netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next RESEND] test_bpf: extend tests for 32-bit endianness conversion
@ 2015-07-08 21:00 Xi Wang
  2015-07-08 23:20 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Xi Wang @ 2015-07-08 21:00 UTC (permalink / raw)
  To: netdev; +Cc: Xi Wang

Currently "ALU_END_FROM_BE 32" and "ALU_END_FROM_LE 32" do not test if
the upper bits of the result are zeros (the arm64 JIT had such bugs).
Extend the two tests to catch this.

Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: Xi Wang <xi.wang@gmail.com>
---
See the arm64 JIT bugs:

https://lkml.org/lkml/2015/6/25/721
---
 lib/test_bpf.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/test_bpf.c b/lib/test_bpf.c
index 7f58c73..9198f28 100644
--- a/lib/test_bpf.c
+++ b/lib/test_bpf.c
@@ -3674,6 +3674,9 @@ static struct bpf_test tests[] = {
 		.u.insns_int = {
 			BPF_LD_IMM64(R0, 0x0123456789abcdefLL),
 			BPF_ENDIAN(BPF_FROM_BE, R0, 32),
+			BPF_ALU64_REG(BPF_MOV, R1, R0),
+			BPF_ALU64_IMM(BPF_RSH, R1, 32),
+			BPF_ALU32_REG(BPF_ADD, R0, R1), /* R1 = 0 */
 			BPF_EXIT_INSN(),
 		},
 		INTERNAL,
@@ -3708,6 +3711,9 @@ static struct bpf_test tests[] = {
 		.u.insns_int = {
 			BPF_LD_IMM64(R0, 0x0123456789abcdefLL),
 			BPF_ENDIAN(BPF_FROM_LE, R0, 32),
+			BPF_ALU64_REG(BPF_MOV, R1, R0),
+			BPF_ALU64_IMM(BPF_RSH, R1, 32),
+			BPF_ALU32_REG(BPF_ADD, R0, R1), /* R1 = 0 */
 			BPF_EXIT_INSN(),
 		},
 		INTERNAL,
-- 
2.1.4

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

* Re: [PATCH net-next RESEND] test_bpf: extend tests for 32-bit endianness conversion
  2015-07-08 21:00 [PATCH net-next RESEND] test_bpf: extend tests for 32-bit endianness conversion Xi Wang
@ 2015-07-08 23:20 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-07-08 23:20 UTC (permalink / raw)
  To: xi.wang; +Cc: netdev

From: Xi Wang <xi.wang@gmail.com>
Date: Wed,  8 Jul 2015 14:00:56 -0700

> Currently "ALU_END_FROM_BE 32" and "ALU_END_FROM_LE 32" do not test if
> the upper bits of the result are zeros (the arm64 JIT had such bugs).
> Extend the two tests to catch this.
> 
> Acked-by: Daniel Borkmann <daniel@iogearbox.net>
> Acked-by: Alexei Starovoitov <ast@plumgrid.com>
> Signed-off-by: Xi Wang <xi.wang@gmail.com>

Applied, thanks.

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

end of thread, other threads:[~2015-07-08 23:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-08 21:00 [PATCH net-next RESEND] test_bpf: extend tests for 32-bit endianness conversion Xi Wang
2015-07-08 23:20 ` 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).