* [PATCH] sadump, kaslr: fix failure of calculating kaslr_offset
@ 2022-01-25 12:55 d.hatayama
2022-01-26 1:43 ` HAGIO KAZUHITO =?unknown-8bit?b?6JCp5bC+IOS4gOS7gQ==?=
0 siblings, 1 reply; 2+ messages in thread
From: d.hatayama @ 2022-01-25 12:55 UTC (permalink / raw)
To: kexec
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 <d.hatayama@fujitsu.com>
---
makedumpfile.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/makedumpfile.c b/makedumpfile.c
index a51bdaf..7ed9756 100644
--- a/makedumpfile.c
+++ b/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.31.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] sadump, kaslr: fix failure of calculating kaslr_offset
2022-01-25 12:55 [PATCH] sadump, kaslr: fix failure of calculating kaslr_offset d.hatayama
@ 2022-01-26 1:43 ` HAGIO KAZUHITO =?unknown-8bit?b?6JCp5bC+IOS4gOS7gQ==?=
0 siblings, 0 replies; 2+ messages in thread
From: HAGIO KAZUHITO =?unknown-8bit?b?6JCp5bC+IOS4gOS7gQ==?= @ 2022-01-26 1:43 UTC (permalink / raw)
To: kexec
-----Original Message-----
> 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 <d.hatayama@fujitsu.com>
> ---
> makedumpfile.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/makedumpfile.c b/makedumpfile.c
> index a51bdaf..7ed9756 100644
> --- a/makedumpfile.c
> +++ b/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.31.1
Thanks, applied.
https://github.com/makedumpfile/makedumpfile/commit/59b1726fbcc251155140c8a1972384498fee4daf
Kazu
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-01-26 1:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-25 12:55 [PATCH] sadump, kaslr: fix failure of calculating kaslr_offset d.hatayama
2022-01-26 1:43 ` HAGIO KAZUHITO =?unknown-8bit?b?6JCp5bC+IOS4gOS7gQ==?=
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.