[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20201022094758.GC2318292@krava>
Date: Thu, 22 Oct 2020 11:47:58 +0200
From: Jiri Olsa <jolsa@...hat.com>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc: davem@...emloft.net, daniel@...earbox.net,
john.fastabend@...il.com, jolsa@...nel.org, netdev@...r.kernel.org,
bpf@...r.kernel.org, kernel-team@...com
Subject: Re: [PATCH bpf-next 0/3] bpf: Pointers beyond packet end.
On Wed, Oct 21, 2020 at 11:20:12AM -0700, Alexei Starovoitov wrote:
> From: Alexei Starovoitov <ast@...nel.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@...hat.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
>
Powered by blists - more mailing lists