Re: [PATCH] tracing: Do not allow user events to add a system name
From: Beau Belgrave
Date: Wed Nov 18 2026 - 16:49:00 EST
On Wed, Nov 18, 2026 at 12:25:20PM -0500, Steven Rostedt wrote:
> From: Steven Rostedt <rostedt@xxxxxxxxxxx>
>
> 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@xxxxxxxxxxxxxxx
> Fixes: 7f5a08c79df35 ("user_events: Add minimal support for trace_event into ftrace")
> Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
> ---
> 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);
> }
>
Thanks Steve!
Acked-by: Beau Belgrave <beaub@xxxxxxxxxxxxxxxxxxx>
-Beau
> --
> 2.53.0