[PATCH v3 0/3] Three fixes for signal handling

2025-02-28 Thread Takashi Yano
Takashi Yano (3): Cygwin: signal: Fix deadlock on SIGCONT Cygwin: signal: Fix a race issue on modifying _pinfo::process_state Cygwin: signal: Fix a problem that process hangs on exit [<= revised] winsup/cygwin/exceptions.cc | 31 winsup/cygwin/fork.cc

[PATCH v3 3/3] Cygwin: signal: Fix a problem that process hangs on exit

2025-02-28 Thread Takashi Yano
The process that receives many SIGSTOP/SIGCONT signals sometimes hangs on exit in sig_dispatch_pending(). This patch skips processing signals in call_signal_handler() when exit_state > ES_EXIT_STARTING to avoid that situation. Addresses: https://cygwin.com/pipermail/cygwin/2025-February/257473.htm

[PATCH v3 1/3] Cygwin: signal: Fix deadlock on SIGCONT

2025-02-28 Thread Takashi Yano
If SIGCONT starts processing while __SIGFLUSHFAST is ongoing, _main_tls->current_sig will never be cleared because the signal processing is stopped while waiting for the wake-up event in the main thread. This leads to a deadlock in the while loop waiting for current_sig to be cleared. With this pat

[PATCH v3 2/3] Cygwin: signal: Fix a race issue on modifying _pinfo::process_state

2025-02-28 Thread Takashi Yano
The PID_STOPPED flag in _ponfo::process_state is sometimes accidentally cleared due to a race condition when modifying it with the "|=" or "&=" operators. This patch uses InterlockedOr/And() instead to avoid the race condition. Addresses: https://cygwin.com/pipermail/cygwin/2025-February/257473.ht

[PATCH v2 2/3] Cygwin: signal: Fix a race issue on modifying _pinfo::process_state

2025-02-28 Thread Takashi Yano
The PID_STOPPED flag in _ponfo::process_state is sometimes accidentally cleared due to a race condition when modifying it with the "|=" or "&=" operators. This patch uses InterlockedOr/And() instead to avoid the race condition. Addresses: https://cygwin.com/pipermail/cygwin/2025-February/257473.ht

[PATCH v2 0/3] Three fixes for signal handling

2025-02-28 Thread Takashi Yano
Takashi Yano (3): Cygwin: signal: Fix deadlock on SIGCONT Cygwin: signal: Fix a race issue on modifying _pinfo::process_state Cygwin: signal: Fix a problem that process hangs on exit [<= revised] winsup/cygwin/exceptions.cc | 29 winsup/cygwin/fork.cc

[PATCH v2 1/3] Cygwin: signal: Fix deadlock on SIGCONT

2025-02-28 Thread Takashi Yano
If SIGCONT starts processing while __SIGFLUSHFAST is ongoing, _main_tls->current_sig will never be cleared because the signal processing is stopped while waiting for the wake-up event in the main thread. This leads to a deadlock in the while loop waiting for current_sig to be cleared. With this pat

[PATCH v2 3/3] Cygwin: signal: Fix a problem that process hangs on exit

2025-02-28 Thread Takashi Yano
The process that receives many SIGSTOP/SIGCONT signals sometimes hangs on exit in sig_dispatch_pending(). This patch skips processing signals in wait_sig() when exit_state > ES_EXIT_STARTING to avoid that situation. Addresses: https://cygwin.com/pipermail/cygwin/2025-February/257473.html Fixes: d2

[PATCH 0/3] A few fixes for signal handling

2025-02-28 Thread Takashi Yano
Takashi Yano (3): Cygwin: signal: Fix deadlock on SIGCONT Cygwin: signal: Fix a race issue on modifying _pinfo::process_state Cygwin: signal: Fix a problem that process hangs on exit winsup/cygwin/exceptions.cc | 29 winsup/cygwin/fork.cc

[PATCH 1/3] Cygwin: signal: Fix deadlock on SIGCONT

2025-02-28 Thread Takashi Yano
If SIGCONT starts processing while __SIGFLUSHFAST is ongoing, _main_tls->current_sig will never be cleared because the signal processing is stopped while waiting for the wake-up event in the main thread. This leads to a deadlock in the while loop waiting for current_sig to be cleared. With this pat

[PATCH 2/3] Cygwin: signal: Fix a race issue on modifying _pinfo::process_state

2025-02-28 Thread Takashi Yano
The PID_STOPPED flag in _ponfo::process_state is sometimes accidentally cleared due to a race condition when modifying it with the "|=" or "&=" operators. This patch uses InterlockedOr/And() instead to avoid the race condition. Addresses: https://cygwin.com/pipermail/cygwin/2025-February/257473.ht

[PATCH 3/3] Cygwin: signal: Fix a problem that process hangs on exit

2025-02-28 Thread Takashi Yano
The process that receives many SIGSTOP/SIGCONT signals sometimes hangs on exit in sig_dispatch_pending(). This patch avoids processing signals in sig_dispatch_pending() as if __SIGFLASHFAST is used. Addresses: https://cygwin.com/pipermail/cygwin/2025-February/257473.html Fixes: d243e51ef1d3 ("Cygw