* [PATCH] tracing/probe: Fix same probe event argument matching
@ 2019-09-24 11:49 Srikar Dronamraju
2019-09-24 16:57 ` Masami Hiramatsu
0 siblings, 1 reply; 2+ messages in thread
From: Srikar Dronamraju @ 2019-09-24 11:49 UTC (permalink / raw)
To: Steven Rostedt, Masami Hiramatsu, Ingo Molnar
Cc: Andrew Morton, Naveen Rao, Ravi Bangoria, LKML, Srikar Dronamraju
Commit fe60b0ce8e73 ("tracing/probe: Reject exactly same probe event")
tries to reject a event which matches an already existing probe.
However it currently continues to match arguments and rejects adding a
probe even when the arguments don't match. Fix this by only rejecting a
probe if and only if all the arguments match.
Fixes: fe60b0ce8e73 ("tracing/probe: Reject exactly same probe event")
Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
---
kernel/trace/trace_kprobe.c | 5 +++--
kernel/trace/trace_uprobe.c | 5 +++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index a6697e28ddda..402dc3ce88d3 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -549,10 +549,11 @@ static bool trace_kprobe_has_same_kprobe(struct trace_kprobe *orig,
for (i = 0; i < orig->tp.nr_args; i++) {
if (strcmp(orig->tp.args[i].comm,
comp->tp.args[i].comm))
- continue;
+ break;
}
- return true;
+ if (i == orig->tp.nr_args)
+ return true;
}
return false;
diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index 34dd6d0016a3..dd884341f5c5 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -431,10 +431,11 @@ static bool trace_uprobe_has_same_uprobe(struct trace_uprobe *orig,
for (i = 0; i < orig->tp.nr_args; i++) {
if (strcmp(orig->tp.args[i].comm,
comp->tp.args[i].comm))
- continue;
+ break;
}
- return true;
+ if (i == orig->tp.nr_args)
+ return true;
}
return false;
--
2.18.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] tracing/probe: Fix same probe event argument matching
2019-09-24 11:49 [PATCH] tracing/probe: Fix same probe event argument matching Srikar Dronamraju
@ 2019-09-24 16:57 ` Masami Hiramatsu
0 siblings, 0 replies; 2+ messages in thread
From: Masami Hiramatsu @ 2019-09-24 16:57 UTC (permalink / raw)
To: Srikar Dronamraju
Cc: Steven Rostedt, Ingo Molnar, Andrew Morton, Naveen Rao,
Ravi Bangoria, LKML
Hi Srikar,
On Tue, 24 Sep 2019 17:19:06 +0530
Srikar Dronamraju <srikar@linux.vnet.ibm.com> wrote:
> Commit fe60b0ce8e73 ("tracing/probe: Reject exactly same probe event")
> tries to reject a event which matches an already existing probe.
>
> However it currently continues to match arguments and rejects adding a
> probe even when the arguments don't match. Fix this by only rejecting a
> probe if and only if all the arguments match.
Thank you for fixing!
This looks good to me.
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
>
> Fixes: fe60b0ce8e73 ("tracing/probe: Reject exactly same probe event")
> Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
> ---
> kernel/trace/trace_kprobe.c | 5 +++--
> kernel/trace/trace_uprobe.c | 5 +++--
> 2 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
> index a6697e28ddda..402dc3ce88d3 100644
> --- a/kernel/trace/trace_kprobe.c
> +++ b/kernel/trace/trace_kprobe.c
> @@ -549,10 +549,11 @@ static bool trace_kprobe_has_same_kprobe(struct trace_kprobe *orig,
> for (i = 0; i < orig->tp.nr_args; i++) {
> if (strcmp(orig->tp.args[i].comm,
> comp->tp.args[i].comm))
> - continue;
> + break;
> }
>
> - return true;
> + if (i == orig->tp.nr_args)
> + return true;
> }
>
> return false;
> diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
> index 34dd6d0016a3..dd884341f5c5 100644
> --- a/kernel/trace/trace_uprobe.c
> +++ b/kernel/trace/trace_uprobe.c
> @@ -431,10 +431,11 @@ static bool trace_uprobe_has_same_uprobe(struct trace_uprobe *orig,
> for (i = 0; i < orig->tp.nr_args; i++) {
> if (strcmp(orig->tp.args[i].comm,
> comp->tp.args[i].comm))
> - continue;
> + break;
> }
>
> - return true;
> + if (i == orig->tp.nr_args)
> + return true;
> }
>
> return false;
> --
> 2.18.1
>
--
Masami Hiramatsu <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-09-24 16:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-24 11:49 [PATCH] tracing/probe: Fix same probe event argument matching Srikar Dronamraju
2019-09-24 16:57 ` Masami Hiramatsu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).