Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/aarch64 Fix panic caused by modload. http://mail-in...



details:   https://anonhg.NetBSD.org/src/rev/5662045d673c
branches:  trunk
changeset: 938329:5662045d673c
user:      ryo <ryo%NetBSD.org@localhost>
date:      Sun Sep 06 17:38:10 2020 +0000

description:
Fix panic caused by modload. http://mail-index.netbsd.org/port-arm/2020/08/30/msg006960.html

The address space reserved for modules may not be mapped in L1-L3.

diffstat:

 sys/arch/aarch64/aarch64/pmap.c    |  17 ++++++++++++-----
 sys/arch/aarch64/include/machdep.h |   4 +++-
 2 files changed, 15 insertions(+), 6 deletions(-)

diffs (80 lines):

diff -r c679aada0e7e -r 5662045d673c sys/arch/aarch64/aarch64/pmap.c
--- a/sys/arch/aarch64/aarch64/pmap.c   Sun Sep 06 17:22:44 2020 +0000
+++ b/sys/arch/aarch64/aarch64/pmap.c   Sun Sep 06 17:38:10 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.87 2020/08/14 08:19:26 skrll Exp $  */
+/*     $NetBSD: pmap.c,v 1.88 2020/09/06 17:38:10 ryo Exp $    */
 
 /*
  * Copyright (c) 2017 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -27,10 +27,11 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.87 2020/08/14 08:19:26 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.88 2020/09/06 17:38:10 ryo Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_ddb.h"
+#include "opt_modular.h"
 #include "opt_multiprocessor.h"
 #include "opt_pmap.h"
 #include "opt_uvmhist.h"
@@ -282,6 +283,12 @@
 #define IN_KSEG_ADDR(va)       \
        IN_RANGE((va), AARCH64_KSEG_START, AARCH64_KSEG_END)
 
+#ifdef MODULAR
+#define IN_MODULE_VA(va)       IN_RANGE((va), module_start, module_end)
+#else
+#define IN_MODULE_VA(va)       false
+#endif
+
 #ifdef DIAGNOSTIC
 #define KASSERT_PM_ADDR(pm,va)                                         \
        do {                                                            \
@@ -1671,7 +1678,7 @@
        idx = l0pde_index(va);
        pde = l0[idx];
        if (!l0pde_valid(pde)) {
-               KASSERT(!kenter);
+               KASSERT(!kenter || IN_MODULE_VA(va));
                /* no need to increment L0 occupancy. L0 page never freed */
                pdppa = pmap_alloc_pdp(pm, &pdppg, flags, false);  /* L1 pdp */
                if (pdppa == POOL_PADDR_INVALID) {
@@ -1689,7 +1696,7 @@
        idx = l1pde_index(va);
        pde = l1[idx];
        if (!l1pde_valid(pde)) {
-               KASSERT(!kenter);
+               KASSERT(!kenter || IN_MODULE_VA(va));
                pdppa0 = pdppa;
                pdppg0 = pdppg;
                pdppa = pmap_alloc_pdp(pm, &pdppg, flags, false);  /* L2 pdp */
@@ -1709,7 +1716,7 @@
        idx = l2pde_index(va);
        pde = l2[idx];
        if (!l2pde_valid(pde)) {
-               KASSERT(!kenter);
+               KASSERT(!kenter || IN_MODULE_VA(va));
                pdppa0 = pdppa;
                pdppg0 = pdppg;
                pdppa = pmap_alloc_pdp(pm, &pdppg, flags, false);  /* L3 pdp */
diff -r c679aada0e7e -r 5662045d673c sys/arch/aarch64/include/machdep.h
--- a/sys/arch/aarch64/include/machdep.h        Sun Sep 06 17:22:44 2020 +0000
+++ b/sys/arch/aarch64/include/machdep.h        Sun Sep 06 17:38:10 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.h,v 1.16 2020/08/06 06:49:55 ryo Exp $ */
+/*     $NetBSD: machdep.h,v 1.17 2020/09/06 17:38:10 ryo Exp $ */
 
 /*
  * Copyright (c) 2017 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -59,6 +59,8 @@
 
 extern paddr_t physical_start;
 extern paddr_t physical_end;
+extern vaddr_t module_start;
+extern vaddr_t module_end;
 
 extern void (*cpu_reset_address0)(void);
 extern void (*cpu_reset_address)(void);



Home | Main Index | Thread Index | Old Index