* [PATCH] tracing/histograms: Fix parsing of "sym-offset" modifier
@ 2021-07-07 15:08 Steven Rostedt
2021-07-07 16:30 ` Tom Zanussi
0 siblings, 1 reply; 2+ messages in thread
From: Steven Rostedt @ 2021-07-07 15:08 UTC (permalink / raw)
To: LKML, Ingo Molnar, Andrew Morton, Tom Zanussi, Masami Hiramatsu,
Namhyung Kim, Daniel Bristot de Oliveira
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
With the addition of simple mathematical operations (plus and minus), the
parsing of the "sym-offset" modifier broke, as it took the '-' part of the
"sym-offset" as a minus, and tried to break it up into a mathematical
operation of "field.sym - offset", in which case it failed to parse
(unless the event had a field called "offset").
Both .sym and .sym-offset modifiers should not be entered into
mathematical calculations anyway. If ".sym-offset" is found in the
modifier, then simply make it not an operation that can be calculated on.
Cc: stable@vger.kernel.org
Fixes: 100719dcef447 ("tracing: Add simple expression support to hist triggers")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
kernel/trace/trace_events_hist.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
index ba03b7d84fc2..0207aeed31e6 100644
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -1555,6 +1555,13 @@ static int contains_operator(char *str)
switch (*op) {
case '-':
+ /*
+ * Unfortunately, the modifier ".sym-offset"
+ * can confuse things.
+ */
+ if (op - str >= 4 && !strncmp(op - 4, ".sym-offset", 11))
+ return FIELD_OP_NONE;
+
if (*str == '-')
field_op = FIELD_OP_UNARY_MINUS;
else
--
2.31.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] tracing/histograms: Fix parsing of "sym-offset" modifier
2021-07-07 15:08 [PATCH] tracing/histograms: Fix parsing of "sym-offset" modifier Steven Rostedt
@ 2021-07-07 16:30 ` Tom Zanussi
0 siblings, 0 replies; 2+ messages in thread
From: Tom Zanussi @ 2021-07-07 16:30 UTC (permalink / raw)
To: Steven Rostedt, LKML, Ingo Molnar, Andrew Morton,
Masami Hiramatsu, Namhyung Kim, Daniel Bristot de Oliveira
Hi Steve,
On Wed, 2021-07-07 at 11:08 -0400, Steven Rostedt wrote:
> From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
>
> With the addition of simple mathematical operations (plus and minus),
> the
> parsing of the "sym-offset" modifier broke, as it took the '-' part
> of the
> "sym-offset" as a minus, and tried to break it up into a mathematical
> operation of "field.sym - offset", in which case it failed to parse
> (unless the event had a field called "offset").
>
> Both .sym and .sym-offset modifiers should not be entered into
> mathematical calculations anyway. If ".sym-offset" is found in the
> modifier, then simply make it not an operation that can be calculated
> on.
>
> Cc: stable@vger.kernel.org
> Fixes: 100719dcef447 ("tracing: Add simple expression support to hist
> triggers")
> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> ---
> kernel/trace/trace_events_hist.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/kernel/trace/trace_events_hist.c
> b/kernel/trace/trace_events_hist.c
> index ba03b7d84fc2..0207aeed31e6 100644
> --- a/kernel/trace/trace_events_hist.c
> +++ b/kernel/trace/trace_events_hist.c
> @@ -1555,6 +1555,13 @@ static int contains_operator(char *str)
>
> switch (*op) {
> case '-':
> + /*
> + * Unfortunately, the modifier ".sym-offset"
> + * can confuse things.
> + */
Good catch.
> + if (op - str >= 4 && !strncmp(op - 4, ".sym-offset",
> 11))
> + return FIELD_OP_NONE;
> +
> if (*str == '-')
> field_op = FIELD_OP_UNARY_MINUS;
> else
Reviewed-by: Tom Zanussi <zanussi@kernel.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-07-07 16:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-07 15:08 [PATCH] tracing/histograms: Fix parsing of "sym-offset" modifier Steven Rostedt
2021-07-07 16:30 ` Tom Zanussi
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.