CVE-2016-7907: net: imx: infinite loop (bz #1381182)
CVE-2017-5525: audio: memory leakage in ac97 (bz #1414110) CVE-2017-5526: audio: memory leakage in es1370 (bz #1414210) CVE-2016-10155 watchdog: memory leakage in i6300esb (bz #1415200) CVE-2017-5552: virtio-gpu-3d: memory leakage (bz #1415283) CVE-2017-5578: virtio-gpu: memory leakage (bz #1415797) CVE-2017-5667: sd: sdhci OOB access during multi block transfer (bz #1417560) CVE-2017-5856: scsi: megasas: memory leakage (bz #1418344) CVE-2017-5857: virtio-gpu-3d: host memory leakage in virgl_cmd_resource_unref (bz #1418383) CVE-2017-5898: usb: integer overflow in emulated_apdu_from_guest (bz #1419700) CVE-2017-5987: sd: infinite loop issue in multi block transfers (bz #1422001) CVE-2017-6058: vmxnet3: OOB access when doing vlan stripping (bz #1423359) CVE-2017-6505: usb: an infinite loop issue in ohci_service_ed_list (bz #1429434) CVE-2017-2615: cirrus: oob access while doing bitblt copy backward (bz #1418206) CVE-2017-2620: cirrus: potential arbitrary code execution (bz #1425419) Fix spice GL with new mesa/libglvnd (bz #1431905)
This commit is contained in:
parent
11f3efdec3
commit
eaa6ce4fe2
61
0043-net-imx-limit-buffer-descriptor-count.patch
Normal file
61
0043-net-imx-limit-buffer-descriptor-count.patch
Normal file
@ -0,0 +1,61 @@
|
||||
From: Prasad J Pandit <pjp@fedoraproject.org>
|
||||
Date: Thu, 2 Feb 2017 16:16:24 +0530
|
||||
Subject: [PATCH] net: imx: limit buffer descriptor count
|
||||
|
||||
i.MX Fast Ethernet Controller uses buffer descriptors to manage
|
||||
data flow to/fro receive & transmit queues. While transmitting
|
||||
packets, it could continue to read buffer descriptors if a buffer
|
||||
descriptor has length of zero and has crafted values in bd.flags.
|
||||
Set an upper limit to number of buffer descriptors.
|
||||
|
||||
Reported-by: Li Qiang <liqiang6-s@360.cn>
|
||||
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
|
||||
Signed-off-by: Jason Wang <jasowang@redhat.com>
|
||||
(cherry picked from commit 81f17e0d435c3db3a3e67e0d32ebf9c98973211f)
|
||||
---
|
||||
hw/net/imx_fec.c | 10 ++++++----
|
||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c
|
||||
index 1c415ab..6b42c10 100644
|
||||
--- a/hw/net/imx_fec.c
|
||||
+++ b/hw/net/imx_fec.c
|
||||
@@ -55,6 +55,8 @@
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
+#define IMX_MAX_DESC 1024
|
||||
+
|
||||
static const char *imx_default_reg_name(IMXFECState *s, uint32_t index)
|
||||
{
|
||||
static char tmp[20];
|
||||
@@ -402,12 +404,12 @@ static void imx_eth_update(IMXFECState *s)
|
||||
|
||||
static void imx_fec_do_tx(IMXFECState *s)
|
||||
{
|
||||
- int frame_size = 0;
|
||||
+ int frame_size = 0, descnt = 0;
|
||||
uint8_t frame[ENET_MAX_FRAME_SIZE];
|
||||
uint8_t *ptr = frame;
|
||||
uint32_t addr = s->tx_descriptor;
|
||||
|
||||
- while (1) {
|
||||
+ while (descnt++ < IMX_MAX_DESC) {
|
||||
IMXFECBufDesc bd;
|
||||
int len;
|
||||
|
||||
@@ -453,12 +455,12 @@ static void imx_fec_do_tx(IMXFECState *s)
|
||||
|
||||
static void imx_enet_do_tx(IMXFECState *s)
|
||||
{
|
||||
- int frame_size = 0;
|
||||
+ int frame_size = 0, descnt = 0;
|
||||
uint8_t frame[ENET_MAX_FRAME_SIZE];
|
||||
uint8_t *ptr = frame;
|
||||
uint32_t addr = s->tx_descriptor;
|
||||
|
||||
- while (1) {
|
||||
+ while (descnt++ < IMX_MAX_DESC) {
|
||||
IMXENETBufDesc bd;
|
||||
int len;
|
||||
|
49
0044-audio-ac97-add-exit-function.patch
Normal file
49
0044-audio-ac97-add-exit-function.patch
Normal file
@ -0,0 +1,49 @@
|
||||
From: Li Qiang <liqiang6-s@360.cn>
|
||||
Date: Wed, 14 Dec 2016 18:30:21 -0800
|
||||
Subject: [PATCH] audio: ac97: add exit function
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Currently the ac97 device emulation doesn't have a exit function,
|
||||
hot unplug this device will leak some memory. Add a exit function to
|
||||
avoid this.
|
||||
|
||||
Signed-off-by: Li Qiang <liqiang6-s@360.cn>
|
||||
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
||||
Message-id: 58520052.4825ed0a.27a71.6cae@mx.google.com
|
||||
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||
(cherry picked from commit 12351a91da97b414eec8cdb09f1d9f41e535a401)
|
||||
---
|
||||
hw/audio/ac97.c | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c
|
||||
index cbd959e..c306575 100644
|
||||
--- a/hw/audio/ac97.c
|
||||
+++ b/hw/audio/ac97.c
|
||||
@@ -1387,6 +1387,16 @@ static void ac97_realize(PCIDevice *dev, Error **errp)
|
||||
ac97_on_reset (&s->dev.qdev);
|
||||
}
|
||||
|
||||
+static void ac97_exit(PCIDevice *dev)
|
||||
+{
|
||||
+ AC97LinkState *s = DO_UPCAST(AC97LinkState, dev, dev);
|
||||
+
|
||||
+ AUD_close_in(&s->card, s->voice_pi);
|
||||
+ AUD_close_out(&s->card, s->voice_po);
|
||||
+ AUD_close_in(&s->card, s->voice_mc);
|
||||
+ AUD_remove_card(&s->card);
|
||||
+}
|
||||
+
|
||||
static int ac97_init (PCIBus *bus)
|
||||
{
|
||||
pci_create_simple (bus, -1, "AC97");
|
||||
@@ -1404,6 +1414,7 @@ static void ac97_class_init (ObjectClass *klass, void *data)
|
||||
PCIDeviceClass *k = PCI_DEVICE_CLASS (klass);
|
||||
|
||||
k->realize = ac97_realize;
|
||||
+ k->exit = ac97_exit;
|
||||
k->vendor_id = PCI_VENDOR_ID_INTEL;
|
||||
k->device_id = PCI_DEVICE_ID_INTEL_82801AA_5;
|
||||
k->revision = 0x01;
|
52
0045-audio-es1370-add-exit-function.patch
Normal file
52
0045-audio-es1370-add-exit-function.patch
Normal file
@ -0,0 +1,52 @@
|
||||
From: Li Qiang <liqiang6-s@360.cn>
|
||||
Date: Wed, 14 Dec 2016 18:32:22 -0800
|
||||
Subject: [PATCH] audio: es1370: add exit function
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Currently the es1370 device emulation doesn't have a exit function,
|
||||
hot unplug this device will leak some memory. Add a exit function to
|
||||
avoid this.
|
||||
|
||||
Signed-off-by: Li Qiang <liqiang6-s@360.cn>
|
||||
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
||||
Message-id: 585200c9.a968ca0a.1ab80.4c98@mx.google.com
|
||||
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||
(cherry picked from commit 069eb7b2b8fc47c7cb52e5a4af23ea98d939e3da)
|
||||
---
|
||||
hw/audio/es1370.c | 14 ++++++++++++++
|
||||
1 file changed, 14 insertions(+)
|
||||
|
||||
diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c
|
||||
index 8449b5f..883ec69 100644
|
||||
--- a/hw/audio/es1370.c
|
||||
+++ b/hw/audio/es1370.c
|
||||
@@ -1041,6 +1041,19 @@ static void es1370_realize(PCIDevice *dev, Error **errp)
|
||||
es1370_reset (s);
|
||||
}
|
||||
|
||||
+static void es1370_exit(PCIDevice *dev)
|
||||
+{
|
||||
+ ES1370State *s = ES1370(dev);
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; i < 2; ++i) {
|
||||
+ AUD_close_out(&s->card, s->dac_voice[i]);
|
||||
+ }
|
||||
+
|
||||
+ AUD_close_in(&s->card, s->adc_voice);
|
||||
+ AUD_remove_card(&s->card);
|
||||
+}
|
||||
+
|
||||
static int es1370_init (PCIBus *bus)
|
||||
{
|
||||
pci_create_simple (bus, -1, TYPE_ES1370);
|
||||
@@ -1053,6 +1066,7 @@ static void es1370_class_init (ObjectClass *klass, void *data)
|
||||
PCIDeviceClass *k = PCI_DEVICE_CLASS (klass);
|
||||
|
||||
k->realize = es1370_realize;
|
||||
+ k->exit = es1370_exit;
|
||||
k->vendor_id = PCI_VENDOR_ID_ENSONIQ;
|
||||
k->device_id = PCI_DEVICE_ID_ENSONIQ_ES1370;
|
||||
k->class_id = PCI_CLASS_MULTIMEDIA_AUDIO;
|
43
0046-watchdog-6300esb-add-exit-function.patch
Normal file
43
0046-watchdog-6300esb-add-exit-function.patch
Normal file
@ -0,0 +1,43 @@
|
||||
From: Li Qiang <liqiang6-s@360.cn>
|
||||
Date: Mon, 28 Nov 2016 17:49:04 -0800
|
||||
Subject: [PATCH] watchdog: 6300esb: add exit function
|
||||
|
||||
When the Intel 6300ESB watchdog is hot unplug. The timer allocated
|
||||
in realize isn't freed thus leaking memory leak. This patch avoid
|
||||
this through adding the exit function.
|
||||
|
||||
Signed-off-by: Li Qiang <liqiang6-s@360.cn>
|
||||
Message-Id: <583cde9c.3223ed0a.7f0c2.886e@mx.google.com>
|
||||
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
(cherry picked from commit eb7a20a3616085d46aa6b4b4224e15587ec67e6e)
|
||||
---
|
||||
hw/watchdog/wdt_i6300esb.c | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/hw/watchdog/wdt_i6300esb.c b/hw/watchdog/wdt_i6300esb.c
|
||||
index a83d951..49b3cd1 100644
|
||||
--- a/hw/watchdog/wdt_i6300esb.c
|
||||
+++ b/hw/watchdog/wdt_i6300esb.c
|
||||
@@ -428,6 +428,14 @@ static void i6300esb_realize(PCIDevice *dev, Error **errp)
|
||||
/* qemu_register_coalesced_mmio (addr, 0x10); ? */
|
||||
}
|
||||
|
||||
+static void i6300esb_exit(PCIDevice *dev)
|
||||
+{
|
||||
+ I6300State *d = WATCHDOG_I6300ESB_DEVICE(dev);
|
||||
+
|
||||
+ timer_del(d->timer);
|
||||
+ timer_free(d->timer);
|
||||
+}
|
||||
+
|
||||
static WatchdogTimerModel model = {
|
||||
.wdt_name = "i6300esb",
|
||||
.wdt_description = "Intel 6300ESB",
|
||||
@@ -441,6 +449,7 @@ static void i6300esb_class_init(ObjectClass *klass, void *data)
|
||||
k->config_read = i6300esb_config_read;
|
||||
k->config_write = i6300esb_config_write;
|
||||
k->realize = i6300esb_realize;
|
||||
+ k->exit = i6300esb_exit;
|
||||
k->vendor_id = PCI_VENDOR_ID_INTEL;
|
||||
k->device_id = PCI_DEVICE_ID_INTEL_ESB_9;
|
||||
k->class_id = PCI_CLASS_SYSTEM_OTHER;
|
@ -0,0 +1,38 @@
|
||||
From: Li Qiang <liq3ea@gmail.com>
|
||||
Date: Thu, 29 Dec 2016 03:11:26 -0500
|
||||
Subject: [PATCH] virtio-gpu-3d: fix memory leak in resource attach backing
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
If the virgl_renderer_resource_attach_iov function fails the
|
||||
'res_iovs' will be leaked. Add check of the return value to
|
||||
free the 'res_iovs' when failing.
|
||||
|
||||
Signed-off-by: Li Qiang <liq3ea@gmail.com>
|
||||
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
||||
Message-id: 1482999086-59795-1-git-send-email-liq3ea@gmail.com
|
||||
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||
(cherry picked from commit 33243031dad02d161225ba99d782616da133f689)
|
||||
---
|
||||
hw/display/virtio-gpu-3d.c | 7 +++++--
|
||||
1 file changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c
|
||||
index cdd03a4..f96a0c2 100644
|
||||
--- a/hw/display/virtio-gpu-3d.c
|
||||
+++ b/hw/display/virtio-gpu-3d.c
|
||||
@@ -291,8 +291,11 @@ static void virgl_resource_attach_backing(VirtIOGPU *g,
|
||||
return;
|
||||
}
|
||||
|
||||
- virgl_renderer_resource_attach_iov(att_rb.resource_id,
|
||||
- res_iovs, att_rb.nr_entries);
|
||||
+ ret = virgl_renderer_resource_attach_iov(att_rb.resource_id,
|
||||
+ res_iovs, att_rb.nr_entries);
|
||||
+
|
||||
+ if (ret != 0)
|
||||
+ virtio_gpu_cleanup_mapping_iov(res_iovs, att_rb.nr_entries);
|
||||
}
|
||||
|
||||
static void virgl_resource_detach_backing(VirtIOGPU *g,
|
@ -0,0 +1,32 @@
|
||||
From: Li Qiang <liq3ea@gmail.com>
|
||||
Date: Thu, 29 Dec 2016 04:28:41 -0500
|
||||
Subject: [PATCH] virtio-gpu: fix memory leak in resource attach backing
|
||||
|
||||
In the resource attach backing function, everytime it will
|
||||
allocate 'res->iov' thus can leading a memory leak. This
|
||||
patch avoid this.
|
||||
|
||||
Signed-off-by: Li Qiang <liq3ea@gmail.com>
|
||||
Message-id: 1483003721-65360-1-git-send-email-liq3ea@gmail.com
|
||||
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||
(cherry picked from commit 204f01b30975923c64006f8067f0937b91eea68b)
|
||||
---
|
||||
hw/display/virtio-gpu.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
|
||||
index 8903dee..cadd7d8 100644
|
||||
--- a/hw/display/virtio-gpu.c
|
||||
+++ b/hw/display/virtio-gpu.c
|
||||
@@ -708,6 +708,11 @@ virtio_gpu_resource_attach_backing(VirtIOGPU *g,
|
||||
return;
|
||||
}
|
||||
|
||||
+ if (res->iov) {
|
||||
+ cmd->error = VIRTIO_GPU_RESP_ERR_UNSPEC;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
ret = virtio_gpu_create_mapping_iov(&ab, cmd, &res->addrs, &res->iov);
|
||||
if (ret != 0) {
|
||||
cmd->error = VIRTIO_GPU_RESP_ERR_UNSPEC;
|
34
0049-sd-sdhci-check-data-length-during-dma_memory_read.patch
Normal file
34
0049-sd-sdhci-check-data-length-during-dma_memory_read.patch
Normal file
@ -0,0 +1,34 @@
|
||||
From: Prasad J Pandit <pjp@fedoraproject.org>
|
||||
Date: Tue, 7 Feb 2017 18:29:59 +0000
|
||||
Subject: [PATCH] sd: sdhci: check data length during dma_memory_read
|
||||
|
||||
While doing multi block SDMA transfer in routine
|
||||
'sdhci_sdma_transfer_multi_blocks', the 's->fifo_buffer' starting
|
||||
index 'begin' and data length 's->data_count' could end up to be same.
|
||||
This could lead to an OOB access issue. Correct transfer data length
|
||||
to avoid it.
|
||||
|
||||
Cc: qemu-stable@nongnu.org
|
||||
Reported-by: Jiang Xin <jiangxin1@huawei.com>
|
||||
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
|
||||
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
|
||||
Message-id: 20170130064736.9236-1-ppandit@redhat.com
|
||||
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
||||
(cherry picked from commit 42922105beb14c2fc58185ea022b9f72fb5465e9)
|
||||
---
|
||||
hw/sd/sdhci.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
|
||||
index 01fbf22..5bd5ab6 100644
|
||||
--- a/hw/sd/sdhci.c
|
||||
+++ b/hw/sd/sdhci.c
|
||||
@@ -536,7 +536,7 @@ static void sdhci_sdma_transfer_multi_blocks(SDHCIState *s)
|
||||
boundary_count -= block_size - begin;
|
||||
}
|
||||
dma_memory_read(&address_space_memory, s->sdmasysad,
|
||||
- &s->fifo_buffer[begin], s->data_count);
|
||||
+ &s->fifo_buffer[begin], s->data_count - begin);
|
||||
s->sdmasysad += s->data_count - begin;
|
||||
if (s->data_count == block_size) {
|
||||
for (n = 0; n < block_size; n++) {
|
61
0050-megasas-fix-guest-triggered-memory-leak.patch
Normal file
61
0050-megasas-fix-guest-triggered-memory-leak.patch
Normal file
@ -0,0 +1,61 @@
|
||||
From: Paolo Bonzini <pbonzini@redhat.com>
|
||||
Date: Mon, 2 Jan 2017 11:03:33 +0100
|
||||
Subject: [PATCH] megasas: fix guest-triggered memory leak
|
||||
|
||||
If the guest sets the sglist size to a value >=2GB, megasas_handle_dcmd
|
||||
will return MFI_STAT_MEMORY_NOT_AVAILABLE without freeing the memory.
|
||||
Avoid this by returning only the status from map_dcmd, and loading
|
||||
cmd->iov_size in the caller.
|
||||
|
||||
Reported-by: Li Qiang <liqiang6-s@360.cn>
|
||||
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
(cherry picked from commit 765a707000e838c30b18d712fe6cb3dd8e0435f3)
|
||||
---
|
||||
hw/scsi/megasas.c | 11 ++++++-----
|
||||
1 file changed, 6 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
|
||||
index 52a4123..ebf0302 100644
|
||||
--- a/hw/scsi/megasas.c
|
||||
+++ b/hw/scsi/megasas.c
|
||||
@@ -672,14 +672,14 @@ static int megasas_map_dcmd(MegasasState *s, MegasasCmd *cmd)
|
||||
trace_megasas_dcmd_invalid_sge(cmd->index,
|
||||
cmd->frame->header.sge_count);
|
||||
cmd->iov_size = 0;
|
||||
- return -1;
|
||||
+ return -EINVAL;
|
||||
}
|
||||
iov_pa = megasas_sgl_get_addr(cmd, &cmd->frame->dcmd.sgl);
|
||||
iov_size = megasas_sgl_get_len(cmd, &cmd->frame->dcmd.sgl);
|
||||
pci_dma_sglist_init(&cmd->qsg, PCI_DEVICE(s), 1);
|
||||
qemu_sglist_add(&cmd->qsg, iov_pa, iov_size);
|
||||
cmd->iov_size = iov_size;
|
||||
- return cmd->iov_size;
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
static void megasas_finish_dcmd(MegasasCmd *cmd, uint32_t iov_size)
|
||||
@@ -1552,19 +1552,20 @@ static const struct dcmd_cmd_tbl_t {
|
||||
|
||||
static int megasas_handle_dcmd(MegasasState *s, MegasasCmd *cmd)
|
||||
{
|
||||
- int opcode, len;
|
||||
+ int opcode;
|
||||
int retval = 0;
|
||||
+ size_t len;
|
||||
const struct dcmd_cmd_tbl_t *cmdptr = dcmd_cmd_tbl;
|
||||
|
||||
opcode = le32_to_cpu(cmd->frame->dcmd.opcode);
|
||||
trace_megasas_handle_dcmd(cmd->index, opcode);
|
||||
- len = megasas_map_dcmd(s, cmd);
|
||||
- if (len < 0) {
|
||||
+ if (megasas_map_dcmd(s, cmd) < 0) {
|
||||
return MFI_STAT_MEMORY_NOT_AVAILABLE;
|
||||
}
|
||||
while (cmdptr->opcode != -1 && cmdptr->opcode != opcode) {
|
||||
cmdptr++;
|
||||
}
|
||||
+ len = cmd->iov_size;
|
||||
if (cmdptr->opcode == -1) {
|
||||
trace_megasas_dcmd_unhandled(cmd->index, opcode, len);
|
||||
retval = megasas_dcmd_dummy(s, cmd);
|
@ -0,0 +1,45 @@
|
||||
From: Gerd Hoffmann <kraxel@redhat.com>
|
||||
Date: Mon, 23 Jan 2017 11:26:50 +0100
|
||||
Subject: [PATCH] virtio-gpu: fix resource leak in virgl_cmd_resource_unref
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
When the guest sends VIRTIO_GPU_CMD_RESOURCE_UNREF without detaching the
|
||||
backing storage beforehand (VIRTIO_GPU_CMD_RESOURCE_DETACH_BACKING)
|
||||
we'll leak memory.
|
||||
|
||||
This patch fixes it for 3d mode, simliar to the 2d mode fix in commit
|
||||
"b8e2392 virtio-gpu: call cleanup mapping function in resource destroy".
|
||||
|
||||
Reported-by: 李强 <liqiang6-s@360.cn>
|
||||
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||
Message-id: 1485167210-4757-1-git-send-email-kraxel@redhat.com
|
||||
(cherry picked from commit 5e8e3c4c75c199aa1017db816fca02be2a9f8798)
|
||||
---
|
||||
hw/display/virtio-gpu-3d.c | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c
|
||||
index f96a0c2..ecb09d1 100644
|
||||
--- a/hw/display/virtio-gpu-3d.c
|
||||
+++ b/hw/display/virtio-gpu-3d.c
|
||||
@@ -77,10 +77,18 @@ static void virgl_cmd_resource_unref(VirtIOGPU *g,
|
||||
struct virtio_gpu_ctrl_command *cmd)
|
||||
{
|
||||
struct virtio_gpu_resource_unref unref;
|
||||
+ struct iovec *res_iovs = NULL;
|
||||
+ int num_iovs = 0;
|
||||
|
||||
VIRTIO_GPU_FILL_CMD(unref);
|
||||
trace_virtio_gpu_cmd_res_unref(unref.resource_id);
|
||||
|
||||
+ virgl_renderer_resource_detach_iov(unref.resource_id,
|
||||
+ &res_iovs,
|
||||
+ &num_iovs);
|
||||
+ if (res_iovs != NULL && num_iovs != 0) {
|
||||
+ virtio_gpu_cleanup_mapping_iov(res_iovs, num_iovs);
|
||||
+ }
|
||||
virgl_renderer_resource_unref(unref.resource_id);
|
||||
}
|
||||
|
32
0052-usb-ccid-check-ccid-apdu-length.patch
Normal file
32
0052-usb-ccid-check-ccid-apdu-length.patch
Normal file
@ -0,0 +1,32 @@
|
||||
From: Prasad J Pandit <pjp@fedoraproject.org>
|
||||
Date: Fri, 3 Feb 2017 00:52:28 +0530
|
||||
Subject: [PATCH] usb: ccid: check ccid apdu length
|
||||
|
||||
CCID device emulator uses Application Protocol Data Units(APDU)
|
||||
to exchange command and responses to and from the host.
|
||||
The length in these units couldn't be greater than 65536. Add
|
||||
check to ensure the same. It'd also avoid potential integer
|
||||
overflow in emulated_apdu_from_guest.
|
||||
|
||||
Reported-by: Li Qiang <liqiang6-s@360.cn>
|
||||
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
|
||||
Message-id: 20170202192228.10847-1-ppandit@redhat.com
|
||||
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||
(cherry picked from commit c7dfbf322595ded4e70b626bf83158a9f3807c6a)
|
||||
---
|
||||
hw/usb/dev-smartcard-reader.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hw/usb/dev-smartcard-reader.c b/hw/usb/dev-smartcard-reader.c
|
||||
index af4b851..fc32b00 100644
|
||||
--- a/hw/usb/dev-smartcard-reader.c
|
||||
+++ b/hw/usb/dev-smartcard-reader.c
|
||||
@@ -967,7 +967,7 @@ static void ccid_on_apdu_from_guest(USBCCIDState *s, CCID_XferBlock *recv)
|
||||
DPRINTF(s, 1, "%s: seq %d, len %d\n", __func__,
|
||||
recv->hdr.bSeq, len);
|
||||
ccid_add_pending_answer(s, (CCID_Header *)recv);
|
||||
- if (s->card) {
|
||||
+ if (s->card && len <= BULK_OUT_DATA_SIZE) {
|
||||
ccid_card_apdu_from_guest(s->card, recv->abData, len);
|
||||
} else {
|
||||
DPRINTF(s, D_WARN, "warning: discarded apdu\n");
|
@ -0,0 +1,51 @@
|
||||
From: Prasad J Pandit <pjp@fedoraproject.org>
|
||||
Date: Tue, 28 Feb 2017 12:08:14 +0000
|
||||
Subject: [PATCH] sd: sdhci: check transfer mode register in multi block
|
||||
transfer
|
||||
|
||||
In the SDHCI protocol, the transfer mode register value
|
||||
is used during multi block transfer to check if block count
|
||||
register is enabled and should be updated. Transfer mode
|
||||
register could be set such that, block count register would
|
||||
not be updated, thus leading to an infinite loop. Add check
|
||||
to avoid it.
|
||||
|
||||
Reported-by: Wjjzhang <wjjzhang@tencent.com>
|
||||
Reported-by: Jiang Xin <jiangxin1@huawei.com>
|
||||
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
|
||||
Message-id: 20170214185225.7994-3-ppandit@redhat.com
|
||||
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
|
||||
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
||||
(cherry picked from commit 6e86d90352adf6cb08295255220295cf23c4286e)
|
||||
---
|
||||
hw/sd/sdhci.c | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
|
||||
index 5bd5ab6..a9c744b 100644
|
||||
--- a/hw/sd/sdhci.c
|
||||
+++ b/hw/sd/sdhci.c
|
||||
@@ -486,6 +486,11 @@ static void sdhci_sdma_transfer_multi_blocks(SDHCIState *s)
|
||||
uint32_t boundary_chk = 1 << (((s->blksize & 0xf000) >> 12) + 12);
|
||||
uint32_t boundary_count = boundary_chk - (s->sdmasysad % boundary_chk);
|
||||
|
||||
+ if (!(s->trnmod & SDHC_TRNS_BLK_CNT_EN) || !s->blkcnt) {
|
||||
+ qemu_log_mask(LOG_UNIMP, "infinite transfer is not supported\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
/* XXX: Some sd/mmc drivers (for example, u-boot-slp) do not account for
|
||||
* possible stop at page boundary if initial address is not page aligned,
|
||||
* allow them to work properly */
|
||||
@@ -797,11 +802,6 @@ static void sdhci_data_transfer(void *opaque)
|
||||
if (s->trnmod & SDHC_TRNS_DMA) {
|
||||
switch (SDHC_DMA_TYPE(s->hostctl)) {
|
||||
case SDHC_CTRL_SDMA:
|
||||
- if ((s->trnmod & SDHC_TRNS_MULTI) &&
|
||||
- (!(s->trnmod & SDHC_TRNS_BLK_CNT_EN) || s->blkcnt == 0)) {
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
if ((s->blkcnt == 1) || !(s->trnmod & SDHC_TRNS_MULTI)) {
|
||||
sdhci_sdma_transfer_single_block(s);
|
||||
} else {
|
125
0054-eth-Extend-vlan-stripping-functions.patch
Normal file
125
0054-eth-Extend-vlan-stripping-functions.patch
Normal file
@ -0,0 +1,125 @@
|
||||
From: Dmitry Fleytman <dmitry@daynix.com>
|
||||
Date: Thu, 16 Feb 2017 14:29:32 +0200
|
||||
Subject: [PATCH] eth: Extend vlan stripping functions
|
||||
|
||||
Make VLAN stripping functions return number of bytes
|
||||
copied to given Ethernet header buffer.
|
||||
|
||||
This information should be used to re-compose
|
||||
packet IOV after VLAN stripping.
|
||||
|
||||
Cc: qemu-stable@nongnu.org
|
||||
Signed-off-by: Dmitry Fleytman <dmitry@daynix.com>
|
||||
Signed-off-by: Jason Wang <jasowang@redhat.com>
|
||||
(cherry picked from commit 566342c3125ac2e73abd36c650222318164517ed)
|
||||
---
|
||||
include/net/eth.h | 4 ++--
|
||||
net/eth.c | 25 ++++++++++++++-----------
|
||||
2 files changed, 16 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/include/net/eth.h b/include/net/eth.h
|
||||
index 2013175..afeb45b 100644
|
||||
--- a/include/net/eth.h
|
||||
+++ b/include/net/eth.h
|
||||
@@ -331,12 +331,12 @@ eth_get_pkt_tci(const void *p)
|
||||
}
|
||||
}
|
||||
|
||||
-bool
|
||||
+size_t
|
||||
eth_strip_vlan(const struct iovec *iov, int iovcnt, size_t iovoff,
|
||||
uint8_t *new_ehdr_buf,
|
||||
uint16_t *payload_offset, uint16_t *tci);
|
||||
|
||||
-bool
|
||||
+size_t
|
||||
eth_strip_vlan_ex(const struct iovec *iov, int iovcnt, size_t iovoff,
|
||||
uint16_t vet, uint8_t *new_ehdr_buf,
|
||||
uint16_t *payload_offset, uint16_t *tci);
|
||||
diff --git a/net/eth.c b/net/eth.c
|
||||
index df81efb..5b9ba26 100644
|
||||
--- a/net/eth.c
|
||||
+++ b/net/eth.c
|
||||
@@ -232,7 +232,7 @@ void eth_get_protocols(const struct iovec *iov, int iovcnt,
|
||||
}
|
||||
}
|
||||
|
||||
-bool
|
||||
+size_t
|
||||
eth_strip_vlan(const struct iovec *iov, int iovcnt, size_t iovoff,
|
||||
uint8_t *new_ehdr_buf,
|
||||
uint16_t *payload_offset, uint16_t *tci)
|
||||
@@ -244,7 +244,7 @@ eth_strip_vlan(const struct iovec *iov, int iovcnt, size_t iovoff,
|
||||
new_ehdr, sizeof(*new_ehdr));
|
||||
|
||||
if (copied < sizeof(*new_ehdr)) {
|
||||
- return false;
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
switch (be16_to_cpu(new_ehdr->h_proto)) {
|
||||
@@ -254,7 +254,7 @@ eth_strip_vlan(const struct iovec *iov, int iovcnt, size_t iovoff,
|
||||
&vlan_hdr, sizeof(vlan_hdr));
|
||||
|
||||
if (copied < sizeof(vlan_hdr)) {
|
||||
- return false;
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
new_ehdr->h_proto = vlan_hdr.h_proto;
|
||||
@@ -268,18 +268,21 @@ eth_strip_vlan(const struct iovec *iov, int iovcnt, size_t iovoff,
|
||||
PKT_GET_VLAN_HDR(new_ehdr), sizeof(vlan_hdr));
|
||||
|
||||
if (copied < sizeof(vlan_hdr)) {
|
||||
- return false;
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
*payload_offset += sizeof(vlan_hdr);
|
||||
+
|
||||
+ return sizeof(struct eth_header) + sizeof(struct vlan_header);
|
||||
+ } else {
|
||||
+ return sizeof(struct eth_header);
|
||||
}
|
||||
- return true;
|
||||
default:
|
||||
- return false;
|
||||
+ return 0;
|
||||
}
|
||||
}
|
||||
|
||||
-bool
|
||||
+size_t
|
||||
eth_strip_vlan_ex(const struct iovec *iov, int iovcnt, size_t iovoff,
|
||||
uint16_t vet, uint8_t *new_ehdr_buf,
|
||||
uint16_t *payload_offset, uint16_t *tci)
|
||||
@@ -291,7 +294,7 @@ eth_strip_vlan_ex(const struct iovec *iov, int iovcnt, size_t iovoff,
|
||||
new_ehdr, sizeof(*new_ehdr));
|
||||
|
||||
if (copied < sizeof(*new_ehdr)) {
|
||||
- return false;
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
if (be16_to_cpu(new_ehdr->h_proto) == vet) {
|
||||
@@ -299,17 +302,17 @@ eth_strip_vlan_ex(const struct iovec *iov, int iovcnt, size_t iovoff,
|
||||
&vlan_hdr, sizeof(vlan_hdr));
|
||||
|
||||
if (copied < sizeof(vlan_hdr)) {
|
||||
- return false;
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
new_ehdr->h_proto = vlan_hdr.h_proto;
|
||||
|
||||
*tci = be16_to_cpu(vlan_hdr.h_tci);
|
||||
*payload_offset = iovoff + sizeof(*new_ehdr) + sizeof(vlan_hdr);
|
||||
- return true;
|
||||
+ return sizeof(struct eth_header);
|
||||
}
|
||||
|
||||
- return false;
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
void
|
117
0055-NetRxPkt-Fix-memory-corruption-on-VLAN-header-stripp.patch
Normal file
117
0055-NetRxPkt-Fix-memory-corruption-on-VLAN-header-stripp.patch
Normal file
@ -0,0 +1,117 @@
|
||||
From: Dmitry Fleytman <dmitry@daynix.com>
|
||||
Date: Thu, 16 Feb 2017 14:29:33 +0200
|
||||
Subject: [PATCH] NetRxPkt: Fix memory corruption on VLAN header stripping
|
||||
|
||||
This patch fixed a problem that was introduced in commit eb700029.
|
||||
|
||||
When net_rx_pkt_attach_iovec() calls eth_strip_vlan()
|
||||
this can result in pkt->ehdr_buf being overflowed, because
|
||||
ehdr_buf is only sizeof(struct eth_header) bytes large
|
||||
but eth_strip_vlan() can write
|
||||
sizeof(struct eth_header) + sizeof(struct vlan_header)
|
||||
bytes into it.
|
||||
|
||||
Devices affected by this problem: vmxnet3.
|
||||
|
||||
Cc: qemu-stable@nongnu.org
|
||||
Reported-by: Peter Maydell <peter.maydell@linaro.org>
|
||||
Signed-off-by: Dmitry Fleytman <dmitry@daynix.com>
|
||||
Signed-off-by: Jason Wang <jasowang@redhat.com>
|
||||
(cherry picked from commit df8bf7a7fe75eb5d5caffa55f5cd4292b757aea6)
|
||||
---
|
||||
hw/net/net_rx_pkt.c | 34 +++++++++++++++++-----------------
|
||||
1 file changed, 17 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/hw/net/net_rx_pkt.c b/hw/net/net_rx_pkt.c
|
||||
index 1019b50..7c0beac 100644
|
||||
--- a/hw/net/net_rx_pkt.c
|
||||
+++ b/hw/net/net_rx_pkt.c
|
||||
@@ -23,13 +23,13 @@
|
||||
|
||||
struct NetRxPkt {
|
||||
struct virtio_net_hdr virt_hdr;
|
||||
- uint8_t ehdr_buf[sizeof(struct eth_header)];
|
||||
+ uint8_t ehdr_buf[sizeof(struct eth_header) + sizeof(struct vlan_header)];
|
||||
struct iovec *vec;
|
||||
uint16_t vec_len_total;
|
||||
uint16_t vec_len;
|
||||
uint32_t tot_len;
|
||||
uint16_t tci;
|
||||
- bool vlan_stripped;
|
||||
+ size_t ehdr_buf_len;
|
||||
bool has_virt_hdr;
|
||||
eth_pkt_types_e packet_type;
|
||||
|
||||
@@ -88,15 +88,13 @@ net_rx_pkt_pull_data(struct NetRxPkt *pkt,
|
||||
const struct iovec *iov, int iovcnt,
|
||||
size_t ploff)
|
||||
{
|
||||
- if (pkt->vlan_stripped) {
|
||||
+ if (pkt->ehdr_buf_len) {
|
||||
net_rx_pkt_iovec_realloc(pkt, iovcnt + 1);
|
||||
|
||||
pkt->vec[0].iov_base = pkt->ehdr_buf;
|
||||
- pkt->vec[0].iov_len = sizeof(pkt->ehdr_buf);
|
||||
-
|
||||
- pkt->tot_len =
|
||||
- iov_size(iov, iovcnt) - ploff + sizeof(struct eth_header);
|
||||
+ pkt->vec[0].iov_len = pkt->ehdr_buf_len;
|
||||
|
||||
+ pkt->tot_len = iov_size(iov, iovcnt) - ploff + pkt->ehdr_buf_len;
|
||||
pkt->vec_len = iov_copy(pkt->vec + 1, pkt->vec_len_total - 1,
|
||||
iov, iovcnt, ploff, pkt->tot_len);
|
||||
} else {
|
||||
@@ -123,11 +121,12 @@ void net_rx_pkt_attach_iovec(struct NetRxPkt *pkt,
|
||||
uint16_t tci = 0;
|
||||
uint16_t ploff = iovoff;
|
||||
assert(pkt);
|
||||
- pkt->vlan_stripped = false;
|
||||
|
||||
if (strip_vlan) {
|
||||
- pkt->vlan_stripped = eth_strip_vlan(iov, iovcnt, iovoff, pkt->ehdr_buf,
|
||||
- &ploff, &tci);
|
||||
+ pkt->ehdr_buf_len = eth_strip_vlan(iov, iovcnt, iovoff, pkt->ehdr_buf,
|
||||
+ &ploff, &tci);
|
||||
+ } else {
|
||||
+ pkt->ehdr_buf_len = 0;
|
||||
}
|
||||
|
||||
pkt->tci = tci;
|
||||
@@ -143,12 +142,13 @@ void net_rx_pkt_attach_iovec_ex(struct NetRxPkt *pkt,
|
||||
uint16_t tci = 0;
|
||||
uint16_t ploff = iovoff;
|
||||
assert(pkt);
|
||||
- pkt->vlan_stripped = false;
|
||||
|
||||
if (strip_vlan) {
|
||||
- pkt->vlan_stripped = eth_strip_vlan_ex(iov, iovcnt, iovoff, vet,
|
||||
- pkt->ehdr_buf,
|
||||
- &ploff, &tci);
|
||||
+ pkt->ehdr_buf_len = eth_strip_vlan_ex(iov, iovcnt, iovoff, vet,
|
||||
+ pkt->ehdr_buf,
|
||||
+ &ploff, &tci);
|
||||
+ } else {
|
||||
+ pkt->ehdr_buf_len = 0;
|
||||
}
|
||||
|
||||
pkt->tci = tci;
|
||||
@@ -162,8 +162,8 @@ void net_rx_pkt_dump(struct NetRxPkt *pkt)
|
||||
NetRxPkt *pkt = (NetRxPkt *)pkt;
|
||||
assert(pkt);
|
||||
|
||||
- printf("RX PKT: tot_len: %d, vlan_stripped: %d, vlan_tag: %d\n",
|
||||
- pkt->tot_len, pkt->vlan_stripped, pkt->tci);
|
||||
+ printf("RX PKT: tot_len: %d, ehdr_buf_len: %lu, vlan_tag: %d\n",
|
||||
+ pkt->tot_len, pkt->ehdr_buf_len, pkt->tci);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -426,7 +426,7 @@ bool net_rx_pkt_is_vlan_stripped(struct NetRxPkt *pkt)
|
||||
{
|
||||
assert(pkt);
|
||||
|
||||
- return pkt->vlan_stripped;
|
||||
+ return pkt->ehdr_buf_len ? true : false;
|
||||
}
|
||||
|
||||
bool net_rx_pkt_has_virt_hdr(struct NetRxPkt *pkt)
|
@ -0,0 +1,30 @@
|
||||
From: Dmitry Fleytman <dmitry@daynix.com>
|
||||
Date: Thu, 16 Feb 2017 14:29:34 +0200
|
||||
Subject: [PATCH] NetRxPkt: Do not try to pull more data than present
|
||||
|
||||
In case of VLAN stripping, ETH header put into a
|
||||
separate buffer, therefore amont of data copied
|
||||
from original IOV should be smaller.
|
||||
|
||||
Cc: qemu-stable@nongnu.org
|
||||
Signed-off-by: Dmitry Fleytman <dmitry@daynix.com>
|
||||
Signed-off-by: Jason Wang <jasowang@redhat.com>
|
||||
(cherry picked from commit d5e772146d2bbc92e5126c145eddef3b2843d026)
|
||||
---
|
||||
hw/net/net_rx_pkt.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hw/net/net_rx_pkt.c b/hw/net/net_rx_pkt.c
|
||||
index 7c0beac..d38babe 100644
|
||||
--- a/hw/net/net_rx_pkt.c
|
||||
+++ b/hw/net/net_rx_pkt.c
|
||||
@@ -96,7 +96,8 @@ net_rx_pkt_pull_data(struct NetRxPkt *pkt,
|
||||
|
||||
pkt->tot_len = iov_size(iov, iovcnt) - ploff + pkt->ehdr_buf_len;
|
||||
pkt->vec_len = iov_copy(pkt->vec + 1, pkt->vec_len_total - 1,
|
||||
- iov, iovcnt, ploff, pkt->tot_len);
|
||||
+ iov, iovcnt, ploff,
|
||||
+ pkt->tot_len - pkt->ehdr_buf_len);
|
||||
} else {
|
||||
net_rx_pkt_iovec_realloc(pkt, iovcnt);
|
||||
|
@ -0,0 +1,34 @@
|
||||
From: Dmitry Fleytman <dmitry@daynix.com>
|
||||
Date: Thu, 16 Feb 2017 14:29:35 +0200
|
||||
Subject: [PATCH] NetRxPkt: Account buffer with ETH header in IOV length
|
||||
|
||||
In case of VLAN stripping ETH header is stored in a
|
||||
separate chunk and length of IOV should take this into
|
||||
account.
|
||||
|
||||
This patch fixes checksum validation for RX packets
|
||||
with VLAN header.
|
||||
|
||||
Devices affected by this problem: e1000e and vmxnet3.
|
||||
|
||||
Cc: qemu-stable@nongnu.org
|
||||
Signed-off-by: Dmitry Fleytman <dmitry@daynix.com>
|
||||
Signed-off-by: Jason Wang <jasowang@redhat.com>
|
||||
(cherry picked from commit c5d083c561a4f5297cc2e44a2f3cef3324d77a88)
|
||||
---
|
||||
hw/net/net_rx_pkt.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hw/net/net_rx_pkt.c b/hw/net/net_rx_pkt.c
|
||||
index d38babe..c7ae33d 100644
|
||||
--- a/hw/net/net_rx_pkt.c
|
||||
+++ b/hw/net/net_rx_pkt.c
|
||||
@@ -97,7 +97,7 @@ net_rx_pkt_pull_data(struct NetRxPkt *pkt,
|
||||
pkt->tot_len = iov_size(iov, iovcnt) - ploff + pkt->ehdr_buf_len;
|
||||
pkt->vec_len = iov_copy(pkt->vec + 1, pkt->vec_len_total - 1,
|
||||
iov, iovcnt, ploff,
|
||||
- pkt->tot_len - pkt->ehdr_buf_len);
|
||||
+ pkt->tot_len - pkt->ehdr_buf_len) + 1;
|
||||
} else {
|
||||
net_rx_pkt_iovec_realloc(pkt, iovcnt);
|
||||
|
49
0058-usb-ohci-limit-the-number-of-link-eds.patch
Normal file
49
0058-usb-ohci-limit-the-number-of-link-eds.patch
Normal file
@ -0,0 +1,49 @@
|
||||
From: Li Qiang <liqiang6-s@360.cn>
|
||||
Date: Tue, 7 Feb 2017 02:23:33 -0800
|
||||
Subject: [PATCH] usb: ohci: limit the number of link eds
|
||||
|
||||
The guest may builds an infinite loop with link eds. This patch
|
||||
limit the number of linked ed to avoid this.
|
||||
|
||||
Signed-off-by: Li Qiang <liqiang6-s@360.cn>
|
||||
Message-id: 5899a02e.45ca240a.6c373.93c1@mx.google.com
|
||||
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||
(cherry picked from commit 95ed56939eb2eaa4e2f349fe6dcd13ca4edfd8fb)
|
||||
---
|
||||
hw/usb/hcd-ohci.c | 9 ++++++++-
|
||||
1 file changed, 8 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c
|
||||
index fa57038..48307fe 100644
|
||||
--- a/hw/usb/hcd-ohci.c
|
||||
+++ b/hw/usb/hcd-ohci.c
|
||||
@@ -42,6 +42,8 @@
|
||||
|
||||
#define OHCI_MAX_PORTS 15
|
||||
|
||||
+#define ED_LINK_LIMIT 4
|
||||
+
|
||||
static int64_t usb_frame_time;
|
||||
static int64_t usb_bit_time;
|
||||
|
||||
@@ -1184,7 +1186,7 @@ static int ohci_service_ed_list(OHCIState *ohci, uint32_t head, int completion)
|
||||
uint32_t next_ed;
|
||||
uint32_t cur;
|
||||
int active;
|
||||
-
|
||||
+ uint32_t link_cnt = 0;
|
||||
active = 0;
|
||||
|
||||
if (head == 0)
|
||||
@@ -1199,6 +1201,11 @@ static int ohci_service_ed_list(OHCIState *ohci, uint32_t head, int completion)
|
||||
|
||||
next_ed = ed.next & OHCI_DPTR_MASK;
|
||||
|
||||
+ if (++link_cnt > ED_LINK_LIMIT) {
|
||||
+ ohci_die(ohci);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
if ((ed.head & OHCI_ED_H) || (ed.flags & OHCI_ED_K)) {
|
||||
uint32_t addr;
|
||||
/* Cancel pending packets for ED that have been paused. */
|
@ -0,0 +1,69 @@
|
||||
From: Bruce Rogers <brogers@suse.com>
|
||||
Date: Mon, 9 Jan 2017 13:35:20 -0700
|
||||
Subject: [PATCH] display: cirrus: ignore source pitch value as needed in
|
||||
blit_is_unsafe
|
||||
|
||||
Commit 4299b90 added a check which is too broad, given that the source
|
||||
pitch value is not required to be initialized for solid fill operations.
|
||||
This patch refines the blit_is_unsafe() check to ignore source pitch in
|
||||
that case. After applying the above commit as a security patch, we
|
||||
noticed the SLES 11 SP4 guest gui failed to initialize properly.
|
||||
|
||||
Signed-off-by: Bruce Rogers <brogers@suse.com>
|
||||
Message-id: 20170109203520.5619-1-brogers@suse.com
|
||||
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||
(cherry picked from commit 913a87885f589d263e682c2eb6637c6e14538061)
|
||||
---
|
||||
hw/display/cirrus_vga.c | 11 +++++++----
|
||||
1 file changed, 7 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
|
||||
index bdb092e..379910d 100644
|
||||
--- a/hw/display/cirrus_vga.c
|
||||
+++ b/hw/display/cirrus_vga.c
|
||||
@@ -294,7 +294,7 @@ static bool blit_region_is_unsafe(struct CirrusVGAState *s,
|
||||
return false;
|
||||
}
|
||||
|
||||
-static bool blit_is_unsafe(struct CirrusVGAState *s)
|
||||
+static bool blit_is_unsafe(struct CirrusVGAState *s, bool dst_only)
|
||||
{
|
||||
/* should be the case, see cirrus_bitblt_start */
|
||||
assert(s->cirrus_blt_width > 0);
|
||||
@@ -308,6 +308,9 @@ static bool blit_is_unsafe(struct CirrusVGAState *s)
|
||||
s->cirrus_blt_dstaddr & s->cirrus_addr_mask)) {
|
||||
return true;
|
||||
}
|
||||
+ if (dst_only) {
|
||||
+ return false;
|
||||
+ }
|
||||
if (blit_region_is_unsafe(s, s->cirrus_blt_srcpitch,
|
||||
s->cirrus_blt_srcaddr & s->cirrus_addr_mask)) {
|
||||
return true;
|
||||
@@ -673,7 +676,7 @@ static int cirrus_bitblt_common_patterncopy(CirrusVGAState * s,
|
||||
|
||||
dst = s->vga.vram_ptr + (s->cirrus_blt_dstaddr & s->cirrus_addr_mask);
|
||||
|
||||
- if (blit_is_unsafe(s))
|
||||
+ if (blit_is_unsafe(s, false))
|
||||
return 0;
|
||||
|
||||
(*s->cirrus_rop) (s, dst, src,
|
||||
@@ -691,7 +694,7 @@ static int cirrus_bitblt_solidfill(CirrusVGAState *s, int blt_rop)
|
||||
{
|
||||
cirrus_fill_t rop_func;
|
||||
|
||||
- if (blit_is_unsafe(s)) {
|
||||
+ if (blit_is_unsafe(s, true)) {
|
||||
return 0;
|
||||
}
|
||||
rop_func = cirrus_fill[rop_to_index[blt_rop]][s->cirrus_blt_pixelwidth - 1];
|
||||
@@ -795,7 +798,7 @@ static int cirrus_do_copy(CirrusVGAState *s, int dst, int src, int w, int h)
|
||||
|
||||
static int cirrus_bitblt_videotovideo_copy(CirrusVGAState * s)
|
||||
{
|
||||
- if (blit_is_unsafe(s))
|
||||
+ if (blit_is_unsafe(s, false))
|
||||
return 0;
|
||||
|
||||
return cirrus_do_copy(s, s->cirrus_blt_dstaddr - s->vga.start_addr,
|
@ -0,0 +1,47 @@
|
||||
From: Wolfgang Bumiller <w.bumiller@proxmox.com>
|
||||
Date: Wed, 25 Jan 2017 14:48:57 +0100
|
||||
Subject: [PATCH] cirrus: handle negative pitch in cirrus_invalidate_region()
|
||||
|
||||
cirrus_invalidate_region() calls memory_region_set_dirty()
|
||||
on a per-line basis, always ranging from off_begin to
|
||||
off_begin+bytesperline. With a negative pitch off_begin
|
||||
marks the top most used address and thus we need to do an
|
||||
initial shift backwards by a line for negative pitches of
|
||||
backward blits, otherwise the first iteration covers the
|
||||
line going from the start offset forwards instead of
|
||||
backwards.
|
||||
Additionally since the start address is inclusive, if we
|
||||
shift by a full `bytesperline` we move to the first address
|
||||
*not* included in the blit, so we only shift by one less
|
||||
than bytesperline.
|
||||
|
||||
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
|
||||
Message-id: 1485352137-29367-1-git-send-email-w.bumiller@proxmox.com
|
||||
|
||||
[ kraxel: codestyle fixes ]
|
||||
|
||||
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||
(cherry picked from commit f153b563f8cf121aebf5a2fff5f0110faf58ccb3)
|
||||
---
|
||||
hw/display/cirrus_vga.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
|
||||
index 379910d..0f05e45 100644
|
||||
--- a/hw/display/cirrus_vga.c
|
||||
+++ b/hw/display/cirrus_vga.c
|
||||
@@ -661,9 +661,14 @@ static void cirrus_invalidate_region(CirrusVGAState * s, int off_begin,
|
||||
int off_cur;
|
||||
int off_cur_end;
|
||||
|
||||
+ if (off_pitch < 0) {
|
||||
+ off_begin -= bytesperline - 1;
|
||||
+ }
|
||||
+
|
||||
for (y = 0; y < lines; y++) {
|
||||
off_cur = off_begin;
|
||||
off_cur_end = (off_cur + bytesperline) & s->cirrus_addr_mask;
|
||||
+ assert(off_cur_end >= off_cur);
|
||||
memory_region_set_dirty(&s->vga.vram, off_cur, off_cur_end - off_cur);
|
||||
off_begin += off_pitch;
|
||||
}
|
@ -0,0 +1,99 @@
|
||||
From: Wolfgang Bumiller <w.bumiller@proxmox.com>
|
||||
Date: Tue, 24 Jan 2017 16:35:38 +0100
|
||||
Subject: [PATCH] cirrus: allow zero source pitch in pattern fill rops
|
||||
|
||||
The rops used by cirrus_bitblt_common_patterncopy only use
|
||||
the destination pitch, so the source pitch shoul allowed to
|
||||
be zero and the blit with used for the range check around the
|
||||
source address.
|
||||
|
||||
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
|
||||
Message-id: 1485272138-23249-1-git-send-email-w.bumiller@proxmox.com
|
||||
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||
(cherry picked from commit 5858dd1801883309bdd208d72ddb81c4e9fee30c)
|
||||
---
|
||||
hw/display/cirrus_vga.c | 27 +++++++++++++++++++--------
|
||||
1 file changed, 19 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
|
||||
index 0f05e45..98f089e 100644
|
||||
--- a/hw/display/cirrus_vga.c
|
||||
+++ b/hw/display/cirrus_vga.c
|
||||
@@ -272,9 +272,6 @@ static void cirrus_update_memory_access(CirrusVGAState *s);
|
||||
static bool blit_region_is_unsafe(struct CirrusVGAState *s,
|
||||
int32_t pitch, int32_t addr)
|
||||
{
|
||||
- if (!pitch) {
|
||||
- return true;
|
||||
- }
|
||||
if (pitch < 0) {
|
||||
int64_t min = addr
|
||||
+ ((int64_t)s->cirrus_blt_height-1) * pitch;
|
||||
@@ -294,8 +291,11 @@ static bool blit_region_is_unsafe(struct CirrusVGAState *s,
|
||||
return false;
|
||||
}
|
||||
|
||||
-static bool blit_is_unsafe(struct CirrusVGAState *s, bool dst_only)
|
||||
+static bool blit_is_unsafe(struct CirrusVGAState *s, bool dst_only,
|
||||
+ bool zero_src_pitch_ok)
|
||||
{
|
||||
+ int32_t check_pitch;
|
||||
+
|
||||
/* should be the case, see cirrus_bitblt_start */
|
||||
assert(s->cirrus_blt_width > 0);
|
||||
assert(s->cirrus_blt_height > 0);
|
||||
@@ -304,6 +304,10 @@ static bool blit_is_unsafe(struct CirrusVGAState *s, bool dst_only)
|
||||
return true;
|
||||
}
|
||||
|
||||
+ if (!s->cirrus_blt_dstpitch) {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
if (blit_region_is_unsafe(s, s->cirrus_blt_dstpitch,
|
||||
s->cirrus_blt_dstaddr & s->cirrus_addr_mask)) {
|
||||
return true;
|
||||
@@ -311,7 +315,13 @@ static bool blit_is_unsafe(struct CirrusVGAState *s, bool dst_only)
|
||||
if (dst_only) {
|
||||
return false;
|
||||
}
|
||||
- if (blit_region_is_unsafe(s, s->cirrus_blt_srcpitch,
|
||||
+
|
||||
+ check_pitch = s->cirrus_blt_srcpitch;
|
||||
+ if (!zero_src_pitch_ok && !check_pitch) {
|
||||
+ check_pitch = s->cirrus_blt_width;
|
||||
+ }
|
||||
+
|
||||
+ if (blit_region_is_unsafe(s, check_pitch,
|
||||
s->cirrus_blt_srcaddr & s->cirrus_addr_mask)) {
|
||||
return true;
|
||||
}
|
||||
@@ -681,8 +691,9 @@ static int cirrus_bitblt_common_patterncopy(CirrusVGAState * s,
|
||||
|
||||
dst = s->vga.vram_ptr + (s->cirrus_blt_dstaddr & s->cirrus_addr_mask);
|
||||
|
||||
- if (blit_is_unsafe(s, false))
|
||||
+ if (blit_is_unsafe(s, false, true)) {
|
||||
return 0;
|
||||
+ }
|
||||
|
||||
(*s->cirrus_rop) (s, dst, src,
|
||||
s->cirrus_blt_dstpitch, 0,
|
||||
@@ -699,7 +710,7 @@ static int cirrus_bitblt_solidfill(CirrusVGAState *s, int blt_rop)
|
||||
{
|
||||
cirrus_fill_t rop_func;
|
||||
|
||||
- if (blit_is_unsafe(s, true)) {
|
||||
+ if (blit_is_unsafe(s, true, true)) {
|
||||
return 0;
|
||||
}
|
||||
rop_func = cirrus_fill[rop_to_index[blt_rop]][s->cirrus_blt_pixelwidth - 1];
|
||||
@@ -803,7 +814,7 @@ static int cirrus_do_copy(CirrusVGAState *s, int dst, int src, int w, int h)
|
||||
|
||||
static int cirrus_bitblt_videotovideo_copy(CirrusVGAState * s)
|
||||
{
|
||||
- if (blit_is_unsafe(s, false))
|
||||
+ if (blit_is_unsafe(s, false, false))
|
||||
return 0;
|
||||
|
||||
return cirrus_do_copy(s, s->cirrus_blt_dstaddr - s->vga.start_addr,
|
101
0062-cirrus-fix-blit-address-mask-handling.patch
Normal file
101
0062-cirrus-fix-blit-address-mask-handling.patch
Normal file
@ -0,0 +1,101 @@
|
||||
From: Gerd Hoffmann <kraxel@redhat.com>
|
||||
Date: Wed, 25 Jan 2017 11:09:56 +0100
|
||||
Subject: [PATCH] cirrus: fix blit address mask handling
|
||||
|
||||
Apply the cirrus_addr_mask to cirrus_blt_dstaddr and cirrus_blt_srcaddr
|
||||
right after assigning them, in cirrus_bitblt_start(), instead of having
|
||||
this all over the place in the cirrus code, and missing a few places.
|
||||
|
||||
Reported-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
|
||||
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||
Message-id: 1485338996-17095-1-git-send-email-kraxel@redhat.com
|
||||
(cherry picked from commit 60cd23e85151525ab26591394c4e7e06fa07d216)
|
||||
---
|
||||
hw/display/cirrus_vga.c | 25 ++++++++++++-------------
|
||||
1 file changed, 12 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
|
||||
index 98f089e..7db6409 100644
|
||||
--- a/hw/display/cirrus_vga.c
|
||||
+++ b/hw/display/cirrus_vga.c
|
||||
@@ -309,7 +309,7 @@ static bool blit_is_unsafe(struct CirrusVGAState *s, bool dst_only,
|
||||
}
|
||||
|
||||
if (blit_region_is_unsafe(s, s->cirrus_blt_dstpitch,
|
||||
- s->cirrus_blt_dstaddr & s->cirrus_addr_mask)) {
|
||||
+ s->cirrus_blt_dstaddr)) {
|
||||
return true;
|
||||
}
|
||||
if (dst_only) {
|
||||
@@ -322,7 +322,7 @@ static bool blit_is_unsafe(struct CirrusVGAState *s, bool dst_only,
|
||||
}
|
||||
|
||||
if (blit_region_is_unsafe(s, check_pitch,
|
||||
- s->cirrus_blt_srcaddr & s->cirrus_addr_mask)) {
|
||||
+ s->cirrus_blt_srcaddr)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -689,7 +689,7 @@ static int cirrus_bitblt_common_patterncopy(CirrusVGAState * s,
|
||||
{
|
||||
uint8_t *dst;
|
||||
|
||||
- dst = s->vga.vram_ptr + (s->cirrus_blt_dstaddr & s->cirrus_addr_mask);
|
||||
+ dst = s->vga.vram_ptr + s->cirrus_blt_dstaddr;
|
||||
|
||||
if (blit_is_unsafe(s, false, true)) {
|
||||
return 0;
|
||||
@@ -714,7 +714,7 @@ static int cirrus_bitblt_solidfill(CirrusVGAState *s, int blt_rop)
|
||||
return 0;
|
||||
}
|
||||
rop_func = cirrus_fill[rop_to_index[blt_rop]][s->cirrus_blt_pixelwidth - 1];
|
||||
- rop_func(s, s->vga.vram_ptr + (s->cirrus_blt_dstaddr & s->cirrus_addr_mask),
|
||||
+ rop_func(s, s->vga.vram_ptr + s->cirrus_blt_dstaddr,
|
||||
s->cirrus_blt_dstpitch,
|
||||
s->cirrus_blt_width, s->cirrus_blt_height);
|
||||
cirrus_invalidate_region(s, s->cirrus_blt_dstaddr,
|
||||
@@ -732,9 +732,8 @@ static int cirrus_bitblt_solidfill(CirrusVGAState *s, int blt_rop)
|
||||
|
||||
static int cirrus_bitblt_videotovideo_patterncopy(CirrusVGAState * s)
|
||||
{
|
||||
- return cirrus_bitblt_common_patterncopy(s,
|
||||
- s->vga.vram_ptr + ((s->cirrus_blt_srcaddr & ~7) &
|
||||
- s->cirrus_addr_mask));
|
||||
+ return cirrus_bitblt_common_patterncopy(s, s->vga.vram_ptr +
|
||||
+ (s->cirrus_blt_srcaddr & ~7));
|
||||
}
|
||||
|
||||
static int cirrus_do_copy(CirrusVGAState *s, int dst, int src, int w, int h)
|
||||
@@ -788,10 +787,8 @@ static int cirrus_do_copy(CirrusVGAState *s, int dst, int src, int w, int h)
|
||||
if (notify)
|
||||
graphic_hw_update(s->vga.con);
|
||||
|
||||
- (*s->cirrus_rop) (s, s->vga.vram_ptr +
|
||||
- (s->cirrus_blt_dstaddr & s->cirrus_addr_mask),
|
||||
- s->vga.vram_ptr +
|
||||
- (s->cirrus_blt_srcaddr & s->cirrus_addr_mask),
|
||||
+ (*s->cirrus_rop) (s, s->vga.vram_ptr + s->cirrus_blt_dstaddr,
|
||||
+ s->vga.vram_ptr + s->cirrus_blt_srcaddr,
|
||||
s->cirrus_blt_dstpitch, s->cirrus_blt_srcpitch,
|
||||
s->cirrus_blt_width, s->cirrus_blt_height);
|
||||
|
||||
@@ -842,8 +839,7 @@ static void cirrus_bitblt_cputovideo_next(CirrusVGAState * s)
|
||||
} else {
|
||||
/* at least one scan line */
|
||||
do {
|
||||
- (*s->cirrus_rop)(s, s->vga.vram_ptr +
|
||||
- (s->cirrus_blt_dstaddr & s->cirrus_addr_mask),
|
||||
+ (*s->cirrus_rop)(s, s->vga.vram_ptr + s->cirrus_blt_dstaddr,
|
||||
s->cirrus_bltbuf, 0, 0, s->cirrus_blt_width, 1);
|
||||
cirrus_invalidate_region(s, s->cirrus_blt_dstaddr, 0,
|
||||
s->cirrus_blt_width, 1);
|
||||
@@ -962,6 +958,9 @@ static void cirrus_bitblt_start(CirrusVGAState * s)
|
||||
s->cirrus_blt_modeext = s->vga.gr[0x33];
|
||||
blt_rop = s->vga.gr[0x32];
|
||||
|
||||
+ s->cirrus_blt_dstaddr &= s->cirrus_addr_mask;
|
||||
+ s->cirrus_blt_srcaddr &= s->cirrus_addr_mask;
|
||||
+
|
||||
#ifdef DEBUG_BITBLT
|
||||
printf("rop=0x%02x mode=0x%02x modeext=0x%02x w=%d h=%d dpitch=%d spitch=%d daddr=0x%08x saddr=0x%08x writemask=0x%02x\n",
|
||||
blt_rop,
|
45
0063-cirrus-fix-oob-access-issue-CVE-2017-2615.patch
Normal file
45
0063-cirrus-fix-oob-access-issue-CVE-2017-2615.patch
Normal file
@ -0,0 +1,45 @@
|
||||
From: Li Qiang <liqiang6-s@360.cn>
|
||||
Date: Wed, 1 Feb 2017 09:35:01 +0100
|
||||
Subject: [PATCH] cirrus: fix oob access issue (CVE-2017-2615)
|
||||
|
||||
When doing bitblt copy in backward mode, we should minus the
|
||||
blt width first just like the adding in the forward mode. This
|
||||
can avoid the oob access of the front of vga's vram.
|
||||
|
||||
Signed-off-by: Li Qiang <liqiang6-s@360.cn>
|
||||
|
||||
{ kraxel: with backward blits (negative pitch) addr is the topmost
|
||||
address, so check it as-is against vram size ]
|
||||
|
||||
Cc: qemu-stable@nongnu.org
|
||||
Cc: P J P <ppandit@redhat.com>
|
||||
Cc: Laszlo Ersek <lersek@redhat.com>
|
||||
Cc: Paolo Bonzini <pbonzini@redhat.com>
|
||||
Cc: Wolfgang Bumiller <w.bumiller@proxmox.com>
|
||||
Fixes: d3532a0db02296e687711b8cdc7791924efccea0 (CVE-2014-8106)
|
||||
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||
Message-id: 1485938101-26602-1-git-send-email-kraxel@redhat.com
|
||||
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
|
||||
(cherry picked from commit 62d4c6bd5263bb8413a06c80144fc678df6dfb64)
|
||||
---
|
||||
hw/display/cirrus_vga.c | 7 +++----
|
||||
1 file changed, 3 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
|
||||
index 7db6409..16f27e8 100644
|
||||
--- a/hw/display/cirrus_vga.c
|
||||
+++ b/hw/display/cirrus_vga.c
|
||||
@@ -274,10 +274,9 @@ static bool blit_region_is_unsafe(struct CirrusVGAState *s,
|
||||
{
|
||||
if (pitch < 0) {
|
||||
int64_t min = addr
|
||||
- + ((int64_t)s->cirrus_blt_height-1) * pitch;
|
||||
- int32_t max = addr
|
||||
- + s->cirrus_blt_width;
|
||||
- if (min < 0 || max > s->vga.vram_size) {
|
||||
+ + ((int64_t)s->cirrus_blt_height - 1) * pitch
|
||||
+ - s->cirrus_blt_width;
|
||||
+ if (min < -1 || addr >= s->vga.vram_size) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
101
0064-cirrus-fix-patterncopy-checks.patch
Normal file
101
0064-cirrus-fix-patterncopy-checks.patch
Normal file
@ -0,0 +1,101 @@
|
||||
From: Gerd Hoffmann <kraxel@redhat.com>
|
||||
Date: Thu, 9 Feb 2017 14:02:20 +0100
|
||||
Subject: [PATCH] cirrus: fix patterncopy checks
|
||||
|
||||
The blit_region_is_unsafe checks don't work correctly for the
|
||||
patterncopy source. It's a fixed-sized region, which doesn't
|
||||
depend on cirrus_blt_{width,height}. So go do the check in
|
||||
cirrus_bitblt_common_patterncopy instead, then tell blit_is_unsafe that
|
||||
it doesn't need to verify the source. Also handle the case where we
|
||||
blit from cirrus_bitbuf correctly.
|
||||
|
||||
This patch replaces 5858dd1801883309bdd208d72ddb81c4e9fee30c.
|
||||
|
||||
Security impact: I think for the most part error on the safe side this
|
||||
time, refusing blits which should have been allowed.
|
||||
|
||||
Only exception is placing the blit source at the end of the video ram,
|
||||
so cirrus_blt_srcaddr + 256 goes beyond the end of video memory. But
|
||||
even in that case I'm not fully sure this actually allows read access to
|
||||
host memory. To trick the commit 5858dd18 security checks one has to
|
||||
pick very small cirrus_blt_{width,height} values, which in turn implies
|
||||
only a fraction of the blit source will actually be used.
|
||||
|
||||
Cc: Wolfgang Bumiller <w.bumiller@proxmox.com>
|
||||
Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
||||
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
||||
Reviewed-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
|
||||
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
|
||||
Message-id: 1486645341-5010-1-git-send-email-kraxel@redhat.com
|
||||
(cherry picked from commit 95280c31cda79bb1d0968afc7b19a220b3a9d986)
|
||||
---
|
||||
hw/display/cirrus_vga.c | 36 ++++++++++++++++++++++++++++++------
|
||||
1 file changed, 30 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
|
||||
index 16f27e8..6bd13fc 100644
|
||||
--- a/hw/display/cirrus_vga.c
|
||||
+++ b/hw/display/cirrus_vga.c
|
||||
@@ -683,14 +683,39 @@ static void cirrus_invalidate_region(CirrusVGAState * s, int off_begin,
|
||||
}
|
||||
}
|
||||
|
||||
-static int cirrus_bitblt_common_patterncopy(CirrusVGAState * s,
|
||||
- const uint8_t * src)
|
||||
+static int cirrus_bitblt_common_patterncopy(CirrusVGAState *s, bool videosrc)
|
||||
{
|
||||
+ uint32_t patternsize;
|
||||
uint8_t *dst;
|
||||
+ uint8_t *src;
|
||||
|
||||
dst = s->vga.vram_ptr + s->cirrus_blt_dstaddr;
|
||||
|
||||
- if (blit_is_unsafe(s, false, true)) {
|
||||
+ if (videosrc) {
|
||||
+ switch (s->vga.get_bpp(&s->vga)) {
|
||||
+ case 8:
|
||||
+ patternsize = 64;
|
||||
+ break;
|
||||
+ case 15:
|
||||
+ case 16:
|
||||
+ patternsize = 128;
|
||||
+ break;
|
||||
+ case 24:
|
||||
+ case 32:
|
||||
+ default:
|
||||
+ patternsize = 256;
|
||||
+ break;
|
||||
+ }
|
||||
+ s->cirrus_blt_srcaddr &= ~(patternsize - 1);
|
||||
+ if (s->cirrus_blt_srcaddr + patternsize > s->vga.vram_size) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ src = s->vga.vram_ptr + s->cirrus_blt_srcaddr;
|
||||
+ } else {
|
||||
+ src = s->cirrus_bltbuf;
|
||||
+ }
|
||||
+
|
||||
+ if (blit_is_unsafe(s, true, true)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -731,8 +756,7 @@ static int cirrus_bitblt_solidfill(CirrusVGAState *s, int blt_rop)
|
||||
|
||||
static int cirrus_bitblt_videotovideo_patterncopy(CirrusVGAState * s)
|
||||
{
|
||||
- return cirrus_bitblt_common_patterncopy(s, s->vga.vram_ptr +
|
||||
- (s->cirrus_blt_srcaddr & ~7));
|
||||
+ return cirrus_bitblt_common_patterncopy(s, true);
|
||||
}
|
||||
|
||||
static int cirrus_do_copy(CirrusVGAState *s, int dst, int src, int w, int h)
|
||||
@@ -831,7 +855,7 @@ static void cirrus_bitblt_cputovideo_next(CirrusVGAState * s)
|
||||
|
||||
if (s->cirrus_srccounter > 0) {
|
||||
if (s->cirrus_blt_mode & CIRRUS_BLTMODE_PATTERNCOPY) {
|
||||
- cirrus_bitblt_common_patterncopy(s, s->cirrus_bltbuf);
|
||||
+ cirrus_bitblt_common_patterncopy(s, false);
|
||||
the_end:
|
||||
s->cirrus_srccounter = 0;
|
||||
cirrus_bitblt_reset(s);
|
100
0065-Revert-cirrus-allow-zero-source-pitch-in-pattern-fil.patch
Normal file
100
0065-Revert-cirrus-allow-zero-source-pitch-in-pattern-fil.patch
Normal file
@ -0,0 +1,100 @@
|
||||
From: Gerd Hoffmann <kraxel@redhat.com>
|
||||
Date: Thu, 9 Feb 2017 14:02:21 +0100
|
||||
Subject: [PATCH] Revert "cirrus: allow zero source pitch in pattern fill rops"
|
||||
|
||||
This reverts commit 5858dd1801883309bdd208d72ddb81c4e9fee30c.
|
||||
|
||||
Conflicts:
|
||||
hw/display/cirrus_vga.c
|
||||
|
||||
Cc: Wolfgang Bumiller <w.bumiller@proxmox.com>
|
||||
Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
||||
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
||||
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
|
||||
Message-id: 1486645341-5010-2-git-send-email-kraxel@redhat.com
|
||||
(cherry picked from commit 12e97ec39931e5321645fd483ab761319d48bf16)
|
||||
---
|
||||
hw/display/cirrus_vga.c | 26 ++++++++------------------
|
||||
1 file changed, 8 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
|
||||
index 6bd13fc..0e47cf8 100644
|
||||
--- a/hw/display/cirrus_vga.c
|
||||
+++ b/hw/display/cirrus_vga.c
|
||||
@@ -272,6 +272,9 @@ static void cirrus_update_memory_access(CirrusVGAState *s);
|
||||
static bool blit_region_is_unsafe(struct CirrusVGAState *s,
|
||||
int32_t pitch, int32_t addr)
|
||||
{
|
||||
+ if (!pitch) {
|
||||
+ return true;
|
||||
+ }
|
||||
if (pitch < 0) {
|
||||
int64_t min = addr
|
||||
+ ((int64_t)s->cirrus_blt_height - 1) * pitch
|
||||
@@ -290,11 +293,8 @@ static bool blit_region_is_unsafe(struct CirrusVGAState *s,
|
||||
return false;
|
||||
}
|
||||
|
||||
-static bool blit_is_unsafe(struct CirrusVGAState *s, bool dst_only,
|
||||
- bool zero_src_pitch_ok)
|
||||
+static bool blit_is_unsafe(struct CirrusVGAState *s, bool dst_only)
|
||||
{
|
||||
- int32_t check_pitch;
|
||||
-
|
||||
/* should be the case, see cirrus_bitblt_start */
|
||||
assert(s->cirrus_blt_width > 0);
|
||||
assert(s->cirrus_blt_height > 0);
|
||||
@@ -303,10 +303,6 @@ static bool blit_is_unsafe(struct CirrusVGAState *s, bool dst_only,
|
||||
return true;
|
||||
}
|
||||
|
||||
- if (!s->cirrus_blt_dstpitch) {
|
||||
- return true;
|
||||
- }
|
||||
-
|
||||
if (blit_region_is_unsafe(s, s->cirrus_blt_dstpitch,
|
||||
s->cirrus_blt_dstaddr)) {
|
||||
return true;
|
||||
@@ -314,13 +310,7 @@ static bool blit_is_unsafe(struct CirrusVGAState *s, bool dst_only,
|
||||
if (dst_only) {
|
||||
return false;
|
||||
}
|
||||
-
|
||||
- check_pitch = s->cirrus_blt_srcpitch;
|
||||
- if (!zero_src_pitch_ok && !check_pitch) {
|
||||
- check_pitch = s->cirrus_blt_width;
|
||||
- }
|
||||
-
|
||||
- if (blit_region_is_unsafe(s, check_pitch,
|
||||
+ if (blit_region_is_unsafe(s, s->cirrus_blt_srcpitch,
|
||||
s->cirrus_blt_srcaddr)) {
|
||||
return true;
|
||||
}
|
||||
@@ -715,7 +705,7 @@ static int cirrus_bitblt_common_patterncopy(CirrusVGAState *s, bool videosrc)
|
||||
src = s->cirrus_bltbuf;
|
||||
}
|
||||
|
||||
- if (blit_is_unsafe(s, true, true)) {
|
||||
+ if (blit_is_unsafe(s, true)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -734,7 +724,7 @@ static int cirrus_bitblt_solidfill(CirrusVGAState *s, int blt_rop)
|
||||
{
|
||||
cirrus_fill_t rop_func;
|
||||
|
||||
- if (blit_is_unsafe(s, true, true)) {
|
||||
+ if (blit_is_unsafe(s, true)) {
|
||||
return 0;
|
||||
}
|
||||
rop_func = cirrus_fill[rop_to_index[blt_rop]][s->cirrus_blt_pixelwidth - 1];
|
||||
@@ -834,7 +824,7 @@ static int cirrus_do_copy(CirrusVGAState *s, int dst, int src, int w, int h)
|
||||
|
||||
static int cirrus_bitblt_videotovideo_copy(CirrusVGAState * s)
|
||||
{
|
||||
- if (blit_is_unsafe(s, false, false))
|
||||
+ if (blit_is_unsafe(s, false))
|
||||
return 0;
|
||||
|
||||
return cirrus_do_copy(s, s->cirrus_blt_dstaddr - s->vga.start_addr,
|
@ -0,0 +1,46 @@
|
||||
From: Gerd Hoffmann <kraxel@redhat.com>
|
||||
Date: Wed, 8 Feb 2017 11:18:36 +0100
|
||||
Subject: [PATCH] cirrus: add blit_is_unsafe call to cirrus_bitblt_cputovideo
|
||||
(CVE-2017-2620)
|
||||
|
||||
CIRRUS_BLTMODE_MEMSYSSRC blits do NOT check blit destination
|
||||
and blit width, at all. Oops. Fix it.
|
||||
|
||||
Security impact: high.
|
||||
|
||||
The missing blit destination check allows to write to host memory.
|
||||
Basically same as CVE-2014-8106 for the other blit variants.
|
||||
|
||||
Cc: qemu-stable@nongnu.org
|
||||
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||
(cherry picked from commit 92f2b88cea48c6aeba8de568a45f2ed958f3c298)
|
||||
---
|
||||
hw/display/cirrus_vga.c | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
|
||||
index 0e47cf8..a093dc8 100644
|
||||
--- a/hw/display/cirrus_vga.c
|
||||
+++ b/hw/display/cirrus_vga.c
|
||||
@@ -899,6 +899,10 @@ static int cirrus_bitblt_cputovideo(CirrusVGAState * s)
|
||||
{
|
||||
int w;
|
||||
|
||||
+ if (blit_is_unsafe(s, true)) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
s->cirrus_blt_mode &= ~CIRRUS_BLTMODE_MEMSYSSRC;
|
||||
s->cirrus_srcptr = &s->cirrus_bltbuf[0];
|
||||
s->cirrus_srcptr_end = &s->cirrus_bltbuf[0];
|
||||
@@ -924,6 +928,10 @@ static int cirrus_bitblt_cputovideo(CirrusVGAState * s)
|
||||
}
|
||||
s->cirrus_srccounter = s->cirrus_blt_srcpitch * s->cirrus_blt_height;
|
||||
}
|
||||
+
|
||||
+ /* the blit_is_unsafe call above should catch this */
|
||||
+ assert(s->cirrus_blt_srcpitch <= CIRRUS_BLTBUFSIZE);
|
||||
+
|
||||
s->cirrus_srcptr = s->cirrus_bltbuf;
|
||||
s->cirrus_srcptr_end = s->cirrus_bltbuf + s->cirrus_blt_srcpitch;
|
||||
cirrus_update_memory_access(s);
|
33
0067-egl-helpers-Support-newer-MESA-versions.patch
Normal file
33
0067-egl-helpers-Support-newer-MESA-versions.patch
Normal file
@ -0,0 +1,33 @@
|
||||
From: Frediano Ziglio <fziglio@redhat.com>
|
||||
Date: Mon, 20 Feb 2017 09:50:55 +0000
|
||||
Subject: [PATCH] egl-helpers: Support newer MESA versions
|
||||
|
||||
According to
|
||||
https://www.khronos.org/registry/EGL/extensions/MESA/EGL_MESA_platform_gbm.txt
|
||||
if MESA_platform_gbm is supported display should be initialized
|
||||
from a GBM handle using eglGetPlatformDisplayEXT.
|
||||
|
||||
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
|
||||
Message-id: 20170220095055.4234-1-fziglio@redhat.com
|
||||
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||
(cherry picked from commit 0ea1523fb6703aa0dcd65e66b59e96fec028e60a)
|
||||
---
|
||||
ui/egl-helpers.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/ui/egl-helpers.c b/ui/egl-helpers.c
|
||||
index 79cee05..d8d57c4 100644
|
||||
--- a/ui/egl-helpers.c
|
||||
+++ b/ui/egl-helpers.c
|
||||
@@ -203,7 +203,11 @@ int qemu_egl_init_dpy(EGLNativeDisplayType dpy, bool gles, bool debug)
|
||||
}
|
||||
|
||||
egl_dbg("eglGetDisplay (dpy %p) ...\n", dpy);
|
||||
+#ifdef EGL_MESA_platform_gbm
|
||||
+ qemu_egl_display = eglGetPlatformDisplayEXT(EGL_PLATFORM_GBM_MESA, dpy, NULL);
|
||||
+#else
|
||||
qemu_egl_display = eglGetDisplay(dpy);
|
||||
+#endif
|
||||
if (qemu_egl_display == EGL_NO_DISPLAY) {
|
||||
error_report("egl: eglGetDisplay failed");
|
||||
return -1;
|
73
qemu.spec
73
qemu.spec
@ -68,7 +68,7 @@
|
||||
Summary: QEMU is a FAST! processor emulator
|
||||
Name: qemu
|
||||
Version: 2.7.1
|
||||
Release: 3%{?rcrel}%{?dist}
|
||||
Release: 4%{?rcrel}%{?dist}
|
||||
Epoch: 2
|
||||
License: GPLv2+ and LGPLv2+ and BSD
|
||||
Group: Development/Tools
|
||||
@ -196,6 +196,53 @@ Patch0041: 0041-virtio-gpu-fix-information-leak-in-capset-get-dispat.patch
|
||||
# CVE-2016-9912: virtio-gpu: memory leakage when destroying gpu resource (bz
|
||||
# #1402285)
|
||||
Patch0042: 0042-virtio-gpu-call-cleanup-mapping-function-in-resource.patch
|
||||
# CVE-2016-7907: net: imx: infinite loop (bz #1381182)
|
||||
Patch0043: 0043-net-imx-limit-buffer-descriptor-count.patch
|
||||
# CVE-2017-5525: audio: memory leakage in ac97 (bz #1414110)
|
||||
Patch0044: 0044-audio-ac97-add-exit-function.patch
|
||||
# CVE-2017-5526: audio: memory leakage in es1370 (bz #1414210)
|
||||
Patch0045: 0045-audio-es1370-add-exit-function.patch
|
||||
# CVE-2016-10155 watchdog: memory leakage in i6300esb (bz #1415200)
|
||||
Patch0046: 0046-watchdog-6300esb-add-exit-function.patch
|
||||
# CVE-2017-5552: virtio-gpu-3d: memory leakage (bz #1415283)
|
||||
Patch0047: 0047-virtio-gpu-3d-fix-memory-leak-in-resource-attach-bac.patch
|
||||
# CVE-2017-5578: virtio-gpu: memory leakage (bz #1415797)
|
||||
Patch0048: 0048-virtio-gpu-fix-memory-leak-in-resource-attach-backin.patch
|
||||
# CVE-2017-5667: sd: sdhci OOB access during multi block transfer (bz
|
||||
# #1417560)
|
||||
Patch0049: 0049-sd-sdhci-check-data-length-during-dma_memory_read.patch
|
||||
# CVE-2017-5856: scsi: megasas: memory leakage (bz #1418344)
|
||||
Patch0050: 0050-megasas-fix-guest-triggered-memory-leak.patch
|
||||
# CVE-2017-5857: virtio-gpu-3d: host memory leakage in
|
||||
# virgl_cmd_resource_unref (bz #1418383)
|
||||
Patch0051: 0051-virtio-gpu-fix-resource-leak-in-virgl_cmd_resource_u.patch
|
||||
# CVE-2017-5898: usb: integer overflow in emulated_apdu_from_guest (bz
|
||||
# #1419700)
|
||||
Patch0052: 0052-usb-ccid-check-ccid-apdu-length.patch
|
||||
# CVE-2017-5987: sd: infinite loop issue in multi block transfers (bz
|
||||
# #1422001)
|
||||
Patch0053: 0053-sd-sdhci-check-transfer-mode-register-in-multi-block.patch
|
||||
# CVE-2017-6058: vmxnet3: OOB access when doing vlan stripping (bz #1423359)
|
||||
Patch0054: 0054-eth-Extend-vlan-stripping-functions.patch
|
||||
Patch0055: 0055-NetRxPkt-Fix-memory-corruption-on-VLAN-header-stripp.patch
|
||||
Patch0056: 0056-NetRxPkt-Do-not-try-to-pull-more-data-than-present.patch
|
||||
Patch0057: 0057-NetRxPkt-Account-buffer-with-ETH-header-in-IOV-lengt.patch
|
||||
# CVE-2017-6505: usb: an infinite loop issue in ohci_service_ed_list (bz
|
||||
# #1429434)
|
||||
Patch0058: 0058-usb-ohci-limit-the-number-of-link-eds.patch
|
||||
# CVE-2017-2615: cirrus: oob access while doing bitblt copy backward (bz
|
||||
# #1418206)
|
||||
Patch0059: 0059-display-cirrus-ignore-source-pitch-value-as-needed-i.patch
|
||||
Patch0060: 0060-cirrus-handle-negative-pitch-in-cirrus_invalidate_re.patch
|
||||
Patch0061: 0061-cirrus-allow-zero-source-pitch-in-pattern-fill-rops.patch
|
||||
Patch0062: 0062-cirrus-fix-blit-address-mask-handling.patch
|
||||
Patch0063: 0063-cirrus-fix-oob-access-issue-CVE-2017-2615.patch
|
||||
# CVE-2017-2620: cirrus: potential arbitrary code execution (bz #1425419)
|
||||
Patch0064: 0064-cirrus-fix-patterncopy-checks.patch
|
||||
Patch0065: 0065-Revert-cirrus-allow-zero-source-pitch-in-pattern-fil.patch
|
||||
Patch0066: 0066-cirrus-add-blit_is_unsafe-call-to-cirrus_bitblt_cput.patch
|
||||
# Fix spice GL with new mesa/libglvnd (bz #1431905)
|
||||
Patch0067: 0067-egl-helpers-Support-newer-MESA-versions.patch
|
||||
|
||||
# documentation deps
|
||||
BuildRequires: texinfo
|
||||
@ -1666,6 +1713,30 @@ getent passwd qemu >/dev/null || \
|
||||
|
||||
|
||||
%changelog
|
||||
* Wed Mar 15 2017 Cole Robinson <crobinso@redhat.com> - 2:2.7.1-4
|
||||
- CVE-2016-7907: net: imx: infinite loop (bz #1381182)
|
||||
- CVE-2017-5525: audio: memory leakage in ac97 (bz #1414110)
|
||||
- CVE-2017-5526: audio: memory leakage in es1370 (bz #1414210)
|
||||
- CVE-2016-10155 watchdog: memory leakage in i6300esb (bz #1415200)
|
||||
- CVE-2017-5552: virtio-gpu-3d: memory leakage (bz #1415283)
|
||||
- CVE-2017-5578: virtio-gpu: memory leakage (bz #1415797)
|
||||
- CVE-2017-5667: sd: sdhci OOB access during multi block transfer (bz
|
||||
#1417560)
|
||||
- CVE-2017-5856: scsi: megasas: memory leakage (bz #1418344)
|
||||
- CVE-2017-5857: virtio-gpu-3d: host memory leakage in
|
||||
virgl_cmd_resource_unref (bz #1418383)
|
||||
- CVE-2017-5898: usb: integer overflow in emulated_apdu_from_guest (bz
|
||||
#1419700)
|
||||
- CVE-2017-5987: sd: infinite loop issue in multi block transfers (bz
|
||||
#1422001)
|
||||
- CVE-2017-6058: vmxnet3: OOB access when doing vlan stripping (bz #1423359)
|
||||
- CVE-2017-6505: usb: an infinite loop issue in ohci_service_ed_list (bz
|
||||
#1429434)
|
||||
- CVE-2017-2615: cirrus: oob access while doing bitblt copy backward (bz
|
||||
#1418206)
|
||||
- CVE-2017-2620: cirrus: potential arbitrary code execution (bz #1425419)
|
||||
- Fix spice GL with new mesa/libglvnd (bz #1431905)
|
||||
|
||||
* Tue Feb 21 2017 Daniel Berrange <berrange@redhat.com> - 2:2.7.1-3
|
||||
- Drop texi2html BR, since QEMU switched to using makeinfo back in 2010
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user