* [PATCH] vhost: Fix compile time error
@ 2019-09-14 8:44 Guenter Roeck
2019-09-14 19:38 ` Michael S. Tsirkin
0 siblings, 1 reply; 2+ messages in thread
From: Guenter Roeck @ 2019-09-14 8:44 UTC (permalink / raw)
To: Michael S . Tsirkin
Cc: Jason Wang, kvm, virtualization, netdev, linux-kernel,
Greg Kroah-Hartman, Linus Torvalds, Guenter Roeck
Building vhost on 32-bit targets results in the following error.
drivers/vhost/vhost.c: In function 'translate_desc':
include/linux/compiler.h:549:38: error:
call to '__compiletime_assert_1879' declared with attribute error:
BUILD_BUG_ON failed: sizeof(_s) > sizeof(long)
Fixes: a89db445fbd7 ("vhost: block speculation of translated descriptors")
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
drivers/vhost/vhost.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index acabf20b069e..102a0c877007 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -2074,7 +2074,7 @@ static int translate_desc(struct vhost_virtqueue *vq, u64 addr, u32 len,
_iov->iov_base = (void __user *)
((unsigned long)node->userspace_addr +
array_index_nospec((unsigned long)(addr - node->start),
- node->size));
+ (unsigned long)node->size));
s += size;
addr += size;
++ret;
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] vhost: Fix compile time error
2019-09-14 8:44 [PATCH] vhost: Fix compile time error Guenter Roeck
@ 2019-09-14 19:38 ` Michael S. Tsirkin
0 siblings, 0 replies; 2+ messages in thread
From: Michael S. Tsirkin @ 2019-09-14 19:38 UTC (permalink / raw)
To: Guenter Roeck
Cc: Jason Wang, kvm, virtualization, netdev, linux-kernel,
Greg Kroah-Hartman, Linus Torvalds
On Sat, Sep 14, 2019 at 01:44:57AM -0700, Guenter Roeck wrote:
> Building vhost on 32-bit targets results in the following error.
>
> drivers/vhost/vhost.c: In function 'translate_desc':
> include/linux/compiler.h:549:38: error:
> call to '__compiletime_assert_1879' declared with attribute error:
> BUILD_BUG_ON failed: sizeof(_s) > sizeof(long)
>
> Fixes: a89db445fbd7 ("vhost: block speculation of translated descriptors")
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Jason Wang <jasowang@redhat.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/vhost/vhost.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> index acabf20b069e..102a0c877007 100644
> --- a/drivers/vhost/vhost.c
> +++ b/drivers/vhost/vhost.c
> @@ -2074,7 +2074,7 @@ static int translate_desc(struct vhost_virtqueue *vq, u64 addr, u32 len,
> _iov->iov_base = (void __user *)
> ((unsigned long)node->userspace_addr +
> array_index_nospec((unsigned long)(addr - node->start),
> - node->size));
> + (unsigned long)node->size));
Unfortunately this does not fix the case where size is actually 64 bit,
e.g. a single node with VA 0, size 2^32 is how
you cover the whole virtual address space.
this is not how qemu uses it, but it's valid.
I think it's best to just revert the patch for now.
> s += size;
> addr += size;
> ++ret;
> --
> 2.7.4
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-09-14 19:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-14 8:44 [PATCH] vhost: Fix compile time error Guenter Roeck
2019-09-14 19:38 ` Michael S. Tsirkin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).