]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
htl: Make __pthread_sigmask directly call __sigthreadmask
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Wed, 5 Mar 2025 23:14:06 +0000 (00:14 +0100)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Thu, 6 Mar 2025 01:28:35 +0000 (02:28 +0100)
If no thread was created yet, __pthread_sigstate will not find our ss
because self->kernel_thread is still nul, and then change the global
sigstate instead of our sigstate! We can directly call __sigthreadmask and
skip the (bogus) lookup step.

htl/pt-sigmask.c
sysdeps/mach/hurd/sigthreadmask.c

index 7b2622c317019d3e98966ac24148eeab6b1ae881..e00a3fa4eb07b29ee556e479390e083cf3f44924 100644 (file)
 #include <pthread.h>
 #include <signal.h>
 #include <shlib-compat.h>
+#include <hurd/signal.h>
 #include <pt-internal.h>
 
 int
 __pthread_sigmask (int how, const sigset_t *set, sigset_t *oset)
 {
-  struct __pthread *self = _pthread_self ();
-
   /* Do not clear SELF's pending signals.  */
-  return __pthread_sigstate (self, how, set, oset, 0);
+  return __sigthreadmask (_hurd_self_sigstate (), how, set, oset, 0);
 }
 libc_hidden_def (__pthread_sigmask)
 versioned_symbol (libc, __pthread_sigmask, pthread_sigmask, GLIBC_2_41);
index d8e928b2a59587bb79d97f230fd65a751a9335a0..9b4f530e11cfe53147448201d20e00cb3939f7b3 100644 (file)
@@ -36,6 +36,8 @@ __sigthreadmask (struct hurd_sigstate *ss, int how,
     new = *set;
 
   assert (ss);
+  /* We are not supposed to change the global blocked state */
+  assert (ss != _hurd_global_sigstate);
 
   _hurd_sigstate_lock (ss);