diff options
author | Stijn Tintel <stijn@linux-ipv6.be> | 2022-02-25 18:23:55 +0300 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2022-02-28 19:20:52 +0300 |
commit | a4fbfdd7a160eccaafc093eb5b34f838b1ca0bf0 (patch) | |
tree | b5e4090496ae35296de1307aa6231a17fa339152 /kernel/bpf/stackmap.c | |
parent | 07609c193a0cfd1e3532a7dd81383c9d458f485c (diff) | |
download | linux-a4fbfdd7a160eccaafc093eb5b34f838b1ca0bf0.tar.xz |
libbpf: Fix BPF_MAP_TYPE_PERF_EVENT_ARRAY auto-pinning
When a BPF map of type BPF_MAP_TYPE_PERF_EVENT_ARRAY doesn't have the
max_entries parameter set, the map will be created with max_entries set
to the number of available CPUs. When we try to reuse such a pinned map,
map_is_reuse_compat will return false, as max_entries in the map
definition differs from max_entries of the existing map, causing the
following error:
libbpf: couldn't reuse pinned map at '/sys/fs/bpf/m_logging': parameter mismatch
Fix this by overwriting max_entries in the map definition. For this to
work, we need to do this in bpf_object__create_maps, before calling
bpf_object__reuse_map.
Fixes: 57a00f41644f ("libbpf: Add auto-pinning of maps when loading BPF objects")
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Song Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/bpf/20220225152355.315204-1-stijn@linux-ipv6.be
Diffstat (limited to 'kernel/bpf/stackmap.c')
0 files changed, 0 insertions, 0 deletions