Compare commits

...
Author SHA1 Message Date
openeuler-ci-bot 5339677e07 !169 Fix for 'sys' to properly display the PANIC message
From: @lliuzhi 
Reviewed-by: @dillon_chen 
Signed-off-by: @dillon_chen
2025-07-16 02:52:20 +00:00
liuzhilin 1f5422d4e0 Fix for 'sys' to properly display the PANIC message 2025-07-16 10:13:42 +08:00
openeuler-ci-bot 212a160214 !162 use patch command to apply patches for consistency in context
From: @wangxiao65 
Reviewed-by: @wangbin224 
Signed-off-by: @wangbin224
2025-06-12 10:56:08 +00:00
wangxiao65 6b2a64b805 use patch command to apply patches for consistency in context 2025-06-10 08:50:27 +08:00
openeuler-ci-bot c796f06fd0 !161 fix ps error when mm_struct.rss_stat is not initialized
From: @mszjaas 
Reviewed-by: @dillon_chen 
Signed-off-by: @dillon_chen
2025-05-21 06:03:33 +00:00
zhangjian bc29223016 fix ps error when mm_struct.rss_stat is not initialized
Signed-off-by: zhangjian <zhangjian496@huawei.com>
2025-05-21 02:10:51 +00:00
openeuler-ci-bot 71e3e151b7 !130 修复源码包同源异构问题
From: @dev11101 
Reviewed-by: @dillon_chen 
Signed-off-by: @dillon_chen
2024-12-04 09:28:35 +00:00
yangzhenyu c1acd180ba * remove the architecture judgment in the patches section; include all patches in the source package.
Signed-off-by: yangzhenyu <dev11101@linx-info.com>
2024-12-04 11:31:43 +08:00
openeuler-ci-bot 005a7d5d08 !121 arm64: fix SDEI stack frame unwind while UNW_4_14 is set
From: @legezywzh 
Reviewed-by: @dillon_chen 
Signed-off-by: @dillon_chen
2024-11-21 08:50:34 +00:00
Xiaoguang Wang 5ef358c380 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: e956a09318 ("crash: add SDEI stack resolution")
Signed-off-by: Xiaoguang Wang <lege.wang@jaguarmicro.com>
2024-11-21 13:59:54 +08:00
openeuler-ci-bot 8c2399d3d2 !119 use autosetup instead of setup in prep stage
From: @wangxiao65 
Reviewed-by: @wangbin224 
Signed-off-by: @wangbin224
2024-11-19 03:08:20 +00:00
wangxiao65 b0d5dd70e6 use autosetup instead of setup in prep stage 2024-11-13 06:36:40 +00:00
openeuler-ci-bot 2c909cde03 !115 arm64:fix a potential segfault when unwind frame
From: @wangxiao65 
Reviewed-by: @wangbin224 
Signed-off-by: @wangbin224
2024-11-12 08:20:31 +00:00
wangxiao65 9f2a36ea5a arm64: fix a potential segfault when unwind frame 2024-11-12 06:19:37 +00:00
openeuler-ci-bot 33205097e6 !113 Fix build warning:%patchN is deprecated (3 usages found), use %patch N
From: @xugmin 
Reviewed-by: @dillon_chen 
Signed-off-by: @dillon_chen
2024-11-11 03:17:39 +00:00
xuguangmin cdfe8f6bca Fix build warning:%patchN is deprecated (3 usages found), use %patch N 2024-11-05 16:41:43 +08:00
openeuler-ci-bot 4ab1426cd8 !98 update to 8.0.5
From: @dillon_chen 
Reviewed-by: @overweight 
Signed-off-by: @overweight
2024-07-26 05:26:18 +00:00
dillon_chen 40d806a730 update to 8.0.5 2024-07-25 16:48:58 +08:00
openeuler-ci-bot 22b05b1b37 !95 [sync] PR-94: 修复loongarch64和sw_64平台的patch在x86_64或其他平台编译出来的源码包中丢失的问题
From: @openeuler-sync-bot 
Reviewed-by: @wangbin224 
Signed-off-by: @wangbin224
2024-06-29 08:11:43 +00:00
孤独的大河马在躺平 58a3a4d98a Fix lack of loongarch64 and sw_64 patche files in src.rpm package which is build from any platform
Signed-off-by: 孤独的大河马在躺平 <shaojiansong@kylinos.cn>
(cherry picked from commit 37379101f9)
2024-06-29 15:34:35 +08:00
openeuler-ci-bot 9eb2aa13b8 !93 Resolve loongarch64 patch add error and add support for loongarch64
From: @dpdwaj 
Reviewed-by: @wangbin224 
Signed-off-by: @wangbin224
2024-04-23 08:32:45 +00:00
doupengda d32856d64d Resolve loongarch64 patch add error and add support for loongarch64 2024-04-16 09:57:29 +08:00
openeuler-ci-bot 66daec136b !91 Upgrade to crash-8.0.4
From: @chenhaixaing 
Reviewed-by: @wangbin224 
Signed-off-by: @wangbin224
2024-02-19 12:10:10 +00:00
chenhaixiang 1b3ca1f15b Upgrade to crash-8.0.4
Signed-off-by chenhaixiang3@huawei.com
2024-01-25 14:32:19 +08:00
openeuler-ci-bot b7f4deb953 !90 Fix compilation error due to new strlcpy function that glibc added
From: @chenhaixaing 
Reviewed-by: @wangbin224 
Signed-off-by: @wangbin224
2023-08-01 12:56:21 +00:00
chenhaixiang 677ac816c7 Fix compilation error due to new strlcpy function that glibc added
Signed-off-by: chenhaixiang3@huawei.com
2023-08-01 08:22:41 -04:00
openeuler-ci-bot 6e03baeeb3 !83 添加LoongArch64架构支持
From: @robinorg 
Reviewed-by: @wangbin224 
Signed-off-by: @wangbin224
2023-07-11 12:08:07 +00:00
Ming Wang 2279f9696c crash: add LoongArch64 support.
Signed-off-by: Ming Wang <wangming01@loongson.cn>
2023-07-11 17:35:43 +08:00
openeuler-ci-bot 93007e8507 !82 Add riscv64 support
From: @East_x 
Reviewed-by: @wangbin224 
Signed-off-by: @wangbin224
2023-07-07 06:13:46 +00:00
EastDong 3405fc720c add riscv support 2023-07-07 11:43:54 +08:00
openeuler-ci-bot cdaa074d92 !79 update to crash-8.0.2
From: @chenhaixaing 
Reviewed-by: @wangbin224 
Signed-off-by: @wangbin224
2023-02-11 01:33:11 +00:00
chenhaixiang f73fa2f432 update to crash-8.0.2
Signed-off-by:chenhaixiang <chenhaixiang3@huawei.com>
2023-02-10 19:39:15 +08:00
openeuler-ci-bot a1f1597b2c !77 fix segfault by "bt" command with offline cpus
From: @lijianglin6 
Reviewed-by: @wangbin224 
Signed-off-by: @wangbin224
2023-01-04 08:27:16 +00:00
l30029166 d30bfa99c6 fix segfault by "bt" command with offline cpus 2023-01-04 15:52:06 +08:00
openeuler-ci-bot 20acea475c !73 modifiy patch description to keep upstream info
From: @huskartang 
Reviewed-by: @wangbin224 
Signed-off-by: @wangbin224
2022-12-29 11:06:45 +00:00
huskarTang 3652955d20 keep upstream info in patches 2022-12-29 17:00:53 +08:00
openeuler-ci-bot 2cbdc492a3 !72 Fix the value of TIF_SIGPENDING macro
From: @huskartang 
Reviewed-by: @wangbin224 
Signed-off-by: @wangbin224
2022-12-29 07:37:00 +00:00
huskarTang 56bd067f8d Fix the value of TIF_SIGPENDING macro
Correct the change of the value of TIF_SIGPENDING macro between
different kernel versions.

TIF_SIGPENDING changes with the kernel version as follows:
ARM     2 -> 0 at v2.6.23
MIPS    2 -> 1 at v2.6.23
MIPS64  2 -> 1 at v2.6.23
PPC     2 -> 1 at v2.6.23
IA64    1 -> 0 at v2.6.23
PPC64   2 -> 1 at v2.6.23
S390    2 -> 1 at v3.16
S390X   2 -> 1 at v3.16
2022-12-29 14:44:28 +08:00
openeuler-ci-bot 2c37844741 !71 Fix 'kmem -s|-S' option on Linux 5.7 and later kernels
From: @huskartang 
Reviewed-by: @wangbin224 
Signed-off-by: @wangbin224
2022-12-29 06:36:30 +00:00
huskarTang bd3bd6b94d Fix 'kmem -s|-S' option on Linux 5.7 and later kernels 2022-12-29 13:00:01 +08:00
openeuler-ci-bot 5e1c30fc74 !70 arm64: Add lowercase tcr_el1_t1sz
From: @huskartang 
Reviewed-by: @wangbin224 
Signed-off-by: @wangbin224
2022-12-29 03:42:33 +00:00
huskarTang 65b1724263 Add lowercase tcr_el1_t1sz 2022-12-29 11:19:03 +08:00
openeuler-ci-bot 944f493144 !69 rename pathes to keep in order
From: @huskartang 
Reviewed-by: @wangbin224 
Signed-off-by: @wangbin224
2022-12-29 01:08:24 +00:00
huskarTang 2523dc8464 format patch names 2022-12-28 21:57:59 +08:00
openeuler-ci-bot 92e8df10e8 !64 Fix aarch64 KASAN 内核kdump,crash工具bt无法显示宕机堆栈
From: @ch-cityhunter 
Reviewed-by: @wangbin224 
Signed-off-by: @wangbin224
2022-12-09 02:43:43 +00:00
Ding Hui d38a008f23 fix backtraces of arm64 KASAN kernel dumpfile truncated
bugzilla: https://gitee.com/src-openeuler/crash/issues/I64FYG

apply upstream
https://listman.redhat.com/archives/crash-utility/2022-December/010288.html
and port for SDEI stack

Signed-off-by: Ding Hui <dinghui@sangfor.com.cn>
2022-12-06 08:57:29 +08:00
openeuler-ci-bot 444394d999 !60 添加sw架构
From: @wuzx065891 
Reviewed-by: @wangbin224 
Signed-off-by: @wangbin224
2022-10-28 06:34:13 +00:00
wzx 634549d7d8 Add sw64 architecture
Signed-off-by: wzx <wuzx1226@qq.com>
2022-10-19 14:34:47 +08:00
openeuler-ci-bot cd51f25ab6 !52 Handle task_struct cpu member changes for kernels >= 5.16-rc1
From: @wangbin224 
Reviewed-by: @hanxinke 
Signed-off-by: @hanxinke
2022-02-23 13:18:55 +00:00
Bin Wang c09fcc8583 Handle task_struct cpu member changes for kernels >= 5.16-rc1
Kernel commit bcf9033e5449bdcaa9bed46467a7141a8049dadb
("sched: move CPU field back into thread_info if THREAD_INFO_IN_TASK=y")
moved the member cpu of task_struct back into thread_info.
Without the patch, crash fails with the following error message
during session initialization:

  crash: invalid structure member offset: task_struct_cpu
FILE: task.c  LINE: 2904  FUNCTION: add_context()

And delete use_system_readline_v3.patch. Use readline provided by
internal gdb instead of system readline. System readline do not
match crash, and will cause a Segmentation fault when parse corefile.

Signed-off-by: Bin Wang <wangbin224@huawei.com>
2022-02-23 20:49:56 +08:00
openeuler-ci-bot 3177491352 !50 revert to fix null pointer reference when CONFIG_KASAN is open
From: @zhouwenpei 
Reviewed-by: @hanxinke 
Signed-off-by: @hanxinke
2022-02-22 09:21:17 +00:00
zhouwenpei 113036b569 revert to fix null pointer reference when CONFIG_KASAN is open 2022-02-08 11:23:34 +08:00
openeuler-ci-bot 4bf9c5b493 !46 add SDEI stack resolution
Merge pull request !46 from zhouwenpei/master
2022-01-20 08:04:30 +00:00
zhouwenpei e956a09318 add SDEI stack resolution 2021-12-31 11:30:02 +08:00
openeuler-ci-bot 02f014ace3 !43 fix seek error “IRQ stack pointer”
Merge pull request !43 from zhouwenpei/master
2021-12-30 12:36:58 +00:00
zhouwenpei 6cef8b237f fix seek error IRQ stack pointer 2021-12-30 17:33:21 +08:00
openeuler-ci-bot c10dc6cb03 !41 update verion to 7.3.0
Merge pull request !41 from zhouwenpei/master
2021-12-25 07:02:02 +00:00
zhouwenpei a70be530b9 update verion to 7.3.0 2021-11-30 20:13:30 +08:00
openeuler-ci-bot ab795fc7d2 !40 crash:fix null pointer reference when CONFIG_KASAN is open
From: @wangbin224
Reviewed-by: @overweight
Signed-off-by: @overweight
2021-09-06 01:34:35 +00:00
wangbin 1882a00b9d crash: fix null pointer reference when CONFIG_KASAN is open
If CONFIG_KASAN is open, CONFIG_VMAP_STACK will be closed. And
the sdei_stack_normal_ptr will be undefined. When crash init the
stack, sdei_stacks will not init. We should not access the sdei_stacks
later, so check null pointer before access it.

Signed-off-by: wangbin <wangbin224@huawei.com>
2021-09-03 16:14:17 +08:00
openeuler-ci-bot 0cec8d7d9d !39 add buildrequire m4
From: @zhouwenpei
Reviewed-by: @miao_kaibo
Signed-off-by: @miao_kaibo
2021-06-30 02:05:04 +00:00
zhouwenpei f617707973 add buildrequire m4 2021-06-29 15:42:34 +08:00
openeuler-ci-bot 11fb8fbbe1 !35 add -j option for building efficiency optimization
From: @tong_1001
Reviewed-by: @overweight
Signed-off-by: @overweight
2021-05-11 09:32:39 +08:00
tong_1001 31d3ad5c28 add -j option for building efficiency optimization 2021-05-10 19:21:50 +08:00
openeuler-ci-bot 5d01663dd2 !32 fix patch issue in upgrade version commit
From: @tong_1001
Reviewed-by: @overweight
Signed-off-by: @overweight
2021-04-09 14:11:45 +08:00
shixuantong 6919abe3d9 fix patch issue in upgrade version commit 2021-04-08 22:59:03 +08:00
openeuler-ci-bot 7071dccd38 !31 upgrade version to 7.2.9
From: @run-is-pig
Reviewed-by: @overweight
Signed-off-by: @overweight
2021-02-01 17:18:10 +08:00
renmingshuai 2424f9464a Upgrade version to 7.2.9 2021-02-01 11:37:13 +08:00
openeuler-ci-bot d2d69873fc !23 Update Source0, URL, add Source1 and update tarball from upstream release
From: @tong_1001
Reviewed-by: @licihua
Signed-off-by: @licihua
2020-12-12 10:43:23 +08:00
桐小哥 cee9e7e661 Update Source0, URL, add Source1 and update tarball from upstream release 2020-12-12 10:15:44 +08:00
openeuler-ci-bot d3818a5e01 !11 Restore Source0 and URL
Merge pull request !11 from 桐小哥/master
2020-09-09 11:08:50 +08:00
桐小哥 34fc28b7de Restore Source0 and URL 2020-09-08 17:19:25 +08:00
openeuler-ci-bot 0d9718b7d2 !10 【轻量级 PR】:修正笔误
Merge pull request !10 from Monday/N/A
2020-08-22 09:50:51 +08:00
Monday 2d72ef22c1 修正笔误 2020-08-13 19:37:15 +08:00
openeuler-ci-bot 3073692d70 !8 update yaml file
Merge pull request !8 from 桐小哥/master
2020-08-13 19:36:48 +08:00
桐小哥 a0adc6ce87 update crash.yaml. 2020-08-13 18:58:12 +08:00
openeuler-ci-bot 01041dae1c !6 crash
Merge pull request !6 from xinghe/master
2020-07-29 09:17:30 +08:00
jinzhimin369 341a661cd7 update version 2020-07-28 11:14:39 +08:00
openeuler-ci-bot 8fd1ee9de0 !5 crash
Merge pull request !5 from xinghe/master
2020-07-28 09:36:28 +08:00
weiwei_150212 76806288cc update version 2020-07-28 09:09:30 +08:00
19909236985 6a3a22c4cf add yaml file in package 2020-07-28 09:09:29 +08:00
openeuler-ci-bot a83f4a2d78 !3 add yaml file in package
Merge pull request !3 from 吴超超/master
2020-06-15 09:03:18 +08:00
19909236985 79e971434c add yaml file in package 2020-06-13 19:20:03 +08:00
14 changed files with 20929 additions and 190 deletions
+9 -8
View File
@@ -1,22 +1,23 @@
--- crash-7.1.4/diskdump.c.orig
+++ crash-7.1.4/diskdump.c
@@ -23,6 +23,8 @@
--- crash-8.0.4/diskdump.c.orig
+++ crash-8.0.4/diskdump.c
@@ -23,6 +23,9 @@
* GNU General Public License for more details.
*/
+#define LZO
+#define SNAPPY
+#define ZSTD
#include "defs.h"
#include "diskdump.h"
#include "xen_dom0.h"
--- crash-7.1.4/Makefile.orig
+++ crash-7.1.4/Makefile
@@ -228,7 +228,7 @@ all: make_configure
--- crash-8.0.4/Makefile.orig
+++ crash-8.0.4/Makefile
@@ -256,7 +256,7 @@ all: make_configure
gdb_merge: force
@if [ ! -f ${GDB}/README ]; then \
make --no-print-directory gdb_unzip; fi
$(MAKE) gdb_unzip; fi
- @echo "${LDFLAGS} -lz -ldl -rdynamic" > ${GDB}/gdb/mergelibs
+ @echo "${LDFLAGS} -lz -llzo2 -lsnappy -ldl -rdynamic" > ${GDB}/gdb/mergelibs
+ @echo "${LDFLAGS} -lz -llzo2 -lsnappy -lzstd -ldl -rdynamic" > ${GDB}/gdb/mergelibs
@echo "../../${PROGRAM} ../../${PROGRAM}lib.a" > ${GDB}/gdb/mergeobj
@rm -f ${PROGRAM}
@if [ ! -f ${GDB}/config.status ]; then \
@@ -31,40 +31,38 @@ PID: 55429 TASK: ffff802772e3ae80 CPU: 19 COMMAND: "insmod"
Signed-off-by: Jialong Chen <chenjialong@huawei.com>
---
arm64.c | 210 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
arm64.c | 213 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
defs.h | 3 +
2 files changed, 209 insertions(+), 4 deletions(-)
2 files changed, 212 insertions(+), 4 deletions(-)
diff --git a/arm64.c b/arm64.c
index 4ee53ce..95e7d72 100644
index c3e26a3..d293e6c 100644
--- a/arm64.c
+++ b/arm64.c
@@ -82,6 +82,10 @@ static int arm64_get_crash_notes(void);
static void arm64_calc_VA_BITS(void);
static int arm64_is_uvaddr(ulong, struct task_context *);
@@ -93,6 +93,11 @@ static void arm64_calc_VA_BITS(void);
static void arm64_calc_KERNELPACMASK(void);
static int arm64_get_vmcoreinfo(unsigned long *vaddr, const char *label, int base);
+static int arm64_in_sdei_normal_stack(int cpu, ulong stkptr);
+static void arm64_set_sdei_normal_stack(struct bt_info *bt);
+static void arm64_sdei_stack_init(void);
+static int arm64_in_kdump_text_on_sdei_stack(struct bt_info *bt);
/*
* Do all necessary machine-specific setup here. This is called several times
@@ -406,6 +410,7 @@ arm64_init(int when)
+
struct kernel_range {
unsigned long modules_vaddr, modules_end;
unsigned long vmalloc_start_addr, vmalloc_end;
@@ -520,6 +525,7 @@ arm64_init(int when)
arm64_irq_stack_init();
arm64_overflow_stack_init();
arm64_stackframe_init();
+ arm64_sdei_stack_init();
break;
case POST_VM:
@@ -1446,6 +1451,70 @@ arm64_irq_stack_init(void)
readmem(p, KVADDR, &(ms->irq_stacks[i]), sizeof(ulong),
"IRQ stack pointer", RETURN_ON_ERROR);
}
+ }
+}
+
case POST_INIT:
@@ -2174,6 +2180,70 @@ arm64_irq_stack_init(void)
}
}
+/*
+ * Gather IRQ stack values.
+ */
@@ -126,37 +124,40 @@ index 4ee53ce..95e7d72 100644
+ readmem(p, KVADDR, &(ms->sdei_stacks[i]), sizeof(ulong),
+ "SDEI stack pointer", RETURN_ON_ERROR);
+ }
}
}
@@ -1943,7 +2012,7 @@ arm64_unwind_frame(struct bt_info *bt, struct arm64_stackframe *frame)
+ }
+}
+
/*
* Gather Overflow stack values.
*
@@ -2736,7 +2806,7 @@ arm64_unwind_frame(struct bt_info *bt, struct arm64_stackframe *frame)
{
unsigned long high, low, fp;
unsigned long stack_mask;
- unsigned long irq_stack_ptr, orig_sp;
+ unsigned long irq_stack_ptr, orig_sp, sdei_stack_ptr;
struct arm64_pt_regs *ptregs;
struct machine_specific *ms;
struct machine_specific *ms = machdep->machspec;
@@ -1971,7 +2040,8 @@ 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)) {
@@ -2765,7 +2835,8 @@ arm64_unwind_frame(struct bt_info *bt, struct arm64_stackframe *frame)
if (((bt->flags & BT_IRQSTACK) &&
!arm64_on_irq_stack(bt->tc->processor, frame->fp)) ||
((bt->flags & BT_OVERFLOW_STACK) &&
- !arm64_on_overflow_stack(bt->tc->processor, frame->fp))) {
+ !arm64_on_overflow_stack(bt->tc->processor, frame->fp)) &&
+ !arm64_in_sdei_normal_stack(bt->tc->processor, frame->fp)) {
if (arm64_on_process_stack(bt, frame->fp)) {
arm64_set_process_stack(bt);
@@ -2012,6 +2082,7 @@ arm64_unwind_frame(struct bt_info *bt, struct arm64_stackframe *frame)
@@ -2805,6 +2876,7 @@ arm64_unwind_frame(struct bt_info *bt, struct arm64_stackframe *frame)
* orig_sp = IRQ_STACK_TO_TASK_STACK(irq_stack_ptr); (pt_regs pointer on process stack)
*/
ms = machdep->machspec;
irq_stack_ptr = ms->irq_stacks[bt->tc->processor] + ms->irq_stack_size - 16;
+ sdei_stack_ptr = ms->sdei_stacks[bt->tc->processor] + ms->sdei_stack_size - 16;
if (frame->sp == irq_stack_ptr) {
orig_sp = GET_STACK_ULONG(irq_stack_ptr - 8);
@@ -2032,6 +2103,25 @@ arm64_unwind_frame(struct bt_info *bt, struct arm64_stackframe *frame)
@@ -2825,6 +2897,25 @@ arm64_unwind_frame(struct bt_info *bt, struct arm64_stackframe *frame)
frame->fp, INSTACK(frame->fp, bt) ? "" : " (?)");
return FALSE;
}
@@ -182,7 +183,7 @@ index 4ee53ce..95e7d72 100644
}
return TRUE;
@@ -2371,6 +2461,10 @@ arm64_back_trace_cmd(struct bt_info *bt)
@@ -3164,6 +3255,10 @@ arm64_back_trace_cmd(struct bt_info *bt)
arm64_set_irq_stack(bt);
bt->flags |= BT_IRQSTACK;
}
@@ -193,39 +194,39 @@ index 4ee53ce..95e7d72 100644
stackframe.fp = GET_STACK_ULONG(bt->bptr - 8);
stackframe.pc = GET_STACK_ULONG(bt->bptr);
stackframe.sp = bt->bptr + 8;
@@ -2380,6 +2474,10 @@ arm64_back_trace_cmd(struct bt_info *bt)
@@ -3173,6 +3268,10 @@ arm64_back_trace_cmd(struct bt_info *bt)
arm64_set_irq_stack(bt);
bt->flags |= BT_IRQSTACK;
}
+ if (arm64_in_sdei_normal_stack(bt->tc->processor, bt->hp->esp)) {
+ if (arm64_in_sdei_normal_stack(bt->tc->processor, bt->bptr)) {
+ arm64_set_sdei_normal_stack(bt);
+ bt->flags |= BT_IRQSTACK;
+ }
stackframe.fp = GET_STACK_ULONG(bt->hp->esp - 8);
stackframe.pc = bt->hp->eip ?
bt->hp->eip : GET_STACK_ULONG(bt->hp->esp);
@@ -2390,6 +2488,10 @@ arm64_back_trace_cmd(struct bt_info *bt)
arm64_set_irq_stack(bt);
bt->flags |= BT_IRQSTACK;
@@ -3186,6 +3285,10 @@ 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->frameptr)) {
+ if (arm64_in_sdei_normal_stack(bt->tc->processor, bt->bptr)) {
+ arm64_set_sdei_normal_stack(bt);
+ bt->flags |= BT_IRQSTACK;
+ }
stackframe.sp = bt->stkptr;
stackframe.pc = bt->instptr;
stackframe.fp = bt->frameptr;
@@ -2451,7 +2553,8 @@ arm64_back_trace_cmd(struct bt_info *bt)
@@ -3249,7 +3352,8 @@ arm64_back_trace_cmd(struct bt_info *bt)
}
if ((bt->flags & BT_IRQSTACK) &&
- !arm64_on_irq_stack(bt->tc->processor, stackframe.fp)) {
+ !arm64_on_irq_stack(bt->tc->processor, stackframe.fp) &&
+ !arm64_in_sdei_normal_stack(bt->tc->processor, stackframe.fp)) {
+ !arm64_on_irq_stack(bt->tc->processor, stackframe.fp) &&
+ !arm64_in_sdei_normal_stack(bt->tc->processor, stackframe.fp)) {
bt->flags &= ~BT_IRQSTACK;
if (arm64_switch_stack(bt, &stackframe, ofp) == USER_MODE)
break;
@@ -2729,6 +2832,79 @@ arm64_in_kdump_text(struct bt_info *bt, struct arm64_stackframe *frame)
@@ -3537,6 +3641,81 @@ arm64_in_kdump_text(struct bt_info *bt, struct arm64_stackframe *frame)
return FALSE;
}
@@ -242,6 +243,8 @@ index 4ee53ce..95e7d72 100644
+ return FALSE;
+
+ ms = machdep->machspec;
+ if (!ms->sdei_stacks)
+ return FALSE;
+ cpu = bt->tc->processor;
+ stackbase = ms->sdei_stacks[cpu];
+ stackbuf = GETBUF(ms->sdei_stack_size);
@@ -258,7 +261,7 @@ index 4ee53ce..95e7d72 100644
+
+ for (ptr = start - 8; ptr >= base; ptr--) {
+ if (bt->flags & BT_OPT_BACK_TRACE) {
+ if ((*ptr >= ms->crash_kexec_start) &&
+ if ((*ptr > ms->crash_kexec_start) &&
+ (*ptr < ms->crash_kexec_end) &&
+ INSTACK(*(ptr - 1), bt)) {
+ bt->bptr = ((ulong)(ptr - 1) - (ulong)base) + stackbase;
@@ -268,7 +271,7 @@ index 4ee53ce..95e7d72 100644
+ FREEBUF(stackbuf);
+ return TRUE;
+ }
+ if ((*ptr >= ms->crash_save_cpu_start) &&
+ if ((*ptr > ms->crash_save_cpu_start) &&
+ (*ptr < ms->crash_save_cpu_end) &&
+ INSTACK(*(ptr - 1), bt)) {
+ bt->bptr = ((ulong)(ptr - 1) - (ulong)base) + stackbase;
@@ -279,7 +282,7 @@ index 4ee53ce..95e7d72 100644
+ return TRUE;
+ }
+ } else {
+ if ((*ptr >= ms->crash_kexec_start) && (*ptr < ms->crash_kexec_end)) {
+ if ((*ptr > ms->crash_kexec_start) && (*ptr < ms->crash_kexec_end)) {
+ bt->bptr = ((ulong)ptr - (ulong)base) + stackbase;
+ if (CRASHDEBUG(1))
+ fprintf(fp, "%lx: %lx (crash_kexec on IRQ stack)\n",
@@ -287,7 +290,7 @@ index 4ee53ce..95e7d72 100644
+ FREEBUF(stackbuf);
+ return TRUE;
+ }
+ if ((*ptr >= ms->crash_save_cpu_start) && (*ptr < ms->crash_save_cpu_end)) {
+ if ((*ptr > ms->crash_save_cpu_start) && (*ptr < ms->crash_save_cpu_end)) {
+ bt->bptr = ((ulong)ptr - (ulong)base) + stackbase;
+ if (CRASHDEBUG(1))
+ fprintf(fp, "%lx: %lx (crash_save_cpu on IRQ stack)\n",
@@ -305,18 +308,18 @@ index 4ee53ce..95e7d72 100644
static int
arm64_in_kdump_text_on_irq_stack(struct bt_info *bt)
{
@@ -2876,7 +3052,8 @@ try_kernel:
@@ -3727,7 +3906,8 @@ try_kernel:
}
if (arm64_in_kdump_text(bt, frame) ||
- arm64_in_kdump_text_on_irq_stack(bt))
- arm64_in_kdump_text_on_irq_stack(bt)) {
+ arm64_in_kdump_text_on_irq_stack(bt) ||
+ arm64_in_kdump_text_on_sdei_stack(bt))
+ arm64_in_kdump_text_on_sdei_stack(bt)) {
bt->flags |= BT_KDUMP_ADJUST;
return TRUE;
@@ -3563,6 +3740,31 @@ arm64_in_alternate_stack(int cpu, ulong stkptr)
return FALSE;
if (skip && is_idle_thread(bt->task))
bt->flags |= BT_SKIP_IDLE;
@@ -4488,6 +4668,31 @@ arm64_on_overflow_stack(int cpu, ulong stkptr)
ms->overflow_stacks, ms->overflow_stack_size);
}
+static int
@@ -327,7 +330,7 @@ index 4ee53ce..95e7d72 100644
+ if (!ms->sdei_stack_size || (cpu >= kt->cpus))
+ return FALSE;
+
+ if ((stkptr >= ms->sdei_stacks[cpu]) &&
+ if ((stkptr > ms->sdei_stacks[cpu]) &&
+ (stkptr < (ms->sdei_stacks[cpu] + ms->sdei_stack_size)))
+ return TRUE;
+
@@ -348,10 +351,10 @@ index 4ee53ce..95e7d72 100644
arm64_set_irq_stack(struct bt_info *bt)
{
diff --git a/defs.h b/defs.h
index d6492c5..ab25a27 100644
index afdcf6c..4885d55 100644
--- a/defs.h
+++ b/defs.h
@@ -3194,6 +3194,9 @@ struct machine_specific {
@@ -3376,6 +3376,9 @@ struct machine_specific {
ulong irq_stack_size;
ulong *irq_stacks;
char *irq_stackbuf;
@@ -360,7 +363,7 @@ index d6492c5..ab25a27 100644
+ char *sdei_stackbuf;
ulong __irqentry_text_start;
ulong __irqentry_text_end;
/* for exception vector code */
ulong overflow_stack_size;
--
2.19.1
2.27.0
+3105
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,72 @@
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
BIN
View File
Binary file not shown.
@@ -0,0 +1,66 @@
From db0077614aaeda6d0ed557f2b91d3349d5fe430f Mon Sep 17 00:00:00 2001
From: Austin Kim <austindh.kim@gmail.com>
Date: Tue, 29 Oct 2024 17:32:07 +0900
Subject: [PATCH] Fix for 'sys' to properly display the PANIC message
Using 'sys' command, we can view the panic message with general system
information. If we run RISCV64-based vmcore, PANIC message is not properly
displayed.
The reason is that the string "Unable to handle kernel" is not
completely matched with the panic_msg[]. The corresponding kernel commit
is 21733cb518471.
Without the patch:
crash> sys
KERNEL: vmlinux [TAINTED]
DUMPFILE: vmcore
CPUS: 4
DATE: Thu Aug 22 16:13:08 KST 2024
UPTIME: 00:33:25
LOAD AVERAGE: 0.07, 0.07, 0.02
TASKS: 385
NODENAME: starfive
RELEASE: 6.6.20+
VERSION: #13 SMP Mon Aug 19 12:58:52 KST 2024
MACHINE: riscv64 (unknown Mhz)
MEMORY: 4 GB
PANIC: ""
With the patch:
crash> sys
KERNEL: vmlinux [TAINTED]
DUMPFILE: vmcore
CPUS: 4
DATE: Thu Aug 22 16:13:08 KST 2024
UPTIME: 00:33:25
LOAD AVERAGE: 0.07, 0.07, 0.02
TASKS: 385
NODENAME: starfive
RELEASE: 6.6.20+
VERSION: #13 SMP Mon Aug 19 12:58:52 KST 2024
MACHINE: riscv64 (unknown Mhz)
MEMORY: 4 GB
PANIC: "Unable to handle kernel access to user memory without uaccess routines at virtual address 0000000000000000"
Signed-off-by: Austin Kim <austindh.kim@gmail.com>
---
task.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/task.c b/task.c
index c131cc32..33de7da2 100644
--- a/task.c
+++ b/task.c
@@ -6392,6 +6392,11 @@ get_panicmsg(char *buf)
get_symbol_data("sysrq_pressed", sizeof(int), &msg_found);
break;
}
+
+ /*
+ * Try to search panic string in panic keywords
+ */
+ search_panic_task_by_keywords(buf, &msg_found);
}
found:
+152 -14
View File
@@ -1,22 +1,28 @@
Name: crash
Version: 7.2.6
Release: 3
Version: 8.0.5
Release: 9
Summary: Linux kernel crash utility.
License: GPLv3
URL: http://people.redhat.com/anderson
Source0: http://people.redhat.com/anderson/%{name}-%{version}.tar.gz
URL: https://crash-utility.github.io
Source0: https://github.com/crash-utility/crash/archive/refs/tags/%{version}.tar.gz
Source1: http://ftp.gnu.org/gnu/gdb/gdb-10.2.tar.gz
Patch0: lzo_snappy.patch
Patch1: use_system_readline_v3.patch
Patch0: 0000-lzo_snappy.patch
Patch1: 0001-add-SDEI-stack-resolution.patch
Patch2: 0002-crash-8.0.2-sw.patch
Patch3: 0003-crash-8.0.4-add-support-for-loongarch64.patch
Patch4: 0004-arm64-fix-a-potential-segfault-when-unwind-frame.patch
Patch5: 0005-arm64-fix-SDEI-stack-frame-unwind-while-UNW_4_14-is-.patch
Patch9001: huawei-fix-ps-error-when-mm_struct.rss_stat-is-lazy-initial.patch
%ifarch riscv64
Patch6: backport-fix-for-sys-to-properly-display-the-PANIC-m.patch
%endif
Patch9000: add-SDEI-stack-resolution.patch
Patch9001: fix-bitmap_len-calculation-overflow-problem-in-large.patch
BuildRequires: ncurses-devel zlib-devel lzo-devel snappy-devel
BuildRequires: gcc gcc-c++ bison readline-devel
BuildRequires: ncurses-devel zlib-devel lzo-devel snappy-devel texinfo libzstd-devel
BuildRequires: gcc gcc-c++ bison m4
Requires: binutils
Provides: bundled(libiberty) bundled(gdb) = 7.6
Provides: bundled(libiberty) bundled(gdb) = 10.2
%description
The core analysis suite is a self-contained tool that can be used to
@@ -41,10 +47,28 @@ created by manufacturer-specific firmware.
%package_help
%prep
%autosetup -n %{name}-%{version} -p1
%setup -n %{name}-%{version}
%patch 0 -p1
%patch 1 -p1
%ifarch sw_64
%patch 2 -p1
%endif
%ifarch loongarch64
%patch 3 -p1
%endif
%patch 4 -p1
%patch 5 -p1
%patch 9001 -p1
%ifarch riscv64
%patch 6 -p1
%endif
%build
make RPMPKG="%{version}-%{release}" CFLAGS="%{optflags}" LDFLAGS="%{build_ldflags}"
cp %{SOURCE1} .
make -j`nproc` RPMPKG="%{version}-%{release}" CFLAGS="%{optflags}" CXXFLAGS="%{optflags}" LDFLAGS="%{build_ldflags}"
%install
rm -rf %{buildroot}
@@ -75,6 +99,120 @@ install -D -m 0644 defs.h %{buildroot}%{_includedir}/%{name}/defs.h
%{_mandir}/man8/crash.8*
%changelog
* Mon Jul 14 2025 liuzhilin <liuzhilin@kylinos.cn> - 8.0.5-9
- backport Fix for 'sys' to properly display the PANIC message patch.
* Wed Jun 04 2025 wangxiao <wangxiao184@h-partners.com> - 8.0.5-8
- use patch command to apply patches for consistency in context
* Wed May 21 2025 zhangjian <zhangjian496@huawei.com> - 8.0.5-7
- fix ps error when mm_struct.rss_stat is lazy initialized
* Wed Dec 04 2024 yangzhenyu <dev11101@linx-info.com> - 8.0.5-6
- remove the architecture judgment in the patches section;
- include all patches in the source package.
* Wed Nov 20 2024 Xiaoguang Wang <lege.wang@jaguarmicro.com> - 8.0.5-5
- arm64: fix SDEI stack frame unwind while UNW_4_14 is set
* Wed Nov 13 2024 wangxiao <wangxiao184@h-partners.com> - 8.0.5-4
- use autosetup instead of setup in prep stage
* Tue Nov 12 2024 wangxiao <wangxiao184@h-partners.com> - 8.0.5-3
- arm64: fix a potential segfault when unwind frame
* Tue Nov 05 2024 xuguangmin <xuguangmin@kylinos.cn> - 8.0.5-2
- Fix build warning:%patchN is deprecated (3 usages found), use %patch N
* Thu Jul 25 2024 dillon chen<dillon.chen@gmail.com> - 8.0.5-1
- Upgrade to crash-8.0.5
* Tue May 28 2024 shaojiansong <shaojiansong@kylinos.cn> - 8.0.4-3
- Fix lack of loongarch64 and sw_64 patch files in src.rpm package which is build from any platform.
* Tue Apr 16 2024 Pengda Dou <doupengda@loongson.cn> - 8.0.4-2
- Resolve loongarch64 patch add error
- add support for loongarch64
* Thu Jan 25 2024 chenhaixiang<chenhaixiang3@huawei.com> - 8.0.4-1
- Upgrade to crash-8.0.4
* Tue Aug 1 2023 chenhaixiang<chenhaixiang3@huawei.com> - 8.0.2-4
- Fix compilation error due to new strlcpy function that glibc added
* Mon Jul 10 2023 wangming <wangming01@loongson.cn> - 8.0.2-3
- add LoongArch64 support.
* Fri Jul 7 2023 EastDong <xudong23@iscas.ac.cn> - 8.0.2-2
- add riscv64 support
* Sun Jan 29 2023 chenhaixiang<chenhaixiang3@huawei.com> - 8.0.2-1
- update to crash-8.0.2
* Wed Jan 4 2023 lijianglin<lijianglin2@huawei.com> - 7.3.0-12
- fix segfault by "bt" command with offline cpus
* Thu Dec 29 2022 huskartang <tanly6@chinatelecom.cn> - 7.3.0-11
- Fix the value of TIF_SIGPENDING macro
* Thu Dec 29 2022 huskartang <tanly6@chinatelecom.cn> - 7.3.0-10
- Fix "kmem -s|-S" option on Linux 5.7 and later kernels
* Thu Dec 29 2022 huskartang <tanly6@chinatelecom.cn> - 7.3.0-9
- Add lowercase tcr_el1_t1sz
* Wed Dec 28 2022 huskartang <tanly6@chinatelecom.cn> - 7.3.0-8
- rename pathes to keep in order
* Thu Dec 1 2022 Ding Hui <dinghui@sangfor.com.cn> - 7.3.0-7
- fix backtraces of arm64 KASAN kernel dumpfile truncated
* Wed Oct 19 2022 wuzx<wuzx1226@qq.com> - 7.3.0-6
- add sw64 patch
* Wed Feb 23 2022 wangbin <wangbin224@huawei.com> - 7.3.0-5
- Handle task_struct cpu member changes for kernels >= 5.16-rc1
and delete use_system_readline_v3.patch
* Tue Feb 8 2022 zhouwenpei <zhouwenpei1@h-partners.com> - 7.3.0-4
- revert to fix null pointer reference when CONFIG_KASAN is open
* Fri Dec 31 2021 zhouwenpei <zhouwenpei1@huawei.com> - 7.3.0-3
- add SDEI stack resolution
* Thu Dec 30 2021 zhouwenpei <zhouwenpei1@huawei.com> - 7.3.0-2
- fix seek error "IRQ stack pointer"
* Tue Nov 30 2021 zhouwenpei <zhouwenpei1@huawei.com> - 7.3.0-1
- Upgrade version to 7.3.0
* Fri Sep 03 2021 wangbin <wangbin224@huawei.com> - 7.2.9-5
- fix null pointer reference when CONFIG_KASAN is open
* Tue Jun 29 2021 zhouwenpei <zhouwenpei1@huawei.com> - 7.2.9-4
- add buildrequires m4
* Mon May 10 2021 shixuantong <shixuantong@huawei.com> - 7.2.9-3
- add -j option for building efficiency optimization
* Thu Apr 08 2021 shixuantong <shixuantong@huawei.com> - 7.2.9-2
- fix patch issue in upgrade version commit
* Mon Feb 1 2021 liudabo <liudabo1@huawei.com> - 7.2.9-1
- Upgrade version to 7.2.9
* Sat Dec 12 2020 shixuantong <shixuantong@huawei.com> - 7.2.8-4
- Update Source0, URL, add Source1 and update tarball from upstream release
* Tue Sep 8 2020 shixuantong <shixuantong@huawei.com> - 7.2.8-3
- Restore Source0 and URL
* Tue Jul 28 2020 xinghe <xinghe1@huawei.com> - 7.2.8-2
- repair the source0
* Mon Jul 27 2020 xinghe <xinghe1@huawei.com> - 7.2.8-1
- update version to 7.2.8
* Sun Jan 19 2020 Yeqing Peng <pengyeqing@huawei.com> - 7.2.6-3
- fix parse vmcore fail.
+5
View File
@@ -0,0 +1,5 @@
git_url: https://github.com/crash-utility/crash.git
version_control: github
src_repo: crash-utility/crash
tag_prefix:
separator: "."
@@ -1,74 +0,0 @@
From f2f36b8acbd0d5b9a5daa57b9b1ff7603f08a917 Mon Sep 17 00:00:00 2001
From: Jialong Chen <chenjialong@huawei.com>
Date: Sat, 13 Jul 2019 17:36:29 +0800
Subject: [PATCH] crash: fix bitmap_len calculation overflow problem in large memory
address
reason: variable overflow causes a logic error in crash.
crash: page excluded: kernel virtual address: ffff0000089c9100 type: "kernel_config_data"
WARNING: cannot read kernel_config_data
crash: page excluded: kernel virtual address: ffff00000911b938 type: "possible"
WARNING: cannot read cpu_possible_map
crash: page excluded: kernel virtual address: ffff00000911b8b8 type: "present"
WARNING: cannot read cpu_present_map
crash: page excluded: kernel virtual address: ffff00000911b838 type: "online"
WARNING: cannot read cpu_online_map
crash: page excluded: kernel virtual address: ffff00000911b9b8 type: "active"
WARNING: cannot read cpu_active_map
crash: page excluded: kernel virtual address: ffff0000093ec9d0 type: "shadow_timekeeper xtime_sec"
crash: page excluded: kernel virtual address: ffff000009124d2c type: "init_uts_ns"
crash: vmlinux and vmcore do not match!
------------------------------------------------------------
602770ecf000-6027ffffffff : System RAM
------------------------------------------------------------
1)
int block_size=(int)sysconf(_SC_PAGESIZE);
off_t bitmap_len;
...
bitmap_len = block_size * header->bitmap_blocks;
bitmap_len overflow.
2)
static inline int
get_bit(char *map, int byte, int bit)
{
return map[byte] & (1<<bit);
}
static inline int
page_is_ram(unsigned long nr)
{
return get_bit(dd->bitmap, nr >> 3, nr & 7);
}
current nr=0x6027fff4f,
byte overflow when call get_bit.
Signed-off-by: Jialong Chen <chenjialong@huawei.com>
---
diskdump.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/diskdump.c b/diskdump.c
index c3e343b..1a2a5ce 100644
--- a/diskdump.c
+++ b/diskdump.c
@@ -233,7 +233,7 @@ clean_diskdump_data(void)
}
static inline int
-get_bit(char *map, int byte, int bit)
+get_bit(char *map, unsigned long byte, int bit)
{
return map[byte] & (1<<bit);
}
@@ -674,7 +674,7 @@ restart:
dd->max_mapnr = header->max_mapnr;
/* read memory bitmap */
- bitmap_len = block_size * header->bitmap_blocks;
+ bitmap_len = (off_t)block_size * header->bitmap_blocks;
dd->bitmap_len = bitmap_len;
offset = (off_t)block_size * (1 + header->sub_hdr_size);
--
2.19.1
Binary file not shown.
@@ -0,0 +1,28 @@
From 45052609f61d5d4ee8286d0d6098e53ea6b199a9 Mon Sep 17 00:00:00 2001
From: zhangjian <zhangjian496@huawei.com>
Date: Wed, 21 May 2025 02:08:12 +0000
Subject: [PATCH] tmp
---
tools.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tools.c b/tools.c
index 0f2db10..727a12c 100644
--- a/tools.c
+++ b/tools.c
@@ -6955,6 +6955,11 @@ percpu_counter_sum_positive(ulong fbc)
readmem(fbc + OFFSET(percpu_counter_counters), KVADDR, &addr,
sizeof(void *), "percpu_counter.counters", FAULT_ON_ERROR);
+ /* maybe mm_struct.rss_stat is lazy initialized */
+ if (!addr) {
+ return ret;
+ }
+
for (i = 0; i < kt->cpus; i++) {
readmem(addr + kt->__per_cpu_offset[i], KVADDR, &count,
sizeof(int), "percpu_counter.counters count", FAULT_ON_ERROR);
--
2.33.0
-32
View File
@@ -1,32 +0,0 @@
--- crash-7.0.7/cmdline.c.orig
+++ crash-7.0.7/cmdline.c
@@ -44,7 +44,8 @@ static int verify_args_input_file(char *
#define READLINE_LIBRARY
#include <readline.h>
-#include <rldefs.h>
+#define vi_mode 0
+#define emacs_mode 1
#include <history.h>
static void readline_init(void);
--- crash-7.0.7/Makefile.orig
+++ crash-7.0.7/Makefile
@@ -205,7 +205,7 @@ TAR_FILES=${SOURCE_FILES} Makefile ${GPL
${EXTENSION_SOURCE_FILES} ${MEMORY_DRIVER_FILES}
CSCOPE_FILES=${SOURCE_FILES}
-READLINE_DIRECTORY=./${GDB}/readline
+READLINE_DIRECTORY=/usr/include/readline
BFD_DIRECTORY=./${GDB}/bfd
GDB_INCLUDE_DIRECTORY=./${GDB}/include
@@ -233,7 +233,7 @@ gdb_merge: force
@rm -f ${PROGRAM}
@if [ ! -f ${GDB}/config.status ]; then \
(cd ${GDB}; ./configure ${GDB_CONF_FLAGS} --with-separate-debug-dir=/usr/lib/debug \
- --with-bugurl="" --with-expat=no --with-python=no --disable-sim; \
+ --with-bugurl="" --with-expat=no --with-python=no --disable-sim --with-system-readline; \
make --no-print-directory CRASH_TARGET=${TARGET}; echo ${TARGET} > crash.target) \
else make --no-print-directory rebuild; fi
@if [ ! -f ${PROGRAM} ]; then \