Hi,hatayama
Hi Zhao. Thanks for your prompt response.
I've noticed a issue that has not been fixed in this version,gcore unable to parse
register correctly in arm64,i found crash-utility is fixed,gcore-command can refer to
below change:
I see. I'll include fix for this issue into v1.6.1.
But I'm waiting for bug reports from other archs a few more weeks.
By the way,
commit c975008e61121ef8785622c3bc26964da8fe0deb
Author: Dave Anderson <anderson(a)redhat.com>
Date: Fri Sep 22 14:59:10 2017 -0400
Fix for the ARM64 "bt" command's display of the user mode exception
frame at the top of the stack in Linux 4.7 and later kernels.
Without the patch, the contents of the user mode exception frame are
invalid due to the miscalculation of the starting address of the
pt_regs structure on the kernel stack.
(anderson(a)redhat.com)
gcore patch:
commit 837182cc6589095c0d08f71f57953c50ad61cc19
Author: zhaoqianli <zhaoqianli(a)xiaomi.com>
Date: Thu Nov 12 19:41:01 2020 +0800
Fix register parsing error caused by miscalculation of the
starting address of the pt_regs structure on the kernel stack
Signed-off-by: zhaoqianli <zhaoqianli(a)xiaomi.com>
diff --git a/libgcore/gcore_arm64.c b/libgcore/gcore_arm64.c
index 3257389..c828fee 100644
--- a/libgcore/gcore_arm64.c
+++ b/libgcore/gcore_arm64.c
@@ -28,7 +28,7 @@ static int gpr_get(struct task_context *target,
BZERO(regs, sizeof(*regs));
- readmem(machdep->get_stacktop(target->task) - 16 - SIZE(pt_regs), KVADDR,
+ readmem(machdep->get_stacktop(target->task) -
machdep->machspec->user_eframe_offset, KVADDR,
it looks that the commit c975008e61121ef8785622c3bc26964da8fe0deb of crash utility
has the condition MEMBER_EXISTS("pt_regs", "stackframe").
@@ -1376,6 +1377,11 @@ arm64_stackframe_init(void)
MEMBER_OFFSET_INIT(elf_prstatus_pr_pid, "elf_prstatus",
"pr_pid");
MEMBER_OFFSET_INIT(elf_prstatus_pr_reg, "elf_prstatus",
"pr_reg");
+ if (MEMBER_EXISTS("pt_regs", "stackframe"))
+ machdep->machspec->user_eframe_offset = SIZE(pt_regs);
+ else
+ machdep->machspec->user_eframe_offset = SIZE(pt_regs) + 16;
+
machdep->machspec->__exception_text_start =
symbol_value("__exception_text_start");
machdep->machspec->__exception_text_end =
@
I guess with this patch set, gcore would result in similar issue for
kernels before 4.7.
Could you improve the patch so that gcore works well for kernls both before and later v4.7
kernel?
Thanks.
HATAYAMA, Daisuke