bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libbpf: Fix map creation flags sanitization
@ 2023-01-08 18:20 Ludovic L'Hours
  2023-01-09  8:53 ` Jiri Olsa
  2023-01-11  2:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Ludovic L'Hours @ 2023-01-08 18:20 UTC (permalink / raw)
  To: andrii; +Cc: bpf, Ludovic L'Hours

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 <ludovic.lhours@gmail.com>
---
 tools/lib/bpf/libbpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index a5c67a3c93c5..f8dfee32c2bc 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -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;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] libbpf: Fix map creation flags sanitization
  2023-01-08 18:20 [PATCH] libbpf: Fix map creation flags sanitization Ludovic L'Hours
@ 2023-01-09  8:53 ` Jiri Olsa
  2023-01-11  2:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Jiri Olsa @ 2023-01-09  8:53 UTC (permalink / raw)
  To: Ludovic L'Hours; +Cc: andrii, bpf

On Sun, Jan 08, 2023 at 07:20:18PM +0100, Ludovic L'Hours wrote:
> 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 <ludovic.lhours@gmail.com>

LGTM

Acked-by: Jiri Olsa <jolsa@kernel.org>

jirka

> ---
>  tools/lib/bpf/libbpf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index a5c67a3c93c5..f8dfee32c2bc 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -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;
> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] libbpf: Fix map creation flags sanitization
  2023-01-08 18:20 [PATCH] libbpf: Fix map creation flags sanitization Ludovic L'Hours
  2023-01-09  8:53 ` Jiri Olsa
@ 2023-01-11  2:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-01-11  2:10 UTC (permalink / raw)
  To: Ludovic L'Hours; +Cc: andrii, bpf

Hello:

This patch was applied to bpf/bpf-next.git (master)
by Martin KaFai Lau <martin.lau@kernel.org>:

On Sun,  8 Jan 2023 19:20:18 +0100 you wrote:
> 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 <ludovic.lhours@gmail.com>
> ---
>  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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-11  2:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-08 18:20 [PATCH] libbpf: Fix map creation flags sanitization Ludovic L'Hours
2023-01-09  8:53 ` Jiri Olsa
2023-01-11  2:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).