The sk_assign selftest uses tc to load the BPF object file for the test. If tc is linked against libbpf 1.0+, this test failed, because the BPF file used the legacy maps section. This approach is considered legacy by libbpf and tc (see examples/bpf/README in the iproute2 repo). Therefore, switch to the approach recommended by iproute2 and use a BTF defined map. This is also well supported by libbpf. Signed-off-by: Felix Maurer <fmaurer@xxxxxxxxxx> --- .../selftests/bpf/progs/test_sk_assign.c | 24 +++++-------------- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/tools/testing/selftests/bpf/progs/test_sk_assign.c b/tools/testing/selftests/bpf/progs/test_sk_assign.c index 98c6493d9b91..b0536bdc002b 100644 --- a/tools/testing/selftests/bpf/progs/test_sk_assign.c +++ b/tools/testing/selftests/bpf/progs/test_sk_assign.c @@ -16,25 +16,13 @@ #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> -/* Pin map under /sys/fs/bpf/tc/globals/<map name> */ -#define PIN_GLOBAL_NS 2 - -/* Must match struct bpf_elf_map layout from iproute2 */ struct { - __u32 type; - __u32 size_key; - __u32 size_value; - __u32 max_elem; - __u32 flags; - __u32 id; - __u32 pinning; -} server_map SEC("maps") = { - .type = BPF_MAP_TYPE_SOCKMAP, - .size_key = sizeof(int), - .size_value = sizeof(__u64), - .max_elem = 1, - .pinning = PIN_GLOBAL_NS, -}; + __uint(type, BPF_MAP_TYPE_SOCKMAP); + __uint(key_size, sizeof(int)); + __uint(value_size, sizeof(__u64)); + __uint(max_entries, 1); + __uint(pinning, LIBBPF_PIN_BY_NAME); +} server_map SEC(".maps"); char _license[] SEC("license") = "GPL"; -- 2.39.1