Skip to content

bpf: misc fixes for bpf_iter

Yonghong Song bpf netdev 2 versions – Applied

Status from this message: Applied, Thanks

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest7 patches 2 repliesApplied
  2. v18 patches 7 repliesSuperseded

Changes in v2 from the cover letter

. add "const" qualifier to struct bpf_iter_reg for
bpf_iter_[un]reg_target, and this results in additional "const" qualifiers in some other places
. drop the patch which will issue WARN_ONCE if
seq_ops->show() returns a positive value. If this does happen, code review should spot this or author does know what he is doing. In the future, we do want to implement a mechanism to find out all registered targets so we will be aware of new additions.

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/7tools/bpf: selftests : explain bpf_iter test failures with llvm 10.0.0tools/testing/selftests/bpf/README.rst+43 -00 replies
2/7bpf: change btf_iter func proto prefix to "bpf_iter_"include/linux/bpf.h tools/lib/bpf/libbpf.c+4 -40 replies
3/7bpf: add comments to interpret bpf_prog return valueskernel/bpf/bpf_iter.c+6 -00 replies
4/7bpf: net: refactor bpf_iter target registrationinclude/linux/bpf.h kernel/bpf/bpf_iter.c kernel/bpf/map_iter.c +3 more+61 -610 replies
5/7bpf: change func bpf_iter_unreg_target() signatureinclude/linux/bpf.h kernel/bpf/bpf_iter.c net/ipv6/route.c+4 -40 replies
6/7bpf: enable bpf_iter targets registering ctx argument typesinclude/linux/bpf.h include/net/ip6_fib.h kernel/bpf/bpf_iter.c +7 more+60 -120 replies
7/7samples/bpf: remove compiler warningssamples/bpf/offwaketime_kern.c samples/bpf/sockex2_kern.c samples/bpf/sockex3_kern.c+6 -60 replies

Reviews trailers per patch

5 of 7 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchAndrii Nakryiko
SeriesA-b
1/7
2/7A-b
3/7A-b
4/7
5/7A-b
6/7A-b
7/7A-b

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

Read the v2 thread

Cover letter [PATCH bpf-next v2 0/7] bpf: misc fixes for bpf_iter

Commit ae24345da54e ("bpf: Implement an interface to register bpf_iter targets") and its subsequent commits in the same patch set introduced bpf iterator, a way to run bpf program when iterating kernel data structures.

This patch set addressed some followup issues. One big change is to allow target to pass ctx arg register types to verifier for verification purpose. Please see individual patch for details.

Changelogs:
v1 -> v2:
. add "const" qualifier to struct bpf_iter_reg for
bpf_iter_[un]reg_target, and this results in additional "const" qualifiers in some other places
. drop the patch which will issue WARN_ONCE if
seq_ops->show() returns a positive value. If this does happen, code review should spot this or author does know what he is doing. In the future, we do want to implement a mechanism to find out all registered targets so we will be aware of new additions.

Yonghong Song (7):
tools/bpf: selftests : explain bpf_iter test failures with llvm 10.0.0
bpf: change btf_iter func proto prefix to "bpf_iter_"
bpf: add comments to interpret bpf_prog return values
bpf: net: refactor bpf_iter target registration
bpf: change func bpf_iter_unreg_target() signature
bpf: enable bpf_iter targets registering ctx argument types samples/bpf: remove compiler warnings

 include/linux/bpf.h                    | 22 ++++++++----
 include/net/ip6_fib.h                  |  7 ++++
 kernel/bpf/bpf_iter.c                  | 49 +++++++++++++++-----------
 kernel/bpf/btf.c                       | 15 +++++---
 kernel/bpf/map_iter.c                  | 23 +++++++-----
 kernel/bpf/task_iter.c                 | 42 ++++++++++++++--------
 kernel/bpf/verifier.c                  |  1 -
 net/ipv6/ip6_fib.c                     |  5 ---
 net/ipv6/route.c                       | 25 +++++++------
 net/netlink/af_netlink.c               | 23 +++++++-----
 samples/bpf/offwaketime_kern.c         |  4 +--
 samples/bpf/sockex2_kern.c             |  4 +--
 samples/bpf/sockex3_kern.c             |  4 +--
 tools/lib/bpf/libbpf.c                 |  2 +-
 tools/testing/selftests/bpf/README.rst | 43 ++++++++++++++++++++++
 15 files changed, 183 insertions(+), 86 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/README.rst
Signature · 1 line
2.24.1