diff options
| author | Andrii Nakryiko <[email protected]> | 2022-09-27 04:29:39 +0000 |
|---|---|---|
| committer | Daniel Borkmann <[email protected]> | 2022-09-27 18:45:17 +0000 |
| commit | 87dbdc230d162bf9ee1ac77c8ade178b6b1e199e (patch) | |
| tree | 551e0f6feebbb075cd8ddd391058c806722b1ca7 /tools/testing/selftests/bpf/prog_tests/sockmap_basic.c | |
| parent | selftests/bpf: Fix passing arguments via function in test_kmod.sh (diff) | |
| download | kernel-87dbdc230d162bf9ee1ac77c8ade178b6b1e199e.tar.gz kernel-87dbdc230d162bf9ee1ac77c8ade178b6b1e199e.zip | |
libbpf: Don't require full struct enum64 in UAPI headers
Drop the requirement for system-wide kernel UAPI headers to provide full
struct btf_enum64 definition. This is an unexpected requirement that
slipped in libbpf 1.0 and put unnecessary pressure ([0]) on users to have
a bleeding-edge kernel UAPI header from unreleased Linux 6.0.
To achieve this, we forward declare struct btf_enum64. But that's not
enough as there is btf_enum64_value() helper that expects to know the
layout of struct btf_enum64. So we get a bit creative with
reinterpreting memory layout as array of __u32 and accesing lo32/hi32
fields as array elements. Alternative way would be to have a local
pointer variable for anonymous struct with exactly the same layout as
struct btf_enum64, but that gets us into C++ compiler errors complaining
about invalid type casts. So play it safe, if ugly.
[0] Closes: https://github.com/libbpf/libbpf/issues/562
Fixes: d90ec262b35b ("libbpf: Add enum64 support for btf_dump")
Reported-by: Toke Høiland-Jørgensen <[email protected]>
Signed-off-by: Andrii Nakryiko <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Acked-by: Toke Høiland-Jørgensen <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/sockmap_basic.c')
0 files changed, 0 insertions, 0 deletions
