about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-02-19 10:51:13 -0500
committerRich Felker <dalias@aerifal.cx>2011-02-19 10:51:13 -0500
commita49c119276742d7d212fb88f83a8f559ca549e72 (patch)
treea7da9765943b2858b98beee765258ae3b69a8ea2
parentfb11b6b85e1e01daf17228be32d7f98b47517363 (diff)
downloadmusl-a49c119276742d7d212fb88f83a8f559ca549e72.tar.gz
musl-a49c119276742d7d212fb88f83a8f559ca549e72.tar.xz
musl-a49c119276742d7d212fb88f83a8f559ca549e72.zip
prevent sigprocmask/pthread_sigmask from blocking implementation signals
this code was wrongly disabled because the old version was trying to
be too clever and didn't work. replaced it with a simple version for
now.
-rw-r--r--src/signal/sigprocmask.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/signal/sigprocmask.c b/src/signal/sigprocmask.c
index e89f8765..db27f12a 100644
--- a/src/signal/sigprocmask.c
+++ b/src/signal/sigprocmask.c
@@ -1,6 +1,7 @@
 #include <signal.h>
 #include "syscall.h"
 #include "libc.h"
+#include "pthread_impl.h"
 
 int __libc_sigprocmask(int how, const sigset_t *set, sigset_t *old)
 {
@@ -10,11 +11,12 @@ int __libc_sigprocmask(int how, const sigset_t *set, sigset_t *old)
 int __sigprocmask(int how, const sigset_t *set, sigset_t *old)
 {
 	sigset_t tmp;
-	/* Quickly mask out bits 32 and 33 (thread control signals) */
-	if (0 && how != SIG_UNBLOCK && (set->__bits[4/sizeof *set->__bits] & 3UL<<(32&8*sizeof *set->__bits-1))) {
+	/* Disallow blocking thread control signals */
+	if (how != SIG_UNBLOCK) {
 		tmp = *set;
 		set = &tmp;
-		tmp.__bits[4/sizeof *set->__bits] &= ~(3UL<<(32&8*sizeof *set->__bits-1));
+		sigdelset(&tmp, SIGCANCEL);
+		sigdelset(&tmp, SIGSYSCALL);
 	}
 	return __libc_sigprocmask(how, set, old);
 }