All of lore.kernel.org
 help / color / mirror / Atom feed
From: Beau Belgrave <beaub@linux.microsoft.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Linux Trace Kernel <linux-trace-kernel@vger.kernel.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Subject: Re: [PATCH] tracing: Do not allow user events to add a system name
Date: Wed, 18 Nov 2026 21:48:27 +0000	[thread overview]
Message-ID: <20261118214827.GA683-beaub@linux.microsoft.com> (raw)
In-Reply-To: <20261118122520.4a689710@gandalf.local.home>

On Wed, Nov 18, 2026 at 12:25:20PM -0500, Steven Rostedt wrote:
> 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);
>  }
>  

Thanks Steve!

Acked-by: Beau Belgrave <beaub@linux.microsoft.com>

-Beau

> -- 
> 2.53.0

      reply	other threads:[~2026-11-18 21:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261118214827.GA683-beaub@linux.microsoft.com \
    --to=beaub@linux.microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.