summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2023-01-07 10:09:35 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2023-01-07 10:09:35 +0000
commitbbf721088efcba51ec1e347a160ac33aaafeaf82 (patch)
treef7469ce1c72c4c470c72261247124ca573909a85
parentd90890ed6e363834686d5c3307a6c8688278e2b7 (diff)
The PA-RISC architecture supports execute-only mappings by using a
"remain at privilege level 3" gateway page. Make use of this. ok deraadt@, miod@
-rw-r--r--sys/arch/hppa/hppa/pmap.c5
-rw-r--r--sys/arch/hppa/include/pte.h5
2 files changed, 7 insertions, 3 deletions
diff --git a/sys/arch/hppa/hppa/pmap.c b/sys/arch/hppa/hppa/pmap.c
index a6d12b5af4c..7301e83a273 100644
--- a/sys/arch/hppa/hppa/pmap.c
+++ b/sys/arch/hppa/hppa/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.179 2022/10/25 18:44:36 miod Exp $ */
+/* $OpenBSD: pmap.c,v 1.180 2023/01/07 10:09:34 kettenis Exp $ */
/*
* Copyright (c) 1998-2004 Michael Shalayeff
@@ -407,6 +407,7 @@ pmap_check_alias(struct vm_page *pg, vaddr_t va, pt_entry_t pte)
for (pve = pg->mdpage.pvh_list; pve; pve = pve->pv_next) {
pte |= pmap_vp_find(pve->pv_pmap, pve->pv_va);
if ((va & HPPA_PGAOFF) != (pve->pv_va & HPPA_PGAOFF) &&
+ (pte & PTE_PROT(TLB_GATEWAY)) == 0 &&
(pte & PTE_PROT(TLB_WRITE))) {
#ifdef PMAPDEBUG
printf("pmap_check_alias: "
@@ -494,7 +495,7 @@ pmap_bootstrap(vaddr_t vstart)
hppa_prot[PROT_READ] = TLB_AR_R;
hppa_prot[PROT_WRITE] = TLB_AR_RW;
hppa_prot[PROT_READ | PROT_WRITE] = TLB_AR_RW;
- hppa_prot[PROT_EXEC] = TLB_AR_RX;
+ hppa_prot[PROT_EXEC] = TLB_AR_X;
hppa_prot[PROT_READ | PROT_EXEC] = TLB_AR_RX;
hppa_prot[PROT_WRITE | PROT_EXEC] = TLB_AR_RWX;
hppa_prot[PROT_READ | PROT_WRITE | PROT_EXEC] = TLB_AR_RWX;
diff --git a/sys/arch/hppa/include/pte.h b/sys/arch/hppa/include/pte.h
index 3883833a3d4..a60a236aceb 100644
--- a/sys/arch/hppa/include/pte.h
+++ b/sys/arch/hppa/include/pte.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pte.h,v 1.13 2013/03/25 20:14:30 deraadt Exp $ */
+/* $OpenBSD: pte.h,v 1.14 2023/01/07 10:09:34 kettenis Exp $ */
/*
* Copyright (c) 1990,1993,1994 The University of Utah and
@@ -46,8 +46,11 @@
#define TLB_EXECUTE 0x02000000
#define TLB_GATEWAY 0x04000000
#define TLB_USER 0x00f00000
+/* no execute access at any PL; no GATEWAY promotion */
#define TLB_AR_NA 0x07300000
#define TLB_AR_R TLB_READ
+/* execute access at designated PL; no GATEWAY promotion */
+#define TLB_AR_X 0x07000000
#define TLB_AR_RW TLB_READ|TLB_WRITE
#define TLB_AR_RX TLB_READ|TLB_EXECUTE
#define TLB_AR_RWX TLB_READ|TLB_WRITE|TLB_EXECUTE