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>] [day] [month] [year] [list]
Message-ID: <202007090447.RCOneUQd%lkp@intel.com>
Date:   Thu, 9 Jul 2020 04:00:51 +0800
From:   kernel test robot <lkp@...el.com>
To:     Luc Van Oostenryck <luc.vanoostenryck@...il.com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: net/netfilter/nf_tables_api.c:2097:23: sparse: got struct nft_stats
 __percpu COPYING CREDITS Documentation Kbuild Kconfig LICENSES MAINTAINERS
 Makefile README arch block certs crypto drivers fs include init ipc kernel
 lib mm net samples scripts security sound tools usr virt

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   dcde237b9b0eb1d19306e6f48c0a4e058907619f
commit: 670d0a4b10704667765f7d18f7592993d02783aa sparse: use identifiers to define address spaces
date:   3 weeks ago
config: arm64-randconfig-s032-20200708 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.2-37-gc9676a3b-dirty
        git checkout 670d0a4b10704667765f7d18f7592993d02783aa
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=arm64 

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/netfilter/nf_tables_api.c:1405:25: sparse: sparse: cast between address spaces (__percpu -> __rcu)
   net/netfilter/nf_tables_api.c:1405:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   net/netfilter/nf_tables_api.c:1405:25: sparse:    struct nft_stats [noderef] __rcu *
   net/netfilter/nf_tables_api.c:1405:25: sparse:    struct nft_stats [noderef] __percpu *
   net/netfilter/nf_tables_api.c:1567:31: sparse: sparse: incorrect type in return expression (different address spaces) @@     expected struct nft_stats [noderef] __percpu * @@     got void * @@
   net/netfilter/nf_tables_api.c:1570:31: sparse: sparse: incorrect type in return expression (different address spaces) @@     expected struct nft_stats [noderef] __percpu * @@     got void * @@
   net/netfilter/nf_tables_api.c:1574:31: sparse: sparse: incorrect type in return expression (different address spaces) @@     expected struct nft_stats [noderef] __percpu * @@     got void * @@
   net/netfilter/nf_tables_api.c:1596:17: sparse: sparse: cast between address spaces (__percpu -> __rcu)
   net/netfilter/nf_tables_api.c:1596:17: sparse: sparse: incompatible types in comparison expression (different address spaces):
   net/netfilter/nf_tables_api.c:1596:17: sparse:    struct nft_stats [noderef] __rcu *
   net/netfilter/nf_tables_api.c:1596:17: sparse:    struct nft_stats [noderef] __percpu *
   net/netfilter/nf_tables_api.c:1596:17: sparse: sparse: incompatible types in comparison expression (different address spaces):
   net/netfilter/nf_tables_api.c:1596:17: sparse:    struct nft_stats [noderef] __rcu *
   net/netfilter/nf_tables_api.c:1596:17: sparse:    struct nft_stats [noderef] __percpu *
   net/netfilter/nf_tables_api.c:1639:21: sparse: sparse: cast between address spaces (__percpu -> __rcu)
   net/netfilter/nf_tables_api.c:1639:21: sparse: sparse: incompatible types in comparison expression (different address spaces):
   net/netfilter/nf_tables_api.c:1639:21: sparse:    struct nft_stats [noderef] __rcu *
   net/netfilter/nf_tables_api.c:1639:21: sparse:    struct nft_stats [noderef] __percpu *
   net/netfilter/nf_tables_api.c:1947:25: sparse: sparse: cast between address spaces (__percpu -> __rcu)
   net/netfilter/nf_tables_api.c:1947:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   net/netfilter/nf_tables_api.c:1947:25: sparse:    struct nft_stats [noderef] __rcu *
   net/netfilter/nf_tables_api.c:1947:25: sparse:    struct nft_stats [noderef] __percpu *
   net/netfilter/nf_tables_api.c:2097:23: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct nft_stats *stats @@     got struct nft_stats [noderef] __percpu * @@
   net/netfilter/nf_tables_api.c:2097:23: sparse:     expected struct nft_stats *stats
>> net/netfilter/nf_tables_api.c:2097:23: sparse:     got struct nft_stats [noderef] __percpu *
   net/netfilter/nf_tables_api.c:2108:38: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct nft_stats [noderef] __percpu *stats @@     got struct nft_stats *stats @@
>> net/netfilter/nf_tables_api.c:2108:38: sparse:     expected struct nft_stats [noderef] __percpu *stats
   net/netfilter/nf_tables_api.c:2108:38: sparse:     got struct nft_stats *stats
   net/netfilter/nf_tables_api.c:2144:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void [noderef] __percpu *__pdata @@     got struct nft_stats *stats @@
>> net/netfilter/nf_tables_api.c:2144:21: sparse:     expected void [noderef] __percpu *__pdata
   net/netfilter/nf_tables_api.c:2144:21: sparse:     got struct nft_stats *stats
   include/linux/rcupdate.h:686:9: sparse: sparse: context imbalance in 'nft_netlink_dump_start_rcu' - unexpected unlock
--
>> drivers/rpmsg/qcom_glink_smem.c:93:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const volatile [noderef] __iomem * @@     got void * @@
>> drivers/rpmsg/qcom_glink_smem.c:93:17: sparse:     expected void const volatile [noderef] __iomem *
   drivers/rpmsg/qcom_glink_smem.c:93:17: sparse:     got void *
>> drivers/rpmsg/qcom_glink_smem.c:96:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const volatile [noderef] __iomem * @@     got void *fifo @@
   drivers/rpmsg/qcom_glink_smem.c:96:17: sparse:     expected void const volatile [noderef] __iomem *
   drivers/rpmsg/qcom_glink_smem.c:96:17: sparse:     got void *fifo

vim +2097 net/netfilter/nf_tables_api.c

d54725cd11a57c Pablo Neira Ayuso 2019-10-16  2034  
c9626a2cbdb20e Pablo Neira Ayuso 2019-07-09  2035  static int nf_tables_updchain(struct nft_ctx *ctx, u8 genmask, u8 policy,
c9626a2cbdb20e Pablo Neira Ayuso 2019-07-09  2036  			      u32 flags)
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2037  {
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2038  	const struct nlattr * const *nla = ctx->nla;
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2039  	struct nft_table *table = ctx->table;
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2040  	struct nft_chain *chain = ctx->chain;
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2041  	struct nft_base_chain *basechain;
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2042  	struct nft_stats *stats = NULL;
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2043  	struct nft_chain_hook hook;
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2044  	struct nf_hook_ops *ops;
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2045  	struct nft_trans *trans;
c974a3a36468d1 Pablo Neira Ayuso 2017-12-09  2046  	int err;
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2047  
c9626a2cbdb20e Pablo Neira Ayuso 2019-07-09  2048  	if (chain->flags ^ flags)
c9626a2cbdb20e Pablo Neira Ayuso 2019-07-09  2049  		return -EOPNOTSUPP;
c9626a2cbdb20e Pablo Neira Ayuso 2019-07-09  2050  
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2051  	if (nla[NFTA_CHAIN_HOOK]) {
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2052  		if (!nft_is_base_chain(chain))
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2053  			return -EBUSY;
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2054  
36596dadf54a92 Pablo Neira Ayuso 2018-01-09  2055  		err = nft_chain_parse_hook(ctx->net, nla, &hook, ctx->family,
445509eb9b0027 Pablo Neira Ayuso 2018-08-03  2056  					   false);
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2057  		if (err < 0)
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2058  			return err;
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2059  
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2060  		basechain = nft_base_chain(chain);
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2061  		if (basechain->type != hook.type) {
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2062  			nft_chain_release_hook(&hook);
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2063  			return -EBUSY;
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2064  		}
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2065  
d54725cd11a57c Pablo Neira Ayuso 2019-10-16  2066  		if (ctx->family == NFPROTO_NETDEV) {
d54725cd11a57c Pablo Neira Ayuso 2019-10-16  2067  			if (!nft_hook_list_equal(&basechain->hook_list,
d54725cd11a57c Pablo Neira Ayuso 2019-10-16  2068  						 &hook.list)) {
d54725cd11a57c Pablo Neira Ayuso 2019-10-16  2069  				nft_chain_release_hook(&hook);
d54725cd11a57c Pablo Neira Ayuso 2019-10-16  2070  				return -EBUSY;
d54725cd11a57c Pablo Neira Ayuso 2019-10-16  2071  			}
d54725cd11a57c Pablo Neira Ayuso 2019-10-16  2072  		} else {
c974a3a36468d1 Pablo Neira Ayuso 2017-12-09  2073  			ops = &basechain->ops;
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2074  			if (ops->hooknum != hook.num ||
d54725cd11a57c Pablo Neira Ayuso 2019-10-16  2075  			    ops->priority != hook.priority) {
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2076  				nft_chain_release_hook(&hook);
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2077  				return -EBUSY;
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2078  			}
d54725cd11a57c Pablo Neira Ayuso 2019-10-16  2079  		}
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2080  		nft_chain_release_hook(&hook);
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2081  	}
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2082  
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2083  	if (nla[NFTA_CHAIN_HANDLE] &&
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2084  	    nla[NFTA_CHAIN_NAME]) {
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2085  		struct nft_chain *chain2;
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2086  
f102d66b335a41 Florian Westphal  2018-07-11  2087  		chain2 = nft_chain_lookup(ctx->net, table,
f102d66b335a41 Florian Westphal  2018-07-11  2088  					  nla[NFTA_CHAIN_NAME], genmask);
0d18779be13766 JingPiao Chen     2017-09-23  2089  		if (!IS_ERR(chain2))
0d18779be13766 JingPiao Chen     2017-09-23  2090  			return -EEXIST;
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2091  	}
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2092  
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2093  	if (nla[NFTA_CHAIN_COUNTERS]) {
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2094  		if (!nft_is_base_chain(chain))
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2095  			return -EOPNOTSUPP;
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2096  
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03 @2097  		stats = nft_stats_alloc(nla[NFTA_CHAIN_COUNTERS]);
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2098  		if (IS_ERR(stats))
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2099  			return PTR_ERR(stats);
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2100  	}
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2101  
c6cc94df65c317 Florian Westphal  2018-07-17  2102  	err = -ENOMEM;
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2103  	trans = nft_trans_alloc(ctx, NFT_MSG_NEWCHAIN,
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2104  				sizeof(struct nft_trans_chain));
c6cc94df65c317 Florian Westphal  2018-07-17  2105  	if (trans == NULL)
c6cc94df65c317 Florian Westphal  2018-07-17  2106  		goto err;
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2107  
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03 @2108  	nft_trans_chain_stats(trans) = stats;
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2109  	nft_trans_chain_update(trans) = true;
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2110  
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2111  	if (nla[NFTA_CHAIN_POLICY])
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2112  		nft_trans_chain_policy(trans) = policy;
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2113  	else
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2114  		nft_trans_chain_policy(trans) = -1;
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2115  
c6cc94df65c317 Florian Westphal  2018-07-17  2116  	if (nla[NFTA_CHAIN_HANDLE] &&
c6cc94df65c317 Florian Westphal  2018-07-17  2117  	    nla[NFTA_CHAIN_NAME]) {
c6cc94df65c317 Florian Westphal  2018-07-17  2118  		struct nft_trans *tmp;
c6cc94df65c317 Florian Westphal  2018-07-17  2119  		char *name;
c6cc94df65c317 Florian Westphal  2018-07-17  2120  
c6cc94df65c317 Florian Westphal  2018-07-17  2121  		err = -ENOMEM;
c6cc94df65c317 Florian Westphal  2018-07-17  2122  		name = nla_strdup(nla[NFTA_CHAIN_NAME], GFP_KERNEL);
c6cc94df65c317 Florian Westphal  2018-07-17  2123  		if (!name)
c6cc94df65c317 Florian Westphal  2018-07-17  2124  			goto err;
c6cc94df65c317 Florian Westphal  2018-07-17  2125  
c6cc94df65c317 Florian Westphal  2018-07-17  2126  		err = -EEXIST;
c6cc94df65c317 Florian Westphal  2018-07-17  2127  		list_for_each_entry(tmp, &ctx->net->nft.commit_list, list) {
c6cc94df65c317 Florian Westphal  2018-07-17  2128  			if (tmp->msg_type == NFT_MSG_NEWCHAIN &&
c6cc94df65c317 Florian Westphal  2018-07-17  2129  			    tmp->ctx.table == table &&
c6cc94df65c317 Florian Westphal  2018-07-17  2130  			    nft_trans_chain_update(tmp) &&
c6cc94df65c317 Florian Westphal  2018-07-17  2131  			    nft_trans_chain_name(tmp) &&
c6cc94df65c317 Florian Westphal  2018-07-17  2132  			    strcmp(name, nft_trans_chain_name(tmp)) == 0) {
c6cc94df65c317 Florian Westphal  2018-07-17  2133  				kfree(name);
c6cc94df65c317 Florian Westphal  2018-07-17  2134  				goto err;
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2135  			}
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2136  		}
c6cc94df65c317 Florian Westphal  2018-07-17  2137  
c6cc94df65c317 Florian Westphal  2018-07-17  2138  		nft_trans_chain_name(trans) = name;
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2139  	}
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2140  	list_add_tail(&trans->list, &ctx->net->nft.commit_list);
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2141  
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2142  	return 0;
c6cc94df65c317 Florian Westphal  2018-07-17  2143  err:
c6cc94df65c317 Florian Westphal  2018-07-17 @2144  	free_percpu(stats);
c6cc94df65c317 Florian Westphal  2018-07-17  2145  	kfree(trans);
c6cc94df65c317 Florian Westphal  2018-07-17  2146  	return err;
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2147  }
2c4a488a482d26 Pablo Neira Ayuso 2017-09-03  2148  

:::::: The code at line 2097 was first introduced by commit
:::::: 2c4a488a482d265df4505671f6051067524c4f76 netfilter: nf_tables: add nf_tables_updchain()

:::::: TO: Pablo Neira Ayuso <pablo@...filter.org>
:::::: CC: Pablo Neira Ayuso <pablo@...filter.org>

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ