tree: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master head: 3c3bd542ffbb2ac09631313ede46ae66660ae550 commit: 7d08c2c9117113fee118487425ed55efa50cbfa9 [972/996] bpf: Refactor BPF_PROG_RUN_ARRAY family of macros into functions config: i386-randconfig-r021-20210816 (attached as .config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 2c6448cdc2f68f8c28fd0bd9404182b81306e6e6) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=7d08c2c9117113fee118487425ed55efa50cbfa9 git remote add bpf-next https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git git fetch --no-tags bpf-next master git checkout 7d08c2c9117113fee118487425ed55efa50cbfa9 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All warnings (new ones prefixed by >>): include/linux/u64_stats_sync.h:154:19: warning: unused parameter 'flags' [-Wunused-parameter] unsigned long flags) ^ include/linux/u64_stats_sync.h:162:81: warning: unused parameter 'syncp' [-Wunused-parameter] static inline unsigned int __u64_stats_fetch_begin(const struct u64_stats_sync *syncp) ^ include/linux/u64_stats_sync.h:179:73: warning: unused parameter 'syncp' [-Wunused-parameter] static inline bool __u64_stats_fetch_retry(const struct u64_stats_sync *syncp, ^ include/linux/u64_stats_sync.h:180:20: warning: unused parameter 'start' [-Wunused-parameter] unsigned int start) ^ In file included from drivers/gpu/drm/i915/i915_drv.c:39: In file included from include/linux/vga_switcheroo.h:34: In file included from include/linux/fb.h:6: In file included from include/uapi/linux/fb.h:6: In file included from include/linux/i2c.h:18: In file included from include/linux/regulator/consumer.h:35: In file included from include/linux/suspend.h:5: In file included from include/linux/swap.h:9: In file included from include/linux/memcontrol.h:13: In file included from include/linux/cgroup.h:28: In file included from include/linux/cgroup-defs.h:22: In file included from include/linux/bpf-cgroup.h:5: In file included from include/linux/bpf.h:22: include/linux/sched/mm.h:103:59: warning: unused parameter 'mm' [-Wunused-parameter] static inline void mm_update_next_owner(struct mm_struct *mm) ^ include/linux/sched/mm.h:321:37: warning: unused parameter 'memcg' [-Wunused-parameter] set_active_memcg(struct mem_cgroup *memcg) ^ In file included from drivers/gpu/drm/i915/i915_drv.c:39: In file included from include/linux/vga_switcheroo.h:34: In file included from include/linux/fb.h:6: In file included from include/uapi/linux/fb.h:6: In file included from include/linux/i2c.h:18: In file included from include/linux/regulator/consumer.h:35: In file included from include/linux/suspend.h:5: In file included from include/linux/swap.h:9: In file included from include/linux/memcontrol.h:13: In file included from include/linux/cgroup.h:28: In file included from include/linux/cgroup-defs.h:22: In file included from include/linux/bpf-cgroup.h:5: include/linux/bpf.h:770:61: warning: unused parameter 'prog' [-Wunused-parameter] static inline int bpf_trampoline_link_prog(struct bpf_prog *prog, ^ include/linux/bpf.h:771:32: warning: unused parameter 'tr' [-Wunused-parameter] struct bpf_trampoline *tr) ^ include/linux/bpf.h:775:63: warning: unused parameter 'prog' [-Wunused-parameter] static inline int bpf_trampoline_unlink_prog(struct bpf_prog *prog, ^ include/linux/bpf.h:776:34: warning: unused parameter 'tr' [-Wunused-parameter] struct bpf_trampoline *tr) ^ include/linux/bpf.h:780:61: warning: unused parameter 'key' [-Wunused-parameter] static inline struct bpf_trampoline *bpf_trampoline_get(u64 key, ^ include/linux/bpf.h:781:39: warning: unused parameter 'tgt_info' [-Wunused-parameter] struct bpf_attach_target_info *tgt_info) ^ include/linux/bpf.h:785:62: warning: unused parameter 'tr' [-Wunused-parameter] static inline void bpf_trampoline_put(struct bpf_trampoline *tr) {} ^ include/linux/bpf.h:790:70: warning: unused parameter 'd' [-Wunused-parameter] static inline void bpf_dispatcher_change_prog(struct bpf_dispatcher *d, ^ include/linux/bpf.h:791:29: warning: unused parameter 'from' [-Wunused-parameter] struct bpf_prog *from, ^ include/linux/bpf.h:792:29: warning: unused parameter 'to' [-Wunused-parameter] struct bpf_prog *to) {} ^ include/linux/bpf.h:793:55: warning: unused parameter 'address' [-Wunused-parameter] static inline bool is_bpf_image_address(unsigned long address) ^ include/linux/bpf.h:1012:68: warning: unused parameter 'type_id' [-Wunused-parameter] static inline const struct bpf_struct_ops *bpf_struct_ops_find(u32 type_id) ^ include/linux/bpf.h:1016:52: warning: unused parameter 'btf' [-Wunused-parameter] static inline void bpf_struct_ops_init(struct btf *btf, ^ include/linux/bpf.h:1017:37: warning: unused parameter 'log' [-Wunused-parameter] struct bpf_verifier_log *log) ^ include/linux/bpf.h:1020:51: warning: unused parameter 'data' [-Wunused-parameter] static inline bool bpf_try_module_get(const void *data, struct module *owner) ^ include/linux/bpf.h:1024:47: warning: unused parameter 'data' [-Wunused-parameter] static inline void bpf_module_put(const void *data, struct module *owner) ^ include/linux/bpf.h:1028:70: warning: unused parameter 'map' [-Wunused-parameter] static inline int bpf_struct_ops_map_sys_lookup_elem(struct bpf_map *map, ^ include/linux/bpf.h:1029:18: warning: unused parameter 'key' [-Wunused-parameter] void *key, ^ include/linux/bpf.h:1030:18: warning: unused parameter 'value' [-Wunused-parameter] void *value) ^ >> include/linux/bpf.h:1152:71: warning: unused parameter 'new_ctx' [-Wunused-parameter] static inline struct bpf_run_ctx *bpf_set_run_ctx(struct bpf_run_ctx *new_ctx) ^ >> include/linux/bpf.h:1163:58: warning: unused parameter 'old_ctx' [-Wunused-parameter] static inline void bpf_reset_run_ctx(struct bpf_run_ctx *old_ctx) ^ include/linux/bpf.h:1663:49: warning: unused parameter 'ufd' [-Wunused-parameter] static inline struct bpf_prog *bpf_prog_get(u32 ufd) ^ include/linux/bpf.h:1668:58: warning: unused parameter 'ufd' [-Wunused-parameter] static inline struct bpf_prog *bpf_prog_get_type_dev(u32 ufd, ^ include/linux/bpf.h:1669:31: warning: unused parameter 'type' [-Wunused-parameter] enum bpf_prog_type type, ^ include/linux/bpf.h:1670:17: warning: unused parameter 'attach_drv' [-Wunused-parameter] bool attach_drv) ^ include/linux/bpf.h:1675:50: warning: unused parameter 'prog' [-Wunused-parameter] static inline void bpf_prog_add(struct bpf_prog *prog, int i) ^ include/linux/bpf.h:1675:60: warning: unused parameter 'i' [-Wunused-parameter] static inline void bpf_prog_add(struct bpf_prog *prog, int i) ^ include/linux/bpf.h:1679:50: warning: unused parameter 'prog' [-Wunused-parameter] static inline void bpf_prog_sub(struct bpf_prog *prog, int i) ^ include/linux/bpf.h:1679:60: warning: unused parameter 'i' [-Wunused-parameter] static inline void bpf_prog_sub(struct bpf_prog *prog, int i) ^ include/linux/bpf.h:1683:50: warning: unused parameter 'prog' [-Wunused-parameter] static inline void bpf_prog_put(struct bpf_prog *prog) ^ include/linux/bpf.h:1687:50: warning: unused parameter 'prog' [-Wunused-parameter] static inline void bpf_prog_inc(struct bpf_prog *prog) ^ include/linux/bpf.h:1692:40: warning: unused parameter 'prog' [-Wunused-parameter] bpf_prog_inc_not_zero(struct bpf_prog *prog) ^ include/linux/bpf.h:1697:51: warning: unused parameter 'link' [-Wunused-parameter] static inline void bpf_link_init(struct bpf_link *link, enum bpf_link_type type, ^ include/linux/bpf.h:1697:76: warning: unused parameter 'type' [-Wunused-parameter] static inline void bpf_link_init(struct bpf_link *link, enum bpf_link_type type, ^ include/linux/bpf.h:1698:33: warning: unused parameter 'ops' [-Wunused-parameter] const struct bpf_link_ops *ops, ^ include/linux/bpf.h:1699:23: warning: unused parameter 'prog' [-Wunused-parameter] struct bpf_prog *prog) ^ include/linux/bpf.h:1703:51: warning: unused parameter 'link' [-Wunused-parameter] static inline int bpf_link_prime(struct bpf_link *link, ^ include/linux/bpf.h:1704:30: warning: unused parameter 'primer' [-Wunused-parameter] struct bpf_link_primer *primer) ^ include/linux/bpf.h:1709:59: warning: unused parameter 'primer' [-Wunused-parameter] static inline int bpf_link_settle(struct bpf_link_primer *primer) ^ include/linux/bpf.h:1714:61: warning: unused parameter 'primer' [-Wunused-parameter] static inline void bpf_link_cleanup(struct bpf_link_primer *primer) ^ include/linux/bpf.h:1718:50: warning: unused parameter 'link' [-Wunused-parameter] static inline void bpf_link_inc(struct bpf_link *link) ^ include/linux/bpf.h:1722:50: warning: unused parameter 'link' [-Wunused-parameter] static inline void bpf_link_put(struct bpf_link *link) ^ include/linux/bpf.h:1726:55: warning: unused parameter 'pathname' [-Wunused-parameter] static inline int bpf_obj_get_user(const char __user *pathname, int flags) ^ include/linux/bpf.h:1726:69: warning: unused parameter 'flags' [-Wunused-parameter] static inline int bpf_obj_get_user(const char __user *pathname, int flags) ^ include/linux/bpf.h:1731:58: warning: unused parameter 'map' [-Wunused-parameter] static inline bool dev_map_can_have_prog(struct bpf_map *map) ^ include/linux/bpf.h:1745:40: warning: unused parameter 'dev' [-Wunused-parameter] int dev_xdp_enqueue(struct net_device *dev, struct xdp_buff *xdp, ^ include/linux/bpf.h:1745:62: warning: unused parameter 'xdp' [-Wunused-parameter] int dev_xdp_enqueue(struct net_device *dev, struct xdp_buff *xdp, ^ include/linux/bpf.h:1746:26: warning: unused parameter 'dev_rx' [-Wunused-parameter] struct net_device *dev_rx) ^ include/linux/bpf.h:1752:45: warning: unused parameter 'dst' [-Wunused-parameter] int dev_map_enqueue(struct bpf_dtab_netdev *dst, struct xdp_buff *xdp, ^ include/linux/bpf.h:1752:67: warning: unused parameter 'xdp' [-Wunused-parameter] int dev_map_enqueue(struct bpf_dtab_netdev *dst, struct xdp_buff *xdp, ^ include/linux/bpf.h:1753:26: warning: unused parameter 'dev_rx' [-Wunused-parameter] struct net_device *dev_rx) ^ include/linux/bpf.h:1759:44: warning: unused parameter 'xdp' [-Wunused-parameter] int dev_map_enqueue_multi(struct xdp_buff *xdp, struct net_device *dev_rx, ^ include/linux/bpf.h:1759:68: warning: unused parameter 'dev_rx' [-Wunused-parameter] int dev_map_enqueue_multi(struct xdp_buff *xdp, struct net_device *dev_rx, ^ include/linux/bpf.h:1760:22: warning: unused parameter 'map' [-Wunused-parameter] struct bpf_map *map, bool exclude_ingress) -- ^ include/linux/u64_stats_sync.h:153:56: warning: unused parameter 'syncp' [-Wunused-parameter] u64_stats_update_end_irqrestore(struct u64_stats_sync *syncp, ^ include/linux/u64_stats_sync.h:154:19: warning: unused parameter 'flags' [-Wunused-parameter] unsigned long flags) ^ include/linux/u64_stats_sync.h:162:81: warning: unused parameter 'syncp' [-Wunused-parameter] static inline unsigned int __u64_stats_fetch_begin(const struct u64_stats_sync *syncp) ^ include/linux/u64_stats_sync.h:179:73: warning: unused parameter 'syncp' [-Wunused-parameter] static inline bool __u64_stats_fetch_retry(const struct u64_stats_sync *syncp, ^ include/linux/u64_stats_sync.h:180:20: warning: unused parameter 'start' [-Wunused-parameter] unsigned int start) ^ In file included from drivers/gpu/drm/i915/i915_config.c:6: In file included from drivers/gpu/drm/i915/i915_drv.h:39: In file included from include/linux/i2c.h:18: In file included from include/linux/regulator/consumer.h:35: In file included from include/linux/suspend.h:5: In file included from include/linux/swap.h:9: In file included from include/linux/memcontrol.h:13: In file included from include/linux/cgroup.h:28: In file included from include/linux/cgroup-defs.h:22: In file included from include/linux/bpf-cgroup.h:5: In file included from include/linux/bpf.h:22: include/linux/sched/mm.h:103:59: warning: unused parameter 'mm' [-Wunused-parameter] static inline void mm_update_next_owner(struct mm_struct *mm) ^ include/linux/sched/mm.h:321:37: warning: unused parameter 'memcg' [-Wunused-parameter] set_active_memcg(struct mem_cgroup *memcg) ^ In file included from drivers/gpu/drm/i915/i915_config.c:6: In file included from drivers/gpu/drm/i915/i915_drv.h:39: In file included from include/linux/i2c.h:18: In file included from include/linux/regulator/consumer.h:35: In file included from include/linux/suspend.h:5: In file included from include/linux/swap.h:9: In file included from include/linux/memcontrol.h:13: In file included from include/linux/cgroup.h:28: In file included from include/linux/cgroup-defs.h:22: In file included from include/linux/bpf-cgroup.h:5: include/linux/bpf.h:770:61: warning: unused parameter 'prog' [-Wunused-parameter] static inline int bpf_trampoline_link_prog(struct bpf_prog *prog, ^ include/linux/bpf.h:771:32: warning: unused parameter 'tr' [-Wunused-parameter] struct bpf_trampoline *tr) ^ include/linux/bpf.h:775:63: warning: unused parameter 'prog' [-Wunused-parameter] static inline int bpf_trampoline_unlink_prog(struct bpf_prog *prog, ^ include/linux/bpf.h:776:34: warning: unused parameter 'tr' [-Wunused-parameter] struct bpf_trampoline *tr) ^ include/linux/bpf.h:780:61: warning: unused parameter 'key' [-Wunused-parameter] static inline struct bpf_trampoline *bpf_trampoline_get(u64 key, ^ include/linux/bpf.h:781:39: warning: unused parameter 'tgt_info' [-Wunused-parameter] struct bpf_attach_target_info *tgt_info) ^ include/linux/bpf.h:785:62: warning: unused parameter 'tr' [-Wunused-parameter] static inline void bpf_trampoline_put(struct bpf_trampoline *tr) {} ^ include/linux/bpf.h:790:70: warning: unused parameter 'd' [-Wunused-parameter] static inline void bpf_dispatcher_change_prog(struct bpf_dispatcher *d, ^ include/linux/bpf.h:791:29: warning: unused parameter 'from' [-Wunused-parameter] struct bpf_prog *from, ^ include/linux/bpf.h:792:29: warning: unused parameter 'to' [-Wunused-parameter] struct bpf_prog *to) {} ^ include/linux/bpf.h:793:55: warning: unused parameter 'address' [-Wunused-parameter] static inline bool is_bpf_image_address(unsigned long address) ^ include/linux/bpf.h:1012:68: warning: unused parameter 'type_id' [-Wunused-parameter] static inline const struct bpf_struct_ops *bpf_struct_ops_find(u32 type_id) ^ include/linux/bpf.h:1016:52: warning: unused parameter 'btf' [-Wunused-parameter] static inline void bpf_struct_ops_init(struct btf *btf, ^ include/linux/bpf.h:1017:37: warning: unused parameter 'log' [-Wunused-parameter] struct bpf_verifier_log *log) ^ include/linux/bpf.h:1020:51: warning: unused parameter 'data' [-Wunused-parameter] static inline bool bpf_try_module_get(const void *data, struct module *owner) ^ include/linux/bpf.h:1024:47: warning: unused parameter 'data' [-Wunused-parameter] static inline void bpf_module_put(const void *data, struct module *owner) ^ include/linux/bpf.h:1028:70: warning: unused parameter 'map' [-Wunused-parameter] static inline int bpf_struct_ops_map_sys_lookup_elem(struct bpf_map *map, ^ include/linux/bpf.h:1029:18: warning: unused parameter 'key' [-Wunused-parameter] void *key, ^ include/linux/bpf.h:1030:18: warning: unused parameter 'value' [-Wunused-parameter] void *value) ^ >> include/linux/bpf.h:1152:71: warning: unused parameter 'new_ctx' [-Wunused-parameter] static inline struct bpf_run_ctx *bpf_set_run_ctx(struct bpf_run_ctx *new_ctx) ^ >> include/linux/bpf.h:1163:58: warning: unused parameter 'old_ctx' [-Wunused-parameter] static inline void bpf_reset_run_ctx(struct bpf_run_ctx *old_ctx) ^ include/linux/bpf.h:1663:49: warning: unused parameter 'ufd' [-Wunused-parameter] static inline struct bpf_prog *bpf_prog_get(u32 ufd) ^ include/linux/bpf.h:1668:58: warning: unused parameter 'ufd' [-Wunused-parameter] static inline struct bpf_prog *bpf_prog_get_type_dev(u32 ufd, ^ include/linux/bpf.h:1669:31: warning: unused parameter 'type' [-Wunused-parameter] enum bpf_prog_type type, ^ include/linux/bpf.h:1670:17: warning: unused parameter 'attach_drv' [-Wunused-parameter] bool attach_drv) ^ include/linux/bpf.h:1675:50: warning: unused parameter 'prog' [-Wunused-parameter] static inline void bpf_prog_add(struct bpf_prog *prog, int i) ^ include/linux/bpf.h:1675:60: warning: unused parameter 'i' [-Wunused-parameter] static inline void bpf_prog_add(struct bpf_prog *prog, int i) ^ include/linux/bpf.h:1679:50: warning: unused parameter 'prog' [-Wunused-parameter] static inline void bpf_prog_sub(struct bpf_prog *prog, int i) ^ include/linux/bpf.h:1679:60: warning: unused parameter 'i' [-Wunused-parameter] static inline void bpf_prog_sub(struct bpf_prog *prog, int i) ^ include/linux/bpf.h:1683:50: warning: unused parameter 'prog' [-Wunused-parameter] static inline void bpf_prog_put(struct bpf_prog *prog) ^ include/linux/bpf.h:1687:50: warning: unused parameter 'prog' [-Wunused-parameter] static inline void bpf_prog_inc(struct bpf_prog *prog) ^ include/linux/bpf.h:1692:40: warning: unused parameter 'prog' [-Wunused-parameter] bpf_prog_inc_not_zero(struct bpf_prog *prog) ^ include/linux/bpf.h:1697:51: warning: unused parameter 'link' [-Wunused-parameter] static inline void bpf_link_init(struct bpf_link *link, enum bpf_link_type type, ^ include/linux/bpf.h:1697:76: warning: unused parameter 'type' [-Wunused-parameter] static inline void bpf_link_init(struct bpf_link *link, enum bpf_link_type type, ^ include/linux/bpf.h:1698:33: warning: unused parameter 'ops' [-Wunused-parameter] const struct bpf_link_ops *ops, ^ include/linux/bpf.h:1699:23: warning: unused parameter 'prog' [-Wunused-parameter] struct bpf_prog *prog) ^ include/linux/bpf.h:1703:51: warning: unused parameter 'link' [-Wunused-parameter] static inline int bpf_link_prime(struct bpf_link *link, ^ include/linux/bpf.h:1704:30: warning: unused parameter 'primer' [-Wunused-parameter] struct bpf_link_primer *primer) ^ include/linux/bpf.h:1709:59: warning: unused parameter 'primer' [-Wunused-parameter] static inline int bpf_link_settle(struct bpf_link_primer *primer) ^ include/linux/bpf.h:1714:61: warning: unused parameter 'primer' [-Wunused-parameter] static inline void bpf_link_cleanup(struct bpf_link_primer *primer) ^ include/linux/bpf.h:1718:50: warning: unused parameter 'link' [-Wunused-parameter] static inline void bpf_link_inc(struct bpf_link *link) ^ include/linux/bpf.h:1722:50: warning: unused parameter 'link' [-Wunused-parameter] static inline void bpf_link_put(struct bpf_link *link) ^ include/linux/bpf.h:1726:55: warning: unused parameter 'pathname' [-Wunused-parameter] static inline int bpf_obj_get_user(const char __user *pathname, int flags) ^ include/linux/bpf.h:1726:69: warning: unused parameter 'flags' [-Wunused-parameter] static inline int bpf_obj_get_user(const char __user *pathname, int flags) ^ include/linux/bpf.h:1731:58: warning: unused parameter 'map' [-Wunused-parameter] static inline bool dev_map_can_have_prog(struct bpf_map *map) ^ include/linux/bpf.h:1745:40: warning: unused parameter 'dev' [-Wunused-parameter] int dev_xdp_enqueue(struct net_device *dev, struct xdp_buff *xdp, ^ include/linux/bpf.h:1745:62: warning: unused parameter 'xdp' [-Wunused-parameter] int dev_xdp_enqueue(struct net_device *dev, struct xdp_buff *xdp, ^ include/linux/bpf.h:1746:26: warning: unused parameter 'dev_rx' [-Wunused-parameter] struct net_device *dev_rx) ^ include/linux/bpf.h:1752:45: warning: unused parameter 'dst' [-Wunused-parameter] int dev_map_enqueue(struct bpf_dtab_netdev *dst, struct xdp_buff *xdp, ^ include/linux/bpf.h:1752:67: warning: unused parameter 'xdp' [-Wunused-parameter] int dev_map_enqueue(struct bpf_dtab_netdev *dst, struct xdp_buff *xdp, ^ include/linux/bpf.h:1753:26: warning: unused parameter 'dev_rx' [-Wunused-parameter] struct net_device *dev_rx) ^ include/linux/bpf.h:1759:44: warning: unused parameter 'xdp' [-Wunused-parameter] int dev_map_enqueue_multi(struct xdp_buff *xdp, struct net_device *dev_rx, ^ include/linux/bpf.h:1759:68: warning: unused parameter 'dev_rx' [-Wunused-parameter] int dev_map_enqueue_multi(struct xdp_buff *xdp, struct net_device *dev_rx, ^ include/linux/bpf.h:1760:22: warning: unused parameter 'map' [-Wunused-parameter] struct bpf_map *map, bool exclude_ingress) .. vim +/new_ctx +1152 include/linux/bpf.h 988 989 #if defined(CONFIG_BPF_JIT) && defined(CONFIG_BPF_SYSCALL) 990 #define BPF_MODULE_OWNER ((void *)((0xeB9FUL << 2) + POISON_POINTER_DELTA)) 991 const struct bpf_struct_ops *bpf_struct_ops_find(u32 type_id); 992 void bpf_struct_ops_init(struct btf *btf, struct bpf_verifier_log *log); 993 bool bpf_struct_ops_get(const void *kdata); 994 void bpf_struct_ops_put(const void *kdata); 995 int bpf_struct_ops_map_sys_lookup_elem(struct bpf_map *map, void *key, 996 void *value); 997 static inline bool bpf_try_module_get(const void *data, struct module *owner) 998 { 999 if (owner == BPF_MODULE_OWNER) 1000 return bpf_struct_ops_get(data); 1001 else 1002 return try_module_get(owner); 1003 } 1004 static inline void bpf_module_put(const void *data, struct module *owner) 1005 { 1006 if (owner == BPF_MODULE_OWNER) 1007 bpf_struct_ops_put(data); 1008 else 1009 module_put(owner); 1010 } 1011 #else 1012 static inline const struct bpf_struct_ops *bpf_struct_ops_find(u32 type_id) 1013 { 1014 return NULL; 1015 } 1016 static inline void bpf_struct_ops_init(struct btf *btf, 1017 struct bpf_verifier_log *log) 1018 { 1019 } 1020 static inline bool bpf_try_module_get(const void *data, struct module *owner) 1021 { 1022 return try_module_get(owner); 1023 } 1024 static inline void bpf_module_put(const void *data, struct module *owner) 1025 { 1026 module_put(owner); 1027 } > 1028 static inline int bpf_struct_ops_map_sys_lookup_elem(struct bpf_map *map, > 1029 void *key, 1030 void *value) 1031 { 1032 return -EINVAL; 1033 } 1034 #endif 1035 1036 struct bpf_array { 1037 struct bpf_map map; 1038 u32 elem_size; 1039 u32 index_mask; 1040 struct bpf_array_aux *aux; 1041 union { 1042 char value[0] __aligned(8); 1043 void *ptrs[0] __aligned(8); 1044 void __percpu *pptrs[0] __aligned(8); 1045 }; 1046 }; 1047 1048 #define BPF_COMPLEXITY_LIMIT_INSNS 1000000 /* yes. 1M insns */ 1049 #define MAX_TAIL_CALL_CNT 32 1050 1051 #define BPF_F_ACCESS_MASK (BPF_F_RDONLY | \ 1052 BPF_F_RDONLY_PROG | \ 1053 BPF_F_WRONLY | \ 1054 BPF_F_WRONLY_PROG) 1055 1056 #define BPF_MAP_CAN_READ BIT(0) 1057 #define BPF_MAP_CAN_WRITE BIT(1) 1058 1059 static inline u32 bpf_map_flags_to_cap(struct bpf_map *map) 1060 { 1061 u32 access_flags = map->map_flags & (BPF_F_RDONLY_PROG | BPF_F_WRONLY_PROG); 1062 1063 /* Combination of BPF_F_RDONLY_PROG | BPF_F_WRONLY_PROG is 1064 * not possible. 1065 */ 1066 if (access_flags & BPF_F_RDONLY_PROG) 1067 return BPF_MAP_CAN_READ; 1068 else if (access_flags & BPF_F_WRONLY_PROG) 1069 return BPF_MAP_CAN_WRITE; 1070 else 1071 return BPF_MAP_CAN_READ | BPF_MAP_CAN_WRITE; 1072 } 1073 1074 static inline bool bpf_map_flags_access_ok(u32 access_flags) 1075 { 1076 return (access_flags & (BPF_F_RDONLY_PROG | BPF_F_WRONLY_PROG)) != 1077 (BPF_F_RDONLY_PROG | BPF_F_WRONLY_PROG); 1078 } 1079 1080 struct bpf_event_entry { 1081 struct perf_event *event; 1082 struct file *perf_file; 1083 struct file *map_file; 1084 struct rcu_head rcu; 1085 }; 1086 1087 bool bpf_prog_array_compatible(struct bpf_array *array, const struct bpf_prog *fp); 1088 int bpf_prog_calc_tag(struct bpf_prog *fp); 1089 1090 const struct bpf_func_proto *bpf_get_trace_printk_proto(void); 1091 1092 typedef unsigned long (*bpf_ctx_copy_t)(void *dst, const void *src, 1093 unsigned long off, unsigned long len); 1094 typedef u32 (*bpf_convert_ctx_access_t)(enum bpf_access_type type, 1095 const struct bpf_insn *src, 1096 struct bpf_insn *dst, 1097 struct bpf_prog *prog, 1098 u32 *target_size); 1099 1100 u64 bpf_event_output(struct bpf_map *map, u64 flags, void *meta, u64 meta_size, 1101 void *ctx, u64 ctx_size, bpf_ctx_copy_t ctx_copy); 1102 1103 /* an array of programs to be executed under rcu_lock. 1104 * 1105 * Typical usage: 1106 * ret = BPF_PROG_RUN_ARRAY(&bpf_prog_array, ctx, bpf_prog_run); 1107 * 1108 * the structure returned by bpf_prog_array_alloc() should be populated 1109 * with program pointers and the last pointer must be NULL. 1110 * The user has to keep refcnt on the program and make sure the program 1111 * is removed from the array before bpf_prog_put(). 1112 * The 'struct bpf_prog_array *' should only be replaced with xchg() 1113 * since other cpus are walking the array of pointers in parallel. 1114 */ 1115 struct bpf_prog_array_item { 1116 struct bpf_prog *prog; 1117 struct bpf_cgroup_storage *cgroup_storage[MAX_BPF_CGROUP_STORAGE_TYPE]; 1118 }; 1119 1120 struct bpf_prog_array { 1121 struct rcu_head rcu; 1122 struct bpf_prog_array_item items[]; 1123 }; 1124 1125 struct bpf_prog_array *bpf_prog_array_alloc(u32 prog_cnt, gfp_t flags); 1126 void bpf_prog_array_free(struct bpf_prog_array *progs); 1127 int bpf_prog_array_length(struct bpf_prog_array *progs); 1128 bool bpf_prog_array_is_empty(struct bpf_prog_array *array); 1129 int bpf_prog_array_copy_to_user(struct bpf_prog_array *progs, 1130 __u32 __user *prog_ids, u32 cnt); 1131 1132 void bpf_prog_array_delete_safe(struct bpf_prog_array *progs, 1133 struct bpf_prog *old_prog); 1134 int bpf_prog_array_delete_safe_at(struct bpf_prog_array *array, int index); 1135 int bpf_prog_array_update_at(struct bpf_prog_array *array, int index, 1136 struct bpf_prog *prog); 1137 int bpf_prog_array_copy_info(struct bpf_prog_array *array, 1138 u32 *prog_ids, u32 request_cnt, 1139 u32 *prog_cnt); 1140 int bpf_prog_array_copy(struct bpf_prog_array *old_array, 1141 struct bpf_prog *exclude_prog, 1142 struct bpf_prog *include_prog, 1143 struct bpf_prog_array **new_array); 1144 1145 struct bpf_run_ctx {}; 1146 1147 struct bpf_cg_run_ctx { 1148 struct bpf_run_ctx run_ctx; 1149 const struct bpf_prog_array_item *prog_item; 1150 }; 1151 > 1152 static inline struct bpf_run_ctx *bpf_set_run_ctx(struct bpf_run_ctx *new_ctx) 1153 { 1154 struct bpf_run_ctx *old_ctx = NULL; 1155 1156 #ifdef CONFIG_BPF_SYSCALL 1157 old_ctx = current->bpf_ctx; 1158 current->bpf_ctx = new_ctx; 1159 #endif 1160 return old_ctx; 1161 } 1162 > 1163 static inline void bpf_reset_run_ctx(struct bpf_run_ctx *old_ctx) 1164 { 1165 #ifdef CONFIG_BPF_SYSCALL 1166 current->bpf_ctx = old_ctx; 1167 #endif 1168 } 1169 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org