test_bpf: Add backward jump test case
Subsystems (3)
PATCH 1/1 test_bpf: Add backward jump test case
From: Michael Holzheu <[email protected]>
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 <[email protected]>
Signed-off-by Alexei Starovoitov <[email protected]>
--- lib/test_bpf.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
lib/test_bpf.c +16 -0
@@ -3940,6 +3940,22 @@ static struct bpf_test tests[] = { { }, { { 0, 1 } }, }, +/* BPF_JMP | BPF_JGT | BPF_K jump backwards */ + { + "JMP_JGT_K: if (3 > 2) return 1 (jump backwards)", + .u.insns_int = { +BPF_JMP_IMM (BPF_JA ,0 ,0 ,2 ),/* goto start */ +BPF_ALU32_IMM (BPF_MOV ,R0 ,1 ),/* out: */ +BPF_EXIT_INSN (), +BPF_ALU32_IMM (BPF_MOV ,R0 ,0 ),/* start: */ +BPF_LD_IMM64 (R1 ,3 ),/* note: this takes 2 insns */ +BPF_JMP_IMM (BPF_JGT ,R1 ,2 ,-6 ),/* goto out */ +BPF_EXIT_INSN (), + }, +INTERNAL , + { }, + { { 0, 1 } }, + }, {"JMP_JGE_K: if (3 >= 3) return 1" , .u.insns_int = {
Signature · 1 line
1.7.9.5
Quoted 8 lines · Alexei Starovoitov
From: Michael Holzheu <[email protected]>
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 <[email protected]>Signed-off-by Alexei Starovoitov <[email protected]>
Acked-by Daniel Borkmann <[email protected]>
From: Alexei Starovoitov <[email protected]>
Date: Fri, 22 May 2015 08:36:40 -0700
Quoted 8 lines
From: Michael Holzheu <[email protected]>
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 <[email protected]>Signed-off-by Alexei Starovoitov <[email protected]>
Applied, thanks.