lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 15 Jul 2020 10:50:46 +0800
From:   kernel test robot <lkp@...el.com>
To:     Dmitry Yakunin <zeil@...dex-team.ru>, alexei.starovoitov@...il.com,
        daniel@...earbox.net, netdev@...r.kernel.org, bpf@...r.kernel.org
Cc:     kbuild-all@...ts.01.org, clang-built-linux@...glegroups.com,
        sdf@...gle.com
Subject: Re: [PATCH bpf-next v2 1/4] bpf: setup socket family and addresses
 in bpf_prog_test_run_skb

Hi Dmitry,

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/Dmitry-Yakunin/bpf-cgroup-skb-improvements-for-bpf_prog_test_run/20200715-041420
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: arm64-randconfig-r005-20200714 (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 02946de3802d3bc65bc9f2eb9b8d4969b5a7add8)
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
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>

All errors (new ones prefixed by >>):

   net/bpf/test_run.c:120:14: warning: no previous prototype for function 'bpf_fentry_test1' [-Wmissing-prototypes]
   int noinline bpf_fentry_test1(int a)
                ^
   net/bpf/test_run.c:120:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int noinline bpf_fentry_test1(int a)
   ^
   static 
   net/bpf/test_run.c:125:14: warning: no previous prototype for function 'bpf_fentry_test2' [-Wmissing-prototypes]
   int noinline bpf_fentry_test2(int a, u64 b)
                ^
   net/bpf/test_run.c:125:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int noinline bpf_fentry_test2(int a, u64 b)
   ^
   static 
   net/bpf/test_run.c:130:14: warning: no previous prototype for function 'bpf_fentry_test3' [-Wmissing-prototypes]
   int noinline bpf_fentry_test3(char a, int b, u64 c)
                ^
   net/bpf/test_run.c:130:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int noinline bpf_fentry_test3(char a, int b, u64 c)
   ^
   static 
   net/bpf/test_run.c:135:14: warning: no previous prototype for function 'bpf_fentry_test4' [-Wmissing-prototypes]
   int noinline bpf_fentry_test4(void *a, char b, int c, u64 d)
                ^
   net/bpf/test_run.c:135:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int noinline bpf_fentry_test4(void *a, char b, int c, u64 d)
   ^
   static 
   net/bpf/test_run.c:140:14: warning: no previous prototype for function 'bpf_fentry_test5' [-Wmissing-prototypes]
   int noinline bpf_fentry_test5(u64 a, void *b, short c, int d, u64 e)
                ^
   net/bpf/test_run.c:140:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int noinline bpf_fentry_test5(u64 a, void *b, short c, int d, u64 e)
   ^
   static 
   net/bpf/test_run.c:145:14: warning: no previous prototype for function 'bpf_fentry_test6' [-Wmissing-prototypes]
   int noinline bpf_fentry_test6(u64 a, void *b, short c, int d, void *e, u64 f)
                ^
   net/bpf/test_run.c:145:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int noinline bpf_fentry_test6(u64 a, void *b, short c, int d, void *e, u64 f)
   ^
   static 
   net/bpf/test_run.c:154:14: warning: no previous prototype for function 'bpf_fentry_test7' [-Wmissing-prototypes]
   int noinline bpf_fentry_test7(struct bpf_fentry_test_t *arg)
                ^
   net/bpf/test_run.c:154:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int noinline bpf_fentry_test7(struct bpf_fentry_test_t *arg)
   ^
   static 
   net/bpf/test_run.c:159:14: warning: no previous prototype for function 'bpf_fentry_test8' [-Wmissing-prototypes]
   int noinline bpf_fentry_test8(struct bpf_fentry_test_t *arg)
                ^
   net/bpf/test_run.c:159:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int noinline bpf_fentry_test8(struct bpf_fentry_test_t *arg)
   ^
   static 
   net/bpf/test_run.c:164:14: warning: no previous prototype for function 'bpf_modify_return_test' [-Wmissing-prototypes]
   int noinline bpf_modify_return_test(int a, int *b)
                ^
   net/bpf/test_run.c:164:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int noinline bpf_modify_return_test(int a, int *b)
   ^
   static 
>> net/bpf/test_run.c:460:7: error: no member named 'skc_v6_rcv_saddr' in 'struct sock_common'; did you mean 'skc_rcv_saddr'?
                   sk->sk_v6_rcv_saddr = ipv6_hdr(skb)->saddr;
                       ^
   include/net/sock.h:380:37: note: expanded from macro 'sk_v6_rcv_saddr'
   #define sk_v6_rcv_saddr __sk_common.skc_v6_rcv_saddr
                                       ^
   include/net/sock.h:169:11: note: 'skc_rcv_saddr' declared here
                           __be32  skc_rcv_saddr;
                                   ^
>> net/bpf/test_run.c:460:23: error: assigning to '__be32' (aka 'unsigned int') from incompatible type 'struct in6_addr'
                   sk->sk_v6_rcv_saddr = ipv6_hdr(skb)->saddr;
                                       ^ ~~~~~~~~~~~~~~~~~~~~
>> net/bpf/test_run.c:461:7: error: no member named 'skc_v6_daddr' in 'struct sock_common'; did you mean 'skc_daddr'?
                   sk->sk_v6_daddr = ipv6_hdr(skb)->daddr;
                       ^
   include/net/sock.h:379:34: note: expanded from macro 'sk_v6_daddr'
   #define sk_v6_daddr             __sk_common.skc_v6_daddr
                                               ^
   include/net/sock.h:168:11: note: 'skc_daddr' declared here
                           __be32  skc_daddr;
                                   ^
   net/bpf/test_run.c:461:19: error: assigning to '__be32' (aka 'unsigned int') from incompatible type 'struct in6_addr'
                   sk->sk_v6_daddr = ipv6_hdr(skb)->daddr;
                                   ^ ~~~~~~~~~~~~~~~~~~~~
   9 warnings and 4 errors generated.

vim +460 net/bpf/test_run.c

   389	
   390	int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr,
   391				  union bpf_attr __user *uattr)
   392	{
   393		bool is_l2 = false, is_direct_pkt_access = false;
   394		u32 size = kattr->test.data_size_in;
   395		u32 repeat = kattr->test.repeat;
   396		struct __sk_buff *ctx = NULL;
   397		u32 retval, duration;
   398		int hh_len = ETH_HLEN;
   399		struct sk_buff *skb;
   400		struct sock *sk;
   401		void *data;
   402		int ret;
   403	
   404		data = bpf_test_init(kattr, size, NET_SKB_PAD + NET_IP_ALIGN,
   405				     SKB_DATA_ALIGN(sizeof(struct skb_shared_info)));
   406		if (IS_ERR(data))
   407			return PTR_ERR(data);
   408	
   409		ctx = bpf_ctx_init(kattr, sizeof(struct __sk_buff));
   410		if (IS_ERR(ctx)) {
   411			kfree(data);
   412			return PTR_ERR(ctx);
   413		}
   414	
   415		switch (prog->type) {
   416		case BPF_PROG_TYPE_SCHED_CLS:
   417		case BPF_PROG_TYPE_SCHED_ACT:
   418			is_l2 = true;
   419			/* fall through */
   420		case BPF_PROG_TYPE_LWT_IN:
   421		case BPF_PROG_TYPE_LWT_OUT:
   422		case BPF_PROG_TYPE_LWT_XMIT:
   423			is_direct_pkt_access = true;
   424			break;
   425		default:
   426			break;
   427		}
   428	
   429		sk = kzalloc(sizeof(struct sock), GFP_USER);
   430		if (!sk) {
   431			kfree(data);
   432			kfree(ctx);
   433			return -ENOMEM;
   434		}
   435		sock_net_set(sk, current->nsproxy->net_ns);
   436		sock_init_data(NULL, sk);
   437	
   438		skb = build_skb(data, 0);
   439		if (!skb) {
   440			kfree(data);
   441			kfree(ctx);
   442			kfree(sk);
   443			return -ENOMEM;
   444		}
   445		skb->sk = sk;
   446	
   447		skb_reserve(skb, NET_SKB_PAD + NET_IP_ALIGN);
   448		__skb_put(skb, size);
   449		skb->protocol = eth_type_trans(skb, current->nsproxy->net_ns->loopback_dev);
   450		skb_reset_network_header(skb);
   451	
   452		switch (skb->protocol) {
   453		case htons(ETH_P_IP):
   454			sk->sk_family = AF_INET;
   455			sk->sk_rcv_saddr = ip_hdr(skb)->saddr;
   456			sk->sk_daddr = ip_hdr(skb)->daddr;
   457			break;
   458		case htons(ETH_P_IPV6):
   459			sk->sk_family = AF_INET6;
 > 460			sk->sk_v6_rcv_saddr = ipv6_hdr(skb)->saddr;
 > 461			sk->sk_v6_daddr = ipv6_hdr(skb)->daddr;
   462			break;
   463		default:
   464			break;
   465		}
   466	
   467		if (is_l2)
   468			__skb_push(skb, hh_len);
   469		if (is_direct_pkt_access)
   470			bpf_compute_data_pointers(skb);
   471		ret = convert___skb_to_skb(skb, ctx);
   472		if (ret)
   473			goto out;
   474		ret = bpf_test_run(prog, skb, repeat, &retval, &duration, false);
   475		if (ret)
   476			goto out;
   477		if (!is_l2) {
   478			if (skb_headroom(skb) < hh_len) {
   479				int nhead = HH_DATA_ALIGN(hh_len - skb_headroom(skb));
   480	
   481				if (pskb_expand_head(skb, nhead, 0, GFP_USER)) {
   482					ret = -ENOMEM;
   483					goto out;
   484				}
   485			}
   486			memset(__skb_push(skb, hh_len), 0, hh_len);
   487		}
   488		convert_skb_to___skb(skb, ctx);
   489	
   490		size = skb->len;
   491		/* bpf program can never convert linear skb to non-linear */
   492		if (WARN_ON_ONCE(skb_is_nonlinear(skb)))
   493			size = skb_headlen(skb);
   494		ret = bpf_test_finish(kattr, uattr, skb->data, size, retval, duration);
   495		if (!ret)
   496			ret = bpf_ctx_finish(kattr, uattr, ctx,
   497					     sizeof(struct __sk_buff));
   498	out:
   499		kfree_skb(skb);
   500		bpf_sk_storage_free(sk);
   501		kfree(sk);
   502		kfree(ctx);
   503		return ret;
   504	}
   505	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Download attachment ".config.gz" of type "application/gzip" (34041 bytes)

Powered by blists - more mailing lists