diff options
author | Andrii Nakryiko <andrii@kernel.org> | 2024-01-09 15:17:38 -0800 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2024-01-23 14:40:22 -0800 |
commit | 56d3e44af80c6b4c7cb89a73061ee35d4a7aee18 (patch) | |
tree | fce1436714441a69d07d5e22171399b916e5a984 /tools/testing/selftests/bpf/testing_helpers.h | |
parent | 81777efbf59305fa145bede97dd4abdc35540578 (diff) |
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 <song@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20240109231738.575844-1-andrii@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/testing_helpers.h')
-rw-r--r-- | tools/testing/selftests/bpf/testing_helpers.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/testing_helpers.h b/tools/testing/selftests/bpf/testing_helpers.h index 1ed5b9200d66..e099aa4da611 100644 --- a/tools/testing/selftests/bpf/testing_helpers.h +++ b/tools/testing/selftests/bpf/testing_helpers.h @@ -51,5 +51,6 @@ struct bpf_insn; * e.g. verifier.c:convert_ctx_access() is done. */ int get_xlated_program(int fd_prog, struct bpf_insn **buf, __u32 *cnt); +int testing_prog_flags(void); #endif /* __TESTING_HELPERS_H */ |