[Crash-utility] [PATCH 1/1] arm64: Fix missing offset for modules_vaddr with aarch64 guest dump

Masayoshi Mizuma msys.mizuma at gmail.com
Mon Jan 27 14:46:24 UTC 2020


From: Masayoshi Mizuma <m.mizuma at jp.fujitsu.com>

Fix for aarch64 with Linux v5.0 and later kernels that
contains commit 91fc957c9b1d ("arm64/bpf: don't allocate
BPF JIT programs in module memory") and the memory dump
is captured by virsh dump.
Without the patch, crash cannot find kimage_voffset so it
fails to run, like as:

   # crash vmlinux Guest.dump
   ...
   WARNING: kimage_voffset cannot be determined from the dumpfile.
          Try using the command line option: --machdep kimage_voffset=<addr>
   ...
   crash: read error: kernel virtual address: ffff0000112db978  type: "possible"
   WARNING: cannot read cpu_possible_map
   ...
   crash: vmlinux and Guest.dump do not match!
   ...
   #

This issue happens on the memory dump which is captured by virsh dump
because kimage_voffset isn't stored if it's captured by virsh dump.

Signed-off-by: Masayoshi Mizuma <m.mizuma at jp.fujitsu.com>
---
 arm64.c | 2 ++
 defs.h  | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/arm64.c b/arm64.c
index 7662d71..0831231 100644
--- a/arm64.c
+++ b/arm64.c
@@ -242,6 +242,8 @@ arm64_init(int when)
 				ms->modules_vaddr = ARM64_VA_START;
 				if (kernel_symbol_exists("kasan_init"))
 					ms->modules_vaddr += ARM64_KASAN_SHADOW_SIZE;
+				if (kernel_symbol_exists("bpf_jit_alloc_exec"))
+					ms->modules_vaddr += BPF_JIT_REGION_SIZE;
 				ms->modules_end = ms->modules_vaddr + ARM64_MODULES_VSIZE -1;
 			}
 
diff --git a/defs.h b/defs.h
index efa40b9..867da74 100644
--- a/defs.h
+++ b/defs.h
@@ -3164,6 +3164,9 @@ typedef signed int s32;
 #define ARM64_MODULES_VSIZE     MEGABYTES(128)
 #define ARM64_KASAN_SHADOW_SIZE (1UL << (machdep->machspec->VA_BITS - 3))
 
+/* only used for v5.0 or later */
+#define BPF_JIT_REGION_SIZE	MEGABYTES(128)
+
 /*
  * The following 3 definitions are the original values, but are obsolete
  * for 3.17 and later kernels because they are now build-time calculations.
-- 
2.18.1





More information about the Crash-utility mailing list