[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dangerous use of alloca

From: Agustina Arzille
Subject: Re: Dangerous use of alloca
Date: Tue, 15 Mar 2016 11:44:13 -0300

Hello, Justus,

On 2016-03-15 10:39, Justus Winter wrote:

Quoting Agustina Arzille (2016-03-15 14:11:27)
Hello, everyone.

I was browsing some gnumach source files, and noticed some dangerous use of the gcc builtin 'alloca'. In the file kern/bootstrap.c, lines 212 and
228, we have the following statement:

memcpy (alloca (len), ...)

Good catch.  However, alloca is dangerous even if used correctly, and
is best be avoided.  Would you be so kind to prepare a patch to that


Sure. I will cook up a patch when I get home. Right now, the alternatives
to using alloca that I can think of are either:
1) A global buffer with a fixed size, or
2) 'kalloc' and friends.

Obviously, (2) would be the preferred option, but I'm not sure if it's
completely available during bootstrap. What do you guys think?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]