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: powerpc64-randconfig-r021-20210115 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 
5b42fd8dd4e7e29125a09a41a33af7c9cb57d144)
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 powerpc64 cross compiling tool for clang build
        # apt-get install binutils-powerpc64-linux-gnu
        # 
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=clang make.cross 
ARCH=powerpc64 

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

All errors (new ones prefixed by >>):

   __do_insb
   ^
   arch/powerpc/include/asm/io.h:556:56: note: expanded from macro '__do_insb'
   #define __do_insb(p, b, n)      readsb((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
                                          ~~~~~~~~~~~~~~~~~~~~~^
   In file included from net/ipv4/af_inet.c:81:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:10:
   In file included from arch/powerpc/include/asm/hardirq.h:6:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:45:1: warning: performing pointer 
arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(insw, (unsigned long p, void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 
'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:100:1: note: expanded from here
   __do_insw
   ^
   arch/powerpc/include/asm/io.h:557:56: note: expanded from macro '__do_insw'
   #define __do_insw(p, b, n)      readsw((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
                                          ~~~~~~~~~~~~~~~~~~~~~^
   In file included from net/ipv4/af_inet.c:81:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:10:
   In file included from arch/powerpc/include/asm/hardirq.h:6:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:47:1: warning: performing pointer 
arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(insl, (unsigned long p, void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 
'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:102:1: note: expanded from here
   __do_insl
   ^
   arch/powerpc/include/asm/io.h:558:56: note: expanded from macro '__do_insl'
   #define __do_insl(p, b, n)      readsl((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
                                          ~~~~~~~~~~~~~~~~~~~~~^
   In file included from net/ipv4/af_inet.c:81:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:10:
   In file included from arch/powerpc/include/asm/hardirq.h:6:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:49:1: warning: performing pointer 
arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(outsb, (unsigned long p, const void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 
'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:104:1: note: expanded from here
   __do_outsb
   ^
   arch/powerpc/include/asm/io.h:559:58: note: expanded from macro '__do_outsb'
   #define __do_outsb(p, b, n)     writesb((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
                                           ~~~~~~~~~~~~~~~~~~~~~^
   In file included from net/ipv4/af_inet.c:81:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:10:
   In file included from arch/powerpc/include/asm/hardirq.h:6:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:51:1: warning: performing pointer 
arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(outsw, (unsigned long p, const void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 
'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:106:1: note: expanded from here
   __do_outsw
   ^
   arch/powerpc/include/asm/io.h:560:58: note: expanded from macro '__do_outsw'
   #define __do_outsw(p, b, n)     writesw((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
                                           ~~~~~~~~~~~~~~~~~~~~~^
   In file included from net/ipv4/af_inet.c:81:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:10:
   In file included from arch/powerpc/include/asm/hardirq.h:6:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:53:1: warning: performing pointer 
arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(outsl, (unsigned long p, const void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 
'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:108:1: note: expanded from here
   __do_outsl
   ^
   arch/powerpc/include/asm/io.h:561:58: note: expanded from macro '__do_outsl'
   #define __do_outsl(p, b, n)     writesl((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
                                           ~~~~~~~~~~~~~~~~~~~~~^
>> net/ipv4/af_inet.c:579:9: error: implicit declaration of function 
>> 'BPF_CGROUP_RUN_PROG_INET_SOCK_POST_CONNECT_LOCKED' 
>> [-Werror,-Wimplicit-function-declaration]
                   err = BPF_CGROUP_RUN_PROG_INET_SOCK_POST_CONNECT_LOCKED(sk);
                         ^
>> net/ipv4/af_inet.c:730:9: error: implicit declaration of function 
>> 'BPF_CGROUP_RUN_PROG_INET_SOCK_POST_CONNECT' 
>> [-Werror,-Wimplicit-function-declaration]
                   err = BPF_CGROUP_RUN_PROG_INET_SOCK_POST_CONNECT(sock->sk);
                         ^
   6 warnings and 2 errors generated.


vim +/BPF_CGROUP_RUN_PROG_INET_SOCK_POST_CONNECT_LOCKED +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-...@lists.01.org

Attachment: .config.gz
Description: application/gzip

Reply via email to