[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH qom-cpu v4 02/18] pc: Fix crash when attempting to h
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PATCH qom-cpu v4 02/18] pc: Fix crash when attempting to hotplug CPU with negative ID |
Date: |
Sun, 9 Jun 2013 18:10:31 +0200 |
From: Igor Mammedov <address@hidden>
QMP command "{ 'execute': 'cpu-add', 'arguments': { 'id': -1 }}" may cause
QEMU SIGSEGV at:
piix4_cpu_hotplug_req ()
...
g->sts[cpu_id / 8] |= (1 << (cpu_id % 8));
...
Since for PC in current implementation id should be in range [0...maxcpus)
and maxcpus is already checked, add check for lower bound and error out
on incorrect value.
Signed-off-by: Igor Mammedov <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>
---
hw/i386/pc.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 4844a6b..553becb 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -927,6 +927,11 @@ void pc_hot_add_cpu(const int64_t id, Error **errp)
DeviceState *icc_bridge;
int64_t apic_id = x86_cpu_apic_id_from_index(id);
+ if (id < 0) {
+ error_setg(errp, "Invalid CPU id: %" PRIi64, id);
+ return;
+ }
+
if (cpu_exists(apic_id)) {
error_setg(errp, "Unable to add CPU: %" PRIi64
", it already exists", id);
--
1.8.1.4
- [Qemu-devel] [PATCH qom-cpu v4 00/18] dump: Build cleanups, redone, Andreas Färber, 2013/06/09
- [Qemu-devel] [PATCH qom-cpu v4 02/18] pc: Fix crash when attempting to hotplug CPU with negative ID,
Andreas Färber <=
- [Qemu-devel] [PATCH qom-cpu v4 01/18] dump: Move stubs into libqemustub.a, Andreas Färber, 2013/06/09
- [Qemu-devel] [PATCH qom-cpu v4 03/18] pc: Create pc-*-1.6 machine-types, Andreas Färber, 2013/06/09
- [Qemu-devel] [PATCH qom-cpu v4 04/18] target-i386: Update model values on Conroe/Penryn/Nehalem CPU models, Andreas Färber, 2013/06/09
- [Qemu-devel] [PATCH qom-cpu v4 06/18] target-i386: cpu: Fix potential buffer overrun in get_register_name_32(), Andreas Färber, 2013/06/09
- [Qemu-devel] [PATCH qom-cpu v4 05/18] target-i386: Set level=4 on Conroe/Penryn/Nehalem, Andreas Färber, 2013/06/09
- [Qemu-devel] [PATCH qom-cpu v4 08/18] memory_mapping: Move MemoryMappingList typedef to qemu/typedefs.h, Andreas Färber, 2013/06/09
- [Qemu-devel] [PATCH qom-cpu v4 07/18] cpu: Turn cpu_paging_enabled() into a CPUState hook, Andreas Färber, 2013/06/09
- [Qemu-devel] [PATCH qom-cpu v4 10/18] memory_mapping: Drop qemu_get_memory_mapping() stub, Andreas Färber, 2013/06/09