diff options
author | Michael Holzheu <holzheu@linux.vnet.ibm.com> | 2015-05-22 11:36:40 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-05-22 15:10:51 -0400 |
commit | fe593844957a7ce092ee14e085ee8ddfd6c3b73f (patch) | |
tree | 1f41b51bac7e836294405e4b1f03594bd9bfea74 | |
parent | 12c227ec89a70c14e3efcf102c5babece381e172 (diff) |
test_bpf: Add backward jump test case
Currently the testsuite does not have a test case with a backward jump.
The s390x JIT (kernel 4.0) had a bug in that area.
So add one new test case for this now.
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | lib/test_bpf.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/test_bpf.c b/lib/test_bpf.c index aaa0a40a7eb3..9b012a811ee1 100644 --- a/lib/test_bpf.c +++ b/lib/test_bpf.c | |||
@@ -3940,6 +3940,22 @@ static struct bpf_test tests[] = { | |||
3940 | { }, | 3940 | { }, |
3941 | { { 0, 1 } }, | 3941 | { { 0, 1 } }, |
3942 | }, | 3942 | }, |
3943 | /* BPF_JMP | BPF_JGT | BPF_K jump backwards */ | ||
3944 | { | ||
3945 | "JMP_JGT_K: if (3 > 2) return 1 (jump backwards)", | ||
3946 | .u.insns_int = { | ||
3947 | BPF_JMP_IMM(BPF_JA, 0, 0, 2), /* goto start */ | ||
3948 | BPF_ALU32_IMM(BPF_MOV, R0, 1), /* out: */ | ||
3949 | BPF_EXIT_INSN(), | ||
3950 | BPF_ALU32_IMM(BPF_MOV, R0, 0), /* start: */ | ||
3951 | BPF_LD_IMM64(R1, 3), /* note: this takes 2 insns */ | ||
3952 | BPF_JMP_IMM(BPF_JGT, R1, 2, -6), /* goto out */ | ||
3953 | BPF_EXIT_INSN(), | ||
3954 | }, | ||
3955 | INTERNAL, | ||
3956 | { }, | ||
3957 | { { 0, 1 } }, | ||
3958 | }, | ||
3943 | { | 3959 | { |
3944 | "JMP_JGE_K: if (3 >= 3) return 1", | 3960 | "JMP_JGE_K: if (3 >= 3) return 1", |
3945 | .u.insns_int = { | 3961 | .u.insns_int = { |