mbox series

[bpf,v2,0/4] BPF fixes mixed tail and bpf2bpf calls

Message ID 162388400488.151936.1658153981415911010.stgit@john-XPS-13-9370 (mailing list archive)
Headers show
Series BPF fixes mixed tail and bpf2bpf calls | expand

Message

John Fastabend June 16, 2021, 10:54 p.m. UTC
We recently tried to use mixed programs that have both tail calls and
subprograms, but it needs the attached fixes.

Also added a new test case tailcall_bpf2bpf_5 that simply runs the
previous test case tailcall_bpf2bpf_4 and adds some "noise". The
noise here is just a bunch of map calls to get the verifier to insert
instructions and cause code movement plus it forces used_maps logic
to be used. Originally, I just extended bpf2bpf_4 directly, but if I
got the feedback correct it seems the preference is to have another
test case for this specifically.

With attached patches our programs are happily running with mixed
subprograms and tailcalls.

Thanks,
John

---

John Fastabend (4):
      bpf: Fix null ptr deref with mixed tail calls and subprogs
      bpf: map_poke_descriptor is being called with an unstable poke_tab[]
      bpf: track subprog poke correctly
      bpf: selftest to verify mixing bpf2bpf calls and tailcalls with insn patch


 include/linux/bpf.h                           |  1 +
 kernel/bpf/core.c                             |  6 ++--
 kernel/bpf/verifier.c                         | 36 ++++++++++++++-----
 .../selftests/bpf/prog_tests/tailcalls.c      | 36 +++++++++++++------
 .../selftests/bpf/progs/tailcall_bpf2bpf4.c   | 20 ++++++++++-
 5 files changed, 77 insertions(+), 22 deletions(-)

--

Comments

Andrii Nakryiko June 17, 2021, 4:30 a.m. UTC | #1
On Wed, Jun 16, 2021 at 7:34 PM John Fastabend <john.fastabend@gmail.com> wrote:
>
> We recently tried to use mixed programs that have both tail calls and
> subprograms, but it needs the attached fixes.
>
> Also added a new test case tailcall_bpf2bpf_5 that simply runs the
> previous test case tailcall_bpf2bpf_4 and adds some "noise". The
> noise here is just a bunch of map calls to get the verifier to insert
> instructions and cause code movement plus it forces used_maps logic
> to be used. Originally, I just extended bpf2bpf_4 directly, but if I
> got the feedback correct it seems the preference is to have another
> test case for this specifically.
>
> With attached patches our programs are happily running with mixed
> subprograms and tailcalls.
>
> Thanks,
> John
>
> ---

Would be nice to include bpf@vger.kernel.org as well. I bet not
everyone interested in BPF follows netdev@vger closely.

>
> John Fastabend (4):
>       bpf: Fix null ptr deref with mixed tail calls and subprogs
>       bpf: map_poke_descriptor is being called with an unstable poke_tab[]
>       bpf: track subprog poke correctly
>       bpf: selftest to verify mixing bpf2bpf calls and tailcalls with insn patch
>
>
>  include/linux/bpf.h                           |  1 +
>  kernel/bpf/core.c                             |  6 ++--
>  kernel/bpf/verifier.c                         | 36 ++++++++++++++-----
>  .../selftests/bpf/prog_tests/tailcalls.c      | 36 +++++++++++++------
>  .../selftests/bpf/progs/tailcall_bpf2bpf4.c   | 20 ++++++++++-
>  5 files changed, 77 insertions(+), 22 deletions(-)
>
> --
>