Blame SOURCES/kexec-tools-2.0.15-makedumpfile-x86_64-Fix-incorrect-exclusion-by-e-option-wit.patch

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