summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPratyush Anand <panand@redhat.com>2017-03-01 11:19:42 +0530
committerSimon Horman <horms@verge.net.au>2017-03-13 09:57:16 +0100
commited15ba1b9977e506637ff1697821d97127b2c919 (patch)
treeedc019cb065478b5fae6df007d12ce72436e8509
parent263e45ccf27b21e9862cc538ed28978533d04e4b (diff)
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>
-rw-r--r--kexec/kexec-elf.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kexec/kexec-elf.c b/kexec/kexec-elf.c
index 1d6320a..be60bbd 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");