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

(cherry picked from commit d0991948182a1a149ee84f1b9c4d3e30450c8f0b)

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
rG7af6e00d62f3: netlink: fix NOINET6 build.
Branches
Unknown
Tags
Unknown