Compare commits
10 Commits
2705e4112d
...
a49fbc8cbb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a49fbc8cbb | ||
|
|
9f0de9c614 | ||
|
|
b037ce9209 | ||
|
|
bfbf8b025b | ||
|
|
a757a46004 | ||
|
|
32b5e082ae | ||
|
|
d63ecf1639 | ||
|
|
32d52fa656 | ||
|
|
b84f732053 | ||
|
|
fa5583ea73 |
@ -17211,7 +17211,7 @@ index 3907863..e977ae8 100644
|
||||
static void check_dumpfile_size(char *);
|
||||
static int proc_kcore_init_32(FILE *, int);
|
||||
static int proc_kcore_init_64(FILE *, int);
|
||||
@@ -217,6 +218,11 @@ is_netdump(char *file, ulong source_query)
|
||||
@@ -314,6 +315,11 @@ is_netdump(char *file, ulong source_query)
|
||||
source_query))
|
||||
goto bailout;
|
||||
break;
|
||||
|
||||
71
0006-arm64-fix-a-potential-segfault-when-unwind-frame.patch
Normal file
71
0006-arm64-fix-a-potential-segfault-when-unwind-frame.patch
Normal file
@ -0,0 +1,71 @@
|
||||
From af895b219876b293d551e6dec825aba3905c0588 Mon Sep 17 00:00:00 2001
|
||||
From: "qiwu.chen" <qiwu.chen@transsion.com>
|
||||
Date: Wed, 24 Jul 2024 01:36:09 +0000
|
||||
Subject: [PATCH] arm64: fix a potential segfault when unwind frame
|
||||
|
||||
The range of frame->fp is checked insufficiently, which may lead to a wrong
|
||||
next fp. As a result, bt->stackbuf will be accessed out of range, and segfault.
|
||||
|
||||
crash> bt
|
||||
[Detaching after fork from child process 11409]
|
||||
PID: 7661 TASK: ffffff81858aa500 CPU: 4 COMMAND: "sh"
|
||||
#0 [ffffffc008003f50] local_cpu_stop at ffffffdd7669444c
|
||||
|
||||
Thread 1 "crash" received signal SIGSEGV, Segmentation fault.
|
||||
0x00005555558266cc in arm64_unwind_frame (bt=0x7fffffffd8f0, frame=0x7fffffffd080) at
|
||||
arm64.c:2821
|
||||
2821 frame->fp = GET_STACK_ULONG(fp);
|
||||
(gdb) bt
|
||||
arm64.c:2821
|
||||
out>) at main.c:1338
|
||||
gdb_interface.c:81
|
||||
(gdb) p /x *(struct bt_info*) 0x7fffffffd8f0
|
||||
$3 = {task = 0xffffff81858aa500, flags = 0x0, instptr = 0xffffffdd76694450, stkptr =
|
||||
0xffffffc008003f40, bptr = 0x0, stackbase = 0xffffffc027288000,
|
||||
stacktop = 0xffffffc02728c000, stackbuf = 0x555556115a40, tc = 0x55559d16fdc0, hp = 0x0,
|
||||
textlist = 0x0, ref = 0x0, frameptr = 0xffffffc008003f50,
|
||||
call_target = 0x0, machdep = 0x0, debug = 0x0, eframe_ip = 0x0, radix = 0x0, cpumask =
|
||||
0x0}
|
||||
(gdb) p /x *(struct arm64_stackframe*) 0x7fffffffd080
|
||||
$4 = {fp = 0xffffffc008003f50, sp = 0xffffffc008003f60, pc = 0xffffffdd76694450}
|
||||
crash> bt -S 0xffffffc008003f50
|
||||
PID: 7661 TASK: ffffff81858aa500 CPU: 4 COMMAND: "sh"
|
||||
bt: non-process stack address for this task: ffffffc008003f50
|
||||
(valid range: ffffffc027288000 - ffffffc02728c000)
|
||||
|
||||
Check frame->fp value sufficiently before access it. Only frame->fp within
|
||||
the range of bt->stackbase and bt->stacktop will be regarded as valid.
|
||||
|
||||
Signed-off-by: qiwu.chen <qiwu.chen@transsion.com>
|
||||
|
||||
Conflict: NA
|
||||
Reference: https://github.com/crash-utility/crash/commit/af895b219876b293d551e6dec825aba3905c0588
|
||||
---
|
||||
arm64.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/arm64.c b/arm64.c
|
||||
index b3040d7..624dba2 100644
|
||||
--- a/arm64.c
|
||||
+++ b/arm64.c
|
||||
@@ -2814,7 +2814,7 @@ arm64_unwind_frame(struct bt_info *bt, struct arm64_stackframe *frame)
|
||||
low = frame->sp;
|
||||
high = (low + stack_mask) & ~(stack_mask);
|
||||
|
||||
- if (fp < low || fp > high || fp & 0xf)
|
||||
+ if (fp < low || fp > high || fp & 0xf || !INSTACK(fp, bt))
|
||||
return FALSE;
|
||||
|
||||
frame->sp = fp + 0x10;
|
||||
@@ -3024,7 +3024,7 @@ arm64_unwind_frame_v2(struct bt_info *bt, struct arm64_stackframe *frame,
|
||||
low = frame->sp;
|
||||
high = (low + stack_mask) & ~(stack_mask);
|
||||
|
||||
- if (fp < low || fp > high || fp & 0xf)
|
||||
+ if (fp < low || fp > high || fp & 0xf || !INSTACK(fp, bt))
|
||||
return FALSE;
|
||||
|
||||
if (CRASHDEBUG(1))
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -0,0 +1,46 @@
|
||||
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
|
||||
|
||||
41
crash.spec
41
crash.spec
@ -1,6 +1,6 @@
|
||||
Name: crash
|
||||
Version: 8.0.4
|
||||
Release: 5
|
||||
Release: 10
|
||||
Summary: Linux kernel crash utility.
|
||||
License: GPLv3
|
||||
URL: https://crash-utility.github.io
|
||||
@ -9,10 +9,16 @@ 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.2-sw.patch
|
||||
##%endif
|
||||
##%ifarch loongarch64
|
||||
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
|
||||
|
||||
BuildRequires: ncurses-devel zlib-devel lzo-devel snappy-devel texinfo libzstd-devel
|
||||
BuildRequires: gcc gcc-c++ bison m4
|
||||
@ -43,17 +49,20 @@ created by manufacturer-specific firmware.
|
||||
%package_help
|
||||
|
||||
%prep
|
||||
%setup -q -n %{name}-%{version}
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%setup -n %{name}-%{version}
|
||||
|
||||
%patch 0 -p1
|
||||
%patch 1 -p1
|
||||
|
||||
%ifarch sw_64
|
||||
%patch2 -p1
|
||||
%patch 2 -p1
|
||||
%endif
|
||||
%ifarch loongarch64
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch 3 -p1
|
||||
%patch 4 -p1
|
||||
%endif
|
||||
%patch5 -p1
|
||||
|
||||
%autopatch -m5 -p1
|
||||
|
||||
%build
|
||||
cp %{SOURCE1} .
|
||||
@ -88,6 +97,22 @@ install -D -m 0644 defs.h %{buildroot}%{_includedir}/%{name}/defs.h
|
||||
%{_mandir}/man8/crash.8*
|
||||
|
||||
%changelog
|
||||
* 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
|
||||
|
||||
* Fri Oct 25 2024 duanchenghao <duanchenghao@kylinos.cn> - 8.0.4-6
|
||||
- Fix crash vmlinux /proc/kcore failed for loongarch64
|
||||
|
||||
* Fri Sep 06 2024 yanying <201250106@smail.nju.edu.cn> - 8.0.4-5
|
||||
- Add gdbsupport ignore Wenum-constexpr-conversion in enum-flags.h to fix clang build error
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user