Thread (53 messages) flat view 53 messages, 4 authors, 2024-10-02

Re: [PATCH v14 03/19] function_graph: Pass ftrace_regs to entryfunc

From: Will Deacon <will@kernel.org>
Date: 2024-09-17 08:26:31
Also in: linux-arm-kernel, lkml

On Sun, Sep 15, 2024 at 04:46:14AM -0400, Steven Rostedt wrote:
Can I get an Acked-by from the AARCH64 maintainers for this patch?
Sorry, I wasn't CC'd on the thread, so I missed this.
On Fri, 13 Sep 2024 00:08:40 +0900
"Masami Hiramatsu (Google)" [off-list ref] wrote:
quoted
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>

Pass ftrace_regs to the fgraph_ops::entryfunc(). If ftrace_regs is not
available, it passes a NULL instead. User callback function can access
some registers (including return address) via this ftrace_regs.
Under which circumstances is 'ftrace_regs' NULL?

The arm64 implementation of ftrace_graph_func() is:
quoted
diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c
index a650f5e11fc5..bc647b725e6a 100644
--- a/arch/arm64/kernel/ftrace.c
+++ b/arch/arm64/kernel/ftrace.c
@@ -481,7 +481,25 @@ void prepare_ftrace_return(unsigned long self_addr, unsigned long *parent,
 void ftrace_graph_func(unsigned long ip, unsigned long parent_ip,
 		       struct ftrace_ops *op, struct ftrace_regs *fregs)
 {
-	prepare_ftrace_return(ip, &fregs->lr, fregs->fp);
+	unsigned long return_hooker = (unsigned long)&return_to_handler;
+	unsigned long frame_pointer = fregs->fp;
Which dereferences the unchecked pointer here ^^.

Will
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help