aboutsummaryrefslogtreecommitdiff
path: root/nptl/cond-perf.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2020-04-27 09:55:10 +0200
committerFlorian Weimer <fweimer@redhat.com>2020-04-27 10:04:24 +0200
commitb3cae39dcbfa2432b3f3aa28854d8ac57f0de1b8 (patch)
tree1e2b2d44b6682b12375a48465f04fcca96634593 /nptl/cond-perf.c
parent92954ffa5a5662fbfde14febd7e5dcc358c85470 (diff)
downloadglibc-b3cae39dcbfa2432b3f3aa28854d8ac57f0de1b8.zip
glibc-b3cae39dcbfa2432b3f3aa28854d8ac57f0de1b8.tar.gz
glibc-b3cae39dcbfa2432b3f3aa28854d8ac57f0de1b8.tar.bz2
nptl: Start new threads with all signals blocked [BZ #25098]
New threads inherit the signal mask from the current thread. This means that signal handlers can run on the newly created thread immediately after the kernel has created the userspace thread, even before glibc has initialized the TCB. Consequently, new threads can observe uninitialized ctype data, among other things. To address this, block all signals before starting the thread, and pass the original signal mask to the start routine wrapper. On the new thread, first perform all thread initialization, and then unblock signals. The cost of doing this is two rt_sigprocmask system calls on the old thread, and one rt_sigprocmask system call on the new thread. (If there was a way to clone a new thread with a signals disabled, this could be brought down to one system call each.) The thread descriptor increases in size, too, and sigset_t is fairly large. This increase could be brought down by reusing space the in the descriptor which is not needed before running user code, or by switching to an internal sigset_t definition which only covers the signals supported by the kernel definition. (Part of the thread descriptor size increase is already offset by reduced stack usage in the thread start wrapper routine after this commit.) Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'nptl/cond-perf.c')
0 files changed, 0 insertions, 0 deletions