As for v4.16-rc1, crash for arm64 fails to analyze the core dump,
with a message: cannot determine page size.

There seems to be a couple of reasons for this:
[1] splits a 64-bit field of image header, _kernel_flags_le, into two
32-bit values and in turn they have got a bit different names.

[2] and more recent [3] can possibly add extra space between idmap_pg_dir
and swapper_pg_dir.

This patch addresses both of changes.

[1] commit 6ad1fe5d9077 ("arm64: avoid R_AARCH64_ABS64 relocations for
    Image header fields")

[2] commit 1e1b8c04fa34 ("arm64: entry: Move the trampoline to be before PAN")

[3] commit 4b65a5db3627 ("arm64: Introduce uaccess_{disable,enable}
    functionality based on TTBR0_EL1")

Signed-off-by: AKASHI Takahiro <takahiro.aka...@linaro.org>
---
 arm64.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/arm64.c b/arm64.c
index 7904f65..7f87d5b 100644
--- a/arm64.c
+++ b/arm64.c
@@ -172,8 +172,14 @@ arm64_init(int when)
                if (!machdep->pagesize &&
                    kernel_symbol_exists("swapper_pg_dir") &&
                    kernel_symbol_exists("idmap_pg_dir")) {
-                       value = symbol_value("swapper_pg_dir") -
-                               symbol_value("idmap_pg_dir");
+                       if (kernel_symbol_exists("tramp_pg_dir"))
+                               value = symbol_value("tramp_pg_dir");
+                       else if (kernel_symbol_exists("reserved_ttbr0"))
+                               value = symbol_value("reserved_ttbr0");
+                       else
+                               value = symbol_value("swapper_pg_dir");
+
+                       value -= symbol_value("idmap_pg_dir");
                        /*
                         * idmap_pg_dir is 2 pages prior to 4.1,
                         * and 3 pages thereafter.  Only 4K and 64K 
@@ -436,6 +442,12 @@ arm64_verify_symbol(const char *name, ulong value, char 
type)
        if ((type == 'A') && STREQ(name, "_kernel_flags_le"))
                machdep->machspec->kernel_flags = le64toh(value);
 
+       if ((type == 'A') && STREQ(name, "_kernel_flags_le_hi32"))
+               machdep->machspec->kernel_flags |= (le32toh(value) << 32);
+
+       if ((type == 'A') && STREQ(name, "_kernel_flags_le_lo32"))
+               machdep->machspec->kernel_flags |= le32toh(value);
+
        if (((type == 'A') || (type == 'a')) && (highest_bit_long(value) != 63))
                return FALSE;
 
-- 
2.15.1

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility

Reply via email to