Module Name:    src
Committed By:   simonb
Date:           Mon Sep 28 01:20:29 UTC 2020

Modified Files:
        src/sys/arch/pmax/pmax: machdep.c

Log Message:
Protect where the bootinfo esym value is less than the kernel "end"
symbol by setting the end of kernel marker to the greater of these
two values.
XXX: elf2ecoff bug??


To generate a diff of this commit:
cvs rdiff -u -r1.253 -r1.254 src/sys/arch/pmax/pmax/machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/pmax/pmax/machdep.c
diff -u src/sys/arch/pmax/pmax/machdep.c:1.253 src/sys/arch/pmax/pmax/machdep.c:1.254
--- src/sys/arch/pmax/pmax/machdep.c:1.253	Fri Sep  4 06:12:16 2020
+++ src/sys/arch/pmax/pmax/machdep.c	Mon Sep 28 01:20:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.253 2020/09/04 06:12:16 skrll Exp $	*/
+/*	$NetBSD: machdep.c,v 1.254 2020/09/28 01:20:29 simonb Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.253 2020/09/04 06:12:16 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.254 2020/09/28 01:20:29 simonb Exp $");
 
 #include "opt_ddb.h"
 #include "opt_modular.h"
@@ -170,7 +170,14 @@ mach_init(int argc, int32_t *argv32, int
 	if (bi_syms != NULL) {
 		ssym = (void *)(intptr_t)bi_syms->ssym;
 		esym = (void *)(intptr_t)bi_syms->esym;
-		kernend = (void *)mips_round_page(esym);
+
+		if (esym < (void *)end) {
+			/* protect against bogus bootinfo data */
+			kernend = end;
+		} else {
+			kernend = esym;
+		}
+		kernend = (void *)mips_round_page(kernend);
 #if 0	/* our bootloader clears BSS properly */
 		memset(edata, 0, end - edata);
 #endif

Reply via email to