Skip to content

Commit 2aedacf

Browse files
rostedtgregkh
authored andcommitted
tracing/histograms: Fix parsing of "sym-offset" modifier
commit 26c5637 upstream. 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. Link: https://lkml.kernel.org/r/20210707110821.188ae255@oasis.local.home Cc: Ingo Molnar <mingo@kernel.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Daniel Bristot de Oliveira <bristot@redhat.com> Cc: stable@vger.kernel.org Fixes: 100719d ("tracing: Add simple expression support to hist triggers") Reviewed-by: Tom Zanussi <zanussi@kernel.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 998de99 commit 2aedacf

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎kernel/trace/trace_events_hist.c‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,6 +1539,13 @@ static int contains_operator(char *str)
15391539

15401540
switch (*op) {
15411541
case '-':
1542+
/*
1543+
* Unfortunately, the modifier ".sym-offset"
1544+
* can confuse things.
1545+
*/
1546+
if (op - str >= 4 && !strncmp(op - 4, ".sym-offset", 11))
1547+
return FIELD_OP_NONE;
1548+
15421549
if (*str == '-')
15431550
field_op = FIELD_OP_UNARY_MINUS;
15441551
else

0 commit comments

Comments
 (0)