panic: call panic handlers before kmsg_dump
authorKees Cook <[email protected]>
Wed, 11 Sep 2013 21:25:49 +0000 (14:25 -0700)
committerLinus Torvalds <[email protected]>
Wed, 11 Sep 2013 22:59:30 +0000 (15:59 -0700)
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.

Signed-off-by: Kees Cook <[email protected]>
Cc: Anton Vorontsov <[email protected]>
Cc: Colin Cross <[email protected]>
Acked-by: Tony Luck <[email protected]>
Cc: Stephen Boyd <[email protected]>
Cc: Vikram Mulukutla <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Rusty Russell <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
kernel/panic.c

index 8018646005144c4082da694b331a1f44964134d6..b6c482ccc5db77f4af0afbb0948ff0373bb094d5 100644 (file)
@@ -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)