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:   Wed, 30 Dec 2020 00:49:01 +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/ipv6/ipv6_sockglue.c:1101: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: 3021ad529950d07e0408d65d0f1df00454c1d223 net/ipv6: remove compat_ipv6_{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=3021ad529950d07e0408d65d0f1df00454c1d223
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 3021ad529950d07e0408d65d0f1df00454c1d223
        # 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/ipv6/ipv6_sockglue.c:331:29: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const *addr @@     got int const [noderef] __user *__gu_ptr @@
   net/ipv6/ipv6_sockglue.c:331:29: sparse:     expected void const *addr
   net/ipv6/ipv6_sockglue.c:331:29: sparse:     got int const [noderef] __user *__gu_ptr
   net/ipv6/ipv6_sockglue.c:1059:21: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int *__pu_addr @@     got int [noderef] __user *optlen @@
   net/ipv6/ipv6_sockglue.c:1059:21: sparse:     expected int *__pu_addr
   net/ipv6/ipv6_sockglue.c:1059:21: sparse:     got int [noderef] __user *optlen
   net/ipv6/ipv6_sockglue.c:1077:13: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const *addr @@     got int const [noderef] __user *__gu_ptr @@
   net/ipv6/ipv6_sockglue.c:1077:13: sparse:     expected void const *addr
   net/ipv6/ipv6_sockglue.c:1077:13: sparse:     got int const [noderef] __user *__gu_ptr
   net/ipv6/ipv6_sockglue.c:1100:13: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int *__pu_addr @@     got int [noderef] __user *optlen @@
   net/ipv6/ipv6_sockglue.c:1100:13: sparse:     expected int *__pu_addr
   net/ipv6/ipv6_sockglue.c:1100:13: sparse:     got int [noderef] __user *optlen
>> net/ipv6/ipv6_sockglue.c:1101:13: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected unsigned int *__pu_addr @@     got unsigned int [noderef] __user * @@
   net/ipv6/ipv6_sockglue.c:1101:13: sparse:     expected unsigned int *__pu_addr
   net/ipv6/ipv6_sockglue.c:1101:13: sparse:     got unsigned int [noderef] __user *
   net/ipv6/ipv6_sockglue.c:1102:13: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected unsigned int *__pu_addr @@     got unsigned int [noderef] __user * @@
   net/ipv6/ipv6_sockglue.c:1102:13: sparse:     expected unsigned int *__pu_addr
   net/ipv6/ipv6_sockglue.c:1102:13: sparse:     got unsigned int [noderef] __user *
   net/ipv6/ipv6_sockglue.c:1117:13: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const *addr @@     got int const [noderef] __user *__gu_ptr @@
   net/ipv6/ipv6_sockglue.c:1117:13: sparse:     expected void const *addr
   net/ipv6/ipv6_sockglue.c:1117:13: sparse:     got int const [noderef] __user *__gu_ptr
   net/ipv6/ipv6_sockglue.c:1141:33: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *msg_control @@     got char [noderef] __user *optval @@
   net/ipv6/ipv6_sockglue.c:1141:33: sparse:     expected void *msg_control
   net/ipv6/ipv6_sockglue.c:1141:33: sparse:     got char [noderef] __user *optval
   net/ipv6/ipv6_sockglue.c:1187:24: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int *__pu_addr @@     got int [noderef] __user *optlen @@
   net/ipv6/ipv6_sockglue.c:1187:24: sparse:     expected int *__pu_addr
   net/ipv6/ipv6_sockglue.c:1187:24: sparse:     got int [noderef] __user *optlen
   net/ipv6/ipv6_sockglue.c:1247:24: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int *__pu_addr @@     got int [noderef] __user *optlen @@
   net/ipv6/ipv6_sockglue.c:1247:24: sparse:     expected int *__pu_addr
   net/ipv6/ipv6_sockglue.c:1247:24: sparse:     got int [noderef] __user *optlen
   net/ipv6/ipv6_sockglue.c:1301:21: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int *__pu_addr @@     got int [noderef] __user *optlen @@
   net/ipv6/ipv6_sockglue.c:1301:21: sparse:     expected int *__pu_addr
   net/ipv6/ipv6_sockglue.c:1301:21: sparse:     got int [noderef] __user *optlen
   net/ipv6/ipv6_sockglue.c:1395:21: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int *__pu_addr @@     got int [noderef] __user *optlen @@
   net/ipv6/ipv6_sockglue.c:1395:21: sparse:     expected int *__pu_addr
   net/ipv6/ipv6_sockglue.c:1395:21: sparse:     got int [noderef] __user *optlen
   net/ipv6/ipv6_sockglue.c:1445:13: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int *__pu_addr @@     got int [noderef] __user *optlen @@
   net/ipv6/ipv6_sockglue.c:1445:13: sparse:     expected int *__pu_addr
   net/ipv6/ipv6_sockglue.c:1445:13: sparse:     got int [noderef] __user *optlen

vim +1101 net/ipv6/ipv6_sockglue.c

333fad5364d6b45 YOSHIFUJI Hideaki 2005-09-08  1037  
d5541e85cd40118 Christoph Hellwig 2020-07-17  1038  static int ipv6_get_msfilter(struct sock *sk, void __user *optval,
d5541e85cd40118 Christoph Hellwig 2020-07-17  1039  		int __user *optlen, int len)
^1da177e4c3f415 Linus Torvalds    2005-04-16  1040  {
931ca7ab7fe804d Al Viro           2020-03-29  1041  	const int size0 = offsetof(struct group_filter, gf_slist);
d5541e85cd40118 Christoph Hellwig 2020-07-17  1042  	struct group_filter __user *p = optval;
d5541e85cd40118 Christoph Hellwig 2020-07-17  1043  	struct group_filter gsf;
931ca7ab7fe804d Al Viro           2020-03-29  1044  	int num;
^1da177e4c3f415 Linus Torvalds    2005-04-16  1045  	int err;
^1da177e4c3f415 Linus Torvalds    2005-04-16  1046  
931ca7ab7fe804d Al Viro           2020-03-29  1047  	if (len < size0)
^1da177e4c3f415 Linus Torvalds    2005-04-16  1048  		return -EINVAL;
931ca7ab7fe804d Al Viro           2020-03-29  1049  	if (copy_from_user(&gsf, p, size0))
^1da177e4c3f415 Linus Torvalds    2005-04-16  1050  		return -EFAULT;
20c61fbd8deb2ad YOSHIFUJI Hideaki 2008-04-28  1051  	if (gsf.gf_group.ss_family != AF_INET6)
20c61fbd8deb2ad YOSHIFUJI Hideaki 2008-04-28  1052  		return -EADDRNOTAVAIL;
931ca7ab7fe804d Al Viro           2020-03-29  1053  	num = gsf.gf_numsrc;
^1da177e4c3f415 Linus Torvalds    2005-04-16  1054  	lock_sock(sk);
931ca7ab7fe804d Al Viro           2020-03-29  1055  	err = ip6_mc_msfget(sk, &gsf, p->gf_slist);
931ca7ab7fe804d Al Viro           2020-03-29  1056  	if (!err) {
931ca7ab7fe804d Al Viro           2020-03-29  1057  		if (num > gsf.gf_numsrc)
931ca7ab7fe804d Al Viro           2020-03-29  1058  			num = gsf.gf_numsrc;
931ca7ab7fe804d Al Viro           2020-03-29 @1059  		if (put_user(GROUP_FILTER_SIZE(num), optlen) ||
931ca7ab7fe804d Al Viro           2020-03-29  1060  		    copy_to_user(p, &gsf, size0))
931ca7ab7fe804d Al Viro           2020-03-29  1061  			err = -EFAULT;
931ca7ab7fe804d Al Viro           2020-03-29  1062  	}
^1da177e4c3f415 Linus Torvalds    2005-04-16  1063  	release_sock(sk);
^1da177e4c3f415 Linus Torvalds    2005-04-16  1064  	return err;
^1da177e4c3f415 Linus Torvalds    2005-04-16  1065  }
^1da177e4c3f415 Linus Torvalds    2005-04-16  1066  
d5541e85cd40118 Christoph Hellwig 2020-07-17  1067  static int compat_ipv6_get_msfilter(struct sock *sk, void __user *optval,
d5541e85cd40118 Christoph Hellwig 2020-07-17  1068  		int __user *optlen)
d5541e85cd40118 Christoph Hellwig 2020-07-17  1069  {
d5541e85cd40118 Christoph Hellwig 2020-07-17  1070  	const int size0 = offsetof(struct compat_group_filter, gf_slist);
d5541e85cd40118 Christoph Hellwig 2020-07-17  1071  	struct compat_group_filter __user *p = optval;
d5541e85cd40118 Christoph Hellwig 2020-07-17  1072  	struct compat_group_filter gf32;
d5541e85cd40118 Christoph Hellwig 2020-07-17  1073  	struct group_filter gf;
d5541e85cd40118 Christoph Hellwig 2020-07-17  1074  	int len, err;
d5541e85cd40118 Christoph Hellwig 2020-07-17  1075  	int num;
d5541e85cd40118 Christoph Hellwig 2020-07-17  1076  
d5541e85cd40118 Christoph Hellwig 2020-07-17  1077  	if (get_user(len, optlen))
d5541e85cd40118 Christoph Hellwig 2020-07-17  1078  		return -EFAULT;
d5541e85cd40118 Christoph Hellwig 2020-07-17  1079  	if (len < size0)
d5541e85cd40118 Christoph Hellwig 2020-07-17  1080  		return -EINVAL;
d5541e85cd40118 Christoph Hellwig 2020-07-17  1081  
d5541e85cd40118 Christoph Hellwig 2020-07-17  1082  	if (copy_from_user(&gf32, p, size0))
d5541e85cd40118 Christoph Hellwig 2020-07-17  1083  		return -EFAULT;
d5541e85cd40118 Christoph Hellwig 2020-07-17  1084  	gf.gf_interface = gf32.gf_interface;
d5541e85cd40118 Christoph Hellwig 2020-07-17  1085  	gf.gf_fmode = gf32.gf_fmode;
d5541e85cd40118 Christoph Hellwig 2020-07-17  1086  	num = gf.gf_numsrc = gf32.gf_numsrc;
d5541e85cd40118 Christoph Hellwig 2020-07-17  1087  	gf.gf_group = gf32.gf_group;
d5541e85cd40118 Christoph Hellwig 2020-07-17  1088  
d5541e85cd40118 Christoph Hellwig 2020-07-17  1089  	if (gf.gf_group.ss_family != AF_INET6)
d5541e85cd40118 Christoph Hellwig 2020-07-17  1090  		return -EADDRNOTAVAIL;
d5541e85cd40118 Christoph Hellwig 2020-07-17  1091  
d5541e85cd40118 Christoph Hellwig 2020-07-17  1092  	lock_sock(sk);
d5541e85cd40118 Christoph Hellwig 2020-07-17  1093  	err = ip6_mc_msfget(sk, &gf, p->gf_slist);
d5541e85cd40118 Christoph Hellwig 2020-07-17  1094  	release_sock(sk);
d5541e85cd40118 Christoph Hellwig 2020-07-17  1095  	if (err)
d5541e85cd40118 Christoph Hellwig 2020-07-17  1096  		return err;
d5541e85cd40118 Christoph Hellwig 2020-07-17  1097  	if (num > gf.gf_numsrc)
d5541e85cd40118 Christoph Hellwig 2020-07-17  1098  		num = gf.gf_numsrc;
d5541e85cd40118 Christoph Hellwig 2020-07-17  1099  	len = GROUP_FILTER_SIZE(num) - (sizeof(gf)-sizeof(gf32));
d5541e85cd40118 Christoph Hellwig 2020-07-17  1100  	if (put_user(len, optlen) ||
d5541e85cd40118 Christoph Hellwig 2020-07-17 @1101  	    put_user(gf.gf_fmode, &p->gf_fmode) ||
d5541e85cd40118 Christoph Hellwig 2020-07-17  1102  	    put_user(gf.gf_numsrc, &p->gf_numsrc))
d5541e85cd40118 Christoph Hellwig 2020-07-17  1103  		return -EFAULT;
d5541e85cd40118 Christoph Hellwig 2020-07-17  1104  	return 0;
d5541e85cd40118 Christoph Hellwig 2020-07-17  1105  }
d5541e85cd40118 Christoph Hellwig 2020-07-17  1106  

:::::: The code at line 1101 was first introduced by commit
:::::: d5541e85cd40118a817f015ce3af1f41a7d7de1b net/ipv6: 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