crash/0004-support-vmp_area_list-replaced-with-VMALLOC_START.patch

39 lines
1.1 KiB
Diff
Raw Permalink Normal View History

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