Thread (17 messages) flat view 17 messages, 4 authors, 6h ago
HOTtoday REVIEWED: 2 (0M)

2 review trailers.

[PATCH RFC 1/8] ftrace: Let ftrace_call_adjust() reject a patch site

From: Jose Fernandez (Anthropic) <hidden>
Date: 2026-09-04 01:19:00
Also in: bpf, linux-efi, linux-kbuild, linux-trace-kernel, lkml, llvm, rust-for-linux
Subsystem: function hooks (ftrace), the rest, tracing · Maintainers: Steven Rostedt, Masami Hiramatsu, Linus Torvalds

When ftrace_call_adjust() returns 0 for a patch site,
ftrace_process_locs() does not skip the site. The NULL test runs before
the adjustment since commit 6eeca746fa5f ("ftrace: Test mcount_loc
addr before calling ftrace_call_addr()"), so the 0 is stored as the
record's ip and ftrace_init_nop() later hits the BUG_ON() in arm64's
patch_map(). Test the adjusted address too and count the site as
skipped.

Reviewed-by: Ben Cressey <redacted>
Reviewed-by: Florent Revest (Anthropic) <redacted>
Assisted-by: LLM
Signed-off-by: Jose Fernandez (Anthropic) <redacted>
---
 kernel/trace/ftrace.c | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index f9d80c7bd9f16..394f82230e0c3 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -7676,6 +7676,10 @@ static int ftrace_process_locs(struct module *mod,
 		}
 
 		addr = ftrace_call_adjust(addr);
+		if (!addr) {
+			skipped++;
+			continue;
+		}
 
 		end_offset = (pg->index+1) * sizeof(pg->records[0]);
 		if (end_offset > PAGE_SIZE << pg->order) {
-- 
2.52.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help