summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2018-09-12 11:58:29 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2018-09-12 11:58:29 +0000
commit88bd9787f24957b61ccf25debfdcfbe8823c50b9 (patch)
treede8fcfe18c8e0032d019a617331aaba59de8ebfd
parentd4aece62f46cd3d2237d4552e78673cf524bdbf9 (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.c8
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);