HomeFreeBSD

sleepq_catch_signals: do thread suspension before signal check

Description

sleepq_catch_signals: do thread suspension before signal check

Since locks are dropped when a thread suspends, it's possible for another
thread to deliver a signal to the suspended thread. If the thread awakens from
suspension without checking for signals, it may go to sleep despite having
a pending signal that should wake it up. Therefore the suspension check is
done first, so any signals sent while suspended will be caught in the
subsequent signal check.

Reviewed by: kib
Approved by: kib (mentor)
MFC after: 2 weeks
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D9530

Details

Provenance
badgerAuthored on
Reviewer
kib
Differential Revision
D9530: thread_suspend_check: don't sleep if return_instead is 1
Parents
rS313732: bhyve: whitespace fix for r313727
Branches
Unknown
Tags
Unknown