netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] test_bpf: Add backward jump test case
@ 2015-05-22 15:36 Alexei Starovoitov
  2015-05-22 16:06 ` Daniel Borkmann
  2015-05-22 19:11 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Alexei Starovoitov @ 2015-05-22 15:36 UTC (permalink / raw)
  To: David S. Miller
  Cc: Michael Holzheu, Martin Schwidefsky, Daniel Borkmann, netdev

From: Michael Holzheu <holzheu@linux.vnet.ibm.com>

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>
---
 lib/test_bpf.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

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[] = {
 		{ },
 		{ { 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 = {
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] test_bpf: Add backward jump test case
  2015-05-22 15:36 [PATCH net-next] test_bpf: Add backward jump test case Alexei Starovoitov
@ 2015-05-22 16:06 ` Daniel Borkmann
  2015-05-22 19:11 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Borkmann @ 2015-05-22 16:06 UTC (permalink / raw)
  To: Alexei Starovoitov, David S. Miller
  Cc: Michael Holzheu, Martin Schwidefsky, netdev

On 05/22/2015 05:36 PM, Alexei Starovoitov wrote:
> From: Michael Holzheu <holzheu@linux.vnet.ibm.com>
>
> 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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] test_bpf: Add backward jump test case
  2015-05-22 15:36 [PATCH net-next] test_bpf: Add backward jump test case Alexei Starovoitov
  2015-05-22 16:06 ` Daniel Borkmann
@ 2015-05-22 19:11 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2015-05-22 19:11 UTC (permalink / raw)
  To: ast; +Cc: holzheu, schwidefsky, daniel, netdev

From: Alexei Starovoitov <ast@plumgrid.com>
Date: Fri, 22 May 2015 08:36:40 -0700

> From: Michael Holzheu <holzheu@linux.vnet.ibm.com>
> 
> 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>

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-05-22 19:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-22 15:36 [PATCH net-next] test_bpf: Add backward jump test case Alexei Starovoitov
2015-05-22 16:06 ` Daniel Borkmann
2015-05-22 19:11 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).