summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/qemu
diff options
context:
space:
mode:
authorCatalin Enache <catalin.enache@windriver.com>2017-12-19 12:39:12 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-01-14 09:11:58 +0000
commitb9dcab772fd37ed8376a87d3194195e13ff52d10 (patch)
tree6237abe3dfdf88df283d9d9e6ebdbb84fd63f66b /meta/recipes-devtools/qemu
parentad51bba5a90384b728c06f64b72ef41c6490a701 (diff)
downloadpoky-b9dcab772fd37ed8376a87d3194195e13ff52d10.tar.gz
qemu: CVE-2017-17381
The Virtio Vring implementation in QEMU allows local OS guest users to cause a denial of service (divide-by-zero error and QEMU process crash) by unsetting vring alignment while updating Virtio rings. Reference: https://nvd.nist.gov/vuln/detail/CVE-2017-17381 Upstream patch: https://git.qemu.org/?p=qemu.git;a=commitdiff;h=758ead31c7e17bf17a9ef2e0ca1c3e86ab296b43 (From OE-Core rev: 92a0513837182e2e9aa6c7d4958e495f4b5b4c47) Signed-off-by: Catalin Enache <catalin.enache@windriver.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/qemu')
-rw-r--r--meta/recipes-devtools/qemu/qemu/CVE-2017-17381.patch72
-rw-r--r--meta/recipes-devtools/qemu/qemu_2.10.1.bb1
2 files changed, 73 insertions, 0 deletions
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2017-17381.patch b/meta/recipes-devtools/qemu/qemu/CVE-2017-17381.patch
new file mode 100644
index 0000000000..416771cdcb
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/CVE-2017-17381.patch
@@ -0,0 +1,72 @@
1From 758ead31c7e17bf17a9ef2e0ca1c3e86ab296b43 Mon Sep 17 00:00:00 2001
2From: Prasad J Pandit <pjp@fedoraproject.org>
3Date: Wed, 29 Nov 2017 23:14:27 +0530
4Subject: [PATCH] virtio: check VirtQueue Vring object is set
5
6A guest could attempt to use an uninitialised VirtQueue object
7or unset Vring.align leading to a arithmetic exception. Add check
8to avoid it.
9
10Upstream-Status: Backport
11CVE: CVE-2017-17381
12
13Reported-by: Zhangboxian <zhangboxian@huawei.com>
14Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
15Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
16Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
17Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
18Reviewed-by: Cornelia Huck <cohuck@redhat.com>
19Signed-off-by: Catalin Enache <catalin.enache@windriver.com>
20---
21 hw/virtio/virtio.c | 14 +++++++++++---
22 1 file changed, 11 insertions(+), 3 deletions(-)
23
24diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
25index 703e672..ad564b0 100644
26--- a/hw/virtio/virtio.c
27+++ b/hw/virtio/virtio.c
28@@ -182,7 +182,7 @@ void virtio_queue_update_rings(VirtIODevice *vdev, int n)
29 {
30 VRing *vring = &vdev->vq[n].vring;
31
32- if (!vring->desc) {
33+ if (!vring->num || !vring->desc || !vring->align) {
34 /* not yet setup -> nothing to do */
35 return;
36 }
37@@ -1414,6 +1414,9 @@ void virtio_config_modern_writel(VirtIODevice *vdev,
38
39 void virtio_queue_set_addr(VirtIODevice *vdev, int n, hwaddr addr)
40 {
41+ if (!vdev->vq[n].vring.num) {
42+ return;
43+ }
44 vdev->vq[n].vring.desc = addr;
45 virtio_queue_update_rings(vdev, n);
46 }
47@@ -1426,6 +1429,9 @@ hwaddr virtio_queue_get_addr(VirtIODevice *vdev, int n)
48 void virtio_queue_set_rings(VirtIODevice *vdev, int n, hwaddr desc,
49 hwaddr avail, hwaddr used)
50 {
51+ if (!vdev->vq[n].vring.num) {
52+ return;
53+ }
54 vdev->vq[n].vring.desc = desc;
55 vdev->vq[n].vring.avail = avail;
56 vdev->vq[n].vring.used = used;
57@@ -1494,8 +1500,10 @@ void virtio_queue_set_align(VirtIODevice *vdev, int n, int align)
58 */
59 assert(k->has_variable_vring_alignment);
60
61- vdev->vq[n].vring.align = align;
62- virtio_queue_update_rings(vdev, n);
63+ if (align) {
64+ vdev->vq[n].vring.align = align;
65+ virtio_queue_update_rings(vdev, n);
66+ }
67 }
68
69 static bool virtio_queue_notify_aio_vq(VirtQueue *vq)
70--
712.10.2
72
diff --git a/meta/recipes-devtools/qemu/qemu_2.10.1.bb b/meta/recipes-devtools/qemu/qemu_2.10.1.bb
index 71cc74ebc7..6c2dd586dd 100644
--- a/meta/recipes-devtools/qemu/qemu_2.10.1.bb
+++ b/meta/recipes-devtools/qemu/qemu_2.10.1.bb
@@ -34,6 +34,7 @@ SRC_URI = "http://wiki.qemu-project.org/download/${BP}.tar.bz2 \
34 file://chardev-connect-socket-to-a-spawned-command.patch \ 34 file://chardev-connect-socket-to-a-spawned-command.patch \
35 file://apic-fixup-fallthrough-to-PIC.patch \ 35 file://apic-fixup-fallthrough-to-PIC.patch \
36 file://ppc_locking.patch \ 36 file://ppc_locking.patch \
37 file://CVE-2017-17381.patch \
37 " 38 "
38UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+\..*)\.tar" 39UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+\..*)\.tar"
39 40