Fix crash parsing vmcore file failed for loongarch64

This commit is contained in:
zhangzikang1992 2024-07-30 14:41:24 +08:00
parent bc79147fb7
commit 66aac54683
2 changed files with 44 additions and 1 deletions

View File

@ -0,0 +1,38 @@
From 1fd01b81fc1d7ba1a0dde4bfd10e6ad9189e8376 Mon Sep 17 00:00:00 2001
From: zhangzikang <zhangzikang@kylinos.cn>
Date: Fri, 16 Aug 2024 14:45:33 +0800
Subject: [PATCH] support vmp_area_list replaced with VMALLOC_START
---
memory.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/memory.c b/memory.c
index 86ccec5..c3c18a2 100644
--- a/memory.c
+++ b/memory.c
@@ -17218,11 +17218,20 @@ first_vmalloc_address(void)
{
static ulong vmalloc_start = 0;
ulong vm_struct, vmap_area;
+ char *vmalloc_start_string;
if (DUMPFILE() && vmalloc_start)
return vmalloc_start;
- if (vt->flags & USE_VMAP_AREA) {
+ /*
+ * 'vmap_area_list' and 'vmlist' in Linux 6.9 and later kernels might be
+ * empty, prefer NUMBER(VMALLOC_START) if exported in vmcoreinfo.
+ */
+ vmalloc_start_string = pc->read_vmcoreinfo("NUMBER(VMALLOC_START)");
+ if (vmalloc_start_string) {
+ vmalloc_start = htol(vmalloc_start_string, QUIET, NULL);
+ free(vmalloc_start_string);
+ }else if (vt->flags & USE_VMAP_AREA) {
get_symbol_data("vmap_area_list", sizeof(void *), &vmap_area);
if (!vmap_area)
return 0;
--
2.43.0

View File

@ -1,6 +1,6 @@
Name: crash
Version: 8.0.4
Release: 3
Release: 4
Summary: Linux kernel crash utility.
License: GPLv3
URL: https://crash-utility.github.io
@ -11,6 +11,7 @@ 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-support-vmp_area_list-replaced-with-VMALLOC_START.patch
BuildRequires: ncurses-devel zlib-devel lzo-devel snappy-devel texinfo libzstd-devel
BuildRequires: gcc gcc-c++ bison m4
@ -49,6 +50,7 @@ created by manufacturer-specific firmware.
%endif
%ifarch loongarch64
%patch3 -p1
%patch4 -p1
%endif
%build
@ -84,6 +86,9 @@ install -D -m 0644 defs.h %{buildroot}%{_includedir}/%{name}/defs.h
%{_mandir}/man8/crash.8*
%changelog
* Tue Jul 30 2024 zhangzikang <zhangzikang@kylinos.cn> - 8.0.4-4
- Fix crash parsing vmcore file failed for loongarch64
* 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.