Skip to contentSkip to conversation

tracing: fprobe-event: Sanitize wildcard for fprobe event name

PATCH New Masami Hiramatsu (Google) 1 participant 1 message Aug 16, 2025 Tracing

lore
Share & tools
lore

Masami Hiramatsu (Google)

author maintainer
#0 lore raw

PATCH 1/1 tracing: fprobe-event: Sanitize wildcard for fprobe event name

From: Masami Hiramatsu (Google) <[email protected]>

Fprobe event accepts wildcards for the target functions, but unless user specifies its event name, it makes an event with the wildcards.

/sys/kernel/tracing # echo 'f mutex*' >> dynamic_events /sys/kernel/tracing # cat dynamic_events f:fprobes/mutex*__entry mutex* /sys/kernel/tracing # ls events/fprobes/
enable filter mutex*__entry

To fix this, replace the wildcard ('*') with an underscore.

Fixes 334e5519c375 ("tracing/probes: Add fprobe events for tracing function entry and exit.")
---
 kernel/trace/trace.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace.h +1 -1
index 1dbf1d3cf2f1..5a6688832da8 100644
@@ -2204,7 +2204,7 @@ static inline bool is_good_system_name(const char *name)
 static inline void sanitize_event_name(char *name)
 {
 	while (*name++ != '\0')
-		if (*name == ':' || *name == '.')
+		if (*name == ':' || *name == '.' || *name == '*')
 			*name = '_';
 }