Handles the masked signal when the thread exits
Florian Weimer
fweimer@redhat.com
Thu Nov 18 19:10:55 GMT 2021
* Gibeom Gwon:
> I hit Ctrl+C in the middle of running signal program. You can see
> ^C and sigint:.. printed in my result.
I see it now. It's a real bug. It only happens with cancellation.
Would yo umind filing a bug here?
<https://sourceware.org/bugzilla/enter_bug.cgi?product=glibc&component=nptl>
The fix should look something like this:
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. */
Thanks,
Florian
More information about the Libc-help
mailing list