-/* $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 $ */
/*
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.