bpf: Move BPF_MAP_TYPE for INODE_STORAGE and TASK_STORAGE outside of CONFIG_NET
Subsystems (4)
PATCH 1/1 bpf: Move BPF_MAP_TYPE for INODE_STORAGE and TASK_STORAGE outside of CONFIG_NET
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.
--- include/linux/bpf_types.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
include/linux/bpf_types.h +4 -4
@@ -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)
Quoted 8 lines · Tejun Heo
bpf_types.hhasBPF_MAP_TYPE_INODE_STORAGEandBPF_MAP_TYPE_TASK_STORAGEdeclared inside #ifdefCONFIG_NETalthough they are built regardless ofCONFIG_NET. So, whenCONFIG_BPF_SYSCALL&& !CONFIG_NET, they are built without the declarations leading to spurious build failures and not registered tobpf_map_typesmaking them unavailable.Fix it by moving the
BPF_MAP_TYPEfor the two map types outside ofCONFIG_NET.
Quoted 10 lines · Martin KaFai Lau
Quoted 8 lines · Tejun Heo
bpf_types.hhasBPF_MAP_TYPE_INODE_STORAGEandBPF_MAP_TYPE_TASK_STORAGEdeclared inside #ifdefCONFIG_NETalthough they are built regardless ofCONFIG_NET. So, whenCONFIG_BPF_SYSCALL&& !CONFIG_NET, they are built without the declarations leading to spurious build failures and not registered tobpf_map_typesmaking them unavailable.Fix it by moving the
BPF_MAP_TYPEfor the two map types outside ofCONFIG_NET.Acked-by Martin KaFai Lau <[email protected]>
btw, this should be the fix tag that has both task and inode storage.