Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-9]: src/sys/arch/aarch64/aarch64 Pull up following revision(s) (r...
details: https://anonhg.NetBSD.org/src/rev/3407f9f2af88
branches: netbsd-9
changeset: 963507:3407f9f2af88
user: martin <martin%NetBSD.org@localhost>
date: Tue Jan 21 11:15:52 2020 +0000
description:
Pull up following revision(s) (requested by ryo in ticket #618):
sys/arch/aarch64/aarch64/fault.c: revision 1.11
sys/arch/aarch64/aarch64/pmap.c: revision 1.61
fix behaviour mmap()/mprotect() when passed only PROT_EXEC.
when mmap()/mprotect() with only PROT_EXEC, syscall will be successful,
but the page actually hadn't been mapped.
it should be mapped with PROT_READ|PROT_EXEC implicitly. (r-x)
diffstat:
sys/arch/aarch64/aarch64/fault.c | 6 +++---
sys/arch/aarch64/aarch64/pmap.c | 12 ++++++++++--
2 files changed, 13 insertions(+), 5 deletions(-)
diffs (67 lines):
diff -r 5c50b4adf06f -r 3407f9f2af88 sys/arch/aarch64/aarch64/fault.c
--- a/sys/arch/aarch64/aarch64/fault.c Tue Jan 21 11:11:00 2020 +0000
+++ b/sys/arch/aarch64/aarch64/fault.c Tue Jan 21 11:15:52 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fault.c,v 1.10 2019/06/10 05:56:15 ryo Exp $ */
+/* $NetBSD: fault.c,v 1.10.2.1 2020/01/21 11:15:52 martin Exp $ */
/*
* Copyright (c) 2017 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.10 2019/06/10 05:56:15 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.10.2.1 2020/01/21 11:15:52 martin Exp $");
#include "opt_compat_netbsd32.h"
#include "opt_ddb.h"
@@ -170,7 +170,7 @@
}
if ((eclass == ESR_EC_INSN_ABT_EL0) || (eclass == ESR_EC_INSN_ABT_EL1))
- ftype = VM_PROT_READ | VM_PROT_EXECUTE;
+ ftype = VM_PROT_EXECUTE;
else if (__SHIFTOUT(esr, ESR_ISS_DATAABORT_CM))
ftype = VM_PROT_READ;
else
diff -r 5c50b4adf06f -r 3407f9f2af88 sys/arch/aarch64/aarch64/pmap.c
--- a/sys/arch/aarch64/aarch64/pmap.c Tue Jan 21 11:11:00 2020 +0000
+++ b/sys/arch/aarch64/aarch64/pmap.c Tue Jan 21 11:15:52 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.41.2.4 2019/12/29 09:27:09 martin Exp $ */
+/* $NetBSD: pmap.c,v 1.41.2.5 2020/01/21 11:15:52 martin Exp $ */
/*
* Copyright (c) 2017 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.41.2.4 2019/12/29 09:27:09 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.41.2.5 2020/01/21 11:15:52 martin Exp $");
#include "opt_arm_debug.h"
#include "opt_ddb.h"
@@ -1210,6 +1210,10 @@
KASSERT_PM_ADDR(pm, sva);
KASSERT(!IN_KSEG_ADDR(sva));
+ /* PROT_EXEC requires implicit PROT_READ */
+ if (prot & VM_PROT_EXECUTE)
+ prot |= VM_PROT_READ;
+
if ((prot & VM_PROT_READ) == VM_PROT_NONE) {
PMAP_COUNT(protect_remove_fallback);
pmap_remove(pm, sva, eva);
@@ -2123,6 +2127,10 @@
/* ignore except read/write */
accessprot &= (VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
+ /* PROT_EXEC requires implicit PROT_READ */
+ if (accessprot & VM_PROT_EXECUTE)
+ accessprot |= VM_PROT_READ;
+
/* no permission to read/write/execute for this page */
if ((pmap_prot & accessprot) != accessprot) {
UVMHIST_LOG(pmaphist, "no permission to access", 0, 0, 0, 0);
Home |
Main Index |
Thread Index |
Old Index