5a0f88db96
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
78 lines
2.5 KiB
Diff
78 lines
2.5 KiB
Diff
From e70b97747393a4d5544bdb9eb64a7f5b69b0bb91 Mon Sep 17 00:00:00 2001
|
|
From: Michael Roth <mdroth@linux.vnet.ibm.com>
|
|
Date: Mon, 28 Apr 2014 16:08:17 +0300
|
|
Subject: [PATCH] openpic: avoid buffer overrun on incoming migration
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
CVE-2013-4534
|
|
|
|
opp->nb_cpus is read from the wire and used to determine how many
|
|
IRQDest elements to read into opp->dst[]. If the value exceeds the
|
|
length of opp->dst[], MAX_CPU, opp->dst[] can be overrun with arbitrary
|
|
data from the wire.
|
|
|
|
Fix this by failing migration if the value read from the wire exceeds
|
|
MAX_CPU.
|
|
|
|
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
|
|
Reviewed-by: Alexander Graf <agraf@suse.de>
|
|
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
Signed-off-by: Juan Quintela <quintela@redhat.com>
|
|
(cherry picked from commit 73d963c0a75cb99c6aaa3f6f25e427aa0b35a02e)
|
|
[AF: BNC#864811]
|
|
Signed-off-by: Andreas Färber <afaerber@suse.de>
|
|
---
|
|
hw/intc/openpic.c | 16 ++++++++++++++--
|
|
1 file changed, 14 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/hw/intc/openpic.c b/hw/intc/openpic.c
|
|
index be76fbd..17136c9 100644
|
|
--- a/hw/intc/openpic.c
|
|
+++ b/hw/intc/openpic.c
|
|
@@ -41,6 +41,7 @@
|
|
#include "hw/sysbus.h"
|
|
#include "hw/pci/msi.h"
|
|
#include "qemu/bitops.h"
|
|
+#include "qapi/qmp/qerror.h"
|
|
|
|
//#define DEBUG_OPENPIC
|
|
|
|
@@ -1416,7 +1417,7 @@ static void openpic_load_IRQ_queue(QEMUFile* f, IRQQueue *q)
|
|
static int openpic_load(QEMUFile* f, void *opaque, int version_id)
|
|
{
|
|
OpenPICState *opp = (OpenPICState *)opaque;
|
|
- unsigned int i;
|
|
+ unsigned int i, nb_cpus;
|
|
|
|
if (version_id != 1) {
|
|
return -EINVAL;
|
|
@@ -1428,7 +1429,11 @@ static int openpic_load(QEMUFile* f, void *opaque, int version_id)
|
|
qemu_get_be32s(f, &opp->spve);
|
|
qemu_get_be32s(f, &opp->tfrr);
|
|
|
|
- qemu_get_be32s(f, &opp->nb_cpus);
|
|
+ qemu_get_be32s(f, &nb_cpus);
|
|
+ if (opp->nb_cpus != nb_cpus) {
|
|
+ return -EINVAL;
|
|
+ }
|
|
+ assert(nb_cpus > 0 && nb_cpus <= MAX_CPU);
|
|
|
|
for (i = 0; i < opp->nb_cpus; i++) {
|
|
qemu_get_sbe32s(f, &opp->dst[i].ctpr);
|
|
@@ -1567,6 +1572,13 @@ static void openpic_realize(DeviceState *dev, Error **errp)
|
|
{NULL}
|
|
};
|
|
|
|
+ if (opp->nb_cpus > MAX_CPU) {
|
|
+ error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE,
|
|
+ TYPE_OPENPIC, "nb_cpus", (uint64_t)opp->nb_cpus,
|
|
+ (uint64_t)0, (uint64_t)MAX_CPU);
|
|
+ return;
|
|
+ }
|
|
+
|
|
switch (opp->model) {
|
|
case OPENPIC_MODEL_FSL_MPIC_20:
|
|
default:
|