All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64: traps: add dump instr before BUG in kernel
@ 2021-09-29 13:29 ` Chen Lin
  0 siblings, 0 replies; 10+ messages in thread
From: Chen Lin @ 2021-09-29 13:29 UTC (permalink / raw)
  To: catalin.marinas
  Cc: will, mark.rutland, joey.gouly, maz, linux-arm-kernel,
	linux-kernel, Chen Lin

From: Chen Lin <chen.lin5@zte.com.cn>

we should dump the real instructions before BUG in kernel mode, and
compare this to the instructions from objdump.

Signed-off-by: Chen Lin <chen.lin5@zte.com.cn>
---
 arch/arm64/kernel/traps.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
index b03e383..621a9dd 100644
--- a/arch/arm64/kernel/traps.c
+++ b/arch/arm64/kernel/traps.c
@@ -495,7 +495,12 @@ void do_undefinstr(struct pt_regs *regs)
 	if (call_undef_hook(regs) == 0)
 		return;
 
-	BUG_ON(!user_mode(regs));
+	if (!user_mode(regs)) {
+		pr_emerg("Undef instruction in kernel, dump instr:");
+		dump_kernel_instr(KERN_EMERG, regs);
+		BUG();
+	}
+
 	force_signal_inject(SIGILL, ILL_ILLOPC, regs->pc, 0);
 }
 NOKPROBE_SYMBOL(do_undefinstr);
-- 
1.7.9.5


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-10-13 13:31 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-29 13:29 [PATCH] arm64: traps: add dump instr before BUG in kernel Chen Lin
2021-09-29 13:29 ` Chen Lin
2021-09-30  8:42 ` Will Deacon
2021-09-30  8:42   ` Will Deacon
2021-09-30 14:41   ` Chen Lin
2021-09-30 14:41     ` Chen Lin
2021-10-11 10:06     ` Will Deacon
2021-10-11 10:06       ` Will Deacon
2021-10-13 13:08       ` Chen Lin
2021-10-13 13:08         ` Chen Lin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.