Hi Joe, Thank you for the patch! Yet something to improve:
[auto build test ERROR on bpf-next/master] url: https://github.com/0day-ci/linux/commits/Joe-Stringer/Add-socket-lookup-support/20180914-134632 base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master config: x86_64-randconfig-s0-09141346 (attached as .config) compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All error/warnings (new ones prefixed by >>): net/core/filter.c: In function 'sk_lookup': >> net/core/filter.c:4870:1: error: invalid storage class for function >> 'bpf_sk_lookup' bpf_sk_lookup(struct sk_buff *skb, struct bpf_sock_tuple *tuple, u32 len, ^~~~~~~~~~~~~ >> net/core/filter.c:4869:1: warning: ISO C90 forbids mixed declarations and >> code [-Wdeclaration-after-statement] static unsigned long ^~~~~~ In file included from include/net/sock.h:64:0, from include/linux/sock_diag.h:8, from net/core/filter.c:29: >> include/linux/filter.h:432:6: error: invalid storage class for function >> '____bpf_sk_lookup_tcp' u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__)); \ ^ >> include/linux/filter.h:446:31: note: in expansion of macro 'BPF_CALL_x' #define BPF_CALL_5(name, ...) BPF_CALL_x(5, name, __VA_ARGS__) ^~~~~~~~~~ >> net/core/filter.c:4896:1: note: in expansion of macro 'BPF_CALL_5' BPF_CALL_5(bpf_sk_lookup_tcp, struct sk_buff *, skb, ^~~~~~~~~~ >> net/core/filter.c:4896:12: error: static declaration of 'bpf_sk_lookup_tcp' >> follows non-static declaration BPF_CALL_5(bpf_sk_lookup_tcp, struct sk_buff *, skb, ^ include/linux/filter.h:434:6: note: in definition of macro 'BPF_CALL_x' u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__)) \ ^~~~ >> net/core/filter.c:4896:1: note: in expansion of macro 'BPF_CALL_5' BPF_CALL_5(bpf_sk_lookup_tcp, struct sk_buff *, skb, ^~~~~~~~~~ net/core/filter.c:4896:12: note: previous declaration of 'bpf_sk_lookup_tcp' was here BPF_CALL_5(bpf_sk_lookup_tcp, struct sk_buff *, skb, ^ include/linux/filter.h:433:6: note: in definition of macro 'BPF_CALL_x' u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__)); \ ^~~~ >> net/core/filter.c:4896:1: note: in expansion of macro 'BPF_CALL_5' BPF_CALL_5(bpf_sk_lookup_tcp, struct sk_buff *, skb, ^~~~~~~~~~ net/core/filter.c: In function 'bpf_sk_lookup_tcp': >> include/linux/filter.h:436:10: error: implicit declaration of function >> '____bpf_sk_lookup_tcp' [-Werror=implicit-function-declaration] return ____##name(__BPF_MAP(x,__BPF_CAST,__BPF_N,__VA_ARGS__));\ ^ >> include/linux/filter.h:446:31: note: in expansion of macro 'BPF_CALL_x' #define BPF_CALL_5(name, ...) BPF_CALL_x(5, name, __VA_ARGS__) ^~~~~~~~~~ >> net/core/filter.c:4896:1: note: in expansion of macro 'BPF_CALL_5' BPF_CALL_5(bpf_sk_lookup_tcp, struct sk_buff *, skb, ^~~~~~~~~~ net/core/filter.c: In function 'sk_lookup': include/linux/filter.h:439:6: error: invalid storage class for function '____bpf_sk_lookup_tcp' u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__)) ^ >> include/linux/filter.h:446:31: note: in expansion of macro 'BPF_CALL_x' #define BPF_CALL_5(name, ...) BPF_CALL_x(5, name, __VA_ARGS__) ^~~~~~~~~~ >> net/core/filter.c:4896:1: note: in expansion of macro 'BPF_CALL_5' BPF_CALL_5(bpf_sk_lookup_tcp, struct sk_buff *, skb, ^~~~~~~~~~ >> net/core/filter.c:4903:11: error: initializer element is not constant .func = bpf_sk_lookup_tcp, ^~~~~~~~~~~~~~~~~ net/core/filter.c:4903:11: note: (near initialization for 'bpf_sk_lookup_tcp_proto.func') In file included from include/net/sock.h:64:0, from include/linux/sock_diag.h:8, from net/core/filter.c:29: >> include/linux/filter.h:432:6: error: invalid storage class for function >> '____bpf_sk_lookup_udp' u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__)); \ ^ >> include/linux/filter.h:446:31: note: in expansion of macro 'BPF_CALL_x' #define BPF_CALL_5(name, ...) BPF_CALL_x(5, name, __VA_ARGS__) ^~~~~~~~~~ net/core/filter.c:4913:1: note: in expansion of macro 'BPF_CALL_5' BPF_CALL_5(bpf_sk_lookup_udp, struct sk_buff *, skb, ^~~~~~~~~~ >> net/core/filter.c:4913:12: error: static declaration of 'bpf_sk_lookup_udp' >> follows non-static declaration BPF_CALL_5(bpf_sk_lookup_udp, struct sk_buff *, skb, ^ include/linux/filter.h:434:6: note: in definition of macro 'BPF_CALL_x' u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__)) \ ^~~~ net/core/filter.c:4913:1: note: in expansion of macro 'BPF_CALL_5' BPF_CALL_5(bpf_sk_lookup_udp, struct sk_buff *, skb, ^~~~~~~~~~ net/core/filter.c:4913:12: note: previous declaration of 'bpf_sk_lookup_udp' was here BPF_CALL_5(bpf_sk_lookup_udp, struct sk_buff *, skb, ^ include/linux/filter.h:433:6: note: in definition of macro 'BPF_CALL_x' u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__)); \ ^~~~ net/core/filter.c:4913:1: note: in expansion of macro 'BPF_CALL_5' BPF_CALL_5(bpf_sk_lookup_udp, struct sk_buff *, skb, ^~~~~~~~~~ net/core/filter.c: In function 'bpf_sk_lookup_udp': >> include/linux/filter.h:436:10: error: implicit declaration of function >> '____bpf_sk_lookup_udp' [-Werror=implicit-function-declaration] return ____##name(__BPF_MAP(x,__BPF_CAST,__BPF_N,__VA_ARGS__));\ ^ >> include/linux/filter.h:446:31: note: in expansion of macro 'BPF_CALL_x' #define BPF_CALL_5(name, ...) BPF_CALL_x(5, name, __VA_ARGS__) ^~~~~~~~~~ net/core/filter.c:4913:1: note: in expansion of macro 'BPF_CALL_5' BPF_CALL_5(bpf_sk_lookup_udp, struct sk_buff *, skb, ^~~~~~~~~~ net/core/filter.c: In function 'sk_lookup': include/linux/filter.h:439:6: error: invalid storage class for function '____bpf_sk_lookup_udp' u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__)) ^ >> include/linux/filter.h:446:31: note: in expansion of macro 'BPF_CALL_x' #define BPF_CALL_5(name, ...) BPF_CALL_x(5, name, __VA_ARGS__) ^~~~~~~~~~ net/core/filter.c:4913:1: note: in expansion of macro 'BPF_CALL_5' BPF_CALL_5(bpf_sk_lookup_udp, struct sk_buff *, skb, ^~~~~~~~~~ net/core/filter.c:4920:11: error: initializer element is not constant .func = bpf_sk_lookup_udp, ^~~~~~~~~~~~~~~~~ net/core/filter.c:4920:11: note: (near initialization for 'bpf_sk_lookup_udp_proto.func') In file included from include/net/sock.h:64:0, from include/linux/sock_diag.h:8, from net/core/filter.c:29: -- net//core/filter.c: In function 'sk_lookup': net//core/filter.c:4870:1: error: invalid storage class for function 'bpf_sk_lookup' bpf_sk_lookup(struct sk_buff *skb, struct bpf_sock_tuple *tuple, u32 len, ^~~~~~~~~~~~~ net//core/filter.c:4869:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] static unsigned long ^~~~~~ In file included from include/net/sock.h:64:0, from include/linux/sock_diag.h:8, from net//core/filter.c:29: >> include/linux/filter.h:432:6: error: invalid storage class for function >> '____bpf_sk_lookup_tcp' u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__)); \ ^ >> include/linux/filter.h:446:31: note: in expansion of macro 'BPF_CALL_x' #define BPF_CALL_5(name, ...) BPF_CALL_x(5, name, __VA_ARGS__) ^~~~~~~~~~ net//core/filter.c:4896:1: note: in expansion of macro 'BPF_CALL_5' BPF_CALL_5(bpf_sk_lookup_tcp, struct sk_buff *, skb, ^~~~~~~~~~ net//core/filter.c:4896:12: error: static declaration of 'bpf_sk_lookup_tcp' follows non-static declaration BPF_CALL_5(bpf_sk_lookup_tcp, struct sk_buff *, skb, ^ include/linux/filter.h:434:6: note: in definition of macro 'BPF_CALL_x' u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__)) \ ^~~~ net//core/filter.c:4896:1: note: in expansion of macro 'BPF_CALL_5' BPF_CALL_5(bpf_sk_lookup_tcp, struct sk_buff *, skb, ^~~~~~~~~~ net//core/filter.c:4896:12: note: previous declaration of 'bpf_sk_lookup_tcp' was here BPF_CALL_5(bpf_sk_lookup_tcp, struct sk_buff *, skb, ^ include/linux/filter.h:433:6: note: in definition of macro 'BPF_CALL_x' u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__)); \ ^~~~ net//core/filter.c:4896:1: note: in expansion of macro 'BPF_CALL_5' BPF_CALL_5(bpf_sk_lookup_tcp, struct sk_buff *, skb, ^~~~~~~~~~ net//core/filter.c: In function 'bpf_sk_lookup_tcp': >> include/linux/filter.h:436:10: error: implicit declaration of function >> '____bpf_sk_lookup_tcp' [-Werror=implicit-function-declaration] return ____##name(__BPF_MAP(x,__BPF_CAST,__BPF_N,__VA_ARGS__));\ ^ >> include/linux/filter.h:446:31: note: in expansion of macro 'BPF_CALL_x' #define BPF_CALL_5(name, ...) BPF_CALL_x(5, name, __VA_ARGS__) ^~~~~~~~~~ net//core/filter.c:4896:1: note: in expansion of macro 'BPF_CALL_5' BPF_CALL_5(bpf_sk_lookup_tcp, struct sk_buff *, skb, ^~~~~~~~~~ net//core/filter.c: In function 'sk_lookup': include/linux/filter.h:439:6: error: invalid storage class for function '____bpf_sk_lookup_tcp' u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__)) ^ >> include/linux/filter.h:446:31: note: in expansion of macro 'BPF_CALL_x' #define BPF_CALL_5(name, ...) BPF_CALL_x(5, name, __VA_ARGS__) ^~~~~~~~~~ net//core/filter.c:4896:1: note: in expansion of macro 'BPF_CALL_5' BPF_CALL_5(bpf_sk_lookup_tcp, struct sk_buff *, skb, ^~~~~~~~~~ net//core/filter.c:4903:11: error: initializer element is not constant .func = bpf_sk_lookup_tcp, ^~~~~~~~~~~~~~~~~ net//core/filter.c:4903:11: note: (near initialization for 'bpf_sk_lookup_tcp_proto.func') In file included from include/net/sock.h:64:0, from include/linux/sock_diag.h:8, from net//core/filter.c:29: >> include/linux/filter.h:432:6: error: invalid storage class for function >> '____bpf_sk_lookup_udp' u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__)); \ ^ >> include/linux/filter.h:446:31: note: in expansion of macro 'BPF_CALL_x' #define BPF_CALL_5(name, ...) BPF_CALL_x(5, name, __VA_ARGS__) ^~~~~~~~~~ net//core/filter.c:4913:1: note: in expansion of macro 'BPF_CALL_5' BPF_CALL_5(bpf_sk_lookup_udp, struct sk_buff *, skb, ^~~~~~~~~~ net//core/filter.c:4913:12: error: static declaration of 'bpf_sk_lookup_udp' follows non-static declaration BPF_CALL_5(bpf_sk_lookup_udp, struct sk_buff *, skb, ^ include/linux/filter.h:434:6: note: in definition of macro 'BPF_CALL_x' u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__)) \ ^~~~ net//core/filter.c:4913:1: note: in expansion of macro 'BPF_CALL_5' BPF_CALL_5(bpf_sk_lookup_udp, struct sk_buff *, skb, ^~~~~~~~~~ net//core/filter.c:4913:12: note: previous declaration of 'bpf_sk_lookup_udp' was here BPF_CALL_5(bpf_sk_lookup_udp, struct sk_buff *, skb, ^ include/linux/filter.h:433:6: note: in definition of macro 'BPF_CALL_x' u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__)); \ ^~~~ net//core/filter.c:4913:1: note: in expansion of macro 'BPF_CALL_5' BPF_CALL_5(bpf_sk_lookup_udp, struct sk_buff *, skb, ^~~~~~~~~~ net//core/filter.c: In function 'bpf_sk_lookup_udp': >> include/linux/filter.h:436:10: error: implicit declaration of function >> '____bpf_sk_lookup_udp' [-Werror=implicit-function-declaration] return ____##name(__BPF_MAP(x,__BPF_CAST,__BPF_N,__VA_ARGS__));\ ^ >> include/linux/filter.h:446:31: note: in expansion of macro 'BPF_CALL_x' #define BPF_CALL_5(name, ...) BPF_CALL_x(5, name, __VA_ARGS__) ^~~~~~~~~~ net//core/filter.c:4913:1: note: in expansion of macro 'BPF_CALL_5' BPF_CALL_5(bpf_sk_lookup_udp, struct sk_buff *, skb, ^~~~~~~~~~ net//core/filter.c: In function 'sk_lookup': include/linux/filter.h:439:6: error: invalid storage class for function '____bpf_sk_lookup_udp' u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__)) ^ >> include/linux/filter.h:446:31: note: in expansion of macro 'BPF_CALL_x' #define BPF_CALL_5(name, ...) BPF_CALL_x(5, name, __VA_ARGS__) ^~~~~~~~~~ net//core/filter.c:4913:1: note: in expansion of macro 'BPF_CALL_5' BPF_CALL_5(bpf_sk_lookup_udp, struct sk_buff *, skb, ^~~~~~~~~~ net//core/filter.c:4920:11: error: initializer element is not constant .func = bpf_sk_lookup_udp, ^~~~~~~~~~~~~~~~~ net//core/filter.c:4920:11: note: (near initialization for 'bpf_sk_lookup_udp_proto.func') In file included from include/net/sock.h:64:0, from include/linux/sock_diag.h:8, from net//core/filter.c:29: >> include/linux/filter.h:432:6: error: invalid storage class for function >> '____bpf_sk_release' u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__)); \ ^ include/linux/filter.h:443:31: note: in expansion of macro 'BPF_CALL_x' #define BPF_CALL_2(name, ...) BPF_CALL_x(2, name, __VA_ARGS__) ^~~~~~~~~~ net//core/filter.c:4930:1: note: in expansion of macro 'BPF_CALL_2' BPF_CALL_2(bpf_sk_release, struct sock *, sk, u64, flags) ^~~~~~~~~~ net//core/filter.c:4930:12: error: static declaration of 'bpf_sk_release' follows non-static declaration BPF_CALL_2(bpf_sk_release, struct sock *, sk, u64, flags) ^ include/linux/filter.h:434:6: note: in definition of macro 'BPF_CALL_x' u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__)) \ ^~~~ net//core/filter.c:4930:1: note: in expansion of macro 'BPF_CALL_2' BPF_CALL_2(bpf_sk_release, struct sock *, sk, u64, flags) ^~~~~~~~~~ net//core/filter.c:4930:12: note: previous declaration of 'bpf_sk_release' was here BPF_CALL_2(bpf_sk_release, struct sock *, sk, u64, flags) ^ include/linux/filter.h:433:6: note: in definition of macro 'BPF_CALL_x' u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__)); \ ^~~~ net//core/filter.c:4930:1: note: in expansion of macro 'BPF_CALL_2' BPF_CALL_2(bpf_sk_release, struct sock *, sk, u64, flags) ^~~~~~~~~~ net//core/filter.c: In function 'bpf_sk_release': >> include/linux/filter.h:436:10: error: implicit declaration of function >> '____bpf_sk_release' [-Werror=implicit-function-declaration] return ____##name(__BPF_MAP(x,__BPF_CAST,__BPF_N,__VA_ARGS__));\ ^ include/linux/filter.h:443:31: note: in expansion of macro 'BPF_CALL_x' #define BPF_CALL_2(name, ...) BPF_CALL_x(2, name, __VA_ARGS__) ^~~~~~~~~~ net//core/filter.c:4930:1: note: in expansion of macro 'BPF_CALL_2' BPF_CALL_2(bpf_sk_release, struct sock *, sk, u64, flags) ^~~~~~~~~~ net//core/filter.c: In function 'sk_lookup': include/linux/filter.h:439:6: error: invalid storage class for function '____bpf_sk_release' u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__)) ^ include/linux/filter.h:443:31: note: in expansion of macro 'BPF_CALL_x' #define BPF_CALL_2(name, ...) BPF_CALL_x(2, name, __VA_ARGS__) ^~~~~~~~~~ net//core/filter.c:4930:1: note: in expansion of macro 'BPF_CALL_2' BPF_CALL_2(bpf_sk_release, struct sock *, sk, u64, flags) ^~~~~~~~~~ net//core/filter.c:4941:11: error: initializer element is not constant .func = bpf_sk_release, ^~~~~~~~~~~~~~ net//core/filter.c:4941:11: note: (near initialization for 'bpf_sk_release_proto.func') net//core/filter.c:4980:1: error: invalid storage class for function 'bpf_base_func_proto' bpf_base_func_proto(enum bpf_func_id func_id) ^~~~~~~~~~~~~~~~~~~ net//core/filter.c:5009:1: error: invalid storage class for function 'sock_filter_func_proto' sock_filter_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) ^~~~~~~~~~~~~~~~~~~~~~ net//core/filter.c:5025:1: error: invalid storage class for function 'sock_addr_func_proto' sock_addr_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) ^~~~~~~~~~~~~~~~~~~~ net//core/filter.c:5051:1: error: invalid storage class for function 'sk_filter_func_proto' sk_filter_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) ^~~~~~~~~~~~~~~~~~~~ net//core/filter.c:5068:1: error: invalid storage class for function 'cg_skb_func_proto' cg_skb_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) ^~~~~~~~~~~~~~~~~ net//core/filter.c:5079:1: error: invalid storage class for function 'tc_cls_act_func_proto' tc_cls_act_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) ^~~~~~~~~~~~~~~~~~~~~ net//core/filter.c:5166:1: error: invalid storage class for function 'xdp_func_proto' xdp_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) ^~~~~~~~~~~~~~ net//core/filter.c:5193:1: error: invalid storage class for function 'sock_ops_func_proto' sock_ops_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) ^~~~~~~~~~~~~~~~~~~ net//core/filter.c:5216:1: error: invalid storage class for function 'sk_msg_func_proto' sk_msg_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) ^~~~~~~~~~~~~~~~~ net//core/filter.c:5237:1: error: invalid storage class for function 'sk_skb_func_proto' sk_skb_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) ^~~~~~~~~~~~~~~~~ net//core/filter.c:5272:1: error: invalid storage class for function 'lwt_out_func_proto' lwt_out_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) ^~~~~~~~~~~~~~~~~~ net//core/filter.c:5299:1: error: invalid storage class for function 'lwt_in_func_proto' lwt_in_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) ^~~~~~~~~~~~~~~~~ net//core/filter.c:5310:1: error: invalid storage class for function 'lwt_xmit_func_proto' lwt_xmit_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) ^~~~~~~~~~~~~~~~~~~ net//core/filter.c:5345:1: error: invalid storage class for function 'lwt_seg6local_func_proto' lwt_seg6local_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) ^~~~~~~~~~~~~~~~~~~~~~~~ net//core/filter.c:5361:13: error: invalid storage class for function 'bpf_skb_is_valid_access' static bool bpf_skb_is_valid_access(int off, int size, enum bpf_access_type type, ^~~~~~~~~~~~~~~~~~~~~~~ net//core/filter.c:5404:13: error: invalid storage class for function 'sk_filter_is_valid_access' static bool sk_filter_is_valid_access(int off, int size, ^~~~~~~~~~~~~~~~~~~~~~~~~ net//core/filter.c:5430:13: error: invalid storage class for function 'lwt_is_valid_access' static bool lwt_is_valid_access(int off, int size, ^~~~~~~~~~~~~~~~~~~ net//core/filter.c:5466:13: error: invalid storage class for function '__sock_filter_check_attach_type' static bool __sock_filter_check_attach_type(int off, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ net//core/filter.c:5509:13: error: invalid storage class for function '__sock_filter_check_size' static bool __sock_filter_check_size(int off, int size, ^~~~~~~~~~~~~~~~~~~~~~~~ net//core/filter.c:5536:13: error: invalid storage class for function 'sock_filter_is_valid_access' static bool sock_filter_is_valid_access(int off, int size, ^~~~~~~~~~~~~~~~~~~~~~~~~~~ net//core/filter.c:5547:12: error: invalid storage class for function 'bpf_unclone_prologue' static int bpf_unclone_prologue(struct bpf_insn *insn_buf, bool direct_write, ^~~~~~~~~~~~~~~~~~~~ net//core/filter.c:5586:12: error: invalid storage class for function 'bpf_gen_ld_abs' static int bpf_gen_ld_abs(const struct bpf_insn *orig, ^~~~~~~~~~~~~~ net//core/filter.c:5621:12: error: invalid storage class for function 'tc_cls_act_prologue' static int tc_cls_act_prologue(struct bpf_insn *insn_buf, bool direct_write, ^~~~~~~~~~~~~~~~~~~ net//core/filter.c:5627:13: error: invalid storage class for function 'tc_cls_act_is_valid_access' static bool tc_cls_act_is_valid_access(int off, int size, ^~~~~~~~~~~~~~~~~~~~~~~~~~ net//core/filter.c:5662:13: error: invalid storage class for function '__is_valid_xdp_access' static bool __is_valid_xdp_access(int off, int size) ^~~~~~~~~~~~~~~~~~~~~ net//core/filter.c:5674:13: error: invalid storage class for function 'xdp_is_valid_access' static bool xdp_is_valid_access(int off, int size, ^~~~~~~~~~~~~~~~~~~ net//core/filter.c:5714:13: error: invalid storage class for function 'sock_addr_is_valid_access' static bool sock_addr_is_valid_access(int off, int size, ^~~~~~~~~~~~~~~~~~~~~~~~~ net//core/filter.c:5714:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] static bool sock_addr_is_valid_access(int off, int size, ^~~~~~ net//core/filter.c:5801:13: error: invalid storage class for function 'sock_ops_is_valid_access' static bool sock_ops_is_valid_access(int off, int size, ^~~~~~~~~~~~~~~~~~~~~~~~ net//core/filter.c:5842:12: error: invalid storage class for function 'sk_skb_prologue' static int sk_skb_prologue(struct bpf_insn *insn_buf, bool direct_write, ^~~~~~~~~~~~~~~ net//core/filter.c:5848:13: error: invalid storage class for function 'sk_skb_is_valid_access' static bool sk_skb_is_valid_access(int off, int size, ^~~~~~~~~~~~~~~~~~~~~~ net//core/filter.c:5883:13: error: invalid storage class for function 'sk_msg_is_valid_access' static bool sk_msg_is_valid_access(int off, int size, ^~~~~~~~~~~~~~~~~~~~~~ net//core/filter.c:5915:12: error: invalid storage class for function 'bpf_convert_ctx_access' static u32 bpf_convert_ctx_access(enum bpf_access_type type, ^~~~~~~~~~~~~~~~~~~~~~ net//core/filter.c:6318:12: error: invalid storage class for function 'tc_cls_act_convert_ctx_access' static u32 tc_cls_act_convert_ctx_access(enum bpf_access_type type, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ net//core/filter.c:6342:12: error: invalid storage class for function 'xdp_convert_ctx_access' static u32 xdp_convert_ctx_access(enum bpf_access_type type, ^~~~~~~~~~~~~~~~~~~~~~ net//core/filter.c:6462:12: error: invalid storage class for function 'sock_addr_convert_ctx_access' static u32 sock_addr_convert_ctx_access(enum bpf_access_type type, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ net//core/filter.c:6551:12: error: invalid storage class for function 'sock_ops_convert_ctx_access' static u32 sock_ops_convert_ctx_access(enum bpf_access_type type, ^~~~~~~~~~~~~~~~~~~~~~~~~~~ net//core/filter.c:6890:12: error: invalid storage class for function 'sk_skb_convert_ctx_access' static u32 sk_skb_convert_ctx_access(enum bpf_access_type type, ^~~~~~~~~~~~~~~~~~~~~~~~~ net//core/filter.c:6915:12: error: invalid storage class for function 'sk_msg_convert_ctx_access' static u32 sk_msg_convert_ctx_access(enum bpf_access_type type, ^~~~~~~~~~~~~~~~~~~~~~~~~ net//core/filter.c:7192:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] int sk_get_filter(struct sock *sk, struct sock_filter __user *ubuf, ^~~ net//core/filter.c:7247:13: error: invalid storage class for function 'bpf_init_reuseport_kern' static void bpf_init_reuseport_kern(struct sk_reuseport_kern *reuse_kern, ^~~~~~~~~~~~~~~~~~~~~~~ In file included from include/net/sock.h:64:0, from include/linux/sock_diag.h:8, from net//core/filter.c:29: >> include/linux/filter.h:432:6: error: invalid storage class for function >> '____sk_select_reuseport' u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__)); \ ^ include/linux/filter.h:445:31: note: in expansion of macro 'BPF_CALL_x' #define BPF_CALL_4(name, ...) BPF_CALL_x(4, name, __VA_ARGS__) ^~~~~~~~~~ net//core/filter.c:7277:1: note: in expansion of macro 'BPF_CALL_4' BPF_CALL_4(sk_select_reuseport, struct sk_reuseport_kern *, reuse_kern, ^~~~~~~~~~ net//core/filter.c:7277:12: error: static declaration of 'sk_select_reuseport' follows non-static declaration BPF_CALL_4(sk_select_reuseport, struct sk_reuseport_kern *, reuse_kern, ^ include/linux/filter.h:434:6: note: in definition of macro 'BPF_CALL_x' u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__)) \ ^~~~ net//core/filter.c:7277:1: note: in expansion of macro 'BPF_CALL_4' BPF_CALL_4(sk_select_reuseport, struct sk_reuseport_kern *, reuse_kern, ^~~~~~~~~~ net//core/filter.c:7277:12: note: previous declaration of 'sk_select_reuseport' was here BPF_CALL_4(sk_select_reuseport, struct sk_reuseport_kern *, reuse_kern, ^ include/linux/filter.h:433:6: note: in definition of macro 'BPF_CALL_x' u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__)); \ ^~~~ net//core/filter.c:7277:1: note: in expansion of macro 'BPF_CALL_4' BPF_CALL_4(sk_select_reuseport, struct sk_reuseport_kern *, reuse_kern, ^~~~~~~~~~ net//core/filter.c: In function 'sk_select_reuseport': >> include/linux/filter.h:436:10: error: implicit declaration of function >> '____sk_select_reuseport' [-Werror=implicit-function-declaration] return ____##name(__BPF_MAP(x,__BPF_CAST,__BPF_N,__VA_ARGS__));\ ^ include/linux/filter.h:445:31: note: in expansion of macro 'BPF_CALL_x' #define BPF_CALL_4(name, ...) BPF_CALL_x(4, name, __VA_ARGS__) ^~~~~~~~~~ net//core/filter.c:7277:1: note: in expansion of macro 'BPF_CALL_4' BPF_CALL_4(sk_select_reuseport, struct sk_reuseport_kern *, reuse_kern, ^~~~~~~~~~ net//core/filter.c: In function 'sk_lookup': include/linux/filter.h:439:6: error: invalid storage class for function '____sk_select_reuseport' u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__)) ^ include/linux/filter.h:445:31: note: in expansion of macro 'BPF_CALL_x' #define BPF_CALL_4(name, ...) BPF_CALL_x(4, name, __VA_ARGS__) ^~~~~~~~~~ net//core/filter.c:7277:1: note: in expansion of macro 'BPF_CALL_4' BPF_CALL_4(sk_select_reuseport, struct sk_reuseport_kern *, reuse_kern, ^~~~~~~~~~ net//core/filter.c:7323:20: error: initializer element is not constant .func = sk_select_reuseport, ^~~~~~~~~~~~~~~~~~~ net//core/filter.c:7323:20: note: (near initialization for 'sk_select_reuseport_proto.func') In file included from include/net/sock.h:64:0, from include/linux/sock_diag.h:8, from net//core/filter.c:29: >> include/linux/filter.h:432:6: error: invalid storage class for function >> '____sk_reuseport_load_bytes' u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__)); \ ^ include/linux/filter.h:445:31: note: in expansion of macro 'BPF_CALL_x' #define BPF_CALL_4(name, ...) BPF_CALL_x(4, name, __VA_ARGS__) ^~~~~~~~~~ net//core/filter.c:7332:1: note: in expansion of macro 'BPF_CALL_4' BPF_CALL_4(sk_reuseport_load_bytes, ^~~~~~~~~~ net//core/filter.c:7332:12: error: static declaration of 'sk_reuseport_load_bytes' follows non-static declaration BPF_CALL_4(sk_reuseport_load_bytes, ^ include/linux/filter.h:434:6: note: in definition of macro 'BPF_CALL_x' u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__)) \ ^~~~ net//core/filter.c:7332:1: note: in expansion of macro 'BPF_CALL_4' BPF_CALL_4(sk_reuseport_load_bytes, ^~~~~~~~~~ net//core/filter.c:7332:12: note: previous declaration of 'sk_reuseport_load_bytes' was here BPF_CALL_4(sk_reuseport_load_bytes, ^ include/linux/filter.h:433:6: note: in definition of macro 'BPF_CALL_x' u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__)); \ ^~~~ net//core/filter.c:7332:1: note: in expansion of macro 'BPF_CALL_4' BPF_CALL_4(sk_reuseport_load_bytes, ^~~~~~~~~~ net//core/filter.c: In function 'sk_reuseport_load_bytes': >> include/linux/filter.h:436:10: error: implicit declaration of function >> '____sk_reuseport_load_bytes' [-Werror=implicit-function-declaration] return ____##name(__BPF_MAP(x,__BPF_CAST,__BPF_N,__VA_ARGS__));\ ^ include/linux/filter.h:445:31: note: in expansion of macro 'BPF_CALL_x' #define BPF_CALL_4(name, ...) BPF_CALL_x(4, name, __VA_ARGS__) ^~~~~~~~~~ net//core/filter.c:7332:1: note: in expansion of macro 'BPF_CALL_4' BPF_CALL_4(sk_reuseport_load_bytes, ^~~~~~~~~~ net//core/filter.c: In function 'sk_lookup': include/linux/filter.h:439:6: error: invalid storage class for function '____sk_reuseport_load_bytes' u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__)) ^ include/linux/filter.h:445:31: note: in expansion of macro 'BPF_CALL_x' #define BPF_CALL_4(name, ...) BPF_CALL_x(4, name, __VA_ARGS__) ^~~~~~~~~~ net//core/filter.c:7332:1: note: in expansion of macro 'BPF_CALL_4' BPF_CALL_4(sk_reuseport_load_bytes, ^~~~~~~~~~ net//core/filter.c:7340:11: error: initializer element is not constant .func = sk_reuseport_load_bytes, ^~~~~~~~~~~~~~~~~~~~~~~ net//core/filter.c:7340:11: note: (near initialization for 'sk_reuseport_load_bytes_proto.func') In file included from include/net/sock.h:64:0, from include/linux/sock_diag.h:8, from net//core/filter.c:29: >> include/linux/filter.h:432:6: error: invalid storage class for function >> '____sk_reuseport_load_bytes_relative' u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__)); \ ^ >> include/linux/filter.h:446:31: note: in expansion of macro 'BPF_CALL_x' #define BPF_CALL_5(name, ...) BPF_CALL_x(5, name, __VA_ARGS__) ^~~~~~~~~~ net//core/filter.c:7349:1: note: in expansion of macro 'BPF_CALL_5' BPF_CALL_5(sk_reuseport_load_bytes_relative, ^~~~~~~~~~ net//core/filter.c:7349:12: error: static declaration of 'sk_reuseport_load_bytes_relative' follows non-static declaration BPF_CALL_5(sk_reuseport_load_bytes_relative, ^ include/linux/filter.h:434:6: note: in definition of macro 'BPF_CALL_x' u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__)) \ ^~~~ net//core/filter.c:7349:1: note: in expansion of macro 'BPF_CALL_5' BPF_CALL_5(sk_reuseport_load_bytes_relative, ^~~~~~~~~~ net//core/filter.c:7349:12: note: previous declaration of 'sk_reuseport_load_bytes_relative' was here BPF_CALL_5(sk_reuseport_load_bytes_relative, ^ include/linux/filter.h:433:6: note: in definition of macro 'BPF_CALL_x' u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__)); \ ^~~~ net//core/filter.c:7349:1: note: in expansion of macro 'BPF_CALL_5' BPF_CALL_5(sk_reuseport_load_bytes_relative, ^~~~~~~~~~ net//core/filter.c: In function 'sk_reuseport_load_bytes_relative': >> include/linux/filter.h:436:10: error: implicit declaration of function >> '____sk_reuseport_load_bytes_relative' >> [-Werror=implicit-function-declaration] return ____##name(__BPF_MAP(x,__BPF_CAST,__BPF_N,__VA_ARGS__));\ ^ >> include/linux/filter.h:446:31: note: in expansion of macro 'BPF_CALL_x' #define BPF_CALL_5(name, ...) BPF_CALL_x(5, name, __VA_ARGS__) ^~~~~~~~~~ net//core/filter.c:7349:1: note: in expansion of macro 'BPF_CALL_5' BPF_CALL_5(sk_reuseport_load_bytes_relative, ^~~~~~~~~~ net//core/filter.c: In function 'sk_lookup': include/linux/filter.h:439:6: error: invalid storage class for function '____sk_reuseport_load_bytes_relative' u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__)) ^ vim +/bpf_sk_lookup +4870 net/core/filter.c 4863 4864 /* bpf_sk_lookup performs the core lookup for different types of sockets, 4865 * taking a reference on the socket if it doesn't have the flag SOCK_RCU_FREE. 4866 * Returns the socket as an 'unsigned long' to simplify the casting in the 4867 * callers to satisfy BPF_CALL declarations. 4868 */ > 4869 static unsigned long > 4870 bpf_sk_lookup(struct sk_buff *skb, struct bpf_sock_tuple *tuple, u32 > len, 4871 u8 proto, u32 netns_id, u64 flags) 4872 { 4873 struct net *caller_net = dev_net(skb->dev); 4874 struct sock *sk = NULL; 4875 struct net *net; 4876 4877 if (unlikely(len != sizeof(struct bpf_sock_tuple) || flags || 4878 (tuple->family != AF_INET && tuple->family != AF_INET6))) 4879 goto out; 4880 4881 if (netns_id) 4882 net = get_net_ns_by_id(caller_net, netns_id); 4883 else 4884 net = caller_net; 4885 if (unlikely(!net)) 4886 goto out; 4887 sk = sk_lookup(net, tuple, skb, proto); 4888 put_net(net); 4889 4890 if (sk) 4891 sk = sk_to_full_sk(sk); 4892 out: 4893 return (unsigned long) sk; 4894 } 4895 > 4896 BPF_CALL_5(bpf_sk_lookup_tcp, struct sk_buff *, skb, 4897 struct bpf_sock_tuple *, tuple, u32, len, u32, netns_id, u64, flags) 4898 { 4899 return bpf_sk_lookup(skb, tuple, len, IPPROTO_TCP, netns_id, flags); 4900 } 4901 4902 static const struct bpf_func_proto bpf_sk_lookup_tcp_proto = { > 4903 .func = bpf_sk_lookup_tcp, 4904 .gpl_only = false, 4905 .ret_type = RET_PTR_TO_SOCKET_OR_NULL, 4906 .arg1_type = ARG_PTR_TO_CTX, 4907 .arg2_type = ARG_PTR_TO_MEM, 4908 .arg3_type = ARG_CONST_SIZE, 4909 .arg4_type = ARG_ANYTHING, 4910 .arg5_type = ARG_ANYTHING, 4911 }; 4912 > 4913 BPF_CALL_5(bpf_sk_lookup_udp, struct sk_buff *, skb, 4914 struct bpf_sock_tuple *, tuple, u32, len, u32, netns_id, u64, flags) 4915 { 4916 return bpf_sk_lookup(skb, tuple, len, IPPROTO_UDP, netns_id, flags); 4917 } 4918 4919 static const struct bpf_func_proto bpf_sk_lookup_udp_proto = { 4920 .func = bpf_sk_lookup_udp, 4921 .gpl_only = false, 4922 .ret_type = RET_PTR_TO_SOCKET_OR_NULL, 4923 .arg1_type = ARG_PTR_TO_CTX, 4924 .arg2_type = ARG_PTR_TO_MEM, 4925 .arg3_type = ARG_CONST_SIZE, 4926 .arg4_type = ARG_ANYTHING, 4927 .arg5_type = ARG_ANYTHING, 4928 }; 4929 > 4930 BPF_CALL_2(bpf_sk_release, struct sock *, sk, u64, flags) 4931 { 4932 if (!sock_flag(sk, SOCK_RCU_FREE)) 4933 sock_gen_put(sk); 4934 4935 if (unlikely(flags)) 4936 return -EINVAL; 4937 return 0; 4938 } 4939 4940 static const struct bpf_func_proto bpf_sk_release_proto = { > 4941 .func = bpf_sk_release, 4942 .gpl_only = false, 4943 .ret_type = RET_INTEGER, 4944 .arg1_type = ARG_PTR_TO_SOCKET, 4945 .arg2_type = ARG_ANYTHING, 4946 }; 4947 4948 bool bpf_helper_changes_pkt_data(void *func) 4949 { 4950 if (func == bpf_skb_vlan_push || 4951 func == bpf_skb_vlan_pop || 4952 func == bpf_skb_store_bytes || 4953 func == bpf_skb_change_proto || 4954 func == bpf_skb_change_head || 4955 func == sk_skb_change_head || 4956 func == bpf_skb_change_tail || 4957 func == sk_skb_change_tail || 4958 func == bpf_skb_adjust_room || 4959 func == bpf_skb_pull_data || 4960 func == sk_skb_pull_data || 4961 func == bpf_clone_redirect || 4962 func == bpf_l3_csum_replace || 4963 func == bpf_l4_csum_replace || 4964 func == bpf_xdp_adjust_head || 4965 func == bpf_xdp_adjust_meta || 4966 func == bpf_msg_pull_data || 4967 func == bpf_xdp_adjust_tail || 4968 #if IS_ENABLED(CONFIG_IPV6_SEG6_BPF) 4969 func == bpf_lwt_seg6_store_bytes || 4970 func == bpf_lwt_seg6_adjust_srh || 4971 func == bpf_lwt_seg6_action || 4972 #endif 4973 func == bpf_lwt_push_encap) 4974 return true; 4975 4976 return false; 4977 } 4978 4979 static const struct bpf_func_proto * > 4980 bpf_base_func_proto(enum bpf_func_id func_id) 4981 { 4982 switch (func_id) { 4983 case BPF_FUNC_map_lookup_elem: 4984 return &bpf_map_lookup_elem_proto; 4985 case BPF_FUNC_map_update_elem: 4986 return &bpf_map_update_elem_proto; 4987 case BPF_FUNC_map_delete_elem: 4988 return &bpf_map_delete_elem_proto; 4989 case BPF_FUNC_get_prandom_u32: 4990 return &bpf_get_prandom_u32_proto; 4991 case BPF_FUNC_get_smp_processor_id: 4992 return &bpf_get_raw_smp_processor_id_proto; 4993 case BPF_FUNC_get_numa_node_id: 4994 return &bpf_get_numa_node_id_proto; 4995 case BPF_FUNC_tail_call: 4996 return &bpf_tail_call_proto; 4997 case BPF_FUNC_ktime_get_ns: 4998 return &bpf_ktime_get_ns_proto; 4999 case BPF_FUNC_trace_printk: 5000 if (capable(CAP_SYS_ADMIN)) 5001 return bpf_get_trace_printk_proto(); 5002 /* else: fall through */ 5003 default: 5004 return NULL; 5005 } 5006 } 5007 5008 static const struct bpf_func_proto * > 5009 sock_filter_func_proto(enum bpf_func_id func_id, const struct bpf_prog > *prog) 5010 { 5011 switch (func_id) { 5012 /* inet and inet6 sockets are created in a process 5013 * context so there is always a valid uid/gid 5014 */ 5015 case BPF_FUNC_get_current_uid_gid: 5016 return &bpf_get_current_uid_gid_proto; 5017 case BPF_FUNC_get_local_storage: 5018 return &bpf_get_local_storage_proto; 5019 default: 5020 return bpf_base_func_proto(func_id); 5021 } 5022 } 5023 5024 static const struct bpf_func_proto * > 5025 sock_addr_func_proto(enum bpf_func_id func_id, const struct bpf_prog > *prog) 5026 { 5027 switch (func_id) { 5028 /* inet and inet6 sockets are created in a process 5029 * context so there is always a valid uid/gid 5030 */ 5031 case BPF_FUNC_get_current_uid_gid: 5032 return &bpf_get_current_uid_gid_proto; 5033 case BPF_FUNC_bind: 5034 switch (prog->expected_attach_type) { 5035 case BPF_CGROUP_INET4_CONNECT: 5036 case BPF_CGROUP_INET6_CONNECT: 5037 return &bpf_bind_proto; 5038 default: 5039 return NULL; 5040 } 5041 case BPF_FUNC_get_socket_cookie: 5042 return &bpf_get_socket_cookie_sock_addr_proto; 5043 case BPF_FUNC_get_local_storage: 5044 return &bpf_get_local_storage_proto; 5045 default: 5046 return bpf_base_func_proto(func_id); 5047 } 5048 } 5049 5050 static const struct bpf_func_proto * > 5051 sk_filter_func_proto(enum bpf_func_id func_id, const struct bpf_prog > *prog) 5052 { 5053 switch (func_id) { 5054 case BPF_FUNC_skb_load_bytes: 5055 return &bpf_skb_load_bytes_proto; 5056 case BPF_FUNC_skb_load_bytes_relative: 5057 return &bpf_skb_load_bytes_relative_proto; 5058 case BPF_FUNC_get_socket_cookie: 5059 return &bpf_get_socket_cookie_proto; 5060 case BPF_FUNC_get_socket_uid: 5061 return &bpf_get_socket_uid_proto; 5062 default: 5063 return bpf_base_func_proto(func_id); 5064 } 5065 } 5066 5067 static const struct bpf_func_proto * > 5068 cg_skb_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) 5069 { 5070 switch (func_id) { 5071 case BPF_FUNC_get_local_storage: 5072 return &bpf_get_local_storage_proto; 5073 default: 5074 return sk_filter_func_proto(func_id, prog); 5075 } 5076 } 5077 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
.config.gz
Description: application/gzip