[Crash-utility] [External Mail][ANNOUNCE] crash gcore command, version 1.6.0 is released

赵乾利 zhaoqianli at xiaomi.com
Fri Nov 13 08:06:18 UTC 2020


Hi,hatayama

> it looks that the commit c975008e61121ef8785622c3bc26964da8fe0deb of crash utility
> has the condition MEMBER_EXISTS("pt_regs", "stackframe").
This condition can be used to judge before or  after 4.7,This change is accompanied by the variable stackframe.

> I guess with this patch set, gcore would result in similar issue for
> kernels before 4.7.

Before kernel 4.7,user_eframe_offset is "SIZE(pt_regs) + 16",after 4.7 user_eframe_offset is SIZE(pt_regs) ,Anderson's change can  compatible with before and after kernel 4.7,so gcore can use "user_eframe_offset" directly.

+       if (MEMBER_EXISTS("pt_regs", "stackframe"))
+               machdep->machspec->user_eframe_offset = SIZE(pt_regs);
+       else
+               machdep->machspec->user_eframe_offset = SIZE(pt_regs) + 16;
+

________________________________________
From: d.hatayama at fujitsu.com <d.hatayama at fujitsu.com>
Sent: Friday, November 13, 2020 14:20
To: 赵乾利
Cc: Dreyfus, Thirtsa (Mobileye); lijiang at redhat.com; crash-utility at redhat.com; k-hagio-ab at nec.com
Subject: Re: [External Mail][ANNOUNCE] crash gcore command, version 1.6.0 is released

> 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 at 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 at redhat.com)
>
> gcore patch:
> commit 837182cc6589095c0d08f71f57953c50ad61cc19
> Author: zhaoqianli <zhaoqianli at 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 at 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
#/******本邮件及其附件含有小米公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件! This e-mail and its attachments contain confidential information from XIAOMI, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!******/#




More information about the Crash-utility mailing list