From: Jiri Olsa <jolsa@redhat.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: davem@davemloft.net, daniel@iogearbox.net,
john.fastabend@gmail.com, jolsa@kernel.org,
netdev@vger.kernel.org, bpf@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH bpf-next 0/3] bpf: Pointers beyond packet end.
Date: Thu, 22 Oct 2020 11:47:58 +0200 [thread overview]
Message-ID: <20201022094758.GC2318292@krava> (raw)
In-Reply-To: <20201021182015.39000-1-alexei.starovoitov@gmail.com>
On Wed, Oct 21, 2020 at 11:20:12AM -0700, Alexei Starovoitov wrote:
> From: Alexei Starovoitov <ast@kernel.org>
>
> In some cases LLVM uses the knowledge that branch is taken to optimze the code
> which causes the verifier to reject valid programs.
> Teach the verifier to recognize that
> r1 = skb->data;
> r1 += 10;
> r2 = skb->data_end;
> if (r1 > r2) {
> here r1 points beyond packet_end and subsequent
> if (r1 > r2) // always evaluates to "true".
> }
>
> Alexei Starovoitov (3):
> bpf: Support for pointers beyond pkt_end.
> selftests/bpf: Add skb_pkt_end test
> selftests/bpf: Add asm tests for pkt vs pkt_end comparison.
Tested-by: Jiri Olsa <jolsa@redhat.com>
thanks,
jirka
>
> include/linux/bpf_verifier.h | 2 +-
> kernel/bpf/verifier.c | 131 +++++++++++++++---
> .../bpf/prog_tests/test_skb_pkt_end.c | 41 ++++++
> .../testing/selftests/bpf/progs/skb_pkt_end.c | 54 ++++++++
> .../testing/selftests/bpf/verifier/ctx_skb.c | 42 ++++++
> 5 files changed, 247 insertions(+), 23 deletions(-)
> create mode 100644 tools/testing/selftests/bpf/prog_tests/test_skb_pkt_end.c
> create mode 100644 tools/testing/selftests/bpf/progs/skb_pkt_end.c
>
> --
> 2.23.0
>
prev parent reply other threads:[~2020-10-22 9:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-21 18:20 [PATCH bpf-next 0/3] bpf: Pointers beyond packet end Alexei Starovoitov
2020-10-21 18:20 ` [PATCH bpf-next 1/3] bpf: Support for pointers beyond pkt_end Alexei Starovoitov
2020-10-21 22:07 ` kernel test robot
2020-10-21 18:20 ` [PATCH bpf-next 2/3] selftests/bpf: Add skb_pkt_end test Alexei Starovoitov
2020-10-21 18:20 ` [PATCH bpf-next 3/3] selftests/bpf: Add asm tests for pkt vs pkt_end comparison Alexei Starovoitov
2020-10-22 9:47 ` Jiri Olsa [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=20201022094758.GC2318292@krava \
--to=jolsa@redhat.com \
--cc=alexei.starovoitov@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--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).