Skip to content

Fix various issues with 32-bit libbpf

Andrii Nakryiko bpf netdev 3 versions In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v29 patches 1 replyIn review
  2. v3 Latest9 patches 1 replyIn review
  3. v19 patches 2 repliesSuperseded

Changes in v3 from the cover letter

- don't give up if failed to determine ELF class;

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9tools/bpftool: fix compilation warnings in 32-bit modetools/bpf/bpftool/btf_dumper.c tools/bpf/bpftool/link.c tools/bpf/bpftool/main.h +1 more+20 -120 replies
2/9selftest/bpf: fix compilation warnings in 32-bit modetools/testing/selftests/bpf/prog_tests/bpf_obj_id.c tools/testing/selftests/bpf/prog_tests/core_extern.c tools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf.c +6 more+24 -190 replies
3/9libbpf: fix BTF-defined map-in-map initialization on 32-bit host archestools/lib/bpf/libbpf.c+10 -60 replies
4/9libbpf: handle BTF pointer sizes more carefullytools/lib/bpf/btf.c tools/lib/bpf/btf.h tools/lib/bpf/btf_dump.c +1 more+87 -40 replies
5/9selftests/bpf: fix btf_dump test cases on 32-bit archestools/testing/selftests/bpf/prog_tests/btf_dump.c+20 -70 replies
6/9libbpf: enforce 64-bitness of BTF for BPF object filestools/lib/bpf/libbpf.c+4 -00 replies
7/9selftests/bpf: correct various core_reloc 64-bit assumptionstools/testing/selftests/bpf/prog_tests/core_reloc.c tools/testing/selftests/bpf/progs/core_reloc_types.h+47 -420 replies
8/9tools/bpftool: generate data section struct with conservative alignmenttools/bpf/bpftool/gen.c+14 -00 replies
9/9selftests/bpf: make test_varlen work with 32-bit user-space archtools/testing/selftests/bpf/prog_tests/varlen.c tools/testing/selftests/bpf/progs/test_varlen.c+7 -70 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 bpf 0/9] Fix various issues with 32-bit libbpf

This patch set contains fixes to libbpf, bpftool, and selftests that were found while testing libbpf and selftests built in 32-bit mode. 64-bit nature of BPF target and 32-bit host environment don't always mix together well without extra care, so there were a bunch of problems discovered and fixed.

Each individual patch contains additional explanations, where necessary.

v2->v3:
- don't give up if failed to determine ELF class;
v1->v2:
- guess_ptr_sz -> determine_ptr_sz as per Alexei;
- added pointer size determination by ELF class.

Andrii Nakryiko (9):
tools/bpftool: fix compilation warnings in 32-bit mode selftest/bpf: fix compilation warnings in 32-bit mode
libbpf: fix BTF-defined map-in-map initialization on 32-bit host
arches
libbpf: handle BTF pointer sizes more carefully selftests/bpf: fix btf_dump test cases on 32-bit arches
libbpf: enforce 64-bitness of BTF for BPF object files selftests/bpf: correct various core_reloc 64-bit assumptions tools/bpftool: generate data section struct with conservative
alignment
selftests/bpf: make test_varlen work with 32-bit user-space arch

 tools/bpf/bpftool/btf_dumper.c                |  2 +-
 tools/bpf/bpftool/gen.c                       | 14 ++++
 tools/bpf/bpftool/link.c                      |  4 +-
 tools/bpf/bpftool/main.h                      | 10 ++-
 tools/bpf/bpftool/prog.c                      | 16 ++--
 tools/lib/bpf/btf.c                           | 83 ++++++++++++++++++-
 tools/lib/bpf/btf.h                           |  2 +
 tools/lib/bpf/btf_dump.c                      |  4 +-
 tools/lib/bpf/libbpf.c                        | 20 +++--
 tools/lib/bpf/libbpf.map                      |  2 +
 .../selftests/bpf/prog_tests/bpf_obj_id.c     |  8 +-
 .../selftests/bpf/prog_tests/btf_dump.c       | 27 ++++--
 .../selftests/bpf/prog_tests/core_extern.c    |  4 +-
 .../selftests/bpf/prog_tests/core_reloc.c     | 20 ++---
 .../selftests/bpf/prog_tests/fexit_bpf2bpf.c  |  6 +-
 .../selftests/bpf/prog_tests/flow_dissector.c |  2 +-
 .../selftests/bpf/prog_tests/global_data.c    |  6 +-
 .../selftests/bpf/prog_tests/prog_run_xattr.c |  2 +-
 .../selftests/bpf/prog_tests/skb_ctx.c        |  2 +-
 .../testing/selftests/bpf/prog_tests/varlen.c |  8 +-
 .../selftests/bpf/progs/core_reloc_types.h    | 69 ++++++++-------
 .../testing/selftests/bpf/progs/test_varlen.c |  6 +-
 tools/testing/selftests/bpf/test_btf.c        |  8 +-
 tools/testing/selftests/bpf/test_progs.h      |  5 ++
 24 files changed, 233 insertions(+), 97 deletions(-)
Signature · 1 line
2.24.1