Compare commits

..

No commits in common. "edbde128fc5fdf1e4dc68ad623027b1f22e10bcf" and "723c22bb0aa450353ee7b9cb53736494beec506d" have entirely different histories.

5 changed files with 3116 additions and 106043 deletions

3105
0002-crash-8.0.2-sw.patch Executable file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,46 +0,0 @@
From 45685956da58b15d4542d59b95888b1968980c68 Mon Sep 17 00:00:00 2001
From: Xiaoguang Wang <lege.wang@jaguarmicro.com>
Date: Thu, 7 Nov 2024 14:40:07 +0800
Subject: [PATCH] arm64: fix SDEI stack frame unwind while UNW_4_14 is set
Fix two bugs:
1) If BT_IRQSTACK is set, both irq_stack and sdei_normal_stack need
to be checked while switching to process stack.
2) Use bt->frameptr in arm64_unwind_frame() just like irq stack.
Fixes: 442da89f4898 ("crash: add SDEI stack resolution")
Signed-off-by: Xiaoguang Wang <lege.wang@jaguarmicro.com>
---
arm64.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arm64.c b/arm64.c
index b99baa3..34c3b08 100644
--- a/arm64.c
+++ b/arm64.c
@@ -3244,10 +3244,10 @@ arm64_unwind_frame(struct bt_info *bt, struct arm64_stackframe *frame)
if (machdep->flags & UNW_4_14) {
if (((bt->flags & BT_IRQSTACK) &&
- !arm64_on_irq_stack(bt->tc->processor, frame->fp)) ||
+ !arm64_on_irq_stack(bt->tc->processor, frame->fp) &&
+ !arm64_in_sdei_normal_stack(bt->tc->processor, frame->fp)) ||
((bt->flags & BT_OVERFLOW_STACK) &&
- !arm64_on_overflow_stack(bt->tc->processor, frame->fp)) &&
- !arm64_in_sdei_normal_stack(bt->tc->processor, frame->fp)) {
+ !arm64_on_overflow_stack(bt->tc->processor, frame->fp))) {
if (arm64_on_process_stack(bt, frame->fp)) {
arm64_set_process_stack(bt);
@@ -3696,7 +3696,7 @@ arm64_back_trace_cmd(struct bt_info *bt)
arm64_set_overflow_stack(bt);
bt->flags |= BT_OVERFLOW_STACK;
}
- if (arm64_in_sdei_normal_stack(bt->tc->processor, bt->bptr)) {
+ if (arm64_in_sdei_normal_stack(bt->tc->processor, bt->frameptr)) {
arm64_set_sdei_normal_stack(bt);
bt->flags |= BT_IRQSTACK;
}
--
2.34.1

View File

@ -1,76 +0,0 @@
From ced754d3f8ce796d0d894dbb0f340e9c905c206a Mon Sep 17 00:00:00 2001
From: Tao Liu <ltao@redhat.com>
Date: Wed, 3 Apr 2024 15:06:54 +0800
Subject: [PATCH] Fix segmentation fault in value_search_module_6_4()
The following segmentation fault occurred during session initialization:
$ crash vmlinx vmcore
...
please wait... (determining panic task)Segmentation fault
Here is the backtrace of the crash-utility:
(gdb) bt
#0 value_search_module_6_4 (value=18446603338276298752, offset=0x7ffffffface0) at symbols.c:5564
#1 0x0000555555812bd0 in value_to_symstr (value=18446603338276298752,
buf=buf@entry=0x7fffffffb9c0 "", radix=10, radix@entry=0) at symbols.c:5872
#2 0x00005555557694a2 in display_memory (addr=<optimized out>, count=2048, flag=208,
memtype=memtype@entry=1, opt=opt@entry=0x0) at memory.c:1740
#3 0x0000555555769e1f in raw_stack_dump (stackbase=<optimized out>, size=<optimized out>)
at memory.c:2194
#4 0x00005555557923ff in get_active_set_panic_task () at task.c:8639
#5 0x00005555557930d2 in get_dumpfile_panic_task () at task.c:7628
#6 0x00005555557a89d3 in panic_search () at task.c:7380
#7 get_panic_context () at task.c:6267
#8 task_init () at task.c:687
#9 0x00005555557305b3 in main_loop () at main.c:787
...
This is due to lack of existence check on module symbol table. Not all
mod_mem_type will be existent for a module, e.g. in the following module
case:
(gdb) p lm->symtable[0]
$1 = (struct syment *) 0x4dcbad0
(gdb) p lm->symtable[1]
$2 = (struct syment *) 0x4dcbb70
(gdb) p lm->symtable[2]
$3 = (struct syment *) 0x4dcbc10
(gdb) p lm->symtable[3]
$4 = (struct syment *) 0x0
(gdb) p lm->symtable[4]
$5 = (struct syment *) 0x4dcbcb0
(gdb) p lm->symtable[5]
$6 = (struct syment *) 0x4dcbd00
(gdb) p lm->symtable[6]
$7 = (struct syment *) 0x0
MOD_RO_AFTER_INIT(3) and MOD_INIT_RODATA(6) do not exist, which should
be skipped, otherwise the segmentation fault will happen.
Fixes: 7750e61fdb2a ("Support module memory layout change on Linux 6.4")
Closes: https://github.com/crash-utility/crash/issues/176
Reported-by: Naveen Chaudhary <naveenchaudhary2010@hotmail.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
Conflict: NA
Reference:https://github.com/crash-utility/crash/commit/ced754d3f8ce796d0d894dbb0f340e9c905c206a
---
symbols.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/symbols.c b/symbols.c
index cbc9ed13..b7627a83 100644
--- a/symbols.c
+++ b/symbols.c
@@ -5577,6 +5577,9 @@ value_search_module_6_4(ulong value, ulong *offset)
continue;
for_each_mod_mem_type(t) {
+ if (!lm->symtable[t])
+ continue;
+
sp = lm->symtable[t];
sp_end = lm->symend[t];

View File

@ -1,6 +1,6 @@
Name: crash
Version: 8.0.4
Release: 12
Release: 7
Summary: Linux kernel crash utility.
License: GPLv3
URL: https://crash-utility.github.io
@ -9,18 +9,11 @@ Source1: http://ftp.gnu.org/gnu/gdb/gdb-10.2.tar.gz
Patch0: 0000-lzo_snappy.patch
Patch1: 0001-add-SDEI-stack-resolution.patch
%ifarch sw_64
Patch2: 0002-crash-8.0.4-sw64.patch
%else
%ifarch loongarch64
Patch2: 0002-crash-8.0.2-sw.patch
Patch3: 0003-crash-8.0.4-add-support-for-loongarch64.patch
Patch4: 0004-support-vmp_area_list-replaced-with-VMALLOC_START.patch
%endif
Patch5: 0005-gdb-ignore-Wenum-constexpr-conversion-in-enum-flags.patch
Patch6: 0006-arm64-fix-a-potential-segfault-when-unwind-frame.patch
Patch7: 0007-arm64-fix-SDEI-stack-frame-unwind-while-UNW_4_14-is-.patch
Patch8: 0008-Fix-segmentation-fault-in-value_search_module_6_4.patch
%endif
BuildRequires: ncurses-devel zlib-devel lzo-devel snappy-devel texinfo libzstd-devel
BuildRequires: gcc gcc-c++ bison m4
@ -51,21 +44,18 @@ created by manufacturer-specific firmware.
%package_help
%prep
%ifarch sw_64
%autosetup -n %{name}-%{version} -p1
%else
%setup -n %{name}-%{version}
%setup -q -n %{name}-%{version}
%patch0 -p1
%patch1 -p1
%ifarch sw_64
%patch2 -p1
%endif
%ifarch loongarch64
%patch3 -p1
%patch4 -p1
%endif
%autopatch -m5 -p1
%endif
%patch5 -p1
%patch6 -p1
%build
cp %{SOURCE1} .
@ -100,22 +90,6 @@ install -D -m 0644 defs.h %{buildroot}%{_includedir}/%{name}/defs.h
%{_mandir}/man8/crash.8*
%changelog
* Mon Apr 28 2025 wangxiao <wangxiao184@h-partners.com> - 8.0.4-12
- fix segmentation fault in value_search_module_6_4()
* Tue Apr 15 2025 Gu Zitao <guzitao@wxiat.com> - 8.0.4-11
- crash: add support for sw64
* Thu Dec 05 2024 shenzhongwei <shenzhongwei@kylinos.cn> - 8.0.4-10
- remove the architecture judgment in the patches section;
- include all patches in the source package.
* Fri Nov 29 2024 wangxiao <wangxiao184@h-partners.com> - 8.0.4-9
- arm64: fix SDEI stack frame unwind while UNW_4_14 is set
* Wed Nov 13 2024 wangxiao <wangxiao184@h-partners.com> - 8.0.4-8
- use autosetup instead of setup in prep stage
* Tue Nov 12 2024 wangxiao <wangxiao184@h-partners.com> - 8.0.4-7
- arm64: fix a potential segfault when unwind frame