Trusted PTR_TO_BTF_ID arg support in global subprogs
Status from this message: This series was applied to bpf/bpf-next.git (master)
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest4 patches 0 repliesApplied 4/4
- v27 patches 5 repliesSuperseded 3 of 7 applied
Changes in v3 from the cover letter
- went back to arg:nullable and __arg_nullable naming;
- rebased on latest bpf-next after prepartory patches landed;
Patches in v3 All 4 applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/4 | bpf: add __arg_trusted global func arg taginclude/ kernel/ kernel/ | +111 | 0 replies | Applied |
| 2/4 | bpf: add arg:nullable tag to be combined with trusted pointerskernel/ | +10 | 0 replies | Applied |
| 3/4 | libbpf: add __arg_trusted and __arg_nullable tag macrostools/ | +2 | 0 replies | Applied |
| 4/4 | selftests/bpf: add trusted global subprog arg teststools/ tools/ | +158 | 0 replies | Applied |
Reviews trailers per patch
All 4 patches have a Reviewed-by or Acked-by.
| Patch | Eduard Zingerman |
|---|---|
| 1/4 | A-b |
| 2/4 | A-b |
| 3/4 | A-b |
| 4/4 | A-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v3 bpf-next 0/4] Trusted PTR_TO_BTF_ID arg support in global subprogs
This patch set follows recent changes that added btf_decl_tag-based argument annotation support for global subprogs. This time we add ability to pass PTR_TO_BTF_ID (BTF-aware kernel pointers) arguments into global subprograms. We support explicitly trusted arguments only, for now.
Patch #1 adds logic for arg:trusted tag support on the verifier side. Default semantic of such arguments is non-NULL, enforced on caller side. But patch #2 adds arg:nullable tag that can be combined with arg:trusted to make callee explicitly do the NULL check, which helps implement "optional" PTR_TO_BTF_ID arguments.
Patch #3 adds libbpf-side __arg_trusted and __arg_nullable macros.
Patch #4 adds a bunch of tests validating __arg_trusted in combination with __arg_nullable.
v2->v3:
- went back to arg:nullable and __arg_nullable naming;
- rebased on latest bpf-next after prepartory patches landed;v1->v2:
- added fix up to type enforcement changes, landed earlier;
- dropped bpf_core_cast() changes, will post them separately, as they now
are not used in added tests;
- dropped arg:untrusted support (Alexei);
- renamed arg:nullable to arg:maybe_null (Alexei);
- and also added task_struct___local flavor tests (Alexei).
Andrii Nakryiko (4):
bpf: add __arg_trusted global func arg tag
bpf: add arg:nullable tag to be combined with trusted pointers
libbpf: add __arg_trusted and __arg_nullable tag macros selftests/bpf: add trusted global subprog arg tests
include/linux/bpf_verifier.h | 1 + kernel/bpf/btf.c | 109 ++++++++++-- kernel/bpf/verifier.c | 24 +++ tools/lib/bpf/bpf_helpers.h | 2 + .../selftests/bpf/prog_tests/verifier.c | 2 + .../bpf/progs/verifier_global_ptr_args.c | 156 ++++++++++++++++++ 6 files changed, 281 insertions(+), 13 deletions(-) create mode 100644 tools/testing/selftests/bpf/progs/verifier_global_ptr_args.c
Signature · 1 line
2.34.1