From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Al Viro <viro@ZenIV.linux.org.uk>,
Masami Hiramatsu <mhiramat@kernel.org>,
Dmitry Safonov <0x7f454c46@gmail.com>,
stable@vger.kernel.org
Subject: [RFC][PATCH 1/6] ftrace: Remove incorrect setting of glob search field
Date: Tue, 06 Feb 2018 17:43:39 -0500 [thread overview]
Message-ID: <20180206224541.082571667@goodmis.org> (raw)
In-Reply-To: <20180206224338.446477232@goodmis.org>
[-- Attachment #1: 0001-ftrace-Remove-incorrect-setting-of-glob-search-field.patch --]
[-- Type: text/plain, Size: 1784 bytes --]
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
__unregister_ftrace_function_probe() will incorrectly parse the glob filter
because it resets the search variable that was setup by filter_parse_regex().
Al Viro reported this:
After that call of filter_parse_regex() we could have func_g.search not
equal to glob only if glob started with '!' or '*'. In the former case
we would've buggered off with -EINVAL (not = 1). In the latter we
would've set func_g.search equal to glob + 1, calculated the length of
that thing in func_g.len and proceeded to reset func_g.search back to
glob.
Suppose the glob is e.g. *foo*. We end up with
func_g.type = MATCH_MIDDLE_ONLY;
func_g.len = 3;
func_g.search = "*foo";
Feeding that to ftrace_match_record() will not do anything sane - we
will be looking for names containing "*foo" (->len is ignored for that
one).
Link: http://lkml.kernel.org/r/20180127031706.GE13338@ZenIV.linux.org.uk
Cc: stable@vger.kernel.org
Cc: Dmitry Safonov <0x7f454c46@gmail.com>
Fixes: 3ba009297149f ("ftrace: Introduce ftrace_glob structure")
Reported-by: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
kernel/trace/ftrace.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index dabd9d167d42..eac9ce2c57a2 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -4456,7 +4456,6 @@ unregister_ftrace_function_probe_func(char *glob, struct trace_array *tr,
func_g.type = filter_parse_regex(glob, strlen(glob),
&func_g.search, ¬);
func_g.len = strlen(func_g.search);
- func_g.search = glob;
/* we do not support '!' for function probes */
if (WARN_ON(not))
--
2.15.1
next prev parent reply other threads:[~2018-02-06 22:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-06 22:43 [RFC][PATCH 0/6] tracing: Fix bogus parsing of probes and set_ftrace_filter Steven Rostedt
2018-02-06 22:43 ` Steven Rostedt [this message]
2018-02-07 14:35 ` [RFC][PATCH 1/6] ftrace: Remove incorrect setting of glob search field Dmitry Safonov
2018-02-08 14:00 ` Masami Hiramatsu
2018-02-06 22:43 ` [RFC][PATCH 2/6] tracing: Fix parsing of globs with a wildcard at the beginning Steven Rostedt
2018-02-08 14:01 ` Masami Hiramatsu
2018-02-06 22:43 ` [RFC][PATCH 3/6] selftests/ftrace: Have reset_ftrace_filter handle modules Steven Rostedt
2018-02-06 22:43 ` [RFC][PATCH 4/6] selftests/ftrace: Have reset_ftrace_filter handle multiple instances Steven Rostedt
2018-02-06 22:43 ` [RFC][PATCH 5/6] selftests/ftrace: Add some missing glob checks Steven Rostedt
2018-02-08 14:07 ` Masami Hiramatsu
2018-02-06 22:43 ` [RFC][PATCH 6/6] selftests/ftrace: Add more tests for removing of function probes 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=20180206224541.082571667@goodmis.org \
--to=rostedt@goodmis.org \
--cc=0x7f454c46@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=mingo@kernel.org \
--cc=stable@vger.kernel.org \
--cc=viro@ZenIV.linux.org.uk \
/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
Powered by JetHome