<div dir="ltr"><div>Thank you for the fix, Kazu.</div><div>Applied.</div><div><br></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jan 26, 2022 at 2:07 PM HAGIO KAZUHITO(萩尾 一仁) <<a href="mailto:k-hagio-ab@nec.com" target="_blank">k-hagio-ab@nec.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Currently on arm64, NT_PRSTATUS notes in dumpfile are not mapped to<br>
online cpus and machine_specific->panic_task_regs correctly.  As a<br>
result, the "bt" command can cause a segmentation fault.<br>
<br>
  crash> bt -c 0<br>
  PID: 0      TASK: ffff8000117fa240  CPU: 0   COMMAND: "swapper/0"<br>
  Segmentation fault (core dumped)<br>
<br>
To fix this,<br>
1) make map_cpus_to_prstatus_kdump_cmprs() map the notes to<br>
   dd->nt_prstatus_percpu also on arm64, and<br>
2) move arm64_get_crash_notes() to machdep_init(POST_INIT) in order<br>
   to apply the mapping to machine_specific->panic_task_regs.<br>
<br>
Resolves: <a href="https://github.com/crash-utility/crash/issues/105" rel="noreferrer" target="_blank">https://github.com/crash-utility/crash/issues/105</a><br>
Reported-by: xuchunmei000 <<a href="mailto:xuchunmei@linux.alibaba.com" target="_blank">xuchunmei@linux.alibaba.com</a>><br>
Signed-off-by: Kazuhito Hagio <<a href="mailto:k-hagio-ab@nec.com" target="_blank">k-hagio-ab@nec.com</a>><br>
---<br>
Note: I suspect that the machine_type("ARM64") in commit 9b41d403b16c might<br>
be placed for debugging and contained in the commit by accident.  Because<br>
that segfault could be caused by the uninitialized machdep->process_elf_notes.<br>
<br>
 arm64.c    | 2 +-<br>
 diskdump.c | 3 +--<br>
 2 files changed, 2 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/arm64.c b/arm64.c<br>
index 23c3d75d85aa..4f2c2b5104a1 100644<br>
--- a/arm64.c<br>
+++ b/arm64.c<br>
@@ -472,7 +472,7 @@ arm64_init(int when)<br>
                arm64_stackframe_init();<br>
                break;<br>
<br>
-       case POST_VM:<br>
+       case POST_INIT:<br>
                /*<br>
                 * crash_notes contains machine specific information about the<br>
                 * crash. In particular, it contains CPU registers at the time<br>
diff --git a/diskdump.c b/diskdump.c<br>
index 3e1cfd548c96..d5674276e1fd 100644<br>
--- a/diskdump.c<br>
+++ b/diskdump.c<br>
@@ -111,8 +111,7 @@ map_cpus_to_prstatus_kdump_cmprs(void)<br>
        if (pc->flags2 & QEMU_MEM_DUMP_COMPRESSED)  /* notes exist for all cpus */<br>
                goto resize_note_pointers;<br>
<br>
-       if (!(online = get_cpus_online()) || (online == kt->cpus) || <br>
-           machine_type("ARM64"))<br>
+       if (!(online = get_cpus_online()) || (online == kt->cpus))<br>
                goto resize_note_pointers;<br>
<br>
        if (CRASHDEBUG(1))<br>
-- <br>
2.27.0<br>
<br>
</blockquote></div></div>