diff options
author | Stefan Hajnoczi <stefanha@redhat.com> | 2016-09-21 16:52:19 +0100 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2016-09-23 19:03:55 +0300 |
commit | f5ed36635d8fa73feb66fe12b3b9c2ed90a1adbe (patch) | |
tree | a9086bb7f609570c31bf5503c89e81c947adc890 /include | |
parent | 8275e2f6be8b10c2b3da0fe6927d0ce7ad438c80 (diff) | |
download | qemu-f5ed36635d8fa73feb66fe12b3b9c2ed90a1adbe.tar.gz qemu-f5ed36635d8fa73feb66fe12b3b9c2ed90a1adbe.tar.bz2 qemu-f5ed36635d8fa73feb66fe12b3b9c2ed90a1adbe.zip |
virtio: stop virtqueue processing if device is broken
QEMU prints an error message and exits when the device enters an invalid
state. Terminating the process is heavy-handed. The guest may still be
able to function even if there is a bug in a virtio guest driver.
Moreover, exiting is a bug in nested virtualization where a nested guest
could DoS other nested guests by killing a pass-through virtio device.
I don't think this configuration is possible today but it is likely in
the future.
If the broken flag is set, do not process virtqueues or write back used
descriptors. The broken flag can be cleared again by resetting the
device.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/hw/virtio/virtio.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index f05559d569..888c8debe6 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -87,6 +87,7 @@ struct VirtIODevice VirtQueue *vq; uint16_t device_id; bool vm_running; + bool broken; /* device in invalid state, needs reset */ VMChangeStateEntry *vmstate; char *bus_name; uint8_t device_endian; @@ -135,6 +136,8 @@ void virtio_init(VirtIODevice *vdev, const char *name, uint16_t device_id, size_t config_size); void virtio_cleanup(VirtIODevice *vdev); +void virtio_error(VirtIODevice *vdev, const char *fmt, ...) GCC_FMT_ATTR(2, 3); + /* Set the child bus name. */ void virtio_device_set_child_bus_name(VirtIODevice *vdev, char *bus_name); |