|
|
9bac43 |
From 647e9ff9107bb3c1536b995281e8db905bcb4164 Mon Sep 17 00:00:00 2001
|
|
|
9bac43 |
From: Laurent Vivier <lvivier@redhat.com>
|
|
|
9bac43 |
Date: Wed, 13 Sep 2017 16:20:33 +0200
|
|
|
9bac43 |
Subject: hmp: fix "dump-quest-memory" segfault (ppc)
|
|
|
9bac43 |
|
|
|
9bac43 |
Running QEMU with
|
|
|
9bac43 |
qemu-system-ppc64 -M none -nographic -m 256
|
|
|
9bac43 |
and executing
|
|
|
9bac43 |
dump-guest-memory /dev/null 0 8192
|
|
|
9bac43 |
results in segfault
|
|
|
9bac43 |
|
|
|
9bac43 |
Fix by checking if we have CPU, and exit with
|
|
|
9bac43 |
error if there is no CPU:
|
|
|
9bac43 |
|
|
|
9bac43 |
(qemu) dump-guest-memory /dev/null
|
|
|
9bac43 |
this feature or command is not currently supported
|
|
|
9bac43 |
|
|
|
9bac43 |
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
|
|
|
9bac43 |
Reviewed-by: Greg Kurz <groug@kaod.org>
|
|
|
9bac43 |
Reviewed-by: Thomas Huth <thuth@redhat.com>
|
|
|
9bac43 |
Message-Id: <20170913142036.2469-2-lvivier@redhat.com>
|
|
|
9bac43 |
Acked-by: David Gibson <david@gibson.dropbear.id.au>
|
|
|
9bac43 |
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
9bac43 |
(cherry picked from commit b1fde1ef5106c92dd12f1f0cfcb8c76e57d7f681)
|
|
|
9bac43 |
---
|
|
|
9bac43 |
target/ppc/arch_dump.c | 11 +++++++++--
|
|
|
9bac43 |
1 file changed, 9 insertions(+), 2 deletions(-)
|
|
|
9bac43 |
|
|
|
9bac43 |
diff --git a/target/ppc/arch_dump.c b/target/ppc/arch_dump.c
|
|
|
9bac43 |
index 8e9397a..95b9ab6 100644
|
|
|
9bac43 |
--- a/target/ppc/arch_dump.c
|
|
|
9bac43 |
+++ b/target/ppc/arch_dump.c
|
|
|
9bac43 |
@@ -224,8 +224,15 @@ typedef struct NoteFuncDescStruct NoteFuncDesc;
|
|
|
9bac43 |
int cpu_get_dump_info(ArchDumpInfo *info,
|
|
|
9bac43 |
const struct GuestPhysBlockList *guest_phys_blocks)
|
|
|
9bac43 |
{
|
|
|
9bac43 |
- PowerPCCPU *cpu = POWERPC_CPU(first_cpu);
|
|
|
9bac43 |
- PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);
|
|
|
9bac43 |
+ PowerPCCPU *cpu;
|
|
|
9bac43 |
+ PowerPCCPUClass *pcc;
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+ if (first_cpu == NULL) {
|
|
|
9bac43 |
+ return -1;
|
|
|
9bac43 |
+ }
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+ cpu = POWERPC_CPU(first_cpu);
|
|
|
9bac43 |
+ pcc = POWERPC_CPU_GET_CLASS(cpu);
|
|
|
9bac43 |
|
|
|
9bac43 |
info->d_machine = PPC_ELF_MACHINE;
|
|
|
9bac43 |
info->d_class = ELFCLASS;
|
|
|
9bac43 |
--
|
|
|
9bac43 |
1.8.3.1
|
|
|
9bac43 |
|