Blame kexec-tools-2.0.23-makedumpfile-sadump-kaslr-fix-failure-of-calculating-kaslr_.patch

6e2f52
From 59b1726fbcc251155140c8a1972384498fee4daf Mon Sep 17 00:00:00 2001
6e2f52
From: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
6e2f52
Date: Tue, 25 Jan 2022 12:55:15 +0000
6e2f52
Subject: [PATCH] [PATCH] sadump, kaslr: fix failure of calculating
6e2f52
 kaslr_offset
6e2f52
6e2f52
On kernels v5.8 or later, makedumpfile fails for memory dumps in the
6e2f52
sadump-related formats as follows:
6e2f52
6e2f52
    # makedumpfile -f -l -d 31 -x ./vmlinux /dev/sdd4 /root/vmcore-ld31
6e2f52
    __vtop4_x86_64: Can't get a valid pud_pte.
6e2f52
    ...110 lines of the same message...
6e2f52
    __vtop4_x86_64: Can't get a valid pud_pte.
6e2f52
    calc_kaslr_offset: failed to calculate kaslr_offset and phys_base; default to 0
6e2f52
    readmem: type_addr: 1, addr:ffffffff85411858, size:8
6e2f52
    __vtop4_x86_64: Can't get pgd (page_dir:ffffffff85411858).
6e2f52
    readmem: Can't convert a virtual address(ffffffff059be980) to physical address.
6e2f52
    readmem: type_addr: 0, addr:ffffffff059be980, size:1024
6e2f52
    cpu_online_mask_init: Can't read cpu_online_mask memory.
6e2f52
6e2f52
    makedumpfile Failed.
6e2f52
6e2f52
This is caused by the kernel commit 9d06c4027f21 ("x86/entry: Convert
6e2f52
Divide Error to IDTENTRY") that renamed divide_error to
6e2f52
asm_exc_divide_error, breaking logic for calculating kaslr offset.
6e2f52
6e2f52
Fix this by adding initialization of asm_exc_divide_error.
6e2f52
6e2f52
Signed-off-by: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
6e2f52
---
6e2f52
 makedumpfile.c | 2 ++
6e2f52
 1 file changed, 2 insertions(+)
6e2f52
6e2f52
diff --git a/makedumpfile-1.7.0/makedumpfile.c b/makedumpfile-1.7.0/makedumpfile.c
6e2f52
index a51bdaf..7ed9756 100644
6e2f52
--- a/makedumpfile-1.7.0/makedumpfile.c
6e2f52
+++ b/makedumpfile-1.7.0/makedumpfile.c
6e2f52
@@ -1667,6 +1667,8 @@ get_symbol_info(void)
6e2f52
 	SYMBOL_INIT(cur_cpu_spec, "cur_cpu_spec");
6e2f52
 
6e2f52
 	SYMBOL_INIT(divide_error, "divide_error");
6e2f52
+	if (SYMBOL(divide_error) == NOT_FOUND_SYMBOL)
6e2f52
+		SYMBOL_INIT(divide_error, "asm_exc_divide_error");
6e2f52
 	SYMBOL_INIT(idt_table, "idt_table");
6e2f52
 	SYMBOL_INIT(saved_command_line, "saved_command_line");
6e2f52
 	SYMBOL_INIT(pti_init, "pti_init");
6e2f52
-- 
6e2f52
2.33.1
6e2f52