Subject: Re: ssp and gcc-4.1
To: None <tls@rek.tjls.com>
From: Jason Thorpe <thorpej@shagadelic.org>
List: tech-userlevel
Date: 11/07/2006 10:09:53
On Nov 6, 2006, at 5:39 PM, Thor Lancelot Simon wrote:

> On Tue, Nov 07, 2006 at 02:06:54AM +0200, Mindaugas wrote:
>> Great work, Christos!
>>
>>> 	- malloc vs alloca performance
>> Well, alloca performs much better, but the main problem, that it is  
>> not
>> supported by all platforms, is it?
>
> I'm not sure what you're getting at.  It is certainly the case that we
> conform to the relevant standards by supplying alloca() on all  
> platforms.

Uh, as far as I know, there are NO relevant standards that describe  
alloca(3).

> Most of the problematic code in our kernel is actually calling GCC's
> __builtin_alloca() by way of variable size array declarations.  Some  
> of
> it will be quite tricky to replace with malloc -- e.g. because it is
> in the VM system itself, or because it is called from interrupt  
> context
> but has no graceful way to report an allocation failure.

...and calling alloca() directly also results in a __builtin_alloca()  
most of the time (i.e. unless you've disabled with with a -std=c99  
flag to GCC).  alloca(3) really needs to coordinate with the compiler,  
because of what it does.

Now, one would think that __builtin_alloca() would be OK with ssp --  
after all, the compiler provides both, right?

-- thorpej