bpf: Use canonical stack argument names in diagnostics

The main diagnostic identifies the first outgoing stack slot as stack
argument 1 and the sixth function argument. The causal history instead
labels the same value as stack arg6, making it look like a different slot.

Render causal-history targets in the verifier's canonical stack-argument
location form. The first outgoing slot is now shown as *(R11-8), matching
reg_arg_name(), while the main diagnostic retains its fuller slot and
ordinal description.

Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Link: https://lore.kernel.org/bpf/eb1be5327d136b7e5bd6d68e76fef6de20c40790.camel@gmail.com
Link: https://lore.kernel.org/bpf/20260816015746.2632990-6-memxor@gmail.com
This commit is contained in:
Kumar Kartikeya Dwivedi 2026-08-16 03:57:33 +02:00
parent b26c0b2dd5
commit 09a0c2d678
No known key found for this signature in database
GPG Key ID: 472D377B63542F83

View File

@ -2164,7 +2164,7 @@ static const char *diag_mod_target_desc(struct bpf_verifier_env *env,
case BPF_DIAG_MOD_TARGET_REG:
return bpf_diag_fmt(env, "R%u", target->regno);
case BPF_DIAG_MOD_TARGET_STACK_ARG:
return bpf_diag_fmt(env, "stack arg%d", diag_stack_argno(target->stack_arg));
return bpf_diag_fmt(env, "*(R11-%u)", (target->stack_arg + 1) * BPF_REG_SIZE);
case BPF_DIAG_MOD_TARGET_STACK_SLOT:
return bpf_diag_fmt(env, "stack slot fp%d", -(target->spi + 1) * BPF_REG_SIZE);
default: