[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202010232253.ivXFy8Da-lkp@intel.com>
Date: Fri, 23 Oct 2020 22:25:44 +0800
From: kernel test robot <lkp@...el.com>
To: Ricardo Dias <rdias@...sql.com>, davem@...emloft.net,
kuba@...nel.org, kuznet@....inr.ac.ru, yoshfuji@...ux-ipv6.org,
edumazet@...gle.com
Cc: kbuild-all@...ts.01.org, clang-built-linux@...glegroups.com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] tcp: fix race condition when creating child sockets from
syncookies
Hi Ricardo,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on net-next/master]
[also build test WARNING on net/master linus/master v5.9 next-20201023]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Ricardo-Dias/tcp-fix-race-condition-when-creating-child-sockets-from-syncookies/20201023-191433
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 105faa8742437c28815b2a3eb8314ebc5fd9288c
config: arm-randconfig-r023-20201022 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 147b9497e79a98a8614b2b5eb4ba653b44f6b6f0)
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 arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://github.com/0day-ci/linux/commit/35d7202175fe2c313d66daf214ea113947d78c6d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Ricardo-Dias/tcp-fix-race-condition-when-creating-child-sockets-from-syncookies/20201023-191433
git checkout 35d7202175fe2c313d66daf214ea113947d78c6d
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
All warnings (new ones prefixed by >>):
>> net/ipv4/inet_hashtables.c:572:11: warning: variable 'dif' is uninitialized when used here [-Wuninitialized]
dif, sdif))) {
^~~
include/net/inet_hashtables.h:318:33: note: expanded from macro 'INET_MATCH'
(((__sk)->sk_bound_dev_if == (__dif)) || \
^~~~~
include/linux/compiler.h:77:40: note: expanded from macro 'likely'
# define likely(x) __builtin_expect(!!(x), 1)
^
net/ipv4/inet_hashtables.c:553:15: note: initialize the variable 'dif' to silence this warning
const int dif, sdif = sk->sk_bound_dev_if;
^
= 0
1 warning generated.
vim +/dif +572 net/ipv4/inet_hashtables.c
539
540 /* Inserts a socket into ehash if no existing socket exists for the same
541 * quadruple (saddr, sport, daddr, dport).
542 * If there is an existing socket, returns that socket, otherwise returns NULL.
543 */
544 struct sock *inet_ehash_insert_chk_dup(struct sock *sk)
545 {
546 struct inet_hashinfo *hashinfo = sk->sk_prot->h.hashinfo;
547 struct hlist_nulls_head *list;
548 struct inet_ehash_bucket *head;
549 const struct hlist_nulls_node *node;
550 struct sock *esk;
551 spinlock_t *lock; /* protects hashinfo socket entry */
552 struct net *net = sock_net(sk);
553 const int dif, sdif = sk->sk_bound_dev_if;
554
555 INET_ADDR_COOKIE(acookie, sk->sk_daddr, sk->sk_rcv_saddr);
556 const __portpair ports = INET_COMBINED_PORTS(sk->sk_dport, sk->sk_num);
557
558 WARN_ON_ONCE(!sk_unhashed(sk));
559
560 sk->sk_hash = sk_ehashfn(sk);
561 head = inet_ehash_bucket(hashinfo, sk->sk_hash);
562 list = &head->chain;
563 lock = inet_ehash_lockp(hashinfo, sk->sk_hash);
564
565 spin_lock(lock);
566 begin:
567 sk_nulls_for_each_rcu(esk, node, list) {
568 if (esk->sk_hash != sk->sk_hash)
569 continue;
570 if (likely(INET_MATCH(esk, net, acookie,
571 sk->sk_daddr, sk->sk_rcv_saddr, ports,
> 572 dif, sdif))) {
573 if (unlikely(!refcount_inc_not_zero(&esk->sk_refcnt)))
574 goto out;
575 if (unlikely(!INET_MATCH(esk, net, acookie,
576 sk->sk_daddr,
577 sk->sk_rcv_saddr, ports,
578 dif, sdif))) {
579 sock_gen_put(esk);
580 goto begin;
581 }
582 goto found;
583 }
584 }
585 out:
586 esk = NULL;
587 __sk_nulls_add_node_rcu(sk, list);
588 found:
589 spin_unlock(lock);
590 if (esk) {
591 percpu_counter_inc(sk->sk_prot->orphan_count);
592 inet_sk_set_state(sk, TCP_CLOSE);
593 sock_set_flag(sk, SOCK_DEAD);
594 inet_csk_destroy_sock(sk);
595 }
596 return esk;
597 }
598
---
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" (23233 bytes)
Powered by blists - more mailing lists