From aea972f1c099519d2a6c25e8ab0ac69486b22961 Mon Sep 17 00:00:00 2001 From: deraadt Date: Mon, 13 Feb 2023 14:51:49 +0000 Subject: [PATCH] Upon fork, copy the copyin_check structure to the new map, otherwise the xonly rules are not applied a child. This was due to the same misunderstanding as with msyscall a few days ago. ok guenther kettenis --- sys/uvm/uvm_map.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sys/uvm/uvm_map.c b/sys/uvm/uvm_map.c index 7ee39c71838..620cece4f56 100644 --- a/sys/uvm/uvm_map.c +++ b/sys/uvm/uvm_map.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_map.c,v 1.310 2023/02/11 21:11:37 deraadt Exp $ */ +/* $OpenBSD: uvm_map.c,v 1.311 2023/02/13 14:51:49 deraadt Exp $ */ /* $NetBSD: uvm_map.c,v 1.86 2000/11/27 08:40:03 chs Exp $ */ /* @@ -3983,6 +3983,14 @@ uvmspace_fork(struct process *pr) } } new_map->flags |= old_map->flags & VM_MAP_SYSCALL_ONCE; +#ifdef PMAP_CHECK_COPYIN + if (PMAP_CHECK_COPYIN) { + memcpy(&new_map->check_copyin, &old_map->check_copyin, + sizeof(new_map->check_copyin)); + membar_producer(); + new_map->check_copyin_count = old_map->check_copyin_count; + } +#endif vm_map_unlock(old_map); vm_map_unlock(new_map); -- 2.20.1