e2a042f066
Fix CVE-2013-4148 (bnc#864812), CVE-2013-4149 (bnc#864649), CVE-2013-4150 (bnc#864650), CVE-2013-4151 (bnc#864653), CVE-2013-4526 (bnc#864671), CVE-2013-4527 (bnc#864673), CVE-2013-4529 (bnc#864678), CVE-2013-4530 (bnc#864682), CVE-2013-4531 (bnc#864796), CVE-2013-4533 (bnc#864655), CVE-2013-4534 (bnc#864811), CVE-2013-4535 / CVE-2013-4536 (bnc#864665), CVE-2013-4537 (bnc#864391), CVE-2013-4538 (bnc#864769), CVE-2013-4539 (bnc#864805), CVE-2013-4540 (bnc#864801), CVE-2013-4541 (bnc#864802), CVE-2013-4542 (bnc#864804), CVE-2013-6399 (bnc#864814), CVE-2014-0182 (bnc#874788) OBS-URL: https://build.opensuse.org/request/show/235280 OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=211
58 lines
1.8 KiB
Diff
58 lines
1.8 KiB
Diff
From a76b7609802937bfc6f35a75cf0809c8f7197f76 Mon Sep 17 00:00:00 2001
|
|
From: "Michael S. Tsirkin" <mst@redhat.com>
|
|
Date: Thu, 3 Apr 2014 19:51:14 +0300
|
|
Subject: [PATCH] virtio: out-of-bounds buffer write on invalid state load
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
CVE-2013-4151 QEMU 1.0 out-of-bounds buffer write in
|
|
virtio_load@hw/virtio/virtio.c
|
|
|
|
So we have this code since way back when:
|
|
|
|
num = qemu_get_be32(f);
|
|
|
|
for (i = 0; i < num; i++) {
|
|
vdev->vq[i].vring.num = qemu_get_be32(f);
|
|
|
|
array of vqs has size VIRTIO_PCI_QUEUE_MAX, so
|
|
on invalid input this will write beyond end of buffer.
|
|
|
|
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
|
|
Signed-off-by: Juan Quintela <quintela@redhat.com>
|
|
(cherry picked from commit cc45995294b92d95319b4782750a3580cabdbc0c)
|
|
[AF: BNC#864653]
|
|
Signed-off-by: Andreas Färber <afaerber@suse.de>
|
|
---
|
|
hw/virtio/virtio.c | 8 +++++++-
|
|
1 file changed, 7 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
|
|
index aeabf3a..05f05e7 100644
|
|
--- a/hw/virtio/virtio.c
|
|
+++ b/hw/virtio/virtio.c
|
|
@@ -891,7 +891,8 @@ int virtio_set_features(VirtIODevice *vdev, uint32_t val)
|
|
|
|
int virtio_load(VirtIODevice *vdev, QEMUFile *f)
|
|
{
|
|
- int num, i, ret;
|
|
+ int i, ret;
|
|
+ uint32_t num;
|
|
uint32_t features;
|
|
uint32_t supported_features;
|
|
BusState *qbus = qdev_get_parent_bus(DEVICE(vdev));
|
|
@@ -919,6 +920,11 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f)
|
|
|
|
num = qemu_get_be32(f);
|
|
|
|
+ if (num > VIRTIO_PCI_QUEUE_MAX) {
|
|
+ error_report("Invalid number of PCI queues: 0x%x", num);
|
|
+ return -1;
|
|
+ }
|
|
+
|
|
for (i = 0; i < num; i++) {
|
|
vdev->vq[i].vring.num = qemu_get_be32(f);
|
|
if (k->has_variable_vring_alignment) {
|