Files
linux/kernel/trace
Raushan Patel 00a8ce2a2a 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/[email protected]/

Fixes: 18b1e870a4 ("tracing/probes: Add $arg* meta argument for all function args")
Cc: [email protected]
Signed-off-by: Raushan Patel <[email protected]>
Signed-off-by: Masami Hiramatsu (Google) <[email protected]>
2026-07-28 23:58:31 +09:00
..