bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Hubbard <jhubbard@nvidia.com>
To: Andrii Nakryiko <andriin@fb.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>,
	Song Liu <songliubraving@fb.com>,
	John Fastabend <john.fastabend@gmail.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Linux Next Mailing List <linux-next@vger.kernel.org>,
	<bpf@vger.kernel.org>, <netdev@vger.kernel.org>,
	<linux-mm@kvack.org>, LKML <linux-kernel@vger.kernel.org>,
	John Hubbard <jhubbard@nvidia.com>,
	kbuild test robot <lkp@intel.com>
Subject: [PATCH] bpf: fix a no-mmu build failure by providing a stub allocator
Date: Mon, 25 Nov 2019 15:41:03 -0800	[thread overview]
Message-ID: <20191125234103.1699950-2-jhubbard@nvidia.com> (raw)
In-Reply-To: <20191125234103.1699950-1-jhubbard@nvidia.com>

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


  reply	other threads:[~2019-11-25 23:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2019-11-25 23:43   ` [PATCH] " Daniel Borkmann
2019-11-25 23:45     ` John Hubbard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191125234103.1699950-2-jhubbard@nvidia.com \
    --to=jhubbard@nvidia.com \
    --cc=andriin@fb.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=hannes@cmpxchg.org \
    --cc=john.fastabend@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-next@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=songliubraving@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).