Skip to content

BTF: arbitrary __attribute__ encoding

Ihor Solodrai bpf 2 versions – 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 · linked by author and title

  1. v3 Latest6 patches 2 repliesApplied 6/6
  2. v26 patches 4 repliesSuperseded

v1->v2 from the cover letter

- When checking for specific BTF tags in the verifier, make sure the tag's kflag is 0
- Split docs and libbpf changes into separate patches
- Various renames, as suggested by Andrii and Eduard

Patches in v3 All 6 applied

#Subject and filesSizeRepliesApplied
1/6libbpf: introduce kflag for type_tags and decl_tags in BTFtools/lib/bpf/btf.c tools/lib/bpf/btf.h tools/lib/bpf/libbpf.map+68 -230 repliesApplied
2/6docs/bpf: document the semantics of BTF tags with kind_flagDocumentation/bpf/btf.rst include/uapi/linux/btf.h tools/include/uapi/linux/btf.h+25 -60 repliesApplied
3/6libbpf: check the kflag of type tags in btf_dumptools/lib/bpf/btf_dump.c+4 -10 repliesApplied
4/6selftests/bpf: add a btf_dump test for type_tagstools/testing/selftests/bpf/prog_tests/btf_dump.c+110 -370 repliesApplied
5/6bpf: allow kind_flag for BTF type and decl tagskernel/bpf/btf.c tools/testing/selftests/bpf/prog_tests/btf.c+13 -172 repliesApplied
6/6selftests/bpf: add a BTF verification test for kflagged type_tagtools/testing/selftests/bpf/prog_tests/btf.c tools/testing/selftests/bpf/test_btf.h+24 -10 repliesApplied

Reviews trailers per patch

4 of 6 patches have a Reviewed-by or Acked-by.

PatchAlan MaguireAndrii NakryikoEduard Zingerman
1/6R-b A-b
2/6
3/6R-b A-b
4/6A-b
5/6A-b
6/6

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 v3 thread

Cover letter [PATCH bpf-next v3 0/6] BTF: arbitrary __attribute__ encoding

This patch series extends BPF Type Format (BTF) to support arbitrary __attribute__ encoding.

Setting the kind_flag to 1 in BTF type tags and decl tags now changes the meaning for the encoded tag, in particular with respect to btf_dump in libbpf.

If the kflag is set, then the string encoded by the tag represents the full attribute-list of an attribute specifier [1].

This feature will allow extending tools such as pahole and bpftool to capture and use more granular type information, and make it easier to manage compatibility between clang and gcc BPF compilers.

[1] https://gcc.gnu.org/onlinedocs/gcc-13.2.0/gcc/Attribute-Syntax.html

v2->v3: nit fixes suggested by Andrii
v1->v2:
- When checking for specific BTF tags in the verifier, make sure the tag's kflag is 0
- Split docs and libbpf changes into separate patches
- Various renames, as suggested by Andrii and Eduard

v2: https://lore.kernel.org/bpf/[email protected]/
v1: https://lore.kernel.org/bpf/[email protected]

Ihor Solodrai (6):
libbpf: introduce kflag for type_tags and decl_tags in BTF docs/bpf: document the semantics of BTF tags with kind_flag
libbpf: check the kflag of type tags in btf_dump selftests/bpf: add a btf_dump test for type_tags
bpf: allow kind_flag for BTF type and decl tags selftests/bpf: add a BTF verification test for kflagged type_tag

 Documentation/bpf/btf.rst                     |  25 ++-
 include/uapi/linux/btf.h                      |   3 +-
 kernel/bpf/btf.c                              |  26 ++--
 tools/include/uapi/linux/btf.h                |   3 +-
 tools/lib/bpf/btf.c                           |  86 +++++++---
 tools/lib/bpf/btf.h                           |   3 +
 tools/lib/bpf/btf_dump.c                      |   5 +-
 tools/lib/bpf/libbpf.map                      |   2 +
 tools/testing/selftests/bpf/prog_tests/btf.c  |  23 ++-
 .../selftests/bpf/prog_tests/btf_dump.c       | 147 +++++++++++++-----
 tools/testing/selftests/bpf/test_btf.h        |   6 +
 11 files changed, 244 insertions(+), 85 deletions(-)
Signature · 1 line
2.48.1