sk_assign is failing on an s390x machine running Debian "bookworm" for 2 reasons: legacy server_map definition and uninitialized addrlen in recvfrom() call. Fix by upgrading the server_map definition and dropping addrlen (recvfrom() allows NULL values for src_addr and addrlen). Signed-off-by: Ilya Leoshkevich <iii@xxxxxxxxxxxxx> --- .../selftests/bpf/prog_tests/sk_assign.c | 5 +--- .../selftests/bpf/progs/test_sk_assign.c | 24 +++++-------------- 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/sk_assign.c b/tools/testing/selftests/bpf/prog_tests/sk_assign.c index 3e190ed63976..ba99dce1db0d 100644 --- a/tools/testing/selftests/bpf/prog_tests/sk_assign.c +++ b/tools/testing/selftests/bpf/prog_tests/sk_assign.c @@ -129,15 +129,12 @@ get_port(int fd) static ssize_t rcv_msg(int srv_client, int type) { - struct sockaddr_storage ss; char buf[BUFSIZ]; - socklen_t slen; if (type == SOCK_STREAM) return read(srv_client, &buf, sizeof(buf)); else - return recvfrom(srv_client, &buf, sizeof(buf), 0, - (struct sockaddr *)&ss, &slen); + return recvfrom(srv_client, &buf, sizeof(buf), 0, NULL, NULL); } static int diff --git a/tools/testing/selftests/bpf/progs/test_sk_assign.c b/tools/testing/selftests/bpf/progs/test_sk_assign.c index 98c6493d9b91..13ba4dd2d19f 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); + __type(key, int); + __type(value, __u64); + __uint(pinning, LIBBPF_PIN_BY_NAME); + __uint(max_entries, 1); +} server_map SEC(".maps"); char _license[] SEC("license") = "GPL"; -- 2.39.1