summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Dudau <adrian.dudau@enea.com>2016-11-03 13:18:01 (GMT)
committerSona Sarmadi <sona.sarmadi@enea.com>2017-02-10 11:21:36 (GMT)
commit10bef78e2135fb191166e3893cc4a1326deede8c (patch)
tree6a043f57ba9b01189c4eca279b88ebef21a51219
parentad13ebb1a522389441b526ddf11301761e7c3938 (diff)
downloadpoky-10bef78e2135fb191166e3893cc4a1326deede8c.tar.gz
qemu: Security fix CVE-2016-4952
affects qemu < 2.7.0 Quick Emulator(Qemu) built with the VMWARE PVSCSI paravirtual SCSI bus emulation support is vulnerable to an OOB r/w access issue. It could occur while processing SCSI commands 'PVSCSI_CMD_SETUP_RINGS' or 'PVSCSI_CMD_SETUP_MSG_RING'. A privileged user inside guest could use this flaw to crash the Qemu process resulting in DoS. References: ---------- http://www.openwall.com/lists/oss-security/2016/05/23/1 Signed-off-by: Adrian Dudau <adrian.dudau@enea.com> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Sona Sarmadi <sona.sarmadi@enea.com>
-rw-r--r--meta/recipes-devtools/qemu/qemu/CVE-2016-4952.patch105
-rw-r--r--meta/recipes-devtools/qemu/qemu_2.5.0.bb1
2 files changed, 106 insertions, 0 deletions
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2016-4952.patch b/meta/recipes-devtools/qemu/qemu/CVE-2016-4952.patch
new file mode 100644
index 0000000..52d2a1e
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/CVE-2016-4952.patch
@@ -0,0 +1,105 @@
1From 3e831b40e015ba34dfb55ff11f767001839425ff Mon Sep 17 00:00:00 2001
2From: Prasad J Pandit <pjp@fedoraproject.org>
3Date: Mon, 23 May 2016 16:18:05 +0530
4Subject: [PATCH] scsi: pvscsi: check command descriptor ring buffer size (CVE-2016-4952)
5
6Vmware Paravirtual SCSI emulation uses command descriptors to
7process SCSI commands. These descriptors come with their ring
8buffers. A guest could set the ring buffer size to an arbitrary
9value leading to OOB access issue. Add check to avoid it.
10
11Upstream-Status: Backported
12
13Reported-by: Li Qiang <liqiang6-s@360.cn>
14Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
15Cc: qemu-stable@nongnu.org
16Message-Id: <1464000485-27041-1-git-send-email-ppandit@redhat.com>
17Reviewed-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>
18Reviewed-by: Dmitry Fleytman <dmitry@daynix.com>
19Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
20Signed-off-by: Adrian Dudau <adrian.dudau@enea.com>
21---
22 hw/scsi/vmw_pvscsi.c | 24 ++++++++++++++++++++----
23 1 files changed, 20 insertions(+), 4 deletions(-)
24
25diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c
26index f67b5bf..2d7528d 100644
27--- a/hw/scsi/vmw_pvscsi.c
28+++ b/hw/scsi/vmw_pvscsi.c
29@@ -153,7 +153,7 @@ pvscsi_log2(uint32_t input)
30 return log;
31 }
32
33-static void
34+static int
35 pvscsi_ring_init_data(PVSCSIRingInfo *m, PVSCSICmdDescSetupRings *ri)
36 {
37 int i;
38@@ -161,6 +161,10 @@ pvscsi_ring_init_data(PVSCSIRingInfo *m, PVSCSICmdDescSetupRings *ri)
39 uint32_t req_ring_size, cmp_ring_size;
40 m->rs_pa = ri->ringsStatePPN << VMW_PAGE_SHIFT;
41
42+ if ((ri->reqRingNumPages > PVSCSI_SETUP_RINGS_MAX_NUM_PAGES)
43+ || (ri->cmpRingNumPages > PVSCSI_SETUP_RINGS_MAX_NUM_PAGES)) {
44+ return -1;
45+ }
46 req_ring_size = ri->reqRingNumPages * PVSCSI_MAX_NUM_REQ_ENTRIES_PER_PAGE;
47 cmp_ring_size = ri->cmpRingNumPages * PVSCSI_MAX_NUM_CMP_ENTRIES_PER_PAGE;
48 txr_len_log2 = pvscsi_log2(req_ring_size - 1);
49@@ -192,15 +196,20 @@ pvscsi_ring_init_data(PVSCSIRingInfo *m, PVSCSICmdDescSetupRings *ri)
50
51 /* Flush ring state page changes */
52 smp_wmb();
53+
54+ return 0;
55 }
56
57-static void
58+static int
59 pvscsi_ring_init_msg(PVSCSIRingInfo *m, PVSCSICmdDescSetupMsgRing *ri)
60 {
61 int i;
62 uint32_t len_log2;
63 uint32_t ring_size;
64
65+ if (ri->numPages > PVSCSI_SETUP_MSG_RING_MAX_NUM_PAGES) {
66+ return -1;
67+ }
68 ring_size = ri->numPages * PVSCSI_MAX_NUM_MSG_ENTRIES_PER_PAGE;
69 len_log2 = pvscsi_log2(ring_size - 1);
70
71@@ -220,6 +229,8 @@ pvscsi_ring_init_msg(PVSCSIRingInfo *m, PVSCSICmdDescSetupMsgRing *ri)
72
73 /* Flush ring state page changes */
74 smp_wmb();
75+
76+ return 0;
77 }
78
79 static void
80@@ -770,7 +781,10 @@ pvscsi_on_cmd_setup_rings(PVSCSIState *s)
81 trace_pvscsi_on_cmd_arrived("PVSCSI_CMD_SETUP_RINGS");
82
83 pvscsi_dbg_dump_tx_rings_config(rc);
84- pvscsi_ring_init_data(&s->rings, rc);
85+ if (pvscsi_ring_init_data(&s->rings, rc) < 0) {
86+ return PVSCSI_COMMAND_PROCESSING_FAILED;
87+ }
88+
89 s->rings_info_valid = TRUE;
90 return PVSCSI_COMMAND_PROCESSING_SUCCEEDED;
91 }
92@@ -850,7 +864,9 @@ pvscsi_on_cmd_setup_msg_ring(PVSCSIState *s)
93 }
94
95 if (s->rings_info_valid) {
96- pvscsi_ring_init_msg(&s->rings, rc);
97+ if (pvscsi_ring_init_msg(&s->rings, rc) < 0) {
98+ return PVSCSI_COMMAND_PROCESSING_FAILED;
99+ }
100 s->msg_ring_info_valid = TRUE;
101 }
102 return sizeof(PVSCSICmdDescSetupMsgRing) / sizeof(uint32_t);
103--
1041.7.0.4
105
diff --git a/meta/recipes-devtools/qemu/qemu_2.5.0.bb b/meta/recipes-devtools/qemu/qemu_2.5.0.bb
index 58902b1..b965f69 100644
--- a/meta/recipes-devtools/qemu/qemu_2.5.0.bb
+++ b/meta/recipes-devtools/qemu/qemu_2.5.0.bb
@@ -27,6 +27,7 @@ SRC_URI += "file://configure-fix-Darwin-target-detection.patch \
27 file://CVE-2016-4002.patch \ 27 file://CVE-2016-4002.patch \
28 file://CVE-2016-5403.patch \ 28 file://CVE-2016-5403.patch \
29 file://CVE-2016-4441.patch \ 29 file://CVE-2016-4441.patch \
30 file://CVE-2016-4952.patch \
30 " 31 "
31SRC_URI_prepend = "http://wiki.qemu-project.org/download/${BP}.tar.bz2" 32SRC_URI_prepend = "http://wiki.qemu-project.org/download/${BP}.tar.bz2"
32SRC_URI[md5sum] = "f469f2330bbe76e3e39db10e9ac4f8db" 33SRC_URI[md5sum] = "f469f2330bbe76e3e39db10e9ac4f8db"