[PATCH v3 0/2] libbpf: fix reuse of DEVMAP

From: Yureka Lilian
Date: Thu Aug 14 2025 - 14:07:17 EST


changes in v3:

- instead of setting BPF_F_RDONLY_PROG on both sides, just
clear BPF_F_RDONLY_PROG in map_info.map_flags as suggested
by Andrii Nakryiko

- in the test, use ASSERT_* instead of CHECK
- shorten the test by using open_and_load from the skel
- in the test, drop NULL check before unloading/destroying bpf objs

- start the commit messages with "libbpf" and "selftests/bpf"
respectively instead of just "bpf"

changes in v2:

- preserve compatibility with older kernels
- add a basic selftest covering the re-use of DEVMAP maps

Yureka Lilian (2):
libbpf: fix reuse of DEVMAP
selftests/bpf: add test for DEVMAP reuse

tools/lib/bpf/libbpf.c | 11 ++++
.../bpf/prog_tests/pinning_devmap_reuse.c | 50 +++++++++++++++++++
.../selftests/bpf/progs/test_pinning_devmap.c | 20 ++++++++
3 files changed, 81 insertions(+)
create mode 100644 tools/testing/selftests/bpf/prog_tests/pinning_devmap_reuse.c
create mode 100644 tools/testing/selftests/bpf/progs/test_pinning_devmap.c

--
2.50.1