BPF List
 help / color / mirror / Atom feed
From: Yonghong Song <yonghong.song@linux.dev>
To: Eduard Zingerman <eddyz87@gmail.com>, 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 15:32:12 -0700	[thread overview]
Message-ID: <a22346ee-5c99-4fba-8774-6ce78502d575@linux.dev> (raw)
In-Reply-To: <7b985aa45f8277036c8b2ec50277daf987929fcc.camel@gmail.com>


On 7/16/24 12:54 PM, Eduard Zingerman wrote:
> 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.

Okay, I will shorten the test to have minimum instructions
to reproduce the issue.

>
>> +        "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);
>> +}
> [...]

  reply	other threads:[~2024-07-16 22:32 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
2024-07-16 22:32     ` Yonghong Song [this message]
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=a22346ee-5c99-4fba-8774-6ce78502d575@linux.dev \
    --to=yonghong.song@linux.dev \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=kernel-team@fb.com \
    --cc=martin.lau@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