Commit 6920b086 authored by Ludovic L'Hours's avatar Ludovic L'Hours Committed by Martin KaFai Lau

libbpf: Fix map creation flags sanitization

As BPF_F_MMAPABLE flag is now conditionnaly set (by map_is_mmapable),
it should not be toggled but disabled if not supported by kernel.

Fixes: 4fcac46c ("libbpf: only add BPF_F_MMAPABLE flag for data maps with global vars")
Signed-off-by: default avatarLudovic L'Hours <ludovic.lhours@gmail.com>
Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/r/20230108182018.24433-1-ludovic.lhours@gmail.comSigned-off-by: default avatarMartin KaFai Lau <martin.lau@kernel.org>
parent 75514e4c
...@@ -7355,7 +7355,7 @@ static int bpf_object__sanitize_maps(struct bpf_object *obj) ...@@ -7355,7 +7355,7 @@ static int bpf_object__sanitize_maps(struct bpf_object *obj)
if (!bpf_map__is_internal(m)) if (!bpf_map__is_internal(m))
continue; continue;
if (!kernel_supports(obj, FEAT_ARRAY_MMAP)) if (!kernel_supports(obj, FEAT_ARRAY_MMAP))
m->def.map_flags ^= BPF_F_MMAPABLE; m->def.map_flags &= ~BPF_F_MMAPABLE;
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment