All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bpf: Move BPF_MAP_TYPE for INODE_STORAGE and TASK_STORAGE outside of CONFIG_NET
@ 2021-10-21 18:46 Tejun Heo
  2021-10-26 19:19 ` Martin KaFai Lau
  0 siblings, 1 reply; 3+ messages in thread
From: Tejun Heo @ 2021-10-21 18:46 UTC (permalink / raw)
  To: Alexei Starovoitov, Andrii Nakryiko
  Cc: bpf, netdev, kernel-team, linux-kernel

bpf_types.h has BPF_MAP_TYPE_INODE_STORAGE and BPF_MAP_TYPE_TASK_STORAGE
declared inside #ifdef CONFIG_NET although they are built regardless of
CONFIG_NET. So, when CONFIG_BPF_SYSCALL && !CONFIG_NET, they are built
without the declarations leading to spurious build failures and not
registered to bpf_map_types making them unavailable.

Fix it by moving the BPF_MAP_TYPE for the two map types outside of
CONFIG_NET.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: kernel test robot <lkp@intel.com>
---
 include/linux/bpf_types.h |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/linux/bpf_types.h b/include/linux/bpf_types.h
index 9c81724e4b985..bbe1eefa4c8a9 100644
--- a/include/linux/bpf_types.h
+++ b/include/linux/bpf_types.h
@@ -101,14 +101,14 @@ BPF_MAP_TYPE(BPF_MAP_TYPE_STACK_TRACE, stack_trace_map_ops)
 #endif
 BPF_MAP_TYPE(BPF_MAP_TYPE_ARRAY_OF_MAPS, array_of_maps_map_ops)
 BPF_MAP_TYPE(BPF_MAP_TYPE_HASH_OF_MAPS, htab_of_maps_map_ops)
-#ifdef CONFIG_NET
-BPF_MAP_TYPE(BPF_MAP_TYPE_DEVMAP, dev_map_ops)
-BPF_MAP_TYPE(BPF_MAP_TYPE_DEVMAP_HASH, dev_map_hash_ops)
-BPF_MAP_TYPE(BPF_MAP_TYPE_SK_STORAGE, sk_storage_map_ops)
 #ifdef CONFIG_BPF_LSM
 BPF_MAP_TYPE(BPF_MAP_TYPE_INODE_STORAGE, inode_storage_map_ops)
 #endif
 BPF_MAP_TYPE(BPF_MAP_TYPE_TASK_STORAGE, task_storage_map_ops)
+#ifdef CONFIG_NET
+BPF_MAP_TYPE(BPF_MAP_TYPE_DEVMAP, dev_map_ops)
+BPF_MAP_TYPE(BPF_MAP_TYPE_DEVMAP_HASH, dev_map_hash_ops)
+BPF_MAP_TYPE(BPF_MAP_TYPE_SK_STORAGE, sk_storage_map_ops)
 BPF_MAP_TYPE(BPF_MAP_TYPE_CPUMAP, cpu_map_ops)
 #if defined(CONFIG_XDP_SOCKETS)
 BPF_MAP_TYPE(BPF_MAP_TYPE_XSKMAP, xsk_map_ops)

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

* Re: [PATCH] bpf: Move BPF_MAP_TYPE for INODE_STORAGE and TASK_STORAGE outside of CONFIG_NET
  2021-10-21 18:46 [PATCH] bpf: Move BPF_MAP_TYPE for INODE_STORAGE and TASK_STORAGE outside of CONFIG_NET Tejun Heo
@ 2021-10-26 19:19 ` Martin KaFai Lau
  2021-10-26 19:25   ` Martin KaFai Lau
  0 siblings, 1 reply; 3+ messages in thread
From: Martin KaFai Lau @ 2021-10-26 19:19 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Alexei Starovoitov, Andrii Nakryiko, bpf, netdev, kernel-team,
	linux-kernel

On Thu, Oct 21, 2021 at 08:46:10AM -1000, Tejun Heo wrote:
> bpf_types.h has BPF_MAP_TYPE_INODE_STORAGE and BPF_MAP_TYPE_TASK_STORAGE
> declared inside #ifdef CONFIG_NET although they are built regardless of
> CONFIG_NET. So, when CONFIG_BPF_SYSCALL && !CONFIG_NET, they are built
> without the declarations leading to spurious build failures and not
> registered to bpf_map_types making them unavailable.
> 
> Fix it by moving the BPF_MAP_TYPE for the two map types outside of
> CONFIG_NET.
Acked-by: Martin KaFai Lau <kafai@fb.com>

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

* Re: [PATCH] bpf: Move BPF_MAP_TYPE for INODE_STORAGE and TASK_STORAGE outside of CONFIG_NET
  2021-10-26 19:19 ` Martin KaFai Lau
@ 2021-10-26 19:25   ` Martin KaFai Lau
  0 siblings, 0 replies; 3+ messages in thread
From: Martin KaFai Lau @ 2021-10-26 19:25 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Alexei Starovoitov, Andrii Nakryiko, bpf, netdev, kernel-team,
	linux-kernel

On Tue, Oct 26, 2021 at 12:19:36PM -0700, Martin KaFai Lau wrote:
> On Thu, Oct 21, 2021 at 08:46:10AM -1000, Tejun Heo wrote:
> > bpf_types.h has BPF_MAP_TYPE_INODE_STORAGE and BPF_MAP_TYPE_TASK_STORAGE
> > declared inside #ifdef CONFIG_NET although they are built regardless of
> > CONFIG_NET. So, when CONFIG_BPF_SYSCALL && !CONFIG_NET, they are built
> > without the declarations leading to spurious build failures and not
> > registered to bpf_map_types making them unavailable.
> > 
> > Fix it by moving the BPF_MAP_TYPE for the two map types outside of
> > CONFIG_NET.
> Acked-by: Martin KaFai Lau <kafai@fb.com>

btw, this should be the fix tag that has both task and inode storage.
Fixes: a10787e6d58c ("bpf: Enable task local storage for tracing programs")

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

end of thread, other threads:[~2021-10-26 19:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-21 18:46 [PATCH] bpf: Move BPF_MAP_TYPE for INODE_STORAGE and TASK_STORAGE outside of CONFIG_NET Tejun Heo
2021-10-26 19:19 ` Martin KaFai Lau
2021-10-26 19:25   ` Martin KaFai Lau

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.