Commit 39373fe
committed
Cygwin: signal: Do not handle signals while waiting for wakeup evt
... Otherwise, the opportunity for cleanup the wakeup event handle etc.
may be lost because the user signal handler never returns if it calls
longjmp(). This results in handle leak because the wakeup event handle
will not be closed. This issue happens when the commnad e.g. "stress-ng
--mprotect 1 -t 5" is executed. Instead, call call_signal_handler()
after cleaning up if some signals are armed during waiting wakeup event.
This essentially reverts the commit d243e51, however, the deadlock
fixed by that commit no longer occurs even reverting it for some reason.
This is probably due to the redesign of the signal queue.
In addition, do not touch "incyg" flag in _cygtls::call_signal_handler()
because the process is still in the cygwin function when a user signal
handler is called from the cygwin functions such as cygwait().
Addresses: https://sourceware.org/pipermail/cygwin/2025-March/257726.html
Fixes: d243e51 ("Cygwin: signal: Fix deadlock between main thread and sig thread")
Fixes: 3a1ccfc ("* exceptions.cc (setup_handler): Remove locked flag. Use 'incyg' flag and in_exception function to determine when we're in a cygwin function.")
Reported-by: Christian Franke <[email protected]>
Signed-off-by: Takashi Yano <[email protected]>
(cherry picked from commit 68991cd)1 parent 2b98cc8 commit 39373fe
2 files changed
+11
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1756 | 1756 | | |
1757 | 1757 | | |
1758 | 1758 | | |
1759 | | - | |
1760 | 1759 | | |
1761 | 1760 | | |
1762 | 1761 | | |
| |||
1869 | 1868 | | |
1870 | 1869 | | |
1871 | 1870 | | |
1872 | | - | |
1873 | | - | |
1874 | 1871 | | |
1875 | 1872 | | |
1876 | 1873 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
611 | 611 | | |
612 | 612 | | |
613 | 613 | | |
614 | | - | |
| 614 | + | |
615 | 615 | | |
616 | 616 | | |
617 | 617 | | |
| |||
762 | 762 | | |
763 | 763 | | |
764 | 764 | | |
765 | | - | |
766 | | - | |
767 | | - | |
768 | 765 | | |
769 | 766 | | |
770 | 767 | | |
771 | | - | |
| 768 | + | |
772 | 769 | | |
773 | 770 | | |
774 | 771 | | |
| |||
791 | 788 | | |
792 | 789 | | |
793 | 790 | | |
794 | | - | |
| 791 | + | |
795 | 792 | | |
796 | 793 | | |
797 | 794 | | |
| |||
807 | 804 | | |
808 | 805 | | |
809 | 806 | | |
810 | | - | |
811 | | - | |
| 807 | + | |
| 808 | + | |
812 | 809 | | |
813 | 810 | | |
814 | 811 | | |
| |||
843 | 840 | | |
844 | 841 | | |
845 | 842 | | |
846 | | - | |
| 843 | + | |
847 | 844 | | |
848 | 845 | | |
849 | 846 | | |
| |||
874 | 871 | | |
875 | 872 | | |
876 | 873 | | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
877 | 879 | | |
878 | 880 | | |
879 | 881 | | |
| |||
0 commit comments