[RFC][BZ #16009] Memory handling in strxfrm_l()

Joseph Myers joseph@codesourcery.com
Fri Nov 21 17:22:00 GMT 2014


On Fri, 21 Nov 2014, Leonhard Holz wrote:

> I took a look at __libc_use_alloca and it's just
> 
> extern inline int __libc_use_alloca (size_t size)
> {
>   return size <= __MAX_ALLOCA_CUTOFF;
> }
> 
> Should'nt it consider the currently used stack size to see if there is enough
> stack memory left? Or do I have a too simple idea of OS stack memory
> handling...

The security requirement is simply that pages up to __MAX_ALLOCA_CUTOFF 
(plus non-alloca stack requirements) beyond the current stack pointer must 
either be available for the stack, or must be unmapped so that attempted 
writes to them result in a fatal signal - that alloca can't overflow from 
the stack into other allocated and writable memory regions.

I don't know what guarantees are provided in this regard by the Linux 
kernel / glibc's allocation of thread stacks.

-- 
Joseph S. Myers
joseph@codesourcery.com



More information about the Libc-alpha mailing list