Skip to contentSkip to conversation

cpu: crash fix for -rc2 (don't allow negative core id)

GIT PULL Applied Eduardo Habkost 2 participants 3 messages Aug 3, 2017 – Aug 4, 2017

lore
Share & tools
lore
#0 lore raw

The following changes since commit aaaec6acad7cf97372d48c1b09126a09697519c8:

Update version for v2.10.0-rc1 release (2017-08-02 16:36:32 +0100)

are available in the git repository at:

git://github.com/ehabkost/qemu.git tags/machine-pull-request

for you to fetch changes up to be2960baae07e5257cde8c814cbd91647e235147:

cpu: don't allow negative core id (2017-08-02 18:30:13 -0300)

----------------------------------------------------------------
cpu: crash fix (don't allow negative core id)

----------------------------------------------------------------

Laurent Vivier (1):
cpu: don't allow negative core id

 hw/cpu/core.c | 5 +++++
 1 file changed, 5 insertions(+)
Signature · 1 line
2.9.4
#1 lore raw

[Qemu-devel] [PULL 1/1] cpu: don't allow negative core id

From: Laurent Vivier <[email protected]>

With pseries machine type a negative core-id is not managed properly:
-1 gives an inaccurate error message ("core -1 already populated"), -2 crashes QEMU (core dump)

As it seems a negative value is invalid for any architecture, instead of checking this in spapr_core_pre_plug() I think it's better to check this in the generic part, core_prop_set_core_id()

Message-Id: <[email protected]>

---
 hw/cpu/core.c | 5 +++++
 1 file changed, 5 insertions(+)
hw/cpu/core.c +5 -0
index 2bf960d..bd578ab 100644
@@ -33,6 +33,11 @@ static void core_prop_set_core_id(Object *obj, Visitor *v, const char *name,
         return;
     }
 
+    if (value < 0) {
+        error_setg(errp, "Invalid core id %"PRId64, value);
+        return;
+    }
+
     core->core_id = value;
 }
 
Signature · 1 line
2.9.4
#2 lore raw
In reply to Eduardo Habkost
Quoted 15 lines · Eduardo Habkost

The following changes since commit aaaec6acad7cf97372d48c1b09126a09697519c8:

Update version for v2.10.0-rc1 release (2017-08-02 16:36:32 +0100)

are available in the git repository at:

git://github.com/ehabkost/qemu.git tags/machine-pull-request

for you to fetch changes up to be2960baae07e5257cde8c814cbd91647e235147:

cpu: don't allow negative core id (2017-08-02 18:30:13 -0300)

----------------------------------------------------------------
cpu: crash fix (don't allow negative core id)

Quoted 7 lines

----------------------------------------------------------------

Laurent Vivier (1):
cpu: don't allow negative core id

 hw/cpu/core.c | 5 +++++
 1 file changed, 5 insertions(+)

Applied, thanks.

-- PMM