]> git.baikalelectronics.ru Git - kernel.git/commit
selftests/bpf: Add libbpf's log fixup logic selftests
authorAndrii Nakryiko <andrii@kernel.org>
Tue, 26 Apr 2022 00:45:11 +0000 (17:45 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 26 Apr 2022 22:41:46 +0000 (15:41 -0700)
commit44684e86c41b00bca2f53b205f8b9b997aede2f6
treeeca090cff5cfac9246469b566e722fe81932e4f9
parent7fe2b2a51a8e473837200e00360d865e264fe61b
selftests/bpf: Add libbpf's log fixup logic selftests

Add tests validating that libbpf is indeed patching up BPF verifier log
with CO-RE relocation details. Also test partial and full truncation
scenarios.

This test might be a bit fragile due to changing BPF verifier log
format. If that proves to be frequently breaking, we can simplify tests
or remove the truncation subtests. But for now it seems useful to test
it in those conditions that are otherwise rarely occuring in practice.

Also test CO-RE relo failure in a subprog as that excercises subprogram CO-RE
relocation mapping logic which doesn't work out of the box without extra
relo storage previously done only for gen_loader case.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20220426004511.2691730-11-andrii@kernel.org
tools/testing/selftests/bpf/prog_tests/log_fixup.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/test_log_fixup.c [new file with mode: 0644]
tools/testing/selftests/bpf/test_progs.h