Linux Trace Kernel
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Yifan Feng <evanfengff@gmail.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ftrace: Do not WARN on a function probe glob that starts with '!'
Date: Wed, 18 Nov 2026 15:56:19 -0500	[thread overview]
Message-ID: <20261118155619.4d465f3c@gandalf.local.home> (raw)
In-Reply-To: <20261118032637.80038-1-evanfengff@gmail.com>

On Tue, 17 Nov 2026 19:26:37 -0800
Yifan Feng <evanfengff@gmail.com> wrote:

> Removing a function probe with a second '!' in front of the glob
> triggers a WARN_ON() in unregister_ftrace_function_probe_func():
> 
>   # echo '!!vfs_read:traceoff' >> set_ftrace_filter
>   WARNING: kernel/trace/ftrace.c:5675 at unregister_ftrace_function_probe_func+0x662/0x870
> 
> The callback strips the first '!' and filter_parse_regex() then reports
> the second one as a negated glob. This is plain bad input from user
> space, so return -EINVAL without the warning.

I still want the warning because that should never happen.

The real fix is to make "!!" return -EINVAL immediately.

-- Steve


> 
> Fixes: 23b4ff3aa479 ("ftrace: add traceon traceoff commands to enable/disable the buffers")
> Signed-off-by: Yifan Feng <evanfengff@gmail.com>
> ---
> Tested on v7.4-rc3 in QEMU: WARNING and taint before, -EINVAL only after.
> Found and written with the help of an AI coding assistant.
> 
>  kernel/trace/ftrace.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index c7d74b33d36d..04ea82a18601 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -5672,7 +5672,7 @@ unregister_ftrace_function_probe_func(char *glob, struct trace_array *tr,
>  		func_g.len = strlen(func_g.search);
>  
>  		/* we do not support '!' for function probes */
> -		if (WARN_ON(not))
> +		if (not)
>  			return -EINVAL;
>  	}
>  
> 
> base-commit: 7ccb044c27720d48175577080b851f047ddcfd1c


      reply	other threads:[~2026-11-18 20:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18  3:26 [PATCH] ftrace: Do not WARN on a function probe glob that starts with '!' Yifan Feng
2026-11-18 20:56 ` Steven Rostedt [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=20261118155619.4d465f3c@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=evanfengff@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox