From aa5ab4cf6c7335392094577380d2eaee8a0a8d52 Mon Sep 17 00:00:00 2001
From: Kazuhito Hagio <k-hagio@ab.jp.nec.com>
Date: Thu, 29 Aug 2019 12:26:34 -0400
Subject: [PATCH] x86_64: Fix incorrect exclusion by -e option with KASLR
The -e option uses info->vmemmap_start for creating a table to determine
the positions of page structures that should be excluded, but it is a
hardcoded value even with KASLR-enabled vmcore. As a result, the option
excludes incorrect pages from it.
To fix this, get the vmemmap start address from info->mem_map_data.
Signed-off-by: Kazuhito Hagio <k-hagio@ab.jp.nec.com>
---
arch/x86_64.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/makedumpfile-1.6.2/arch/x86_64.c b/makedumpfile-1.6.2/arch/x86_64.c
index 3c0fdc5e72fb..4eeaf4925f43 100644
--- a/makedumpfile-1.6.2/arch/x86_64.c
+++ b/makedumpfile-1.6.2/arch/x86_64.c
@@ -579,6 +579,16 @@ find_vmemmap_x86_64()
if (NUMBER(sme_mask) != NOT_FOUND_NUMBER)
pmask &= ~(NUMBER(sme_mask));
+ /*
+ * vmemmap region can be randomized by KASLR.
+ * (currently we don't utilize info->vmemmap_end on x86_64.)
+ */
+ if (info->mem_map_data &&
+ info->mem_map_data[0].mem_map != NOT_MEMMAP_ADDR)
+ info->vmemmap_start = info->mem_map_data[0].mem_map;
+
+ DEBUG_MSG("vmemmap_start: %16lx\n", info->vmemmap_start);
+
pagestructsize = size_table.page;
hugepagesize = PTRS_PER_PMD * info->page_size;
vaddr_base = info->vmemmap_start;
--
2.18.1