Skip to content

Fix libbpf and selftest issues detected by ASAN

Andrii Nakryiko bpf netdev 2 versions – Applied

Status from this message: Applied, Thanks

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest11 patches 1 replyApplied
  2. v16 patches 4 repliesSuperseded

Changes in v2 from the cover letter

- don't add ASAN flavor, but allow extra flags for build (Alexei);
- fix few more found issues, which somehow were missed first time.

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/11selftests/bpf: ensure test flavors use correct skeletonstools/testing/selftests/bpf/Makefile+1 -10 replies
2/11selftests/bpf: add SAN_CFLAGS param to selftests build to allow sanitizerstools/testing/selftests/bpf/Makefile+4 -30 replies
3/11selftests/bpf: convert test_hashmap into test_progs testtools/testing/selftests/bpf/.gitignore tools/testing/selftests/bpf/Makefile tools/testing/selftests/bpf/prog_tests/hashmap.c+140 -1440 replies
4/11libbpf: fix memory leak and possible double-free in hashmap__cleartools/lib/bpf/hashmap.c+7 -00 replies
5/11selftests/bpf: fix memory leak in test selectortools/testing/selftests/bpf/test_progs.c+16 -40 replies
6/11selftests/bpf: fix memory leak in extract_build_id()tools/testing/selftests/bpf/test_progs.c+1 -00 replies
7/11selftests/bpf: fix invalid memory reads in core_relo selftesttools/testing/selftests/bpf/prog_tests/core_reloc.c+1 -10 replies
8/11libbpf: fix huge memory leak in libbpf_find_vmlinux_btf_id()tools/lib/bpf/libbpf.c+4 -10 replies
9/11selftests/bpf: disable ASAN instrumentation for mmap()'ed memory readtools/testing/selftests/bpf/prog_tests/perf_buffer.c+5 -00 replies
10/11selftests/bpf: fix bpf_link leak in ns_current_pid_tgid selftesttools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid.c+1 -40 replies
11/11selftests/bpf: add runqslower binary to .gitignoretools/testing/selftests/bpf/.gitignore+1 -10 replies

Reviews trailers per patch

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

Read the v2 thread

Cover letter [PATCH v2 bpf-next 00/11] Fix libbpf and selftest issues detected by ASAN

Add necessary infra to build selftests with ASAN (or any other sanitizer). Fix a bunch of found memory leaks and other memory access issues.

v1->v2:
- don't add ASAN flavor, but allow extra flags for build (Alexei);
- fix few more found issues, which somehow were missed first time.

Andrii Nakryiko (11):
selftests/bpf: ensure test flavors use correct skeletons selftests/bpf: add SAN_CFLAGS param to selftests build to allow
sanitizers
selftests/bpf: convert test_hashmap into test_progs test
libbpf: fix memory leak and possible double-free in hashmap__clear selftests/bpf: fix memory leak in test selector selftests/bpf: fix memory leak in extract_build_id() selftests/bpf: fix invalid memory reads in core_relo selftest
libbpf: fix huge memory leak in libbpf_find_vmlinux_btf_id() selftests/bpf: disable ASAN instrumentation for mmap()'ed memory read selftests/bpf: fix bpf_link leak in ns_current_pid_tgid selftest selftests/bpf: add runqslower binary to .gitignore

 tools/lib/bpf/hashmap.c                       |   7 +
 tools/lib/bpf/libbpf.c                        |   5 +-
 tools/testing/selftests/bpf/.gitignore        |   4 +-
 tools/testing/selftests/bpf/Makefile          |  11 +-
 .../selftests/bpf/prog_tests/core_reloc.c     |   2 +-
 .../{test_hashmap.c => prog_tests/hashmap.c}  | 280 +++++++++---------
 .../bpf/prog_tests/ns_current_pid_tgid.c      |   5 +-
 .../selftests/bpf/prog_tests/perf_buffer.c    |   5 +
 tools/testing/selftests/bpf/test_progs.c      |  21 +-
 9 files changed, 181 insertions(+), 159 deletions(-)
 rename tools/testing/selftests/bpf/{test_hashmap.c => prog_tests/hashmap.c} (53%)
Signature · 1 line
2.24.1