qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL 02/13] dump: Update correct kdump phys_base field for AArch64
Date: Mon, 19 Mar 2018 18:34:04 +0000	[thread overview]
Message-ID: <20180319183415.1976-3-peter.maydell@linaro.org> (raw)
In-Reply-To: <20180319183415.1976-1-peter.maydell@linaro.org>

From: Wei Huang <wei@redhat.com>

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 <wei@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 1520615003-20869-1-git-send-email-wei@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 dump.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

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;
             }
-- 
2.16.2

  parent reply	other threads:[~2018-03-19 18:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-19 18:34 [Qemu-devel] [PULL 00/13] target-arm queue Peter Maydell
2018-03-19 18:34 ` [Qemu-devel] [PULL 01/13] fsl-imx6: Swap Ethernet interrupt defines Peter Maydell
2018-03-19 18:34 ` Peter Maydell [this message]
2018-03-19 18:34 ` [Qemu-devel] [PULL 03/13] char: i.MX: Simplify imx_update() Peter Maydell
2018-03-19 18:34 ` [Qemu-devel] [PULL 04/13] char: i.MX: Add support for "TX complete" interrupt Peter Maydell
2018-03-19 18:34 ` [Qemu-devel] [PULL 05/13] hw/arm/raspi: Don't do board-setup or secure-boot for raspi3 Peter Maydell
2018-03-19 18:34 ` [Qemu-devel] [PULL 06/13] hw/arm/boot: assert that secure_boot and secure_board_setup are false for AArch64 Peter Maydell
2018-03-19 18:34 ` [Qemu-devel] [PULL 07/13] hw/arm/boot: If booting a kernel in EL2, set SCR_EL3.HCE Peter Maydell
2018-03-19 18:34 ` [Qemu-devel] [PULL 08/13] hw/arm/bcm2386: Fix parent type of bcm2386 Peter Maydell
2018-03-19 18:34 ` [Qemu-devel] [PULL 09/13] hw/arm/bcm2836: Rename bcm2836 type/struct to bcm283x Peter Maydell
2018-03-19 18:34 ` [Qemu-devel] [PULL 10/13] hw/arm/bcm2836: Create proper bcm2837 device Peter Maydell
2018-03-19 18:34 ` [Qemu-devel] [PULL 11/13] hw/arm/bcm2836: Use correct affinity values for BCM2837 Peter Maydell
2018-03-19 18:34 ` [Qemu-devel] [PULL 12/13] hw/arm/bcm2836: Hardcode correct CPU type Peter Maydell
2018-03-19 18:34 ` [Qemu-devel] [PULL 13/13] hw/arm/raspi: Provide spin-loop code for AArch64 CPUs Peter Maydell
2018-03-20  9:51 ` [Qemu-devel] [PULL 00/13] target-arm queue Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180319183415.1976-3-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).