On Fri, Oct 29, 2021 at 05:22:45PM +0100, Mark Rutland wrote:
To fix this, we need to be able to uniquely identify each rewritten
return address such that we can map this back to the original return
address. We can use HAVE_FUNCTION_GRAPH_RET_ADDR_PTR to associate
each rewritten return address with a unique location on the stack. As
the return address is passed in the LR (and so is not guaranteed a
unique location in memory), we use the FP upon entry to the function
(i.e. the address of the caller's frame record) as the return address
pointer. Any nested call will have a different FP value as the caller
must create its own frame record and update FP to point to this.
As a bonus since we're relying on core code more the result is also
simpler.
Reviewed-by: Mark Brown <broonie@kernel.org>