]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
tracing/probes: Reject $arg0 in meta argument expansion
authorRaushan Patel <raushan.jhon@gmail.com>
Fri, 24 Jul 2026 05:44:35 +0000 (11:14 +0530)
committerMasami Hiramatsu (Google) <mhiramat@kernel.org>
Tue, 28 Jul 2026 14:58:31 +0000 (23:58 +0900)
commit00a8ce2a2a9fa17674e1feec4d9105c1a5d6a419
tree05dddaab413d01da2662b9cb416166cfe8efb202
parentf5098b6bae761e346ebcd9da7f95622c04733cff
tracing/probes: Reject $arg0 in meta argument expansion

traceprobe_expand_meta_args() parses $argN with simple_strtoul() and
calls sprint_nth_btf_arg(n - 1, ...). For $arg0, n is 0 so the index is
-1. Because ctx->nr_params is signed, the "idx >= nr_params" guard in
sprint_nth_btf_arg() does not catch the negative index, and
ctx->params[-1].name_off is read out of bounds.

The normal per-argument path (parse_probe_vars()) already rejects
$arg0 via its argument-number check, but meta-argument expansion runs
before per-argument parsing and substitutes the value first, bypassing
that check.

Reject $arg0 explicitly during expansion.

Link: https://lore.kernel.org/all/20260724054435.146279-1-raushan.jhon@gmail.com/
Fixes: 18b1e870a496 ("tracing/probes: Add $arg* meta argument for all function args")
Cc: stable@vger.kernel.org
Signed-off-by: Raushan Patel <raushan.jhon@gmail.com>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
kernel/trace/trace_probe.c