summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2019-04-03 18:14:30 +0200
committerCorinna Vinschen <corinna@vinschen.de>2019-04-03 18:14:30 +0200
commitd3a69d32b1b21b3885d3c8222c0c316be646ddf1 (patch)
treee6c7fe3c0f8c58a4e6bcd72ad8a6f9419e80ca26
parentc4c614046308a55e4b478c3609f05101c1b8e6b6 (diff)
downloadcygnal-d3a69d32b1b21b3885d3c8222c0c316be646ddf1.tar.gz
cygnal-d3a69d32b1b21b3885d3c8222c0c316be646ddf1.tar.bz2
cygnal-d3a69d32b1b21b3885d3c8222c0c316be646ddf1.zip
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 <corinna@vinschen.de>
-rw-r--r--winsup/cygwin/exceptions.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index da4348fdb..a9b378133 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);
}