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]
Date:   Mon, 4 Mar 2019 15:47:05 +0800
From:   kbuild test robot <lkp@...el.com>
To:     Su Yanjun <suyj.fnst@...fujitsu.com>
Cc:     kbuild-all@...org, davem@...emloft.net,
        steffen.klassert@...unet.com, fw@...len.de, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, suyj.fnst@...fujitsu.com
Subject: Re: [PATCH] net: xfrm: Add '_rcu' tag for rcu protected pointer in
 netns_xfrm

Hi Su,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]
[also build test WARNING on v5.0 next-20190301]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Su-Yanjun/net-xfrm-Add-_rcu-tag-for-rcu-protected-pointer-in-netns_xfrm/20190304-135248
reproduce:
        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

All warnings (new ones prefixed by >>):

>> net/xfrm/xfrm_user.c:1198:39: sparse: warning: incorrect type in argument 1 (different address spaces)
   net/xfrm/xfrm_user.c:1198:39: sparse:    expected struct sock *sk
   net/xfrm/xfrm_user.c:1198:39: sparse:    got struct sock [noderef] <asn:4> *nlsk
   net/xfrm/xfrm_user.c:1257:39: sparse: warning: incorrect type in argument 1 (different address spaces)
   net/xfrm/xfrm_user.c:1257:39: sparse:    expected struct sock *sk
   net/xfrm/xfrm_user.c:1257:39: sparse:    got struct sock [noderef] <asn:4> *nlsk
   net/xfrm/xfrm_user.c:1277:46: sparse: warning: incorrect type in argument 1 (different address spaces)
   net/xfrm/xfrm_user.c:1277:46: sparse:    expected struct sock *sk
   net/xfrm/xfrm_user.c:1277:46: sparse:    got struct sock [noderef] <asn:4> *nlsk
   net/xfrm/xfrm_user.c:1340:38: sparse: warning: incorrect type in argument 1 (different address spaces)
   net/xfrm/xfrm_user.c:1340:38: sparse:    expected struct sock *sk
   net/xfrm/xfrm_user.c:1340:38: sparse:    got struct sock [noderef] <asn:4> *nlsk
   net/xfrm/xfrm_user.c:1906:54: sparse: warning: incorrect type in argument 1 (different address spaces)
   net/xfrm/xfrm_user.c:1906:54: sparse:    expected struct sock *sk
   net/xfrm/xfrm_user.c:1906:54: sparse:    got struct sock [noderef] <asn:4> *nlsk
   net/xfrm/xfrm_user.c:2065:38: sparse: warning: incorrect type in argument 1 (different address spaces)
   net/xfrm/xfrm_user.c:2065:38: sparse:    expected struct sock *sk
   net/xfrm/xfrm_user.c:2065:38: sparse:    got struct sock [noderef] <asn:4> *nlsk
   net/xfrm/xfrm_user.c:2655:60: sparse: warning: incorrect type in argument 1 (different address spaces)
   net/xfrm/xfrm_user.c:2655:60: sparse:    expected struct sock *ssk
   net/xfrm/xfrm_user.c:2655:60: sparse:    got struct sock [noderef] <asn:4> *nlsk

sparse warnings: (new ones prefixed by >>)

   net/xfrm/xfrm_user.c:1198:39: sparse: warning: incorrect type in argument 1 (different address spaces)
>> net/xfrm/xfrm_user.c:1198:39: sparse:    expected struct sock *sk
>> net/xfrm/xfrm_user.c:1198:39: sparse:    got struct sock [noderef] <asn:4> *nlsk
   net/xfrm/xfrm_user.c:1257:39: sparse: warning: incorrect type in argument 1 (different address spaces)
   net/xfrm/xfrm_user.c:1257:39: sparse:    expected struct sock *sk
   net/xfrm/xfrm_user.c:1257:39: sparse:    got struct sock [noderef] <asn:4> *nlsk
   net/xfrm/xfrm_user.c:1277:46: sparse: warning: incorrect type in argument 1 (different address spaces)
   net/xfrm/xfrm_user.c:1277:46: sparse:    expected struct sock *sk
   net/xfrm/xfrm_user.c:1277:46: sparse:    got struct sock [noderef] <asn:4> *nlsk
   net/xfrm/xfrm_user.c:1340:38: sparse: warning: incorrect type in argument 1 (different address spaces)
   net/xfrm/xfrm_user.c:1340:38: sparse:    expected struct sock *sk
   net/xfrm/xfrm_user.c:1340:38: sparse:    got struct sock [noderef] <asn:4> *nlsk
   net/xfrm/xfrm_user.c:1906:54: sparse: warning: incorrect type in argument 1 (different address spaces)
   net/xfrm/xfrm_user.c:1906:54: sparse:    expected struct sock *sk
   net/xfrm/xfrm_user.c:1906:54: sparse:    got struct sock [noderef] <asn:4> *nlsk
   net/xfrm/xfrm_user.c:2065:38: sparse: warning: incorrect type in argument 1 (different address spaces)
   net/xfrm/xfrm_user.c:2065:38: sparse:    expected struct sock *sk
   net/xfrm/xfrm_user.c:2065:38: sparse:    got struct sock [noderef] <asn:4> *nlsk
   net/xfrm/xfrm_user.c:2655:60: sparse: warning: incorrect type in argument 1 (different address spaces)
>> net/xfrm/xfrm_user.c:2655:60: sparse:    expected struct sock *ssk
   net/xfrm/xfrm_user.c:2655:60: sparse:    got struct sock [noderef] <asn:4> *nlsk

vim +1198 net/xfrm/xfrm_user.c

880a6fab Christophe Gouault           2014-08-29  1180  
ecfd6b18 Jamal Hadi Salim             2007-04-28  1181  static int xfrm_get_spdinfo(struct sk_buff *skb, struct nlmsghdr *nlh,
5424f32e Thomas Graf                  2007-08-22  1182  		struct nlattr **attrs)
ecfd6b18 Jamal Hadi Salim             2007-04-28  1183  {
a6483b79 Alexey Dobriyan              2008-11-25  1184  	struct net *net = sock_net(skb->sk);
ecfd6b18 Jamal Hadi Salim             2007-04-28  1185  	struct sk_buff *r_skb;
7b67c857 Thomas Graf                  2007-08-22  1186  	u32 *flags = nlmsg_data(nlh);
15e47304 Eric W. Biederman            2012-09-07  1187  	u32 sportid = NETLINK_CB(skb).portid;
ecfd6b18 Jamal Hadi Salim             2007-04-28  1188  	u32 seq = nlh->nlmsg_seq;
2fc5f83b Gustavo A. R. Silva          2017-10-26  1189  	int err;
ecfd6b18 Jamal Hadi Salim             2007-04-28  1190  
7deb2264 Thomas Graf                  2007-08-22  1191  	r_skb = nlmsg_new(xfrm_spdinfo_msgsize(), GFP_ATOMIC);
ecfd6b18 Jamal Hadi Salim             2007-04-28  1192  	if (r_skb == NULL)
ecfd6b18 Jamal Hadi Salim             2007-04-28  1193  		return -ENOMEM;
ecfd6b18 Jamal Hadi Salim             2007-04-28  1194  
2fc5f83b Gustavo A. R. Silva          2017-10-26  1195  	err = build_spdinfo(r_skb, net, sportid, seq, *flags);
2fc5f83b Gustavo A. R. Silva          2017-10-26  1196  	BUG_ON(err < 0);
ecfd6b18 Jamal Hadi Salim             2007-04-28  1197  
15e47304 Eric W. Biederman            2012-09-07 @1198  	return nlmsg_unicast(net->xfrm.nlsk, r_skb, sportid);
ecfd6b18 Jamal Hadi Salim             2007-04-28  1199  }
ecfd6b18 Jamal Hadi Salim             2007-04-28  1200  
a1b831f2 Alexey Dobriyan              2017-09-21  1201  static inline unsigned int xfrm_sadinfo_msgsize(void)
7deb2264 Thomas Graf                  2007-08-22  1202  {
7deb2264 Thomas Graf                  2007-08-22  1203  	return NLMSG_ALIGN(4)
7deb2264 Thomas Graf                  2007-08-22  1204  	       + nla_total_size(sizeof(struct xfrmu_sadhinfo))
7deb2264 Thomas Graf                  2007-08-22  1205  	       + nla_total_size(4); /* XFRMA_SAD_CNT */
7deb2264 Thomas Graf                  2007-08-22  1206  }
7deb2264 Thomas Graf                  2007-08-22  1207  
e071041b Alexey Dobriyan              2010-01-23  1208  static int build_sadinfo(struct sk_buff *skb, struct net *net,
15e47304 Eric W. Biederman            2012-09-07  1209  			 u32 portid, u32 seq, u32 flags)
28d8909b Jamal Hadi Salim             2007-04-26  1210  {
af11e316 Jamal Hadi Salim             2007-05-04  1211  	struct xfrmk_sadinfo si;
af11e316 Jamal Hadi Salim             2007-05-04  1212  	struct xfrmu_sadhinfo sh;
28d8909b Jamal Hadi Salim             2007-04-26  1213  	struct nlmsghdr *nlh;
1d1e34dd David S. Miller              2012-06-27  1214  	int err;
28d8909b Jamal Hadi Salim             2007-04-26  1215  	u32 *f;
28d8909b Jamal Hadi Salim             2007-04-26  1216  
15e47304 Eric W. Biederman            2012-09-07  1217  	nlh = nlmsg_put(skb, portid, seq, XFRM_MSG_NEWSADINFO, sizeof(u32), 0);
25985edc Lucas De Marchi              2011-03-30  1218  	if (nlh == NULL) /* shouldn't really happen ... */
28d8909b Jamal Hadi Salim             2007-04-26  1219  		return -EMSGSIZE;
28d8909b Jamal Hadi Salim             2007-04-26  1220  
28d8909b Jamal Hadi Salim             2007-04-26  1221  	f = nlmsg_data(nlh);
28d8909b Jamal Hadi Salim             2007-04-26  1222  	*f = flags;
e071041b Alexey Dobriyan              2010-01-23  1223  	xfrm_sad_getinfo(net, &si);
28d8909b Jamal Hadi Salim             2007-04-26  1224  
af11e316 Jamal Hadi Salim             2007-05-04  1225  	sh.sadhmcnt = si.sadhmcnt;
af11e316 Jamal Hadi Salim             2007-05-04  1226  	sh.sadhcnt = si.sadhcnt;
af11e316 Jamal Hadi Salim             2007-05-04  1227  
1d1e34dd David S. Miller              2012-06-27  1228  	err = nla_put_u32(skb, XFRMA_SAD_CNT, si.sadcnt);
1d1e34dd David S. Miller              2012-06-27  1229  	if (!err)
1d1e34dd David S. Miller              2012-06-27  1230  		err = nla_put(skb, XFRMA_SAD_HINFO, sizeof(sh), &sh);
1d1e34dd David S. Miller              2012-06-27  1231  	if (err) {
1d1e34dd David S. Miller              2012-06-27  1232  		nlmsg_cancel(skb, nlh);
1d1e34dd David S. Miller              2012-06-27  1233  		return err;
1d1e34dd David S. Miller              2012-06-27  1234  	}
28d8909b Jamal Hadi Salim             2007-04-26  1235  
053c095a Johannes Berg                2015-01-16  1236  	nlmsg_end(skb, nlh);
053c095a Johannes Berg                2015-01-16  1237  	return 0;
28d8909b Jamal Hadi Salim             2007-04-26  1238  }
28d8909b Jamal Hadi Salim             2007-04-26  1239  
28d8909b Jamal Hadi Salim             2007-04-26  1240  static int xfrm_get_sadinfo(struct sk_buff *skb, struct nlmsghdr *nlh,
5424f32e Thomas Graf                  2007-08-22  1241  		struct nlattr **attrs)
28d8909b Jamal Hadi Salim             2007-04-26  1242  {
a6483b79 Alexey Dobriyan              2008-11-25  1243  	struct net *net = sock_net(skb->sk);
28d8909b Jamal Hadi Salim             2007-04-26  1244  	struct sk_buff *r_skb;
7b67c857 Thomas Graf                  2007-08-22  1245  	u32 *flags = nlmsg_data(nlh);
15e47304 Eric W. Biederman            2012-09-07  1246  	u32 sportid = NETLINK_CB(skb).portid;
28d8909b Jamal Hadi Salim             2007-04-26  1247  	u32 seq = nlh->nlmsg_seq;
2fc5f83b Gustavo A. R. Silva          2017-10-26  1248  	int err;
28d8909b Jamal Hadi Salim             2007-04-26  1249  
7deb2264 Thomas Graf                  2007-08-22  1250  	r_skb = nlmsg_new(xfrm_sadinfo_msgsize(), GFP_ATOMIC);
28d8909b Jamal Hadi Salim             2007-04-26  1251  	if (r_skb == NULL)
28d8909b Jamal Hadi Salim             2007-04-26  1252  		return -ENOMEM;
28d8909b Jamal Hadi Salim             2007-04-26  1253  
2fc5f83b Gustavo A. R. Silva          2017-10-26  1254  	err = build_sadinfo(r_skb, net, sportid, seq, *flags);
2fc5f83b Gustavo A. R. Silva          2017-10-26  1255  	BUG_ON(err < 0);
28d8909b Jamal Hadi Salim             2007-04-26  1256  
15e47304 Eric W. Biederman            2012-09-07  1257  	return nlmsg_unicast(net->xfrm.nlsk, r_skb, sportid);
28d8909b Jamal Hadi Salim             2007-04-26  1258  }
28d8909b Jamal Hadi Salim             2007-04-26  1259  
22e70050 Christoph Hellwig            2007-01-02  1260  static int xfrm_get_sa(struct sk_buff *skb, struct nlmsghdr *nlh,
5424f32e Thomas Graf                  2007-08-22  1261  		struct nlattr **attrs)
^1da177e Linus Torvalds               2005-04-16  1262  {
fc34acd3 Alexey Dobriyan              2008-11-25  1263  	struct net *net = sock_net(skb->sk);
7b67c857 Thomas Graf                  2007-08-22  1264  	struct xfrm_usersa_id *p = nlmsg_data(nlh);
^1da177e Linus Torvalds               2005-04-16  1265  	struct xfrm_state *x;
^1da177e Linus Torvalds               2005-04-16  1266  	struct sk_buff *resp_skb;
eb2971b6 Masahide NAKAMURA            2006-08-23  1267  	int err = -ESRCH;
^1da177e Linus Torvalds               2005-04-16  1268  
fc34acd3 Alexey Dobriyan              2008-11-25  1269  	x = xfrm_user_state_lookup(net, p, attrs, &err);
^1da177e Linus Torvalds               2005-04-16  1270  	if (x == NULL)
^1da177e Linus Torvalds               2005-04-16  1271  		goto out_noput;
^1da177e Linus Torvalds               2005-04-16  1272  
^1da177e Linus Torvalds               2005-04-16  1273  	resp_skb = xfrm_state_netlink(skb, x, nlh->nlmsg_seq);
^1da177e Linus Torvalds               2005-04-16  1274  	if (IS_ERR(resp_skb)) {
^1da177e Linus Torvalds               2005-04-16  1275  		err = PTR_ERR(resp_skb);
^1da177e Linus Torvalds               2005-04-16  1276  	} else {
15e47304 Eric W. Biederman            2012-09-07  1277  		err = nlmsg_unicast(net->xfrm.nlsk, resp_skb, NETLINK_CB(skb).portid);
^1da177e Linus Torvalds               2005-04-16  1278  	}
^1da177e Linus Torvalds               2005-04-16  1279  	xfrm_state_put(x);
^1da177e Linus Torvalds               2005-04-16  1280  out_noput:
^1da177e Linus Torvalds               2005-04-16  1281  	return err;
^1da177e Linus Torvalds               2005-04-16  1282  }
^1da177e Linus Torvalds               2005-04-16  1283  
22e70050 Christoph Hellwig            2007-01-02  1284  static int xfrm_alloc_userspi(struct sk_buff *skb, struct nlmsghdr *nlh,
5424f32e Thomas Graf                  2007-08-22  1285  		struct nlattr **attrs)
^1da177e Linus Torvalds               2005-04-16  1286  {
fc34acd3 Alexey Dobriyan              2008-11-25  1287  	struct net *net = sock_net(skb->sk);
^1da177e Linus Torvalds               2005-04-16  1288  	struct xfrm_state *x;
^1da177e Linus Torvalds               2005-04-16  1289  	struct xfrm_userspi_info *p;
^1da177e Linus Torvalds               2005-04-16  1290  	struct sk_buff *resp_skb;
^1da177e Linus Torvalds               2005-04-16  1291  	xfrm_address_t *daddr;
^1da177e Linus Torvalds               2005-04-16  1292  	int family;
^1da177e Linus Torvalds               2005-04-16  1293  	int err;
6f26b61e Jamal Hadi Salim             2010-02-22  1294  	u32 mark;
6f26b61e Jamal Hadi Salim             2010-02-22  1295  	struct xfrm_mark m;
7e652640 Steffen Klassert             2018-06-12  1296  	u32 if_id = 0;
^1da177e Linus Torvalds               2005-04-16  1297  
7b67c857 Thomas Graf                  2007-08-22  1298  	p = nlmsg_data(nlh);
776e9dd9 Fan Du                       2013-12-16  1299  	err = verify_spi_info(p->info.id.proto, p->min, p->max);
^1da177e Linus Torvalds               2005-04-16  1300  	if (err)
^1da177e Linus Torvalds               2005-04-16  1301  		goto out_noput;
^1da177e Linus Torvalds               2005-04-16  1302  
^1da177e Linus Torvalds               2005-04-16  1303  	family = p->info.family;
^1da177e Linus Torvalds               2005-04-16  1304  	daddr = &p->info.id.daddr;
^1da177e Linus Torvalds               2005-04-16  1305  
^1da177e Linus Torvalds               2005-04-16  1306  	x = NULL;
6f26b61e Jamal Hadi Salim             2010-02-22  1307  
6f26b61e Jamal Hadi Salim             2010-02-22  1308  	mark = xfrm_mark_get(attrs, &m);
7e652640 Steffen Klassert             2018-06-12  1309  
7e652640 Steffen Klassert             2018-06-12  1310  	if (attrs[XFRMA_IF_ID])
7e652640 Steffen Klassert             2018-06-12  1311  		if_id = nla_get_u32(attrs[XFRMA_IF_ID]);
7e652640 Steffen Klassert             2018-06-12  1312  
^1da177e Linus Torvalds               2005-04-16  1313  	if (p->info.seq) {
6f26b61e Jamal Hadi Salim             2010-02-22  1314  		x = xfrm_find_acq_byseq(net, mark, p->info.seq);
70e94e66 YOSHIFUJI Hideaki / 吉藤英明 2013-01-29  1315  		if (x && !xfrm_addr_equal(&x->id.daddr, daddr, family)) {
^1da177e Linus Torvalds               2005-04-16  1316  			xfrm_state_put(x);
^1da177e Linus Torvalds               2005-04-16  1317  			x = NULL;
^1da177e Linus Torvalds               2005-04-16  1318  		}
^1da177e Linus Torvalds               2005-04-16  1319  	}
^1da177e Linus Torvalds               2005-04-16  1320  
^1da177e Linus Torvalds               2005-04-16  1321  	if (!x)
6f26b61e Jamal Hadi Salim             2010-02-22  1322  		x = xfrm_find_acq(net, &m, p->info.mode, p->info.reqid,
7e652640 Steffen Klassert             2018-06-12  1323  				  if_id, p->info.id.proto, daddr,
^1da177e Linus Torvalds               2005-04-16  1324  				  &p->info.saddr, 1,
^1da177e Linus Torvalds               2005-04-16  1325  				  family);
^1da177e Linus Torvalds               2005-04-16  1326  	err = -ENOENT;
^1da177e Linus Torvalds               2005-04-16  1327  	if (x == NULL)
^1da177e Linus Torvalds               2005-04-16  1328  		goto out_noput;
^1da177e Linus Torvalds               2005-04-16  1329  
658b219e Herbert Xu                   2007-10-09  1330  	err = xfrm_alloc_spi(x, p->min, p->max);
658b219e Herbert Xu                   2007-10-09  1331  	if (err)
658b219e Herbert Xu                   2007-10-09  1332  		goto out;
^1da177e Linus Torvalds               2005-04-16  1333  
^1da177e Linus Torvalds               2005-04-16  1334  	resp_skb = xfrm_state_netlink(skb, x, nlh->nlmsg_seq);
^1da177e Linus Torvalds               2005-04-16  1335  	if (IS_ERR(resp_skb)) {
^1da177e Linus Torvalds               2005-04-16  1336  		err = PTR_ERR(resp_skb);
^1da177e Linus Torvalds               2005-04-16  1337  		goto out;
^1da177e Linus Torvalds               2005-04-16  1338  	}
^1da177e Linus Torvalds               2005-04-16  1339  
15e47304 Eric W. Biederman            2012-09-07 @1340  	err = nlmsg_unicast(net->xfrm.nlsk, resp_skb, NETLINK_CB(skb).portid);
^1da177e Linus Torvalds               2005-04-16  1341  
^1da177e Linus Torvalds               2005-04-16  1342  out:
^1da177e Linus Torvalds               2005-04-16  1343  	xfrm_state_put(x);
^1da177e Linus Torvalds               2005-04-16  1344  out_noput:
^1da177e Linus Torvalds               2005-04-16  1345  	return err;
^1da177e Linus Torvalds               2005-04-16  1346  }
^1da177e Linus Torvalds               2005-04-16  1347  

:::::: The code at line 1198 was first introduced by commit
:::::: 15e473046cb6e5d18a4d0057e61d76315230382b netlink: Rename pid to portid to avoid confusion

:::::: TO: Eric W. Biederman <ebiederm@...ssion.com>
:::::: CC: David S. Miller <davem@...emloft.net>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Download attachment ".config.gz" of type "application/gzip" (67254 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ