Blame SOURCES/kexec-tools-2.0.14-makedumpfile-makedumpfile-Correct-the-calculation-of.patch

766e0d
From 4c53423b995463067fbbd394e724b4d1d6ea3d62 Mon Sep 17 00:00:00 2001
766e0d
Message-Id: <4c53423b995463067fbbd394e724b4d1d6ea3d62.1489471500.git.panand@redhat.com>
766e0d
In-Reply-To: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand@redhat.com>
766e0d
References: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand@redhat.com>
766e0d
From: Baoquan He <bhe@redhat.com>
766e0d
Date: Thu, 2 Mar 2017 17:37:19 +0900
766e0d
Subject: [PATCH 5/7] [PATCH v3 5/7] makedumpfile: Correct the calculation of
766e0d
 kvaddr in set_kcore_vmcoreinfo
766e0d
766e0d
In set_kcore_vmcoreinfo, we calculate the virtual address of vmcoreinfo
766e0d
by OR operation as below:
766e0d
766e0d
	kvaddr = (ulong)vmcoreinfo_addr | PAGE_OFFSET;
766e0d
766e0d
When mm sections kaslr is not enabled, this is correct since the
766e0d
starting address of direct mapping section is 0xffff880000000000 which
766e0d
is 1T aligned.  Usually system with memory below 1T won't cause problem.
766e0d
766e0d
However with mm section kaslr enabled, the starting address of direct
766e0d
mapping is 1G aligned. The above code makes kvaddr unsure.
766e0d
766e0d
So change it to adding operation:
766e0d
	kvaddr = (ulong)vmcoreinfo_addr + PAGE_OFFSET;
766e0d
766e0d
Signed-off-by: Baoquan He <bhe@redhat.com>
766e0d
---
766e0d
 elf_info.c | 2 +-
766e0d
 1 file changed, 1 insertion(+), 1 deletion(-)
766e0d
766e0d
diff --git a/makedumpfile-1.6.1/elf_info.c b/makedumpfile-1.6.1/elf_info.c
766e0d
index c5743b3cab28..100272f83c48 100644
766e0d
--- a/makedumpfile-1.6.1/elf_info.c
766e0d
+++ b/makedumpfile-1.6.1/elf_info.c
766e0d
@@ -372,7 +372,7 @@ int set_kcore_vmcoreinfo(uint64_t vmcoreinfo_addr, uint64_t vmcoreinfo_len)
766e0d
 	off_t offset_desc;
766e0d
 
766e0d
 	offset = UNINITIALIZED;
766e0d
-	kvaddr = (ulong)vmcoreinfo_addr | PAGE_OFFSET;
766e0d
+	kvaddr = (ulong)vmcoreinfo_addr + PAGE_OFFSET;
766e0d
 
766e0d
 	for (i = 0; i < num_pt_loads; ++i) {
766e0d
 		struct pt_load_segment *p = &pt_loads[i];
766e0d
-- 
766e0d
2.9.3
766e0d