Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1262553 > unrolled thread
| Started by | Yang Shi <yang.shi@linaro.org> |
|---|---|
| First post | 2015-11-04 21:00 +0100 |
| Last post | 2015-11-05 06:10 +0100 |
| Articles | 6 — 6 participants |
Back to article view | Back to linux.kernel
[PATCH] bpf: add mod default A and X test cases Yang Shi <yang.shi@linaro.org> - 2015-11-04 21:00 +0100
Re: [PATCH] bpf: add mod default A and X test cases Daniel Borkmann <daniel@iogearbox.net> - 2015-11-04 21:20 +0100
Re: [PATCH] bpf: add mod default A and X test cases Alexei Starovoitov <alexei.starovoitov@gmail.com> - 2015-11-04 21:30 +0100
Re: [PATCH] bpf: add mod default A and X test cases Z Lim <zlim.lnx@gmail.com> - 2015-11-04 23:10 +0100
Re: [PATCH] bpf: add mod default A and X test cases Xi Wang <xi.wang@gmail.com> - 2015-11-04 23:50 +0100
Re: [PATCH] bpf: add mod default A and X test cases David Miller <davem@davemloft.net> - 2015-11-05 06:10 +0100
| From | Yang Shi <yang.shi@linaro.org> |
|---|---|
| Date | 2015-11-04 21:00 +0100 |
| Subject | [PATCH] bpf: add mod default A and X test cases |
| Message-ID | <qrcnT-4Qx-1@gated-at.bofh.it> |
When running "mod X" operation, if X is 0 the filter has to be halt.
Add new test cases to cover A = A mod X if X is 0, and A = A mod 1.
CC: Xi Wang <xi.wang@gmail.com>
CC: Zi Shen Lim <zlim.lnx@gmail.com>
Signed-off-by: Yang Shi <yang.shi@linaro.org>
---
lib/test_bpf.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/lib/test_bpf.c b/lib/test_bpf.c
index d137739..10cd186 100644
--- a/lib/test_bpf.c
+++ b/lib/test_bpf.c
@@ -5056,6 +5056,36 @@ static struct bpf_test tests[] = {
{ {0x1, 0x0 } },
},
{
+ "MOD default X",
+ .u.insns = {
+ /*
+ * A = 0x42
+ * A = A mod X ; this halt the filter execution if X is 0
+ * ret 0x42
+ */
+ BPF_STMT(BPF_LD | BPF_IMM, 0x42),
+ BPF_STMT(BPF_ALU | BPF_MOD | BPF_X, 0),
+ BPF_STMT(BPF_RET | BPF_K, 0x42),
+ },
+ CLASSIC | FLAG_NO_DATA,
+ {},
+ { {0x1, 0x0 } },
+ },
+ {
+ "MOD default A",
+ .u.insns = {
+ /*
+ * A = A mod 1
+ * ret A
+ */
+ BPF_STMT(BPF_ALU | BPF_MOD | BPF_K, 0x1),
+ BPF_STMT(BPF_RET | BPF_A, 0x0),
+ },
+ CLASSIC | FLAG_NO_DATA,
+ {},
+ { {0x1, 0x0 } },
+ },
+ {
"JMP EQ default A",
.u.insns = {
/*
--
2.0.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Daniel Borkmann <daniel@iogearbox.net> |
|---|---|
| Date | 2015-11-04 21:20 +0100 |
| Message-ID | <qrcHh-5df-29@gated-at.bofh.it> |
| In reply to | #1262553 |
On 11/04/2015 08:36 PM, Yang Shi wrote: > When running "mod X" operation, if X is 0 the filter has to be halt. > Add new test cases to cover A = A mod X if X is 0, and A = A mod 1. > > CC: Xi Wang <xi.wang@gmail.com> > CC: Zi Shen Lim <zlim.lnx@gmail.com> > Signed-off-by: Yang Shi <yang.shi@linaro.org> LGTM! Acked-by: Daniel Borkmann <daniel@iogearbox.net> -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Alexei Starovoitov <alexei.starovoitov@gmail.com> |
|---|---|
| Date | 2015-11-04 21:30 +0100 |
| Message-ID | <qrcQW-5hE-11@gated-at.bofh.it> |
| In reply to | #1262553 |
On Wed, Nov 04, 2015 at 11:36:37AM -0800, Yang Shi wrote: > When running "mod X" operation, if X is 0 the filter has to be halt. > Add new test cases to cover A = A mod X if X is 0, and A = A mod 1. > > CC: Xi Wang <xi.wang@gmail.com> > CC: Zi Shen Lim <zlim.lnx@gmail.com> > Signed-off-by: Yang Shi <yang.shi@linaro.org> Acked-by: Alexei Starovoitov <ast@kernel.org> -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Z Lim <zlim.lnx@gmail.com> |
|---|---|
| Date | 2015-11-04 23:10 +0100 |
| Message-ID | <qrepI-6lw-19@gated-at.bofh.it> |
| In reply to | #1262553 |
On Wed, Nov 4, 2015 at 11:36 AM, Yang Shi <yang.shi@linaro.org> wrote: > When running "mod X" operation, if X is 0 the filter has to be halt. > Add new test cases to cover A = A mod X if X is 0, and A = A mod 1. > > CC: Xi Wang <xi.wang@gmail.com> > CC: Zi Shen Lim <zlim.lnx@gmail.com> > Signed-off-by: Yang Shi <yang.shi@linaro.org> > --- Acked-by: Zi Shen Lim <zlim.lnx@gmail.com> -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Xi Wang <xi.wang@gmail.com> |
|---|---|
| Date | 2015-11-04 23:50 +0100 |
| Message-ID | <qrf2q-6BJ-9@gated-at.bofh.it> |
| In reply to | #1262553 |
On Wed, Nov 4, 2015 at 11:36 AM, Yang Shi <yang.shi@linaro.org> wrote: > When running "mod X" operation, if X is 0 the filter has to be halt. > Add new test cases to cover A = A mod X if X is 0, and A = A mod 1. > > CC: Xi Wang <xi.wang@gmail.com> > CC: Zi Shen Lim <zlim.lnx@gmail.com> > Signed-off-by: Yang Shi <yang.shi@linaro.org> Acked-by: Xi Wang <xi.wang@gmail.com> -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2015-11-05 06:10 +0100 |
| Message-ID | <qrkY9-2c9-5@gated-at.bofh.it> |
| In reply to | #1262553 |
From: Yang Shi <yang.shi@linaro.org> Date: Wed, 4 Nov 2015 11:36:37 -0800 > When running "mod X" operation, if X is 0 the filter has to be halt. > Add new test cases to cover A = A mod X if X is 0, and A = A mod 1. > > CC: Xi Wang <xi.wang@gmail.com> > CC: Zi Shen Lim <zlim.lnx@gmail.com> > Signed-off-by: Yang Shi <yang.shi@linaro.org> Applied, thank you. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web