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