HomeFreeBSD

powerpc: Fix copyin/copyout race condition

Description

powerpc: Fix copyin/copyout race condition

It's possible for a context switch, and CPU migration, to occur between
fetching the PCPU context and extracting the pc_curpcb. This can cause
the fault handler to be installed for the wrong thread, leading to a
panic in copyin()/copyout(). Since curthread is already in %r13, just
use that directly, as GPRs are migrated, so there is no migration race
risk.

Details

Provenance
jhibbitsAuthored on Dec 8 2020, 10:49 PM
pkubajCommitted on Dec 30 2020, 10:45 PM
Parents
rG6260bfb08742: powerpc: Optimize copyinstr() to avoid repeatedly mapping user strings
Branches
Unknown
Tags
Unknown