summaryrefslogtreecommitdiff
path: root/sys/uvm/uvm_map.c
diff options
context:
space:
mode:
authorKlemens Nanni <kn@cvs.openbsd.org>2022-02-10 10:14:03 +0000
committerKlemens Nanni <kn@cvs.openbsd.org>2022-02-10 10:14:03 +0000
commitbb180ea8a9f82c56b5ef1d42ac28a4165decbe92 (patch)
treef0feab4958ed6a6376d4500bd16443de8b69e280 /sys/uvm/uvm_map.c
parent74e71b7ed589d1c6d413f9be6f774b35eab595cc (diff)
Unwire with map lock held
uvm_unmap_remove() effectively requires its caller to lock the vm map. Even though uvm_map_teardown() is only called after a map's last reference is dropped and is thus safe from other threads accessing the map, grab the map's lock in uvm_map_teardown() to satify upcoming lock assertions in uvm_unmap_remove(). Tested as part of a larger diff through - amd64 package bulk builds by naddy - amd64, arm64, powerpc64 base builds and regress by bluhm - amd64 and sparc64 base builds and regress by me Feedback mpi OK kettenis
Diffstat (limited to 'sys/uvm/uvm_map.c')
-rw-r--r--sys/uvm/uvm_map.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/uvm/uvm_map.c b/sys/uvm/uvm_map.c
index c931418f753..f37e75d038d 100644
--- a/sys/uvm/uvm_map.c
+++ b/sys/uvm/uvm_map.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_map.c,v 1.282 2021/12/21 22:21:32 mpi Exp $ */
+/* $OpenBSD: uvm_map.c,v 1.283 2022/02/10 10:14:02 kn Exp $ */
/* $NetBSD: uvm_map.c,v 1.86 2000/11/27 08:40:03 chs Exp $ */
/*
@@ -2734,6 +2734,7 @@ uvm_map_teardown(struct vm_map *map)
KERNEL_ASSERT_UNLOCKED();
KASSERT((map->flags & VM_MAP_INTRSAFE) == 0);
+ vm_map_lock(map);
/* Remove address selectors. */
uvm_addr_destroy(map->uaddr_exe);