From b1b9518a9ac571610e42a194d3122bc197d9ccaf Mon Sep 17 00:00:00 2001 From: deraadt Date: Sat, 19 Feb 2022 23:56:18 +0000 Subject: [PATCH] tsleep() prints a stack trace when cold==2. The suspend/resume code has phases where sleeps are not allowed, and this used to discover it. msleep() needs the same check. --- sys/kern/kern_synch.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index e993131cd9b..d888cb2b84a 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_synch.c,v 1.181 2022/02/14 11:26:05 claudio Exp $ */ +/* $OpenBSD: kern_synch.c,v 1.182 2022/02/19 23:56:18 deraadt Exp $ */ /* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */ /* @@ -222,6 +222,10 @@ msleep(const volatile void *ident, struct mutex *mtx, int priority, if (priority & PCATCH) KERNEL_ASSERT_LOCKED(); +#ifdef DDB + if (cold == 2) + db_stack_dump(); +#endif if (cold || panicstr) { /* * After a panic, or during autoconfiguration, -- 2.20.1