Netdev Archive on lore.kernel.org
 help / color / Atom feed
* [vhost:linux-next 8/9] drivers/vhost/vhost.c:2076:5: note: in expansion of macro 'array_index_nospec'
@ 2019-09-11 11:38 kbuild test robot
  0 siblings, 0 replies; only message in thread
From: kbuild test robot @ 2019-09-11 11:38 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: kbuild-all, kvm, virtualization, netdev

[-- Attachment #1: Type: text/plain, Size: 8189 bytes --]

tree:   https://kernel.googlesource.com/pub/scm/linux/kernel/git/mst/vhost.git linux-next
head:   f2c4b499aecc0c5a1ec67f3a2a7310cb7168a8ab
commit: 4c145987a955269da79312a79ec26638712644bb [8/9] vhost: block speculation of translated descriptors
config: mips-malta_kvm_defconfig (attached as .config)
compiler: mipsel-linux-gcc (GCC) 7.4.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout 4c145987a955269da79312a79ec26638712644bb
        # save the attached .config to linux build tree
        GCC_VERSION=7.4.0 make.cross ARCH=mips 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

   In file included from include/linux/kernel.h:11:0,
                    from include/linux/list.h:9,
                    from include/linux/wait.h:7,
                    from include/linux/eventfd.h:13,
                    from drivers/vhost/vhost.c:13:
   drivers/vhost/vhost.c: In function 'translate_desc':
>> include/linux/compiler.h:350:38: error: call to '__compiletime_assert_2077' declared with attribute error: BUILD_BUG_ON failed: sizeof(_s) > sizeof(long)
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:331:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/nospec.h:55:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(sizeof(_i) > sizeof(long));   \
     ^~~~~~~~~~~~
>> drivers/vhost/vhost.c:2076:5: note: in expansion of macro 'array_index_nospec'
        array_index_nospec(addr - node->start,
        ^~~~~~~~~~~~~~~~~~
>> include/linux/compiler.h:350:38: error: call to '__compiletime_assert_2077' declared with attribute error: BUILD_BUG_ON failed: sizeof(_s) > sizeof(long)
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:331:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
   include/linux/nospec.h:56:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(sizeof(_s) > sizeof(long));   \
     ^~~~~~~~~~~~
>> drivers/vhost/vhost.c:2076:5: note: in expansion of macro 'array_index_nospec'
        array_index_nospec(addr - node->start,
        ^~~~~~~~~~~~~~~~~~
--
   In file included from include/linux/kernel.h:11:0,
                    from include/linux/list.h:9,
                    from include/linux/wait.h:7,
                    from include/linux/eventfd.h:13,
                    from drivers//vhost/vhost.c:13:
   drivers//vhost/vhost.c: In function 'translate_desc':
>> include/linux/compiler.h:350:38: error: call to '__compiletime_assert_2077' declared with attribute error: BUILD_BUG_ON failed: sizeof(_s) > sizeof(long)
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:331:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/nospec.h:55:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(sizeof(_i) > sizeof(long));   \
     ^~~~~~~~~~~~
   drivers//vhost/vhost.c:2076:5: note: in expansion of macro 'array_index_nospec'
        array_index_nospec(addr - node->start,
        ^~~~~~~~~~~~~~~~~~
>> include/linux/compiler.h:350:38: error: call to '__compiletime_assert_2077' declared with attribute error: BUILD_BUG_ON failed: sizeof(_s) > sizeof(long)
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:331:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
   include/linux/nospec.h:56:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(sizeof(_s) > sizeof(long));   \
     ^~~~~~~~~~~~
   drivers//vhost/vhost.c:2076:5: note: in expansion of macro 'array_index_nospec'
        array_index_nospec(addr - node->start,
        ^~~~~~~~~~~~~~~~~~

vim +/array_index_nospec +2076 drivers/vhost/vhost.c

  2039	
  2040	static int translate_desc(struct vhost_virtqueue *vq, u64 addr, u32 len,
  2041				  struct iovec iov[], int iov_size, int access)
  2042	{
  2043		const struct vhost_umem_node *node;
  2044		struct vhost_dev *dev = vq->dev;
  2045		struct vhost_umem *umem = dev->iotlb ? dev->iotlb : dev->umem;
  2046		struct iovec *_iov;
  2047		u64 s = 0;
  2048		int ret = 0;
  2049	
  2050		while ((u64)len > s) {
  2051			u64 size;
  2052			if (unlikely(ret >= iov_size)) {
  2053				ret = -ENOBUFS;
  2054				break;
  2055			}
  2056	
  2057			node = vhost_umem_interval_tree_iter_first(&umem->umem_tree,
  2058								addr, addr + len - 1);
  2059			if (node == NULL || node->start > addr) {
  2060				if (umem != dev->iotlb) {
  2061					ret = -EFAULT;
  2062					break;
  2063				}
  2064				ret = -EAGAIN;
  2065				break;
  2066			} else if (!(node->perm & access)) {
  2067				ret = -EPERM;
  2068				break;
  2069			}
  2070	
  2071			_iov = iov + ret;
  2072			size = node->size - addr + node->start;
  2073			_iov->iov_len = min((u64)len - s, size);
  2074			_iov->iov_base = (void __user *)(unsigned long)
  2075				(node->userspace_addr +
> 2076				 array_index_nospec(addr - node->start,
  2077						    node->size));
  2078			s += size;
  2079			addr += size;
  2080			++ret;
  2081		}
  2082	
  2083		if (ret == -EAGAIN)
  2084			vhost_iotlb_miss(vq, addr, access);
  2085		return ret;
  2086	}
  2087	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 20549 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-11 11:38 [vhost:linux-next 8/9] drivers/vhost/vhost.c:2076:5: note: in expansion of macro 'array_index_nospec' kbuild test robot

Netdev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/netdev/0 netdev/git/0.git
	git clone --mirror https://lore.kernel.org/netdev/1 netdev/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 netdev netdev/ https://lore.kernel.org/netdev \
		netdev@vger.kernel.org netdev@archiver.kernel.org
	public-inbox-index netdev


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.netdev


AGPL code for this site: git clone https://public-inbox.org/ public-inbox