]> 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, 13 Feb 2023 21:35:47 +0000 (16:35 -0500)
commitd0991948182a1a149ee84f1b9c4d3e30450c8f0b
tree88083e21315dfa3b0420dee105539549e23bd62b
parentc7ea65ec69dde90253bd1872fecaeb7c07337f97
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
sys/vm/vm_fault.c