[{"id":1768263,"web_url":"http://patchwork.ozlabs.org/comment/1768263/","msgid":"<20170914001409.GG3972@umbus.fritz.box>","list_archive_url":null,"date":"2017-09-14T00:14:09","subject":"Re: [Qemu-devel] [PATCH v4 1/4] hmp: fix \"dump-quest-memory\"\n\tsegfault (ppc)","submitter":{"id":47,"url":"http://patchwork.ozlabs.org/api/people/47/","name":"David Gibson","email":"david@gibson.dropbear.id.au"},"content":"On Wed, Sep 13, 2017 at 04:20:33PM +0200, Laurent Vivier wrote:\n> Running QEMU with\n>     qemu-system-ppc64 -M none -nographic -m 256\n> and executing\n>     dump-guest-memory /dev/null 0 8192\n> results in segfault\n> \n> Fix by checking if we have CPU, and exit with\n> error if there is no CPU:\n> \n>     (qemu) dump-guest-memory /dev/null\n>     this feature or command is not currently supported\n> \n> Signed-off-by: Laurent Vivier <lvivier@redhat.com>\n> Reviewed-by: Greg Kurz <groug@kaod.org>\n> Reviewed-by: Thomas Huth <thuth@redhat.com>\n\nAcked-by: David Gibson <david@gibson.dropbear.id.au>\n\n> ---\n>  target/ppc/arch_dump.c | 11 +++++++++--\n>  1 file changed, 9 insertions(+), 2 deletions(-)\n> \n> diff --git a/target/ppc/arch_dump.c b/target/ppc/arch_dump.c\n> index 8e9397aa58..95b9ab6f29 100644\n> --- a/target/ppc/arch_dump.c\n> +++ b/target/ppc/arch_dump.c\n> @@ -224,8 +224,15 @@ typedef struct NoteFuncDescStruct NoteFuncDesc;\n>  int cpu_get_dump_info(ArchDumpInfo *info,\n>                        const struct GuestPhysBlockList *guest_phys_blocks)\n>  {\n> -    PowerPCCPU *cpu = POWERPC_CPU(first_cpu);\n> -    PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);\n> +    PowerPCCPU *cpu;\n> +    PowerPCCPUClass *pcc;\n> +\n> +    if (first_cpu == NULL) {\n> +        return -1;\n> +    }\n> +\n> +    cpu = POWERPC_CPU(first_cpu);\n> +    pcc = POWERPC_CPU_GET_CLASS(cpu);\n>  \n>      info->d_machine = PPC_ELF_MACHINE;\n>      info->d_class = ELFCLASS;","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=gibson.dropbear.id.au\n\theader.i=@gibson.dropbear.id.au header.b=\"oQt68j4b\"; \n\tdkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xt0K66tSpz9t2V\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 14 Sep 2017 10:48:58 +1000 (AEST)","from localhost ([::1]:45214 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dsIKv-0004xd-4B\n\tfor incoming@patchwork.ozlabs.org; Wed, 13 Sep 2017 20:48:57 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:38425)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <dgibson@ozlabs.org>) id 1dsIKK-0004v8-5I\n\tfor qemu-devel@nongnu.org; Wed, 13 Sep 2017 20:48:23 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <dgibson@ozlabs.org>) id 1dsIKJ-0007Tv-5v\n\tfor qemu-devel@nongnu.org; Wed, 13 Sep 2017 20:48:20 -0400","from ozlabs.org ([103.22.144.67]:32845)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <dgibson@ozlabs.org>)\n\tid 1dsIK9-0007LV-NU; Wed, 13 Sep 2017 20:48:10 -0400","by ozlabs.org (Postfix, from userid 1007)\n\tid 3xt0J52mRKz9t2h; Thu, 14 Sep 2017 10:48:05 +1000 (AEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple;\n\td=gibson.dropbear.id.au; s=201602; t=1505350085;\n\tbh=Eb1YwhwXLCVWynkpRxJN8XLUMtMLGyNxhf+o3DLt7Z8=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=oQt68j4b9/5Gdw7zD/IUaniJ66rUAJBP3SK8dj/fwq5Gkw5gbThCh/2kImHYiby6r\n\tgdfow9oZKYumNLCi3g8/v+UYTlQauVfqsRJbFvjWHbgbcOOzh8lG1/owCxA5y2Ksv8\n\tfQLUf/frvVVo4I1bgsXUrQ6Cb5av8ypoaVsO+/rs=","Date":"Thu, 14 Sep 2017 10:14:09 +1000","From":"David Gibson <david@gibson.dropbear.id.au>","To":"Laurent Vivier <lvivier@redhat.com>","Message-ID":"<20170914001409.GG3972@umbus.fritz.box>","References":"<20170913142036.2469-1-lvivier@redhat.com>\n\t<20170913142036.2469-2-lvivier@redhat.com>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\"; boundary=\"kjpMrWxdCilgNbo1\"","Content-Disposition":"inline","In-Reply-To":"<20170913142036.2469-2-lvivier@redhat.com>","User-Agent":"Mutt/1.8.3 (2017-05-23)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"103.22.144.67","Subject":"Re: [Qemu-devel] [PATCH v4 1/4] hmp: fix \"dump-quest-memory\"\n\tsegfault (ppc)","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Peter Maydell <peter.maydell@linaro.org>, Thomas Huth <thuth@redhat.com>,\n\tCornelia Huck <cohuck@redhat.com>,\n\t\"Dr . David Alan Gilbert\" <dgilbert@redhat.com>,\n\tqemu-devel@nongnu.org, Greg Kurz <groug@kaod.org>,\n\tqemu-arm@nongnu.org, qemu-ppc@nongnu.org","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}}]