lkml.org 
[lkml]   [2021]   [Sep]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] arm64: traps: add dump instr before BUG in kernel
On Wed, Sep 29, 2021 at 09:29:46PM +0800, Chen Lin wrote:
> 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();
> + }

Hmm, I'm not completely convinced about this as the instruction in the
i-cache could be completely different. I think the PC value (for addr2line)
is a lot more useful, and we should be printing that already.

Maybe you can elaborate on a situation where this information was helpful?

Thanks,

Will

\
 
 \ /
  Last update: 2021-09-30 10:42    [W:0.059 / U:0.252 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site