From patchwork Mon Mar 19 18:34:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 132073 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp3052607ljb; Mon, 19 Mar 2018 11:37:21 -0700 (PDT) X-Google-Smtp-Source: AG47ELutLYs1JuJf0xhJQI+cKSUWw91YGfxbgeckDp4STdNUDFDcTvW8X4d69OElovCI/J2Rw993 X-Received: by 10.55.17.34 with SMTP id b34mr8193184qkh.343.1521484640957; Mon, 19 Mar 2018 11:37:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521484640; cv=none; d=google.com; s=arc-20160816; b=HXvYWF1SsCi26v5uG8oU2nPUko7EF/2a6FNZx+FiAO6ZOZAZ9UJWU3cQaMkyOOtjHg /yjTlYYkqo6+Goc2PSgJ/I88hK+yD+DCESGwY+OyX+liP+Y6E5eN1QVNRkqwGjMfIVmw faQdW2eHymBh5ATeDio1akwQSMW2L22lYJKs4g2+MwBeBh+NqZFwd9nI9tAUNZOnYF2s xl+L9PYtp0O3wVNEIWWMB/klFawHSkiGxNvMGCjYs13HLwgf+2+ZJkTWaeD+u/uhhcGF 9ZVXUrNm97qnl9EiuDrhQzIJ3LSt7mjYNFtuutU1KeBFlnib0HbsFOi0Qq+wyZIAun+6 ocyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:arc-authentication-results; bh=a6/t8EEwCu99EjeSMM5+I4fD3EtE16iNcXu0t5LskoI=; b=wkJzVqbw3w0PCDkmeRjhNp8Cv9tjpPXT3nMlyfVGyd35DWaDHlOwacLV4CA/ZU2u1t 9OgAI1gAAhuvKTuRch5P3YxK/Cbz5AgtCO28rFBgTfts9jan2D6hx3Bknwwx57Yq9CNn 3W7VspH3QHTtesd7Ajq/khMDH8gAkMk0rjV6mE5FOC5uywimWoI0Z9EPzZ6WKe5W4i/d hfTb+JmOUz22CHT1JmfElMX5j2idmnfSL/004gyK1YfnGddFAf2bdwA36XEwREmHWFWK WJ+eAkPutHDYNs4WPQnbNY8hn9Q2kGoYkF6ns12MpQA8WJGfS76L0tLlDj5j/NTY1xBE cCCg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id p30si681674qtl.65.2018.03.19.11.37.20 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 19 Mar 2018 11:37:20 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:43365 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1exzeq-0003bX-33 for patch@linaro.org; Mon, 19 Mar 2018 14:37:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49687) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1exzbx-0002JX-Ou for qemu-devel@nongnu.org; Mon, 19 Mar 2018 14:34:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1exzbw-0007dp-TV for qemu-devel@nongnu.org; Mon, 19 Mar 2018 14:34:21 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:40454) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1exzbw-0007bM-LP for qemu-devel@nongnu.org; Mon, 19 Mar 2018 14:34:20 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1exzbu-0002zP-Sz for qemu-devel@nongnu.org; Mon, 19 Mar 2018 18:34:18 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 19 Mar 2018 18:34:04 +0000 Message-Id: <20180319183415.1976-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319183415.1976-1-peter.maydell@linaro.org> References: <20180319183415.1976-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 02/13] dump: Update correct kdump phys_base field for AArch64 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Wei Huang For guest kernel that supports KASLR, the load address can change every time when guest VM runs. To find the physical base address correctly, current QEMU dump searches VMCOREINFO for the string "NUMBER(phys_base)=". However this string pattern is only available on x86_64. AArch64 uses a different field, called "NUMBER(PHYS_OFFSET)=". This patch makes sure QEMU dump uses the correct string on AArch64. Signed-off-by: Wei Huang Reviewed-by: Marc-André Lureau Message-id: 1520615003-20869-1-git-send-email-wei@redhat.com Signed-off-by: Peter Maydell --- dump.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) -- 2.16.2 diff --git a/dump.c b/dump.c index 097e60b2b3..6bdb0dbe23 100644 --- a/dump.c +++ b/dump.c @@ -1609,10 +1609,18 @@ static void vmcoreinfo_update_phys_base(DumpState *s) lines = g_strsplit((char *)vmci, "\n", -1); for (i = 0; lines[i]; i++) { - if (g_str_has_prefix(lines[i], "NUMBER(phys_base)=")) { - if (qemu_strtou64(lines[i] + 18, NULL, 16, + const char *prefix = NULL; + + if (s->dump_info.d_machine == EM_X86_64) { + prefix = "NUMBER(phys_base)="; + } else if (s->dump_info.d_machine == EM_AARCH64) { + prefix = "NUMBER(PHYS_OFFSET)="; + } + + if (prefix && g_str_has_prefix(lines[i], prefix)) { + if (qemu_strtou64(lines[i] + strlen(prefix), NULL, 16, &phys_base) < 0) { - warn_report("Failed to read NUMBER(phys_base)="); + warn_report("Failed to read %s", prefix); } else { s->dump_info.phys_base = phys_base; }