https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=d3a69d32b1b21b3885d3c8222c0c316be646ddf1
commit d3a69d32b1b21b3885d3c8222c0c316be646ddf1 Author: Corinna Vinschen <cori...@vinschen.de> Date: Wed Apr 3 18:14:30 2019 +0200 Cygwin: signals: restore sigmask from context given to signal handler In case SA_SIGINFO flag is given, the signal handler may change the context and the application is supposed to pick up from the changed context. So far we don't do that, so the context given to the signal handler is basically read-only, unless the signal handler calls setcontext or swapcontext. For a start, restore the thread's signal mask from the uc_sigmask value of the context given to the signal handler. If that's feasible for Cygwin, we restore the entire context from the context changed by the signal handler in a followup patch. Signed-off-by: Corinna Vinschen <cori...@vinschen.de> Diff: --- winsup/cygwin/exceptions.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index da4348f..a9b3781 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -1818,7 +1818,8 @@ _cygtls::call_signal_handler () incyg = true; - set_signal_mask (_my_tls.sigmask, this_oldmask); + set_signal_mask (_my_tls.sigmask, (this_sa_flags & SA_SIGINFO) + ? context.uc_sigmask : this_oldmask); if (this_errno >= 0) set_errno (this_errno); }