public inbox for cygwin-cvs@sourceware.org help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org> To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: sigpending: don't report pending signals for other threads Date: Fri, 12 Jul 2019 15:27:00 -0000 [thread overview] Message-ID: <20190712152753.4462.qmail@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=bae987be12b12b18a4e7952a25dba2101f5da1d6 commit bae987be12b12b18a4e7952a25dba2101f5da1d6 Author: Corinna Vinschen <corinna@vinschen.de> Date: Fri Jul 12 17:18:48 2019 +0200 Cygwin: sigpending: don't report pending signals for other threads 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> Diff: --- winsup/cygwin/release/3.1.0 | 3 +++ winsup/cygwin/sigproc.cc | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/release/3.1.0 b/winsup/cygwin/release/3.1.0 index c8fe555..3b73a18 100644 --- a/winsup/cygwin/release/3.1.0 +++ b/winsup/cygwin/release/3.1.0 @@ -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 diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index cba1af7..900facd 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -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;
reply other threads:[~2019-07-12 15:27 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190712152753.4462.qmail@sourceware.org \ --to=corinna@sourceware.org \ --cc=cygwin-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).