qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] vhost: fix corrupting GPA 0 when using uninitia


From: Maxime Coquelin
Subject: Re: [Qemu-devel] [PATCH] vhost: fix corrupting GPA 0 when using uninitialized queues
Date: Fri, 12 Jan 2018 11:39:36 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2



On 01/12/2018 11:13 AM, Zheng Xiang wrote:
When guest driver only setup part of queues declared in QEMU, it
would corrupt guest's physical address 0 when using uninitialized
queues in vhost_virtqueue_start.

In AARCH64 virtual machines, the address of system memory starts at
0x40000000 and the address of rom starts at 0. So, when using qemu
with vhost-scsi, it will fail with below error:
qemu-kvm: Error start vhost dev
qemu-kvm: unable to start vhost-scsi: Cannot allocate memory

This patch fix this issue by skipping calling vhost_virtqueue_start
for uninitialized queues.

Cc: Michael S. Tsirkin <address@hidden>
Signed-off-by: Zheng Xiang <address@hidden>
---
  hw/virtio/vhost.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index e4290ce..ac79ffd 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -1532,6 +1532,8 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice 
*vdev)
          goto fail_mem;
      }
      for (i = 0; i < hdev->nvqs; ++i) {
+        if (virtio_queue_get_desc_addr(vdev, hdev->vq_index + i) == 0)
+            continue;
          r = vhost_virtqueue_start(hdev,
                                    vdev,
                                    hdev->vqs + i,


Thanks, it fixes the silent corruption that happens with vhost-user net
backend and Windows guests, when the number of queues pairs declared in
Qemu is higher than the number of vcpus.

Tested-by: Maxime Coquelin <address@hidden>

Maxime



reply via email to

[Prev in Thread] Current Thread [Next in Thread]