Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/aarch64/aarch64 add simple stack overflow checker f...
details: https://anonhg.NetBSD.org/src/rev/eb4f6f215c55
branches: trunk
changeset: 995114:eb4f6f215c55
user: ryo <ryo%NetBSD.org@localhost>
date: Fri Dec 07 18:46:27 2018 +0000
description:
add simple stack overflow checker for debugging
diffstat:
sys/arch/aarch64/aarch64/trap.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diffs (34 lines):
diff -r c3ed1f0215b8 -r eb4f6f215c55 sys/arch/aarch64/aarch64/trap.c
--- a/sys/arch/aarch64/aarch64/trap.c Fri Dec 07 18:45:13 2018 +0000
+++ b/sys/arch/aarch64/aarch64/trap.c Fri Dec 07 18:46:27 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.11 2018/10/12 01:28:57 ryo Exp $ */
+/* $NetBSD: trap.c,v 1.12 2018/12/07 18:46:27 ryo Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.11 2018/10/12 01:28:57 ryo Exp $");
+__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.12 2018/12/07 18:46:27 ryo Exp $");
#include "opt_arm_intr_impl.h"
#include "opt_compat_netbsd32.h"
@@ -296,6 +296,15 @@
{
struct cpu_info * const ci = curcpu();
+#ifdef STACKCHECKS
+ struct lwp *l = curlwp;
+ void *sp = (void *)reg_sp_read();
+ if (l->l_addr >= sp) {
+ panic("lwp/interrupt stack overflow detected."
+ " lwp=%p, sp=%p, l_addr=%p", l, sp, l->l_addr);
+ }
+#endif
+
/* enable traps */
daif_enable(DAIF_D|DAIF_A);
Home |
Main Index |
Thread Index |
Old Index