Skip to content

Commit ab4dc30

Browse files
viktormalikAlexei Starovoitov
authored andcommitted
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]/ Signed-off-by: Viktor Malik <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent f01750a commit ab4dc30

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

kernel/bpf/arena.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <linux/bpf.h>
44
#include <linux/btf.h>
55
#include <linux/err.h>
6+
#include "linux/filter.h"
67
#include <linux/btf_ids.h>
78
#include <linux/vmalloc.h>
89
#include <linux/pagemap.h>
@@ -99,6 +100,9 @@ static struct bpf_map *arena_map_alloc(union bpf_attr *attr)
99100
u64 vm_range;
100101
int err = -ENOMEM;
101102

103+
if (!bpf_jit_supports_arena())
104+
return ERR_PTR(-EOPNOTSUPP);
105+
102106
if (attr->key_size || attr->value_size || attr->max_entries == 0 ||
103107
/* BPF_F_MMAPABLE must be set */
104108
!(attr->map_flags & BPF_F_MMAPABLE) ||

0 commit comments

Comments
 (0)