On Mon, Dec 2, 2024 at 4:22 PM Kumar Kartikeya Dwivedi <memxor@xxxxxxxxx> wrote: > > Andrii spotted that process_dynptr_func's rejection of incorrect > argument register type will print an error string where argument numbers > are not zero-indexed, unlike elsewhere in the verifier. Fix this by > subtracting 1 from regno. The same scenario exists for iterator > messages. Fix selftest error strings that match on the exact argument > number while we're at it to ensure clean bisection. > > Suggested-by: Andrii Nakryiko <andrii@xxxxxxxxxx> > Signed-off-by: Kumar Kartikeya Dwivedi <memxor@xxxxxxxxx> > --- > Changelog: > v1 -> v2: > v1: https://lore.kernel.org/bpf/20241127212026.3580542-1-memxor@xxxxxxxxx > --- > kernel/bpf/verifier.c | 12 +++++----- > .../testing/selftests/bpf/progs/dynptr_fail.c | 22 +++++++++---------- > .../selftests/bpf/progs/iters_state_safety.c | 14 ++++++------ > .../selftests/bpf/progs/iters_testmod_seq.c | 4 ++-- > .../bpf/progs/test_kfunc_dynptr_param.c | 2 +- > .../selftests/bpf/progs/verifier_bits_iter.c | 4 ++-- > 6 files changed, 29 insertions(+), 29 deletions(-) > > diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c > index 1c4ebb326785..32c016d305af 100644 > --- a/kernel/bpf/verifier.c > +++ b/kernel/bpf/verifier.c > @@ -8071,7 +8071,7 @@ static int process_dynptr_func(struct bpf_verifier_env *env, int regno, int insn > if (reg->type != PTR_TO_STACK && reg->type != CONST_PTR_TO_DYNPTR) { > verbose(env, > "arg#%d expected pointer to stack or const struct bpf_dynptr\n", > - regno); > + regno - 1); I took it into bpf tree. Otherwise some messages in bpf tree will be without -1 and one with.