Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tracing/histograms: Fix parsing of "sym-offset" modifier

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: 100719dcef447 ("tracing: Add simple expression support to hist triggers")
Reviewed-by: Tom Zanussi <zanussi@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

+7
+7
kernel/trace/trace_events_hist.c
··· 1555 1555 1556 1556 switch (*op) { 1557 1557 case '-': 1558 + /* 1559 + * Unfortunately, the modifier ".sym-offset" 1560 + * can confuse things. 1561 + */ 1562 + if (op - str >= 4 && !strncmp(op - 4, ".sym-offset", 11)) 1563 + return FIELD_OP_NONE; 1564 + 1558 1565 if (*str == '-') 1559 1566 field_op = FIELD_OP_UNARY_MINUS; 1560 1567 else