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  linux-cve-announce  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]
Message-ID: <202101151446.9FdwBFaW-lkp@intel.com>
Date:   Fri, 15 Jan 2021 14:55:06 +0800
From:   kernel test robot <lkp@...el.com>
To:     Stanislav Fomichev <sdf@...gle.com>, netdev@...r.kernel.org,
        bpf@...r.kernel.org
Cc:     kbuild-all@...ts.01.org, ast@...nel.org, daniel@...earbox.net,
        Stanislav Fomichev <sdf@...gle.com>
Subject: Re: [RPC PATCH bpf-next] bpf: implement new
 BPF_CGROUP_INET_SOCK_POST_CONNECT

Hi Stanislav,

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/Stanislav-Fomichev/bpf-implement-new-BPF_CGROUP_INET_SOCK_POST_CONNECT/20210115-112524
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: arm-randconfig-r014-20210115 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
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://github.com/0day-ci/linux/commit/342141c74fe4ece77f9d9753918a77e66d9d3316
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Stanislav-Fomichev/bpf-implement-new-BPF_CGROUP_INET_SOCK_POST_CONNECT/20210115-112524
        git checkout 342141c74fe4ece77f9d9753918a77e66d9d3316
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm 

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/ipv4/af_inet.c: In function 'inet_dgram_connect':
>> net/ipv4/af_inet.c:579:9: error: implicit declaration of function 'BPF_CGROUP_RUN_PROG_INET_SOCK_POST_CONNECT_LOCKED'; did you mean 'BPF_CGROUP_RUN_PROG_INET6_CONNECT_LOCK'? [-Werror=implicit-function-declaration]
     579 |   err = BPF_CGROUP_RUN_PROG_INET_SOCK_POST_CONNECT_LOCKED(sk);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |         BPF_CGROUP_RUN_PROG_INET6_CONNECT_LOCK
   net/ipv4/af_inet.c: In function 'inet_stream_connect':
>> net/ipv4/af_inet.c:730:9: error: implicit declaration of function 'BPF_CGROUP_RUN_PROG_INET_SOCK_POST_CONNECT'; did you mean 'BPF_CGROUP_RUN_PROG_INET6_CONNECT'? [-Werror=implicit-function-declaration]
     730 |   err = BPF_CGROUP_RUN_PROG_INET_SOCK_POST_CONNECT(sock->sk);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |         BPF_CGROUP_RUN_PROG_INET6_CONNECT
   cc1: some warnings being treated as errors


vim +579 net/ipv4/af_inet.c

   557	
   558	int inet_dgram_connect(struct socket *sock, struct sockaddr *uaddr,
   559			       int addr_len, int flags)
   560	{
   561		struct sock *sk = sock->sk;
   562		int err;
   563	
   564		if (addr_len < sizeof(uaddr->sa_family))
   565			return -EINVAL;
   566		if (uaddr->sa_family == AF_UNSPEC)
   567			return sk->sk_prot->disconnect(sk, flags);
   568	
   569		if (BPF_CGROUP_PRE_CONNECT_ENABLED(sk)) {
   570			err = sk->sk_prot->pre_connect(sk, uaddr, addr_len);
   571			if (err)
   572				return err;
   573		}
   574	
   575		if (!inet_sk(sk)->inet_num && inet_autobind(sk))
   576			return -EAGAIN;
   577		err = sk->sk_prot->connect(sk, uaddr, addr_len);
   578		if (!err)
 > 579			err = BPF_CGROUP_RUN_PROG_INET_SOCK_POST_CONNECT_LOCKED(sk);
   580		return err;
   581	}
   582	EXPORT_SYMBOL(inet_dgram_connect);
   583	
   584	static long inet_wait_for_connect(struct sock *sk, long timeo, int writebias)
   585	{
   586		DEFINE_WAIT_FUNC(wait, woken_wake_function);
   587	
   588		add_wait_queue(sk_sleep(sk), &wait);
   589		sk->sk_write_pending += writebias;
   590	
   591		/* Basic assumption: if someone sets sk->sk_err, he _must_
   592		 * change state of the socket from TCP_SYN_*.
   593		 * Connect() does not allow to get error notifications
   594		 * without closing the socket.
   595		 */
   596		while ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV)) {
   597			release_sock(sk);
   598			timeo = wait_woken(&wait, TASK_INTERRUPTIBLE, timeo);
   599			lock_sock(sk);
   600			if (signal_pending(current) || !timeo)
   601				break;
   602		}
   603		remove_wait_queue(sk_sleep(sk), &wait);
   604		sk->sk_write_pending -= writebias;
   605		return timeo;
   606	}
   607	
   608	/*
   609	 *	Connect to a remote host. There is regrettably still a little
   610	 *	TCP 'magic' in here.
   611	 */
   612	int __inet_stream_connect(struct socket *sock, struct sockaddr *uaddr,
   613				  int addr_len, int flags, int is_sendmsg)
   614	{
   615		struct sock *sk = sock->sk;
   616		int err;
   617		long timeo;
   618	
   619		/*
   620		 * uaddr can be NULL and addr_len can be 0 if:
   621		 * sk is a TCP fastopen active socket and
   622		 * TCP_FASTOPEN_CONNECT sockopt is set and
   623		 * we already have a valid cookie for this socket.
   624		 * In this case, user can call write() after connect().
   625		 * write() will invoke tcp_sendmsg_fastopen() which calls
   626		 * __inet_stream_connect().
   627		 */
   628		if (uaddr) {
   629			if (addr_len < sizeof(uaddr->sa_family))
   630				return -EINVAL;
   631	
   632			if (uaddr->sa_family == AF_UNSPEC) {
   633				err = sk->sk_prot->disconnect(sk, flags);
   634				sock->state = err ? SS_DISCONNECTING : SS_UNCONNECTED;
   635				goto out;
   636			}
   637		}
   638	
   639		switch (sock->state) {
   640		default:
   641			err = -EINVAL;
   642			goto out;
   643		case SS_CONNECTED:
   644			err = -EISCONN;
   645			goto out;
   646		case SS_CONNECTING:
   647			if (inet_sk(sk)->defer_connect)
   648				err = is_sendmsg ? -EINPROGRESS : -EISCONN;
   649			else
   650				err = -EALREADY;
   651			/* Fall out of switch with err, set for this state */
   652			break;
   653		case SS_UNCONNECTED:
   654			err = -EISCONN;
   655			if (sk->sk_state != TCP_CLOSE)
   656				goto out;
   657	
   658			if (BPF_CGROUP_PRE_CONNECT_ENABLED(sk)) {
   659				err = sk->sk_prot->pre_connect(sk, uaddr, addr_len);
   660				if (err)
   661					goto out;
   662			}
   663	
   664			err = sk->sk_prot->connect(sk, uaddr, addr_len);
   665			if (err < 0)
   666				goto out;
   667	
   668			sock->state = SS_CONNECTING;
   669	
   670			if (!err && inet_sk(sk)->defer_connect)
   671				goto out;
   672	
   673			/* Just entered SS_CONNECTING state; the only
   674			 * difference is that return value in non-blocking
   675			 * case is EINPROGRESS, rather than EALREADY.
   676			 */
   677			err = -EINPROGRESS;
   678			break;
   679		}
   680	
   681		timeo = sock_sndtimeo(sk, flags & O_NONBLOCK);
   682	
   683		if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV)) {
   684			int writebias = (sk->sk_protocol == IPPROTO_TCP) &&
   685					tcp_sk(sk)->fastopen_req &&
   686					tcp_sk(sk)->fastopen_req->data ? 1 : 0;
   687	
   688			/* Error code is set above */
   689			if (!timeo || !inet_wait_for_connect(sk, timeo, writebias))
   690				goto out;
   691	
   692			err = sock_intr_errno(timeo);
   693			if (signal_pending(current))
   694				goto out;
   695		}
   696	
   697		/* Connection was closed by RST, timeout, ICMP error
   698		 * or another process disconnected us.
   699		 */
   700		if (sk->sk_state == TCP_CLOSE)
   701			goto sock_error;
   702	
   703		/* sk->sk_err may be not zero now, if RECVERR was ordered by user
   704		 * and error was received after socket entered established state.
   705		 * Hence, it is handled normally after connect() return successfully.
   706		 */
   707	
   708		sock->state = SS_CONNECTED;
   709		err = 0;
   710	out:
   711		return err;
   712	
   713	sock_error:
   714		err = sock_error(sk) ? : -ECONNABORTED;
   715		sock->state = SS_UNCONNECTED;
   716		if (sk->sk_prot->disconnect(sk, flags))
   717			sock->state = SS_DISCONNECTING;
   718		goto out;
   719	}
   720	EXPORT_SYMBOL(__inet_stream_connect);
   721	
   722	int inet_stream_connect(struct socket *sock, struct sockaddr *uaddr,
   723				int addr_len, int flags)
   724	{
   725		int err;
   726	
   727		lock_sock(sock->sk);
   728		err = __inet_stream_connect(sock, uaddr, addr_len, flags, 0);
   729		if (!err)
 > 730			err = BPF_CGROUP_RUN_PROG_INET_SOCK_POST_CONNECT(sock->sk);
   731		release_sock(sock->sk);
   732		return err;
   733	}
   734	EXPORT_SYMBOL(inet_stream_connect);
   735	

---
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" (31558 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ