From: Steven Rostedt <rostedt@goodmis.org>
To: David Carlier <devnexen@gmail.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] tracing: Reject .function on the function trace event
Date: Wed, 18 Nov 2026 15:32:20 -0500 [thread overview]
Message-ID: <20261118153220.15542786@gandalf.local.home> (raw)
In-Reply-To: <20261114195914.2678414-1-devnexen@gmail.com>
On Sat, 14 Nov 2026 19:59:14 +0000
David Carlier <devnexen@gmail.com> wrote:
> For the function event, parse_pred() handles the .function suffix
> before the ftrace_event_is_function() case, so "ip.function == schedule"
> builds a predicate with no regex. Setting it through perf then
> dereferences the NULL pred->regex in ftrace_function_set_filter_pred().
>
> The "ip" field of that event already takes a function name, so reject
> the suffix there.
>
> Fixes: e6745a4da964 ("tracing: Add a way to filter function addresses to function names")
> Cc: stable@vger.kernel.org
> Signed-off-by: David Carlier <devnexen@gmail.com>
> ---
> kernel/trace/trace_events_filter.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
> index c10951bcfc5f..11bb751c4388 100644
> --- a/kernel/trace/trace_events_filter.c
> +++ b/kernel/trace/trace_events_filter.c
> @@ -1743,6 +1743,12 @@ static int parse_pred(const char *str, void *data,
> pred->op = op;
>
> if (function) {
> + /* Function events already take a function name on 'ip' */
> + if (ftrace_event_is_function(call)) {
> + parse_error(pe, FILT_ERR_ILLEGAL_FIELD_OP, pos + i);
> + goto err_free;
> + }
> +
> /* The field must be the same size as long */
> if (field->size != sizeof(long)) {
> parse_error(pe, FILT_ERR_ILLEGAL_FIELD_OP, pos + i);
Instead of rejecting it, why not just ignore it?
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index a1c298210059..e64c44ab3ee5 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -1742,7 +1742,9 @@ static int parse_pred(const char *str, void *data,
/* See if the field is a kernel function name */
if ((len = str_has_prefix(str + i, ".function"))) {
- function = true;
+ /* Ignore if event is already a function */
+ if (!ftrace_event_is_function(call))
+ function = true;
i += len;
}
The above fixes the issue as well, and allows things to work as expected.
-- Steve
prev parent reply other threads:[~2026-11-18 20:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-14 19:59 [PATCH] tracing: Reject .function on the function trace event David Carlier
2026-11-14 20:12 ` sashiko-bot
2026-11-17 5:00 ` Daniel Wade
2026-11-18 20:32 ` 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=20261118153220.15542786@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=devnexen@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox