HomeFreeBSD

sched_4bsd: Fix a racy thread state modification

Description

sched_4bsd: Fix a racy thread state modification

When a thread switching off-CPU is migrating to a remote CPU,
sched_switch() may trigger a rescheduling of the thread currently
running on that CPU. When doing so, it must ensure that that thread is
locked before modifying thread state. If the thread's lock is not the
scheduler lock, then the thread is in the process of switching off-CPU
and no extra effort is needed, and the initiator does not hold the
thread's lock and thus should not modify any thread state.

Reported and tested by: Steve Kargl
MFC after: 1 week

Details

Provenance
markjAuthored on Sep 23 2022, 11:41 PM
Parents
rG7652321b7909: rpc.tlsclntd.8: Fix the RFC number now that it exists
Branches
Unknown
Tags
Unknown