All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next v1 0/5] sockmap: add sockmap support for unix stream socket
@ 2021-07-27  0:12 Jiang Wang
  2021-07-27  0:12 ` [PATCH bpf-next v1 1/5] af_unix: add read_sock for stream socket types Jiang Wang
                   ` (5 more replies)
  0 siblings, 6 replies; 20+ messages in thread
From: Jiang Wang @ 2021-07-27  0:12 UTC (permalink / raw)
  To: netdev
  Cc: cong.wang, duanxiongchun, xieyongji, chaiwen.cc, David S. Miller,
	Jakub Kicinski, John Fastabend, Daniel Borkmann, Jakub Sitnicki,
	Lorenz Bauer, Alexei Starovoitov, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, KP Singh, Shuah Khan,
	Johan Almbladh, linux-kernel, bpf, linux-kselftest

This patch series add support for unix stream type
for sockmap. Sockmap already supports TCP, UDP,
unix dgram types. The unix stream support is similar
to unix dgram.

Also add selftests for unix stream type in sockmap tests.


Jiang Wang (5):
  af_unix: add read_sock for stream socket types
  af_unix: add unix_stream_proto for sockmap
  selftest/bpf: add tests for sockmap with unix stream type.
  selftest/bpf: change udp to inet in some function names
  selftest/bpf: add new tests in sockmap for unix stream to tcp.

 include/net/af_unix.h                         |  8 +-
 net/core/sock_map.c                           |  8 +-
 net/unix/af_unix.c                            | 89 ++++++++++++++++--
 net/unix/unix_bpf.c                           | 93 ++++++++++++++-----
 .../selftests/bpf/prog_tests/sockmap_listen.c | 48 ++++++----
 5 files changed, 194 insertions(+), 52 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 20+ messages in thread
* Re: [PATCH bpf-next v1 2/5] af_unix: add unix_stream_proto for sockmap
@ 2021-07-27 16:38 kernel test robot
  2021-07-28  0:38   ` kernel test robot
  0 siblings, 1 reply; 20+ messages in thread
From: kernel test robot @ 2021-07-27 16:38 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 18118 bytes --]

CC: clang-built-linux(a)googlegroups.com
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20210727001252.1287673-3-jiang.wang@bytedance.com>
References: <20210727001252.1287673-3-jiang.wang@bytedance.com>
TO: Jiang Wang <jiang.wang@bytedance.com>
TO: netdev(a)vger.kernel.org
CC: cong.wang(a)bytedance.com
CC: duanxiongchun(a)bytedance.com
CC: xieyongji(a)bytedance.com
CC: chaiwen.cc(a)bytedance.com
CC: Jakub Kicinski <kuba@kernel.org>
CC: John Fastabend <john.fastabend@gmail.com>
CC: Daniel Borkmann <daniel@iogearbox.net>
CC: Jakub Sitnicki <jakub@cloudflare.com>
CC: Lorenz Bauer <lmb@cloudflare.com>

Hi Jiang,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on bpf-next/master]

url:    https://github.com/0day-ci/linux/commits/Jiang-Wang/sockmap-add-sockmap-support-for-unix-stream-socket/20210727-081531
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
:::::: branch date: 16 hours ago
:::::: commit date: 16 hours ago
config: x86_64-randconfig-c001-20210726 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project c658b472f3e61e1818e1909bf02f3d65470018a5)
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 x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://github.com/0day-ci/linux/commit/607ed02e3232aa57995e87230faad770b810a64a
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Jiang-Wang/sockmap-add-sockmap-support-for-unix-stream-socket/20210727-081531
        git checkout 607ed02e3232aa57995e87230faad770b810a64a
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer 

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


clang-analyzer warnings: (new ones prefixed by >>)
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
                                                                      ^
   net/bridge/br_multicast.c:970:3: note: Taking false branch
                   hlist_for_each_entry(ent, &pg->src_list, node) {
                   ^
   include/linux/list.h:993:13: note: expanded from macro 'hlist_for_each_entry'
           for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\
                      ^
   include/linux/list.h:983:15: note: expanded from macro 'hlist_entry_safe'
              ____ptr ? hlist_entry(____ptr, type, member) : NULL; \
                        ^
   include/linux/list.h:972:40: note: expanded from macro 'hlist_entry'
   #define hlist_entry(ptr, type, member) container_of(ptr,type,member)
                                          ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:308:3: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   net/bridge/br_multicast.c:970:3: note: Loop condition is false.  Exiting loop
                   hlist_for_each_entry(ent, &pg->src_list, node) {
                   ^
   include/linux/list.h:993:13: note: expanded from macro 'hlist_for_each_entry'
           for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\
                      ^
   include/linux/list.h:983:15: note: expanded from macro 'hlist_entry_safe'
              ____ptr ? hlist_entry(____ptr, type, member) : NULL; \
                        ^
   include/linux/list.h:972:40: note: expanded from macro 'hlist_entry'
   #define hlist_entry(ptr, type, member) container_of(ptr,type,member)
                                          ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:306:2: note: expanded from macro '__compiletime_assert'
           do {                                                            \
           ^
   net/bridge/br_multicast.c:970:3: note: Loop condition is true.  Entering loop body
                   hlist_for_each_entry(ent, &pg->src_list, node) {
                   ^
   include/linux/list.h:993:2: note: expanded from macro 'hlist_for_each_entry'
           for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\
           ^
   net/bridge/br_multicast.c:971:21: note: Left side of '&&' is true
                           if (over_llqt == time_after(ent->timer.expires,
                                            ^
   include/linux/jiffies.h:105:3: note: expanded from macro 'time_after'
           (typecheck(unsigned long, a) && \
            ^
   include/linux/typecheck.h:9:27: note: expanded from macro 'typecheck'
   #define typecheck(type,x) \
                             ^
   net/bridge/br_multicast.c:971:21: note: Left side of '&&' is true
                           if (over_llqt == time_after(ent->timer.expires,
                                            ^
   include/linux/jiffies.h:105:3: note: expanded from macro 'time_after'
           (typecheck(unsigned long, a) && \
            ^
   include/linux/typecheck.h:9:27: note: expanded from macro 'typecheck'
   #define typecheck(type,x) \
                             ^
   net/bridge/br_multicast.c:971:21: note: The left operand of '-' is a garbage value
                           if (over_llqt == time_after(ent->timer.expires,
                                            ^
   include/linux/jiffies.h:107:15: note: expanded from macro 'time_after'
            ((long)((b) - (a)) < 0))
                     ~  ^
   Suppressed 4 warnings (4 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   Suppressed 3 warnings (3 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   Suppressed 3 warnings (3 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   Suppressed 3 warnings (3 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   Suppressed 3 warnings (3 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   Suppressed 3 warnings (3 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   4 warnings generated.
   Suppressed 4 warnings (4 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   4 warnings generated.
   Suppressed 4 warnings (4 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   7 warnings generated.
>> net/unix/af_unix.c:837:7: warning: Access to field 'type' results in a dereference of a null pointer (loaded from variable 'sock') [clang-analyzer-core.NullDereference]
                   if (sock->type == SOCK_STREAM)
                       ^
   net/unix/af_unix.c:1299:6: note: 'err' is >= 0
           if (err < 0)
               ^~~
   net/unix/af_unix.c:1299:2: note: Taking false branch
           if (err < 0)
           ^
   net/unix/af_unix.c:1303:6: note: Assuming the condition is false
           if (test_bit(SOCK_PASSCRED, &sock->flags) && !u->addr &&
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/unix/af_unix.c:1303:44: note: Left side of '&&' is false
           if (test_bit(SOCK_PASSCRED, &sock->flags) && !u->addr &&
                                                     ^
   net/unix/af_unix.c:1317:37: note: Passing null pointer value via 2nd parameter 'sock'
           newsk = unix_create1(sock_net(sk), NULL, 0, sock->type);
                                              ^
   include/linux/stddef.h:8:14: note: expanded from macro 'NULL'
   #define NULL ((void *)0)
                ^~~~~~~~~~~
   net/unix/af_unix.c:1317:10: note: Calling 'unix_create1'
           newsk = unix_create1(sock_net(sk), NULL, 0, sock->type);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/unix/af_unix.c:828:6: note: Assuming the condition is false
           if (atomic_long_read(&unix_nr_socks) > 2 * get_max_files())
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/unix/af_unix.c:828:2: note: Taking false branch
           if (atomic_long_read(&unix_nr_socks) > 2 * get_max_files())
           ^
   net/unix/af_unix.c:831:6: note: Assuming 'type' is equal to 0
           if (type != 0) {
               ^~~~~~~~~
   net/unix/af_unix.c:831:2: note: Taking false branch
           if (type != 0) {
           ^
   net/unix/af_unix.c:837:7: note: Access to field 'type' results in a dereference of a null pointer (loaded from variable 'sock')
                   if (sock->type == SOCK_STREAM)
                       ^~~~
   net/unix/af_unix.c:1251:34: warning: Dereference of null pointer [clang-analyzer-core.NullDereference]
                   sk->sk_state = other->sk_state = TCP_ESTABLISHED;
                                  ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
   net/unix/af_unix.c:1189:6: note: Assuming the condition is false
           if (alen < offsetofend(struct sockaddr, sa_family))
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/unix/af_unix.c:1189:2: note: Taking false branch
           if (alen < offsetofend(struct sockaddr, sa_family))
           ^
   net/unix/af_unix.c:1192:6: note: Assuming field 'sa_family' is equal to AF_UNSPEC
           if (addr->sa_family != AF_UNSPEC) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/unix/af_unix.c:1192:2: note: Taking false branch
           if (addr->sa_family != AF_UNSPEC) {
           ^
   net/unix/af_unix.c:1228:3: note: Null pointer value stored to 'other'
                   other = NULL;
                   ^~~~~~~~~~~~
   net/unix/af_unix.c:1235:6: note: Assuming field 'peer' is null
           if (unix_peer(sk)) {
               ^
   net/unix/af_unix.c:180:23: note: expanded from macro 'unix_peer'
   #define unix_peer(sk) (unix_sk(sk)->peer)
                         ^~~~~~~~~~~~~~~~~~~
   net/unix/af_unix.c:1235:2: note: Taking false branch
           if (unix_peer(sk)) {
           ^
   net/unix/af_unix.c:1247:3: note: Calling 'unix_state_double_unlock'
                   unix_state_double_unlock(sk, other);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/unix/af_unix.c:1170:15: note: 'sk1' is not equal to 'sk2'
           if (unlikely(sk1 == sk2) || !sk2) {
                        ^
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   net/unix/af_unix.c:1170:6: note: Left side of '||' is false
           if (unlikely(sk1 == sk2) || !sk2) {
               ^
   include/linux/compiler.h:78:22: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                           ^
   net/unix/af_unix.c:1170:31: note: 'sk2' is null
           if (unlikely(sk1 == sk2) || !sk2) {
                                        ^~~
   net/unix/af_unix.c:1170:2: note: Taking true branch
           if (unlikely(sk1 == sk2) || !sk2) {
           ^
   net/unix/af_unix.c:1171:3: note: Calling 'spin_unlock'
                   unix_state_unlock(sk1);
                   ^
   include/net/af_unix.h:51:30: note: expanded from macro 'unix_state_unlock'
   #define unix_state_unlock(s)    spin_unlock(&unix_sk(s)->lock)
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/spinlock.h:394:2: note: Value assigned to field 'peer', which participates in a condition later
           raw_spin_unlock(&lock->rlock);
           ^
   include/linux/spinlock.h:284:32: note: expanded from macro 'raw_spin_unlock'
   #define raw_spin_unlock(lock)           _raw_spin_unlock(lock)
                                           ^~~~~~~~~~~~~~~~~~~~~~
   net/unix/af_unix.c:1171:3: note: Returning from 'spin_unlock'
                   unix_state_unlock(sk1);

vim +837 net/unix/af_unix.c

^1da177e4c3f41 Linus Torvalds   2005-04-16  821  
607ed02e3232aa Jiang Wang       2021-07-27  822  static struct sock *unix_create1(struct net *net, struct socket *sock, int kern, int type)
^1da177e4c3f41 Linus Torvalds   2005-04-16  823  {
^1da177e4c3f41 Linus Torvalds   2005-04-16  824  	struct sock *sk = NULL;
^1da177e4c3f41 Linus Torvalds   2005-04-16  825  	struct unix_sock *u;
^1da177e4c3f41 Linus Torvalds   2005-04-16  826  
518de9b39e8545 Eric Dumazet     2010-10-26  827  	atomic_long_inc(&unix_nr_socks);
518de9b39e8545 Eric Dumazet     2010-10-26  828  	if (atomic_long_read(&unix_nr_socks) > 2 * get_max_files())
^1da177e4c3f41 Linus Torvalds   2005-04-16  829  		goto out;
^1da177e4c3f41 Linus Torvalds   2005-04-16  830  
607ed02e3232aa Jiang Wang       2021-07-27  831  	if (type != 0) {
607ed02e3232aa Jiang Wang       2021-07-27  832  		if (type == SOCK_STREAM)
607ed02e3232aa Jiang Wang       2021-07-27  833  			sk = sk_alloc(net, PF_UNIX, GFP_KERNEL, &unix_stream_proto, kern);
607ed02e3232aa Jiang Wang       2021-07-27  834  		else /*for seqpacket */
607ed02e3232aa Jiang Wang       2021-07-27  835  			sk = sk_alloc(net, PF_UNIX, GFP_KERNEL, &unix_dgram_proto, kern);
607ed02e3232aa Jiang Wang       2021-07-27  836  	} else {
607ed02e3232aa Jiang Wang       2021-07-27 @837  		if (sock->type == SOCK_STREAM)
607ed02e3232aa Jiang Wang       2021-07-27  838  			sk = sk_alloc(net, PF_UNIX, GFP_KERNEL, &unix_stream_proto, kern);
607ed02e3232aa Jiang Wang       2021-07-27  839  		else
607ed02e3232aa Jiang Wang       2021-07-27  840  			sk = sk_alloc(net, PF_UNIX, GFP_KERNEL, &unix_dgram_proto, kern);
607ed02e3232aa Jiang Wang       2021-07-27  841  	}
^1da177e4c3f41 Linus Torvalds   2005-04-16  842  	if (!sk)
^1da177e4c3f41 Linus Torvalds   2005-04-16  843  		goto out;
^1da177e4c3f41 Linus Torvalds   2005-04-16  844  
^1da177e4c3f41 Linus Torvalds   2005-04-16  845  	sock_init_data(sock, sk);
^1da177e4c3f41 Linus Torvalds   2005-04-16  846  
3aa9799e13645f Vladimir Davydov 2016-07-26  847  	sk->sk_allocation	= GFP_KERNEL_ACCOUNT;
^1da177e4c3f41 Linus Torvalds   2005-04-16  848  	sk->sk_write_space	= unix_write_space;
a0a53c8ba95451 Denis V. Lunev   2007-12-11  849  	sk->sk_max_ack_backlog	= net->unx.sysctl_max_dgram_qlen;
^1da177e4c3f41 Linus Torvalds   2005-04-16  850  	sk->sk_destruct		= unix_sock_destructor;
^1da177e4c3f41 Linus Torvalds   2005-04-16  851  	u	  = unix_sk(sk);
40ffe67d2e89c7 Al Viro          2012-03-14  852  	u->path.dentry = NULL;
40ffe67d2e89c7 Al Viro          2012-03-14  853  	u->path.mnt = NULL;
fd19f329a32bdc Benjamin LaHaise 2006-01-03  854  	spin_lock_init(&u->lock);
516e0cc5646f37 Al Viro          2008-07-26  855  	atomic_long_set(&u->inflight, 0);
1fd05ba5a2f2aa Miklos Szeredi   2007-07-11  856  	INIT_LIST_HEAD(&u->link);
6e1ce3c3451291 Linus Torvalds   2016-09-01  857  	mutex_init(&u->iolock); /* single task reading lock */
6e1ce3c3451291 Linus Torvalds   2016-09-01  858  	mutex_init(&u->bindlock); /* single task binding lock */
^1da177e4c3f41 Linus Torvalds   2005-04-16  859  	init_waitqueue_head(&u->peer_wait);
7d267278a9ece9 Rainer Weikusat  2015-11-20  860  	init_waitqueue_func_entry(&u->peer_wake, unix_dgram_peer_wake_relay);
3c32da19a858fb Kirill Tkhai     2019-12-09  861  	memset(&u->scm_stat, 0, sizeof(struct scm_stat));
7123aaa3a14165 Eric Dumazet     2012-06-08  862  	unix_insert_socket(unix_sockets_unbound(sk), sk);
^1da177e4c3f41 Linus Torvalds   2005-04-16  863  out:
284b327be2f86c Pavel Emelyanov  2007-11-10  864  	if (sk == NULL)
518de9b39e8545 Eric Dumazet     2010-10-26  865  		atomic_long_dec(&unix_nr_socks);
920de804bca61f Eric Dumazet     2008-11-24  866  	else {
920de804bca61f Eric Dumazet     2008-11-24  867  		local_bh_disable();
a8076d8db98de6 Eric Dumazet     2008-11-17  868  		sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
920de804bca61f Eric Dumazet     2008-11-24  869  		local_bh_enable();
920de804bca61f Eric Dumazet     2008-11-24  870  	}
^1da177e4c3f41 Linus Torvalds   2005-04-16  871  	return sk;
^1da177e4c3f41 Linus Torvalds   2005-04-16  872  }
^1da177e4c3f41 Linus Torvalds   2005-04-16  873  

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 33620 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread
* Re: [PATCH bpf-next v1 2/5] af_unix: add unix_stream_proto for sockmap
@ 2021-07-28  2:13 kernel test robot
  0 siblings, 0 replies; 20+ messages in thread
From: kernel test robot @ 2021-07-28  2:13 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 15517 bytes --]

CC: clang-built-linux(a)googlegroups.com
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20210727001252.1287673-3-jiang.wang@bytedance.com>
References: <20210727001252.1287673-3-jiang.wang@bytedance.com>
TO: Jiang Wang <jiang.wang@bytedance.com>
TO: netdev(a)vger.kernel.org
CC: cong.wang(a)bytedance.com
CC: duanxiongchun(a)bytedance.com
CC: xieyongji(a)bytedance.com
CC: chaiwen.cc(a)bytedance.com
CC: Jakub Kicinski <kuba@kernel.org>
CC: John Fastabend <john.fastabend@gmail.com>
CC: Daniel Borkmann <daniel@iogearbox.net>
CC: Jakub Sitnicki <jakub@cloudflare.com>
CC: Lorenz Bauer <lmb@cloudflare.com>

Hi Jiang,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on bpf-next/master]

url:    https://github.com/0day-ci/linux/commits/Jiang-Wang/sockmap-add-sockmap-support-for-unix-stream-socket/20210727-081531
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
:::::: branch date: 26 hours ago
:::::: commit date: 26 hours ago
config: x86_64-randconfig-c001-20210727 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project c658b472f3e61e1818e1909bf02f3d65470018a5)
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 x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://github.com/0day-ci/linux/commit/607ed02e3232aa57995e87230faad770b810a64a
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Jiang-Wang/sockmap-add-sockmap-support-for-unix-stream-socket/20210727-081531
        git checkout 607ed02e3232aa57995e87230faad770b810a64a
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer 

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


clang-analyzer warnings: (new ones prefixed by >>)
                       ^~~~
   net/unix/af_unix.c:1251:34: warning: Dereference of null pointer [clang-analyzer-core.NullDereference]
                   sk->sk_state = other->sk_state = TCP_ESTABLISHED;
                                  ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
   net/unix/af_unix.c:1189:6: note: Assuming the condition is false
           if (alen < offsetofend(struct sockaddr, sa_family))
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/unix/af_unix.c:1189:2: note: Taking false branch
           if (alen < offsetofend(struct sockaddr, sa_family))
           ^
   net/unix/af_unix.c:1192:6: note: Assuming field 'sa_family' is equal to AF_UNSPEC
           if (addr->sa_family != AF_UNSPEC) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/unix/af_unix.c:1192:2: note: Taking false branch
           if (addr->sa_family != AF_UNSPEC) {
           ^
   net/unix/af_unix.c:1228:3: note: Null pointer value stored to 'other'
                   other = NULL;
                   ^~~~~~~~~~~~
   net/unix/af_unix.c:1235:6: note: Assuming field 'peer' is null
           if (unix_peer(sk)) {
               ^
   net/unix/af_unix.c:180:23: note: expanded from macro 'unix_peer'
   #define unix_peer(sk) (unix_sk(sk)->peer)
                         ^~~~~~~~~~~~~~~~~~~
   net/unix/af_unix.c:1235:2: note: Taking false branch
           if (unix_peer(sk)) {
           ^
   net/unix/af_unix.c:1247:3: note: Calling 'unix_state_double_unlock'
                   unix_state_double_unlock(sk, other);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/unix/af_unix.c:1170:15: note: 'sk1' is not equal to 'sk2'
           if (unlikely(sk1 == sk2) || !sk2) {
                        ^
   include/linux/compiler.h:48:41: note: expanded from macro 'unlikely'
   #  define unlikely(x)   (__branch_check__(x, 0, __builtin_constant_p(x)))
                                             ^
   include/linux/compiler.h:33:34: note: expanded from macro '__branch_check__'
                           ______r = __builtin_expect(!!(x), expect);      \
                                                         ^
   net/unix/af_unix.c:1170:15: note: 'sk1' is not equal to 'sk2'
           if (unlikely(sk1 == sk2) || !sk2) {
                        ^
   include/linux/compiler.h:48:68: note: expanded from macro 'unlikely'
   #  define unlikely(x)   (__branch_check__(x, 0, __builtin_constant_p(x)))
                                                                        ^
   include/linux/compiler.h:35:19: note: expanded from macro '__branch_check__'
                                                expect, is_constant);      \
                                                        ^~~~~~~~~~~
   net/unix/af_unix.c:1170:6: note: Left side of '||' is false
           if (unlikely(sk1 == sk2) || !sk2) {
               ^
   include/linux/compiler.h:48:23: note: expanded from macro 'unlikely'
   #  define unlikely(x)   (__branch_check__(x, 0, __builtin_constant_p(x)))
                           ^
   net/unix/af_unix.c:1170:31: note: 'sk2' is null
           if (unlikely(sk1 == sk2) || !sk2) {
                                        ^~~
   net/unix/af_unix.c:1170:2: note: Taking true branch
           if (unlikely(sk1 == sk2) || !sk2) {
           ^
   net/unix/af_unix.c:1171:3: note: Calling 'spin_unlock'
                   unix_state_unlock(sk1);
                   ^
   include/net/af_unix.h:51:30: note: expanded from macro 'unix_state_unlock'
   #define unix_state_unlock(s)    spin_unlock(&unix_sk(s)->lock)
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/spinlock.h:394:2: note: Value assigned to field 'peer', which participates in a condition later
           raw_spin_unlock(&lock->rlock);
           ^
   include/linux/spinlock.h:284:32: note: expanded from macro 'raw_spin_unlock'
   #define raw_spin_unlock(lock)           _raw_spin_unlock(lock)
                                           ^~~~~~~~~~~~~~~~~~~~~~
   net/unix/af_unix.c:1171:3: note: Returning from 'spin_unlock'
                   unix_state_unlock(sk1);
                   ^
   include/net/af_unix.h:51:30: note: expanded from macro 'unix_state_unlock'
   #define unix_state_unlock(s)    spin_unlock(&unix_sk(s)->lock)
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/unix/af_unix.c:1247:3: note: Returning from 'unix_state_double_unlock'
                   unix_state_double_unlock(sk, other);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/unix/af_unix.c:1250:6: note: Assuming field 'peer' is non-null
           if (unix_peer(sk))
               ^
   net/unix/af_unix.c:180:23: note: expanded from macro 'unix_peer'
   #define unix_peer(sk) (unix_sk(sk)->peer)
                         ^~~~~~~~~~~~~~~~~~~
   net/unix/af_unix.c:1250:2: note: Taking true branch
           if (unix_peer(sk))
           ^
   net/unix/af_unix.c:1251:34: note: Dereference of null pointer
                   sk->sk_state = other->sk_state = TCP_ESTABLISHED;
                                  ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
   net/unix/af_unix.c:1558:3: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]
                   err = 0;
                   ^     ~
   net/unix/af_unix.c:1558:3: note: Value stored to 'err' is never read
                   err = 0;
                   ^     ~
>> net/unix/af_unix.c:2590:15: warning: Value stored to 'sk' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct sock *sk = sock->sk;
                        ^~   ~~~~~~~~
   net/unix/af_unix.c:2590:15: note: Value stored to 'sk' during its initialization is never read
           struct sock *sk = sock->sk;
                        ^~   ~~~~~~~~
   Suppressed 12 warnings (11 in non-user code, 1 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   12 warnings generated.
   net/atm/common.c:238:2: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
           skb_queue_walk_safe(&queue, skb, tmp) {
           ^
   include/linux/skbuff.h:3537:33: note: expanded from macro 'skb_queue_walk_safe'
                   for (skb = (queue)->next, tmp = skb->next;                      \
                                                 ^ ~~~~~~~~~
   net/atm/common.c:231:2: note: Calling '__skb_queue_head_init'
           __skb_queue_head_init(&queue);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/atm/common.c:231:2: note: Returning from '__skb_queue_head_init'
           __skb_queue_head_init(&queue);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/atm/common.c:234:2: note: Loop condition is false.  Exiting loop
           spin_lock_irqsave(&rq->lock, flags);
           ^
   include/linux/spinlock.h:384:2: note: expanded from macro 'spin_lock_irqsave'
           raw_spin_lock_irqsave(spinlock_check(lock), flags);     \
           ^
   include/linux/spinlock.h:250:2: note: expanded from macro 'raw_spin_lock_irqsave'
           do {                                            \
           ^
   net/atm/common.c:234:2: note: Loop condition is false.  Exiting loop
           spin_lock_irqsave(&rq->lock, flags);
           ^
   include/linux/spinlock.h:382:43: note: expanded from macro 'spin_lock_irqsave'
   #define spin_lock_irqsave(lock, flags)                          \
                                                                   ^
   net/atm/common.c:235:2: note: Calling 'skb_queue_splice_init'
           skb_queue_splice_init(rq, &queue);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/skbuff.h:1979:6: note: Assuming the condition is false
           if (!skb_queue_empty(list)) {
               ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/skbuff.h:1979:2: note: Taking false branch
           if (!skb_queue_empty(list)) {
           ^
   net/atm/common.c:235:2: note: Returning from 'skb_queue_splice_init'
           skb_queue_splice_init(rq, &queue);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/atm/common.c:238:2: note: Assigned value is garbage or undefined
           skb_queue_walk_safe(&queue, skb, tmp) {
           ^
   include/linux/skbuff.h:3537:33: note: expanded from macro 'skb_queue_walk_safe'
                   for (skb = (queue)->next, tmp = skb->next;                      \
                                                 ^ ~~~~~~~~~
   Suppressed 11 warnings (11 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   11 warnings generated.
   Suppressed 11 warnings (11 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   11 warnings generated.
   Suppressed 11 warnings (11 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   11 warnings generated.
   Suppressed 11 warnings (11 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   11 warnings generated.
   Suppressed 11 warnings (11 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   11 warnings generated.
   Suppressed 11 warnings (11 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   5 warnings generated.
   Suppressed 5 warnings (5 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   9 warnings generated.
   drivers/thunderbolt/switch.c:498:36: warning: Value stored to 'regs' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           const struct tb_regs_port_header *regs = &port->config;
                                             ^~~~   ~~~~~~~~~~~~~
   drivers/thunderbolt/switch.c:498:36: note: Value stored to 'regs' during its initialization is never read
           const struct tb_regs_port_header *regs = &port->config;
                                             ^~~~   ~~~~~~~~~~~~~
   drivers/thunderbolt/switch.c:1408:38: warning: Value stored to 'regs' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           const struct tb_regs_switch_header *regs = &sw->config;
                                               ^~~~   ~~~~~~~~~~~
   drivers/thunderbolt/switch.c:1408:38: note: Value stored to 'regs' during its initialization is never read
           const struct tb_regs_switch_header *regs = &sw->config;
                                               ^~~~   ~~~~~~~~~~~
   drivers/thunderbolt/switch.c:2268:13: warning: Value stored to 'tb' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct tb *tb = sw->tb;
                      ^~   ~~~~~~
   drivers/thunderbolt/switch.c:2268:13: note: Value stored to 'tb' during its initialization is never read
           struct tb *tb = sw->tb;
                      ^~   ~~~~~~
   drivers/thunderbolt/switch.c:2272:2: warning: Value stored to 'route' is never read [clang-analyzer-deadcode.DeadStores]
           route = tb_route(sw);
           ^       ~~~~~~~~~~~~
   drivers/thunderbolt/switch.c:2272:2: note: Value stored to 'route' is never read
           route = tb_route(sw);
           ^       ~~~~~~~~~~~~
   Suppressed 5 warnings (5 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.

vim +/sk +2590 net/unix/af_unix.c

607ed02e3232aa Jiang Wang           2021-07-27  2578  
2b514574f7e88c Hannes Frederic Sowa 2015-05-21  2579  static int unix_stream_recvmsg(struct socket *sock, struct msghdr *msg,
2b514574f7e88c Hannes Frederic Sowa 2015-05-21  2580  			       size_t size, int flags)
2b514574f7e88c Hannes Frederic Sowa 2015-05-21  2581  {
2b514574f7e88c Hannes Frederic Sowa 2015-05-21  2582  	struct unix_stream_read_state state = {
2b514574f7e88c Hannes Frederic Sowa 2015-05-21  2583  		.recv_actor = unix_stream_read_actor,
2b514574f7e88c Hannes Frederic Sowa 2015-05-21  2584  		.socket = sock,
2b514574f7e88c Hannes Frederic Sowa 2015-05-21  2585  		.msg = msg,
2b514574f7e88c Hannes Frederic Sowa 2015-05-21  2586  		.size = size,
2b514574f7e88c Hannes Frederic Sowa 2015-05-21  2587  		.flags = flags
2b514574f7e88c Hannes Frederic Sowa 2015-05-21  2588  	};
2b514574f7e88c Hannes Frederic Sowa 2015-05-21  2589  
607ed02e3232aa Jiang Wang           2021-07-27 @2590  	struct sock *sk = sock->sk;
607ed02e3232aa Jiang Wang           2021-07-27  2591  

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 34139 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2021-08-10 17:04 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-27  0:12 [PATCH bpf-next v1 0/5] sockmap: add sockmap support for unix stream socket Jiang Wang
2021-07-27  0:12 ` [PATCH bpf-next v1 1/5] af_unix: add read_sock for stream socket types Jiang Wang
2021-07-29  8:37   ` Jakub Sitnicki
2021-07-27  0:12 ` [PATCH bpf-next v1 2/5] af_unix: add unix_stream_proto for sockmap Jiang Wang
2021-07-27 16:37   ` John Fastabend
2021-07-28  2:07     ` Cong Wang
2021-07-28 18:43       ` John Fastabend
2021-07-29 21:27         ` Cong Wang
2021-08-10 17:04           ` John Fastabend
2021-07-27  0:12 ` [PATCH bpf-next v1 3/5] selftest/bpf: add tests for sockmap with unix stream type Jiang Wang
2021-07-27 16:38   ` John Fastabend
2021-07-27  0:12 ` [PATCH bpf-next v1 4/5] selftest/bpf: change udp to inet in some function names Jiang Wang
2021-07-27 16:40   ` John Fastabend
2021-07-27  0:12 ` [PATCH bpf-next v1 5/5] selftest/bpf: add new tests in sockmap for unix stream to tcp Jiang Wang
2021-07-27 16:42   ` John Fastabend
2021-07-27 16:44 ` [PATCH bpf-next v1 0/5] sockmap: add sockmap support for unix stream socket John Fastabend
2021-07-27 16:38 [PATCH bpf-next v1 2/5] af_unix: add unix_stream_proto for sockmap kernel test robot
2021-07-28  0:38 ` kernel test robot
2021-07-28  0:38   ` kernel test robot
2021-07-28  2:13 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.