Skip to content

bpf: Add d_path helper

Jiri Olsa bpf netdev 12 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v12 Latest14 patches 4 repliesIn review
  2. v11 RFC14 patches 2 repliesSuperseded
  3. v1014 patches 6 repliesSuperseded
Earlier versions · 9
VersionPostedPatchesRepliesStatus
v914 patches23 repliesSuperseded
v813 patches26 repliesSuperseded
v79 patches1 replyApplied
v69 patches2 repliesSuperseded
v59 patches12 repliesSuperseded
v414 patches44 repliesSuperseded
v30 of 9 patches2 repliesSuperseded
v2 RFC9 patches18 repliesSuperseded
v1 RFC3 patches16 repliesSuperseded

Changes in v12 from the cover letter

- added acks
- rebased on latest bpf-next
- reposted without RFC tag

Patches in v12 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/14tools resolve_btfids: Add size check to get_id functiontools/bpf/resolve_btfids/main.c+8 -10 replies
2/14tools resolve_btfids: Add support for set symbolstools/bpf/resolve_btfids/main.c+19 -10 replies
3/14bpf: Move btf_resolve_size into __btf_resolve_sizeinclude/linux/btf.h kernel/bpf/bpf_struct_ops.c kernel/bpf/btf.c+17 -130 replies
4/14bpf: Add elem_id pointer as argument to __btf_resolve_sizekernel/bpf/btf.c+7 -30 replies
5/14bpf: Add type_id pointer as argument to __btf_resolve_sizekernel/bpf/btf.c+9 -40 replies
6/14bpf: Remove recursion call in btf_struct_accesskernel/bpf/btf.c+5 -60 replies
7/14bpf: Factor btf_struct_access functionkernel/bpf/btf.c+65 -100 replies
8/14bpf: Add btf_struct_ids_match functioninclude/linux/bpf.h kernel/bpf/btf.c kernel/bpf/verifier.c+44 -60 replies
9/14bpf: Add BTF_SET_START/END macrosinclude/linux/bpf.h include/linux/btf_ids.h kernel/bpf/btf.c +2 more+123 -20 replies
10/14bpf: Add d_path helperinclude/uapi/linux/bpf.h kernel/trace/bpf_trace.c scripts/bpf_helpers_doc.py +1 more+80 -22 replies
11/14bpf: Update .BTF_ids section in btf.rst with sets infoDocumentation/bpf/btf.rst+25 -00 replies
12/14selftests/bpf: Add verifier test for d_path helpertools/testing/selftests/bpf/test_verifier.c tools/testing/selftests/bpf/verifier/d_path.c+55 -10 replies
13/14selftests/bpf: Add test for d_path helpertools/testing/selftests/bpf/prog_tests/d_path.c tools/testing/selftests/bpf/progs/test_d_path.c+205 -02 replies
14/14selftests/bpf: Add set test to resolve_btfidstools/testing/selftests/bpf/prog_tests/resolve_btfids.c+38 -10 replies

Reviews trailers per patch

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

PatchAndrii NakryikoKP SinghWenbo Zhang
1/14A-b
2/14A-b
3/14A-b
4/14A-b
5/14A-b
6/14A-b
7/14A-b
8/14A-b
9/14A-b
10/14A-b A-b
11/14A-b
12/14A-b
13/14A-b Original-patch-by
14/14A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v12 thread

Cover letter [PATCH v12 bpf-next 00/14] bpf: Add d_path helper

hi,
adding d_path helper function that returns full path for given 'struct path' object, which needs to be the kernel BTF 'path' object. The path is returned in buffer provided 'buf' of size 'sz' and is zero terminated.

  long bpf_d_path(struct path *path, char *buf, u32 sz);

The helper calls directly d_path function, so there's only limited set of function it can be called from.

The patchset also adds support to add set of BTF IDs for a helper to define functions that the helper is allowed to be called from.

Also available at:
https://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
bpf/d_path

v12 changes:
- added acks
- rebased on latest bpf-next
- reposted without RFC tag

thanks,
jirka

---
Jiri Olsa (14):
tools resolve_btfids: Add size check to get_id function tools resolve_btfids: Add support for set symbols
bpf: Move btf_resolve_size into __btf_resolve_size
bpf: Add elem_id pointer as argument to __btf_resolve_size
bpf: Add type_id pointer as argument to __btf_resolve_size
bpf: Remove recursion call in btf_struct_access
bpf: Factor btf_struct_access function
bpf: Add btf_struct_ids_match function
bpf: Add BTF_SET_START/END macros
bpf: Add d_path helper
bpf: Update .BTF_ids section in btf.rst with sets info selftests/bpf: Add verifier test for d_path helper selftests/bpf: Add test for d_path helper selftests/bpf: Add set test to resolve_btfids

 Documentation/bpf/btf.rst                               |  25 +++++++++++++++
 include/linux/bpf.h                                     |   6 ++++
 include/linux/btf.h                                     |   3 +-
 include/linux/btf_ids.h                                 |  51 +++++++++++++++++++++++++++++-
 include/uapi/linux/bpf.h                                |  16 +++++++++-
 kernel/bpf/bpf_struct_ops.c                             |   6 ++--
 kernel/bpf/btf.c                                        | 163 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------
 kernel/bpf/verifier.c                                   |  22 +++++++++----
 kernel/trace/bpf_trace.c                                |  48 ++++++++++++++++++++++++++++
 scripts/bpf_helpers_doc.py                              |   2 ++
 tools/bpf/resolve_btfids/main.c                         |  29 +++++++++++++++--
 tools/include/linux/btf_ids.h                           |  51 +++++++++++++++++++++++++++++-
 tools/include/uapi/linux/bpf.h                          |  16 +++++++++-
 tools/testing/selftests/bpf/prog_tests/d_path.c         | 147 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tools/testing/selftests/bpf/prog_tests/resolve_btfids.c |  39 ++++++++++++++++++++++-
 tools/testing/selftests/bpf/progs/test_d_path.c         |  58 ++++++++++++++++++++++++++++++++++
 tools/testing/selftests/bpf/test_verifier.c             |  19 ++++++++++-
 tools/testing/selftests/bpf/verifier/d_path.c           |  37 ++++++++++++++++++++++
 18 files changed, 694 insertions(+), 44 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/d_path.c
 create mode 100644 tools/testing/selftests/bpf/progs/test_d_path.c
 create mode 100644 tools/testing/selftests/bpf/verifier/d_path.c