This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Use malloca instead alloca
> As value allocated on stack is value not allocated on heap this would
> delay this condition. If 4mb were allocated on stack then with
> fragmentation ratio 2 you could allocate additional 2mb until this
> happen.
Sorry, I haven't caught your point. Maybe because my english skill is very poor.
>> Also, signal handlers can be run on alternate stacks with sigaltstack,
>> and it's possible to call non-async-signal-safe functions in libc from
>> such signal handlers as long as you can ensure they did not interrupt
>> unsafe functions. A trivial way to do this is raise().
>>
> This is not big problem. We could change bound from size-32768 to size/2.
> Or additionaly keep counter of memory used my malloca and
> allocate until size/2 is hit.
What's happen if RLIMIT_STACK is infinity? When stack size is large,
your approach
makes SEGV even if using overcommit_memory=2.