From: Steven Rostedt <rostedt@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Andrew Morton <akpm@linux-foundation.org>,
stable@vger.kernel.org, Yifan Feng <evanfengff@gmail.com>
Subject: [for-linus][PATCH 4/5] ftrace: Reject "!!" in front of a set_ftrace_filter command
Date: Fri, 27 Nov 2026 13:42:07 -0500 [thread overview]
Message-ID: <20261127184242.197661244@kernel.org> (raw)
In-Reply-To: 20261127184203.439481361@kernel.org
From: Yifan Feng <evanfengff@gmail.com>
A command written to set_ftrace_filter with two '!' in front of the
function glob triggers the 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 command callbacks strip the first '!' and pass the rest as the glob
of the probe to remove. filter_parse_regex() then reports the second
'!' as a negated glob, which function probes do not support.
Return -EINVAL for such input in ftrace_process_regex(), before a
command callback is called.
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261119191205.32892-1-evanfengff@gmail.com
Fixes: 23b4ff3aa479 ("ftrace: add traceon traceoff commands to enable/disable the buffers")
Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Yifan Feng <evanfengff@gmail.com>
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/ftrace.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 6654da9d1bbf..5b161959e701 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -5847,6 +5847,13 @@ static int ftrace_process_regex(struct ftrace_iterator *iter,
/* command found */
+ /*
+ * A double "!!" confuses the parser. This isn't a boolean operation,
+ * simply reject it.
+ */
+ if (func[0] == '!' && func[1] == '!')
+ return -EINVAL;
+
command = strsep(&next, ":");
guard(mutex)(&ftrace_cmd_mutex);
--
2.53.0
next prev parent reply other threads:[~2026-11-27 18:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 18:42 [for-linus][PATCH 0/5] tracing: Fixes for v7.4 Steven Rostedt
2026-11-27 18:42 ` [for-linus][PATCH 1/5] tracing/user_events: Fail fork when event state duplication fails Steven Rostedt
2026-11-27 18:42 ` [for-linus][PATCH 2/5] tracing/remotes: Align field offset in remote_event_format_show() Steven Rostedt
2026-11-27 18:42 ` [for-linus][PATCH 3/5] ftrace: Fix lost recursion records in ftrace_record_recursion() Steven Rostedt
2026-11-27 18:42 ` Steven Rostedt [this message]
2026-11-27 18:42 ` [for-linus][PATCH 5/5] tracing/filters: Use atomic bitops and READ_ONCE() for trace_event_file::flags Steven Rostedt
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=20261127184242.197661244@kernel.org \
--to=rostedt@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=evanfengff@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=stable@vger.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 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.