diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2024-01-21 16:59:16 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2024-01-21 16:59:16 +0000 |
commit | ddc274eb8deae3be3d7de519492f026b47b9f9e1 (patch) | |
tree | 8d69d0c0056d39ca22925192bdea3947d162e6fa /sys/uvm | |
parent | be146c0d7880a81b39d42a4995bcef1b8b541158 (diff) |
For minherit(MAP_INHERIT_ZERO) upon readonly memory return EPERM.
ok kettenis
Diffstat (limited to 'sys/uvm')
-rw-r--r-- | sys/uvm/uvm_map.c | 5 |
1 files changed, 4 insertions, 1 deletions
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); } |