Fix devmap pinning and reloading. The kernel adds BPF_F_RDONLY_PROG to all devmaps when created, but libbpf checks that user flags match pinned map flags when using LIBBPF_PIN_BY_NAME, so reusing pinned devmaps doesn't work, failing with an error like: libbpf: couldn't reuse pinned map at '/sys/fs/bpf/dev_map': parameter mismatch Work around this by ignoring RDONLY_PROG in the compat check in libbpf. Changes since v1: - Fixed a broken import - Fixed style issues Pramukh Naduthota (2): Ignore RDONLY_PROG for devmaps in libbpf to allow re-loading of pinned devmaps Add a selftest for devmap pinning. tools/lib/bpf/libbpf.c | 8 +++++++- .../testing/selftests/bpf/prog_tests/devmap.c | 20 +++++++++++++++++++ .../selftests/bpf/progs/test_pinned_devmap.c | 17 ++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/bpf/prog_tests/devmap.c create mode 100644 tools/testing/selftests/bpf/progs/test_pinned_devmap.c -- 2.30.2