Revert "Cygwin: fix potential SEGV in sigwaitinfo/signalfd scenario"

This reverts commit 92115a83a4.

This was utterly wrong.
This commit is contained in:
Corinna Vinschen 2019-08-16 16:36:20 +02:00
parent 72ff9acad2
commit b7399d5e6f
2 changed files with 3 additions and 17 deletions

View File

@ -1628,7 +1628,7 @@ _cygtls::call_signal_handler ()
if (retaddr () == (__tlsstack_t) sigdelayed) if (retaddr () == (__tlsstack_t) sigdelayed)
pop (); pop ();
debug_only_printf ("dealing with signal %d, handler %p", sig, func); debug_only_printf ("dealing with signal %d", sig);
this_sa_flags = sa_flags; this_sa_flags = sa_flags;
sigset_t this_oldmask = set_process_mask_delta (); sigset_t this_oldmask = set_process_mask_delta ();
@ -1647,12 +1647,8 @@ _cygtls::call_signal_handler ()
ucontext_t *thiscontext = NULL, context_copy; ucontext_t *thiscontext = NULL, context_copy;
/* Only make a context for SA_SIGINFO handlers, only if a handler /* Only make a context for SA_SIGINFO handlers */
exists. If handler is NULL, drop SA_SIGINFO flag to avoid if (this_sa_flags & SA_SIGINFO)
accidental context access later in the function. */
if (!thisfunc)
this_sa_flags &= ~SA_SIGINFO;
else if (this_sa_flags & SA_SIGINFO)
{ {
context.uc_link = 0; context.uc_link = 0;
context.uc_flags = 0; context.uc_flags = 0;
@ -1714,11 +1710,6 @@ _cygtls::call_signal_handler ()
sig = 0; /* Flag that we can accept another signal */ sig = 0; /* Flag that we can accept another signal */
unlock (); /* unlock signal stack */ unlock (); /* unlock signal stack */
/* Handler may be NUll in sigwaitinfo/signalfd scenario. Avoid
crashing by calling a NULL function. */
if (!thisfunc)
goto skip_calling_handler;
/* Alternate signal stack requested for this signal and alternate signal /* Alternate signal stack requested for this signal and alternate signal
stack set up for this thread? */ stack set up for this thread? */
if (this_sa_flags & SA_ONSTACK if (this_sa_flags & SA_ONSTACK
@ -1826,8 +1817,6 @@ _cygtls::call_signal_handler ()
signal handler. */ signal handler. */
thisfunc (thissig, &thissi, thiscontext); thisfunc (thissig, &thissi, thiscontext);
skip_calling_handler:
incyg = true; incyg = true;
set_signal_mask (_my_tls.sigmask, (this_sa_flags & SA_SIGINFO) set_signal_mask (_my_tls.sigmask, (this_sa_flags & SA_SIGINFO)

View File

@ -71,6 +71,3 @@ Bug Fixes
- 64 bit only: Avoid collisions between memory maps created with shmat - 64 bit only: Avoid collisions between memory maps created with shmat
and Windows datastructures during fork. and Windows datastructures during fork.
Addresses: https://cygwin.com/ml/cygwin/2019-08/msg00107.html Addresses: https://cygwin.com/ml/cygwin/2019-08/msg00107.html
- Avoid a SEGV after using signalfd.
Addresses: https://cygwin.com/ml/cygwin/2019-08/msg00148.html