From: Will Hawkins <hawkinsw@borlaugic.com>
To: linux-kernel@vger.kernel.org, hawkinsw@gmail.com, rostedt@goodmis.org
Cc: Will Hawkins <hawkinsw@borlaugic.com>
Subject: [PATCH] trace-cmd record: Fix syntax in make_pid_filter
Date: Fri, 13 Oct 2017 13:57:12 -0400 [thread overview]
Message-ID: <1507917432-8110-1-git-send-email-hawkinsw@borlaugic.com> (raw)
In older versions of the kernel, event filtering by
pid does not use the set_event_pid file. Instead,
ftrace uses a common filter (created in make_pid_filter)
to filter events based on PID.
The syntax of the filter generated by this function is
overly permissive. When filtering by pid, || is used
where && should be (in certain cases) which means that
unrelated events are captured.
Signed-off-by: Will Hawkins <hawkinsw@borlaugic.com>
---
trace-record.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/trace-record.c b/trace-record.c
index a0b6541..d9c2959 100644
--- a/trace-record.c
+++ b/trace-record.c
@@ -935,14 +935,19 @@ static char *make_pid_filter(char *curr_filter, const char *field)
str = filter + curr_len;
for (p = filter_pids; p; p = p->next) {
- if (p == filter_pids)
- orit = "";
- else
- orit = "||";
- if (p->exclude)
+ if (p->exclude) {
match = "!=";
- else
+ if (p == filter_pids)
+ orit = "";
+ else
+ orit = "&&";
+ } else {
match = "==";
+ if (p == filter_pids)
+ orit = "";
+ else
+ orit = "||";
+ }
len = sprintf(str, "%s(%s%s%d)", orit, field, match, p->pid);
str += len;
}
--
2.7.4
next reply other threads:[~2017-10-13 17:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-13 17:57 Will Hawkins [this message]
2017-10-13 18:24 ` Steven Rostedt
2017-10-13 18:32 ` Will Hawkins
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=1507917432-8110-1-git-send-email-hawkinsw@borlaugic.com \
--to=hawkinsw@borlaugic.com \
--cc=hawkinsw@gmail.com \
--cc=linux-kernel@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®