Bug 13088 - SIGEV_THREAD POSIX timer fails with EAGAIN in programs with large TLS segment
Summary: SIGEV_THREAD POSIX timer fails with EAGAIN in programs with large TLS segment
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: nptl (show other bugs)
Version: 2.14
: P2 normal
Target Milestone: ---
Assignee: Ulrich Drepper
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-13 16:50 UTC by Alexander Korobka
Modified: 2014-06-27 12:32 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Korobka 2011-08-13 16:50:35 UTC
This problem is similar to the issue 11787.

The culprit here is the __start_helper_thread() function in nptl/sysdeps/unix/sysv/linux/timer_routines.c, which tries to create a thread with the stack size attribute fixed at PTHREAD_STACK_MIN (16K). As a result, call to pthread_create() fails when allocating thread stack in nptl/allocatestack.c if the TLS segment does not fit this artificial size constraint.
Comment 1 Rich Felker 2011-08-14 00:01:53 UTC
I would say the bug is that glibc/NPTL treats the stack size attribute as the total size it should allocate, rather than as the size for actual STACK. If it always allocated the requested stack size PLUS the amount needed for TLS, the thread structure, and any other associated data, then this situation could not arise.
Comment 2 Ulrich Drepper 2011-12-23 03:44:30 UTC
I added a patch.