[PATCH] Use malloca instead alloca

KOSAKI Motohiro kosaki.motohiro@gmail.com
Sun Dec 30 22:59:00 GMT 2012


> x86 version
> linux/arch/x86/mm/mmap.c
> -----------------------------------------------------------------
> static unsigned long mmap_base(void)
> {
>    unsigned long gap = rlimit(RLIMIT_STACK);
>
>   if (gap < MIN_GAP)
>     gap = MIN_GAP;
>   else if (gap > MAX_GAP)
>     gap = MAX_GAP;
>
>   return PAGE_ALIGN(TASK_SIZE - gap - mmap_rnd());
> }

One more thing. mmap_base is calculated at process creation time. However
RLIMIT_STACK is used when actual stack expansion. then weird scenario might
occur when process changes RLIMIT_STACK dynamically.



More information about the Libc-alpha mailing list