diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2018-09-12 11:58:29 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2018-09-12 11:58:29 +0000 |
commit | 88bd9787f24957b61ccf25debfdcfbe8823c50b9 (patch) | |
tree | de8fcfe18c8e0032d019a617331aaba59de8ebfd | |
parent | d4aece62f46cd3d2237d4552e78673cf524bdbf9 (diff) |
Make pmap_protect(9) actually remove exec permission if the new permissions
include PROT_READ but not PROT_EXEC.
ok patrick@
-rw-r--r-- | sys/arch/arm64/arm64/pmap.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/arch/arm64/arm64/pmap.c b/sys/arch/arm64/arm64/pmap.c index 9beb6047c0d..4cd23d17b71 100644 --- a/sys/arch/arm64/arm64/pmap.c +++ b/sys/arch/arm64/arm64/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.57 2018/08/18 15:42:19 kettenis Exp $ */ +/* $OpenBSD: pmap.c,v 1.58 2018/09/12 11:58:28 kettenis Exp $ */ /* * Copyright (c) 2008-2009,2014-2016 Dale Rahn <drahn@dalerahn.com> * @@ -1424,6 +1424,10 @@ pmap_page_ro(pmap_t pm, vaddr_t va, vm_prot_t prot) pted->pted_va &= ~PROT_WRITE; pted->pted_pte &= ~PROT_WRITE; + if ((prot & PROT_EXEC) == 0) { + pted->pted_va &= ~PROT_EXEC; + pted->pted_pte &= ~PROT_EXEC; + } pmap_pte_update(pted, pl3); ttlb_flush(pm, pted->pted_va & ~PAGE_MASK); @@ -1496,7 +1500,7 @@ pmap_protect(pmap_t pm, vaddr_t sva, vaddr_t eva, vm_prot_t prot) if (prot & (PROT_READ | PROT_EXEC)) { pmap_lock(pm); while (sva < eva) { - pmap_page_ro(pm, sva, 0); + pmap_page_ro(pm, sva, prot); sva += PAGE_SIZE; } pmap_unlock(pm); |