summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Felker <[email protected]>2024-12-13 11:41:54 +0000
committerRich Felker <[email protected]>2024-12-13 11:41:54 +0000
commit561cd07dff8003251729569e5539b00698941697 (patch)
treef6c35c8474ea55c21a795eae4843841c4d79944d
parent47fa6e4fcc5f61c365c91a9bc90e7ed8b3a178ef (diff)
downloadmusl-561cd07dff8003251729569e5539b00698941697.tar.gz
SIGEV_THREAD timers: re-block signals when reusing kernel thread
previously, we left any changes made by the application to the timer thread's signal mask active when resetting the thread state for reuse. not only did this violate the intended invariant that timer threads start with all signals blocked; it also allowed application code to execute in a thread that, formally, did not exist. and further, if the internal SIGTIMER signal became unblocked, it could also lead to missed timer expiration events.
-rw-r--r--src/time/timer_create.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/time/timer_create.c b/src/time/timer_create.c
index 2d8a62bd..cc6c2236 100644
--- a/src/time/timer_create.c
+++ b/src/time/timer_create.c
@@ -30,6 +30,8 @@ static void cleanup_fromsig(void *p)
{
pthread_t self = __pthread_self();
__pthread_tsd_run_dtors();
+ __block_app_sigs(0);
+ __syscall(SYS_rt_sigprocmask, SIG_BLOCK, SIGTIMER_SET, 0, _NSIG/8);
self->cancel = 0;
self->cancelbuf = 0;
self->canceldisable = 0;
OSZAR »