Re: [PATCH 3/8] arm64: kprobes: Record frame pointer with kretprobe instance
From: Mark Rutland <mark.rutland@arm.com>
Date: 2021-10-14 10:27:11
Also in:
lkml
On Thu, Oct 14, 2021 at 07:01:55PM +0900, Masami Hiramatsu wrote:
On Thu, 14 Oct 2021 10:13:32 +0100 Mark Rutland [off-list ref] wrote:quoted
On Thu, Oct 14, 2021 at 05:04:05PM +0900, Masami Hiramatsu wrote:quoted
On Wed, 13 Oct 2021 11:01:39 +0100 Mark Rutland [off-list ref] wrote:quoted
On Fri, Oct 08, 2021 at 09:28:39PM +0900, Masami Hiramatsu wrote:quoted
Record the frame pointer instead of stack address with kretprobe instance as the identifier on the instance list. Since arm64 always enable CONFIG_FRAME_POINTER, we can use the actual frame pointer (x29).Just to check, why do we need to use the FP rather than SP? It wasn't clear to me if that's necessary later in the series, or if I'm missing something here.Actually, this is for finding correct return address from the per-task kretprobe instruction list (suppose it as a shadow stack) when it will be searched in stack-backtracing. At that point, the framepointer will be a reliable key.Sure, my question was more "why isn't the SP a reliable key?", because both the SP and FP should be balanced at function-entry and function-return time. I'm asking because I think I'm missing a subtlety.Ah, because SP is not used while unwinding frame. For the kretprobe, either FP or SP is OK. But for the stacktrace.c, I can not use SP and is easy to change to use FP. :)
Ah, so this is just so that stacktrace can match the address. For clarity, would you be happy to add a sentence to the commit message like: | This will allow the stacktrace code to find the original return | address from the FP alone. Thanks, Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel