Skip to content

resolve_btfids: Discover kfuncs from BTF ID sets

Ihor Solodrai bpf linux-input sashiko-reviews 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 Latest8 patches 14 repliesApplied 8/8

Patches in v1 All 8 applied

#Subject and filesSizeRepliesApplied
1/8resolve_btfids: Implement generic ensure_mem() to grow arraystools/bpf/resolve_btfids/main.c+33 -222 repliesApplied
2/8resolve_btfids: Index BTF ID symbols by addresstools/bpf/resolve_btfids/main.c+72 -241 replyApplied
3/8resolve_btfids: Keep collected kfuncs in a rbtreetools/bpf/resolve_btfids/main.c+42 -82 repliesApplied
4/8libbpf: Export btf__find_by_name_kind_own()tools/lib/bpf/btf.h tools/lib/bpf/libbpf.map tools/lib/bpf/libbpf_internal.h+3 -22 repliesApplied
5/8resolve_btfids: Fix the _impl lookup for module BTFtools/bpf/resolve_btfids/main.c+1 -11 replyApplied
6/8HID: bpf: Make syscall kfunc flags match the struct_ops setdrivers/hid/bpf/hid_bpf_dispatch.c+5 -52 repliesApplied
7/8resolve_btfids: Discover kfuncs from BTF ID setstools/bpf/resolve_btfids/main.c+29 -602 repliesApplied
8/8resolve_btfids: Enforce consistent kfunc flags across BTF ID setstools/bpf/resolve_btfids/main.c+13 -41 replyApplied

Reviews trailers per patch

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

PatchEmil TsalapatisEduard ZingermanAlan Maguire
SeriesT-b
1/8R-b
2/8R-b R-b
3/8R-b
4/8R-b
5/8R-b
6/8R-b
7/8R-b
8/8R-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 v1 thread

Cover letter [PATCH bpf-next v1 0/8] resolve_btfids: Discover kfuncs from BTF ID sets

This series develops resolve_btfids in preparation for bringing kernel-specific BTF transformations in tree, which will reduce kbuild dependency on pahole's features.

resolve_btfids currently identifies kfuncs by reading the "bpf_kfunc" decl tags pahole emits into vmlinux BTF. The series switches the source of truth to the BTF ID sets registered with BTF_KFUNCS_START()/END() in the kernel, which is the mechanism BPF verifier uses.

The series is based on patches #5 and #6 from the original "resolve_btfids: Implement BTF tags emission for kfuncs" series [1], and includes a few significant additions. Particularly the build time enforcement of kfunc flags consistency [2].

The series consists of:
- patches #1-#3 implement supporting infrastructure for the proper kfunc discovery and deduplication
- patches #4-#5 expose btf__find_by_name_kind_own() and use it to fix a latent bug in _impl func lookup
- patch #6 fixes inconsistent kfunc flags for HID kfuncs
- patch #7 implements kfunc discovery from BTF ID sets
- patch #8 adds enforcement of kfunc flags consistency

The resolve_btfids selftests patches have landed earlier [3].

[1] https://lore.kernel.org/bpf/[email protected]/
[2] https://lore.kernel.org/bpf/[email protected]/
[3] https://lore.kernel.org/bpf/[email protected]/

---

Changes compared to [1]:
- Drop the idempotency (ensure_*) machinery: assume valid input BTF (Andrii)
- Use rbtree to store the kfuncs (Andrii)
- Enforce full KF_* flag consistency as a build error (Eduard)
- Various cleanups and nits (Andrii, Emil, Jiri)

---

Ihor Solodrai (8):
resolve_btfids: Implement generic ensure_mem() to grow arrays
resolve_btfids: Index BTF ID symbols by address
resolve_btfids: Keep collected kfuncs in a rbtree
libbpf: Export btf__find_by_name_kind_own()
resolve_btfids: Fix the _impl lookup for module BTF
HID: bpf: Make syscall kfunc flags match the struct_ops set
resolve_btfids: Discover kfuncs from BTF ID sets
resolve_btfids: Enforce consistent kfunc flags across BTF ID sets

 drivers/hid/bpf/hid_bpf_dispatch.c |  10 +-
 tools/bpf/resolve_btfids/main.c    | 275 ++++++++++++++++++-----------
 tools/lib/bpf/btf.h                |   2 +
 tools/lib/bpf/libbpf.map           |   1 +
 tools/lib/bpf/libbpf_internal.h    |   2 -
 5 files changed, 181 insertions(+), 109 deletions(-)
Signature · 1 line
2.55.0