BPF Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 0/1] bpf: fix a no-mmu build failure by providing a stub allocator
@ 2019-11-25 23:41 John Hubbard
  2019-11-25 23:41 ` [PATCH] " John Hubbard
  0 siblings, 1 reply; 4+ messages in thread
From: John Hubbard @ 2019-11-25 23:41 UTC (permalink / raw)
  To: Andrii Nakryiko
  Cc: Daniel Borkmann, Song Liu, John Fastabend, Johannes Weiner,
	Linux Next Mailing List, bpf, netdev, linux-mm, LKML,
	John Hubbard

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(+)

-- 
2.24.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] bpf: fix a no-mmu build failure by providing a stub allocator
  2019-11-25 23:41 [PATCH 0/1] bpf: fix a no-mmu build failure by providing a stub allocator John Hubbard
@ 2019-11-25 23:41 ` " John Hubbard
  2019-11-25 23:43   ` Daniel Borkmann
  0 siblings, 1 reply; 4+ messages in thread
From: John Hubbard @ 2019-11-25 23:41 UTC (permalink / raw)
  To: Andrii Nakryiko
  Cc: Daniel Borkmann, Song Liu, John Fastabend, Johannes Weiner,
	Linux Next Mailing List, bpf, netdev, linux-mm, LKML,
	John Hubbard, kbuild test robot

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%lkp@intel.com

Fix the build by providing a stub function for __bpf_map_area_alloc().

Fixes: fc9702273e2e ("bpf: Add mmap() support for BPF_MAP_TYPE_ARRAY")
Reported-by: kbuild test robot <lkp@intel.com>
Cc: Andrii Nakryiko <andriin@fb.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Song Liu <songliubraving@fb.com>
Cc: John Fastabend <john.fastabend@gmail.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
---
 kernel/bpf/syscall.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index e3461ec59570..cb3e13ee4123 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -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)
 {
-- 
2.24.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] bpf: fix a no-mmu build failure by providing a stub allocator
  2019-11-25 23:41 ` [PATCH] " John Hubbard
@ 2019-11-25 23:43   ` Daniel Borkmann
  2019-11-25 23:45     ` John Hubbard
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Borkmann @ 2019-11-25 23:43 UTC (permalink / raw)
  To: John Hubbard, Andrii Nakryiko
  Cc: Song Liu, John Fastabend, Johannes Weiner,
	Linux Next Mailing List, bpf, netdev, linux-mm, LKML,
	kbuild test robot

On 11/26/19 12:41 AM, John Hubbard wrote:
> 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%lkp@intel.com
> 
> Fix the build by providing a stub function for __bpf_map_area_alloc().
> 
> Fixes: fc9702273e2e ("bpf: Add mmap() support for BPF_MAP_TYPE_ARRAY")
> Reported-by: kbuild test robot <lkp@intel.com>
> Cc: Andrii Nakryiko <andriin@fb.com>
> Cc: Daniel Borkmann <daniel@iogearbox.net>
> Cc: Song Liu <songliubraving@fb.com>
> Cc: John Fastabend <john.fastabend@gmail.com>
> Cc: Johannes Weiner <hannes@cmpxchg.org>
> Signed-off-by: John Hubbard <jhubbard@nvidia.com>

Thanks for the patch, already fixed via:

https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=ed81745a4c96841937f1da35c0eb66ac312e1480

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] bpf: fix a no-mmu build failure by providing a stub allocator
  2019-11-25 23:43   ` Daniel Borkmann
@ 2019-11-25 23:45     ` John Hubbard
  0 siblings, 0 replies; 4+ messages in thread
From: John Hubbard @ 2019-11-25 23:45 UTC (permalink / raw)
  To: Daniel Borkmann, Andrii Nakryiko
  Cc: Song Liu, John Fastabend, Johannes Weiner,
	Linux Next Mailing List, bpf, netdev, linux-mm, LKML,
	kbuild test robot

On 11/25/19 3:43 PM, Daniel Borkmann wrote:
> On 11/26/19 12:41 AM, John Hubbard wrote:
>> 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%lkp@intel.com
>>
>> Fix the build by providing a stub function for __bpf_map_area_alloc().
>>
>> Fixes: fc9702273e2e ("bpf: Add mmap() support for BPF_MAP_TYPE_ARRAY")
>> Reported-by: kbuild test robot <lkp@intel.com>
>> Cc: Andrii Nakryiko <andriin@fb.com>
>> Cc: Daniel Borkmann <daniel@iogearbox.net>
>> Cc: Song Liu <songliubraving@fb.com>
>> Cc: John Fastabend <john.fastabend@gmail.com>
>> Cc: Johannes Weiner <hannes@cmpxchg.org>
>> Signed-off-by: John Hubbard <jhubbard@nvidia.com>
> 
> Thanks for the patch, already fixed via:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=ed81745a4c96841937f1da35c0eb66ac312e1480

OK, good, that's a better fix, too. Appreciate the quick answers!


thanks,
-- 
John Hubbard
NVIDIA

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-25 23:41 [PATCH 0/1] bpf: fix a no-mmu build failure by providing a stub allocator John Hubbard
2019-11-25 23:41 ` [PATCH] " John Hubbard
2019-11-25 23:43   ` Daniel Borkmann
2019-11-25 23:45     ` John Hubbard

BPF Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/bpf/0 bpf/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 bpf bpf/ https://lore.kernel.org/bpf \
		bpf@vger.kernel.org
	public-inbox-index bpf

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.bpf


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git