Compare commits
48
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5339677e07 | ||
|
|
1f5422d4e0 | ||
|
|
212a160214 | ||
|
|
6b2a64b805 | ||
|
|
c796f06fd0 | ||
|
|
bc29223016 | ||
|
|
71e3e151b7 | ||
|
|
c1acd180ba | ||
|
|
005a7d5d08 | ||
|
|
5ef358c380 | ||
|
|
8c2399d3d2 | ||
|
|
b0d5dd70e6 | ||
|
|
2c909cde03 | ||
|
|
9f2a36ea5a | ||
|
|
33205097e6 | ||
|
|
cdfe8f6bca | ||
|
|
4ab1426cd8 | ||
|
|
40d806a730 | ||
|
|
22b05b1b37 | ||
|
|
58a3a4d98a | ||
|
|
9eb2aa13b8 | ||
|
|
d32856d64d | ||
|
|
66daec136b | ||
|
|
1b3ca1f15b | ||
|
|
b7f4deb953 | ||
|
|
677ac816c7 | ||
|
|
6e03baeeb3 | ||
|
|
2279f9696c | ||
|
|
93007e8507 | ||
|
|
3405fc720c | ||
|
|
cdaa074d92 | ||
|
|
f73fa2f432 | ||
|
|
a1f1597b2c | ||
|
|
d30bfa99c6 | ||
|
|
20acea475c | ||
|
|
3652955d20 | ||
|
|
2cbdc492a3 | ||
|
|
56bd067f8d | ||
|
|
2c37844741 | ||
|
|
bd3bd6b94d | ||
|
|
5e1c30fc74 | ||
|
|
65b1724263 | ||
|
|
944f493144 | ||
|
|
2523dc8464 | ||
|
|
92e8df10e8 | ||
|
|
d38a008f23 | ||
|
|
444394d999 | ||
|
|
634549d7d8 |
@@ -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 fdf77bd..cc32d9d 100644
|
||||
index c3e26a3..d293e6c 100644
|
||||
--- a/arm64.c
|
||||
+++ b/arm64.c
|
||||
@@ -87,6 +87,10 @@ 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
|
||||
@@ -461,6 +465,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:
|
||||
@@ -1655,6 +1660,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,10 +124,13 @@ index fdf77bd..cc32d9d 100644
|
||||
+ readmem(p, KVADDR, &(ms->sdei_stacks[i]), sizeof(ulong),
|
||||
+ "SDEI stack pointer", RETURN_ON_ERROR);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2173,7 +2242,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;
|
||||
@@ -138,17 +139,17 @@ index fdf77bd..cc32d9d 100644
|
||||
struct arm64_pt_regs *ptregs;
|
||||
struct machine_specific *ms = machdep->machspec;
|
||||
|
||||
@@ -2203,7 +2272,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);
|
||||
|
||||
@@ -2243,6 +2313,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)
|
||||
*/
|
||||
irq_stack_ptr = ms->irq_stacks[bt->tc->processor] + ms->irq_stack_size - 16;
|
||||
@@ -156,7 +157,7 @@ index fdf77bd..cc32d9d 100644
|
||||
|
||||
if (frame->sp == irq_stack_ptr) {
|
||||
orig_sp = GET_STACK_ULONG(irq_stack_ptr - 8);
|
||||
@@ -2263,6 +2334,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 fdf77bd..cc32d9d 100644
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@@ -2602,6 +2692,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,42 +194,43 @@ index fdf77bd..cc32d9d 100644
|
||||
stackframe.fp = GET_STACK_ULONG(bt->bptr - 8);
|
||||
stackframe.pc = GET_STACK_ULONG(bt->bptr);
|
||||
stackframe.sp = bt->bptr + 8;
|
||||
@@ -2611,6 +2705,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);
|
||||
@@ -2621,6 +2719,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;
|
||||
@@ -2682,7 +2784,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;
|
||||
@@ -2965,6 +3068,81 @@ 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;
|
||||
}
|
||||
|
||||
static int
|
||||
+static int
|
||||
+arm64_in_kdump_text_on_sdei_stack(struct bt_info *bt)
|
||||
+{
|
||||
+ int cpu;
|
||||
@@ -259,7 +261,7 @@ index fdf77bd..cc32d9d 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;
|
||||
@@ -269,7 +271,7 @@ index fdf77bd..cc32d9d 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;
|
||||
@@ -280,7 +282,7 @@ index fdf77bd..cc32d9d 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",
|
||||
@@ -288,7 +290,7 @@ index fdf77bd..cc32d9d 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",
|
||||
@@ -303,22 +305,21 @@ index fdf77bd..cc32d9d 100644
|
||||
+ return FALSE;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
static int
|
||||
arm64_in_kdump_text_on_irq_stack(struct bt_info *bt)
|
||||
{
|
||||
int cpu;
|
||||
@@ -3111,7 +3287,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;
|
||||
@@ -3804,6 +3981,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
|
||||
@@ -329,7 +330,7 @@ index fdf77bd..cc32d9d 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;
|
||||
+
|
||||
@@ -350,10 +351,10 @@ index fdf77bd..cc32d9d 100644
|
||||
arm64_set_irq_stack(struct bt_info *bt)
|
||||
{
|
||||
diff --git a/defs.h b/defs.h
|
||||
index 9594950..9cd5ffa 100644
|
||||
index afdcf6c..4885d55 100644
|
||||
--- a/defs.h
|
||||
+++ b/defs.h
|
||||
@@ -3283,6 +3283,9 @@ struct machine_specific {
|
||||
@@ -3376,6 +3376,9 @@ struct machine_specific {
|
||||
ulong irq_stack_size;
|
||||
ulong *irq_stacks;
|
||||
char *irq_stackbuf;
|
||||
@@ -362,7 +363,7 @@ index 9594950..9cd5ffa 100644
|
||||
+ char *sdei_stackbuf;
|
||||
ulong __irqentry_text_start;
|
||||
ulong __irqentry_text_end;
|
||||
/* for exception vector code */
|
||||
ulong overflow_stack_size;
|
||||
--
|
||||
2.13.7
|
||||
2.27.0
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
From 5719afc7a40868418405a87a2711088556e68a3b Mon Sep 17 00:00:00 2001
|
||||
From: Pingfan Liu <piliu@redhat.com>
|
||||
Date: Fri, 2 Jul 2021 10:14:21 +0800
|
||||
Subject: [PATCH 13/16] arm64: rename ARM64_PAGE_OFFSET_ACTUAL to
|
||||
ARM64_FLIP_PAGE_OFFSET_ACTUAL
|
||||
|
||||
Reflect the flipped layout of kernel VA, which is introduced by
|
||||
kernel commit 14c127c957c1 ("arm64: mm: Flip kernel VA space").
|
||||
|
||||
Signed-off-by: Pingfan Liu <piliu@redhat.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
arm64.c | 10 ++++++----
|
||||
defs.h | 3 ++-
|
||||
2 files changed, 8 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/arm64.c b/arm64.c
|
||||
index 8934961b109d..9fe1a4a3bddb 100644
|
||||
--- a/arm64.c
|
||||
+++ b/arm64.c
|
||||
@@ -217,10 +217,12 @@ arm64_init(int when)
|
||||
arm64_calc_VA_BITS();
|
||||
arm64_calc_KERNELPACMASK();
|
||||
ms = machdep->machspec;
|
||||
+
|
||||
+ /* vabits_actual introduced after mm flip, so it should be flipped layout */
|
||||
if (ms->VA_BITS_ACTUAL) {
|
||||
- ms->page_offset = ARM64_PAGE_OFFSET_ACTUAL;
|
||||
- machdep->identity_map_base = ARM64_PAGE_OFFSET_ACTUAL;
|
||||
- machdep->kvbase = ARM64_PAGE_OFFSET_ACTUAL;
|
||||
+ ms->page_offset = ARM64_FLIP_PAGE_OFFSET_ACTUAL;
|
||||
+ machdep->identity_map_base = ARM64_FLIP_PAGE_OFFSET_ACTUAL;
|
||||
+ machdep->kvbase = ARM64_FLIP_PAGE_OFFSET_ACTUAL;
|
||||
ms->userspace_top = ARM64_USERSPACE_TOP_ACTUAL;
|
||||
} else {
|
||||
ms->page_offset = ARM64_PAGE_OFFSET;
|
||||
@@ -401,7 +403,7 @@ arm64_init(int when)
|
||||
fprintf(fp, "CONFIG_ARM64_VA_BITS: %ld\n", ms->CONFIG_ARM64_VA_BITS);
|
||||
fprintf(fp, " VA_BITS_ACTUAL: %ld\n", ms->VA_BITS_ACTUAL);
|
||||
fprintf(fp, "(calculated) VA_BITS: %ld\n", ms->VA_BITS);
|
||||
- fprintf(fp, " PAGE_OFFSET: %lx\n", ARM64_PAGE_OFFSET_ACTUAL);
|
||||
+ fprintf(fp, " PAGE_OFFSET: %lx\n", ARM64_FLIP_PAGE_OFFSET_ACTUAL);
|
||||
fprintf(fp, " VA_START: %lx\n", ms->VA_START);
|
||||
fprintf(fp, " modules: %lx - %lx\n", ms->modules_vaddr, ms->modules_end);
|
||||
fprintf(fp, " vmalloc: %lx - %lx\n", ms->vmalloc_start_addr, ms->vmalloc_end);
|
||||
diff --git a/defs.h b/defs.h
|
||||
index 5d32954905c2..eb7ce6aea331 100644
|
||||
--- a/defs.h
|
||||
+++ b/defs.h
|
||||
@@ -3233,7 +3233,8 @@ typedef signed int s32;
|
||||
|
||||
#define ARM64_PAGE_OFFSET ((0xffffffffffffffffUL) \
|
||||
<< (machdep->machspec->VA_BITS - 1))
|
||||
-#define ARM64_PAGE_OFFSET_ACTUAL ((0xffffffffffffffffUL) \
|
||||
+/* kernels >= v5.4 the kernel VA space is flipped */
|
||||
+#define ARM64_FLIP_PAGE_OFFSET_ACTUAL ((0xffffffffffffffffUL) \
|
||||
- ((1UL) << machdep->machspec->VA_BITS_ACTUAL) + 1)
|
||||
|
||||
#define ARM64_USERSPACE_TOP ((1UL) << machdep->machspec->VA_BITS)
|
||||
--
|
||||
2.30.2
|
||||
@@ -1,56 +0,0 @@
|
||||
From 167d37e347fe35c6f7db826e8539e192c4375564 Mon Sep 17 00:00:00 2001
|
||||
From: Pingfan Liu <piliu@redhat.com>
|
||||
Date: Fri, 2 Jul 2021 10:14:22 +0800
|
||||
Subject: [PATCH 14/16] arm64: assign page_offset with VA_BITS kernel
|
||||
configuration value
|
||||
|
||||
On RHEL9, crash hits a bug when executing "crash /proc/kcore":
|
||||
seek error: kernel virtual address: ffff6a0f3fff0000 type: "pmd page"
|
||||
|
||||
The kernel virtual address does not vary with vabits_actual, instead,
|
||||
is determined by configuration value. But crash does not observe this
|
||||
fact.
|
||||
|
||||
Since vabits_actual related kernel commit is introduced after arm64
|
||||
mm layout flip commit, so changes are safe under the condition if
|
||||
(ms->VA_BITS_ACTUAL), and keep the else branch untouched.
|
||||
|
||||
Signed-off-by: Pingfan Liu <piliu@redhat.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
arm64.c | 7 ++++---
|
||||
defs.h | 1 +
|
||||
2 files changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/arm64.c b/arm64.c
|
||||
index 9fe1a4a3bddb..149db36cd119 100644
|
||||
--- a/arm64.c
|
||||
+++ b/arm64.c
|
||||
@@ -220,9 +220,10 @@ arm64_init(int when)
|
||||
|
||||
/* vabits_actual introduced after mm flip, so it should be flipped layout */
|
||||
if (ms->VA_BITS_ACTUAL) {
|
||||
- ms->page_offset = ARM64_FLIP_PAGE_OFFSET_ACTUAL;
|
||||
- machdep->identity_map_base = ARM64_FLIP_PAGE_OFFSET_ACTUAL;
|
||||
- machdep->kvbase = ARM64_FLIP_PAGE_OFFSET_ACTUAL;
|
||||
+ ms->page_offset = ARM64_FLIP_PAGE_OFFSET;
|
||||
+ /* useless on arm64 */
|
||||
+ machdep->identity_map_base = ARM64_FLIP_PAGE_OFFSET;
|
||||
+ machdep->kvbase = ARM64_FLIP_PAGE_OFFSET;
|
||||
ms->userspace_top = ARM64_USERSPACE_TOP_ACTUAL;
|
||||
} else {
|
||||
ms->page_offset = ARM64_PAGE_OFFSET;
|
||||
diff --git a/defs.h b/defs.h
|
||||
index eb7ce6aea331..b7b20af4bcf9 100644
|
||||
--- a/defs.h
|
||||
+++ b/defs.h
|
||||
@@ -3234,6 +3234,7 @@ typedef signed int s32;
|
||||
#define ARM64_PAGE_OFFSET ((0xffffffffffffffffUL) \
|
||||
<< (machdep->machspec->VA_BITS - 1))
|
||||
/* kernels >= v5.4 the kernel VA space is flipped */
|
||||
+#define ARM64_FLIP_PAGE_OFFSET (-(1UL) << machdep->machspec->CONFIG_ARM64_VA_BITS)
|
||||
#define ARM64_FLIP_PAGE_OFFSET_ACTUAL ((0xffffffffffffffffUL) \
|
||||
- ((1UL) << machdep->machspec->VA_BITS_ACTUAL) + 1)
|
||||
|
||||
--
|
||||
2.30.2
|
||||
Executable
+3105
File diff suppressed because it is too large
Load Diff
@@ -1,83 +0,0 @@
|
||||
From bf1379a8b6ff8d6a8fa12978f7194f15f85c4380 Mon Sep 17 00:00:00 2001
|
||||
From: Pingfan Liu <piliu@redhat.com>
|
||||
Date: Fri, 2 Jul 2021 10:14:23 +0800
|
||||
Subject: [PATCH 15/16] arm64: use dedicated bits to record the VA space layout
|
||||
changes
|
||||
|
||||
arm64 memory layout experiences big changes due to the following kernel
|
||||
commits in date descending order:
|
||||
5. 7bc1a0f9e176 arm64: mm: use single quantity to represent the PA to VA translation
|
||||
4. b6d00d47e81a arm64: mm: Introduce 52-bit Kernel VAs
|
||||
3. 5383cc6efed1 arm64: mm: Introduce vabits_actual
|
||||
2. 14c127c957c1 arm64: mm: Flip kernel VA space
|
||||
1. f80fb3a3d508 arm64: add support for kernel ASLR
|
||||
|
||||
For 1, crash has already used NEW_VMEMMAP to trace it.
|
||||
For 2, crash lacks a flag to tag it and handle it differently.
|
||||
For 3, two important kernel variables vabits_actual and physvirt_offset
|
||||
are introduced.
|
||||
For 4, since it comes immediately after 3, crash-utility does not need
|
||||
to distinguish it.
|
||||
For 5, kernel variable phyvirt_offset is removed
|
||||
|
||||
These changes have effects on PTOV()/VTOP() formula. So introducing
|
||||
two bits HAS_PHYSVIRT_OFFSET and FLIPPED_VM as hint to apply different
|
||||
formula.
|
||||
|
||||
Signed-off-by: Pingfan Liu <piliu@redhat.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
arm64.c | 10 ++++++++++
|
||||
defs.h | 2 ++
|
||||
2 files changed, 12 insertions(+)
|
||||
|
||||
diff --git a/arm64.c b/arm64.c
|
||||
index 149db36cd119..b04369f6d4d8 100644
|
||||
--- a/arm64.c
|
||||
+++ b/arm64.c
|
||||
@@ -563,6 +563,10 @@ arm64_dump_machdep_table(ulong arg)
|
||||
fprintf(fp, "%sMACHDEP_BT_TEXT", others++ ? "|" : "");
|
||||
if (machdep->flags & NEW_VMEMMAP)
|
||||
fprintf(fp, "%sNEW_VMEMMAP", others++ ? "|" : "");
|
||||
+ if (machdep->flags & FLIPPED_VM)
|
||||
+ fprintf(fp, "%sFLIPPED_VM", others++ ? "|" : "");
|
||||
+ if (machdep->flags & HAS_PHYSVIRT_OFFSET)
|
||||
+ fprintf(fp, "%sHAS_PHYSVIRT_OFFSET", others++ ? "|" : "");
|
||||
fprintf(fp, ")\n");
|
||||
|
||||
fprintf(fp, " kvbase: %lx\n", machdep->kvbase);
|
||||
@@ -997,6 +1001,7 @@ arm64_calc_physvirt_offset(void)
|
||||
if (READMEM(pc->mfd, &physvirt_offset, sizeof(physvirt_offset),
|
||||
sp->value, sp->value -
|
||||
machdep->machspec->kimage_voffset) > 0) {
|
||||
+ machdep->flags |= HAS_PHYSVIRT_OFFSET;
|
||||
ms->physvirt_offset = physvirt_offset;
|
||||
}
|
||||
}
|
||||
@@ -3963,6 +3968,11 @@ arm64_calc_VA_BITS(void)
|
||||
error(FATAL, "cannot determine VA_BITS_ACTUAL\n");
|
||||
}
|
||||
|
||||
+ /*
|
||||
+ * The mm flip commit is introduced before 52-bits VA, which is before the
|
||||
+ * commit to export NUMBER(TCR_EL1_T1SZ)
|
||||
+ */
|
||||
+ machdep->flags |= FLIPPED_VM;
|
||||
return;
|
||||
}
|
||||
|
||||
diff --git a/defs.h b/defs.h
|
||||
index b7b20af4bcf9..eca145cb881c 100644
|
||||
--- a/defs.h
|
||||
+++ b/defs.h
|
||||
@@ -3214,6 +3214,8 @@ typedef signed int s32;
|
||||
#define NEW_VMEMMAP (0x80)
|
||||
#define VM_L4_4K (0x100)
|
||||
#define UNW_4_14 (0x200)
|
||||
+#define FLIPPED_VM (0x400)
|
||||
+#define HAS_PHYSVIRT_OFFSET (0x800)
|
||||
|
||||
/*
|
||||
* Get kimage_voffset from /dev/crash
|
||||
--
|
||||
2.30.2
|
||||
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
|
||||
|
||||
@@ -1,165 +0,0 @@
|
||||
From f53b73e8380bca054cebd2b61ff118c46609429b Mon Sep 17 00:00:00 2001
|
||||
From: Pingfan Liu <piliu@redhat.com>
|
||||
Date: Fri, 2 Jul 2021 10:14:24 +0800
|
||||
Subject: [PATCH 16/16] arm64: implement switchable PTOV()/VTOP() for kernels
|
||||
>= 5.10
|
||||
|
||||
Crash encounters a bug like the following:
|
||||
...
|
||||
SECTION_SIZE_BITS: 30
|
||||
CONFIG_ARM64_VA_BITS: 52
|
||||
VA_BITS_ACTUAL: 48
|
||||
(calculated) VA_BITS: 48
|
||||
PAGE_OFFSET: ffff000000000000
|
||||
VA_START: ffff800000000000
|
||||
modules: ffff800008000000 - ffff80000fffffff
|
||||
vmalloc: ffff800010000000 - ffffffdfdffeffff
|
||||
kernel image: ffff800010000000 - ffff800012750000
|
||||
vmemmap: ffffffdfffe00000 - ffffffffffffffff
|
||||
|
||||
<readmem: ffff800011c53bc8, KVADDR, "nr_irqs", 4, (FOE), b47bdc>
|
||||
<read_kdump: addr: ffff800011c53bc8 paddr: eb453bc8 cnt: 4>
|
||||
read_netdump: addr: ffff800011c53bc8 paddr: eb453bc8 cnt: 4 offset: 1c73bc8
|
||||
irq_stack_ptr:
|
||||
type: 1, TYPE_CODE_PTR
|
||||
target_typecode: 8, TYPE_CODE_INT
|
||||
target_length: 8
|
||||
length: 8
|
||||
GNU_GET_DATATYPE[thread_union]: returned via gdb_error_hook
|
||||
<readmem: ffff000b779c0050, KVADDR, "IRQ stack pointer", 8, (ROE), 3a37bea0>
|
||||
<read_kdump: addr: ffff000b779c0050 paddr: fff1000bf79c0050 cnt: 8>
|
||||
read_netdump: READ_ERROR: offset not found for paddr: fff1000bf79c0050
|
||||
crash: read error: kernel virtual address: ffff000b779c0050 type: "IRQ stack pointer"
|
||||
...
|
||||
|
||||
Apparently, for a normal system, the 'paddr: fff1000bf79c0050' is
|
||||
unreasonable.
|
||||
|
||||
This bug connects with kernel commit 7bc1a0f9e176 ("arm64: mm: use
|
||||
single quantity to represent the PA to VA translation"), which removed
|
||||
physvirt_offset kernel variable and changed the PTOV()/VTOP() formulas.
|
||||
|
||||
Implement switchable PTOV()/VTOP() to cope with different kernel
|
||||
version.
|
||||
|
||||
Signed-off-by: Pingfan Liu <piliu@redhat.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
arm64.c | 37 +++++++++++++++++++++++++++++++++----
|
||||
defs.h | 9 ++++-----
|
||||
2 files changed, 37 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/arm64.c b/arm64.c
|
||||
index b04369f6d4d8..d73d5c5a4fed 100644
|
||||
--- a/arm64.c
|
||||
+++ b/arm64.c
|
||||
@@ -994,8 +994,6 @@ arm64_calc_physvirt_offset(void)
|
||||
ulong physvirt_offset;
|
||||
struct syment *sp;
|
||||
|
||||
- ms->physvirt_offset = ms->phys_offset - ms->page_offset;
|
||||
-
|
||||
if ((sp = kernel_symbol_search("physvirt_offset")) &&
|
||||
machdep->machspec->kimage_voffset) {
|
||||
if (READMEM(pc->mfd, &physvirt_offset, sizeof(physvirt_offset),
|
||||
@@ -1003,8 +1001,13 @@ arm64_calc_physvirt_offset(void)
|
||||
machdep->machspec->kimage_voffset) > 0) {
|
||||
machdep->flags |= HAS_PHYSVIRT_OFFSET;
|
||||
ms->physvirt_offset = physvirt_offset;
|
||||
+ return;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ /* Useless if no symbol 'physvirt_offset', just keep semantics */
|
||||
+ ms->physvirt_offset = ms->phys_offset - ms->page_offset;
|
||||
+
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1051,6 +1054,7 @@ arm64_calc_phys_offset(void)
|
||||
if (READMEM(pc->mfd, &phys_offset, sizeof(phys_offset),
|
||||
vaddr, paddr) > 0) {
|
||||
ms->phys_offset = phys_offset;
|
||||
+
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1178,6 +1182,21 @@ arm64_init_kernel_pgd(void)
|
||||
vt->kernel_pgd[i] = value;
|
||||
}
|
||||
|
||||
+ulong arm64_PTOV(ulong paddr)
|
||||
+{
|
||||
+ struct machine_specific *ms = machdep->machspec;
|
||||
+
|
||||
+ /*
|
||||
+ * Either older kernel before kernel has 'physvirt_offset' or newer
|
||||
+ * kernel which removes 'physvirt_offset' has the same formula:
|
||||
+ * #define __phys_to_virt(x) ((unsigned long)((x) - PHYS_OFFSET) | PAGE_OFFSET)
|
||||
+ */
|
||||
+ if (!(machdep->flags & HAS_PHYSVIRT_OFFSET))
|
||||
+ return (paddr - ms->phys_offset) | PAGE_OFFSET;
|
||||
+ else
|
||||
+ return paddr - ms->physvirt_offset;
|
||||
+}
|
||||
+
|
||||
ulong
|
||||
arm64_VTOP(ulong addr)
|
||||
{
|
||||
@@ -1188,8 +1207,18 @@ arm64_VTOP(ulong addr)
|
||||
return addr - machdep->machspec->kimage_voffset;
|
||||
}
|
||||
|
||||
- if (addr >= machdep->machspec->page_offset)
|
||||
- return addr + machdep->machspec->physvirt_offset;
|
||||
+ if (addr >= machdep->machspec->page_offset) {
|
||||
+ if (machdep->flags & HAS_PHYSVIRT_OFFSET) {
|
||||
+ return addr + machdep->machspec->physvirt_offset;
|
||||
+ } else {
|
||||
+ /*
|
||||
+ * Either older kernel before kernel has 'physvirt_offset' or newer
|
||||
+ * kernel which removes 'physvirt_offset' has the same formula:
|
||||
+ * #define __lm_to_phys(addr) (((addr) & ~PAGE_OFFSET) + PHYS_OFFSET)
|
||||
+ */
|
||||
+ return (addr & ~PAGE_OFFSET) + machdep->machspec->phys_offset;
|
||||
+ }
|
||||
+ }
|
||||
else if (machdep->machspec->kimage_voffset)
|
||||
return addr - machdep->machspec->kimage_voffset;
|
||||
else /* no randomness */
|
||||
diff --git a/defs.h b/defs.h
|
||||
index eca145cb881c..c91177a245fd 100644
|
||||
--- a/defs.h
|
||||
+++ b/defs.h
|
||||
@@ -3092,11 +3092,6 @@ typedef u64 pte_t;
|
||||
#define _64BIT_
|
||||
#define MACHINE_TYPE "ARM64"
|
||||
|
||||
-#define PTOV(X) \
|
||||
- ((unsigned long)(X) - (machdep->machspec->physvirt_offset))
|
||||
-
|
||||
-#define VTOP(X) arm64_VTOP((ulong)(X))
|
||||
-
|
||||
#define USERSPACE_TOP (machdep->machspec->userspace_top)
|
||||
#define PAGE_OFFSET (machdep->machspec->page_offset)
|
||||
#define VMALLOC_START (machdep->machspec->vmalloc_start_addr)
|
||||
@@ -3106,6 +3101,9 @@ typedef u64 pte_t;
|
||||
#define MODULES_VADDR (machdep->machspec->modules_vaddr)
|
||||
#define MODULES_END (machdep->machspec->modules_end)
|
||||
|
||||
+#define PTOV(X) arm64_PTOV((ulong)(X))
|
||||
+#define VTOP(X) arm64_VTOP((ulong)(X))
|
||||
+
|
||||
#define IS_VMALLOC_ADDR(X) arm64_IS_VMALLOC_ADDR((ulong)(X))
|
||||
|
||||
#define PAGEBASE(X) (((ulong)(X)) & (ulong)machdep->pagemask)
|
||||
@@ -5910,6 +5908,7 @@ void unwind_backtrace(struct bt_info *);
|
||||
void arm64_init(int);
|
||||
void arm64_dump_machdep_table(ulong);
|
||||
ulong arm64_VTOP(ulong);
|
||||
+ulong arm64_PTOV(ulong);
|
||||
int arm64_IS_VMALLOC_ADDR(ulong);
|
||||
ulong arm64_swp_type(ulong);
|
||||
ulong arm64_swp_offset(ulong);
|
||||
--
|
||||
2.30.2
|
||||
@@ -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
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,56 +0,0 @@
|
||||
From 68870c83d299603c07785e3530e33c13045c87ef Mon Sep 17 00:00:00 2001
|
||||
From: Alexander Egorenkov <egorenar@linux.ibm.com>
|
||||
Date: Wed, 13 Oct 2021 10:56:39 +0200
|
||||
Subject: [PATCH] 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()
|
||||
|
||||
Signed-off-by: Alexander Egorenkov <egorenar@linux.ibm.com>
|
||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
---
|
||||
task.c | 7 ++++---
|
||||
1 file changed, 4 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/task.c b/task.c
|
||||
index 672b416..bb6a5da 100644
|
||||
--- a/task.c
|
||||
+++ b/task.c
|
||||
@@ -278,8 +278,10 @@ task_init(void)
|
||||
} else if (VALID_MEMBER(task_struct_stack))
|
||||
MEMBER_OFFSET_INIT(task_struct_thread_info, "task_struct", "stack");
|
||||
|
||||
+ MEMBER_OFFSET_INIT(task_struct_cpu, "task_struct", "cpu");
|
||||
+
|
||||
if (VALID_MEMBER(task_struct_thread_info)) {
|
||||
- if (tt->flags & THREAD_INFO_IN_TASK) {
|
||||
+ if (tt->flags & THREAD_INFO_IN_TASK && VALID_MEMBER(task_struct_cpu)) {
|
||||
MEMBER_OFFSET_INIT(thread_info_flags, "thread_info", "flags");
|
||||
/* (unnecessary) reminders */
|
||||
ASSIGN_OFFSET(thread_info_task) = INVALID_OFFSET;
|
||||
@@ -315,7 +317,6 @@ task_init(void)
|
||||
MEMBER_OFFSET_INIT(task_struct_has_cpu, "task_struct", "has_cpu");
|
||||
MEMBER_OFFSET_INIT(task_struct_cpus_runnable,
|
||||
"task_struct", "cpus_runnable");
|
||||
- MEMBER_OFFSET_INIT(task_struct_cpu, "task_struct", "cpu");
|
||||
MEMBER_OFFSET_INIT(task_struct_active_mm, "task_struct", "active_mm");
|
||||
MEMBER_OFFSET_INIT(task_struct_next_run, "task_struct", "next_run");
|
||||
MEMBER_OFFSET_INIT(task_struct_flags, "task_struct", "flags");
|
||||
@@ -2900,7 +2901,7 @@ add_context(ulong task, char *tp)
|
||||
else
|
||||
tc->thread_info = ULONG(tp + OFFSET(task_struct_thread_info));
|
||||
fill_thread_info(tc->thread_info);
|
||||
- if (tt->flags & THREAD_INFO_IN_TASK)
|
||||
+ if (tt->flags & THREAD_INFO_IN_TASK && VALID_MEMBER(task_struct_cpu))
|
||||
processor_addr = (int *) (tp + OFFSET(task_struct_cpu));
|
||||
else
|
||||
processor_addr = (int *) (tt->thread_info +
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -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:
|
||||
+106
-15
@@ -1,25 +1,28 @@
|
||||
Name: crash
|
||||
Version: 7.3.0
|
||||
Release: 5
|
||||
Version: 8.0.5
|
||||
Release: 9
|
||||
Summary: Linux kernel crash utility.
|
||||
License: GPLv3
|
||||
URL: https://crash-utility.github.io
|
||||
Source0: https://github.com/crash-utility/crash/archive/%{version}.tar.gz
|
||||
Source1: http://ftp.gnu.org/gnu/gdb/gdb-7.6.tar.gz
|
||||
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
|
||||
|
||||
Patch1: lzo_snappy.patch
|
||||
Patch2: 0001-arm64-rename-ARM64_PAGE_OFFSET_ACTUAL-to-ARM64_FLIP_.patch
|
||||
Patch3: 0002-arm64-assign-page_offset-with-VA_BITS-kernel-configu.patch
|
||||
Patch4: 0003-arm64-use-dedicated-bits-to-record-the-VA-space-layo.patch
|
||||
Patch5: 0004-arm64-implement-switchable-PTOV-VTOP-for-kernels-5.1.patch
|
||||
Patch6: add-SDEI-stack-resolution.patch
|
||||
Patch7: Handle-task_struct-cpu-member-changes-for-kernels-5..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
|
||||
|
||||
BuildRequires: ncurses-devel zlib-devel lzo-devel snappy-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
|
||||
@@ -44,11 +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
|
||||
cp %{SOURCE1} .
|
||||
make -j RPMPKG="%{version}-%{release}" CFLAGS="%{optflags}" LDFLAGS="%{build_ldflags}"
|
||||
make -j`nproc` RPMPKG="%{version}-%{release}" CFLAGS="%{optflags}" CXXFLAGS="%{optflags}" LDFLAGS="%{build_ldflags}"
|
||||
|
||||
%install
|
||||
rm -rf %{buildroot}
|
||||
@@ -79,6 +99,77 @@ 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
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user