Skip to contentSkip to conversation

panic: call panic handlers before kmsg_dump

PATCH In review Kees Cook 2 participants 4 messages Jul 18, 2013 – Sep 10, 2013

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 panic: call panic handlers before kmsg_dump

Since the panic handlers may produce additional information (via printk) for the kernel log, it should be reported as part of the panic output saved by kmsg_dump(). Without this re-ordering, nothing that adds information to a panic will show up in pstore's view when kmsg_dump runs, and is therefore not visible to crash reporting tools that examine pstore output.

---
 kernel/panic.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
kernel/panic.c +6 -2
index 8018646..b6c482c 100644
@@ -123,10 +123,14 @@ void panic(const char *fmt, ...)
 	 */
 	smp_send_stop();
 
-	kmsg_dump(KMSG_DUMP_PANIC);
-
+	/*
+	 * Run any panic handlers, including those that might need to
+	 * add information to the kmsg dump output.
+	 */
 	atomic_notifier_call_chain(&panic_notifier_list, 0, buf);
 
+	kmsg_dump(KMSG_DUMP_PANIC);
+
 	bust_spinlocks(0);
 
 	if (!panic_blink)
Signature · 6 lines
1.7.9.5


-- 
Kees Cook
Chrome OS Security
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Kees Cook

Since the panic handlers may produce additional information (via printk) for the kernel log, it should be reported as part of the panic output saved by kmsg_dump(). Without this re-ordering, nothing that adds information to a panic will show up in pstore's view when kmsg_dump runs, and is therefore not visible to crash reporting tools that examine pstore output.

Good point.

author
#2 lore raw
Quoted 11 lines · Tony Luck
Quoted 6 lines · Kees Cook

Since the panic handlers may produce additional information (via printk) for the kernel log, it should be reported as part of the panic output saved by kmsg_dump(). Without this re-ordering, nothing that adds information to a panic will show up in pstore's view when kmsg_dump runs, and is therefore not visible to crash reporting tools that examine pstore output.

Good point.

Can someone pick this patch up? If akpm doesn't want it, it could live in the pstore tree maybe?

-Kees

Signature · 2 lines
Kees Cook
Chrome OS Security
author
#3 lore raw
Quoted 9 lines · Kees Cook
Quoted 8 lines · Tony Luck
Quoted 6 lines · Kees Cook

Since the panic handlers may produce additional information (via printk) for the kernel log, it should be reported as part of the panic output saved by kmsg_dump(). Without this re-ordering, nothing that adds information to a panic will show up in pstore's view when kmsg_dump runs, and is therefore not visible to crash reporting tools that examine pstore output.

Quoted 6 lines
Quoted 3 lines

Good point.

Can someone pick this patch up? If akpm doesn't want it, it could live in the pstore tree maybe?

Ah, sorry, it seems like it is already in -mm. Never mind!

-Kees

Signature · 2 lines
Kees Cook
Chrome OS Security