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  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]
Date:   Tue, 29 Dec 2020 22:45:52 +0800
From:   kernel test robot <lkp@...el.com>
To:     Christoph Hellwig <hch@....de>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: net/ipv4/ip_sockglue.c:1489:13: sparse: sparse: incorrect type in
 initializer (different address spaces)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   dea8dcf2a9fa8cc540136a6cd885c3beece16ec3
commit: b6238c04c0e5dbe7ae4ea48e96e004905b120a04 net/ipv4: remove compat_ip_{get,set}sockopt
date:   5 months ago
config: csky-randconfig-s032-20201227 (attached as .config)
compiler: csky-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.3-184-g1b896707-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b6238c04c0e5dbe7ae4ea48e96e004905b120a04
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout b6238c04c0e5dbe7ae4ea48e96e004905b120a04
        # 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=csky 

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/ipv4/ip_sockglue.c:908:29: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const *addr @@     got int const [noderef] __user *__gu_ptr @@
   net/ipv4/ip_sockglue.c:908:29: sparse:     expected void const *addr
   net/ipv4/ip_sockglue.c:908:29: sparse:     got int const [noderef] __user *__gu_ptr
   net/ipv4/ip_sockglue.c:913:29: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const *addr @@     got unsigned char const [noderef] __user *__gu_ptr @@
   net/ipv4/ip_sockglue.c:913:29: sparse:     expected void const *addr
   net/ipv4/ip_sockglue.c:913:29: sparse:     got unsigned char const [noderef] __user *__gu_ptr
   net/ipv4/ip_sockglue.c:1456:13: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int *__pu_addr @@     got int [noderef] __user *optlen @@
   net/ipv4/ip_sockglue.c:1456:13: sparse:     expected int *__pu_addr
   net/ipv4/ip_sockglue.c:1456:13: sparse:     got int [noderef] __user *optlen
   net/ipv4/ip_sockglue.c:1488:13: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int *__pu_addr @@     got int [noderef] __user *optlen @@
   net/ipv4/ip_sockglue.c:1488:13: sparse:     expected int *__pu_addr
   net/ipv4/ip_sockglue.c:1488:13: sparse:     got int [noderef] __user *optlen
>> net/ipv4/ip_sockglue.c:1489:13: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected unsigned int *__pu_addr @@     got unsigned int [noderef] __user * @@
   net/ipv4/ip_sockglue.c:1489:13: sparse:     expected unsigned int *__pu_addr
   net/ipv4/ip_sockglue.c:1489:13: sparse:     got unsigned int [noderef] __user *
   net/ipv4/ip_sockglue.c:1490:13: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected unsigned int *__pu_addr @@     got unsigned int [noderef] __user * @@
   net/ipv4/ip_sockglue.c:1490:13: sparse:     expected unsigned int *__pu_addr
   net/ipv4/ip_sockglue.c:1490:13: sparse:     got unsigned int [noderef] __user *
   net/ipv4/ip_sockglue.c:1509:13: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const *addr @@     got int const [noderef] __user *__gu_ptr @@
   net/ipv4/ip_sockglue.c:1509:13: sparse:     expected void const *addr
   net/ipv4/ip_sockglue.c:1509:13: sparse:     got int const [noderef] __user *__gu_ptr
   net/ipv4/ip_sockglue.c:1535:32: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int *__pu_addr @@     got int [noderef] __user *optlen @@
   net/ipv4/ip_sockglue.c:1535:32: sparse:     expected int *__pu_addr
   net/ipv4/ip_sockglue.c:1535:32: sparse:     got int [noderef] __user *optlen
   net/ipv4/ip_sockglue.c:1540:21: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int *__pu_addr @@     got int [noderef] __user *optlen @@
   net/ipv4/ip_sockglue.c:1540:21: sparse:     expected int *__pu_addr
   net/ipv4/ip_sockglue.c:1540:21: sparse:     got int [noderef] __user *optlen
   net/ipv4/ip_sockglue.c:1630:21: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int *__pu_addr @@     got int [noderef] __user *optlen @@
   net/ipv4/ip_sockglue.c:1630:21: sparse:     expected int *__pu_addr
   net/ipv4/ip_sockglue.c:1630:21: sparse:     got int [noderef] __user *optlen
   net/ipv4/ip_sockglue.c:1693:24: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int *__pu_addr @@     got int [noderef] __user *optlen @@
   net/ipv4/ip_sockglue.c:1693:24: sparse:     expected int *__pu_addr
   net/ipv4/ip_sockglue.c:1693:24: sparse:     got int [noderef] __user *optlen
   net/ipv4/ip_sockglue.c:1713:21: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int *__pu_addr @@     got int [noderef] __user *optlen @@
   net/ipv4/ip_sockglue.c:1713:21: sparse:     expected int *__pu_addr
   net/ipv4/ip_sockglue.c:1713:21: sparse:     got int [noderef] __user *optlen
   net/ipv4/ip_sockglue.c:1719:21: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int *__pu_addr @@     got int [noderef] __user *optlen @@
   net/ipv4/ip_sockglue.c:1719:21: sparse:     expected int *__pu_addr
   net/ipv4/ip_sockglue.c:1719:21: sparse:     got int [noderef] __user *optlen

vim +1489 net/ipv4/ip_sockglue.c

49e74c24f31048b Christoph Hellwig 2020-07-17  1461  
49e74c24f31048b Christoph Hellwig 2020-07-17  1462  static int compat_ip_get_mcast_msfilter(struct sock *sk, void __user *optval,
b6238c04c0e5dbe Christoph Hellwig 2020-07-17  1463  		int __user *optlen, int len)
49e74c24f31048b Christoph Hellwig 2020-07-17  1464  {
49e74c24f31048b Christoph Hellwig 2020-07-17  1465  	const int size0 = offsetof(struct compat_group_filter, gf_slist);
49e74c24f31048b Christoph Hellwig 2020-07-17  1466  	struct compat_group_filter __user *p = optval;
49e74c24f31048b Christoph Hellwig 2020-07-17  1467  	struct compat_group_filter gf32;
49e74c24f31048b Christoph Hellwig 2020-07-17  1468  	struct group_filter gf;
49e74c24f31048b Christoph Hellwig 2020-07-17  1469  	int num;
b6238c04c0e5dbe Christoph Hellwig 2020-07-17  1470  	int err;
49e74c24f31048b Christoph Hellwig 2020-07-17  1471  
49e74c24f31048b Christoph Hellwig 2020-07-17  1472  	if (len < size0)
49e74c24f31048b Christoph Hellwig 2020-07-17  1473  		return -EINVAL;
49e74c24f31048b Christoph Hellwig 2020-07-17  1474  	if (copy_from_user(&gf32, p, size0))
49e74c24f31048b Christoph Hellwig 2020-07-17  1475  		return -EFAULT;
49e74c24f31048b Christoph Hellwig 2020-07-17  1476  
49e74c24f31048b Christoph Hellwig 2020-07-17  1477  	gf.gf_interface = gf32.gf_interface;
49e74c24f31048b Christoph Hellwig 2020-07-17  1478  	gf.gf_fmode = gf32.gf_fmode;
49e74c24f31048b Christoph Hellwig 2020-07-17  1479  	num = gf.gf_numsrc = gf32.gf_numsrc;
49e74c24f31048b Christoph Hellwig 2020-07-17  1480  	gf.gf_group = gf32.gf_group;
49e74c24f31048b Christoph Hellwig 2020-07-17  1481  
49e74c24f31048b Christoph Hellwig 2020-07-17  1482  	err = ip_mc_gsfget(sk, &gf, p->gf_slist);
49e74c24f31048b Christoph Hellwig 2020-07-17  1483  	if (err)
49e74c24f31048b Christoph Hellwig 2020-07-17  1484  		return err;
49e74c24f31048b Christoph Hellwig 2020-07-17  1485  	if (gf.gf_numsrc < num)
49e74c24f31048b Christoph Hellwig 2020-07-17  1486  		num = gf.gf_numsrc;
49e74c24f31048b Christoph Hellwig 2020-07-17  1487  	len = GROUP_FILTER_SIZE(num) - (sizeof(gf) - sizeof(gf32));
49e74c24f31048b Christoph Hellwig 2020-07-17  1488  	if (put_user(len, optlen) ||
49e74c24f31048b Christoph Hellwig 2020-07-17 @1489  	    put_user(gf.gf_fmode, &p->gf_fmode) ||
49e74c24f31048b Christoph Hellwig 2020-07-17  1490  	    put_user(gf.gf_numsrc, &p->gf_numsrc))
49e74c24f31048b Christoph Hellwig 2020-07-17  1491  		return -EFAULT;
49e74c24f31048b Christoph Hellwig 2020-07-17  1492  	return 0;
49e74c24f31048b Christoph Hellwig 2020-07-17  1493  }
49e74c24f31048b Christoph Hellwig 2020-07-17  1494  

:::::: The code at line 1489 was first introduced by commit
:::::: 49e74c24f31048b4faa3cfcccb93f444abb0b910 net/ipv4: factor out MCAST_MSFILTER getsockopt helpers

:::::: TO: Christoph Hellwig <hch@....de>
:::::: CC: David S. Miller <davem@...emloft.net>

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

Powered by blists - more mailing lists