summaryrefslogtreecommitdiff
path: root/sys/uvm/uvm_map.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2023-02-13 14:52:56 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2023-02-13 14:52:56 +0000
commite581c5f98f49311e2ad9233319e8839e474777d0 (patch)
treebae92bf4fe765afaf3d8a76b9a3dbf9d634dfae5 /sys/uvm/uvm_map.c
parentbeaf2a8bac794ec1341f7b7bafd357544e72d193 (diff)
Also lock the map in the execve-driven calls to uvm_map_check_copyin_add()
ok kettenis
Diffstat (limited to 'sys/uvm/uvm_map.c')
-rw-r--r--sys/uvm/uvm_map.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/uvm/uvm_map.c b/sys/uvm/uvm_map.c
index 620cece4f56..71fb9feaeed 100644
--- a/sys/uvm/uvm_map.c
+++ b/sys/uvm/uvm_map.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_map.c,v 1.311 2023/02/13 14:51:49 deraadt Exp $ */
+/* $OpenBSD: uvm_map.c,v 1.312 2023/02/13 14:52:55 deraadt Exp $ */
/* $NetBSD: uvm_map.c,v 1.86 2000/11/27 08:40:03 chs Exp $ */
/*
@@ -4244,6 +4244,7 @@ check_copyin_add(struct vm_map *map, vaddr_t start, vaddr_t end)
if (PMAP_CHECK_COPYIN == 0 ||
map->check_copyin_count >= UVM_MAP_CHECK_COPYIN_MAX)
return;
+ vm_map_assert_wrlock(map);
map->check_copyin[map->check_copyin_count].start = start;
map->check_copyin[map->check_copyin_count].end = end;
membar_producer();
@@ -4265,7 +4266,9 @@ uvm_map_check_copyin_add(struct vm_map *map, vaddr_t start, vaddr_t end)
end = MIN(end, map->max_offset);
if (start >= end)
return 0;
+ vm_map_lock(map);
check_copyin_add(map, start, end);
+ vm_map_unlock(map);
return (0);
}
#endif /* PMAP_CHECK_COPYIN */