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>
This commit is contained in:
Corinna Vinschen 2019-04-03 18:14:30 +02:00
parent c4c6140463
commit d3a69d32b1

View File

@ -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);
}