diff -Nru kexec-tools-2.0.10/debian/changelog kexec-tools-2.0.10/debian/changelog --- kexec-tools-2.0.10/debian/changelog 2017-06-23 18:27:52.000000000 +0000 +++ kexec-tools-2.0.10/debian/changelog 2017-09-12 13:47:10.000000000 +0000 @@ -1,3 +1,13 @@ +kexec-tools (1:2.0.10-1ubuntu2.4) xenial; urgency=medium + + [Marcelo Henrique Cerri] + * [Hyper-V] 16.04 kexec-tools doesn't match linux-azure (LP: #1712867) + - [PATCH] build_mem_phdrs(): check if p_paddr is invalid + - [PATCH] kexec-tools/x86: get_kernel_vaddr_and_size off-by-one fix + - Increase crashkernel size to 256M for machines with 2G or more of memory. + + -- Stefan Bader Tue, 12 Sep 2017 09:12:32 +0200 + kexec-tools (1:2.0.10-1ubuntu2.3) xenial; urgency=medium * Add backport of upstream arm64 crashdump support (LP: #1694859). diff -Nru kexec-tools-2.0.10/debian/kexec-tools.grub kexec-tools-2.0.10/debian/kexec-tools.grub --- kexec-tools-2.0.10/debian/kexec-tools.grub 2016-03-25 15:55:53.000000000 +0000 +++ kexec-tools-2.0.10/debian/kexec-tools.grub 2017-09-08 20:24:19.000000000 +0000 @@ -1 +1 @@ -GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT crashkernel=384M-:128M" +GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT crashkernel=384M-2G:128M,2G-:256M" diff -Nru kexec-tools-2.0.10/debian/patches/build_mem_phdrs-check-if-p_paddr-is-invalid.patch kexec-tools-2.0.10/debian/patches/build_mem_phdrs-check-if-p_paddr-is-invalid.patch --- kexec-tools-2.0.10/debian/patches/build_mem_phdrs-check-if-p_paddr-is-invalid.patch 1970-01-01 00:00:00.000000000 +0000 +++ kexec-tools-2.0.10/debian/patches/build_mem_phdrs-check-if-p_paddr-is-invalid.patch 2017-09-08 20:18:58.000000000 +0000 @@ -0,0 +1,39 @@ +From ed15ba1b9977e506637ff1697821d97127b2c919 Mon Sep 17 00:00:00 2001 +From: Pratyush Anand +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 +Acked-by: Dave Young +Signed-off-by: Simon Horman +--- + kexec/kexec-elf.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +Index: kexec-tools-2.0.10/kexec/kexec-elf.c +=================================================================== +--- kexec-tools-2.0.10.orig/kexec/kexec-elf.c 2017-09-08 17:18:48.192494797 -0300 ++++ kexec-tools-2.0.10/kexec/kexec-elf.c 2017-09-08 17:18:48.192494797 -0300 +@@ -432,7 +432,8 @@ + } + 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"); diff -Nru kexec-tools-2.0.10/debian/patches/kexec-tools-x86-get_kernel_vaddr_and_size-off-by-one.patch kexec-tools-2.0.10/debian/patches/kexec-tools-x86-get_kernel_vaddr_and_size-off-by-one.patch --- kexec-tools-2.0.10/debian/patches/kexec-tools-x86-get_kernel_vaddr_and_size-off-by-one.patch 1970-01-01 00:00:00.000000000 +0000 +++ kexec-tools-2.0.10/debian/patches/kexec-tools-x86-get_kernel_vaddr_and_size-off-by-one.patch 2017-09-08 20:20:14.000000000 +0000 @@ -0,0 +1,39 @@ +From dbb99d938810b60035122a1bcc68c4d585a0e57f Mon Sep 17 00:00:00 2001 +From: Dave Young +Date: Thu, 8 Dec 2016 10:52:22 +0800 +Subject: [PATCH] kexec-tools/x86: get_kernel_vaddr_and_size off-by-one fix + +I got below error while tesing kexec -p: +"Can't find kernel text map area from kcore" + +The case is the pt_load start addr was same as stext_sym. The checking +code should really be saddr <= stext_sym so that the right pt_load area +includes stext_sym can be matched. + +This was not reported by people previously because it will fail over to +use hardcode X86_64__START_KERNEL_map to match the pt_load areas again +in later code and it sometimes succeeds because of kernel address +randomization. + +With this change according to my test stext_sym checking can garantee +falling into right pt_load area if we get correct stext_sym. + +Signed-off-by: Dave Young +Signed-off-by: Simon Horman +--- + kexec/arch/i386/crashdump-x86.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: kexec-tools-2.0.10/kexec/arch/i386/crashdump-x86.c +=================================================================== +--- kexec-tools-2.0.10.orig/kexec/arch/i386/crashdump-x86.c 2017-09-08 17:20:11.621385081 -0300 ++++ kexec-tools-2.0.10/kexec/arch/i386/crashdump-x86.c 2017-09-08 17:20:11.617385041 -0300 +@@ -175,7 +175,7 @@ + unsigned long long size; + + /* Look for kernel text mapping header. */ +- if (saddr < stext_sym && eaddr > stext_sym) { ++ if (saddr <= stext_sym && eaddr > stext_sym) { + saddr = _ALIGN_DOWN(saddr, X86_64_KERN_VADDR_ALIGN); + elf_info->kern_vaddr_start = saddr; + size = eaddr - saddr; diff -Nru kexec-tools-2.0.10/debian/patches/series kexec-tools-2.0.10/debian/patches/series --- kexec-tools-2.0.10/debian/patches/series 2017-06-23 18:27:21.000000000 +0000 +++ kexec-tools-2.0.10/debian/patches/series 2017-09-08 20:20:08.000000000 +0000 @@ -38,3 +38,5 @@ 0008-arm64-kdump-set-up-other-segments.patch 0009-arm64-kdump-add-DT-properties-to-crash-dump-kernel-s.patch 0010-arm64-kdump-Add-support-for-binary-image-files.patch +build_mem_phdrs-check-if-p_paddr-is-invalid.patch +kexec-tools-x86-get_kernel_vaddr_and_size-off-by-one.patch