diff --git a/kexec-tools-2.0.23-makedumpfile-sadump-kaslr-fix-failure-of-calculating-kaslr_.patch b/kexec-tools-2.0.23-makedumpfile-sadump-kaslr-fix-failure-of-calculating-kaslr_.patch new file mode 100644 index 0000000..e7a47b5 --- /dev/null +++ b/kexec-tools-2.0.23-makedumpfile-sadump-kaslr-fix-failure-of-calculating-kaslr_.patch @@ -0,0 +1,49 @@ +From 59b1726fbcc251155140c8a1972384498fee4daf Mon Sep 17 00:00:00 2001 +From: HATAYAMA Daisuke +Date: Tue, 25 Jan 2022 12:55:15 +0000 +Subject: [PATCH] [PATCH] sadump, kaslr: fix failure of calculating + kaslr_offset + +On kernels v5.8 or later, makedumpfile fails for memory dumps in the +sadump-related formats as follows: + + # makedumpfile -f -l -d 31 -x ./vmlinux /dev/sdd4 /root/vmcore-ld31 + __vtop4_x86_64: Can't get a valid pud_pte. + ...110 lines of the same message... + __vtop4_x86_64: Can't get a valid pud_pte. + calc_kaslr_offset: failed to calculate kaslr_offset and phys_base; default to 0 + readmem: type_addr: 1, addr:ffffffff85411858, size:8 + __vtop4_x86_64: Can't get pgd (page_dir:ffffffff85411858). + readmem: Can't convert a virtual address(ffffffff059be980) to physical address. + readmem: type_addr: 0, addr:ffffffff059be980, size:1024 + cpu_online_mask_init: Can't read cpu_online_mask memory. + + makedumpfile Failed. + +This is caused by the kernel commit 9d06c4027f21 ("x86/entry: Convert +Divide Error to IDTENTRY") that renamed divide_error to +asm_exc_divide_error, breaking logic for calculating kaslr offset. + +Fix this by adding initialization of asm_exc_divide_error. + +Signed-off-by: HATAYAMA Daisuke +--- + makedumpfile.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/makedumpfile-1.7.0/makedumpfile.c b/makedumpfile-1.7.0/makedumpfile.c +index a51bdaf..7ed9756 100644 +--- a/makedumpfile-1.7.0/makedumpfile.c ++++ b/makedumpfile-1.7.0/makedumpfile.c +@@ -1667,6 +1667,8 @@ get_symbol_info(void) + SYMBOL_INIT(cur_cpu_spec, "cur_cpu_spec"); + + SYMBOL_INIT(divide_error, "divide_error"); ++ if (SYMBOL(divide_error) == NOT_FOUND_SYMBOL) ++ SYMBOL_INIT(divide_error, "asm_exc_divide_error"); + SYMBOL_INIT(idt_table, "idt_table"); + SYMBOL_INIT(saved_command_line, "saved_command_line"); + SYMBOL_INIT(pti_init, "pti_init"); +-- +2.33.1 + diff --git a/kexec-tools.spec b/kexec-tools.spec index 696bc80..eb496b6 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -112,6 +112,7 @@ Requires: systemd-udev%{?_isa} # Patches 601 onward are generic patches # Patch601: ./kexec-tools-2.0.22-01-s390_handle_R_390_PLT32DBL_reloc_entries_in_machine_apply_elf_rel_.patch +Patch602: ./kexec-tools-2.0.23-makedumpfile-sadump-kaslr-fix-failure-of-calculating-kaslr_.patch %description kexec-tools provides /sbin/kexec binary that facilitates a new @@ -128,6 +129,7 @@ tar -z -x -v -f %{SOURCE9} tar -z -x -v -f %{SOURCE19} %patch601 -p1 +%patch602 -p1 %ifarch ppc %define archdef ARCH=ppc