From: deraadt Date: Wed, 25 Jan 2023 23:42:03 +0000 (+0000) Subject: In the previous commit, FIXPROT would upgrade a PROT_NONE mapping too far. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=c74ea1ce49c33a5a0b9c9686e76338d41ee46261;p=openbsd In the previous commit, FIXPROT would upgrade a PROT_NONE mapping too far. Correct the logic, still blocking PROT_EXEC ok anton kettenis --- diff --git a/sys/uvm/uvm_map.c b/sys/uvm/uvm_map.c index f99ac269303..f5c23a642b9 100644 --- a/sys/uvm/uvm_map.c +++ b/sys/uvm/uvm_map.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_map.c,v 1.307 2023/01/24 00:16:08 deraadt Exp $ */ +/* $OpenBSD: uvm_map.c,v 1.308 2023/01/25 23:42:03 deraadt Exp $ */ /* $NetBSD: uvm_map.c,v 1.86 2000/11/27 08:40:03 chs Exp $ */ /* @@ -4469,9 +4469,12 @@ uvm_map_extract(struct vm_map *srcmap, vaddr_t start, vsize_t len, goto fail2_unmap; } kernel_map->size += cp_len; - if (flags & UVM_EXTRACT_FIXPROT) - newentry->protection = newentry->max_protection & - ~PROT_EXEC; + + /* Figure out the best protection */ + if ((flags & UVM_EXTRACT_FIXPROT) && + newentry->protection != PROT_NONE) + newentry->protection = newentry->max_protection; + newentry->protection &= ~PROT_EXEC; /* * Step 2: perform pmap copy.