]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
vm_fault: Fix a race in vm_fault_soft_fast()
authorMark Johnston <markj@FreeBSD.org>
Mon, 13 Feb 2023 21:24:40 +0000 (16:24 -0500)
committerMark Johnston <markj@FreeBSD.org>
Mon, 27 Feb 2023 13:22:33 +0000 (08:22 -0500)
commit2f57ef2d3b8f776a28e195cd780a3bb4924570be
tree638e6966fb486f085ab24bdb3d62a32a8b91ccaf
parent7af6e00d62f3ba75c91146015724b44a05567efe
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)
sys/vm/vm_fault.c