[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 14/43] spapr: fix out of bounds write in spapr_populate
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 14/43] spapr: fix out of bounds write in spapr_populate_drmem_v2 |
Date: |
Tue, 19 Feb 2019 01:30:20 +1100 |
From: Fabiano Rosas <address@hidden>
buf_len is uint8_t which is not large enough to hold the result of:
nr_entries * sizeof(struct sPAPRDrconfCellV2) + sizeof(uint32_t);
for a nr_entries greater than 10.
This causes the allocated buffer 'int_buf' to be smaller than expected
and we eventually overwrite some of glibc's control structures (see
"chunk" in https://sourceware.org/glibc/wiki/MallocInternals)
The following error is seen while trying to free int_buf:
"free(): invalid next size (fast)"
Fixes: a324d6f166 "spapr: Support ibm,dynamic-memory-v2 property"
Signed-off-by: Fabiano Rosas <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Greg Kurz <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
hw/ppc/spapr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 850cfe28c4..abf9ebce59 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -687,14 +687,14 @@ static int spapr_populate_drmem_v2(sPAPRMachineState
*spapr, void *fdt,
int offset, MemoryDeviceInfoList *dimms)
{
MachineState *machine = MACHINE(spapr);
- uint8_t *int_buf, *cur_index, buf_len;
+ uint8_t *int_buf, *cur_index;
int ret;
uint64_t lmb_size = SPAPR_MEMORY_BLOCK_SIZE;
uint64_t addr, cur_addr, size;
uint32_t nr_boot_lmbs = (machine->device_memory->base / lmb_size);
uint64_t mem_end = machine->device_memory->base +
memory_region_size(&machine->device_memory->mr);
- uint32_t node, nr_entries = 0;
+ uint32_t node, buf_len, nr_entries = 0;
sPAPRDRConnector *drc;
DrconfCellQueue *elem, *next;
MemoryDeviceInfoList *info;
--
2.20.1
- [Qemu-ppc] [PULL 06/43] cuda: decrease time delay before raising VIA SR interrupt and remove fast path, (continued)
- [Qemu-ppc] [PULL 06/43] cuda: decrease time delay before raising VIA SR interrupt and remove fast path, David Gibson, 2019/02/18
- [Qemu-ppc] [PULL 10/43] ppc: fix crash during branch stepping, David Gibson, 2019/02/18
- [Qemu-ppc] [PULL 09/43] target/ppc: Remove some #if 0'ed code, David Gibson, 2019/02/18
- [Qemu-ppc] [PULL 11/43] xive: Only set source type for LSIs, David Gibson, 2019/02/18
- [Qemu-ppc] [PULL 13/43] target/ppc: Disable ISA 2.06 PM instructions on POWER9, David Gibson, 2019/02/18
- [Qemu-ppc] [PULL 16/43] spapr/irq: remove the XICS offset adjustment, David Gibson, 2019/02/18
- [Qemu-ppc] [PULL 17/43] xics: Explicitely call KVM ICP methods from the common code, David Gibson, 2019/02/18
- [Qemu-ppc] [PULL 19/43] xics: Handle KVM ICP realize from the common code, David Gibson, 2019/02/18
- [Qemu-ppc] [PULL 12/43] qdev: pass an Object * to qbus_set_hotplug_handler(), David Gibson, 2019/02/18
- [Qemu-ppc] [PULL 15/43] spapr/irq: add an 'nr_irq' parameter to initialize the backend., David Gibson, 2019/02/18
- [Qemu-ppc] [PULL 14/43] spapr: fix out of bounds write in spapr_populate_drmem_v2,
David Gibson <=
- [Qemu-ppc] [PULL 23/43] xics: Handle KVM ICS reset from the "simple" ICS code, David Gibson, 2019/02/18
- [Qemu-ppc] [PULL 18/43] xics: Handle KVM ICP reset from the common code, David Gibson, 2019/02/18
- [Qemu-ppc] [PULL 22/43] xics: Explicitely call KVM ICS methods from the common code, David Gibson, 2019/02/18
- [Qemu-ppc] [PULL 27/43] target/ppc: convert VMX logical instructions to use vector operations, David Gibson, 2019/02/18
- [Qemu-ppc] [PULL 21/43] xics: Drop the KVM ICP class, David Gibson, 2019/02/18
- [Qemu-ppc] [PULL 20/43] spapr/irq: Use the base ICP class for KVM, David Gibson, 2019/02/18
- [Qemu-ppc] [PULL 31/43] target/ppc: convert VSX logical operations to vector operations, David Gibson, 2019/02/18
- [Qemu-ppc] [PULL 25/43] spapr/irq: Use the "simple" ICS class for KVM, David Gibson, 2019/02/18
- [Qemu-ppc] [PULL 29/43] target/ppc: convert vspltis[bhw] to use vector operations, David Gibson, 2019/02/18
- [Qemu-ppc] [PULL 36/43] target/ppc: Use helper_mtvscr for reset and gdb, David Gibson, 2019/02/18