Skip to content

Commit

Permalink
panic: dump registers on panic_on_warn
Browse files Browse the repository at this point in the history
Currently we print stack and registers for ordinary warnings but we do not
for panic_on_warn which looks as oversight - panic() will reboot the
machine but won't print registers.

This moves printing of registers and modules earlier.

This does not move the stack dumping as panic() dumps it.

Signed-off-by: Alexey Kardashevskiy <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Reviewed-by: Kees Cook <[email protected]>
Cc: Douglas Anderson <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Kees Cook <[email protected]>
Cc: Rafael Aquini <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: Nicholas Piggin <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Linus Torvalds <[email protected]>
aik authored and torvalds committed Oct 16, 2020

Verified

This commit was signed with the committer’s verified signature.
jorenham Joren Hammudoglu
1 parent 85094c0 commit 3f388f2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions kernel/panic.c
Original file line number Diff line number Diff line change
@@ -589,6 +589,11 @@ void __warn(const char *file, int line, void *caller, unsigned taint,
if (args)
vprintk(args->fmt, args->args);

print_modules();

if (regs)
show_regs(regs);

if (panic_on_warn) {
/*
* This thread may hit another WARN() in the panic path.
@@ -600,12 +605,7 @@ void __warn(const char *file, int line, void *caller, unsigned taint,
panic("panic_on_warn set ...\n");
}

print_modules();

if (regs)
show_regs(regs);
else
dump_stack();
dump_stack();

print_irqtrace_events(current);

0 comments on commit 3f388f2

Please sign in to comment.