On Wed, Jan 26, 2022 at 1:08 AM HAGIO KAZUHITO(萩尾 一仁)
<k-hagio-ab(a)nec.com> wrote:
Currently on arm64, NT_PRSTATUS notes in dumpfile are not mapped to
online cpus and machine_specific->panic_task_regs correctly. As a
result, the "bt" command can cause a segmentation fault.
crash> bt -c 0
PID: 0 TASK: ffff8000117fa240 CPU: 0 COMMAND: "swapper/0"
Segmentation fault (core dumped)
To fix this,
1) make map_cpus_to_prstatus_kdump_cmprs() map the notes to
dd->nt_prstatus_percpu also on arm64, and
2) move arm64_get_crash_notes() to machdep_init(POST_INIT) in order
to apply the mapping to machine_specific->panic_task_regs.
Resolves:
https://github.com/crash-utility/crash/issues/105
Reported-by: xuchunmei000 <xuchunmei(a)linux.alibaba.com>
Signed-off-by: Kazuhito Hagio <k-hagio-ab(a)nec.com>
---
Note: I suspect that the machine_type("ARM64") in commit 9b41d403b16c might
be placed for debugging and contained in the commit by accident. Because
that segfault could be caused by the uninitialized machdep->process_elf_notes.
arm64.c | 2 +-
diskdump.c | 3 +--
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/arm64.c b/arm64.c
index 23c3d75d85aa..4f2c2b5104a1 100644
--- a/arm64.c
+++ b/arm64.c
@@ -472,7 +472,7 @@ arm64_init(int when)
arm64_stackframe_init();
break;
- case POST_VM:
+ case POST_INIT:
/*
* crash_notes contains machine specific information about the
* crash. In particular, it contains CPU registers at the time
diff --git a/diskdump.c b/diskdump.c
index 3e1cfd548c96..d5674276e1fd 100644
--- a/diskdump.c
+++ b/diskdump.c
@@ -111,8 +111,7 @@ map_cpus_to_prstatus_kdump_cmprs(void)
if (pc->flags2 & QEMU_MEM_DUMP_COMPRESSED) /* notes exist for all cpus
*/
goto resize_note_pointers;
- if (!(online = get_cpus_online()) || (online == kt->cpus) ||
- machine_type("ARM64"))
+ if (!(online = get_cpus_online()) || (online == kt->cpus))
goto resize_note_pointers;
if (CRASHDEBUG(1))
--
2.27.0
You can add
Tested-by: Dave Wysochanski <dwysocha(a)redhat.com>
Before this patch I had a vmcore that would segfault with 'bt -a',
with backtrace as in
https://github.com/crash-utility/crash/issues/105#issuecomment-1017176451
After this patch the segfault is gone.
FWIW, I saw was some new warnings with the vmcore but may be expected:
WARNING: cannot determine starting stack frame for task ffff809920692100
WARNING: cannot determine starting stack frame for task ffff80992068ee00
WARNING: cannot determine starting stack frame for task ffff80992069ed00
WARNING: cpu 4: cannot find NT_PRSTATUS note
WARNING: cpu 5: cannot find NT_PRSTATUS note
WARNING: cpu 6: cannot find NT_PRSTATUS note
WARNING: cpu 7: cannot find NT_PRSTATUS note
WARNING: cpu 8: cannot find NT_PRSTATUS note
WARNING: cpu 9: cannot find NT_PRSTATUS note
WARNING: cpu 10: cannot find NT_PRSTATUS note
WARNING: cpu 11: cannot find NT_PRSTATUS note
--
Crash-utility mailing list
Crash-utility(a)redhat.com
https://listman.redhat.com/mailman/listinfo/crash-utility