test_bpf: extend tests for 32-bit endianness conversion
Subsystems (3)
PATCH 1/1 test_bpf: extend tests for 32-bit endianness conversion
Currently "ALU_END_FROM_BE 32" and "ALU_END_FROM_LE 32" do not test if the upper bits of the result are zeros (the arm64 JIT had such bugs). Extend the two tests to catch this.
Cc Alexei Starovoitov <[email protected]>
Signed-off-by Xi Wang <[email protected]>
---
See the arm64 JIT bugs:
https://lkml.org/lkml/2015/6/25/721
--- lib/test_bpf.c | 6 ++++++ 1 file changed, 6 insertions(+)
lib/test_bpf.c +6 -0
@@ -3674,6 +3674,9 @@ static struct bpf_test tests[] = { .u.insns_int = {BPF_LD_IMM64 (R0 ,0x0123456789abcdefLL ),BPF_ENDIAN (BPF_FROM_BE ,R0 ,32 ), +BPF_ALU64_REG (BPF_MOV ,R1 ,R0 ), +BPF_ALU64_IMM (BPF_RSH ,R1 ,32 ), +BPF_ALU32_REG (BPF_ADD ,R0 ,R1 ),/* R1 = 0 */ BPF_EXIT_INSN (), }, INTERNAL,
@@ -3708,6 +3711,9 @@ static struct bpf_test tests[] = { .u.insns_int = {BPF_LD_IMM64 (R0 ,0x0123456789abcdefLL ),BPF_ENDIAN (BPF_FROM_LE ,R0 ,32 ), +BPF_ALU64_REG (BPF_MOV ,R1 ,R0 ), +BPF_ALU64_IMM (BPF_RSH ,R1 ,32 ), +BPF_ALU32_REG (BPF_ADD ,R0 ,R1 ),/* R1 = 0 */ BPF_EXIT_INSN (), }, INTERNAL,
Signature · 1 line
2.1.4
Quoted 6 lines · Xi Wang
Currently "
ALU_END_FROM_BE32" and "ALU_END_FROM_LE32" do not test if the upper bits of the result are zeros (the arm64 JIT had such bugs). Extend the two tests to catch this.Cc Alexei Starovoitov <[email protected]>Signed-off-by Xi Wang <[email protected]>
Thanks for extending the test suite!
Acked-by Daniel Borkmann <[email protected]>
Quoted 6 lines · Xi Wang
Currently "
ALU_END_FROM_BE32" and "ALU_END_FROM_LE32" do not test if the upper bits of the result are zeros (the arm64 JIT had such bugs). Extend the two tests to catch this.Cc Alexei Starovoitov<[email protected]>Signed-off-by Xi Wang<[email protected]>
looks good. Please resubmit when net-next reopens. Thanks!