libbpf: Fix map creation flags sanitization
PATCH 1/1 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 4fcac46c7e10 ("libbpf: only add BPF_F_MMAPABLE flag for data maps with global vars")
Signed-off-by Ludovic L'Hours <[email protected]>
--- tools/lib/bpf/libbpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/bpf/libbpf.c +1 -1
@@ -7355,7 +7355,7 @@ static int bpf_object__sanitize_maps(struct bpf_object *obj)if (!bpf_map__is_internal (m))continue ;if (!kernel_supports (obj,FEAT_ARRAY_MMAP )) - m->def.map_flags ^=BPF_F_MMAPABLE ; + m->def.map_flags &= ~BPF_F_MMAPABLE ; }return 0 ;
Signature · 1 line
2.25.1
Quoted 5 lines · Ludovic L'Hours
As
BPF_F_MMAPABLEflag is now conditionnaly set (bymap_is_mmapable), it should not be toggled but disabled if not supported by kernel.Fixes 4fcac46c7e10 ("libbpf: only add BPF_F_MMAPABLE flag for data maps with global vars")Signed-off-by Ludovic L'Hours <[email protected]>
LGTM
Acked-by Jiri Olsa <[email protected]>
jirka
Quoted 20 lines
--- tools/lib/bpf/libbpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/lib/bpf/libbpf.c +1
-1@@ -7355,7 +7355,7 @@ static int bpf_object__sanitize_maps(struct bpf_object *obj)if (!bpf_map__is_internal (m))continue ;if (!kernel_supports (obj,FEAT_ARRAY_MMAP )) - m->def.map_flags ^=BPF_F_MMAPABLE ; + m->def.map_flags &= ~BPF_F_MMAPABLE ; }return 0 ;Signature · 1 line
2.25.1
This patch was applied to bpf/bpf-next.git (master) by Martin KaFai Lau <[email protected]>:
Hello:
This patch was applied to bpf/bpf-next.git (master) by Martin KaFai Lau <[email protected]>:
Quoted 8 lines · On Sun, 8 Jan 2023 19:20:18 +0100 you wrote:
As
BPF_F_MMAPABLEflag is now conditionnaly set (bymap_is_mmapable), it should not be toggled but disabled if not supported by kernel.Fixes 4fcac46c7e10 ("libbpf: only add BPF_F_MMAPABLE flag for data maps with global vars")Signed-off-by Ludovic L'Hours <[email protected]>--- tools/lib/bpf/libbpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Here is the summary with links:
- libbpf: Fix map creation flags sanitization
https://git.kernel.org/bpf/bpf-next/c/6920b08661e3
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html