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.

Approved by: re (cperciva)
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)
(cherry picked from commit 2f57ef2d3b8f776a28e195cd780a3bb4924570be)

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
rGd0e8ce556627: 13.2: update to BETA3
Branches
Unknown
Tags
Unknown