From: deraadt Date: Sun, 21 Jan 2024 16:59:15 +0000 (+0000) Subject: For minherit(MAP_INHERIT_ZERO) upon readonly memory return EPERM. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=6bffaeed6b38758ab18441db1c3bb407d06553de;p=openbsd For minherit(MAP_INHERIT_ZERO) upon readonly memory return EPERM. ok kettenis --- diff --git a/sys/uvm/uvm_map.c b/sys/uvm/uvm_map.c index 0cc03de7331..34c37cc0d2e 100644 --- a/sys/uvm/uvm_map.c +++ b/sys/uvm/uvm_map.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_map.c,v 1.324 2024/01/21 16:57:06 deraadt Exp $ */ +/* $OpenBSD: uvm_map.c,v 1.325 2024/01/21 16:59:15 deraadt Exp $ */ /* $NetBSD: uvm_map.c,v 1.86 2000/11/27 08:40:03 chs Exp $ */ /* @@ -4199,6 +4199,9 @@ uvm_map_inherit(struct vm_map *map, vaddr_t start, vaddr_t end, while (entry1 != NULL && entry1->start < end) { if (entry1->etype & UVM_ET_IMMUTABLE) goto out; + if (new_inheritance == MAP_INHERIT_ZERO && + (entry1->protection & PROT_WRITE) == 0) + goto out; entry1 = RBT_NEXT(uvm_map_addr, entry1); }