tracing: fprobe-event: Sanitize wildcard for fprobe event name
authorMasami Hiramatsu (Google) <mhiramat@kernel.org>
Sat, 16 Aug 2025 14:10:51 +0000 (23:10 +0900)
committerMasami Hiramatsu (Google) <mhiramat@kernel.org>
Wed, 20 Aug 2025 14:41:58 +0000 (23:41 +0900)
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.

Link: https://lore.kernel.org/all/175535345114.282990.12294108192847938710.stgit@devnote2/
Fixes: 334e5519c375 ("tracing/probes: Add fprobe events for tracing function entry and exit.")
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Cc: stable@vger.kernel.org
kernel/trace/trace.h

index 1dbf1d3cf2f1d437c372b65ac359073aec0c738b..5a6688832da84df17e71a17988cad6983e9767d9 100644 (file)
@@ -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 = '_';
 }