* [PATCH bpf-next] bpf: Do not alloc arena on unsupported arches
@ 2024-11-15 8:25 Viktor Malik
2024-11-15 16:20 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Viktor Malik @ 2024-11-15 8:25 UTC (permalink / raw)
To: bpf
Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Martin KaFai Lau, Eduard Zingerman, Song Liu, Yonghong Song,
John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
Viktor Malik
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/4afdcb50-13f2-4772-8db1-3fd02bd985b3@redhat.com/
Signed-off-by: Viktor Malik <vmalik@redhat.com>
---
kernel/bpf/arena.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/kernel/bpf/arena.c b/kernel/bpf/arena.c
index 3e1dfe349ced..945a5680f6a5 100644
--- a/kernel/bpf/arena.c
+++ b/kernel/bpf/arena.c
@@ -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) ||
--
2.47.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH bpf-next] bpf: Do not alloc arena on unsupported arches
2024-11-15 8:25 [PATCH bpf-next] bpf: Do not alloc arena on unsupported arches Viktor Malik
@ 2024-11-15 16:20 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-11-15 16:20 UTC (permalink / raw)
To: Viktor Malik
Cc: bpf, ast, daniel, andrii, martin.lau, eddyz87, song,
yonghong.song, john.fastabend, kpsingh, sdf, haoluo, jolsa
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:
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/4afdcb50-13f2-4772-8db1-3fd02bd985b3@redhat.com/
>
> Signed-off-by: Viktor Malik <vmalik@redhat.com>
>
> [...]
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!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-11-15 16:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-15 8:25 [PATCH bpf-next] bpf: Do not alloc arena on unsupported arches Viktor Malik
2024-11-15 16:20 ` 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