Bug#727009: make x finited hard limit of stacksize

Emilio Pozuelo Monfort pochu at debian.org
Thu Nov 7 10:35:21 UTC 2013


On 07/11/13 09:07, Petr Salinger wrote:
> 
> ulimit -S of stack size:
> linux-i386:     8 MB
> linux-amd64:    8 MB
> kfreebsd-i386:  8 MB
> kfreebsd-amd64: 8 MB
> 
> ulimit -H of stack size:
> linux-i386:     unlimited
> linux-amd64:    unlimited
> kfreebsd-i386:  64 MB
> kfreebsd-amd64: 512 MB
> 
> 
> *******************************
> 
>> From {nptl/fbtl}/nptl-init.c
> 
>   /* Determine the default allowed stack size.  This is the size used
>      in case the user does not specify one.  */
>   struct rlimit limit;
>   if (getrlimit (RLIMIT_STACK, &limit) != 0
>       || limit.rlim_cur == RLIM_INFINITY)
>     /* The system limit is not usable.  Use an architecture-specific
>        default.  */
>     limit.rlim_cur = ARCH_STACK_DEFAULT_SIZE;
>   else if (limit.rlim_cur < PTHREAD_STACK_MIN)
>     /* The system limit is unusably small.
>        Use the minimal size acceptable.  */
>     limit.rlim_cur = PTHREAD_STACK_MIN;
> ...
> 2.17:
>    __default_stacksize = limit.rlim_cur;
> 
> 2.18:
>    __default_pthread_attr.stacksize = limit.rlim_cur;
> 
> For {linux,kfreebsd}-{i386,amd64}
> 
> PTHREAD_STACK_MIN         16 KB
> ARCH_STACK_DEFAULT_SIZE         2 MB
> 
> *******************************
> 
> The make raises soft limit of stack size to hard limit of stack size.
> 
> *******************************
> 
> As a result of above, under linux, each thread needs only 2 MB for its stack,
> while under kfreebsd each thread needs virtual space for either 64 MB or 512 MB.
> 
> It looks like reasonable approach will be to put also upper bound
> to __default_stacksize, let say to 4*ARCH_STACK_DEFAULT_SIZE (= 4*2MB)

Great! I even see you have already committed a fix to eglibc. :-)

Regards,
Emilio



More information about the pkg-gnome-maintainers mailing list