From: Rich Felker Date: Tue, 17 Mar 2015 00:12:49 +0000 (-0400) Subject: block all signals (even internal ones) in cancellation signal handler X-Git-Tag: v1.1.7~2 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=76fd01177a32d602bc5ee7bd7ba65316adbae611;p=oweals%2Fmusl.git block all signals (even internal ones) in cancellation signal handler previously the implementation-internal signal used for multithreaded set*id operations was left unblocked during handling of the cancellation signal. however, on some archs, signal contexts are huge (up to 5k) and the possibility of nested signal handlers drastically increases the minimum stack requirement. since the cancellation signal handler will do its job and return in bounded time before possibly passing execution to application code, there is no need to allow other signals to interrupt it. --- diff --git a/src/thread/pthread_cancel.c b/src/thread/pthread_cancel.c index 1b71aa42..a507f923 100644 --- a/src/thread/pthread_cancel.c +++ b/src/thread/pthread_cancel.c @@ -1,3 +1,4 @@ +#include #include "pthread_impl.h" #include "syscall.h" #include "libc.h" @@ -80,7 +81,7 @@ static void init_cancellation() .sa_flags = SA_SIGINFO | SA_RESTART, .sa_sigaction = cancel_handler }; - sigfillset(&sa.sa_mask); + memset(&sa.sa_mask, -1, _NSIG/8); __libc_sigaction(SIGCANCEL, &sa, 0); }