From: Eduard Zingerman <eddyz87@gmail.com>
To: "Maciej Żenczykowski" <zenczykowski@gmail.com>
Cc: bpf@vger.kernel.org, ast@kernel.org, andrii@kernel.org,
daniel@iogearbox.net, martin.lau@linux.dev, kernel-team@fb.com,
yonghong.song@linux.dev
Subject: Re: [PATCH bpf-next 2/3] bpf: infer packet range for 'if pkt ==/!= pkt_end' comparisons
Date: Mon, 08 Jan 2024 15:57:35 +0200 [thread overview]
Message-ID: <c1dc9b8cf943b59396559be26706b77625fbac08.camel@gmail.com> (raw)
In-Reply-To: <CAHo-OowJWNFMAEwvFhaPUevHjTYBe71NuMgYLBShtzxFcSQ3jw@mail.gmail.com>
On Mon, 2024-01-08 at 05:49 -0800, Maciej Żenczykowski wrote:
> (I've looked at all 3 patches, and they seem fine... but I don't claim
> to understand the intricacies of the verifier/registers/etc well
> enough to be certain)
Thank you.
> On Mon, Jan 8, 2024 at 5:28 AM Eduard Zingerman <eddyz87@gmail.com> wrote:
> >
> > Extend try_match_pkt_pointers() to handle == and != operations.
> > For instruction:
> >
> > .--------------- pointer to packet with some range R
> > | .--------- pointer to packet end
> > v v
> > if rA == rB goto ...
>
> it's possible this would be better without the 'goto' as just 'if (rA
> == rB) ...'
The idea was to show this as BPF asm instruction, which has syntax
'if rA == rB goto C'. I'll wait for more feedback and submit v2
with updated commit message to make it more clear.
> > It is valid to infer that R bytes are available in packet.
> > This change should allow verification of BPF generated for
> > C code like below:
> >
> > if (data + 42 != data_end) { ... }
>
> this should probably be:
> if (data + 42 != data_end) return;
> ...
Makes sense, will update commit message.
next prev parent reply other threads:[~2024-01-08 13:57 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-08 13:27 [PATCH bpf-next 0/3] infer packet range for 'if pkt ==/!= pkt_end' instructions Eduard Zingerman
2024-01-08 13:28 ` [PATCH bpf-next 1/3] bpf: simplify try_match_pkt_pointers() Eduard Zingerman
2024-01-09 0:40 ` Andrii Nakryiko
2024-01-09 0:43 ` Andrii Nakryiko
2024-01-09 0:52 ` Eduard Zingerman
2024-01-09 18:22 ` Andrii Nakryiko
2024-01-08 13:28 ` [PATCH bpf-next 2/3] bpf: infer packet range for 'if pkt ==/!= pkt_end' comparisons Eduard Zingerman
2024-01-08 13:49 ` Maciej Żenczykowski
2024-01-08 13:57 ` Eduard Zingerman [this message]
2024-01-09 0:45 ` Andrii Nakryiko
2024-01-09 0:57 ` Eduard Zingerman
2024-01-09 18:32 ` Andrii Nakryiko
2024-01-09 17:26 ` Yonghong Song
2024-01-10 1:07 ` Eduard Zingerman
2024-01-10 18:23 ` Eduard Zingerman
2024-01-08 13:28 ` [PATCH bpf-next 3/3] selftests/bpf: test packet range inference for 'if pkt ==/!= pkt_end' 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=c1dc9b8cf943b59396559be26706b77625fbac08.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@linux.dev \
--cc=yonghong.song@linux.dev \
--cc=zenczykowski@gmail.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