]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
hurd: Check for _hurdsig_preempted_set with _hurd_siglock held
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Sun, 8 Mar 2026 02:10:00 +0000 (02:10 +0000)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Sun, 8 Mar 2026 10:41:29 +0000 (11:41 +0100)
Without taking _hurd_siglock, we could be missing the addition of a global
preemptor.

Reported-by: Brent Baccala <cosine@freesoft.org> 's Claude assistant
hurd/hurdsig.c

index b202d1fdfcc025b0f08f6e2c9c684b78b3fc61e0..cb3e04ec0d72cf77c32babc03b0f469e6256df46 100644 (file)
@@ -765,10 +765,11 @@ post_signal (struct hurd_sigstate *ss,
     handler = ss->preemptors ? try_preemptor (ss->preemptors) : SIG_ERR;
 
     /* If no thread-specific preemptor, check for a global one.  */
-    if (handler == SIG_ERR && __sigismember (&_hurdsig_preempted_set, signo))
+    if (handler == SIG_ERR)
       {
        __mutex_lock (&_hurd_siglock);
-       handler = try_preemptor (_hurdsig_preemptors);
+       if (__sigismember (&_hurdsig_preempted_set, signo))
+         handler = try_preemptor (_hurdsig_preemptors);
        __mutex_unlock (&_hurd_siglock);
       }
   }