public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: /proc/<PID>/status: avoid crash computing signal info
@ 2023-01-10 10:48 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2023-01-10 10:48 UTC (permalink / raw)
  To: cygwin-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=7c14e5a10add3ad3dc53ed6af1ad2044d205e844

commit 7c14e5a10add3ad3dc53ed6af1ad2044d205e844
Author:     Corinna Vinschen <corinna@vinschen.de>
AuthorDate: Tue Jan 10 11:45:28 2023 +0100
Commit:     Corinna Vinschen <corinna@vinschen.de>
CommitDate: Tue Jan 10 11:48:02 2023 +0100

    Cygwin: /proc/<PID>/status: avoid crash computing signal info
    
    The code computing the mask of pending signals used the per-queued
    signal TLS pointer without checking it for NULL.  Fix this by using
    the process-wide signal mask in that case.
    
    Fixes: 195169186bfd5 ("Cygwin: wait_sig: allow to compute process-wide mask of pending signals")
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/release/3.4.4 | 3 +++
 winsup/cygwin/sigproc.cc    | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/release/3.4.4 b/winsup/cygwin/release/3.4.4
index a653b08a1a40..35d746ba08fd 100644
--- a/winsup/cygwin/release/3.4.4
+++ b/winsup/cygwin/release/3.4.4
@@ -10,3 +10,6 @@ Bug Fixes
 
 - Reinstantiate exporting _alloca.
   Addresses: https://cygwin.com/pipermail/cygwin/2023-January/252797.html
+
+- Avoid hangs when reading /proc/<PID>/status.
+  Addresses: https://cygwin.com/pipermail/cygwin/2022-December/252756.html
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index ce36c8be37fb..86e4e607ab7e 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -1375,7 +1375,8 @@ wait_sig (VOID *)
 	    *pack.mask = 0;
 	    while ((q = q->next))
 	      {
-		if (q->sigtls->sigmask & (bit = SIGTOMASK (q->si.si_signo)))
+		_cygtls *sigtls = q->sigtls ?: _main_tls;
+		if (sigtls->sigmask & (bit = SIGTOMASK (q->si.si_signo)))
 		  {
 		    tl_entry = cygheap->find_tls (q->si.si_signo, issig_wait);
 		    if (tl_entry)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-10 10:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-10 10:48 [newlib-cygwin] Cygwin: /proc/<PID>/status: avoid crash computing signal info Corinna Vinschen

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).