Re: [PATCH] arm64: stacktrace: Stop unwinding when the PC is zero

From: Catalin Marinas
Date: Fri Apr 30 2021 - 13:33:05 EST


On Thu, Apr 29, 2021 at 11:48:13AM +0100, Mark Rutland wrote:
> From b99e647b34b74059f3013c09f12fbd542c7679fd Mon Sep 17 00:00:00 2001
> From: Mark Rutland <mark.rutland@xxxxxxx>
> Date: Thu, 29 Apr 2021 11:20:04 +0100
> Subject: [PATCH] arm64: stacktrace: restore terminal records
>
> We removed the terminal frame records in commit:
>
> 6106e1112cc69a36 ("arm64: remove EL0 exception frame record")
>
> ... on the assumption that as we no longer used them to find the pt_regs
> at exception boundaries, they were no longer necessary.
>
> However, Leo reports that as an unintended side-effect, this causes
> traces which cross secondary_start_kernel to terminate one entry too
> late, with a spurious "0" entry.
>
> There are a few ways we could sovle this, but as we're planning to use
> terminal records for RELIABLE_STACKTRACE, let's revert the logic change
> for now, keeping the update comments and accounting for the changes in
> commit:
>
> 3c02600144bdb0a1 ("arm64: stacktrace: Report when we reach the end of the stack")
>
> This is effectively a partial revert of commit:
>
> 6106e1112cc69a36 ("arm64: remove EL0 exception frame record")
>
> Signed-off-by: Mark Rutland <mark.rutland@xxxxxxx>
> Fixes: 6106e1112cc69a36 ("arm64: remove EL0 exception frame record")
> Reported-by: Leo Yan <leo.yan@xxxxxxxxxx>
> Cc: Catalin Marinas <catalin.marinas@xxxxxxx>
> Cc: Will Deacon <will@xxxxxxxxxx>
> Cc: Mark Brown <broonie@xxxxxxxxxx>
> Cc: "Madhavan T. Venkataraman" <madvenka@xxxxxxxxxxxxxxxxxxx>

Thanks Mark. I applied it to for-next/core (couldn't figure out the
combination of b4 and git am + the scissors and not replying to the top
message).

--
Catalin