aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/prog_tests/bpf_verif_scale.c
diff options
context:
space:
mode:
authorAndrii Nakryiko <[email protected]>2024-01-09 23:17:38 +0000
committerAlexei Starovoitov <[email protected]>2024-01-23 22:40:22 +0000
commit56d3e44af80c6b4c7cb89a73061ee35d4a7aee18 (patch)
treefce1436714441a69d07d5e22171399b916e5a984 /tools/testing/selftests/bpf/prog_tests/bpf_verif_scale.c
parentIntroduce concept of conformance groups (diff)
downloadkernel-56d3e44af80c6b4c7cb89a73061ee35d4a7aee18.tar.gz
kernel-56d3e44af80c6b4c7cb89a73061ee35d4a7aee18.zip
selftests/bpf: detect testing prog flags support
Various tests specify extra testing prog_flags when loading BPF programs, like BPF_F_TEST_RND_HI32, and more recently also BPF_F_TEST_REG_INVARIANTS. While BPF_F_TEST_RND_HI32 is old enough to not cause much problem on older kernels, BPF_F_TEST_REG_INVARIANTS is very fresh and unconditionally specifying it causes selftests to fail on even slightly outdated kernels. This breaks libbpf CI test against 4.9 and 5.15 kernels, it can break some local development (done outside of VM), etc. To prevent this, and guard against similar problems in the future, do runtime detection of supported "testing flags", and only provide those that host kernel recognizes. Acked-by: Song Liu <[email protected]> Acked-by: Jiri Olsa <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/bpf_verif_scale.c')
-rw-r--r--tools/testing/selftests/bpf/prog_tests/bpf_verif_scale.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_verif_scale.c b/tools/testing/selftests/bpf/prog_tests/bpf_verif_scale.c
index e770912fc1d2..4c6ada5b270b 100644
--- a/tools/testing/selftests/bpf/prog_tests/bpf_verif_scale.c
+++ b/tools/testing/selftests/bpf/prog_tests/bpf_verif_scale.c
@@ -35,7 +35,7 @@ static int check_load(const char *file, enum bpf_prog_type type)
}
bpf_program__set_type(prog, type);
- bpf_program__set_flags(prog, BPF_F_TEST_RND_HI32 | BPF_F_TEST_REG_INVARIANTS);
+ bpf_program__set_flags(prog, testing_prog_flags());
bpf_program__set_log_level(prog, 4 | extra_prog_load_log_flags);
err = bpf_object__load(obj);