From: Jiri Olsa <jolsa@redhat.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: davem@davemloft.net, daniel@iogearbox.net,
netdev@vger.kernel.org, bpf@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH v2 bpf-next 3/3] selftests/bpf: Add asm tests for pkt vs pkt_end comparison.
Date: Wed, 20 Jan 2021 21:51:03 +0100 [thread overview]
Message-ID: <20210120205103.GI1760208@krava> (raw)
In-Reply-To: <20201111031213.25109-4-alexei.starovoitov@gmail.com>
On Tue, Nov 10, 2020 at 07:12:13PM -0800, Alexei Starovoitov wrote:
> From: Alexei Starovoitov <ast@kernel.org>
>
> Add few assembly tests for packet comparison.
>
> Tested-by: Jiri Olsa <jolsa@redhat.com>
> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
hi,
I'm now getting error when running this test:
#347/p pkt_end < pkt taken check Did not run the program (not supported) OK
Summary: 1 PASSED, 0 SKIPPED, 0 FAILED
it looks like my kernel does not have prog->aux->ops->test_run
defined for BPF_PROG_TYPE_SK_SKB for some reason
do I miss some config option? I recall running this
back in November, so I'm confused ;-)
thanks,
jirka
> ---
> .../testing/selftests/bpf/verifier/ctx_skb.c | 42 +++++++++++++++++++
> 1 file changed, 42 insertions(+)
>
> diff --git a/tools/testing/selftests/bpf/verifier/ctx_skb.c b/tools/testing/selftests/bpf/verifier/ctx_skb.c
> index 2e16b8e268f2..2022c0f2cd75 100644
> --- a/tools/testing/selftests/bpf/verifier/ctx_skb.c
> +++ b/tools/testing/selftests/bpf/verifier/ctx_skb.c
> @@ -1089,3 +1089,45 @@
> .errstr_unpriv = "R1 leaks addr",
> .result = REJECT,
> },
> +{
> + "pkt > pkt_end taken check",
> + .insns = {
> + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, // 0. r2 = *(u32 *)(r1 + data_end)
> + offsetof(struct __sk_buff, data_end)),
> + BPF_LDX_MEM(BPF_W, BPF_REG_4, BPF_REG_1, // 1. r4 = *(u32 *)(r1 + data)
> + offsetof(struct __sk_buff, data)),
> + BPF_MOV64_REG(BPF_REG_3, BPF_REG_4), // 2. r3 = r4
> + BPF_ALU64_IMM(BPF_ADD, BPF_REG_3, 42), // 3. r3 += 42
> + BPF_MOV64_IMM(BPF_REG_1, 0), // 4. r1 = 0
> + BPF_JMP_REG(BPF_JGT, BPF_REG_3, BPF_REG_2, 2), // 5. if r3 > r2 goto 8
> + BPF_ALU64_IMM(BPF_ADD, BPF_REG_4, 14), // 6. r4 += 14
> + BPF_MOV64_REG(BPF_REG_1, BPF_REG_4), // 7. r1 = r4
> + BPF_JMP_REG(BPF_JGT, BPF_REG_3, BPF_REG_2, 1), // 8. if r3 > r2 goto 10
> + BPF_LDX_MEM(BPF_H, BPF_REG_2, BPF_REG_1, 9), // 9. r2 = *(u8 *)(r1 + 9)
> + BPF_MOV64_IMM(BPF_REG_0, 0), // 10. r0 = 0
> + BPF_EXIT_INSN(), // 11. exit
> + },
> + .result = ACCEPT,
> + .prog_type = BPF_PROG_TYPE_SK_SKB,
> +},
> +{
> + "pkt_end < pkt taken check",
> + .insns = {
> + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, // 0. r2 = *(u32 *)(r1 + data_end)
> + offsetof(struct __sk_buff, data_end)),
> + BPF_LDX_MEM(BPF_W, BPF_REG_4, BPF_REG_1, // 1. r4 = *(u32 *)(r1 + data)
> + offsetof(struct __sk_buff, data)),
> + BPF_MOV64_REG(BPF_REG_3, BPF_REG_4), // 2. r3 = r4
> + BPF_ALU64_IMM(BPF_ADD, BPF_REG_3, 42), // 3. r3 += 42
> + BPF_MOV64_IMM(BPF_REG_1, 0), // 4. r1 = 0
> + BPF_JMP_REG(BPF_JGT, BPF_REG_3, BPF_REG_2, 2), // 5. if r3 > r2 goto 8
> + BPF_ALU64_IMM(BPF_ADD, BPF_REG_4, 14), // 6. r4 += 14
> + BPF_MOV64_REG(BPF_REG_1, BPF_REG_4), // 7. r1 = r4
> + BPF_JMP_REG(BPF_JLT, BPF_REG_2, BPF_REG_3, 1), // 8. if r2 < r3 goto 10
> + BPF_LDX_MEM(BPF_H, BPF_REG_2, BPF_REG_1, 9), // 9. r2 = *(u8 *)(r1 + 9)
> + BPF_MOV64_IMM(BPF_REG_0, 0), // 10. r0 = 0
> + BPF_EXIT_INSN(), // 11. exit
> + },
> + .result = ACCEPT,
> + .prog_type = BPF_PROG_TYPE_SK_SKB,
> +},
> --
> 2.24.1
>
next prev parent reply other threads:[~2021-01-20 23:42 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-11 3:12 [PATCH v2 bpf-next 0/3] bpf: Pointers beyond packet end Alexei Starovoitov
2020-11-11 3:12 ` [PATCH v2 bpf-next 1/3] bpf: Support for pointers beyond pkt_end Alexei Starovoitov
2020-11-12 19:16 ` John Fastabend
2020-11-12 23:56 ` Daniel Borkmann
2020-11-13 0:09 ` Alexei Starovoitov
2020-11-13 0:50 ` Daniel Borkmann
2020-11-12 23:59 ` Alexei Starovoitov
2020-11-13 0:35 ` John Fastabend
2020-11-11 3:12 ` [PATCH v2 bpf-next 2/3] selftests/bpf: Add skb_pkt_end test Alexei Starovoitov
2020-11-12 19:19 ` John Fastabend
2020-11-11 3:12 ` [PATCH v2 bpf-next 3/3] selftests/bpf: Add asm tests for pkt vs pkt_end comparison Alexei Starovoitov
2020-11-12 19:24 ` John Fastabend
2021-01-20 20:51 ` Jiri Olsa [this message]
2020-11-13 0:50 ` [PATCH v2 bpf-next 0/3] bpf: Pointers beyond packet end patchwork-bot+netdevbpf
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=20210120205103.GI1760208@krava \
--to=jolsa@redhat.com \
--cc=alexei.starovoitov@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=kernel-team@fb.com \
--cc=netdev@vger.kernel.org \
/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).