Skip to contentSkip to conversation

tracing: Ignore .function on the function trace event

PATCH New David Carlier 1 participant 1 message Nov 19

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 tracing: Ignore .function on the function trace event

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.

Fixes cfb58e278c6a ("tracing/filters: Dynamically allocate filter_pred.regex")

---
Changes in v2:
- Ignore the suffix instead of rejecting it (Steven)
- Fixes: points at the commit that made regex a pointer (Daniel Wade)
- v1: https://lore.kernel.org/linux-trace-kernel/[email protected]/

 kernel/trace/trace_events_filter.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/trace/trace_events_filter.c +3 -1
index c10951bcfc5f..2bbcc2abe794 100644
@@ -1708,7 +1708,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;
 	}
 
Signature · 1 line
2.55.0