bug-hurd
[Top][All Lists]
Advanced

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

Re: Dangerous use of alloca


From: Justus Winter
Subject: Re: Dangerous use of alloca
Date: Tue, 15 Mar 2016 19:18:15 +0100
User-agent: alot/0.3.8.dev

Quoting Samuel Thibault (2016-03-15 18:30:16)
> Justus Winter, on Tue 15 Mar 2016 18:10:18 +0100, wrote:
> > Quoting Samuel Thibault (2016-03-15 17:31:53)
> > > Justus Winter, on Tue 15 Mar 2016 14:39:00 +0100, 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.
> > > 
> > > What do you mean by "dangerous"?  I don't think we'll ever get a command
> > > line that does not fit into the stack.
> > 
> > I don't see why not actually, unless grub limits this somehow O:-)
> 
> It doesn't indeed, so it is definitely possible; I just don't see
> anybody typing a 4096-characters command line :)

Not typing of course, but I'm pretty sure the grub scripting language
is turing complete, and I can actually picture a use case: Serialize
the grub environment and pass it on to the boot shell which can make
further use of it.

Justus



reply via email to

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