HomeFreeBSD

vmm: take exclusive mem_segs_lock in vm_cleanup()

Description

vmm: take exclusive mem_segs_lock in vm_cleanup()

The consumers of vm_cleanup() are vm_reinit() and vm_destroy().

The vm_reinit() call path is, here vmmdev_ioctl() takes mem_segs_lock:

vmmdev_ioctl()
vm_reinit()
vm_cleanup(destroy=false)

The call path for vm_destroy() is (mem_segs_lock not taken):

sysctl_vmm_destroy()
vmmdev_destroy()
vm_destroy()
vm_cleanup(destroy=true)

Fix this by taking mem_segs_lock in vm_cleanup() when destroy == true.

Reviewed by: corvink, markj, jhb
Fixes: 67b69e76e8ee ("vmm: Use an sx lock to protect the memory map.")
Differential Revision: https://reviews.freebsd.org/D38071

(cherry picked from commit c668e8173a8fc047b54a5c51b0fe4637e87836b6)

Details

Provenance
rewAuthored on Jan 20 2023, 11:10 AM
jhbCommitted on Jan 26 2023, 10:05 PM
Reviewer
rG67b69e76e8ee: vmm: Use an sx lock to protect the memory map.
Differential Revision
D38071: vmm: take exclusive mem_segs_lock in vm_cleanup()
Parents
rGeb37d3cc565e: vmm: take exclusive mem_segs_lock when (un)assigning ppt dev
Branches
Unknown
Tags
Unknown