crash-utility / crash

Linux kernel crash utility
https://crash-utility.github.io
837 stars 275 forks source link

How to support crash tool for linux-5.15 or later versions #125

Closed KangHoupeng closed 2 years ago

KangHoupeng commented 2 years ago

Now I want to support crash dump tool for linux-5.15, however, it can't read analyze the vmlinux and vmcore. And I found the crash-utility's commit 9f168fb560bffe2116208cc1c947a95ef612f4fb fix it for Linux 5.1 kernels. So I wonder if the linux-5.15 is different for low version kernel and we need deal with it in the same way.

kernel info: / # uname -a Linux sun_xx_iw_x_p1 5.15.41+ #12 SMP PREEMPT Mon Sep 19 16:42:54 CST 2022 aarch64 GNU/Linux

Message as follow: crashs 8.0.1++ Copyright (C) 2002-2022 Red Hat, Inc. Copyright (C) 2004, 2005, 2006, 2010 IBM Corporation Copyright (C) 1999-2006 Hewlett-Packard Co Copyright (C) 2005, 2006, 2011, 2012 Fujitsu Limited Copyright (C) 2006, 2007 VA Linux Systems Japan K.K. Copyright (C) 2005, 2011, 2020-2022 NEC Corporation Copyright (C) 1999, 2002, 2007 Silicon Graphics, Inc. Copyright (C) 1999, 2000, 2001, 2002 Mission Critical Linux, Inc. Copyright (C) 2015, 2021 VMware, Inc. This program is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Enter "help copying" to see the conditions. This program has absolutely no warranty. Enter "help warranty" for details.

NOTE: setting vabits_actual to: 39

NOTE: setting kimage_voffset to: 0xffffffbfc8000000

GNU gdb (GDB) 10.2 Copyright (C) 2021 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "--host=x86_64-pc-linux-gnu --target=aarch64-elf-linux". Type "show configuration" for configuration details. Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/.

For help, type "help". Type "apropos word" to search for commands related to "word"...

sp: 0xffffffc0087cf580 WARNING: could not find MAGIC_START! crashs: dbg/vmlinux and /var/tmp/ramdump_elf_Lmb5Zc do not match!

Usage:

crash [OPTION]... NAMELIST MEMORY-IMAGE[@ADDRESS] (dumpfile form) crash [OPTION]... [NAMELIST] (live system form)

Enter "crashs -h" for details.

KangHoupeng commented 2 years ago

Yeah, I have solved it. When I assign the kalsr as 0x80000,It can work well. ./crashs tmp/vmlinux tmp/de_dram_data_202292093322@0x40000000 --machdep vabits_actual=39 --machdep kimage_voffset=0xffffffbfc8000000 --kaslr 0x80000

5.4: [ 221.697165] SMP: stopping secondary CPUs [ 221.701677] Kernel Offset: disabled [ 221.705609] CPU features: 0x00010002,20002004 [ 221.710492] Memory Limit: none

5.15: [ 91.749294] SMP: stopping secondary CPUs [ 91.753755] Kernel Offset: 0x80000 from 0xffffffc008000000 [ 91.759894] PHYS_OFFSET: 0x40000000 [ 91.763797] CPU features: 0x0,00004801,00000842 [ 91.768869] Memory Limit: none

crashs 8.0.1++ Copyright (C) 2002-2022 Red Hat, Inc. Copyright (C) 2004, 2005, 2006, 2010 IBM Corporation Copyright (C) 1999-2006 Hewlett-Packard Co Copyright (C) 2005, 2006, 2011, 2012 Fujitsu Limited Copyright (C) 2006, 2007 VA Linux Systems Japan K.K. Copyright (C) 2005, 2011, 2020-2022 NEC Corporation Copyright (C) 1999, 2002, 2007 Silicon Graphics, Inc. Copyright (C) 1999, 2000, 2001, 2002 Mission Critical Linux, Inc. Copyright (C) 2015, 2021 VMware, Inc. This program is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Enter "help copying" to see the conditions. This program has absolutely no warranty. Enter "help warranty" for details.

NOTE: setting vabits_actual to: 39

NOTE: setting kimage_voffset to: 0xffffffbfc8000000

GNU gdb (GDB) 10.2 Copyright (C) 2021 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "--host=x86_64-pc-linux-gnu --target=aarch64-elf-linux". Type "show configuration" for configuration details. Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/.

For help, type "help". Type "apropos word" to search for commands related to "word"...

sp: 0xffffffc00884f580 sp: 0xffffffc00884f580 WARNING: cpu 0: cannot find NT_PRSTATUS note WARNING: cpu 1: cannot find NT_PRSTATUS note WARNING: cpu 2: cannot find NT_PRSTATUS note WARNING: cpu 3: cannot find NT_PRSTATUS note KERNEL: tmp/vmlinux DUMPFILES: /var/tmp/ramdump_elf_QYaCg1 [temporary ELF header] tmp/de_dram_data_202292093322 CPUS: 4 [OFFLINE: 3] DATE: Wed Feb 15 04:02:37 CST 2012 UPTIME: 00:01:31 LOAD AVERAGE: 0.78, 0.26, 0.10 TASKS: 85 NODENAME: sun_xx_iw_x_p1 RELEASE: 5.15.41 VERSION: #13 SMP PREEMPT Tue Sep 20 09:15:52 CST 2022 MACHINE: aarch64 (unknown Mhz) MEMORY: 3 GB PANIC: "Kernel panic - not syncing: sysrq triggered crash" PID: 407 COMMAND: "ash" TASK: ffffff8002caf080 [THREAD_INFO: ffffff8002caf080] CPU: 0 STATE: TASK_RUNNING (PANIC)

sp: 0xffffffc00884f580 crashs> help

crashs version: 8.0.1++ gdb version: 10.2 For help on any command above, enter "help ". For help on input options, enter "help input". For help on output options, enter "help output".

crashs>