parent
677ac816c7
commit
1b3ca1f15b
@ -1,5 +1,5 @@
|
|||||||
--- crash-8.0.2/diskdump.c.orig
|
--- crash-8.0.4/diskdump.c.orig
|
||||||
+++ crash-8.0.2/diskdump.c
|
+++ crash-8.0.4/diskdump.c
|
||||||
@@ -23,6 +23,9 @@
|
@@ -23,6 +23,9 @@
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
@ -10,8 +10,8 @@
|
|||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include "diskdump.h"
|
#include "diskdump.h"
|
||||||
#include "xen_dom0.h"
|
#include "xen_dom0.h"
|
||||||
--- crash-8.0.2/Makefile.orig
|
--- crash-8.0.4/Makefile.orig
|
||||||
+++ crash-8.0.2/Makefile
|
+++ crash-8.0.4/Makefile
|
||||||
@@ -256,7 +256,7 @@ all: make_configure
|
@@ -256,7 +256,7 @@ all: make_configure
|
||||||
gdb_merge: force
|
gdb_merge: force
|
||||||
@if [ ! -f ${GDB}/README ]; then \
|
@if [ ! -f ${GDB}/README ]; then \
|
||||||
|
|||||||
@ -1,148 +0,0 @@
|
|||||||
From 5f27639196c3240810fbf30d367da0063a6612ff Mon Sep 17 00:00:00 2001
|
|
||||||
From: Ding Hui <dinghui@sangfor.com.cn>
|
|
||||||
Date: Thu, 1 Dec 2022 15:01:45 +0800
|
|
||||||
Subject: [PATCH] arm64: fix backtraces of KASAN kernel dumpfile truncated
|
|
||||||
|
|
||||||
We met "bt" command on KASAN kernel vmcore display truncated backtraces
|
|
||||||
like this:
|
|
||||||
|
|
||||||
crash> bt
|
|
||||||
PID: 4131 TASK: ffff8001521df000 CPU: 3 COMMAND: "bash"
|
|
||||||
#0 [ffff2000224b0cb0] machine_kexec_prepare at ffff2000200bff4c
|
|
||||||
|
|
||||||
After digging the root cause, it turns out that arm64_in_kdump_text()
|
|
||||||
found wrong bt->bptr at "machine_kexec" branch.
|
|
||||||
|
|
||||||
Disassemble machine_kexec() of KASAN vmlinux (gcc 7.3.0):
|
|
||||||
|
|
||||||
crash> dis -x machine_kexec
|
|
||||||
0xffff2000200bff50 <machine_kexec>: stp x29, x30, [sp,#-208]!
|
|
||||||
0xffff2000200bff54 <machine_kexec+0x4>: mov x29, sp
|
|
||||||
0xffff2000200bff58 <machine_kexec+0x8>: stp x19, x20, [sp,#16]
|
|
||||||
0xffff2000200bff5c <machine_kexec+0xc>: str x24, [sp,#56]
|
|
||||||
0xffff2000200bff60 <machine_kexec+0x10>: str x26, [sp,#72]
|
|
||||||
0xffff2000200bff64 <machine_kexec+0x14>: mov x2, #0x8ab3
|
|
||||||
0xffff2000200bff68 <machine_kexec+0x18>: add x1, x29, #0x70
|
|
||||||
0xffff2000200bff6c <machine_kexec+0x1c>: lsr x1, x1, #3
|
|
||||||
0xffff2000200bff70 <machine_kexec+0x20>: movk x2, #0x41b5, lsl #16
|
|
||||||
0xffff2000200bff74 <machine_kexec+0x24>: mov x19, #0x200000000000
|
|
||||||
0xffff2000200bff78 <machine_kexec+0x28>: adrp x3, 0xffff2000224b0000
|
|
||||||
0xffff2000200bff7c <machine_kexec+0x2c>: movk x19, #0xdfff, lsl #48
|
|
||||||
0xffff2000200bff80 <machine_kexec+0x30>: add x3, x3, #0xcb0
|
|
||||||
0xffff2000200bff84 <machine_kexec+0x34>: add x4, x1, x19
|
|
||||||
0xffff2000200bff88 <machine_kexec+0x38>: stp x2, x3, [x29,#112]
|
|
||||||
0xffff2000200bff8c <machine_kexec+0x3c>: adrp x2, 0xffff2000200bf000 <swsusp_arch_resume+0x1e8>
|
|
||||||
0xffff2000200bff90 <machine_kexec+0x40>: add x2, x2, #0xf50
|
|
||||||
0xffff2000200bff94 <machine_kexec+0x44>: str x2, [x29,#128]
|
|
||||||
0xffff2000200bff98 <machine_kexec+0x48>: mov w2, #0xf1f1f1f1
|
|
||||||
0xffff2000200bff9c <machine_kexec+0x4c>: str w2, [x1,x19]
|
|
||||||
0xffff2000200bffa0 <machine_kexec+0x50>: mov w2, #0xf200
|
|
||||||
0xffff2000200bffa4 <machine_kexec+0x54>: mov w1, #0xf3f3f3f3
|
|
||||||
0xffff2000200bffa8 <machine_kexec+0x58>: movk w2, #0xf2f2, lsl #16
|
|
||||||
0xffff2000200bffac <machine_kexec+0x5c>: stp w2, w1, [x4,#4]
|
|
||||||
|
|
||||||
We notice that:
|
|
||||||
1. machine_kexec() start address is 0xffff2000200bff50
|
|
||||||
2. the instruction at machine_kexec+0x44 stores the same value
|
|
||||||
0xffff2000200bff50 (comes from 0xffff2000200bf000 + 0xf50)
|
|
||||||
into stack postion [x29,#128].
|
|
||||||
|
|
||||||
When arm64_in_kdump_text() searches for LR from stack, it met
|
|
||||||
0xffff2000200bff50 firstly, so got wrong bt->bptr.
|
|
||||||
|
|
||||||
We know that the real LR is always greater than the start address
|
|
||||||
of a function, so let's fix it by changing the search conditon to
|
|
||||||
(*ptr > xxx_start) && (*ptr < xxx_end).
|
|
||||||
|
|
||||||
Signed-off-by: Ding Hui <dinghui@sangfor.com.cn>
|
|
||||||
---
|
|
||||||
arm64.c | 18 +++++++++---------
|
|
||||||
1 file changed, 9 insertions(+), 9 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/arm64.c b/arm64.c
|
|
||||||
index c3e26a3..7e8a7db 100644
|
|
||||||
--- a/arm64.c
|
|
||||||
+++ b/arm64.c
|
|
||||||
@@ -3479,7 +3479,7 @@ arm64_in_kdump_text(struct bt_info *bt, struct arm64_stackframe *frame)
|
|
||||||
ms = machdep->machspec;
|
|
||||||
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)
|
|
||||||
@@ -3488,7 +3488,7 @@ arm64_in_kdump_text(struct bt_info *bt, struct arm64_stackframe *frame)
|
|
||||||
fprintf(fp, "%lx: %lx (crash_kexec)\n", bt->bptr, *ptr);
|
|
||||||
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)
|
|
||||||
@@ -3498,14 +3498,14 @@ arm64_in_kdump_text(struct bt_info *bt, struct arm64_stackframe *frame)
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
- if ((*ptr >= ms->machine_kexec_start) && (*ptr < ms->machine_kexec_end)) {
|
|
||||||
+ if ((*ptr > ms->machine_kexec_start) && (*ptr < ms->machine_kexec_end)) {
|
|
||||||
bt->bptr = ((ulong)ptr - (ulong)base)
|
|
||||||
+ task_to_stackbase(bt->tc->task);
|
|
||||||
if (CRASHDEBUG(1))
|
|
||||||
fprintf(fp, "%lx: %lx (machine_kexec)\n", bt->bptr, *ptr);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
- if ((*ptr >= ms->crash_kexec_start) && (*ptr < ms->crash_kexec_end)) {
|
|
||||||
+ if ((*ptr > ms->crash_kexec_start) && (*ptr < ms->crash_kexec_end)) {
|
|
||||||
/*
|
|
||||||
* Stash the first crash_kexec frame in case the machine_kexec
|
|
||||||
* frame is not found.
|
|
||||||
@@ -3519,7 +3519,7 @@ arm64_in_kdump_text(struct bt_info *bt, struct arm64_stackframe *frame)
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
- 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)
|
|
||||||
+ task_to_stackbase(bt->tc->task);
|
|
||||||
if (CRASHDEBUG(1))
|
|
||||||
@@ -3566,7 +3566,7 @@ arm64_in_kdump_text_on_irq_stack(struct bt_info *bt)
|
|
||||||
|
|
||||||
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;
|
|
||||||
@@ -3576,7 +3576,7 @@ arm64_in_kdump_text_on_irq_stack(struct bt_info *bt)
|
|
||||||
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;
|
|
||||||
@@ -3587,7 +3587,7 @@ arm64_in_kdump_text_on_irq_stack(struct bt_info *bt)
|
|
||||||
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",
|
|
||||||
@@ -3595,7 +3595,7 @@ arm64_in_kdump_text_on_irq_stack(struct bt_info *bt)
|
|
||||||
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",
|
|
||||||
--
|
|
||||||
2.33.0
|
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@ -1,70 +0,0 @@
|
|||||||
From 4ee56105881d7bb1da1e668ac5bb47a4e0846676 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Lianbo Jiang <lijiang@redhat.com>
|
|
||||||
Date: Wed, 5 Jul 2023 10:02:59 +0800
|
|
||||||
Subject: [PATCH] Fix compilation error due to new strlcpy function that glibc
|
|
||||||
added
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
The crash-utility has its own strlcpy(), but recently the latest glibc
|
|
||||||
has also implemented the strlcpy function, which is derived from
|
|
||||||
OpenBSD. Eventually this caused the following compilation error:
|
|
||||||
|
|
||||||
# make -j8 lzo
|
|
||||||
...
|
|
||||||
In file included from global_data.c:18:
|
|
||||||
defs.h:5556:8: error: conflicting types for ‘strlcpy’; have ‘size_t(char *, char *, size_t)’ {aka ‘long unsigned int(char *, char *, long unsigned int)’}
|
|
||||||
5556 | size_t strlcpy(char *, char *, size_t);
|
|
||||||
| ^~~~~~~
|
|
||||||
In file included from memory.c:19:
|
|
||||||
defs.h:5556:8: error: conflicting types for ‘strlcpy’; have ‘size_t(char *, char *, size_t)’ {aka ‘long unsigned int(char *, char *, long unsigned int)’}
|
|
||||||
5556 | size_t strlcpy(char *, char *, size_t);
|
|
||||||
| ^~~~~~~
|
|
||||||
...
|
|
||||||
|
|
||||||
To fix the issue, let's declare the strlcpy() as a weak function and
|
|
||||||
keep the same parameter types as the glibc function has.
|
|
||||||
|
|
||||||
Related glibc commits:
|
|
||||||
454a20c8756c ("Implement strlcpy and strlcat [BZ #178]")
|
|
||||||
d2fda60e7c40 ("manual: Manual update for strlcat, strlcpy, wcslcat, wclscpy")
|
|
||||||
388ae538ddcb ("hurd: Add strlcpy, strlcat, wcslcpy, wcslcat to libc.abilist")
|
|
||||||
|
|
||||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
|
||||||
|
|
||||||
Reference:https://github.com/crash-utility/crash/commit/4ee56105881d7bb1da1e668ac5bb47a4e0846676
|
|
||||||
---
|
|
||||||
defs.h | 2 +-
|
|
||||||
tools.c | 2 +-
|
|
||||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/defs.h b/defs.h
|
|
||||||
index 8f7d1fa..26afe23 100644
|
|
||||||
--- a/defs.h
|
|
||||||
+++ b/defs.h
|
|
||||||
@@ -5553,7 +5553,7 @@ uint32_t swap32(uint32_t, int);
|
|
||||||
uint64_t swap64(uint64_t, int);
|
|
||||||
ulong *get_cpumask_buf(void);
|
|
||||||
int make_cpumask(char *, ulong *, int, int *);
|
|
||||||
-size_t strlcpy(char *, char *, size_t);
|
|
||||||
+size_t strlcpy(char *, const char *, size_t) __attribute__ ((__weak__));
|
|
||||||
struct rb_node *rb_first(struct rb_root *);
|
|
||||||
struct rb_node *rb_parent(struct rb_node *, struct rb_node *);
|
|
||||||
struct rb_node *rb_right(struct rb_node *, struct rb_node *);
|
|
||||||
diff --git a/tools.c b/tools.c
|
|
||||||
index 392a797..0f2db10 100644
|
|
||||||
--- a/tools.c
|
|
||||||
+++ b/tools.c
|
|
||||||
@@ -6795,7 +6795,7 @@ make_cpumask_error:
|
|
||||||
* always be NULL-terminated.
|
|
||||||
*/
|
|
||||||
size_t
|
|
||||||
-strlcpy(char *dest, char *src, size_t size)
|
|
||||||
+strlcpy(char *dest, const char *src, size_t size)
|
|
||||||
{
|
|
||||||
size_t ret = strlen(src);
|
|
||||||
|
|
||||||
--
|
|
||||||
2.27.0
|
|
||||||
|
|
||||||
BIN
8.0.2.tar.gz
BIN
8.0.2.tar.gz
Binary file not shown.
BIN
8.0.4.tar.gz
Normal file
BIN
8.0.4.tar.gz
Normal file
Binary file not shown.
20
crash.spec
20
crash.spec
@ -1,25 +1,20 @@
|
|||||||
Name: crash
|
Name: crash
|
||||||
Version: 8.0.2
|
Version: 8.0.4
|
||||||
Release: 4
|
Release: 1
|
||||||
Summary: Linux kernel crash utility.
|
Summary: Linux kernel crash utility.
|
||||||
License: GPLv3
|
License: GPLv3
|
||||||
URL: https://crash-utility.github.io
|
URL: https://crash-utility.github.io
|
||||||
Source0: https://github.com/crash-utility/crash/archive/%{version}.tar.gz
|
Source0: https://github.com/crash-utility/crash/archive/%{version}.tar.gz
|
||||||
Source1: http://ftp.gnu.org/gnu/gdb/gdb-10.2.tar.gz
|
Source1: http://ftp.gnu.org/gnu/gdb/gdb-10.2.tar.gz
|
||||||
|
|
||||||
Patch1: 0000-lzo_snappy.patch
|
Patch0: 0000-lzo_snappy.patch
|
||||||
Patch2: 0001-add-SDEI-stack-resolution.patch
|
Patch1: 0001-add-SDEI-stack-resolution.patch
|
||||||
%ifarch sw_64
|
%ifarch sw_64
|
||||||
Patch3: 0002-crash-8.0.2-sw.patch
|
Patch2: 0002-crash-8.0.2-sw.patch
|
||||||
%endif
|
|
||||||
Patch4: 0003-arm64-fix-backtraces-of-KASAN-kernel-dumpfile-truncated.patch
|
|
||||||
%ifarch riscv64
|
|
||||||
Patch5: 0004-riscv-support.patch
|
|
||||||
%endif
|
%endif
|
||||||
%ifarch loongarch64
|
%ifarch loongarch64
|
||||||
Patch6: 0005-crash-add-loongarch-support.patch
|
Patch3: 0003-crash-add-loongarch-support.patch
|
||||||
%endif
|
%endif
|
||||||
Patch7: 0006-Fix-compilation-error-due-to-new-strlcpy-function-th.patch
|
|
||||||
|
|
||||||
BuildRequires: ncurses-devel zlib-devel lzo-devel snappy-devel texinfo libzstd-devel
|
BuildRequires: ncurses-devel zlib-devel lzo-devel snappy-devel texinfo libzstd-devel
|
||||||
BuildRequires: gcc gcc-c++ bison m4
|
BuildRequires: gcc gcc-c++ bison m4
|
||||||
@ -85,6 +80,9 @@ install -D -m 0644 defs.h %{buildroot}%{_includedir}/%{name}/defs.h
|
|||||||
%{_mandir}/man8/crash.8*
|
%{_mandir}/man8/crash.8*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* 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
|
* Tue Aug 1 2023 chenhaixiang<chenhaixiang3@huawei.com> - 8.0.2-4
|
||||||
- Fix compilation error due to new strlcpy function that glibc added
|
- Fix compilation error due to new strlcpy function that glibc added
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user