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: <202012300229.c8h8rbjt-lkp@intel.com>
Date:   Wed, 30 Dec 2020 02:31:36 +0800
From:   kernel test robot <lkp@...el.com>
To:     Robin Murphy <robin.murphy@....com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Joerg Roedel <jroedel@...e.de>
Subject: samples/vfio-mdev/mbochs.c:1270:21: sparse: sparse: incorrect type
 in argument 1 (different address spaces)

Hi Robin,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   dea8dcf2a9fa8cc540136a6cd885c3beece16ec3
commit: b4ceb4a5359ed1c9ba4a20acf3a70d4bbead3248 iommu: Tidy up Kconfig for SoC IOMMUs
date:   6 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=b4ceb4a5359ed1c9ba4a20acf3a70d4bbead3248
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout b4ceb4a5359ed1c9ba4a20acf3a70d4bbead3248
        # 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 >>)"
>> samples/vfio-mdev/mbochs.c:1270:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const *addr @@     got unsigned int const [noderef] __user *__gu_ptr @@
   samples/vfio-mdev/mbochs.c:1270:21: sparse:     expected void const *addr
   samples/vfio-mdev/mbochs.c:1270:21: sparse:     got unsigned int const [noderef] __user *__gu_ptr
   samples/vfio-mdev/mbochs.c:1346:1: sparse: sparse: symbol 'mdev_type_attr_name' was not declared. Should it be static?
   samples/vfio-mdev/mbochs.c:1356:1: sparse: sparse: symbol 'mdev_type_attr_description' was not declared. Should it be static?
   samples/vfio-mdev/mbochs.c:1366:1: sparse: sparse: symbol 'mdev_type_attr_available_instances' was not declared. Should it be static?
   samples/vfio-mdev/mbochs.c:1373:1: sparse: sparse: symbol 'mdev_type_attr_device_api' was not declared. Should it be static?

vim +1270 samples/vfio-mdev/mbochs.c

a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1166  
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1167  static long mbochs_ioctl(struct mdev_device *mdev, unsigned int cmd,
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1168  			unsigned long arg)
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1169  {
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1170  	int ret = 0;
104c7405a64d937 Gerd Hoffmann 2018-09-21  1171  	unsigned long minsz, outsz;
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1172  
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1173  	switch (cmd) {
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1174  	case VFIO_DEVICE_GET_INFO:
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1175  	{
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1176  		struct vfio_device_info info;
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1177  
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1178  		minsz = offsetofend(struct vfio_device_info, num_irqs);
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1179  
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1180  		if (copy_from_user(&info, (void __user *)arg, minsz))
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1181  			return -EFAULT;
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1182  
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1183  		if (info.argsz < minsz)
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1184  			return -EINVAL;
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1185  
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1186  		ret = mbochs_get_device_info(mdev, &info);
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1187  		if (ret)
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1188  			return ret;
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1189  
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1190  		if (copy_to_user((void __user *)arg, &info, minsz))
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1191  			return -EFAULT;
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1192  
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1193  		return 0;
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1194  	}
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1195  	case VFIO_DEVICE_GET_REGION_INFO:
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1196  	{
104c7405a64d937 Gerd Hoffmann 2018-09-21  1197  		struct vfio_region_info_ext info;
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1198  
104c7405a64d937 Gerd Hoffmann 2018-09-21  1199  		minsz = offsetofend(typeof(info), base.offset);
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1200  
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1201  		if (copy_from_user(&info, (void __user *)arg, minsz))
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1202  			return -EFAULT;
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1203  
104c7405a64d937 Gerd Hoffmann 2018-09-21  1204  		outsz = info.base.argsz;
104c7405a64d937 Gerd Hoffmann 2018-09-21  1205  		if (outsz < minsz)
104c7405a64d937 Gerd Hoffmann 2018-09-21  1206  			return -EINVAL;
104c7405a64d937 Gerd Hoffmann 2018-09-21  1207  		if (outsz > sizeof(info))
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1208  			return -EINVAL;
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1209  
104c7405a64d937 Gerd Hoffmann 2018-09-21  1210  		ret = mbochs_get_region_info(mdev, &info);
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1211  		if (ret)
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1212  			return ret;
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1213  
104c7405a64d937 Gerd Hoffmann 2018-09-21  1214  		if (copy_to_user((void __user *)arg, &info, outsz))
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1215  			return -EFAULT;
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1216  
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1217  		return 0;
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1218  	}
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1219  
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1220  	case VFIO_DEVICE_GET_IRQ_INFO:
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1221  	{
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1222  		struct vfio_irq_info info;
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1223  
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1224  		minsz = offsetofend(struct vfio_irq_info, count);
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1225  
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1226  		if (copy_from_user(&info, (void __user *)arg, minsz))
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1227  			return -EFAULT;
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1228  
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1229  		if ((info.argsz < minsz) ||
104c7405a64d937 Gerd Hoffmann 2018-09-21  1230  		    (info.index >= VFIO_PCI_NUM_IRQS))
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1231  			return -EINVAL;
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1232  
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1233  		ret = mbochs_get_irq_info(mdev, &info);
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1234  		if (ret)
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1235  			return ret;
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1236  
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1237  		if (copy_to_user((void __user *)arg, &info, minsz))
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1238  			return -EFAULT;
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1239  
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1240  		return 0;
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1241  	}
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1242  
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1243  	case VFIO_DEVICE_QUERY_GFX_PLANE:
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1244  	{
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1245  		struct vfio_device_gfx_plane_info plane;
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1246  
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1247  		minsz = offsetofend(struct vfio_device_gfx_plane_info,
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1248  				    region_index);
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1249  
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1250  		if (copy_from_user(&plane, (void __user *)arg, minsz))
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1251  			return -EFAULT;
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1252  
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1253  		if (plane.argsz < minsz)
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1254  			return -EINVAL;
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1255  
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1256  		ret = mbochs_query_gfx_plane(mdev, &plane);
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1257  		if (ret)
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1258  			return ret;
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1259  
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1260  		if (copy_to_user((void __user *)arg, &plane, minsz))
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1261  			return -EFAULT;
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1262  
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1263  		return 0;
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1264  	}
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1265  
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1266  	case VFIO_DEVICE_GET_GFX_DMABUF:
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1267  	{
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1268  		u32 dmabuf_id;
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1269  
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11 @1270  		if (get_user(dmabuf_id, (__u32 __user *)arg))
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1271  			return -EFAULT;
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1272  
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1273  		return mbochs_get_gfx_dmabuf(mdev, dmabuf_id);
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1274  	}
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1275  
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1276  	case VFIO_DEVICE_SET_IRQS:
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1277  		return -EINVAL;
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1278  
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1279  	case VFIO_DEVICE_RESET:
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1280  		return mbochs_reset(mdev);
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1281  	}
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1282  	return -ENOTTY;
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1283  }
a5e6e6505f38f7b Gerd Hoffmann 2018-05-11  1284  

:::::: The code at line 1270 was first introduced by commit
:::::: a5e6e6505f38f7bce1d3576503a2bffff3fa888c sample: vfio bochs vbe display (host device for bochs-drm)

:::::: TO: Gerd Hoffmann <kraxel@...hat.com>
:::::: CC: Alex Williamson <alex.williamson@...hat.com>

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ