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: 195169186b ("Cygwin: wait_sig: allow to compute process-wide mask of pending signals")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2023-01-10 11:45:28 +01:00
parent 1a9f95d894
commit 7c14e5a10a
2 changed files with 5 additions and 1 deletions

View File

@ -10,3 +10,6 @@ Bug Fixes
- Reinstantiate exporting _alloca. - Reinstantiate exporting _alloca.
Addresses: https://cygwin.com/pipermail/cygwin/2023-January/252797.html 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

View File

@ -1375,7 +1375,8 @@ wait_sig (VOID *)
*pack.mask = 0; *pack.mask = 0;
while ((q = q->next)) 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); tl_entry = cygheap->find_tls (q->si.si_signo, issig_wait);
if (tl_entry) if (tl_entry)