On 06/03/2025 11:12, Corinna Vinschen wrote:
On Mar  6 20:02, Takashi Yano wrote:
The commit 3c1308ed890e adds a guard to stop signal handling on exit()
in call_signal_handler(). However, the signal that is already queued
but does not use signal handler may be going to process even with that
patch.
This patch add one more guard at the begining of sigpacket::process()
to avoid that situation.

Fixes: 3c1308ed890e ("Cygwin: signal: Fix a problem that process hangs on exit")
Reviewed-by:
Signed-off-by: Takashi Yano <takashi.y...@nifty.ne.jp>
---
  winsup/cygwin/exceptions.cc | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index 759f89dca..a67529b19 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -1457,7 +1457,7 @@ sigpacket::process ()
/* Don't try to send signals if we're just starting up since signal masks
       may not be available.  */

Looks like this comment should be updated? Maybe just "starting up or shutting down"? Or the reason why sending signal while shutting down is unsafe?

-  if (!cygwin_finished_initializing)
+  if (!cygwin_finished_initializing || ext_state > ES_EXIT_STARTING)
      {
        rc = -1;
        goto done;
--
2.45.1

Makes sense, please push.

Reply via email to