bpf: Do not alloc arena on unsupported arches
PATCH 1/1 bpf: Do not alloc arena on unsupported arches
Do not allocate BPF arena on arches that do not support it, instead return EOPNOTSUPP. This is useful to prevent bugs such as soft lockups while trying to free the arena which we have witnessed on ppc64le [1].
[1] https://lore.kernel.org/bpf/[email protected]/
--- kernel/bpf/arena.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/bpf/arena.c +4 -0
@@ -3,6 +3,7 @@#include <linux/bpf.h> #include <linux/btf.h> #include <linux/err.h> +#include "linux/filter.h" #include <linux/btf_ids.h> #include <linux/vmalloc.h> #include <linux/pagemap.h>
@@ -99,6 +100,9 @@ static struct bpf_map *arena_map_alloc(union bpf_attr *attr)u64 vm_range;int err = -ENOMEM ; +if (!bpf_jit_supports_arena ()) +return ERR_PTR (-EOPNOTSUPP ); + if (attr->key_size || attr->value_size || attr->max_entries == 0 || /* BPF_F_MMAPABLE must be set */ !(attr->map_flags & BPF_F_MMAPABLE) ||
Signature · 1 line
2.47.0
This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:
Hello:
This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:
Quoted 9 lines · On Fri, 15 Nov 2024 09:25:48 +0100 you wrote:
Do not allocate BPF arena on arches that do not support it, instead return EOPNOTSUPP. This is useful to prevent bugs such as soft lockups while trying to free the arena which we have witnessed on ppc64le [1].
[1] https://lore.kernel.org/bpf/[email protected]/
Signed-off-by Viktor Malik <[email protected]>[...]
Here is the summary with links:
- [bpf-next] bpf: Do not alloc arena on unsupported arches
https://git.kernel.org/bpf/bpf-next/c/ab4dc30c5322
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html