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: <202208201138.I9XBm1NX-lkp@intel.com>
Date:   Sat, 20 Aug 2022 11:52:17 +0800
From:   kernel test robot <lkp@...el.com>
To:     Jason Gunthorpe <jgg@...dia.com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Nicolin Chen <nicolinc@...dia.com>
Subject: [jgunthorpe:iommufd 12/14]
 drivers/iommu/iommufd/vfio_compat.c:261:17: sparse: sparse: cast removes
 address space '__user' of expression

tree:   https://github.com/jgunthorpe/linux iommufd
head:   6624f48e554fe6a880b261074a1c9580dc9b5384
commit: faa672c0b9c1f75243f045e40a068ca4ceb56eaf [12/14] iommufd: vfio container FD ioctl compatibility
config: sparc64-randconfig-s033-20220820
compiler: sparc64-linux-gcc (GCC) 12.1.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.4-39-gce1a6720-dirty
        # https://github.com/jgunthorpe/linux/commit/faa672c0b9c1f75243f045e40a068ca4ceb56eaf
        git remote add jgunthorpe https://github.com/jgunthorpe/linux
        git fetch --no-tags jgunthorpe iommufd
        git checkout faa672c0b9c1f75243f045e40a068ca4ceb56eaf
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=sparc64 SHELL=/bin/bash drivers/iommu/iommufd/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@...el.com>

sparse warnings: (new ones prefixed by >>)
>> drivers/iommu/iommufd/vfio_compat.c:261:17: sparse: sparse: cast removes address space '__user' of expression
>> drivers/iommu/iommufd/vfio_compat.c:261:17: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected struct vfio_iommu_type1_info_cap_iova_range [noderef] __user *ucap_iovas @@     got struct vfio_iommu_type1_info_cap_iova_range * @@
   drivers/iommu/iommufd/vfio_compat.c:261:17: sparse:     expected struct vfio_iommu_type1_info_cap_iova_range [noderef] __user *ucap_iovas
   drivers/iommu/iommufd/vfio_compat.c:261:17: sparse:     got struct vfio_iommu_type1_info_cap_iova_range *

vim +/__user +261 drivers/iommu/iommufd/vfio_compat.c

   255	
   256	static int iommufd_fill_cap_iova(struct iommufd_ioas *ioas,
   257					 struct vfio_info_cap_header __user *cur,
   258					 size_t avail)
   259	{
   260		struct vfio_iommu_type1_info_cap_iova_range __user *ucap_iovas =
 > 261			container_of(cur, struct vfio_iommu_type1_info_cap_iova_range,
   262				     header);
   263		struct vfio_iommu_type1_info_cap_iova_range cap_iovas = {
   264			.header = {
   265				.id = VFIO_IOMMU_TYPE1_INFO_CAP_IOVA_RANGE,
   266				.version = 1,
   267			},
   268		};
   269		struct interval_tree_span_iter span;
   270	
   271		interval_tree_for_each_span (&span, &ioas->iopt.reserved_itree,
   272					     0, ULONG_MAX) {
   273			struct vfio_iova_range range;
   274	
   275			if (!span.is_hole)
   276				continue;
   277			range.start = span.start_hole;
   278			range.end = span.last_hole;
   279			if (avail >= struct_size(&cap_iovas, iova_ranges,
   280						 cap_iovas.nr_iovas + 1) &&
   281			    copy_to_user(&ucap_iovas->iova_ranges[cap_iovas.nr_iovas],
   282					 &range, sizeof(range)))
   283				return -EFAULT;
   284			cap_iovas.nr_iovas++;
   285		}
   286		if (avail >= struct_size(&cap_iovas, iova_ranges, cap_iovas.nr_iovas) &&
   287		    copy_to_user(ucap_iovas, &cap_iovas, sizeof(cap_iovas)))
   288			return -EFAULT;
   289		return struct_size(&cap_iovas, iova_ranges, cap_iovas.nr_iovas);
   290	}
   291	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

View attachment "config" of type "text/plain" (156646 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ