bpf: fix a no-mmu build failure by providing a stub allocator
Subsystems (6)
cover bpf: fix a no-mmu build failure by providing a stub allocator
Hi,
I ran into this on today's linux-next: commit c165016bac27 ("Add linux-next specific files for 20191125"). The kbuild robot reported a build failure on my larger (unrelated) patchset, but there were actually two build failures, and this patch here fixes the second failure.
John Hubbard (1):
bpf: fix a no-mmu build failure by providing a stub allocator
kernel/bpf/syscall.c | 7 +++++++ 1 file changed, 7 insertions(+)
Signature · 1 line
2.24.0
PATCH 1/1 bpf: fix a no-mmu build failure by providing a stub allocator
Commit fc9702273e2e ("bpf: Add mmap() support for BPF_MAP_TYPE_ARRAY") added code that calls vmalloc_user_node_flags() and therefore requires mm/vmalloc.c. However, that file is not built for the !CONFIG_MMU case. This leads to a build failure when using ARM with the config provided by at least one particular kbuild test robot report [1].
[1] https://lore/kernel.org/r/201911251639.UWS3hE3Y%[email protected]
Fix the build by providing a stub function for __bpf_map_area_alloc().
--- kernel/bpf/syscall.c | 7 +++++++ 1 file changed, 7 insertions(+)
kernel/bpf/syscall.c +7 -0
@@ -128,6 +128,7 @@ static struct bpf_map *find_and_alloc_map(union bpf_attr *attr)return map; } +#ifdef CONFIG_MMU static void *__bpf_map_area_alloc (u64 size,int numa_node,bool mmapable) {/* We really just want to fail instead of triggering OOM killer
@@ -162,6 +163,12 @@ static void *__bpf_map_area_alloc(u64 size, int numa_node, bool mmapable)GFP_KERNEL | __GFP_RETRY_MAYFAIL | flags, __builtin_return_address(0)); } +#else /* CONFIG_MMU */ +static void *__bpf_map_area_alloc (u64 size,int numa_node,bool mmapable) +{ +return NULL ; +} +#endif /* !CONFIG_MMU */ void *bpf_map_area_alloc (u64 size,int numa_node) {
Signature · 1 line
2.24.0
Daniel Borkmann
maintainerQuoted 10 lines · John Hubbard
Commit
fc9702273e2e("bpf: Addmmap()support forBPF_MAP_TYPE_ARRAY") added code that callsvmalloc_user_node_flags()and therefore requiresmm/vmalloc.c. However, that file is not built for the !CONFIG_MMU case. This leads to a build failure when using ARM with the config provided by at least one particular kbuild test robot report [1].[1] https://lore/kernel.org/r/201911251639.UWS3hE3Y%[email protected]
Fix the build by providing a stub function for
__bpf_map_area_alloc().
Quoted 8 lines
Fixes fc9702273e2e ("bpf: Add mmap() support for BPF_MAP_TYPE_ARRAY")Reported-by kbuild test robot <[email protected]>Cc Andrii Nakryiko <[email protected]>Cc Daniel Borkmann <[email protected]>Cc Song Liu <[email protected]>Cc John Fastabend <[email protected]>Cc Johannes Weiner <[email protected]>Signed-off-by John Hubbard <[email protected]>
Thanks for the patch, already fixed via:
Quoted 20 lines · Daniel Borkmann
Quoted 10 lines · John Hubbard
Commit
fc9702273e2e("bpf: Addmmap()support forBPF_MAP_TYPE_ARRAY") added code that callsvmalloc_user_node_flags()and therefore requiresmm/vmalloc.c. However, that file is not built for the !CONFIG_MMU case. This leads to a build failure when using ARM with the config provided by at least one particular kbuild test robot report [1].[1] https://lore/kernel.org/r/201911251639.UWS3hE3Y%[email protected]
Fix the build by providing a stub function for
__bpf_map_area_alloc().Quoted 8 lines
Fixes fc9702273e2e ("bpf: Add mmap() support for BPF_MAP_TYPE_ARRAY")Reported-by kbuild test robot <[email protected]>Cc Andrii Nakryiko <[email protected]>Cc Daniel Borkmann <[email protected]>Cc Song Liu <[email protected]>Cc John Fastabend <[email protected]>Cc Johannes Weiner <[email protected]>Signed-off-by John Hubbard <[email protected]>
Quoted 3 lines
Thanks for the patch, already fixed via:
OK, good, that's a better fix, too. Appreciate the quick answers!
thanks,
Signature · 2 lines
John Hubbard NVIDIA