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: <202102140308.IZ2lfKij-lkp@intel.com>
Date:   Sun, 14 Feb 2021 03:41:06 +0800
From:   kernel test robot <lkp@...el.com>
To:     Taehee Yoo <ap420073@...il.com>, davem@...emloft.net,
        kuba@...nel.org, xiyou.wangcong@...il.com, netdev@...r.kernel.org,
        jwi@...ux.ibm.com, kgraul@...ux.ibm.com, hca@...ux.ibm.com,
        gor@...ux.ibm.com, borntraeger@...ibm.com,
        mareklindner@...mailbox.ch
Cc:     kbuild-all@...ts.01.org
Subject: Re: [PATCH net-next v2 5/7] mld: convert ipv6_mc_socklist->sflist to
 RCU

Hi Taehee,

Thank you for the patch! Perhaps something to improve:

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

url:    https://github.com/0day-ci/linux/commits/Taehee-Yoo/mld-change-context-from-atomic-to-sleepable/20210214-015930
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 3c5a2fd042d0bfac71a2dfb99515723d318df47b
config: x86_64-randconfig-s022-20210214 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-215-g0fb77bb6-dirty
        # https://github.com/0day-ci/linux/commit/5a21fa32b1401aa428cd0249ee5b02ddb12cff60
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Taehee-Yoo/mld-change-context-from-atomic-to-sleepable/20210214-015930
        git checkout 5a21fa32b1401aa428cd0249ee5b02ddb12cff60
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64 

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


"sparse warnings: (new ones prefixed by >>)"
>> net/ipv6/mcast.c:430:17: sparse: sparse: incompatible types in comparison expression (different address spaces):
>> net/ipv6/mcast.c:430:17: sparse:    struct ip6_sf_socklist [noderef] __rcu *
>> net/ipv6/mcast.c:430:17: sparse:    struct ip6_sf_socklist *
   net/ipv6/mcast.c: note: in included file:
   include/net/mld.h:32:43: sparse: sparse: array of flexible structures
   net/ipv6/mcast.c:257:25: sparse: sparse: context imbalance in 'ip6_mc_find_dev_rcu' - different lock contexts for basic block
   net/ipv6/mcast.c:447:9: sparse: sparse: context imbalance in 'ip6_mc_source' - unexpected unlock
   net/ipv6/mcast.c:536:9: sparse: sparse: context imbalance in 'ip6_mc_msfilter' - unexpected unlock
   net/ipv6/mcast.c:583:21: sparse: sparse: context imbalance in 'ip6_mc_msfget' - unexpected unlock
   net/ipv6/mcast.c:2724:25: sparse: sparse: context imbalance in 'igmp6_mc_get_next' - unexpected unlock
   net/ipv6/mcast.c:2746:9: sparse: sparse: context imbalance in 'igmp6_mc_get_idx' - wrong count at exit
   net/ipv6/mcast.c:2773:9: sparse: sparse: context imbalance in 'igmp6_mc_seq_stop' - unexpected unlock
   net/ipv6/mcast.c:2845:31: sparse: sparse: context imbalance in 'igmp6_mcf_get_next' - unexpected unlock
   net/ipv6/mcast.c:2877:9: sparse: sparse: context imbalance in 'igmp6_mcf_get_idx' - wrong count at exit
   net/ipv6/mcast.c:2894:9: sparse: sparse: context imbalance in 'igmp6_mcf_seq_next' - wrong count at exit
   net/ipv6/mcast.c:2907:17: sparse: sparse: context imbalance in 'igmp6_mcf_seq_stop' - unexpected unlock

vim +430 net/ipv6/mcast.c

   325	
   326	int ip6_mc_source(int add, int omode, struct sock *sk,
   327		struct group_source_req *pgsr)
   328	{
   329		struct in6_addr *source, *group;
   330		struct ipv6_mc_socklist *pmc;
   331		struct inet6_dev *idev;
   332		struct ipv6_pinfo *inet6 = inet6_sk(sk);
   333		struct ip6_sf_socklist *psl;
   334		struct net *net = sock_net(sk);
   335		int i, j, rv;
   336		int leavegroup = 0;
   337		int err;
   338	
   339		source = &((struct sockaddr_in6 *)&pgsr->gsr_source)->sin6_addr;
   340		group = &((struct sockaddr_in6 *)&pgsr->gsr_group)->sin6_addr;
   341	
   342		if (!ipv6_addr_is_multicast(group))
   343			return -EINVAL;
   344	
   345		rcu_read_lock();
   346		idev = ip6_mc_find_dev_rcu(net, group, pgsr->gsr_interface);
   347		if (!idev) {
   348			rcu_read_unlock();
   349			return -ENODEV;
   350		}
   351	
   352		err = -EADDRNOTAVAIL;
   353	
   354		for_each_pmc_rcu(inet6, pmc) {
   355			if (pgsr->gsr_interface && pmc->ifindex != pgsr->gsr_interface)
   356				continue;
   357			if (ipv6_addr_equal(&pmc->addr, group))
   358				break;
   359		}
   360		if (!pmc) {		/* must have a prior join */
   361			err = -EINVAL;
   362			goto done;
   363		}
   364		/* if a source filter was set, must be the same mode as before */
   365		if (rcu_access_pointer(pmc->sflist)) {
   366			if (pmc->sfmode != omode) {
   367				err = -EINVAL;
   368				goto done;
   369			}
   370		} else if (pmc->sfmode != omode) {
   371			/* allow mode switches for empty-set filters */
   372			ip6_mc_add_src(idev, group, omode, 0, NULL, 0);
   373			ip6_mc_del_src(idev, group, pmc->sfmode, 0, NULL, 0);
   374			pmc->sfmode = omode;
   375		}
   376	
   377		psl = rtnl_dereference(pmc->sflist);
   378		if (!add) {
   379			if (!psl)
   380				goto done;	/* err = -EADDRNOTAVAIL */
   381			rv = !0;
   382			for (i = 0; i < psl->sl_count; i++) {
   383				rv = !ipv6_addr_equal(&psl->sl_addr[i], source);
   384				if (rv == 0)
   385					break;
   386			}
   387			if (rv)		/* source not found */
   388				goto done;	/* err = -EADDRNOTAVAIL */
   389	
   390			/* special case - (INCLUDE, empty) == LEAVE_GROUP */
   391			if (psl->sl_count == 1 && omode == MCAST_INCLUDE) {
   392				leavegroup = 1;
   393				goto done;
   394			}
   395	
   396			/* update the interface filter */
   397			ip6_mc_del_src(idev, group, omode, 1, source, 1);
   398	
   399			for (j = i+1; j < psl->sl_count; j++)
   400				psl->sl_addr[j-1] = psl->sl_addr[j];
   401			psl->sl_count--;
   402			err = 0;
   403			goto done;
   404		}
   405		/* else, add a new source to the filter */
   406	
   407		if (psl && psl->sl_count >= sysctl_mld_max_msf) {
   408			err = -ENOBUFS;
   409			goto done;
   410		}
   411		if (!psl || psl->sl_count == psl->sl_max) {
   412			struct ip6_sf_socklist *newpsl;
   413			int count = IP6_SFBLOCK;
   414	
   415			if (psl)
   416				count += psl->sl_max;
   417			newpsl = sock_kmalloc(sk, IP6_SFLSIZE(count), GFP_ATOMIC);
   418			if (!newpsl) {
   419				err = -ENOBUFS;
   420				goto done;
   421			}
   422			newpsl->sl_max = count;
   423			newpsl->sl_count = count - IP6_SFBLOCK;
   424			if (psl) {
   425				for (i = 0; i < psl->sl_count; i++)
   426					newpsl->sl_addr[i] = psl->sl_addr[i];
   427				atomic_sub(IP6_SFLSIZE(psl->sl_max), &sk->sk_omem_alloc);
   428				kfree_rcu(psl, rcu);
   429			}
 > 430			rcu_assign_pointer(psl, newpsl);
   431			rcu_assign_pointer(pmc->sflist, psl);
   432		}
   433		rv = 1;	/* > 0 for insert logic below if sl_count is 0 */
   434		for (i = 0; i < psl->sl_count; i++) {
   435			rv = !ipv6_addr_equal(&psl->sl_addr[i], source);
   436			if (rv == 0) /* There is an error in the address. */
   437				goto done;
   438		}
   439		for (j = psl->sl_count-1; j >= i; j--)
   440			psl->sl_addr[j+1] = psl->sl_addr[j];
   441		psl->sl_addr[i] = *source;
   442		psl->sl_count++;
   443		err = 0;
   444		/* update the interface list */
   445		ip6_mc_add_src(idev, group, omode, 1, source, 1);
   446	done:
   447		read_unlock_bh(&idev->lock);
   448		rcu_read_unlock();
   449		if (leavegroup)
   450			err = ipv6_sock_mc_drop(sk, pgsr->gsr_interface, group);
   451		return err;
   452	}
   453	

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ