diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 1f96bb8..46e6d1e 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -20,7 +20,7 @@ check() { depends() { local _dep="base shutdown" - if [ -d /sys/module/drm/drivers ]; then + if [ -n "$( find /sys/devices -name drm )" ]; then _dep="$_dep drm" fi diff --git a/kdump.sysconfig.x86_64 b/kdump.sysconfig.x86_64 index d4e26f5..f269d02 100644 --- a/kdump.sysconfig.x86_64 +++ b/kdump.sysconfig.x86_64 @@ -21,7 +21,7 @@ KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet" # This variable lets us append arguments to the current kdump commandline # after processed by KDUMP_COMMANDLINE_REMOVE -KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 rootflags=nofail acpi_no_memhotplug transparent_hugepage=never" +KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 rootflags=nofail acpi_no_memhotplug transparent_hugepage=never nokaslr" # Any additional kexec arguments required. In most situations, this should # be left empty diff --git a/kexec-tools-2.0.14-build_mem_phdrs-check-if-p_paddr-is-invalid.patch b/kexec-tools-2.0.14-build_mem_phdrs-check-if-p_paddr-is-invalid.patch new file mode 100644 index 0000000..f479086 --- /dev/null +++ b/kexec-tools-2.0.14-build_mem_phdrs-check-if-p_paddr-is-invalid.patch @@ -0,0 +1,43 @@ +From 5520739f1e6e31c7731d34d384bbaf4904282931 Mon Sep 17 00:00:00 2001 +Message-Id: <5520739f1e6e31c7731d34d384bbaf4904282931.1489470510.git.panand@redhat.com> +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(-) + +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 + diff --git a/kexec-tools-2.0.14-makedumpfile-elf_info-kcore-check-for-invalid-physic.patch b/kexec-tools-2.0.14-makedumpfile-elf_info-kcore-check-for-invalid-physic.patch new file mode 100644 index 0000000..1edff59 --- /dev/null +++ b/kexec-tools-2.0.14-makedumpfile-elf_info-kcore-check-for-invalid-physic.patch @@ -0,0 +1,47 @@ +From f4ab6897a716d3f3959f6cb8cab27744eaecb5a6 Mon Sep 17 00:00:00 2001 +Message-Id: +In-Reply-To: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand@redhat.com> +References: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand@redhat.com> +From: Pratyush Anand +Date: Thu, 2 Mar 2017 17:37:16 +0900 +Subject: [PATCH 4/7] [PATCH v3 4/7] elf_info: kcore: check for invalid + physical address + +kcore passes correct phys_start for direct mapped region and an invalid +value (-1) for all other regions after the kernel commit +464920104bf7(/proc/kcore: update physical address for kcore ram and +text). arch specific function is_phys_addr() accepts only virt_start. +Therefore, check for valid phys_start in get_kcore_dump_loads(). + +Signed-off-by: Pratyush Anand +--- + elf_info.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/makedumpfile-1.6.1/elf_info.c b/makedumpfile-1.6.1/elf_info.c +index 65ff333cf33a..c5743b3cab28 100644 +--- a/makedumpfile-1.6.1/elf_info.c ++++ b/makedumpfile-1.6.1/elf_info.c +@@ -881,7 +881,8 @@ int get_kcore_dump_loads(void) + + for (i = 0; i < num_pt_loads; ++i) { + struct pt_load_segment *p = &pt_loads[i]; +- if (!is_phys_addr(p->virt_start)) ++ if (p->phys_start == NOT_PADDR ++ || !is_phys_addr(p->virt_start)) + continue; + loads++; + } +@@ -901,7 +902,8 @@ int get_kcore_dump_loads(void) + + for (i = 0, j = 0; i < num_pt_loads; ++i) { + struct pt_load_segment *p = &pt_loads[i]; +- if (!is_phys_addr(p->virt_start)) ++ if (p->phys_start == NOT_PADDR ++ || !is_phys_addr(p->virt_start)) + continue; + if (j >= loads) + return FALSE; +-- +2.9.3 + diff --git a/kexec-tools-2.0.14-makedumpfile-initial-call-cache_init-a-bit-early.patch b/kexec-tools-2.0.14-makedumpfile-initial-call-cache_init-a-bit-early.patch new file mode 100644 index 0000000..8523767 --- /dev/null +++ b/kexec-tools-2.0.14-makedumpfile-initial-call-cache_init-a-bit-early.patch @@ -0,0 +1,47 @@ +From 8e2834bac4f62da3894da297f083068431be6d80 Mon Sep 17 00:00:00 2001 +Message-Id: <8e2834bac4f62da3894da297f083068431be6d80.1489471500.git.panand@redhat.com> +In-Reply-To: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand@redhat.com> +References: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand@redhat.com> +From: Pratyush Anand +Date: Thu, 2 Mar 2017 17:37:11 +0900 +Subject: [PATCH 2/7] [PATCH v3 2/7] initial(): call cache_init() a bit early + +Call cache_init() before get_kcore_dump_loads(), because latter uses +cache_search(). + +Call path is like this : +get_kcore_dump_loads() -> process_dump_load() -> vaddr_to_paddr() -> +vtop4_x86_64() -> readmem() -> cache_search() + +Signed-off-by: Pratyush Anand +--- + makedumpfile.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/makedumpfile-1.6.1/makedumpfile.c b/makedumpfile-1.6.1/makedumpfile.c +index 6942047199de..3b8e9810468d 100644 +--- a/makedumpfile-1.6.1/makedumpfile.c ++++ b/makedumpfile-1.6.1/makedumpfile.c +@@ -3878,6 +3878,9 @@ initial(void) + if (!get_value_for_old_linux()) + return FALSE; + ++ if (!is_xen_memory() && !cache_init()) ++ return FALSE; ++ + if (info->flag_mem_usage && !get_kcore_dump_loads()) + return FALSE; + +@@ -4000,9 +4003,6 @@ out: + } + } + +- if (!is_xen_memory() && !cache_init()) +- return FALSE; +- + if (debug_info && !get_machdep_info()) + return FALSE; + +-- +2.9.3 + diff --git a/kexec-tools-2.0.14-makedumpfile-makedumpfile-Correct-the-calculation-of.patch b/kexec-tools-2.0.14-makedumpfile-makedumpfile-Correct-the-calculation-of.patch new file mode 100644 index 0000000..16388c8 --- /dev/null +++ b/kexec-tools-2.0.14-makedumpfile-makedumpfile-Correct-the-calculation-of.patch @@ -0,0 +1,45 @@ +From 4c53423b995463067fbbd394e724b4d1d6ea3d62 Mon Sep 17 00:00:00 2001 +Message-Id: <4c53423b995463067fbbd394e724b4d1d6ea3d62.1489471500.git.panand@redhat.com> +In-Reply-To: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand@redhat.com> +References: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand@redhat.com> +From: Baoquan He +Date: Thu, 2 Mar 2017 17:37:19 +0900 +Subject: [PATCH 5/7] [PATCH v3 5/7] makedumpfile: Correct the calculation of + kvaddr in set_kcore_vmcoreinfo + +In set_kcore_vmcoreinfo, we calculate the virtual address of vmcoreinfo +by OR operation as below: + + kvaddr = (ulong)vmcoreinfo_addr | PAGE_OFFSET; + +When mm sections kaslr is not enabled, this is correct since the +starting address of direct mapping section is 0xffff880000000000 which +is 1T aligned. Usually system with memory below 1T won't cause problem. + +However with mm section kaslr enabled, the starting address of direct +mapping is 1G aligned. The above code makes kvaddr unsure. + +So change it to adding operation: + kvaddr = (ulong)vmcoreinfo_addr + PAGE_OFFSET; + +Signed-off-by: Baoquan He +--- + elf_info.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/makedumpfile-1.6.1/elf_info.c b/makedumpfile-1.6.1/elf_info.c +index c5743b3cab28..100272f83c48 100644 +--- a/makedumpfile-1.6.1/elf_info.c ++++ b/makedumpfile-1.6.1/elf_info.c +@@ -372,7 +372,7 @@ int set_kcore_vmcoreinfo(uint64_t vmcoreinfo_addr, uint64_t vmcoreinfo_len) + off_t offset_desc; + + offset = UNINITIALIZED; +- kvaddr = (ulong)vmcoreinfo_addr | PAGE_OFFSET; ++ kvaddr = (ulong)vmcoreinfo_addr + PAGE_OFFSET; + + for (i = 0; i < num_pt_loads; ++i) { + struct pt_load_segment *p = &pt_loads[i]; +-- +2.9.3 + diff --git a/kexec-tools-2.0.14-makedumpfile-makedumpfile-Discard-process_dump_load.patch b/kexec-tools-2.0.14-makedumpfile-makedumpfile-Discard-process_dump_load.patch new file mode 100644 index 0000000..30b0e0e --- /dev/null +++ b/kexec-tools-2.0.14-makedumpfile-makedumpfile-Discard-process_dump_load.patch @@ -0,0 +1,57 @@ +From f3ff8c6232de43fa2cc60f5ca0f233cf8eb8d2ad Mon Sep 17 00:00:00 2001 +Message-Id: +In-Reply-To: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand@redhat.com> +References: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand@redhat.com> +From: Baoquan He +Date: Thu, 2 Mar 2017 17:37:23 +0900 +Subject: [PATCH 6/7] [PATCH v3 6/7] makedumpfile: Discard process_dump_load + +Kernel commit 464920104bf7 (/proc/kcore: update physical address for +kcore ram and text) provides physical address of direct mapping kcore +program segments. So no need to calculate it specifically now. And the +old code is not correct since it calls vaddr_to_paddr() which has not +been ready at that time. + +Signed-off-by: Baoquan He +--- + elf_info.c | 17 ----------------- + 1 file changed, 17 deletions(-) + +diff --git a/makedumpfile-1.6.1/elf_info.c b/makedumpfile-1.6.1/elf_info.c +index 100272f83c48..8e2437622141 100644 +--- a/makedumpfile-1.6.1/elf_info.c ++++ b/makedumpfile-1.6.1/elf_info.c +@@ -857,22 +857,6 @@ static int exclude_segment(struct pt_load_segment **pt_loads, + return 0; + } + +-static int +-process_dump_load(struct pt_load_segment *pls) +-{ +- unsigned long long paddr; +- +- paddr = vaddr_to_paddr(pls->virt_start); +- pls->phys_start = paddr; +- pls->phys_end = paddr + (pls->virt_end - pls->virt_start); +- DEBUG_MSG("process_dump_load\n"); +- DEBUG_MSG(" phys_start : %llx\n", pls->phys_start); +- DEBUG_MSG(" phys_end : %llx\n", pls->phys_end); +- DEBUG_MSG(" virt_start : %llx\n", pls->virt_start); +- DEBUG_MSG(" virt_end : %llx\n", pls->virt_end); +- +- return TRUE; +-} + + int get_kcore_dump_loads(void) + { +@@ -917,7 +901,6 @@ int get_kcore_dump_loads(void) + } + + pls[j] = *p; +- process_dump_load(&pls[j]); + j++; + } + +-- +2.9.3 + diff --git a/kexec-tools-2.0.14-makedumpfile-mem-usage-allow-to-work-only-with-f-for.patch b/kexec-tools-2.0.14-makedumpfile-mem-usage-allow-to-work-only-with-f-for.patch new file mode 100644 index 0000000..9282a37 --- /dev/null +++ b/kexec-tools-2.0.14-makedumpfile-mem-usage-allow-to-work-only-with-f-for.patch @@ -0,0 +1,84 @@ +From 78cbb4035209add81563c00ba46d237f86b8c427 Mon Sep 17 00:00:00 2001 +Message-Id: <78cbb4035209add81563c00ba46d237f86b8c427.1489471500.git.panand@redhat.com> +In-Reply-To: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand@redhat.com> +References: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand@redhat.com> +From: Pratyush Anand +Date: Thu, 2 Mar 2017 17:37:25 +0900 +Subject: [PATCH 7/7] [PATCH v3 7/7] mem-usage: allow to work only with -f for + kernel version < 4.11 + +PT_LOAD of kcore does not have valid p_paddr values for kernel version +less that v4.11. Therefore, older kernel will no long work for mem-usage +with current makedumpfile code. They can only work when they are patched +with fix to "update physical address for kcore ram and text". + +This patch fixes the makedumpfile so that it does not allow to work +older kernel for --mem-usage until someone is sure that kernel is +rightly patched and so uses -f in command line. It also updates man page +and usage info accordingly. + +Signed-off-by: Pratyush Anand +--- + makedumpfile.8 | 9 ++++++++- + makedumpfile.c | 6 ++++++ + print_info.c | 1 + + 3 files changed, 15 insertions(+), 1 deletion(-) + +diff --git a/makedumpfile-1.6.1/makedumpfile.8 b/makedumpfile-1.6.1/makedumpfile.8 +index 9069fb18cdb6..993236486e77 100644 +--- a/makedumpfile-1.6.1/makedumpfile.8 ++++ b/makedumpfile-1.6.1/makedumpfile.8 +@@ -235,13 +235,20 @@ the ELF format does not support compressed data. + + .TP + \fB\-f\fR +-Force existing DUMPFILE to be overwritten. ++Force existing DUMPFILE to be overwritten and mem-usage to work with older ++kernel as well. + .br + .B Example: + .br + # makedumpfile \-f \-d 31 \-x vmlinux /proc/vmcore dumpfile + .br + This command overwrites \fIDUMPFILE\fR even if it already exists. ++.br ++# makedumpfile \-f \-\-mem\-usage /proc/kcore ++.br ++Kernel version lesser than v4.11 will not work with \-\-mem\-usage ++functionality until it has been patched with upstream commit 464920104bf7. ++Therefore if you have patched your older kernel then use \-f. + + .TP + \fB\-x\fR \fIVMLINUX\fR +diff --git a/makedumpfile-1.6.1/makedumpfile.c b/makedumpfile-1.6.1/makedumpfile.c +index 3b8e9810468d..e3be1ab0a9ec 100644 +--- a/makedumpfile-1.6.1/makedumpfile.c ++++ b/makedumpfile-1.6.1/makedumpfile.c +@@ -11269,6 +11269,12 @@ main(int argc, char *argv[]) + MSG("Try `makedumpfile --help' for more information.\n"); + goto out; + } ++ if (info->kernel_version < KERNEL_VERSION(4, 11, 0) && ++ !info->flag_force) { ++ MSG("mem-usage not supported for this kernel.\n"); ++ MSG("You can try with -f if your kernel's kcore has valid p_paddr\n"); ++ goto out; ++ } + + if (!show_mem_usage()) + goto out; +diff --git a/makedumpfile-1.6.1/print_info.c b/makedumpfile-1.6.1/print_info.c +index 392d863a4227..3c577d83cebb 100644 +--- a/makedumpfile-1.6.1/print_info.c ++++ b/makedumpfile-1.6.1/print_info.c +@@ -310,6 +310,7 @@ print_usage(void) + MSG("\n"); + MSG(" [-f]:\n"); + MSG(" Overwrite DUMPFILE even if it already exists.\n"); ++ MSG(" Force mem-usage to work with older kernel as well.\n"); + MSG("\n"); + MSG(" [-h, --help]:\n"); + MSG(" Show help message and LZO/snappy support status (enabled/disabled).\n"); +-- +2.9.3 + diff --git a/kexec-tools-2.0.14-makedumpfile-show_mem_usage-calculate-page-offset-af.patch b/kexec-tools-2.0.14-makedumpfile-show_mem_usage-calculate-page-offset-af.patch new file mode 100644 index 0000000..5f30a2a --- /dev/null +++ b/kexec-tools-2.0.14-makedumpfile-show_mem_usage-calculate-page-offset-af.patch @@ -0,0 +1,41 @@ +From 4b0bed3523a5f6c2c428d9dab3d27d4572207d52 Mon Sep 17 00:00:00 2001 +Message-Id: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand@redhat.com> +From: Pratyush Anand +Date: Thu, 2 Mar 2017 17:37:08 +0900 +Subject: [PATCH 1/7] [PATCH v3 1/7] show_mem_usage(): calculate page offset + after elf load + +x86_64 calculated page offset from PT_LOAD headers. Therefore call +get_page_offset() after get_elf_loads() + +Signed-off-by: Pratyush Anand +--- + makedumpfile.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/makedumpfile-1.6.1/makedumpfile.c b/makedumpfile-1.6.1/makedumpfile.c +index e69b6df9a9ee..6942047199de 100644 +--- a/makedumpfile-1.6.1/makedumpfile.c ++++ b/makedumpfile-1.6.1/makedumpfile.c +@@ -10944,15 +10944,15 @@ int show_mem_usage(void) + + info->dump_level = MAX_DUMP_LEVEL; + +- if (!get_page_offset()) +- return FALSE; +- + if (!open_files_for_creating_dumpfile()) + return FALSE; + + if (!get_elf_loads(info->fd_memory, info->name_memory)) + return FALSE; + ++ if (!get_page_offset()) ++ return FALSE; ++ + if (!get_sys_kernel_vmcoreinfo(&vmcoreinfo_addr, &vmcoreinfo_len)) + return FALSE; + +-- +2.9.3 + diff --git a/kexec-tools-2.0.14-makedumpfile-x86_64-check-physical-address-in-PT_LOA.patch b/kexec-tools-2.0.14-makedumpfile-x86_64-check-physical-address-in-PT_LOA.patch new file mode 100644 index 0000000..02deed8 --- /dev/null +++ b/kexec-tools-2.0.14-makedumpfile-x86_64-check-physical-address-in-PT_LOA.patch @@ -0,0 +1,47 @@ +From f1363023b909df886eca5efcb64b78be9b8e6086 Mon Sep 17 00:00:00 2001 +Message-Id: +In-Reply-To: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand@redhat.com> +References: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand@redhat.com> +From: Pratyush Anand +Date: Thu, 2 Mar 2017 17:37:13 +0900 +Subject: [PATCH 3/7] [PATCH v3 3/7] x86_64: check physical address in PT_LOAD + for none direct mapped regions + +A kcore PT_LOAD can have a section from vmalloc region. However, +physical address in that header would be invalid (-1) after kernel +commit 464920104bf7 (/proc/kcore: update physical address for kcore ram +and text). Therefore, check for valid physical address while calculating +page_offset or phys_offset. + +Signed-off-by: Pratyush Anand +--- + arch/x86_64.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/makedumpfile-1.6.1/arch/x86_64.c b/makedumpfile-1.6.1/arch/x86_64.c +index 893cd516fc8b..e978a36f8878 100644 +--- a/makedumpfile-1.6.1/arch/x86_64.c ++++ b/makedumpfile-1.6.1/arch/x86_64.c +@@ -41,7 +41,8 @@ get_page_offset_x86_64(void) + unsigned long long virt_start; + + for (i = 0; get_pt_load(i, &phys_start, NULL, &virt_start, NULL); i++) { +- if (virt_start < __START_KERNEL_map) { ++ if (virt_start < __START_KERNEL_map ++ && phys_start != NOT_PADDR) { + info->page_offset = virt_start - phys_start; + return TRUE; + } +@@ -76,7 +77,8 @@ get_phys_base_x86_64(void) + } + + for (i = 0; get_pt_load(i, &phys_start, NULL, &virt_start, NULL); i++) { +- if (virt_start >= __START_KERNEL_map) { ++ if (virt_start >= __START_KERNEL_map ++ && phys_start != NOT_PADDR) { + + info->phys_base = phys_start - + (virt_start & ~(__START_KERNEL_map)); +-- +2.9.3 + diff --git a/kexec-tools-2.0.14-x86-x86_64-Fix-format-warning-with-die.patch b/kexec-tools-2.0.14-x86-x86_64-Fix-format-warning-with-die.patch new file mode 100644 index 0000000..537a234 --- /dev/null +++ b/kexec-tools-2.0.14-x86-x86_64-Fix-format-warning-with-die.patch @@ -0,0 +1,75 @@ +From fe667ab0567d5a5631809db2ce3476c83d312d21 Mon Sep 17 00:00:00 2001 +Message-Id: +From: Pratyush Anand +Date: Tue, 14 Mar 2017 17:59:22 +0530 +Subject: [PATCH] x86/x86_64: Fix format warning with die() + +Fedora koji uses gcc version 7.0.1-0.12.fc27, and it generates a build +warning + + kexec/arch/i386/kexec-elf-x86.c:299:3: error: format not a string + literal and no format arguments [-Werror=format-security] + die(error_msg); + ^~~ + cc1: some warnings being treated as errors + +error_msg can have a format specifier as well in string. In such cases, +if there is no other arguments for the format variable then code will +try to access a non existing argument. Therefore, use 1st argument as +format specifier for string print and pass error_msg as the string to be +printed. + +While doing that,also use const qualifier before "char *error_msg". + +Signed-off-by: Pratyush Anand +Signed-off-by: Simon Horman +--- + kexec/arch/i386/kexec-elf-x86.c | 4 ++-- + kexec/arch/x86_64/kexec-elf-x86_64.c | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/kexec/arch/i386/kexec-elf-x86.c b/kexec/arch/i386/kexec-elf-x86.c +index de00dcb869d7..fedf031cdf4a 100644 +--- a/kexec/arch/i386/kexec-elf-x86.c ++++ b/kexec/arch/i386/kexec-elf-x86.c +@@ -91,7 +91,7 @@ int elf_x86_load(int argc, char **argv, const char *buf, off_t len, + char *command_line = NULL, *modified_cmdline = NULL; + const char *append = NULL; + char *tmp_cmdline = NULL; +- char *error_msg = NULL; ++ const char *error_msg = NULL; + int result; + int command_line_len; + const char *ramdisk; +@@ -296,6 +296,6 @@ out: + free(command_line); + free(modified_cmdline); + if (error_msg) +- die(error_msg); ++ die("%s", error_msg); + return result; + } +diff --git a/kexec/arch/x86_64/kexec-elf-x86_64.c b/kexec/arch/x86_64/kexec-elf-x86_64.c +index ae6569220bc8..ad2231193eb1 100644 +--- a/kexec/arch/x86_64/kexec-elf-x86_64.c ++++ b/kexec/arch/x86_64/kexec-elf-x86_64.c +@@ -99,7 +99,7 @@ int elf_x86_64_load(int argc, char **argv, const char *buf, off_t len, + #define ARG_STYLE_NONE 2 + int opt; + int result = 0; +- char *error_msg = NULL; ++ const char *error_msg = NULL; + + /* See options.h and add any new options there too! */ + static const struct option options[] = { +@@ -276,6 +276,6 @@ out: + free(command_line); + free(modified_cmdline); + if (error_msg) +- die(error_msg); ++ die("%s", error_msg); + return result; + } +-- +2.9.3 + diff --git a/kexec-tools-2.0.15-makedumpfile-fix-SECTION_MAP_MASK-for-kernel-bigger-than-4.13.patch b/kexec-tools-2.0.15-makedumpfile-fix-SECTION_MAP_MASK-for-kernel-bigger-than-4.13.patch new file mode 100644 index 0000000..7209d50 --- /dev/null +++ b/kexec-tools-2.0.15-makedumpfile-fix-SECTION_MAP_MASK-for-kernel-bigger-than-4.13.patch @@ -0,0 +1,66 @@ +From: Pratyush Anand +To: ats-kumagai@wm.jp.nec.com +Subject: [Makedumpfile PATCH v2] Fix SECTION_MAP_MASK for kernel >= v.13 +Date: Thu, 17 Aug 2017 09:16:59 +0530 +Cc: Pratyush Anand , dyoung@redhat.com, + kexec@lists.infradead.org, bhe@redhat.com +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Content-Type: text/plain; charset=utf-8 + +commit 2d070eab2e82 "mm: consider zone which is not fully populated to +have holes" added a new flag SECTION_IS_ONLINE and therefore +SECTION_MAP_MASK has been changed. We are not able to find correct +mem_map in makedumpfile for kernel version v4.13-rc1 and onward because +of the above kernel change. + +This patch fixes the MASK value keeping the code backward compatible + +Signed-off-by: Pratyush Anand +--- +v1->v2: Improved kernel_version comparison to take care of stable kernel +versions as well. + + makedumpfile.c | 5 ++++- + makedumpfile.h | 4 +++- + 2 files changed, 7 insertions(+), 2 deletions(-) + +diff --git kexec-tools-2.0.15/makedumpfile-1.6.1/makedumpfile.c kexec-tools-2.0.15.new/makedumpfile-1.6.1/makedumpfile.c +index 30230a15a2e7..c975651ca357 100644 +--- kexec-tools-2.0.15/makedumpfile-1.6.1/makedumpfile.c ++++ kexec-tools-2.0.15.new/makedumpfile-1.6.1/makedumpfile.c +@@ -3304,7 +3304,10 @@ section_mem_map_addr(unsigned long addr) + return NOT_KV_ADDR; + } + map = ULONG(mem_section + OFFSET(mem_section.section_mem_map)); +- map &= SECTION_MAP_MASK; ++ if (info->kernel_version < KERNEL_VERSION(4, 13, 0)) ++ map &= SECTION_MAP_MASK_4_12; ++ else ++ map &= SECTION_MAP_MASK; + free(mem_section); + + return map; +diff --git kexec-tools-2.0.15/makedumpfile-1.6.1/makedumpfile.h kexec-tools-2.0.15.new/makedumpfile-1.6.1/makedumpfile.h +index 8a05794843fb..322f28c632b0 100644 +--- kexec-tools-2.0.15/makedumpfile-1.6.1/makedumpfile.h ++++ kexec-tools-2.0.15.new/makedumpfile-1.6.1/makedumpfile.h +@@ -183,7 +183,9 @@ isAnon(unsigned long mapping) + #define SECTIONS_PER_ROOT() (info->sections_per_root) + #define SECTION_ROOT_MASK() (SECTIONS_PER_ROOT() - 1) + #define SECTION_NR_TO_ROOT(sec) ((sec) / SECTIONS_PER_ROOT()) +-#define SECTION_MAP_LAST_BIT (1UL<<2) ++#define SECTION_IS_ONLINE (1UL<<2) ++#define SECTION_MAP_LAST_BIT (1UL<<3) ++#define SECTION_MAP_MASK_4_12 (~(SECTION_IS_ONLINE-1)) + #define SECTION_MAP_MASK (~(SECTION_MAP_LAST_BIT-1)) + #define NR_SECTION_ROOTS() divideup(num_section, SECTIONS_PER_ROOT()) + #define SECTION_NR_TO_PFN(sec) ((sec) << PFN_SECTION_SHIFT()) +-- +2.9.4 + + +_______________________________________________ +kexec mailing list +kexec@lists.infradead.org +http://lists.infradead.org/mailman/listinfo/kexec diff --git a/kexec-tools-2.0.15-makedumpfile-take-care-of-init-level4-pgt-rename-in-kernel.patch b/kexec-tools-2.0.15-makedumpfile-take-care-of-init-level4-pgt-rename-in-kernel.patch new file mode 100644 index 0000000..56c9a50 --- /dev/null +++ b/kexec-tools-2.0.15-makedumpfile-take-care-of-init-level4-pgt-rename-in-kernel.patch @@ -0,0 +1,43 @@ +Following commit renamed init_level4_pgt to init_top_pgt in kernel. + +commit 65ade2f872b474fa8a04c2d397783350326634e6 +Author: Kirill A. Shutemov +Date: Tue Jun 6 14:31:27 2017 +0300 + + x86/boot/64: Rename init_level4_pgt and early_level4_pgt + +This patch takes care of above kernel modification in makedumpfile. + +Signed-off-by: Pratyush Anand +--- +v2 -> v1 +Removed redundant 'if condition' for WRITE_SYMBOL(). + + makedumpfile.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git kexec-tools-2.0.15/makedumpfile-1.6.1/makedumpfile.c kexec-tools-2.0.15.new/makedumpfile-1.6.1/makedumpfile.c +index f85003a33551..30230a15a2e7 100644 +--- kexec-tools-2.0.15/makedumpfile-1.6.1/makedumpfile.c ++++ kexec-tools-2.0.15.new/makedumpfile-1.6.1/makedumpfile.c +@@ -1486,6 +1486,8 @@ get_symbol_info(void) + SYMBOL_INIT(_stext, "_stext"); + SYMBOL_INIT(swapper_pg_dir, "swapper_pg_dir"); + SYMBOL_INIT(init_level4_pgt, "init_level4_pgt"); ++ if (SYMBOL(init_level4_pgt) == NOT_FOUND_SYMBOL) ++ SYMBOL_INIT(init_level4_pgt, "init_top_pgt"); + SYMBOL_INIT(vmlist, "vmlist"); + SYMBOL_INIT(vmap_area_list, "vmap_area_list"); + SYMBOL_INIT(node_online_map, "node_online_map"); +@@ -2500,6 +2502,8 @@ read_vmcoreinfo(void) + READ_SYMBOL("_stext", _stext); + READ_SYMBOL("swapper_pg_dir", swapper_pg_dir); + READ_SYMBOL("init_level4_pgt", init_level4_pgt); ++ if (SYMBOL(init_level4_pgt) == NOT_FOUND_SYMBOL) ++ READ_SYMBOL("init_top_pgt", init_level4_pgt); + READ_SYMBOL("vmlist", vmlist); + READ_SYMBOL("vmap_area_list", vmap_area_list); + READ_SYMBOL("node_online_map", node_online_map); +-- +2.9.4 + diff --git a/kexec-tools.spec b/kexec-tools.spec index 2a176f3..b340b12 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -1,6 +1,6 @@ Name: kexec-tools -Version: 2.0.14 -Release: 4%{?dist} +Version: 2.0.15 +Release: 1%{?dist}.6 License: GPLv2 Group: Applications/System Summary: The kexec/kdump userspace component @@ -84,6 +84,16 @@ Obsoletes: diskdumputils netdump kexec-tools-eppic # Patches 601 onward are generic patches # Patch601: kexec-tools-2.0.3-disable-kexec-test.patch +Patch603: kexec-tools-2.0.14-makedumpfile-show_mem_usage-calculate-page-offset-af.patch +Patch604: kexec-tools-2.0.14-makedumpfile-initial-call-cache_init-a-bit-early.patch +Patch605: kexec-tools-2.0.14-makedumpfile-x86_64-check-physical-address-in-PT_LOA.patch +Patch606: kexec-tools-2.0.14-makedumpfile-elf_info-kcore-check-for-invalid-physic.patch +Patch607: kexec-tools-2.0.14-makedumpfile-makedumpfile-Correct-the-calculation-of.patch +Patch608: kexec-tools-2.0.14-makedumpfile-makedumpfile-Discard-process_dump_load.patch +Patch609: kexec-tools-2.0.14-makedumpfile-mem-usage-allow-to-work-only-with-f-for.patch +Patch610: kexec-tools-2.0.15-makedumpfile-take-care-of-init-level4-pgt-rename-in-kernel.patch +Patch611: kexec-tools-2.0.15-makedumpfile-fix-SECTION_MAP_MASK-for-kernel-bigger-than-4.13.patch + %description kexec-tools provides /sbin/kexec binary that facilitates a new @@ -107,6 +117,15 @@ tar -z -x -v -f %{SOURCE19} tar -z -x -v -f %{SOURCE23} %patch601 -p1 +%patch603 -p1 +%patch604 -p1 +%patch605 -p1 +%patch606 -p1 +%patch607 -p1 +%patch608 -p1 +%patch609 -p1 +%patch610 -p1 +%patch611 -p1 %ifarch ppc %define archdef ARCH=ppc @@ -131,7 +150,7 @@ cp %{SOURCE21} . cp %{SOURCE27} . make -%ifarch %{ix86} x86_64 ppc64 s390x ppc64le +%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64 make -C eppic/libeppic make -C makedumpfile-1.6.1 LINKTYPE=dynamic USELZO=on USESNAPPY=on make -C makedumpfile-1.6.1 LDFLAGS="-I../eppic/libeppic -L../eppic/libeppic" eppic_makedumpfile.so @@ -174,7 +193,7 @@ install -m 644 %{SOURCE15} $RPM_BUILD_ROOT%{_mandir}/man5/kdump.conf.5 install -m 644 %{SOURCE16} $RPM_BUILD_ROOT%{_unitdir}/kdump.service install -m 755 -D %{SOURCE22} $RPM_BUILD_ROOT%{_prefix}/lib/systemd/system-generators/kdump-dep-generator.sh -%ifarch %{ix86} x86_64 ppc64 s390x ppc64le +%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64 install -m 755 makedumpfile-1.6.1/makedumpfile $RPM_BUILD_ROOT/sbin/makedumpfile install -m 644 makedumpfile-1.6.1/makedumpfile.8.gz $RPM_BUILD_ROOT/%{_mandir}/man8/makedumpfile.8.gz install -m 644 makedumpfile-1.6.1/makedumpfile.conf.5.gz $RPM_BUILD_ROOT/%{_mandir}/man5/makedumpfile.conf.5.gz @@ -279,7 +298,7 @@ done %{_bindir}/* %{_datadir}/kdump %{_prefix}/lib/kdump -%ifarch %{ix86} x86_64 ppc64 s390x ppc64le +%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64 %{_sysconfdir}/makedumpfile.conf.sample %endif %config(noreplace,missingok) %{_sysconfdir}/sysconfig/kdump @@ -299,7 +318,7 @@ done %doc kexec-kdump-howto.txt %doc kdump-in-cluster-environment.txt %doc live-image-kdump-howto.txt -%ifarch %{ix86} x86_64 ppc64 s390x ppc64le +%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64 %{_libdir}/eppic_makedumpfile.so /usr/share/makedumpfile/eppic_scripts/ %endif @@ -310,6 +329,31 @@ done %doc %changelog +* Thu Nov 9 2017 Dave Young - 2.0.15-1.6 +- Revert "Use absolute path /usr/bin/dracut in mkdumprd" + +* Thu Nov 9 2017 Dave Young - 2.0.15-1.5 +- Use absolute path /usr/bin/dracut in mkdumprd + +* Wed Sep 20 2017 Dave Young - 2.0.15-1.4 +- Pull in two makedumpfile patches for 4.13.0+ kernel + +* Wed Jun 28 2017 Dave Young - 2.0.15-1.3 +- aarch64: Add makedumpfile executable +- dracut-module-setup: Fix test for inclusion of DRM modules + +* Fri Jun 23 2017 Dave Young - 2.0.15-1.2 +- update sources file + +* Thu Jun 23 2017 Dave Young - 2.0.15-1 +- rebase upstream kexec-tools 2.0.15 + +* Thu Apr 27 2017 Dave Young - 2.0.14-4.2 +- kdump.sysconfig/x86_64: Add nokaslr to kdump kernel cmdline + +* Fri Mar 17 2017 Dave Young - 2.0.14-4.1 +- Fix kernel kaslr caused regressions (kexec -p and makedumpfile --mem-usage) + * Mon Jan 23 2017 Dave Young - 2.0.14-4 - drop kdump script rhcrashkernel-param in kexec-tools repo - kdumpctl: sanity check of nr_cpus for x86_64 in case running out of vectors diff --git a/sources b/sources index a3f4f60..c0a4290 100644 --- a/sources +++ b/sources @@ -2,3 +2,4 @@ SHA512 (eppic_050615.tar.gz) = de23c3cd59ded23f2f0092c194b2169e78fcd385a8df7daf3 SHA512 (kexec-tools-2.0.14.tar.xz) = 8c1f9d1f4bb69a621961d45091f9c8349535ae69b80168423663685b44d89e1b9324d5cd11c83e86d805a3371f4f1600b0def551c52efb3c6cf020e9c11c273f SHA512 (kdump-anaconda-addon-005-25-g2a4398f.tar.gz) = 0ce8602607a8d781e1804973e6affef1ed3dce729bb1a5525b2a8129f28bcb88713f6e8be5e3f41151223518096f7eed33dd3ea0e63ac7dc338b21fb78664e7e SHA512 (makedumpfile-1.6.1.tar.gz) = fd343e8117e38f9fd608f914297dfe54e0b677733db1871db5824d8ca549e6b8709ae5df6ec82362c100c6d8f35815c39c48e0c87395a30e6305aba7d11c8708 +SHA512 (kexec-tools-2.0.15.tar.xz) = 0bddf31b9bb0e203b813d820e1e248974c2d62cb388dfaf4f2f4971f764cc71e54edbaeaeb663c15d6fa06574beceb87d9ffd7d822ac6699d86c54645096e7e9