diff options
author | Xi Wang <xi.wang@gmail.com> | 2015-07-08 17:00:56 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-07-08 19:19:53 -0400 |
commit | ba29becd770ffec90f3af896daffac6b9acec608 (patch) | |
tree | 96815c89643734aba98bd63bb68454dd92547eab /lib/test_bpf.c | |
parent | ca661a28887714ee2ebdcfe9e89fa2528fcbfbbf (diff) |
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.
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'lib/test_bpf.c')
-rw-r--r-- | lib/test_bpf.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/test_bpf.c b/lib/test_bpf.c index 7f58c735d745..9198f28a5528 100644 --- a/lib/test_bpf.c +++ b/lib/test_bpf.c | |||
@@ -3674,6 +3674,9 @@ static struct bpf_test tests[] = { | |||
3674 | .u.insns_int = { | 3674 | .u.insns_int = { |
3675 | BPF_LD_IMM64(R0, 0x0123456789abcdefLL), | 3675 | BPF_LD_IMM64(R0, 0x0123456789abcdefLL), |
3676 | BPF_ENDIAN(BPF_FROM_BE, R0, 32), | 3676 | BPF_ENDIAN(BPF_FROM_BE, R0, 32), |
3677 | BPF_ALU64_REG(BPF_MOV, R1, R0), | ||
3678 | BPF_ALU64_IMM(BPF_RSH, R1, 32), | ||
3679 | BPF_ALU32_REG(BPF_ADD, R0, R1), /* R1 = 0 */ | ||
3677 | BPF_EXIT_INSN(), | 3680 | BPF_EXIT_INSN(), |
3678 | }, | 3681 | }, |
3679 | INTERNAL, | 3682 | INTERNAL, |
@@ -3708,6 +3711,9 @@ static struct bpf_test tests[] = { | |||
3708 | .u.insns_int = { | 3711 | .u.insns_int = { |
3709 | BPF_LD_IMM64(R0, 0x0123456789abcdefLL), | 3712 | BPF_LD_IMM64(R0, 0x0123456789abcdefLL), |
3710 | BPF_ENDIAN(BPF_FROM_LE, R0, 32), | 3713 | BPF_ENDIAN(BPF_FROM_LE, R0, 32), |
3714 | BPF_ALU64_REG(BPF_MOV, R1, R0), | ||
3715 | BPF_ALU64_IMM(BPF_RSH, R1, 32), | ||
3716 | BPF_ALU32_REG(BPF_ADD, R0, R1), /* R1 = 0 */ | ||
3711 | BPF_EXIT_INSN(), | 3717 | BPF_EXIT_INSN(), |
3712 | }, | 3718 | }, |
3713 | INTERNAL, | 3719 | INTERNAL, |