summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2024-01-21 00:23:30 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2024-01-21 00:23:30 +0000
commit5ab80022cffe4554ab9d653d6a7cf9abbae1c1ac (patch)
treefa0d7105f571346c380944a2f2b4e437217dd6d0
parent12efaab926996354b2530a129962bf33180ae82b (diff)
some bizzare glitch related to ramdisk instbin static binaries, their
mutable mapping is not working right, so temporarily bring back the RW -> R *only* for ramdisk kernels
-rw-r--r--sys/uvm/uvm_map.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/sys/uvm/uvm_map.c b/sys/uvm/uvm_map.c
index 5078f3a229d..c877457db64 100644
--- a/sys/uvm/uvm_map.c
+++ b/sys/uvm/uvm_map.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_map.c,v 1.321 2024/01/20 13:19:39 deraadt Exp $ */
+/* $OpenBSD: uvm_map.c,v 1.322 2024/01/21 00:23:29 deraadt Exp $ */
/* $NetBSD: uvm_map.c,v 1.86 2000/11/27 08:40:03 chs Exp $ */
/*
@@ -3145,8 +3145,17 @@ uvm_map_protect(struct vm_map *map, vaddr_t start, vaddr_t end,
continue;
if (checkimmutable && (iter->etype & UVM_ET_IMMUTABLE)) {
- error = EPERM;
- goto out;
+#ifdef SMALL_KERNEL
+ if (iter->protection == (PROT_READ | PROT_WRITE) &&
+ new_prot == PROT_READ) {
+ /* Permit RW to R as a data-locking mechanism */
+ goto ok;
+ } else
+#endif
+ {
+ error = EPERM;
+ goto out;
+ }
}
old_prot = iter->protection;
if (old_prot == PROT_NONE && new_prot != old_prot) {