[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1632922186-3116-1-git-send-email-chen45464546@163.com>
Date: Wed, 29 Sep 2021 21:29:46 +0800
From: Chen Lin <chen45464546@....com>
To: catalin.marinas@....com
Cc: will@...nel.org, mark.rutland@....com, joey.gouly@....com,
maz@...nel.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, Chen Lin <chen.lin5@....com.cn>
Subject: [PATCH] arm64: traps: add dump instr before BUG in kernel
From: Chen Lin <chen.lin5@....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@....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
Powered by blists - more mailing lists