[hurd, commited] hurd: Check for _hurdsig_preempted_set with _hurd_siglock held

Samuel Thibault <[email protected]>
Newsgroups gmane.os.hurd.cvs,gmane.comp.lib.glibc.alpha
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.