[PATCH] arm64/traps: show fault address in exception trace
Will Deacon
will at kernel.org
Tue Apr 29 08:33:53 PDT 2025
On Tue, Apr 29, 2025 at 10:15:24AM +0300, Baruch Siach wrote:
> The FAR (fault address) register provides useful information when
> debugging an unhandled exception.
>
> Signed-off-by: Baruch Siach <baruch at tkos.co.il>
> ---
> arch/arm64/kernel/traps.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
> index 4e26bd356a48..14eb598e33a7 100644
> --- a/arch/arm64/kernel/traps.c
> +++ b/arch/arm64/kernel/traps.c
> @@ -239,7 +239,7 @@ void die(const char *str, struct pt_regs *regs, long err)
> make_task_dead(SIGSEGV);
> }
>
> -static void arm64_show_signal(int signo, const char *str)
> +static void arm64_show_signal(int signo, const char *str, unsigned long far)
> {
> static DEFINE_RATELIMIT_STATE(rs, DEFAULT_RATELIMIT_INTERVAL,
> DEFAULT_RATELIMIT_BURST);
> @@ -256,6 +256,7 @@ static void arm64_show_signal(int signo, const char *str)
> pr_info("%s[%d]: unhandled exception: ", tsk->comm, task_pid_nr(tsk));
> if (esr)
> pr_cont("%s, ESR 0x%016lx, ", esr_get_class_string(esr), esr);
> + pr_cont("FAR 0x%016lx, ", far);
Are you sure the FAR is always valid here? For example, if we're delivering
a SIGILL due to an undefined instruction.
Also, once you have the PC and the registers (both of which we print),
it's not too hard to dig the instruction out of the binary and figure out
the faulting address that way.
Will
More information about the linux-arm-kernel
mailing list