[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191123205628.828920-1-andriin@fb.com>
Date: Sat, 23 Nov 2019 12:56:28 -0800
From: Andrii Nakryiko <andriin@...com>
To: <bpf@...r.kernel.org>, <netdev@...r.kernel.org>, <ast@...com>,
<daniel@...earbox.net>
CC: <andrii.nakryiko@...il.com>, <kernel-team@...com>,
Andrii Nakryiko <andriin@...com>,
Johannes Weiner <hannes@...xchg.org>
Subject: [PATCH bpf-next] bpf: fail mmap without CONFIG_MMU
mmap() support for BPF array depends on vmalloc_user_node_flags, which is
available only on CONFIG_MMU configurations. Fail mmap-able allocations if no
CONFIG_MMU is set.
Cc: Johannes Weiner <hannes@...xchg.org>
Reported-by: kbuild test robot <lkp@...el.com>
Signed-off-by: Andrii Nakryiko <andriin@...com>
---
kernel/bpf/syscall.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index bb002f15b32a..242a06fbdf18 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -156,8 +156,12 @@ static void *__bpf_map_area_alloc(u64 size, int numa_node, bool mmapable)
}
if (mmapable) {
BUG_ON(!PAGE_ALIGNED(size));
+#ifndef CONFIG_MMU
+ return NULL;
+#else
return vmalloc_user_node_flags(size, numa_node, GFP_KERNEL |
__GFP_RETRY_MAYFAIL | flags);
+#endif
}
return __vmalloc_node_flags_caller(size, numa_node,
GFP_KERNEL | __GFP_RETRY_MAYFAIL |
--
2.17.1
Powered by blists - more mailing lists