HomeFreeBSD

vm_fault: Fix a race in vm_fault_soft_fast()

Description

vm_fault: Fix a race in vm_fault_soft_fast()

When vm_fault_soft_fast() creates a mapping, it release the VM map lock
before unbusying the top-level object. Without the map lock, however,
nothing prevents the VM object from being deallocated while still busy.

Fix the problem by unbusying the object before releasing the VM map
lock. If vm_fault_soft_fast() fails to create a mapping, the VM map
lock is not released, so those cases don't need to change.

Reported by: syzkaller
Reviewed by: kib (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D38527

Details

Provenance
markjAuthored on Feb 13 2023, 9:24 PM
Reviewer
kib
Differential Revision
D38527: vm_fault: Fix a race in vm_fault_soft_fast()
Parents
rGc7ea65ec69dd: inpcb: refcount_release() returns a bool
Branches
Unknown
Tags
Unknown