diff options
author | Stefan Hajnoczi | 2011-05-08 23:29:07 +0200 |
---|---|---|
committer | Michael S. Tsirkin | 2011-06-12 09:33:38 +0200 |
commit | 7157e2e23e89adcd436caeab31fdd6b47eded377 (patch) | |
tree | 5012c5e003f5d66032ef7892240ad8c9a9abe5eb /cpu-common.h | |
parent | virtio-pci.c: convert to PCIDEviceInfo to initialize ids (diff) | |
download | qemu-7157e2e23e89adcd436caeab31fdd6b47eded377.tar.gz qemu-7157e2e23e89adcd436caeab31fdd6b47eded377.tar.xz qemu-7157e2e23e89adcd436caeab31fdd6b47eded377.zip |
virtio: guard against negative vq notifies
The virtio_queue_notify() function checks that the virtqueue number is
less than the maximum number of virtqueues. A signed comparison is used
but the virtqueue number could be negative if a buggy or malicious guest
is run. This results in memory accesses outside of the virtqueue array.
It is risky doing input validation in common code instead of at the
guest<->host boundary. Note that virtio_queue_set_addr(),
virtio_queue_get_addr(), virtio_queue_get_num(), and many other virtio
functions do *not* validate the virtqueue number argument.
Instead of fixing the comparison in virtio_queue_notify(), move the
comparison to the virtio bindings (just like VIRTIO_PCI_QUEUE_SEL) where
we have a uint32_t value and can avoid ever calling into common virtio
code if the virtqueue number is invalid.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'cpu-common.h')
0 files changed, 0 insertions, 0 deletions