mbox series

[bpf-next,0/3] Add support of pointer to struct in global functions

Message ID cover.1607973529.git.me@ubique.spb.ru (mailing list archive)
Headers show
Series Add support of pointer to struct in global functions | expand

Message

Dmitrii Banshchikov Dec. 14, 2020, 7:52 p.m. UTC
This patchset adds support of a pointer to struct among global function
arguments.

The motivation is to overcome the limit on the maximum number of allowed
arguments and avoid tricky and unoptimal ways of passing arguments.

The limitation is that used structs may not contain any other pointers.

Dmitrii Banshchikov (3):
  bpf: Factor out nullable reg type conversion
  bpf: Support pointer to struct in global func args
  selftests/bpf: Add unit tests for global functions

 include/linux/bpf_verifier.h                  |   2 +
 kernel/bpf/btf.c                              |  59 ++++++++--
 kernel/bpf/verifier.c                         | 107 ++++++++++++------
 .../bpf/prog_tests/test_global_funcs.c        |   5 +
 .../selftests/bpf/progs/test_global_func10.c  |  29 +++++
 .../selftests/bpf/progs/test_global_func11.c  |  19 ++++
 .../selftests/bpf/progs/test_global_func12.c  |  21 ++++
 .../selftests/bpf/progs/test_global_func13.c  |  24 ++++
 .../selftests/bpf/progs/test_global_func9.c   |  59 ++++++++++
 9 files changed, 284 insertions(+), 41 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/progs/test_global_func10.c
 create mode 100644 tools/testing/selftests/bpf/progs/test_global_func11.c
 create mode 100644 tools/testing/selftests/bpf/progs/test_global_func12.c
 create mode 100644 tools/testing/selftests/bpf/progs/test_global_func13.c
 create mode 100644 tools/testing/selftests/bpf/progs/test_global_func9.c

Comments

Andrii Nakryiko Dec. 16, 2020, 10:44 p.m. UTC | #1
On Mon, Dec 14, 2020 at 11:53 AM Dmitrii Banshchikov <me@ubique.spb.ru> wrote:
>
> This patchset adds support of a pointer to struct among global function
> arguments.
>
> The motivation is to overcome the limit on the maximum number of allowed
> arguments and avoid tricky and unoptimal ways of passing arguments.
>
> The limitation is that used structs may not contain any other pointers.
>

This patch set seems to be breaking a few selftests, please take a look ([0]).

  [0] https://travis-ci.com/github/kernel-patches/bpf/builds/208973941

> Dmitrii Banshchikov (3):
>   bpf: Factor out nullable reg type conversion
>   bpf: Support pointer to struct in global func args
>   selftests/bpf: Add unit tests for global functions
>
>  include/linux/bpf_verifier.h                  |   2 +
>  kernel/bpf/btf.c                              |  59 ++++++++--
>  kernel/bpf/verifier.c                         | 107 ++++++++++++------
>  .../bpf/prog_tests/test_global_funcs.c        |   5 +
>  .../selftests/bpf/progs/test_global_func10.c  |  29 +++++
>  .../selftests/bpf/progs/test_global_func11.c  |  19 ++++
>  .../selftests/bpf/progs/test_global_func12.c  |  21 ++++
>  .../selftests/bpf/progs/test_global_func13.c  |  24 ++++
>  .../selftests/bpf/progs/test_global_func9.c   |  59 ++++++++++
>  9 files changed, 284 insertions(+), 41 deletions(-)
>  create mode 100644 tools/testing/selftests/bpf/progs/test_global_func10.c
>  create mode 100644 tools/testing/selftests/bpf/progs/test_global_func11.c
>  create mode 100644 tools/testing/selftests/bpf/progs/test_global_func12.c
>  create mode 100644 tools/testing/selftests/bpf/progs/test_global_func13.c
>  create mode 100644 tools/testing/selftests/bpf/progs/test_global_func9.c
>
> --
> 2.25.1
>