From ab1b43851c7b5160ad787019355b96f56534c39a Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Thu, 16 Aug 2012 09:11:07 -0700 Subject: [PATCH] kernel - Stop KTR logging during panic * Stop all KTR logging when a panic occurs so the KTR buffer doesn't get wiped out by events during the panic & core dump. This gives us a KTR buf snapshot as of the panic entry. --- sys/kern/kern_ktr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_ktr.c b/sys/kern/kern_ktr.c index e4c819c92b..2963c792d6 100644 --- a/sys/kern/kern_ktr.c +++ b/sys/kern/kern_ktr.c @@ -419,7 +419,9 @@ ktr_begin_write_entry(struct ktr_info *info, const char *file, int line) cpu = mycpu->gd_cpuid; kcpu = &ktr_cpu[cpu].core; - if (kcpu->ktr_buf == NULL) + if (panicstr) /* stop logging during panic */ + return NULL; + if (kcpu->ktr_buf == NULL) /* too early in boot */ return NULL; crit_enter(); -- 2.41.0