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

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