[PATCH] Cygwin: sigproc: Avoid segfault caused by signal just after fork().

Takashi Yano takashi.yano@nifty.ne.jp
Fri May 6 18:46:27 GMT 2022


- The commit "Cygwin: always add sigmask to child info" also tries
  to fix this issue, however, did not fix enough. This patch fixes
  that.
---
 winsup/cygwin/sigproc.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index 987dfea37..a70c3b6f6 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -1356,9 +1356,9 @@ wait_sig (VOID *)
 	     when _main_tls points to the system-allocated stack, not to
 	     the parent thread. In that case find_tls fails, and we fetch
 	     the sigmask from the child_info passed from the parent. */
-	  tl_entry = cygheap->find_tls (_main_tls);
-	  if (tl_entry)
+	  if (cygwin_finished_initializing)
 	    {
+	      tl_entry = cygheap->find_tls (_main_tls);
 	      dummy_mask = _main_tls->sigmask;
 	      cygheap->unlock_tls (tl_entry);
 	    }
-- 
2.36.0



More information about the Cygwin-patches mailing list