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: <202108171342.ihMMA1eh-lkp@intel.com>
Date:   Tue, 17 Aug 2021 13:18:48 +0800
From:   kernel test robot <lkp@...el.com>
To:     Omar Sandoval <osandov@...com>
Cc:     kbuild-all@...ts.01.org, Omar Sandoval <osandov@...ndov.com>,
        linux-kernel@...r.kernel.org, Josef Bacik <josef@...icpanda.com>
Subject: [osandov:btrfs-send-encoded 8/14] fs/btrfs/ioctl.c:4957:38: sparse:
 sparse: incorrect type in argument 2 (different address spaces)

tree:   https://github.com/osandov/linux.git btrfs-send-encoded
head:   d3940b20ce9f2cf1e25106a87ddd90e165e34674
commit: ced2f02da25627eccaa276c08183a2764795c93f [8/14] btrfs: add BTRFS_IOC_ENCODED_READ
config: arc-randconfig-s031-20210816 (attached as .config)
compiler: arceb-elf-gcc (GCC) 11.2.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-348-gf0e6938b-dirty
        # https://github.com/osandov/linux/commit/ced2f02da25627eccaa276c08183a2764795c93f
        git remote add osandov https://github.com/osandov/linux.git
        git fetch --no-tags osandov btrfs-send-encoded
        git checkout ced2f02da25627eccaa276c08183a2764795c93f
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=arc 

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 >>)
>> fs/btrfs/ioctl.c:4957:38: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected struct iovec const [noderef] __user *uvec @@     got struct iovec const *[addressable] iov @@
   fs/btrfs/ioctl.c:4957:38: sparse:     expected struct iovec const [noderef] __user *uvec
   fs/btrfs/ioctl.c:4957:38: sparse:     got struct iovec const *[addressable] iov
   fs/btrfs/ioctl.c:408:6: sparse: sparse: context imbalance in 'btrfs_exclop_start_try_lock' - wrong count at exit
   fs/btrfs/ioctl.c:419:6: sparse: sparse: context imbalance in 'btrfs_exclop_start_unlock' - unexpected unlock

vim +4957 fs/btrfs/ioctl.c

  4906	
  4907	static int btrfs_ioctl_encoded_read(struct file *file, void __user *argp,
  4908					    bool compat)
  4909	{
  4910		struct btrfs_ioctl_encoded_io_args args;
  4911		size_t copy_end_kernel = offsetofend(struct btrfs_ioctl_encoded_io_args,
  4912						     flags);
  4913		size_t copy_end;
  4914		struct iovec iovstack[UIO_FASTIOV];
  4915		struct iovec *iov = iovstack;
  4916		struct iov_iter iter;
  4917		loff_t pos;
  4918		struct kiocb kiocb;
  4919		ssize_t ret;
  4920	
  4921		if (!capable(CAP_SYS_ADMIN)) {
  4922			ret = -EPERM;
  4923			goto out_acct;
  4924		}
  4925	
  4926		if (compat) {
  4927	#if defined(CONFIG_64BIT) && defined(CONFIG_COMPAT)
  4928			struct btrfs_ioctl_encoded_io_args_32 args32;
  4929	
  4930			copy_end = offsetofend(struct btrfs_ioctl_encoded_io_args_32,
  4931					       flags);
  4932			if (copy_from_user(&args32, argp, copy_end)) {
  4933				ret = -EFAULT;
  4934				goto out_acct;
  4935			}
  4936			args.iov = compat_ptr(args32.iov);
  4937			args.iovcnt = args32.iovcnt;
  4938			args.offset = args32.offset;
  4939			args.flags = args32.flags;
  4940	#else
  4941			return -ENOTTY;
  4942	#endif
  4943		} else {
  4944			copy_end = copy_end_kernel;
  4945			if (copy_from_user(&args, argp, copy_end)) {
  4946				ret = -EFAULT;
  4947				goto out_acct;
  4948			}
  4949		}
  4950		if (args.flags != 0) {
  4951			ret = -EINVAL;
  4952			goto out_acct;
  4953		}
  4954		memset((char *)&args + copy_end_kernel, 0,
  4955		       sizeof(args) - copy_end_kernel);
  4956	
> 4957		ret = import_iovec(READ, args.iov, args.iovcnt, ARRAY_SIZE(iovstack),
  4958				   &iov, &iter);
  4959		if (ret < 0)
  4960			goto out_acct;
  4961	
  4962		if (iov_iter_count(&iter) == 0) {
  4963			ret = 0;
  4964			goto out_iov;
  4965		}
  4966		pos = args.offset;
  4967		ret = rw_verify_area(READ, file, &pos, args.len);
  4968		if (ret < 0)
  4969			goto out_iov;
  4970	
  4971		init_sync_kiocb(&kiocb, file);
  4972		ret = kiocb_set_rw_flags(&kiocb, 0);
  4973		if (ret)
  4974			goto out_iov;
  4975		kiocb.ki_pos = pos;
  4976	
  4977		ret = btrfs_encoded_read(&kiocb, &iter, &args);
  4978		if (ret >= 0) {
  4979			fsnotify_access(file);
  4980			if (copy_to_user(argp + copy_end,
  4981					 (char *)&args + copy_end_kernel,
  4982					 sizeof(args) - copy_end_kernel))
  4983				ret = -EFAULT;
  4984		}
  4985	
  4986	out_iov:
  4987		kfree(iov);
  4988	out_acct:
  4989		if (ret > 0)
  4990			add_rchar(current, ret);
  4991		inc_syscr(current);
  4992		return ret;
  4993	}
  4994	

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ