Commit
c47a7b11bcb3d45e29723afcf6336866476b1d08
tracing: Check operator stack capacity before pushing
predicate_parse() uses the first operator stack entry before processing
any opening parentheses. A push then increments top before writing.
The existing check still permits that write when top already points to
the last allocated entry, which can access beyond the operator stack.
Reject the push when top reaches the last allocated entry.
Cc: stable@vger.kernel.org
Fixes: 39f7c41c908b ("tracing/filters: Enable filtering a cpumask field by another cpumask")
Link: https://patch.msgid.link/atELO9L0I9kg5CpC@Taeyangs-MacBook-Pro.local
Signed-off-by: Taeyang Lee <0wn@theori.io>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Taeyang Lee <0wn@theori.io> · 2026-10-15 17:19 UTC · committed by Steven Rostedt
1 file changed,
+1
−1
modified kernel/trace/trace_events_filter.c
| @@ -511,7 +511,7 @@ predicate_parse(const char *str, int nr_parens, int nr_preds, | |||
| 511 | 511 | ||
| 512 | 512 | switch (*next) { | |
| 513 | 513 | case '(': /* #2 */ | |
| 514 | - | if (top - op_stack > nr_parens) { | |
| 514 | + | if (top - op_stack >= nr_parens - 1) { | |
| 515 | 515 | ret = -EINVAL; | |
| 516 | 516 | goto out_free; | |
| 517 | 517 | } | |