From: Eduard Zingerman <eddyz87@gmail.com>
To: Yonghong Song <yonghong.song@linux.dev>, bpf@vger.kernel.org
Cc: Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
kernel-team@fb.com, Martin KaFai Lau <martin.lau@kernel.org>
Subject: Re: [PATCH bpf-next 2/2] selftests/bpf: Add tests for ldsx of pkt data/data_end/data_meta accesses
Date: Tue, 16 Jul 2024 12:54:22 -0700 [thread overview]
Message-ID: <7b985aa45f8277036c8b2ec50277daf987929fcc.camel@gmail.com> (raw)
In-Reply-To: <20240715201833.3236556-1-yonghong.song@linux.dev>
On Mon, 2024-07-15 at 13:18 -0700, Yonghong Song wrote:
[...]
> +SEC("xdp")
> +__description("LDSX, xdp s32 xdp_md->data")
> +__failure __msg("invalid bpf_context access")
> +__naked void ldsx_ctx_1(void)
> +{
> + asm volatile (
> + "r2 = *(s32 *)(r1 + %[xdp_md_data]);"
Nit: this test fails at the first instruction,
hence there is no need to include it's tail.
I think it would be good to keep these tests minimal.
> + "r3 = *(u32 *)(r1 + %[xdp_md_data_end]);"
> + "r1 = r2;"
> + "r1 += 8;"
> + "if r1 > r3 goto l0_%=;"
> + "r0 = *(u64 *)(r1 - 8);"
> +"l0_%=:"
> + "r0 = 0;"
> + "exit;"
> + :
> + : __imm_const(xdp_md_data, offsetof(struct xdp_md, data)),
> + __imm_const(xdp_md_data_end, offsetof(struct xdp_md, data_end))
> + : __clobber_all);
> +}
[...]
next prev parent reply other threads:[~2024-07-16 19:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-15 20:18 [PATCH bpf-next 1/2] bpf: Fail verification for sign-extension of packet data/data_end/data_meta Yonghong Song
2024-07-15 20:18 ` [PATCH bpf-next 2/2] selftests/bpf: Add tests for ldsx of pkt data/data_end/data_meta accesses Yonghong Song
2024-07-16 19:54 ` Eduard Zingerman [this message]
2024-07-16 22:32 ` Yonghong Song
2024-07-16 19:49 ` [PATCH bpf-next 1/2] bpf: Fail verification for sign-extension of packet data/data_end/data_meta Eduard Zingerman
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=7b985aa45f8277036c8b2ec50277daf987929fcc.camel@gmail.com \
--to=eddyz87@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@fb.com \
--cc=martin.lau@kernel.org \
--cc=yonghong.song@linux.dev \
/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