* [PATCH net 1/4] lib/test_bpf: Fix JMP_JSET tests
@ 2016-04-05 10:02 Naveen N. Rao
2016-04-05 10:02 ` [PATCH net 2/4] lib/test_bpf: Add tests for unsigned BPF_JGT Naveen N. Rao
` (5 more replies)
0 siblings, 6 replies; 18+ messages in thread
From: Naveen N. Rao @ 2016-04-05 10:02 UTC (permalink / raw)
To: linux-kernel, linuxppc-dev, netdev
Cc: Alexei Starovoitov, Daniel Borkmann, David S. Miller,
Ananth N Mavinakayanahalli, Michael Ellerman, Paul Mackerras
JMP_JSET tests incorrectly used BPF_JNE. Fix the same.
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
---
lib/test_bpf.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/test_bpf.c b/lib/test_bpf.c
index 27a7a26..e76fa4d 100644
--- a/lib/test_bpf.c
+++ b/lib/test_bpf.c
@@ -4303,7 +4303,7 @@ static struct bpf_test tests[] = {
.u.insns_int = {
BPF_ALU32_IMM(BPF_MOV, R0, 0),
BPF_LD_IMM64(R1, 3),
- BPF_JMP_IMM(BPF_JNE, R1, 2, 1),
+ BPF_JMP_IMM(BPF_JSET, R1, 2, 1),
BPF_EXIT_INSN(),
BPF_ALU32_IMM(BPF_MOV, R0, 1),
BPF_EXIT_INSN(),
@@ -4317,7 +4317,7 @@ static struct bpf_test tests[] = {
.u.insns_int = {
BPF_ALU32_IMM(BPF_MOV, R0, 0),
BPF_LD_IMM64(R1, 3),
- BPF_JMP_IMM(BPF_JNE, R1, 0xffffffff, 1),
+ BPF_JMP_IMM(BPF_JSET, R1, 0xffffffff, 1),
BPF_EXIT_INSN(),
BPF_ALU32_IMM(BPF_MOV, R0, 1),
BPF_EXIT_INSN(),
@@ -4474,7 +4474,7 @@ static struct bpf_test tests[] = {
BPF_ALU32_IMM(BPF_MOV, R0, 0),
BPF_LD_IMM64(R1, 3),
BPF_LD_IMM64(R2, 2),
- BPF_JMP_REG(BPF_JNE, R1, R2, 1),
+ BPF_JMP_REG(BPF_JSET, R1, R2, 1),
BPF_EXIT_INSN(),
BPF_ALU32_IMM(BPF_MOV, R0, 1),
BPF_EXIT_INSN(),
@@ -4489,7 +4489,7 @@ static struct bpf_test tests[] = {
BPF_ALU32_IMM(BPF_MOV, R0, 0),
BPF_LD_IMM64(R1, 3),
BPF_LD_IMM64(R2, 0xffffffff),
- BPF_JMP_REG(BPF_JNE, R1, R2, 1),
+ BPF_JMP_REG(BPF_JSET, R1, R2, 1),
BPF_EXIT_INSN(),
BPF_ALU32_IMM(BPF_MOV, R0, 1),
BPF_EXIT_INSN(),
--
2.7.4
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH net 2/4] lib/test_bpf: Add tests for unsigned BPF_JGT
2016-04-05 10:02 [PATCH net 1/4] lib/test_bpf: Fix JMP_JSET tests Naveen N. Rao
@ 2016-04-05 10:02 ` Naveen N. Rao
2016-04-05 16:20 ` Alexei Starovoitov
` (2 more replies)
2016-04-05 10:02 ` [PATCH net 3/4] lib/test_bpf: Add test to check for result of 32-bit add that overflows Naveen N. Rao
` (4 subsequent siblings)
5 siblings, 3 replies; 18+ messages in thread
From: Naveen N. Rao @ 2016-04-05 10:02 UTC (permalink / raw)
To: linux-kernel, linuxppc-dev, netdev
Cc: Alexei Starovoitov, Daniel Borkmann, David S. Miller,
Ananth N Mavinakayanahalli, Michael Ellerman, Paul Mackerras
Unsigned Jump-if-Greater-Than.
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
---
lib/test_bpf.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/lib/test_bpf.c b/lib/test_bpf.c
index e76fa4d..7e6fb49 100644
--- a/lib/test_bpf.c
+++ b/lib/test_bpf.c
@@ -4222,6 +4222,20 @@ static struct bpf_test tests[] = {
{ },
{ { 0, 1 } },
},
+ {
+ "JMP_JGT_K: Unsigned jump: if (-1 > 1) return 1",
+ .u.insns_int = {
+ BPF_ALU32_IMM(BPF_MOV, R0, 0),
+ BPF_LD_IMM64(R1, -1),
+ BPF_JMP_IMM(BPF_JGT, R1, 1, 1),
+ BPF_EXIT_INSN(),
+ BPF_ALU32_IMM(BPF_MOV, R0, 1),
+ BPF_EXIT_INSN(),
+ },
+ INTERNAL,
+ { },
+ { { 0, 1 } },
+ },
/* BPF_JMP | BPF_JGE | BPF_K */
{
"JMP_JGE_K: if (3 >= 2) return 1",
@@ -4404,6 +4418,21 @@ static struct bpf_test tests[] = {
{ },
{ { 0, 1 } },
},
+ {
+ "JMP_JGT_X: Unsigned jump: if (-1 > 1) return 1",
+ .u.insns_int = {
+ BPF_ALU32_IMM(BPF_MOV, R0, 0),
+ BPF_LD_IMM64(R1, -1),
+ BPF_LD_IMM64(R2, 1),
+ BPF_JMP_REG(BPF_JGT, R1, R2, 1),
+ BPF_EXIT_INSN(),
+ BPF_ALU32_IMM(BPF_MOV, R0, 1),
+ BPF_EXIT_INSN(),
+ },
+ INTERNAL,
+ { },
+ { { 0, 1 } },
+ },
/* BPF_JMP | BPF_JGE | BPF_X */
{
"JMP_JGE_X: if (3 >= 2) return 1",
--
2.7.4
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH net 3/4] lib/test_bpf: Add test to check for result of 32-bit add that overflows
2016-04-05 10:02 [PATCH net 1/4] lib/test_bpf: Fix JMP_JSET tests Naveen N. Rao
2016-04-05 10:02 ` [PATCH net 2/4] lib/test_bpf: Add tests for unsigned BPF_JGT Naveen N. Rao
@ 2016-04-05 10:02 ` Naveen N. Rao
2016-04-05 16:21 ` Alexei Starovoitov
` (2 more replies)
2016-04-05 10:02 ` [PATCH net 4/4] lib/test_bpf: Add additional BPF_ADD tests Naveen N. Rao
` (3 subsequent siblings)
5 siblings, 3 replies; 18+ messages in thread
From: Naveen N. Rao @ 2016-04-05 10:02 UTC (permalink / raw)
To: linux-kernel, linuxppc-dev, netdev
Cc: Alexei Starovoitov, Daniel Borkmann, David S. Miller,
Ananth N Mavinakayanahalli, Michael Ellerman, Paul Mackerras
BPF_ALU32 and BPF_ALU64 tests for adding two 32-bit values that results in
32-bit overflow.
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
---
lib/test_bpf.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 64 insertions(+)
diff --git a/lib/test_bpf.c b/lib/test_bpf.c
index 7e6fb49..2fb31aa 100644
--- a/lib/test_bpf.c
+++ b/lib/test_bpf.c
@@ -2444,6 +2444,22 @@ static struct bpf_test tests[] = {
{ { 0, 4294967295U } },
},
{
+ "ALU_ADD_X: 2 + 4294967294 = 0",
+ .u.insns_int = {
+ BPF_LD_IMM64(R0, 2),
+ BPF_LD_IMM64(R1, 4294967294U),
+ BPF_ALU32_REG(BPF_ADD, R0, R1),
+ BPF_JMP_IMM(BPF_JEQ, R0, 0, 2),
+ BPF_ALU32_IMM(BPF_MOV, R0, 0),
+ BPF_EXIT_INSN(),
+ BPF_ALU32_IMM(BPF_MOV, R0, 1),
+ BPF_EXIT_INSN(),
+ },
+ INTERNAL,
+ { },
+ { { 0, 1 } },
+ },
+ {
"ALU64_ADD_X: 1 + 2 = 3",
.u.insns_int = {
BPF_LD_IMM64(R0, 1),
@@ -2467,6 +2483,23 @@ static struct bpf_test tests[] = {
{ },
{ { 0, 4294967295U } },
},
+ {
+ "ALU64_ADD_X: 2 + 4294967294 = 4294967296",
+ .u.insns_int = {
+ BPF_LD_IMM64(R0, 2),
+ BPF_LD_IMM64(R1, 4294967294U),
+ BPF_LD_IMM64(R2, 4294967296ULL),
+ BPF_ALU64_REG(BPF_ADD, R0, R1),
+ BPF_JMP_REG(BPF_JEQ, R0, R2, 2),
+ BPF_MOV32_IMM(R0, 0),
+ BPF_EXIT_INSN(),
+ BPF_MOV32_IMM(R0, 1),
+ BPF_EXIT_INSN(),
+ },
+ INTERNAL,
+ { },
+ { { 0, 1 } },
+ },
/* BPF_ALU | BPF_ADD | BPF_K */
{
"ALU_ADD_K: 1 + 2 = 3",
@@ -2502,6 +2535,21 @@ static struct bpf_test tests[] = {
{ { 0, 4294967295U } },
},
{
+ "ALU_ADD_K: 4294967294 + 2 = 0",
+ .u.insns_int = {
+ BPF_LD_IMM64(R0, 4294967294U),
+ BPF_ALU32_IMM(BPF_ADD, R0, 2),
+ BPF_JMP_IMM(BPF_JEQ, R0, 0, 2),
+ BPF_ALU32_IMM(BPF_MOV, R0, 0),
+ BPF_EXIT_INSN(),
+ BPF_ALU32_IMM(BPF_MOV, R0, 1),
+ BPF_EXIT_INSN(),
+ },
+ INTERNAL,
+ { },
+ { { 0, 1 } },
+ },
+ {
"ALU_ADD_K: 0 + (-1) = 0x00000000ffffffff",
.u.insns_int = {
BPF_LD_IMM64(R2, 0x0),
@@ -2551,6 +2599,22 @@ static struct bpf_test tests[] = {
{ { 0, 2147483647 } },
},
{
+ "ALU64_ADD_K: 4294967294 + 2 = 4294967296",
+ .u.insns_int = {
+ BPF_LD_IMM64(R0, 4294967294U),
+ BPF_LD_IMM64(R1, 4294967296ULL),
+ BPF_ALU64_IMM(BPF_ADD, R0, 2),
+ BPF_JMP_REG(BPF_JEQ, R0, R1, 2),
+ BPF_ALU32_IMM(BPF_MOV, R0, 0),
+ BPF_EXIT_INSN(),
+ BPF_ALU32_IMM(BPF_MOV, R0, 1),
+ BPF_EXIT_INSN(),
+ },
+ INTERNAL,
+ { },
+ { { 0, 1 } },
+ },
+ {
"ALU64_ADD_K: 2147483646 + -2147483647 = -1",
.u.insns_int = {
BPF_LD_IMM64(R0, 2147483646),
--
2.7.4
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH net 4/4] lib/test_bpf: Add additional BPF_ADD tests
2016-04-05 10:02 [PATCH net 1/4] lib/test_bpf: Fix JMP_JSET tests Naveen N. Rao
2016-04-05 10:02 ` [PATCH net 2/4] lib/test_bpf: Add tests for unsigned BPF_JGT Naveen N. Rao
2016-04-05 10:02 ` [PATCH net 3/4] lib/test_bpf: Add test to check for result of 32-bit add that overflows Naveen N. Rao
@ 2016-04-05 10:02 ` Naveen N. Rao
2016-04-05 16:28 ` Alexei Starovoitov
` (2 more replies)
2016-04-05 15:57 ` [PATCH net 1/4] lib/test_bpf: Fix JMP_JSET tests Alexei Starovoitov
` (2 subsequent siblings)
5 siblings, 3 replies; 18+ messages in thread
From: Naveen N. Rao @ 2016-04-05 10:02 UTC (permalink / raw)
To: linux-kernel, linuxppc-dev, netdev
Cc: Alexei Starovoitov, Daniel Borkmann, David S. Miller,
Ananth N Mavinakayanahalli, Michael Ellerman, Paul Mackerras
Some of these tests proved useful with the powerpc eBPF JIT port due to
sign-extended 16-bit immediate loads. Though some of these aspects get
covered in other tests, it is better to have explicit tests so as to
quickly tag the precise problem.
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
---
lib/test_bpf.c | 128 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 128 insertions(+)
diff --git a/lib/test_bpf.c b/lib/test_bpf.c
index 2fb31aa..8f22fbe 100644
--- a/lib/test_bpf.c
+++ b/lib/test_bpf.c
@@ -2566,6 +2566,70 @@ static struct bpf_test tests[] = {
{ { 0, 0x1 } },
},
{
+ "ALU_ADD_K: 0 + 0xffff = 0xffff",
+ .u.insns_int = {
+ BPF_LD_IMM64(R2, 0x0),
+ BPF_LD_IMM64(R3, 0xffff),
+ BPF_ALU32_IMM(BPF_ADD, R2, 0xffff),
+ BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
+ BPF_MOV32_IMM(R0, 2),
+ BPF_EXIT_INSN(),
+ BPF_MOV32_IMM(R0, 1),
+ BPF_EXIT_INSN(),
+ },
+ INTERNAL,
+ { },
+ { { 0, 0x1 } },
+ },
+ {
+ "ALU_ADD_K: 0 + 0x7fffffff = 0x7fffffff",
+ .u.insns_int = {
+ BPF_LD_IMM64(R2, 0x0),
+ BPF_LD_IMM64(R3, 0x7fffffff),
+ BPF_ALU32_IMM(BPF_ADD, R2, 0x7fffffff),
+ BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
+ BPF_MOV32_IMM(R0, 2),
+ BPF_EXIT_INSN(),
+ BPF_MOV32_IMM(R0, 1),
+ BPF_EXIT_INSN(),
+ },
+ INTERNAL,
+ { },
+ { { 0, 0x1 } },
+ },
+ {
+ "ALU_ADD_K: 0 + 0x80000000 = 0x80000000",
+ .u.insns_int = {
+ BPF_LD_IMM64(R2, 0x0),
+ BPF_LD_IMM64(R3, 0x80000000),
+ BPF_ALU32_IMM(BPF_ADD, R2, 0x80000000),
+ BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
+ BPF_MOV32_IMM(R0, 2),
+ BPF_EXIT_INSN(),
+ BPF_MOV32_IMM(R0, 1),
+ BPF_EXIT_INSN(),
+ },
+ INTERNAL,
+ { },
+ { { 0, 0x1 } },
+ },
+ {
+ "ALU_ADD_K: 0 + 0x80008000 = 0x80008000",
+ .u.insns_int = {
+ BPF_LD_IMM64(R2, 0x0),
+ BPF_LD_IMM64(R3, 0x80008000),
+ BPF_ALU32_IMM(BPF_ADD, R2, 0x80008000),
+ BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
+ BPF_MOV32_IMM(R0, 2),
+ BPF_EXIT_INSN(),
+ BPF_MOV32_IMM(R0, 1),
+ BPF_EXIT_INSN(),
+ },
+ INTERNAL,
+ { },
+ { { 0, 0x1 } },
+ },
+ {
"ALU64_ADD_K: 1 + 2 = 3",
.u.insns_int = {
BPF_LD_IMM64(R0, 1),
@@ -2657,6 +2721,70 @@ static struct bpf_test tests[] = {
{ },
{ { 0, 0x1 } },
},
+ {
+ "ALU64_ADD_K: 0 + 0xffff = 0xffff",
+ .u.insns_int = {
+ BPF_LD_IMM64(R2, 0x0),
+ BPF_LD_IMM64(R3, 0xffff),
+ BPF_ALU64_IMM(BPF_ADD, R2, 0xffff),
+ BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
+ BPF_MOV32_IMM(R0, 2),
+ BPF_EXIT_INSN(),
+ BPF_MOV32_IMM(R0, 1),
+ BPF_EXIT_INSN(),
+ },
+ INTERNAL,
+ { },
+ { { 0, 0x1 } },
+ },
+ {
+ "ALU64_ADD_K: 0 + 0x7fffffff = 0x7fffffff",
+ .u.insns_int = {
+ BPF_LD_IMM64(R2, 0x0),
+ BPF_LD_IMM64(R3, 0x7fffffff),
+ BPF_ALU64_IMM(BPF_ADD, R2, 0x7fffffff),
+ BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
+ BPF_MOV32_IMM(R0, 2),
+ BPF_EXIT_INSN(),
+ BPF_MOV32_IMM(R0, 1),
+ BPF_EXIT_INSN(),
+ },
+ INTERNAL,
+ { },
+ { { 0, 0x1 } },
+ },
+ {
+ "ALU64_ADD_K: 0 + 0x80000000 = 0xffffffff80000000",
+ .u.insns_int = {
+ BPF_LD_IMM64(R2, 0x0),
+ BPF_LD_IMM64(R3, 0xffffffff80000000LL),
+ BPF_ALU64_IMM(BPF_ADD, R2, 0x80000000),
+ BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
+ BPF_MOV32_IMM(R0, 2),
+ BPF_EXIT_INSN(),
+ BPF_MOV32_IMM(R0, 1),
+ BPF_EXIT_INSN(),
+ },
+ INTERNAL,
+ { },
+ { { 0, 0x1 } },
+ },
+ {
+ "ALU_ADD_K: 0 + 0x80008000 = 0xffffffff80008000",
+ .u.insns_int = {
+ BPF_LD_IMM64(R2, 0x0),
+ BPF_LD_IMM64(R3, 0xffffffff80008000LL),
+ BPF_ALU64_IMM(BPF_ADD, R2, 0x80008000),
+ BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
+ BPF_MOV32_IMM(R0, 2),
+ BPF_EXIT_INSN(),
+ BPF_MOV32_IMM(R0, 1),
+ BPF_EXIT_INSN(),
+ },
+ INTERNAL,
+ { },
+ { { 0, 0x1 } },
+ },
/* BPF_ALU | BPF_SUB | BPF_X */
{
"ALU_SUB_X: 3 - 1 = 2",
--
2.7.4
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH net 1/4] lib/test_bpf: Fix JMP_JSET tests
2016-04-05 10:02 [PATCH net 1/4] lib/test_bpf: Fix JMP_JSET tests Naveen N. Rao
` (2 preceding siblings ...)
2016-04-05 10:02 ` [PATCH net 4/4] lib/test_bpf: Add additional BPF_ADD tests Naveen N. Rao
@ 2016-04-05 15:57 ` Alexei Starovoitov
2016-04-05 19:32 ` Daniel Borkmann
2016-04-06 20:48 ` David Miller
5 siblings, 0 replies; 18+ messages in thread
From: Alexei Starovoitov @ 2016-04-05 15:57 UTC (permalink / raw)
To: Naveen N. Rao, linux-kernel, linuxppc-dev, netdev
Cc: Daniel Borkmann, David S. Miller, Ananth N Mavinakayanahalli,
Michael Ellerman, Paul Mackerras, Michael Holzheu
On 4/5/16 3:02 AM, Naveen N. Rao wrote:
> JMP_JSET tests incorrectly used BPF_JNE. Fix the same.
>
> Cc: Alexei Starovoitov <ast@fb.com>
> Cc: Daniel Borkmann <daniel@iogearbox.net>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Paul Mackerras <paulus@samba.org>
> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Good catch.
Fixes: cffc642d93f9 ("test_bpf: add 173 new testcases for eBPF")
Acked-by: Alexei Starovoitov <ast@kernel.org>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH net 2/4] lib/test_bpf: Add tests for unsigned BPF_JGT
2016-04-05 10:02 ` [PATCH net 2/4] lib/test_bpf: Add tests for unsigned BPF_JGT Naveen N. Rao
@ 2016-04-05 16:20 ` Alexei Starovoitov
2016-04-05 16:50 ` Naveen N. Rao
2016-04-05 19:34 ` Daniel Borkmann
2016-04-06 20:48 ` David Miller
2 siblings, 1 reply; 18+ messages in thread
From: Alexei Starovoitov @ 2016-04-05 16:20 UTC (permalink / raw)
To: Naveen N. Rao, linux-kernel, linuxppc-dev, netdev
Cc: Daniel Borkmann, David S. Miller, Ananth N Mavinakayanahalli,
Michael Ellerman, Paul Mackerras
On 4/5/16 3:02 AM, Naveen N. Rao wrote:
> Unsigned Jump-if-Greater-Than.
>
> Cc: Alexei Starovoitov <ast@fb.com>
> Cc: Daniel Borkmann <daniel@iogearbox.net>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Paul Mackerras <paulus@samba.org>
> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
I think some of the tests already cover it, but extra tests are
always great.
Acked-by: Alexei Starovoitov <ast@kernel.org>
I think the whole set belongs in net-next.
Next time you submit the patches please say [PATCH net-next] in subject.
[PATCH net] is for bugfixes only.
Thanks a bunch!
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH net 3/4] lib/test_bpf: Add test to check for result of 32-bit add that overflows
2016-04-05 10:02 ` [PATCH net 3/4] lib/test_bpf: Add test to check for result of 32-bit add that overflows Naveen N. Rao
@ 2016-04-05 16:21 ` Alexei Starovoitov
2016-04-05 19:36 ` Daniel Borkmann
2016-04-06 20:48 ` David Miller
2 siblings, 0 replies; 18+ messages in thread
From: Alexei Starovoitov @ 2016-04-05 16:21 UTC (permalink / raw)
To: Naveen N. Rao, linux-kernel, linuxppc-dev, netdev
Cc: Daniel Borkmann, David S. Miller, Ananth N Mavinakayanahalli,
Michael Ellerman, Paul Mackerras
On 4/5/16 3:02 AM, Naveen N. Rao wrote:
> BPF_ALU32 and BPF_ALU64 tests for adding two 32-bit values that results in
> 32-bit overflow.
>
> Cc: Alexei Starovoitov <ast@fb.com>
> Cc: Daniel Borkmann <daniel@iogearbox.net>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Paul Mackerras <paulus@samba.org>
> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH net 4/4] lib/test_bpf: Add additional BPF_ADD tests
2016-04-05 10:02 ` [PATCH net 4/4] lib/test_bpf: Add additional BPF_ADD tests Naveen N. Rao
@ 2016-04-05 16:28 ` Alexei Starovoitov
2016-04-05 16:51 ` Naveen N. Rao
2016-04-05 19:48 ` Daniel Borkmann
2016-04-06 20:48 ` David Miller
2 siblings, 1 reply; 18+ messages in thread
From: Alexei Starovoitov @ 2016-04-05 16:28 UTC (permalink / raw)
To: Naveen N. Rao, linux-kernel, linuxppc-dev, netdev
Cc: Daniel Borkmann, David S. Miller, Ananth N Mavinakayanahalli,
Michael Ellerman, Paul Mackerras
On 4/5/16 3:02 AM, Naveen N. Rao wrote:
> Some of these tests proved useful with the powerpc eBPF JIT port due to
> sign-extended 16-bit immediate loads. Though some of these aspects get
> covered in other tests, it is better to have explicit tests so as to
> quickly tag the precise problem.
>
> Cc: Alexei Starovoitov <ast@fb.com>
> Cc: Daniel Borkmann <daniel@iogearbox.net>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Paul Mackerras <paulus@samba.org>
> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Makes sense. Looks like ppc jit will be using quite a bit of
available ppc instructions. Nice.
I'm assuming all these new tests passed with x64 jit?
Acked-by: Alexei Starovoitov <ast@kernel.org>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH net 2/4] lib/test_bpf: Add tests for unsigned BPF_JGT
2016-04-05 16:20 ` Alexei Starovoitov
@ 2016-04-05 16:50 ` Naveen N. Rao
0 siblings, 0 replies; 18+ messages in thread
From: Naveen N. Rao @ 2016-04-05 16:50 UTC (permalink / raw)
To: Alexei Starovoitov
Cc: linux-kernel, linuxppc-dev, netdev, Paul Mackerras,
David S. Miller, Daniel Borkmann
On 2016/04/05 09:20AM, Alexei Starovoitov wrote:
> On 4/5/16 3:02 AM, Naveen N. Rao wrote:
> >Unsigned Jump-if-Greater-Than.
> >
> >Cc: Alexei Starovoitov <ast@fb.com>
> >Cc: Daniel Borkmann <daniel@iogearbox.net>
> >Cc: "David S. Miller" <davem@davemloft.net>
> >Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
> >Cc: Michael Ellerman <mpe@ellerman.id.au>
> >Cc: Paul Mackerras <paulus@samba.org>
> >Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
>
> I think some of the tests already cover it, but extra tests are
> always great.
> Acked-by: Alexei Starovoitov <ast@kernel.org>
>
> I think the whole set belongs in net-next.
> Next time you submit the patches please say [PATCH net-next] in subject.
> [PATCH net] is for bugfixes only.
Ah, sure. Thanks for the review!
- Naveen
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH net 4/4] lib/test_bpf: Add additional BPF_ADD tests
2016-04-05 16:28 ` Alexei Starovoitov
@ 2016-04-05 16:51 ` Naveen N. Rao
0 siblings, 0 replies; 18+ messages in thread
From: Naveen N. Rao @ 2016-04-05 16:51 UTC (permalink / raw)
To: Alexei Starovoitov
Cc: linux-kernel, linuxppc-dev, netdev, Daniel Borkmann,
David S. Miller, Ananth N Mavinakayanahalli, Michael Ellerman,
Paul Mackerras
On 2016/04/05 09:28AM, Alexei Starovoitov wrote:
> On 4/5/16 3:02 AM, Naveen N. Rao wrote:
> >Some of these tests proved useful with the powerpc eBPF JIT port due to
> >sign-extended 16-bit immediate loads. Though some of these aspects get
> >covered in other tests, it is better to have explicit tests so as to
> >quickly tag the precise problem.
> >
> >Cc: Alexei Starovoitov <ast@fb.com>
> >Cc: Daniel Borkmann <daniel@iogearbox.net>
> >Cc: "David S. Miller" <davem@davemloft.net>
> >Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
> >Cc: Michael Ellerman <mpe@ellerman.id.au>
> >Cc: Paul Mackerras <paulus@samba.org>
> >Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
>
> Makes sense. Looks like ppc jit will be using quite a bit of
> available ppc instructions. Nice.
>
> I'm assuming all these new tests passed with x64 jit?
Yes, all these tests pass on x86_64.
- Naveen
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH net 1/4] lib/test_bpf: Fix JMP_JSET tests
2016-04-05 10:02 [PATCH net 1/4] lib/test_bpf: Fix JMP_JSET tests Naveen N. Rao
` (3 preceding siblings ...)
2016-04-05 15:57 ` [PATCH net 1/4] lib/test_bpf: Fix JMP_JSET tests Alexei Starovoitov
@ 2016-04-05 19:32 ` Daniel Borkmann
2016-04-06 20:48 ` David Miller
5 siblings, 0 replies; 18+ messages in thread
From: Daniel Borkmann @ 2016-04-05 19:32 UTC (permalink / raw)
To: Naveen N. Rao, linux-kernel, linuxppc-dev, netdev
Cc: Alexei Starovoitov, David S. Miller, Ananth N Mavinakayanahalli,
Michael Ellerman, Paul Mackerras, Michael Holzheu
On 04/05/2016 12:02 PM, Naveen N. Rao wrote:
> JMP_JSET tests incorrectly used BPF_JNE. Fix the same.
>
> Cc: Alexei Starovoitov <ast@fb.com>
> Cc: Daniel Borkmann <daniel@iogearbox.net>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Paul Mackerras <paulus@samba.org>
> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
> ---
> lib/test_bpf.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/lib/test_bpf.c b/lib/test_bpf.c
> index 27a7a26..e76fa4d 100644
> --- a/lib/test_bpf.c
> +++ b/lib/test_bpf.c
> @@ -4303,7 +4303,7 @@ static struct bpf_test tests[] = {
> .u.insns_int = {
> BPF_ALU32_IMM(BPF_MOV, R0, 0),
> BPF_LD_IMM64(R1, 3),
> - BPF_JMP_IMM(BPF_JNE, R1, 2, 1),
> + BPF_JMP_IMM(BPF_JSET, R1, 2, 1),
> BPF_EXIT_INSN(),
> BPF_ALU32_IMM(BPF_MOV, R0, 1),
> BPF_EXIT_INSN(),
> @@ -4317,7 +4317,7 @@ static struct bpf_test tests[] = {
> .u.insns_int = {
> BPF_ALU32_IMM(BPF_MOV, R0, 0),
> BPF_LD_IMM64(R1, 3),
> - BPF_JMP_IMM(BPF_JNE, R1, 0xffffffff, 1),
> + BPF_JMP_IMM(BPF_JSET, R1, 0xffffffff, 1),
> BPF_EXIT_INSN(),
> BPF_ALU32_IMM(BPF_MOV, R0, 1),
> BPF_EXIT_INSN(),
> @@ -4474,7 +4474,7 @@ static struct bpf_test tests[] = {
> BPF_ALU32_IMM(BPF_MOV, R0, 0),
> BPF_LD_IMM64(R1, 3),
> BPF_LD_IMM64(R2, 2),
> - BPF_JMP_REG(BPF_JNE, R1, R2, 1),
> + BPF_JMP_REG(BPF_JSET, R1, R2, 1),
> BPF_EXIT_INSN(),
> BPF_ALU32_IMM(BPF_MOV, R0, 1),
> BPF_EXIT_INSN(),
> @@ -4489,7 +4489,7 @@ static struct bpf_test tests[] = {
> BPF_ALU32_IMM(BPF_MOV, R0, 0),
> BPF_LD_IMM64(R1, 3),
> BPF_LD_IMM64(R2, 0xffffffff),
> - BPF_JMP_REG(BPF_JNE, R1, R2, 1),
> + BPF_JMP_REG(BPF_JSET, R1, R2, 1),
> BPF_EXIT_INSN(),
> BPF_ALU32_IMM(BPF_MOV, R0, 1),
> BPF_EXIT_INSN(),
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH net 2/4] lib/test_bpf: Add tests for unsigned BPF_JGT
2016-04-05 10:02 ` [PATCH net 2/4] lib/test_bpf: Add tests for unsigned BPF_JGT Naveen N. Rao
2016-04-05 16:20 ` Alexei Starovoitov
@ 2016-04-05 19:34 ` Daniel Borkmann
2016-04-06 20:48 ` David Miller
2 siblings, 0 replies; 18+ messages in thread
From: Daniel Borkmann @ 2016-04-05 19:34 UTC (permalink / raw)
To: Naveen N. Rao, linux-kernel, linuxppc-dev, netdev
Cc: Alexei Starovoitov, David S. Miller, Ananth N Mavinakayanahalli,
Michael Ellerman, Paul Mackerras
On 04/05/2016 12:02 PM, Naveen N. Rao wrote:
> Unsigned Jump-if-Greater-Than.
>
> Cc: Alexei Starovoitov <ast@fb.com>
> Cc: Daniel Borkmann <daniel@iogearbox.net>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Paul Mackerras <paulus@samba.org>
> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH net 3/4] lib/test_bpf: Add test to check for result of 32-bit add that overflows
2016-04-05 10:02 ` [PATCH net 3/4] lib/test_bpf: Add test to check for result of 32-bit add that overflows Naveen N. Rao
2016-04-05 16:21 ` Alexei Starovoitov
@ 2016-04-05 19:36 ` Daniel Borkmann
2016-04-06 20:48 ` David Miller
2 siblings, 0 replies; 18+ messages in thread
From: Daniel Borkmann @ 2016-04-05 19:36 UTC (permalink / raw)
To: Naveen N. Rao, linux-kernel, linuxppc-dev, netdev
Cc: Alexei Starovoitov, David S. Miller, Ananth N Mavinakayanahalli,
Michael Ellerman, Paul Mackerras
On 04/05/2016 12:02 PM, Naveen N. Rao wrote:
> BPF_ALU32 and BPF_ALU64 tests for adding two 32-bit values that results in
> 32-bit overflow.
>
> Cc: Alexei Starovoitov <ast@fb.com>
> Cc: Daniel Borkmann <daniel@iogearbox.net>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Paul Mackerras <paulus@samba.org>
> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH net 4/4] lib/test_bpf: Add additional BPF_ADD tests
2016-04-05 10:02 ` [PATCH net 4/4] lib/test_bpf: Add additional BPF_ADD tests Naveen N. Rao
2016-04-05 16:28 ` Alexei Starovoitov
@ 2016-04-05 19:48 ` Daniel Borkmann
2016-04-06 20:48 ` David Miller
2 siblings, 0 replies; 18+ messages in thread
From: Daniel Borkmann @ 2016-04-05 19:48 UTC (permalink / raw)
To: Naveen N. Rao, linux-kernel, linuxppc-dev, netdev
Cc: Alexei Starovoitov, David S. Miller, Ananth N Mavinakayanahalli,
Michael Ellerman, Paul Mackerras
On 04/05/2016 12:02 PM, Naveen N. Rao wrote:
> Some of these tests proved useful with the powerpc eBPF JIT port due to
> sign-extended 16-bit immediate loads. Though some of these aspects get
> covered in other tests, it is better to have explicit tests so as to
> quickly tag the precise problem.
>
> Cc: Alexei Starovoitov <ast@fb.com>
> Cc: Daniel Borkmann <daniel@iogearbox.net>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Paul Mackerras <paulus@samba.org>
> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Thanks for adding these!
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH net 1/4] lib/test_bpf: Fix JMP_JSET tests
2016-04-05 10:02 [PATCH net 1/4] lib/test_bpf: Fix JMP_JSET tests Naveen N. Rao
` (4 preceding siblings ...)
2016-04-05 19:32 ` Daniel Borkmann
@ 2016-04-06 20:48 ` David Miller
5 siblings, 0 replies; 18+ messages in thread
From: David Miller @ 2016-04-06 20:48 UTC (permalink / raw)
To: naveen.n.rao
Cc: linux-kernel, linuxppc-dev, netdev, ast, daniel, ananth, mpe, paulus
From: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
Date: Tue, 5 Apr 2016 15:32:53 +0530
> JMP_JSET tests incorrectly used BPF_JNE. Fix the same.
>
> Cc: Alexei Starovoitov <ast@fb.com>
> Cc: Daniel Borkmann <daniel@iogearbox.net>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Paul Mackerras <paulus@samba.org>
> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Applied.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH net 2/4] lib/test_bpf: Add tests for unsigned BPF_JGT
2016-04-05 10:02 ` [PATCH net 2/4] lib/test_bpf: Add tests for unsigned BPF_JGT Naveen N. Rao
2016-04-05 16:20 ` Alexei Starovoitov
2016-04-05 19:34 ` Daniel Borkmann
@ 2016-04-06 20:48 ` David Miller
2 siblings, 0 replies; 18+ messages in thread
From: David Miller @ 2016-04-06 20:48 UTC (permalink / raw)
To: naveen.n.rao
Cc: linux-kernel, linuxppc-dev, netdev, ast, daniel, ananth, mpe, paulus
From: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
Date: Tue, 5 Apr 2016 15:32:54 +0530
> Unsigned Jump-if-Greater-Than.
>
> Cc: Alexei Starovoitov <ast@fb.com>
> Cc: Daniel Borkmann <daniel@iogearbox.net>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Paul Mackerras <paulus@samba.org>
> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Applied.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH net 3/4] lib/test_bpf: Add test to check for result of 32-bit add that overflows
2016-04-05 10:02 ` [PATCH net 3/4] lib/test_bpf: Add test to check for result of 32-bit add that overflows Naveen N. Rao
2016-04-05 16:21 ` Alexei Starovoitov
2016-04-05 19:36 ` Daniel Borkmann
@ 2016-04-06 20:48 ` David Miller
2 siblings, 0 replies; 18+ messages in thread
From: David Miller @ 2016-04-06 20:48 UTC (permalink / raw)
To: naveen.n.rao
Cc: linux-kernel, linuxppc-dev, netdev, ast, daniel, ananth, mpe, paulus
From: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
Date: Tue, 5 Apr 2016 15:32:55 +0530
> BPF_ALU32 and BPF_ALU64 tests for adding two 32-bit values that results in
> 32-bit overflow.
>
> Cc: Alexei Starovoitov <ast@fb.com>
> Cc: Daniel Borkmann <daniel@iogearbox.net>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Paul Mackerras <paulus@samba.org>
> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Applied.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH net 4/4] lib/test_bpf: Add additional BPF_ADD tests
2016-04-05 10:02 ` [PATCH net 4/4] lib/test_bpf: Add additional BPF_ADD tests Naveen N. Rao
2016-04-05 16:28 ` Alexei Starovoitov
2016-04-05 19:48 ` Daniel Borkmann
@ 2016-04-06 20:48 ` David Miller
2 siblings, 0 replies; 18+ messages in thread
From: David Miller @ 2016-04-06 20:48 UTC (permalink / raw)
To: naveen.n.rao
Cc: linux-kernel, linuxppc-dev, netdev, ast, daniel, ananth, mpe, paulus
From: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
Date: Tue, 5 Apr 2016 15:32:56 +0530
> Some of these tests proved useful with the powerpc eBPF JIT port due to
> sign-extended 16-bit immediate loads. Though some of these aspects get
> covered in other tests, it is better to have explicit tests so as to
> quickly tag the precise problem.
>
> Cc: Alexei Starovoitov <ast@fb.com>
> Cc: Daniel Borkmann <daniel@iogearbox.net>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Paul Mackerras <paulus@samba.org>
> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Applied.
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2016-04-06 20:59 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-05 10:02 [PATCH net 1/4] lib/test_bpf: Fix JMP_JSET tests Naveen N. Rao
2016-04-05 10:02 ` [PATCH net 2/4] lib/test_bpf: Add tests for unsigned BPF_JGT Naveen N. Rao
2016-04-05 16:20 ` Alexei Starovoitov
2016-04-05 16:50 ` Naveen N. Rao
2016-04-05 19:34 ` Daniel Borkmann
2016-04-06 20:48 ` David Miller
2016-04-05 10:02 ` [PATCH net 3/4] lib/test_bpf: Add test to check for result of 32-bit add that overflows Naveen N. Rao
2016-04-05 16:21 ` Alexei Starovoitov
2016-04-05 19:36 ` Daniel Borkmann
2016-04-06 20:48 ` David Miller
2016-04-05 10:02 ` [PATCH net 4/4] lib/test_bpf: Add additional BPF_ADD tests Naveen N. Rao
2016-04-05 16:28 ` Alexei Starovoitov
2016-04-05 16:51 ` Naveen N. Rao
2016-04-05 19:48 ` Daniel Borkmann
2016-04-06 20:48 ` David Miller
2016-04-05 15:57 ` [PATCH net 1/4] lib/test_bpf: Fix JMP_JSET tests Alexei Starovoitov
2016-04-05 19:32 ` Daniel Borkmann
2016-04-06 20:48 ` 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).