This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug nptl/22636] New: PTHREAD_STACK_MIN is too small on x86-64


https://sourceware.org/bugzilla/show_bug.cgi?id=22636

            Bug ID: 22636
           Summary: PTHREAD_STACK_MIN is too small on x86-64
           Product: glibc
           Version: 2.26
            Status: NEW
          Severity: normal
          Priority: P2
         Component: nptl
          Assignee: unassigned at sourceware dot org
          Reporter: fweimer at redhat dot com
                CC: drepper.fsp at gmail dot com
        Depends on: 11787
  Target Milestone: ---
            Target: x86-64
             Flags: security-

If libgcc is not linked with BIND_NOW, a thread stack size of PTHREAD_STACK_MIN
is not enough to cancel this simple thread:

292     static void*
293     my_pthread_warmup_worker(
294             void *thread_args)
295     {
296             (void)thread_args;
297             for (;;)
298                     sleep(10);
299             return NULL;
300     }

(To be clear: This thread runs with a stack size of PTHREAD_STACK_MIN.)

The reason is that we need space for two XSAVE contents (signal handler and
dynamic linker trampoline for libgcc_s).

Apparently, we subtract the guard page and another page from the 16 KiB
request.  Two XSAVE contexts need around 5 KiB, and the libgcc unwinder
required for cancellation needs quite a bit of stack space as well, so that the
remaining 8 KiB are simply not enough.

Linking libgcc_s with BIND_NOW should reduce stack pressure somewhat, and
fixing the guard size accounting would help as well (bug 11787).


Referenced Bugs:

https://sourceware.org/bugzilla/show_bug.cgi?id=11787
[Bug 11787] Program with large TLS segments fail.
-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]