Without taking _hurd_siglock, we could be missing the addition of a global
preemptor.

Reported-by: Brent Baccala <[email protected]> 's Claude assistant
---
 hurd/hurdsig.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c
index b202d1fdfc..cb3e04ec0d 100644
--- a/hurd/hurdsig.c
+++ b/hurd/hurdsig.c
@@ -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);
       }
   }
-- 
2.51.0


Reply via email to