[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH v5 20/24] zaurus: fix buffer overrun on invalid sta
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-stable] [PATCH v5 20/24] zaurus: fix buffer overrun on invalid state load |
Date: |
Thu, 3 Apr 2014 19:52:13 +0300 |
CVE-2013-4540
Within scoop_gpio_handler_update, if prev_level has a high bit set, then
we get bit > 16 and that causes a buffer overrun.
Since prev_level comes from wire indirectly, this can
happen on invalid state load.
Similarly for gpio_level and gpio_dir.
To fix, limit to 16 bit.
Reported-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
Reviewed-by: Dr. David Alan Gilbert <address@hidden>
---
hw/gpio/zaurus.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/hw/gpio/zaurus.c b/hw/gpio/zaurus.c
index dc79a8b..8e2ce04 100644
--- a/hw/gpio/zaurus.c
+++ b/hw/gpio/zaurus.c
@@ -203,6 +203,15 @@ static bool is_version_0 (void *opaque, int version_id)
return version_id == 0;
}
+static bool vmstate_scoop_validate(void *opaque, int version_id)
+{
+ ScoopInfo *s = opaque;
+
+ return !(s->prev_level & 0xffff0000) &&
+ !(s->gpio_level & 0xffff0000) &&
+ !(s->gpio_dir & 0xffff0000);
+}
+
static const VMStateDescription vmstate_scoop_regs = {
.name = "scoop",
.version_id = 1,
@@ -215,6 +224,7 @@ static const VMStateDescription vmstate_scoop_regs = {
VMSTATE_UINT32(gpio_level, ScoopInfo),
VMSTATE_UINT32(gpio_dir, ScoopInfo),
VMSTATE_UINT32(prev_level, ScoopInfo),
+ VMSTATE_VALIDATE("irq levels are 16 bit", vmstate_scoop_validate),
VMSTATE_UINT16(mcr, ScoopInfo),
VMSTATE_UINT16(cdr, ScoopInfo),
VMSTATE_UINT16(ccr, ScoopInfo),
--
MST
- Re: [Qemu-stable] [PATCH v5 14/24] openpic: avoid buffer overrun on incoming migration, (continued)
- [Qemu-stable] [PATCH v5 16/24] pxa2xx: avoid buffer overrun on incoming migration, Michael S. Tsirkin, 2014/04/03
- [Qemu-stable] [PATCH v5 15/24] virtio: validate num_sg when mapping, Michael S. Tsirkin, 2014/04/03
- [Qemu-stable] [PATCH v5 17/24] ssi-sd: fix buffer overrun on invalid state load, Michael S. Tsirkin, 2014/04/03
- [Qemu-stable] [PATCH v5 18/24] ssd0323: fix buffer overun on invalid state load, Michael S. Tsirkin, 2014/04/03
- [Qemu-stable] [PATCH v5 19/24] tsc210x: fix buffer overrun on invalid state load, Michael S. Tsirkin, 2014/04/03
- [Qemu-stable] [PATCH v5 21/24] virtio-scsi: fix buffer overrun on invalid state load, Michael S. Tsirkin, 2014/04/03
- [Qemu-stable] [PATCH v5 20/24] zaurus: fix buffer overrun on invalid state load,
Michael S. Tsirkin <=
- [Qemu-stable] [PATCH v5 22/24] vmstate: s/VMSTATE_INT32_LE/VMSTATE_INT32_POSITIVE_LE/, Michael S. Tsirkin, 2014/04/03
- [Qemu-stable] [PATCH v5 06/24] virtio-net: out-of-bounds buffer write on invalid state load, Michael S. Tsirkin, 2014/04/03
- [Qemu-stable] [PATCH v5 23/24] usb: sanity check setup_index+setup_len in post_load, Michael S. Tsirkin, 2014/04/03
- [Qemu-stable] [PATCH v5 24/24] savevm: Ignore minimum_version_id_old if there is no load_state_old, Michael S. Tsirkin, 2014/04/03
- [Qemu-stable] [PATCH v5 07/24] virtio: out-of-bounds buffer write on invalid state load, Michael S. Tsirkin, 2014/04/03
- [Qemu-stable] [PATCH v5 05/24] virtio-net: out-of-bounds buffer write on load, Michael S. Tsirkin, 2014/04/03