Skip to content

Add support of pointer to struct in global functions

Dmitrii Banshchikov bpf 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest4 patches 7 repliesIn review
  2. v24 patches 5 repliesSuperseded
  3. v13 patches 9 repliesSuperseded

Changes in v3 from the cover letter

- Fix reg ID generation
- Fix commit description
- Fix typo
- Fix tests

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4bpf: Rename bpf_reg_state variableskernel/bpf/btf.c+12 -81 reply
2/4bpf: Extract nullable reg type conversion into a helper functionkernel/bpf/verifier.c+52 -311 reply
3/4bpf: Support pointers in global func argsinclude/linux/bpf_verifier.h kernel/bpf/btf.c kernel/bpf/verifier.c+77 -103 replies
4/4selftests/bpf: Add unit tests for pointers in global functionstools/testing/selftests/bpf/prog_tests/global_func_args.c tools/testing/selftests/bpf/prog_tests/test_global_funcs.c tools/testing/selftests/bpf/progs/test_global_func10.c +8 more+449 -03 replies

Reviews trailers per patch

All 4 patches have a Reviewed-by or Acked-by.

PatchAndrii Nakryiko
1/4A-b
2/4A-b
3/4A-b
4/4A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 bpf-next 0/4] Add support of pointer to struct in global functions

This patchset adds support of pointers to type with known size 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.

A referenced type may contain pointers but access via such pointers cannot be veirified currently.

v2 -> v3
- Fix reg ID generation
- Fix commit description
- Fix typo
- Fix tests

v1 -> v2:
- Allow pointer to any type with known size rather than struct only
- Allow pointer in global functions only
- Add more tests
- Fix wrapping and v1 comments

Dmitrii Banshchikov (4):
bpf: Rename bpf_reg_state variables
bpf: Extract nullable reg type conversion into a helper function
bpf: Support pointers in global func args selftests/bpf: Add unit tests for pointers in global functions

 include/linux/bpf_verifier.h                  |   2 +
 kernel/bpf/btf.c                              |  71 +++++++---
 kernel/bpf/verifier.c                         | 113 +++++++++++----
 .../bpf/prog_tests/global_func_args.c         |  60 ++++++++
 .../bpf/prog_tests/test_global_funcs.c        |   8 ++
 .../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_func14.c  |  21 +++
 .../selftests/bpf/progs/test_global_func15.c  |  22 +++
 .../selftests/bpf/progs/test_global_func16.c  |  22 +++
 .../selftests/bpf/progs/test_global_func9.c   | 132 ++++++++++++++++++
 .../bpf/progs/test_global_func_args.c         |  91 ++++++++++++
 14 files changed, 588 insertions(+), 47 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/global_func_args.c
 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_func14.c
 create mode 100644 tools/testing/selftests/bpf/progs/test_global_func15.c
 create mode 100644 tools/testing/selftests/bpf/progs/test_global_func16.c
 create mode 100644 tools/testing/selftests/bpf/progs/test_global_func9.c
 create mode 100644 tools/testing/selftests/bpf/progs/test_global_func_args.c
Signature · 1 line
2.25.1