[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 16/17] hw/pci-host: pnv_phb{3, 4}: Fix heap out-of-bound access fa
From: |
Daniel Henrique Barboza |
Subject: |
[PULL 16/17] hw/pci-host: pnv_phb{3, 4}: Fix heap out-of-bound access failure |
Date: |
Tue, 20 Sep 2022 16:42:01 -0300 |
From: Xuzhou Cheng <xuzhou.cheng@windriver.com>
pnv_phb3_root_bus_info and pnv_phb4_root_bus_info are missing the
instance_size initialization. This results in accessing out-of-bound
memory when setting 'chip-id' and 'phb-id', and eventually crashes
glib's malloc functionality with the following message:
"qemu-system-ppc64: GLib: ../glib-2.72.3/glib/gmem.c:131: failed to allocate
3232 bytes"
This issue was noticed only when running qtests with QEMU Windows
32-bit executable. Windows 64-bit, Linux 32/64-bit do not expose
this bug though.
Fixes: 9ae1329ee2fe ("ppc/pnv: Add models for POWER8 PHB3 PCIe Host bridge")
Fixes: 4f9924c4d4cf ("ppc/pnv: Add models for POWER9 PHB4 PCIe Host bridge")
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Xuzhou Cheng <xuzhou.cheng@windriver.com>
Signed-off-by: Bin Meng <bin.meng@windriver.com>
Message-Id: <20220920103159.1865256-29-bmeng.cn@gmail.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
---
hw/pci-host/pnv_phb3.c | 1 +
hw/pci-host/pnv_phb4.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/hw/pci-host/pnv_phb3.c b/hw/pci-host/pnv_phb3.c
index af8575c007..9054c393a2 100644
--- a/hw/pci-host/pnv_phb3.c
+++ b/hw/pci-host/pnv_phb3.c
@@ -1169,6 +1169,7 @@ static void pnv_phb3_root_bus_class_init(ObjectClass
*klass, void *data)
static const TypeInfo pnv_phb3_root_bus_info = {
.name = TYPE_PNV_PHB3_ROOT_BUS,
.parent = TYPE_PCIE_BUS,
+ .instance_size = sizeof(PnvPHB3RootBus),
.class_init = pnv_phb3_root_bus_class_init,
};
diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
index 824e1a73fb..ccbde841fc 100644
--- a/hw/pci-host/pnv_phb4.c
+++ b/hw/pci-host/pnv_phb4.c
@@ -1773,6 +1773,7 @@ static void pnv_phb4_root_bus_class_init(ObjectClass
*klass, void *data)
static const TypeInfo pnv_phb4_root_bus_info = {
.name = TYPE_PNV_PHB4_ROOT_BUS,
.parent = TYPE_PCIE_BUS,
+ .instance_size = sizeof(PnvPHB4RootBus),
.class_init = pnv_phb4_root_bus_class_init,
};
--
2.37.3
- [PULL 00/17] ppc queue, Daniel Henrique Barboza, 2022/09/20
- [PULL 01/17] target/ppc: Add HASHKEYR and HASHPKEYR SPRs, Daniel Henrique Barboza, 2022/09/20
- [PULL 04/17] target/ppc: Move fsqrt to decodetree, Daniel Henrique Barboza, 2022/09/20
- [PULL 02/17] target/ppc: Implement hashst and hashchk, Daniel Henrique Barboza, 2022/09/20
- [PULL 11/17] target/ppc: Zero second doubleword for VSX madd instructions, Daniel Henrique Barboza, 2022/09/20
- [PULL 03/17] target/ppc: Implement hashstp and hashchkp, Daniel Henrique Barboza, 2022/09/20
- [PULL 16/17] hw/pci-host: pnv_phb{3, 4}: Fix heap out-of-bound access failure,
Daniel Henrique Barboza <=
- [PULL 09/17] target/ppc: Zero second doubleword in DFP instructions, Daniel Henrique Barboza, 2022/09/20
- [PULL 05/17] target/ppc: Move fsqrts to decodetree, Daniel Henrique Barboza, 2022/09/20
- [PULL 08/17] target/ppc: Remove unused xer_* macros, Daniel Henrique Barboza, 2022/09/20
- [PULL 07/17] target/ppc: Remove extra space from s128 field in ppc_vsr_t, Daniel Henrique Barboza, 2022/09/20
- [PULL 14/17] target/ppc: Clear fpstatus flags on helpers missing it, Daniel Henrique Barboza, 2022/09/20
- [PULL 15/17] hw/ppc: spapr: Use qemu_vfree() to free spapr->htab, Daniel Henrique Barboza, 2022/09/20
- [PULL 12/17] target/ppc: Set OV32 when OV is set, Daniel Henrique Barboza, 2022/09/20
- [PULL 10/17] target/ppc: Set result to QNaN for DENBCD when VXCVI occurs, Daniel Henrique Barboza, 2022/09/20
- [PULL 06/17] target/ppc: Merge fsqrt and fsqrts helpers, Daniel Henrique Barboza, 2022/09/20
- [PULL 17/17] hw/ppc/spapr: Fix code style problems reported by checkpatch, Daniel Henrique Barboza, 2022/09/20