Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern crashme(9): New kernel_lock_spinout crasher.
details: https://anonhg.NetBSD.org/src/rev/81467321d495
branches: trunk
changeset: 369413:81467321d495
user: riastradh <riastradh%NetBSD.org@localhost>
date: Tue Aug 16 10:24:17 2022 +0000
description:
crashme(9): New kernel_lock_spinout crasher.
This assumes that something will eventually try to take the kernel
lock and, after spinning for a while, spin out and crash -- so for
now it's only enabled under LOCKDEBUG, without which the kernel lock
spins forever.
diffstat:
sys/kern/kern_crashme.c | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletions(-)
diffs (47 lines):
diff -r 0a86751562dc -r 81467321d495 sys/kern/kern_crashme.c
--- a/sys/kern/kern_crashme.c Tue Aug 16 09:03:04 2022 +0000
+++ b/sys/kern/kern_crashme.c Tue Aug 16 10:24:17 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_crashme.c,v 1.5 2021/11/27 14:11:14 riastradh Exp $ */
+/* $NetBSD: kern_crashme.c,v 1.6 2022/08/16 10:24:17 riastradh Exp $ */
/*
* Copyright (c) 2018, 2019 Matthew R. Green
@@ -63,6 +63,9 @@
#ifdef DDB
static int crashme_ddb(int);
#endif
+#ifdef LOCKDEBUG
+static int crashme_kernel_lock_spinout(int);
+#endif
#define CMNODE(name, lname, func) \
{ \
@@ -78,6 +81,10 @@
#ifdef DDB
CMNODE("ddb", "enter ddb directly", crashme_ddb),
#endif
+#ifdef LOCKDEBUG
+ CMNODE("kernel_lock_spinout", "infinite kernel lock",
+ crashme_kernel_lock_spinout),
+#endif
};
static crashme_node *first_node;
static kmutex_t crashme_lock;
@@ -270,3 +277,16 @@
return 0;
}
#endif
+
+#ifdef LOCKDEBUG
+static int
+crashme_kernel_lock_spinout(int flags)
+{
+
+ KERNEL_LOCK(1, NULL);
+ for (;;)
+ __insn_barrier();
+ KERNEL_UNLOCK_ONE(NULL);
+ return 0;
+}
+#endif
Home |
Main Index |
Thread Index |
Old Index