Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/mips/mips Advance the PC on breakpoint instruction ...



details:   https://anonhg.NetBSD.org/src/rev/52a6a56fdd44
branches:  trunk
changeset: 825446:52a6a56fdd44
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Jul 14 20:32:32 2017 +0000

description:
Advance the PC on breakpoint instruction to avoid infinite loop DoS!

diffstat:

 sys/arch/mips/mips/trap.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r 5d14321d0a0b -r 52a6a56fdd44 sys/arch/mips/mips/trap.c
--- a/sys/arch/mips/mips/trap.c Fri Jul 14 19:24:52 2017 +0000
+++ b/sys/arch/mips/mips/trap.c Fri Jul 14 20:32:32 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.243 2016/09/10 13:42:11 skrll Exp $ */
+/*     $NetBSD: trap.c,v 1.244 2017/07/14 20:32:32 christos Exp $      */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.243 2016/09/10 13:42:11 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.244 2017/07/14 20:32:32 christos Exp $");
 
 #include "opt_cputype.h"       /* which mips CPU levels do we support? */
 #include "opt_ddb.h"
@@ -546,6 +546,9 @@
                        ksi.ksi_signo = SIGTRAP;
                        ksi.ksi_addr = (void *)va;
                        ksi.ksi_code = TRAP_TRACE;
+                       /* we broke, skip it to avoid infinite loop */
+                       if (instr == MIPS_BREAK_INSTR)
+                               tf->tf_regs[_R_PC] += 4;
                        break;
                }
                /*



Home | Main Index | Thread Index | Old Index