kexec-tools/kexec-tools-2.0.14-build_mem_phdrs-check-if-p_paddr-is-invalid.patch

44 lines
1.5 KiB
Diff
Raw Normal View History

Fix `makedumpfile --mem-usage /proc/kcore` Patches have been taken from kexec-tools and makedumpfile to fix issue with `makedumpfile --mem-usage /proc/kcore`. Two of the patches is from kexec-tools and rest are from makedumpfile. All the patches have been acked upstream and applies without conflict. Kexec-tools patches: (kexec-tools-2.0.14-x86-x86_64-Fix-format-warning-with-die.patch), which fixes koji build issue. kexec-tools-2.0.14-build_mem_phdrs-check-if-p_paddr-is-invalid.patch fixes the regresssion caused by kernel /proc/kcore fix to use -1 as default value of p_paddr for pt_loads. Without his patch kexec -p will fail with latest kernel. Other makedumpfile patches are backported to support --mem-usage while kernel kaslr being enabled. Details please see the patch log of the individual patches. All the patches are backport of upstream commits. Patches has been tested with kernel 4.11.0-0.rc1.git0.1.fc26.x86_64. # makedumpfile --mem-usage /proc/kcore -f The kernel version is not supported. The makedumpfile operation may be incomplete. TYPE PAGES EXCLUDABLE DESCRIPTION ---------------------------------------------------------------------- ZERO 1960 yes Pages filled with zero NON_PRI_CACHE 22850 yes Cache pages without private flag PRI_CACHE 1517 yes Cache pages with private flag USER 32522 yes User process pages FREE 1898981 yes Free pages KERN_DATA 78721 no Dumpable kernel data page size: 4096 Total pages on system: 2036551 Total size on system: 8341712896 Byte We won't need to pass -f once fedora kernel is rebased with v4.12. Signed-off-by: Pratyush Anand <panand@redhat.com> Acked-by: Dave Young <dyoung@redhat.com>
2017-03-14 15:28:30 +00:00
From 5520739f1e6e31c7731d34d384bbaf4904282931 Mon Sep 17 00:00:00 2001
Message-Id: <5520739f1e6e31c7731d34d384bbaf4904282931.1489470510.git.panand@redhat.com>
From: Pratyush Anand <panand@redhat.com>
Date: Wed, 1 Mar 2017 11:19:42 +0530
Subject: [PATCH] build_mem_phdrs(): check if p_paddr is invalid
Currently, all the p_paddr of PT_LOAD headers are assigned to 0, which
is not correct and could be misleading, since 0 is a valid physical
address.
Upstream kernel commit "464920104bf7 /proc/kcore: update physical
address for kcore ram and text" fixed it and now invalid PT_LOAD is
assigned as -1.
kexec/arch/i386/crashdump-x86.c:get_kernel_vaddr_and_size() uses kcore
interface and so calls build_mem_phdrs() for kcore PT_LOAD headers.
This patch fixes build_mem_phdrs() to check if p_paddr is invalid.
Signed-off-by: Pratyush Anand <panand@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
kexec/kexec-elf.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kexec/kexec-elf.c b/kexec/kexec-elf.c
index 1d6320a2f0e6..be60bbd48486 100644
--- a/kexec/kexec-elf.c
+++ b/kexec/kexec-elf.c
@@ -432,7 +432,8 @@ static int build_mem_phdrs(const char *buf, off_t len, struct mem_ehdr *ehdr,
}
return -1;
}
- if ((phdr->p_paddr + phdr->p_memsz) < phdr->p_paddr) {
+ if (phdr->p_paddr != (unsigned long long)-1 &&
+ (phdr->p_paddr + phdr->p_memsz) < phdr->p_paddr) {
/* The memory address wraps */
if (probe_debug) {
fprintf(stderr, "ELF address wrap around\n");
--
2.9.3