Hi,hatayama
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:
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,
regs, sizeof(struct user_pt_regs), "gpr_get: user_pt_regs",
gcore_verbose_error_handle());
@@ -124,7 +124,7 @@ static int compat_gpr_get(struct task_context *target,
BZERO(&pt_regs, sizeof(pt_regs));
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,
&pt_regs, sizeof(struct pt_regs), "compat_gpr_get:
pt_regs",
gcore_verbose_error_handle());
Below is my debug message,gdb to loadethe corefile generated by gcore,SP reg is wrong,as a
result, the upper-level stack cannot be calculated correctly.
[Without patch]
(gdb) bt
#0 android::Mutex::lock (this=<optimized out>) at
system/core/libutils/include/utils/Mutex.h:183
#1 android::Looper::pollInner (this=0x704ad1c590 <epoll_wait(int, epoll_event*, int,
int)>, timeoutMillis=1291145664)
at system/core/libutils/Looper.cpp:243
#2 0xbc5e696a00000018 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) info reg
x0 0xffffff801998bff0 -549326372880
x1 0xffffffa6d3e83848 -382991845304
x2 0x34 52
x3 0x7fdb6d8f90 549142237072
x4 0x10 16
x5 0x74a5 29861
x6 0x0 0
x7 0x8 8
x8 0x704e33a000 482348343296
x9 0xbf815ee 200807918
x10 0x16 22
x11 0xebabf645f5e97f31 -1464806473440067791
x12 0x1 1
x13 0xc0 192
x14 0x20daea4ae8 141111741160
x15 0x115 277
x16 0x1080400222a3e010 1189020679541088272
x17 0x40 64
x18 0x704a9fcd70 482288323952
x19 0x704ad1c590 482291598736
x20 0x704e01c000 482345074688
x21 0x704cf551c0 482327482816
x22 0x704cf55268 482327482984
x23 0x74a5 29861
x24 0x74a5 29861
x25 0x704cf551c0 482327482816
x26 0x7fffffff 2147483647
x27 0x704d0aa020 482328879136
x28 0x704cfc8840 482327955520
x29 0x704407b8 1883506616
x30 0x70435dc8 1883463112
sp 0x7fdb6d90f0 0x7fdb6d90f0
pc 0x704a9f80c0 0x704a9f80c0 <android::Looper::pollInner(int)+148>
cpsr 0xdb6d8f50 -613576880
fpsr 0x17 23
fpcr 0x0 0
[With patch]
(gdb) bt
#0 __epoll_pwait () at bionic/libc/arch-arm64/syscalls/__epoll_pwait.S:9
#1 0x000000704a9f80c0 in android::Looper::pollInner (this=0x704cf551c0,
timeoutMillis=29861) at
system/core/libutils/Looper.cpp:237
#2 0x000000704a9f7f90 in android::Looper::pollOnce (this=0x704cf551c0,
timeoutMillis=29861, outFd=0x0,
outEvents=0x0, outData=0x0) at system/core/libutils/Looper.cpp:205
#3 0x000000704c4530f4 in android::Looper::pollOnce (this=0x34, timeoutMillis=-613576816)
at
system/core/libutils/include/utils/Looper.h:267
#4 android::NativeMessageQueue::pollOnce (this=<optimized out>, env=0x704cf5db80,
pollObj=<optimized out>,
timeoutMillis=-613576816)
at frameworks/base/core/jni/android_os_MessageQueue.cpp:110
#5 android::android_os_MessageQueue_nativePollOnce (env=0x704cf5db80, obj=<optimized
out>, ptr=<optimized
out>, timeoutMillis=-613576816)
at frameworks/base/core/jni/android_os_MessageQueue.cpp:191
#6 0x0000000073749590 in ?? ()
(gdb) info registers
x0 0x34 52
x1 0x7fdb6d8f90 549142237072
x2 0x10 16
x3 0x74a5 29861
x4 0x0 0
x5 0x8 8
x6 0x704e33a000 482348343296
x7 0xbf815ee 200807918
x8 0x16 22
x9 0xebabf645f5e97f31 -1464806473440067791
x10 0x1 1
x11 0xc0 192
x12 0x20daea4ae8 141111741160
x13 0x115 277
x14 0x1080400222a3e010 1189020679541088272
x15 0x40 64
x16 0x704a9fcd70 482288323952
x17 0x704ad1c590 482291598736
x18 0x704e01c000 482345074688
x19 0x704cf551c0 482327482816
x20 0x704cf55268 482327482984
x21 0x74a5 29861
x22 0x74a5 29861
x23 0x704cf551c0 482327482816
x24 0x7fffffff 2147483647
x25 0x704d0aa020 482328879136
x26 0x704cfc8840 482327955520
x27 0x704407b8 1883506616
x28 0x70435dc8 1883463112
x29 0x7fdb6d90f0 549142237424
x30 0x704a9f80c0 482288304320
sp 0x7fdb6d8f50 0x7fdb6d8f50
pc 0x704ad5c098 0x704ad5c098 <__epoll_pwait+8>
cpsr 0x60001000 1610616832
fpsr 0x17 23
fpcr 0x0 0
________________________________________
From: d.hatayama(a)fujitsu.com <d.hatayama(a)fujitsu.com>
Sent: Thursday, November 12, 2020 9:25
To: crash-utility(a)redhat.com; k-hagio-ab(a)nec.com
Cc: Dreyfus, Thirtsa (Mobileye); lijiang(a)redhat.com; 赵乾利
Subject: [External Mail][ANNOUNCE] crash gcore command, version 1.6.0 is released
This is the release of crash gcore command, version 1.6.0.
This release includes the following 1 new feature and 2 bug fixes.
This is tested on the latest kernels on Fedora 33, RHEL8, RHEL7 and
RHEL6 on x86_64.
Note that ZRAM support is not included in this release because some
patch set is still needed in crash utility.
Hagio-san, could you update the description of crash gcore command
at
https://crash-utility.github.io/extensions.html?
ChangeLog:
- NT_FILE note information is newly supported for tasks in both 64-bit
and 32-bit compatible mode:
# LANG=C eu-readelf -n core.1.systemd | awk '/FILE$/ {f=1} f == 1 {print $0}'
| head -n 10
CORE 12957 FILE
240 files:
564b290de000-564b29112000 00000000 212992 /usr/lib/systemd/systemd
564b29112000-564b291de000 00104000 835584 /usr/lib/systemd/systemd
564b291de000-564b2923d000 00500000 389120 /usr/lib/systemd/systemd
564b2923d000-564b29282000 006d6000 282624 /usr/lib/systemd/systemd
564b29282000-564b29283000 0082f000 4096 /usr/lib/systemd/systemd
7ffbf12c2000-7ffbf134c000 00000000 565248
/etc/selinux/targeted/contexts/files/file_contexts.bin
7ffbf1352000-7ffbf135a000 00000000 32768 /usr/lib64/libnl-3.so.200.26.0
7ffbf135a000-7ffbf1369000 00028000 61440 /usr/lib64/libnl-3.so.200.26.0
(thirtsa.dreyfus(a)intel.com, d.hatayama(a)fujitsu.com)
- Fix failure of collecting vDSO mapping if compat vDSO is disabled
due to wrongly designed condition for compat tasks that tries to
determine vDSO mapping based on VDSO_HIGH_BASE. Without this patch,
vDSO mapping page is not collected for tasks running in 32-bit
compat mode and thus displaying backtrace by gdb's bt command for
the tasks could be incomplete.
(d.hatayama(a)fujitsu.com)
- Fix failure of invalid structure member offset with the message
"gcore: invalid structure member offset:
thread_struct_io_bitmap_max" due to change of kernel data structure
for io bitmap by the commit <577d5cd7e585> ("x86/ioperm: Move
iobitmap data into a struct").
(lijiang(a)redhat.com, d.hatayama(a)fujitsu.com)
MD5 CheckSum:
# md5sum crash-gcore-command-1.6.0.tar.gz
889843438ad702807d48cccfdee94e89 crash-gcore-command-1.6.0.tar.gz
--
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!******/#