[for-linus][PATCH 32/32] tracing: Ignore .function on the function trace event

From: Steven Rostedt

Date: Fri Nov 20 2026 - 12:43:51 EST


From: David Carlier <devnexen@xxxxxxxxx>

For the function event, parse_pred() handles the .function suffix
before the ftrace_event_is_function() case, so "ip.function == schedule"
builds a predicate with no regex. Setting it through perf then
dereferences the NULL pred->regex in ftrace_function_set_filter_pred().

The "ip" field of that event already takes a function name, so ignore
the suffix there and let the function event case handle it.

Cc: stable@xxxxxxxxxxxxxxx
Fixes: cfb58e278c6a ("tracing/filters: Dynamically allocate filter_pred.regex")
Link: https://patch.msgid.link/20261119080139.131834-1-devnexen@xxxxxxxxx
Suggested-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
Signed-off-by: David Carlier <devnexen@xxxxxxxxx>
Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
---
kernel/trace/trace_events_filter.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index 7018964c94fc..a9d77df3e19a 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -1737,7 +1737,9 @@ static int parse_pred(const char *str, void *data,

/* See if the field is a kernel function name */
if ((len = str_has_prefix(str + i, ".function"))) {
- function = true;
+ /* Ignore if event is already a function */
+ if (!ftrace_event_is_function(call))
+ function = true;
i += len;
}

--
2.53.0