Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/aarch64/aarch64 need to add VM_PROT_READ when pmap_...



details:   https://anonhg.NetBSD.org/src/rev/f6805a7395ed
branches:  trunk
changeset: 366430:f6805a7395ed
user:      ryo <ryo%NetBSD.org@localhost>
date:      Mon Aug 27 15:43:37 2018 +0000

description:
need to add VM_PROT_READ when pmap_kenter_pa(va, pa, VM_PROT_WRITE, 0) or pmap_kenter_pa(va, pa, VM_PROT_EXECUTE, 0).
VM_PROT_READ is treated as an access permission inernally.

diffstat:

 sys/arch/aarch64/aarch64/pmap.c |  14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diffs (42 lines):

diff -r 6356c16e606d -r f6805a7395ed sys/arch/aarch64/aarch64/pmap.c
--- a/sys/arch/aarch64/aarch64/pmap.c   Mon Aug 27 15:32:51 2018 +0000
+++ b/sys/arch/aarch64/aarch64/pmap.c   Mon Aug 27 15:43:37 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.19 2018/08/11 12:16:34 ryo Exp $    */
+/*     $NetBSD: pmap.c,v 1.20 2018/08/27 15:43:37 ryo 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.19 2018/08/11 12:16:34 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.20 2018/08/27 15:43:37 ryo Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_ddb.h"
@@ -1062,8 +1062,6 @@
 {
        int s;
 
-       KASSERT((prot & VM_PROT_READ) || !(prot & VM_PROT_WRITE));
-
        s = splvm();
        _pmap_enter(pmap_kernel(), va, pa, prot, flags | PMAP_WIRED, true);
        splx(s);
@@ -1490,6 +1488,14 @@
                pm->pm_stats.resident_count--;
        }
 
+       /*
+        * read permission is treated as an access permission internally.
+        * require to add PROT_READ even if only PROT_WRITE or PROT_EXEC
+        * for wired mapping.
+        */
+       if ((flags & PMAP_WIRED) && (prot & (VM_PROT_WRITE|VM_PROT_EXECUTE)))
+               prot |= VM_PROT_READ;
+
        mdattr = VM_PROT_READ | VM_PROT_WRITE;
        if (pg != NULL) {
                error = _pmap_enter_pv(pg, pm, &spv, va, ptep, pa, flags);



Home | Main Index | Thread Index | Old Index