From e186fc5a31e46f2cbf5ea1a75223b4412907f3d8 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Wed, 24 Nov 2021 08:59:54 +0100 Subject: nptl: Do not set signal mask on second setjmp return [BZ #28607] __libc_signal_restore_set was in the wrong place: It also ran when setjmp returned the second time (after pthread_exit or pthread_cancel). This is observable with blocked pending signals during thread exit. Fixes commit b3cae39dcbfa2432b3f3aa28854d8ac57f0de1b8 ("nptl: Start new threads with all signals blocked [BZ #25098]"). Reviewed-by: Adhemerval Zanella --- nptl/pthread_create.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'nptl') diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c index d6ea43a754..bad9eeb52f 100644 --- a/nptl/pthread_create.c +++ b/nptl/pthread_create.c @@ -406,8 +406,6 @@ start_thread (void *arg) unwind_buf.priv.data.prev = NULL; unwind_buf.priv.data.cleanup = NULL; - __libc_signal_restore_set (&pd->sigmask); - /* Allow setxid from now onwards. */ if (__glibc_unlikely (atomic_exchange_acq (&pd->setxid_futex, 0) == -2)) futex_wake (&pd->setxid_futex, 1, FUTEX_PRIVATE); @@ -417,6 +415,8 @@ start_thread (void *arg) /* Store the new cleanup handler info. */ THREAD_SETMEM (pd, cleanup_jmp_buf, &unwind_buf); + __libc_signal_restore_set (&pd->sigmask); + LIBC_PROBE (pthread_start, 3, (pthread_t) pd, pd->start_routine, pd->arg); /* Run the code the user provided. */ -- cgit 1.4.1