Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/pmax/pmax Protect where the bootinfo esym value is ...



details:   https://anonhg.NetBSD.org/src/rev/6155ae98d210
branches:  trunk
changeset: 1014656:6155ae98d210
user:      simonb <simonb%NetBSD.org@localhost>
date:      Mon Sep 28 01:20:29 2020 +0000

description:
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??

diffstat:

 sys/arch/pmax/pmax/machdep.c |  13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diffs (34 lines):

diff -r e9b406735a5c -r 6155ae98d210 sys/arch/pmax/pmax/machdep.c
--- a/sys/arch/pmax/pmax/machdep.c      Mon Sep 28 00:13:03 2020 +0000
+++ b/sys/arch/pmax/pmax/machdep.c      Mon Sep 28 01:20:29 2020 +0000
@@ -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 @@
        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



Home | Main Index | Thread Index | Old Index