selftests/bpf: Make test_varlen work with 32-bit user-space arch
authorAndrii Nakryiko <andriin@fb.com>
Thu, 13 Aug 2020 20:49:45 +0000 (13:49 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 13 Aug 2020 23:45:41 +0000 (16:45 -0700)
commit4fccd2ff74fbad222c69c7604307e0773a37ab8d
tree29871d1e9eaaf2461ebc6e47b21b2587a1e0e1ea
parent0f993845d723c87656552837b412994d6086f086
selftests/bpf: Make test_varlen work with 32-bit user-space arch

Despite bpftool generating data section memory layout that will work for
32-bit architectures on user-space side, BPF programs should be careful to not
use ambiguous types like `long`, which have different size in 32-bit and
64-bit environments. Fix that in test by using __u64 explicitly, which is
a recommended approach anyway.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200813204945.1020225-10-andriin@fb.com
tools/testing/selftests/bpf/prog_tests/varlen.c
tools/testing/selftests/bpf/progs/test_varlen.c