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 Fix a potential issue in pmapboot_e...



details:   https://anonhg.NetBSD.org/src/rev/537430aa2a96
branches:  trunk
changeset: 949305:537430aa2a96
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sat Jan 09 13:42:25 2021 +0000

description:
Fix a potential issue in pmapboot_enter_range and pmapboot_enter where
if the va and size are not page aligned, there is a possibility of the
last page not being taken into consideration.

diffstat:

 sys/arch/aarch64/aarch64/pmapboot.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r 51c38d79a54e -r 537430aa2a96 sys/arch/aarch64/aarch64/pmapboot.c
--- a/sys/arch/aarch64/aarch64/pmapboot.c       Sat Jan 09 13:19:27 2021 +0000
+++ b/sys/arch/aarch64/aarch64/pmapboot.c       Sat Jan 09 13:42:25 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmapboot.c,v 1.14 2020/12/11 18:03:33 skrll Exp $      */
+/*     $NetBSD: pmapboot.c,v 1.15 2021/01/09 13:42:25 jmcneill Exp $   */
 
 /*
  * Copyright (c) 2018 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmapboot.c,v 1.14 2020/12/11 18:03:33 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmapboot.c,v 1.15 2021/01/09 13:42:25 jmcneill Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_ddb.h"
@@ -240,8 +240,8 @@
            va, pa, size, blocksize, attr);
 
        pa &= ~(blocksize - 1);
+       va_end = (va + size + blocksize - 1) & ~(blocksize - 1);
        va &= ~(blocksize - 1);
-       va_end = (va + size + blocksize- 1) & ~(blocksize - 1);
 #ifdef OPTIMIZE_TLB_CONTIG
        va_start = va;
 #endif
@@ -473,8 +473,8 @@
        vsize_t left, mapsize, nblocks;
        int nskip = 0;
 
+       vend = round_page(va + size);
        va = trunc_page(va);
-       vend = round_page(va + size);
        left = vend - va;
 
        /* align the start address to L2 blocksize */



Home | Main Index | Thread Index | Old Index