From eb7a374790269fc60599ef8f66df3135a21e35c7 Mon Sep 17 00:00:00 2001 From: deraadt Date: Tue, 24 Jan 2023 00:14:30 +0000 Subject: [PATCH] uvm_map_extract() UVM_EXTRACT_FIXPROT alias mappings are only used for read/write operations, so mask out PROT_EXEC to avoid creating an pointless exec mapping in the kernel. We probably need this masking upon minprot (for the non-UVM_EXTRACT_FIXPROT case) also, but I haven't done a test yet. ok kettenis --- sys/uvm/uvm_map.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/uvm/uvm_map.c b/sys/uvm/uvm_map.c index b59fb8d73af..95a7fb2ab4d 100644 --- a/sys/uvm/uvm_map.c +++ b/sys/uvm/uvm_map.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_map.c,v 1.305 2022/12/18 23:41:17 deraadt Exp $ */ +/* $OpenBSD: uvm_map.c,v 1.306 2023/01/24 00:14:30 deraadt Exp $ */ /* $NetBSD: uvm_map.c,v 1.86 2000/11/27 08:40:03 chs Exp $ */ /* @@ -4470,7 +4470,8 @@ uvm_map_extract(struct vm_map *srcmap, vaddr_t start, vsize_t len, } kernel_map->size += cp_len; if (flags & UVM_EXTRACT_FIXPROT) - newentry->protection = newentry->max_protection; + newentry->protection = newentry->max_protection & + ~PROT_MAX; /* * Step 2: perform pmap copy. -- 2.20.1