[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211013081456.GE6701@willie-the-truck>
Date: Wed, 13 Oct 2021 09:14:57 +0100
From: Will Deacon <will@...nel.org>
To: Masami Hiramatsu <mhiramat@...nel.org>
Cc: Steven Rostedt <rostedt@...dmis.org>,
"Naveen N . Rao" <naveen.n.rao@...ux.vnet.ibm.com>,
Ananth N Mavinakayanahalli <ananth@...ux.ibm.com>,
Ingo Molnar <mingo@...nel.org>, linux-kernel@...r.kernel.org,
Sven Schnelle <svens@...ux.ibm.com>,
Catalin Marinas <catalin.marinas@....com>,
Russell King <linux@...linux.org.uk>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH 4/8] arm64: kprobes: Make a frame pointer on
__kretprobe_trampoline
On Fri, Oct 08, 2021 at 09:28:49PM +0900, Masami Hiramatsu wrote:
> Make a frame pointer (make the x29 register points the
> address of pt_regs->regs[29]) on __kretprobe_trampoline.
>
> This frame pointer will be used by the stacktracer when it is
> called from the kretprobe handlers. In this case, the stack
> tracer will unwind stack to trampoline_probe_handler() and
> find the next frame pointer in the stack frame of the
> __kretprobe_trampoline().
>
> Signed-off-by: Masami Hiramatsu <mhiramat@...nel.org>
> ---
> arch/arm64/kernel/probes/kprobes_trampoline.S | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/arch/arm64/kernel/probes/kprobes_trampoline.S b/arch/arm64/kernel/probes/kprobes_trampoline.S
> index 520ee8711db1..9a6499bed58b 100644
> --- a/arch/arm64/kernel/probes/kprobes_trampoline.S
> +++ b/arch/arm64/kernel/probes/kprobes_trampoline.S
> @@ -66,6 +66,9 @@ SYM_CODE_START(__kretprobe_trampoline)
>
> save_all_base_regs
>
> + /* Setup a frame pointer. */
> + add x29, sp, #S_FP
> +
> mov x0, sp
> bl trampoline_probe_handler
> /*
> @@ -74,6 +77,7 @@ SYM_CODE_START(__kretprobe_trampoline)
> */
> mov lr, x0
>
> + /* The frame pointer (x29) is restored with other registers. */
> restore_all_base_regs
>
> add sp, sp, #PT_REGS_SIZE
Acked-by: Will Deacon <will@...nel.org>
Will
Powered by blists - more mailing lists