mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] tracing: Do not allow user events to add a system name
@ 2026-11-18 17:25 Steven Rostedt
  2026-11-18 21:48 ` Beau Belgrave
  0 siblings, 1 reply; 2+ messages in thread
From: Steven Rostedt @ 2026-11-18 17:25 UTC (permalink / raw)
  To: LKML, Linux Trace Kernel
  Cc: Masami Hiramatsu, Mathieu Desnoyers, Beau Belgrave

From: Steven Rostedt <rostedt@goodmis.org>

User events currently do not support the addition of a system name, but
the parsing does not check to see if one is specified.

A kprobe can add its own system name with the following command:

 ~# echo 'p:mysystem/kprobe_event schedule a=%ax' >> dynamic_events
 ~# ls events/mysystem
 enable  filter  kprobe_event

But if one tries to do the same with user events:

 ~# echo 'u:user_events/test u32 a' >> dynamic_events
 ~# ls events/user_events
 ls: reading directory 'events/user_events/': Invalid argument
 enable  filter

It corrupts the file system as the event added had a '/' in the name.

Until user events support specifying system names, just return -EINVAL to
prevent the corrupted file system from happening:

 ~# echo 'u:user_events/test u32 a' >> dynamic_events
 -bash: echo: write error: Invalid argument

Cc: stable@vger.kernel.org
Fixes: 7f5a08c79df35 ("user_events: Add minimal support for trace_event into ftrace")
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace_events_user.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c
index f658c3a77aa7..5d41a28e4493 100644
--- a/kernel/trace/trace_events_user.c
+++ b/kernel/trace/trace_events_user.c
@@ -1035,6 +1035,9 @@ static int user_event_parse_cmd(struct user_event_group *group,
 	if (flags)
 		*flags++ = '\0';
 
+	if (strstr(name, "/") != NULL)
+		return -EINVAL;
+
 	return user_event_parse(group, name, args, flags, newuser, reg_flags);
 }
 
-- 
2.53.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-18 21:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-18 17:25 [PATCH] tracing: Do not allow user events to add a system name Steven Rostedt
2026-11-18 21:48 ` Beau Belgrave

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®