]> www.infradead.org Git - users/jedix/linux-maple.git/commit
bpf: Zero index arg error string for dynptr and iter
authorKumar Kartikeya Dwivedi <memxor@gmail.com>
Tue, 3 Dec 2024 00:22:35 +0000 (16:22 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 3 Dec 2024 02:47:41 +0000 (18:47 -0800)
commitbd74e238ae6944b462f57ce8752440a011ba4530
treea6d52b148671d8270b985ecf8cf2547c42c96a44
parentd4c44354bcaffed729c4eba8c0f2ecfd61fea743
bpf: Zero index arg error string for dynptr and iter

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@kernel.org>
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/r/20241203002235.3776418-1-memxor@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/verifier.c
tools/testing/selftests/bpf/progs/dynptr_fail.c
tools/testing/selftests/bpf/progs/iters_state_safety.c
tools/testing/selftests/bpf/progs/iters_testmod_seq.c
tools/testing/selftests/bpf/progs/test_kfunc_dynptr_param.c
tools/testing/selftests/bpf/progs/verifier_bits_iter.c