]> sourceware.org Git - newlib-cygwin.git/commitdiff
Cygwin: sigpending: don't report pending signals for other threads
authorCorinna Vinschen <corinna@vinschen.de>
Fri, 12 Jul 2019 15:18:48 +0000 (17:18 +0200)
committerCorinna Vinschen <corinna@vinschen.de>
Fri, 12 Jul 2019 15:27:26 +0000 (17:27 +0200)
The sigpending mechanism failed to check if the pending signal was a
process-wide signal, or a signal for the curent thread.  Fix that by
adding a matching conditional to wait_sig's __SIGPENDING code.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
winsup/cygwin/release/3.1.0
winsup/cygwin/sigproc.cc

index c8fe5556e1148e183dc85959a664ed2fceca8432..3b73a180264fb1dca57b0bcc0ee4834bdeb61ff2 100644 (file)
@@ -37,3 +37,6 @@ Bug Fixes
 
 - Fix a timerfd deadlock.
   Addresses: https://cygwin.com/ml/cygwin/2019-06/msg00096.html
+
+- Fix sigpending() incorrectly returning signals for unrelated threads.
+  Addresses: https://cygwin.com/ml/cygwin/2019-07/msg00051.html
index cba1af785dc6ecdf56d30f751196c68373948e51..900facd58e3ca95c693259b8975df510c5faddbd 100644 (file)
@@ -1335,8 +1335,13 @@ wait_sig (VOID *)
            *pack.mask = 0;
            tl_entry = cygheap->find_tls (pack.sigtls);
            while ((q = q->next))
-             if (pack.sigtls->sigmask & (bit = SIGTOMASK (q->si.si_signo)))
-               *pack.mask |= bit;
+             {
+               /* Skip thread-specific signals for other threads. */
+               if (q->sigtls && pack.sigtls != q->sigtls)
+                 continue;
+               if (pack.sigtls->sigmask & (bit = SIGTOMASK (q->si.si_signo)))
+                 *pack.mask |= bit;
+             }
            cygheap->unlock_tls (tl_entry);
          }
          break;
This page took 0.080582 seconds and 5 git commands to generate.