Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/evbarm/nslu2 Panic if kernel image is not fit withi...



details:   https://anonhg.NetBSD.org/src/rev/b3c80b4f5d76
branches:  trunk
changeset: 376424:b3c80b4f5d76
user:      rin <rin%NetBSD.org@localhost>
date:      Sat Jun 17 11:28:13 2023 +0000

description:
Panic if kernel image is not fit within its VA range,
rather than silently freeze later.

diffstat:

 sys/arch/evbarm/nslu2/nslu2_machdep.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r baa38a138413 -r b3c80b4f5d76 sys/arch/evbarm/nslu2/nslu2_machdep.c
--- a/sys/arch/evbarm/nslu2/nslu2_machdep.c     Sat Jun 17 11:24:20 2023 +0000
+++ b/sys/arch/evbarm/nslu2/nslu2_machdep.c     Sat Jun 17 11:28:13 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nslu2_machdep.c,v 1.39 2023/06/17 11:24:20 rin Exp $   */
+/*     $NetBSD: nslu2_machdep.c,v 1.40 2023/06/17 11:28:13 rin Exp $   */
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -94,7 +94,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nslu2_machdep.c,v 1.39 2023/06/17 11:24:20 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nslu2_machdep.c,v 1.40 2023/06/17 11:28:13 rin Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_console.h"
@@ -630,6 +630,9 @@ initarm(void *arg)
                logical += pmap_map_chunk(l1pagetable, KERNEL_BASE + logical,
                    physical_start + logical, totalsize - textsize,
                    VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
+
+               if (KERNEL_BASE + logical >= KERNEL_VM_BASE)
+                       panic("VA for kernel image exhausted.");
        }
 
 #ifdef VERBOSE_INIT_ARM



Home | Main Index | Thread Index | Old Index