public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: signals: restore sigmask from context given to signal handler
@ 2019-04-03 16:19 Corinna Vinschen
0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2019-04-03 16:19 UTC (permalink / raw)
To: cygwin-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=d3a69d32b1b21b3885d3c8222c0c316be646ddf1
commit d3a69d32b1b21b3885d3c8222c0c316be646ddf1
Author: Corinna Vinschen <corinna@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 <corinna@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);
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-04-03 16:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-03 16:19 [newlib-cygwin] Cygwin: signals: restore sigmask from context given to signal handler Corinna Vinschen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).