Module Name: src
Committed By: christos
Date: Fri Jul 14 20:32:32 UTC 2017
Modified Files:
src/sys/arch/mips/mips: trap.c
Log Message:
Advance the PC on breakpoint instruction to avoid infinite loop DoS!
To generate a diff of this commit:
cvs rdiff -u -r1.243 -r1.244 src/sys/arch/mips/mips/trap.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/mips/mips/trap.c
diff -u src/sys/arch/mips/mips/trap.c:1.243 src/sys/arch/mips/mips/trap.c:1.244
--- src/sys/arch/mips/mips/trap.c:1.243 Sat Sep 10 09:42:11 2016
+++ src/sys/arch/mips/mips/trap.c Fri Jul 14 16:32:32 2017
@@ -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 @@ trap(uint32_t status, uint32_t cause, va
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;
}
/*