Skip to content

Support passing BPF iterator to kfuncs

Andrii Nakryiko bpf 1 version Applied

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

  1. v1 Latest3 patches 5 repliesApplied 3/3

Patches in v1 All 3 applied

#Subject and filesSizeRepliesApplied
1/3bpf: extract iterator argument type and name validation logicinclude/linux/btf.h kernel/bpf/btf.c+41 -141 replyApplied
2/3bpf: allow passing struct bpf_iter_<type> as kfunc argumentskernel/bpf/verifier.c+24 -114 repliesApplied
3/3selftests/bpf: test passing iterator to a kfunctools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c tools/testing/selftests/bpf/progs/iters_testmod_seq.c+62 -40 repliesApplied

Reviews trailers per patch

1 of 3 patches has a Reviewed-by or Acked-by.

PatchEduard Zingerman
1/3A-b
2/3
3/3

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

Read the v1 thread

Cover letter [PATCH bpf-next 0/3] Support passing BPF iterator to kfuncs

Add support for passing BPF iterator state to any kfunc. Such kfunc has to declare such argument with valid struct bpf_iter_<type> * type and should use "__iter" suffix in argument name, following the established suffix-based convention. We add a simple test/demo iterator getter in bpf_testmod.

Andrii Nakryiko (3):
bpf: extract iterator argument type and name validation logic
bpf: allow passing struct bpf_iter_<type> as kfunc arguments selftests/bpf: test passing iterator to a kfunc

 include/linux/btf.h                           |  5 ++
 kernel/bpf/btf.c                              | 50 +++++++++++++------
 kernel/bpf/verifier.c                         | 35 +++++++++----
 .../selftests/bpf/bpf_testmod/bpf_testmod.c   | 16 ++++--
 .../selftests/bpf/progs/iters_testmod_seq.c   | 50 +++++++++++++++++++
 5 files changed, 127 insertions(+), 29 deletions(-)
Signature · 1 line
2.43.5