From: Jiong Wang <jiong.wang@netronome.com>
To: daniel@iogearbox.net, ast@kernel.org
Cc: netdev@vger.kernel.org, oss-drivers@netronome.com,
Jiong Wang <jiong.wang@netronome.com>
Subject: [RFC bpf-next 7/7] selftests: bpf: update testcases for BPF_ALU | BPF_ARSH
Date: Tue, 4 Dec 2018 04:56:35 -0500 [thread overview]
Message-ID: <1543917395-6130-8-git-send-email-jiong.wang@netronome.com> (raw)
In-Reply-To: <1543917395-6130-1-git-send-email-jiong.wang@netronome.com>
"arsh32 on imm" and "arsh32 on reg" now are accepted. Also added two new
testcases to make sure arsh32 won't be treated as arsh64 during
interpretation or JIT code-gen for which case the high bits will be moved
into low halve that the testcases could catch them.
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
---
tools/testing/selftests/bpf/test_verifier.c | 29 +++++++++++++++++++++++++----
1 file changed, 25 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c
index 18d0b7f..e7f1bc7 100644
--- a/tools/testing/selftests/bpf/test_verifier.c
+++ b/tools/testing/selftests/bpf/test_verifier.c
@@ -721,8 +721,18 @@ static struct bpf_test tests[] = {
BPF_ALU32_IMM(BPF_ARSH, BPF_REG_0, 5),
BPF_EXIT_INSN(),
},
- .result = REJECT,
- .errstr = "unknown opcode c4",
+ .result = ACCEPT,
+ .retval = 0,
+ },
+ {
+ "arsh32 on imm 2",
+ .insns = {
+ BPF_LD_IMM64(BPF_REG_0, 0x1122334485667788),
+ BPF_ALU32_IMM(BPF_ARSH, BPF_REG_0, 7),
+ BPF_EXIT_INSN(),
+ },
+ .result = ACCEPT,
+ .retval = -16069393,
},
{
"arsh32 on reg",
@@ -732,8 +742,19 @@ static struct bpf_test tests[] = {
BPF_ALU32_REG(BPF_ARSH, BPF_REG_0, BPF_REG_1),
BPF_EXIT_INSN(),
},
- .result = REJECT,
- .errstr = "unknown opcode cc",
+ .result = ACCEPT,
+ .retval = 0,
+ },
+ {
+ "arsh32 on reg 2",
+ .insns = {
+ BPF_LD_IMM64(BPF_REG_0, 0xffff55667788),
+ BPF_MOV64_IMM(BPF_REG_1, 15),
+ BPF_ALU32_REG(BPF_ARSH, BPF_REG_0, BPF_REG_1),
+ BPF_EXIT_INSN(),
+ },
+ .result = ACCEPT,
+ .retval = 43724,
},
{
"arsh64 on imm",
--
2.7.4
prev parent reply other threads:[~2018-12-04 9:59 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-04 9:56 [RFC bpf-next 0/7] bpf: support BPF_ALU | BPF_ARSH Jiong Wang
2018-12-04 9:56 ` [RFC bpf-next 1/7] bpf: interpreter " Jiong Wang
2018-12-04 16:43 ` David Miller
2018-12-04 19:29 ` Alexei Starovoitov
2018-12-04 19:42 ` [oss-drivers] " Jakub Kicinski
2018-12-04 20:00 ` Alexei Starovoitov
2018-12-04 20:10 ` David Miller
2018-12-04 20:14 ` Jiong Wang
2018-12-04 20:19 ` David Miller
2018-12-04 20:16 ` Alexei Starovoitov
2018-12-04 20:20 ` David Miller
2018-12-04 9:56 ` [RFC bpf-next 2/7] mips: bpf: implement jitting of BPF_ALU | BPF_ARSH | BPF_X Jiong Wang
2018-12-04 9:56 ` [RFC bpf-next 3/7] ppc: bpf: implement jitting of BPF_ALU | BPF_ARSH | BPF_* Jiong Wang
2018-12-04 9:56 ` [RFC bpf-next 4/7] s390: " Jiong Wang
2018-12-04 9:56 ` [RFC bpf-next 5/7] nfp: " Jiong Wang
2018-12-04 9:56 ` [RFC bpf-next 6/7] bpf: verifier remove the rejection on BPF_ALU | BPF_ARSH Jiong Wang
2018-12-04 9:56 ` Jiong Wang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1543917395-6130-8-git-send-email-jiong.wang@netronome.com \
--to=jiong.wang@netronome.com \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=netdev@vger.kernel.org \
--cc=oss-drivers@netronome.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).