summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/kcov.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/dev/kcov.c b/sys/dev/kcov.c
index 7e7c5108737..fa1ce1b6dc5 100644
--- a/sys/dev/kcov.c
+++ b/sys/dev/kcov.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kcov.c,v 1.17 2020/05/16 08:38:34 anton Exp $ */
+/* $OpenBSD: kcov.c,v 1.18 2020/05/17 08:46:05 anton Exp $ */
/*
* Copyright (c) 2018 Anton Lindqvist <anton@openbsd.org>
@@ -387,6 +387,13 @@ kd_curproc(int mode)
struct kcov_dev *kd;
/*
+ * Do not trace if the kernel has panicked. This could happen if curproc
+ * had kcov enabled while panicking.
+ */
+ if (__predict_false(panicstr || db_active))
+ return (NULL);
+
+ /*
* Do not trace before kcovopen() has been called at least once.
* At this point, all secondary CPUs have booted and accessing curcpu()
* is safe.