From 3595d7c1364d08e49ae1a83c9d6ae64f901eaf9d Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 5 Apr 2022 05:47:00 -0400 Subject: [PATCH] import crash-8.0.0-6.el9 --- ..._ARM64_VA_BITS-to-initialize-VA_BITS.patch | 34 +++++++++ ...-start-address-of-kernel-code-based-.patch | 69 +++++++++++++++++++ SPECS/crash.spec | 9 ++- 3 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 SOURCES/0001-arm64-Use-CONFIG_ARM64_VA_BITS-to-initialize-VA_BITS.patch create mode 100644 SOURCES/0001-arm64-deduce-the-start-address-of-kernel-code-based-.patch diff --git a/SOURCES/0001-arm64-Use-CONFIG_ARM64_VA_BITS-to-initialize-VA_BITS.patch b/SOURCES/0001-arm64-Use-CONFIG_ARM64_VA_BITS-to-initialize-VA_BITS.patch new file mode 100644 index 0000000..ffc3f85 --- /dev/null +++ b/SOURCES/0001-arm64-Use-CONFIG_ARM64_VA_BITS-to-initialize-VA_BITS.patch @@ -0,0 +1,34 @@ +From 6ecb8a23ca294de5ef92726c782f4c92fcb39d92 Mon Sep 17 00:00:00 2001 +From: Huang Shijie +Date: Fri, 11 Feb 2022 09:46:42 +0000 +Subject: [PATCH] arm64: Use CONFIG_ARM64_VA_BITS to initialize VA_BITS_ACTUAL + +We can get VA_BITS_ACTUAL from CONFIG_ARM64_VA_BITS by guess. + +Without this patch, we may need to use "--machdep vabits_actual=48" to +set the VA_BITS_ACTUAL. + +Signed-off-by: Huang Shijie +--- + arm64.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/arm64.c b/arm64.c +index 4f2c2b5..de1038a 100644 +--- a/arm64.c ++++ b/arm64.c +@@ -4170,6 +4170,11 @@ arm64_calc_VA_BITS(void) + } else if (machdep->machspec->VA_BITS_ACTUAL) { + machdep->machspec->VA_BITS = machdep->machspec->VA_BITS_ACTUAL; + machdep->machspec->VA_START = _VA_START(machdep->machspec->VA_BITS_ACTUAL); ++ } else if (machdep->machspec->CONFIG_ARM64_VA_BITS) { ++ /* guess */ ++ machdep->machspec->VA_BITS_ACTUAL = machdep->machspec->CONFIG_ARM64_VA_BITS; ++ machdep->machspec->VA_BITS = machdep->machspec->CONFIG_ARM64_VA_BITS; ++ machdep->machspec->VA_START = _VA_START(machdep->machspec->VA_BITS_ACTUAL); + } else + error(FATAL, "cannot determine VA_BITS_ACTUAL\n"); + } +-- +2.31.1 + diff --git a/SOURCES/0001-arm64-deduce-the-start-address-of-kernel-code-based-.patch b/SOURCES/0001-arm64-deduce-the-start-address-of-kernel-code-based-.patch new file mode 100644 index 0000000..0454be6 --- /dev/null +++ b/SOURCES/0001-arm64-deduce-the-start-address-of-kernel-code-based-.patch @@ -0,0 +1,69 @@ +From e3bdc32aab5d8fe09b679cf394da8ba8826e207f Mon Sep 17 00:00:00 2001 +From: Pingfan Liu +Date: Thu, 24 Feb 2022 11:52:12 +0800 +Subject: [PATCH] arm64: deduce the start address of kernel code, based on + kernel version + +After kernel commit e2a073dde921 ("arm64: omit [_text, _stext) from +permanent kernel mapping"), the range [_text, _stext] is reclaimed. But +the current crash code still assumes kernel starting from "_text". + +This change only affects the vmalloced area on arm64 and may result a +false in arm64_IS_VMALLOC_ADDR(). + +Since vmcore has no extra information about this trival change, it can +only be deduced from kernel version, which means ms->kimage_text can not +be correctly initialized until kernel_init() finishes. Here on arm64, it +can be done at the point machdep_init(POST_GDB). This is fine +since there is no access to vmalloced area at this stage. + +Signed-off-by: Pingfan Liu +--- + arm64.c | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/arm64.c b/arm64.c +index de1038a..3ab8489 100644 +--- a/arm64.c ++++ b/arm64.c +@@ -92,6 +92,20 @@ static void arm64_calc_VA_BITS(void); + static int arm64_is_uvaddr(ulong, struct task_context *); + static void arm64_calc_KERNELPACMASK(void); + ++static void arm64_calc_kernel_start(void) ++{ ++ struct machine_specific *ms = machdep->machspec; ++ struct syment *sp; ++ ++ if (THIS_KERNEL_VERSION >= LINUX(5,11,0)) ++ sp = kernel_symbol_search("_stext"); ++ else ++ sp = kernel_symbol_search("_text"); ++ ++ ms->kimage_text = (sp ? sp->value : 0); ++ sp = kernel_symbol_search("_end"); ++ ms->kimage_end = (sp ? sp->value : 0); ++} + + /* + * Do all necessary machine-specific setup here. This is called several times +@@ -241,6 +255,7 @@ arm64_init(int when) + if (machdep->flags & NEW_VMEMMAP) { + struct syment *sp; + ++ /* It is finally decided in arm64_calc_kernel_start() */ + sp = kernel_symbol_search("_text"); + ms->kimage_text = (sp ? sp->value : 0); + sp = kernel_symbol_search("_end"); +@@ -387,6 +402,8 @@ arm64_init(int when) + break; + + case POST_GDB: ++ /* Rely on kernel version to decide the kernel start address */ ++ arm64_calc_kernel_start(); + arm64_calc_virtual_memory_ranges(); + arm64_get_section_size_bits(); + +-- +2.31.1 + diff --git a/SPECS/crash.spec b/SPECS/crash.spec index d9a5ff4..d6de6a9 100644 --- a/SPECS/crash.spec +++ b/SPECS/crash.spec @@ -4,7 +4,7 @@ Summary: Kernel analysis utility for live systems, netdump, diskdump, kdump, LKCD or mcore dumpfiles Name: crash Version: 8.0.0 -Release: 5%{?dist} +Release: 6%{?dist} License: GPLv3 Source0: https://github.com/crash-utility/crash/archive/crash-%{version}.tar.gz Source1: http://ftp.gnu.org/gnu/gdb/gdb-10.2.tar.gz @@ -34,6 +34,8 @@ Patch13: 0007-GDB-fix-completion-related-libstdc-assert.patch Patch14: 0008-Improve-the-ps-performance-for-vmcores-with-large-nu.patch Patch15: 0009-arm64-Fix-segfault-by-bt-command-with-offline-cpus.patch Patch16: 0010-Fix-for-kmem-s-S-and-bt-F-F-on-Linux-5.17-rc1.patch +Patch17: 0001-arm64-Use-CONFIG_ARM64_VA_BITS-to-initialize-VA_BITS.patch +Patch18: 0001-arm64-deduce-the-start-address-of-kernel-code-based-.patch %description The core analysis suite is a self-contained tool that can be used to @@ -70,6 +72,8 @@ offered by Mission Critical Linux, or the LKCD kernel patch. %patch14 -p1 %patch15 -p1 %patch16 -p1 +%patch17 -p1 +%patch18 -p1 %build @@ -95,6 +99,9 @@ cp -p defs.h %{buildroot}%{_includedir}/crash %{_includedir}/* %changelog +* Fri Mar 04 2022 Lianbo Jiang - 8.0.0-6 +- Fix for "bt: read of IRQ stack failed" issue on aarch64 + * Mon Feb 07 2022 Lianbo Jiang - 8.0.0-5 - Fix segfault on aarch64 for "bt -a|-c" command - Fix segfault for the "l" command of gdb