When sending ignored signal, arrange for zero return code from sleep
Otherwise consumers get unexpected EINTR errors without seeing a properly discarded signal. Reported and tested by: trasz Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32252
This commit is contained in:
parent
b599982b65
commit
f17eb93d55
@ -2214,17 +2214,20 @@ tdsendsignal(struct proc *p, struct thread *td, int sig, ksiginfo_t *ksi)
|
|||||||
return (ret);
|
return (ret);
|
||||||
} else {
|
} else {
|
||||||
action = SIG_CATCH;
|
action = SIG_CATCH;
|
||||||
|
intrval = 0;
|
||||||
}
|
}
|
||||||
} else if (SIGISMEMBER(td->td_sigmask, sig))
|
} else {
|
||||||
action = SIG_HOLD;
|
if (SIGISMEMBER(td->td_sigmask, sig))
|
||||||
else if (SIGISMEMBER(ps->ps_sigcatch, sig))
|
action = SIG_HOLD;
|
||||||
action = SIG_CATCH;
|
else if (SIGISMEMBER(ps->ps_sigcatch, sig))
|
||||||
else
|
action = SIG_CATCH;
|
||||||
action = SIG_DFL;
|
else
|
||||||
if (SIGISMEMBER(ps->ps_sigintr, sig))
|
action = SIG_DFL;
|
||||||
intrval = EINTR;
|
if (SIGISMEMBER(ps->ps_sigintr, sig))
|
||||||
else
|
intrval = EINTR;
|
||||||
intrval = ERESTART;
|
else
|
||||||
|
intrval = ERESTART;
|
||||||
|
}
|
||||||
mtx_unlock(&ps->ps_mtx);
|
mtx_unlock(&ps->ps_mtx);
|
||||||
|
|
||||||
if (prop & SIGPROP_CONT)
|
if (prop & SIGPROP_CONT)
|
||||||
|
@ -1126,7 +1126,7 @@ sleepq_abort(struct thread *td, int intrval)
|
|||||||
THREAD_LOCK_ASSERT(td, MA_OWNED);
|
THREAD_LOCK_ASSERT(td, MA_OWNED);
|
||||||
MPASS(TD_ON_SLEEPQ(td));
|
MPASS(TD_ON_SLEEPQ(td));
|
||||||
MPASS(td->td_flags & TDF_SINTR);
|
MPASS(td->td_flags & TDF_SINTR);
|
||||||
MPASS(intrval == EINTR || intrval == ERESTART);
|
MPASS(intrval == 0 || intrval == EINTR || intrval == ERESTART);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the TDF_TIMEOUT flag is set, just leave. A
|
* If the TDF_TIMEOUT flag is set, just leave. A
|
||||||
|
Loading…
Reference in New Issue
Block a user