Bug#343853: Bug in glibc: setrlimit
On Sun, Dec 18, 2005 at 04:31:52AM -0500, Gene Cooperman wrote:
> The details of the bug are in BUG-glibc/README in the tarball. In brief,
> using setrlimit on RLIM_STACK, I set rlim_max to RLIM_INFINITY and rlim_cur
> to something unnaturally high (e.g. 2 GB). I then call
> system("./pthread"), where pthread is a program that calls
> pthread_create(). pthread_create() then fails and the pthread process returns:pthread: Cannot allocate memory
> pthread: pthread.c:22: main: Assertion `0 == pthread_retval' failed.
This sounds to me like a feature, not a bug. If the rlimit is
unlimited a default is used; otherwise, it is used as the stack size
for new threads. This happens during program initialization, before
main is called.
If you need a different stack size than your non-infinite RLIM_STACK
setting, you can specify the stack size explicitly when you create the
thread.
--
Daniel Jacobowitz
CodeSourcery, LLC
Reply to: