From: Thomas Richter <tmri...@linux.vnet.ibm.com> Date: Mon, 7 Aug 2017 10:16:36 +0200
> Commit 18f3d6be6be1 ("selftests/bpf: Add test cases to test narrower ctx > field loads") > introduced new eBPF test cases. One of them (test_pkt_md_access.c) > fails on s390x. The BPF verifier error message is: > > [root@s8360046 bpf]# ./test_progs > test_pkt_access:PASS:ipv4 349 nsec > test_pkt_access:PASS:ipv6 212 nsec > [....] > libbpf: load bpf program failed: Permission denied > libbpf: -- BEGIN DUMP LOG --- > libbpf: > 0: (71) r2 = *(u8 *)(r1 +0) > invalid bpf_context access off=0 size=1 > > libbpf: -- END LOG -- > libbpf: failed to load program 'test1' > libbpf: failed to load object './test_pkt_md_access.o' > Summary: 29 PASSED, 1 FAILED > [root@s8360046 bpf]# > > This is caused by a byte endianness issue. S390x is a big endian > architecture. Pointer access to the lowest byte or halfword of a > four byte value need to add an offset. > On little endian architectures this offset is not needed. > > Fix this and use the same approach as the originator used for other files > (for example test_verifier.c) in his original commit. > > With this fix the test program test_progs succeeds on s390x: ... > Signed-off-by: Thomas Richter <tmri...@linux.vnet.ibm.com> > Acked-by: Daniel Borkmann <dan...@iogearbox.net> Applied, thanks.