Skip to content

Fix sanitizer-reported libbpf and selftest issues

Andrii Nakryiko bpf 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest13 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/13tools/resolve_btf_ids: close ELF file on errortools/bpf/resolve_btfids/main.c+3 -20 replies
2/13libbpf: fix potential misaligned memory access in btf_ext__new()tools/lib/bpf/btf.c tools/lib/bpf/btf.h+6 -60 replies
3/13libbpf: prevent UBSan from complaining about integer overflowtools/lib/bpf/btf.c+1 -03 replies
4/13libbpf: don't call libc APIs with NULL pointerstools/lib/bpf/libbpf.c+7 -30 replies
5/13libbpf: fix glob_syms memory leak in bpf_linkertools/lib/bpf/linker.c+1 -00 replies
6/13libbpf: fix using invalidated memory in bpf_linkertools/lib/bpf/linker.c+4 -10 replies
7/13selftests/bpf: fix UBSan complaint about signed __int128 overflowtools/testing/selftests/bpf/prog_tests/btf_dump.c+1 -10 replies
8/13selftests/bpf: fix possible NULL passed to memcpy() with zero sizetools/testing/selftests/bpf/prog_tests/core_reloc.c+2 -10 replies
9/13selftests/bpf: prevent misaligned memory access in get_stack_raw_tp testtools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c+10 -40 replies
10/13selftests/bpf: fix misaligned memory access in queue_stack_map testtools/testing/selftests/bpf/prog_tests/queue_stack_map.c+7 -50 replies
11/13selftests/bpf: prevent out-of-bounds stack access in test_bpffstools/testing/selftests/bpf/prog_tests/test_bpffs.c+3 -10 replies
12/13selftests/bpf: fix misaligned memory accesses in xdp_bonding testtools/testing/selftests/bpf/prog_tests/xdp_bonding.c+20 -160 replies
13/13selftests/bpf: fix misaligned accesses in xdp and xdp_bpf2bpf teststools/testing/selftests/bpf/prog_tests/xdp.c tools/testing/selftests/bpf/prog_tests/xdp_bpf2bpf.c+9 -80 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH bpf-next 00/13] Fix sanitizer-reported libbpf and selftest issues

After doing another run with ASAN, LSAN, and UBSAN, they turned up a bunch of new issues not noticed before. Fix all of them in preparation for sanitized test_progs runs in BPF CI in the near future.

Andrii Nakryiko (13):
tools/resolve_btf_ids: close ELF file on error
libbpf: fix potential misaligned memory access in btf_ext__new()
libbpf: prevent UBSan from complaining about integer overflow
libbpf: don't call libc APIs with NULL pointers
libbpf: fix glob_syms memory leak in bpf_linker
libbpf: fix using invalidated memory in bpf_linker selftests/bpf: fix UBSan complaint about signed __int128 overflow selftests/bpf: fix possible NULL passed to memcpy() with zero size selftests/bpf: prevent misaligned memory access in get_stack_raw_tp
test
selftests/bpf: fix misaligned memory access in queue_stack_map test selftests/bpf: prevent out-of-bounds stack access in test_bpffs selftests/bpf: fix misaligned memory accesses in xdp_bonding test selftests/bpf: fix misaligned accesses in xdp and xdp_bpf2bpf tests

 tools/bpf/resolve_btfids/main.c               |  5 +--
 tools/lib/bpf/btf.c                           | 11 +++---
 tools/lib/bpf/btf.h                           |  2 +-
 tools/lib/bpf/libbpf.c                        | 10 ++++--
 tools/lib/bpf/linker.c                        |  6 +++-
 .../selftests/bpf/prog_tests/btf_dump.c       |  2 +-
 .../selftests/bpf/prog_tests/core_reloc.c     |  3 +-
 .../bpf/prog_tests/get_stack_raw_tp.c         | 14 +++++---
 .../bpf/prog_tests/queue_stack_map.c          | 12 ++++---
 .../selftests/bpf/prog_tests/test_bpffs.c     |  4 ++-
 tools/testing/selftests/bpf/prog_tests/xdp.c  | 11 +++---
 .../selftests/bpf/prog_tests/xdp_bonding.c    | 36 ++++++++++---------
 .../selftests/bpf/prog_tests/xdp_bpf2bpf.c    |  6 ++--
 13 files changed, 74 insertions(+), 48 deletions(-)
Signature · 1 line
2.30.2