selftests/bpf: Fix test_core_autosize on big-endian machines
authorIlya Leoshkevich <iii@linux.ibm.com>
Thu, 12 Aug 2021 22:48:14 +0000 (00:48 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Sep 2021 08:02:22 +0000 (10:02 +0200)
commit1b703f43b3bf74ad74b36ef0e8d6438147f6e832
tree8154238659cb5c28b72fd224729221bc4a6d023c
parent949f35e1952189fc714396ae8c4c0964abc21c3b
selftests/bpf: Fix test_core_autosize on big-endian machines

[ Upstream commit d164dd9a5c08c16a883b3de97d13948c7be7fa4d ]

The "probed" part of test_core_autosize copies an integer using
bpf_core_read() into an integer of a potentially different size.
On big-endian machines a destination offset is required for this to
produce a sensible result.

Fixes: 888d83b961f6 ("selftests/bpf: Validate libbpf's auto-sizing of LD/ST/STX instructions")
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20210812224814.187460-1-iii@linux.ibm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/testing/selftests/bpf/progs/test_core_autosize.c