From b9c0cadcb347c2a4c8bc78509eb334bbe341ed30c39b61afcc2d12581c2aa3f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Tesa=C5=99=C3=ADk?= Date: Thu, 5 Apr 2018 11:51:19 +0000 Subject: [PATCH] Accepting request 593774 from home:ptesarik:branches:Kernel:kdump - kexec-tools-vmcoreinfo-in-xen.patch: Revert "kexec-tools: Read always one vmcoreinfo file" (bsc#1085626, bsc#951740). - kexec-tools-fix-kexec-p-segfault.patch: Fix a segmentation fault when trying to run "kexec -p" (bsc#1080916). OBS-URL: https://build.opensuse.org/request/show/593774 OBS-URL: https://build.opensuse.org/package/show/Kernel:kdump/kexec-tools?expand=0&rev=97 --- kexec-tools-fix-kexec-p-segfault.patch | 25 ++++++++ kexec-tools-vmcoreinfo-in-xen.patch | 79 ++++++++++++++++++++++++++ kexec-tools.changes | 12 ++++ kexec-tools.spec | 4 ++ 4 files changed, 120 insertions(+) create mode 100644 kexec-tools-fix-kexec-p-segfault.patch create mode 100644 kexec-tools-vmcoreinfo-in-xen.patch diff --git a/kexec-tools-fix-kexec-p-segfault.patch b/kexec-tools-fix-kexec-p-segfault.patch new file mode 100644 index 0000000..b619095 --- /dev/null +++ b/kexec-tools-fix-kexec-p-segfault.patch @@ -0,0 +1,25 @@ +From: Petr Tesarik +Date: Thu, 5 Apr 2018 13:07:49 +0200 +Subject: Fix a segmentation fault when trying to run "kexec -p". +References: bsc#1080916 +Upstream: not yet, to be posted after more testing + +Do not fall through to "--mem-min" when "-p" option is parsed. The +break statement was apparently removed by mistake... + +Fixes: cb434cbe6f401037e448276bb12056d1fdc3dbfc +Signed-off-by: Petr Tesarik +--- + kexec/kexec.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/kexec/kexec.c ++++ b/kexec/kexec.c +@@ -1352,6 +1352,7 @@ int main(int argc, char *argv[]) + do_sync = 0; + kexec_file_flags |= KEXEC_FILE_ON_CRASH; + kexec_flags = KEXEC_ON_CRASH; ++ break; + case OPT_MEM_MIN: + mem_min = strtoul(optarg, &endptr, 0); + if (*endptr) { diff --git a/kexec-tools-vmcoreinfo-in-xen.patch b/kexec-tools-vmcoreinfo-in-xen.patch new file mode 100644 index 0000000..1a46c00 --- /dev/null +++ b/kexec-tools-vmcoreinfo-in-xen.patch @@ -0,0 +1,79 @@ +From: Petr Tesarik +Date: Thu, 5 Apr 2018 10:57:05 +0200 +Subject: Revert "kexec-tools: Read always one vmcoreinfo file" +References: bsc#1085626, bsc#951740 +Upstream: not yet, upstream wants to stay broken + +This reverts commit 455d79f57e9367e5c59093fd74798905bd5762fc. + +The explanation seems bogus. The file under /sys/kernel +refers to the Linux kernel VMCOREINFO note, while the +file under /sys/hypervisor refers to the Xen hypervisor +VMCOREINFO_XEN note. The former note contains information +about the Linux kernel. The latter contains information +about the Xen hypervisor. Both are needed to allow page +filtering in makedumpfile. + +Signed-off-by: Petr Tesarik + +--- + kexec/crashdump-elf.c | 33 ++++++++++++++++++++++++++------- + 1 file changed, 26 insertions(+), 7 deletions(-) + +--- a/kexec/crashdump-elf.c ++++ b/kexec/crashdump-elf.c +@@ -40,6 +40,8 @@ int FUNC(struct kexec_info *info, + uint64_t notes_addr, notes_len; + uint64_t vmcoreinfo_addr, vmcoreinfo_len; + int has_vmcoreinfo = 0; ++ uint64_t vmcoreinfo_addr_xen, vmcoreinfo_len_xen; ++ int has_vmcoreinfo_xen = 0; + int (*get_note_info)(int cpu, uint64_t *addr, uint64_t *len); + long int count_cpu; + +@@ -52,14 +54,16 @@ int FUNC(struct kexec_info *info, + return -1; + } + +- if (xen_present()) { +- if (!get_xen_vmcoreinfo(&vmcoreinfo_addr, &vmcoreinfo_len)) +- has_vmcoreinfo = 1; +- } else +- if (!get_kernel_vmcoreinfo(&vmcoreinfo_addr, &vmcoreinfo_len)) +- has_vmcoreinfo = 1; ++ if (get_kernel_vmcoreinfo(&vmcoreinfo_addr, &vmcoreinfo_len) == 0) { ++ has_vmcoreinfo = 1; ++ } ++ ++ if (xen_present() && ++ get_xen_vmcoreinfo(&vmcoreinfo_addr_xen, &vmcoreinfo_len_xen) == 0) { ++ has_vmcoreinfo_xen = 1; ++ } + +- sz = sizeof(EHDR) + (nr_cpus + has_vmcoreinfo) * sizeof(PHDR) + ++ sz = sizeof(EHDR) + (nr_cpus + has_vmcoreinfo + has_vmcoreinfo_xen) * sizeof(PHDR) + + ranges * sizeof(PHDR); + + /* +@@ -178,6 +182,21 @@ int FUNC(struct kexec_info *info, + dbgprintf_phdr("vmcoreinfo header", phdr); + } + ++ if (has_vmcoreinfo_xen) { ++ phdr = (PHDR *) bufp; ++ bufp += sizeof(PHDR); ++ phdr->p_type = PT_NOTE; ++ phdr->p_flags = 0; ++ phdr->p_offset = phdr->p_paddr = vmcoreinfo_addr_xen; ++ phdr->p_vaddr = 0; ++ phdr->p_filesz = phdr->p_memsz = vmcoreinfo_len_xen; ++ /* Do we need any alignment of segments? */ ++ phdr->p_align = 0; ++ ++ (elf->e_phnum)++; ++ dbgprintf_phdr("vmcoreinfo_xen header", phdr); ++ } ++ + /* Setup an PT_LOAD type program header for the region where + * Kernel is mapped if elf_info->kern_size is non-zero. + */ diff --git a/kexec-tools.changes b/kexec-tools.changes index 14c111f..100769a 100644 --- a/kexec-tools.changes +++ b/kexec-tools.changes @@ -1,3 +1,15 @@ +------------------------------------------------------------------- +Thu Apr 5 11:12:53 UTC 2018 - ptesarik@suse.com + +- kexec-tools-vmcoreinfo-in-xen.patch: Revert "kexec-tools: Read + always one vmcoreinfo file" (bsc#1085626, bsc#951740). + +------------------------------------------------------------------- +Thu Apr 5 09:05:11 UTC 2018 - ptesarik@suse.com + +- kexec-tools-fix-kexec-p-segfault.patch: Fix a segmentation fault + when trying to run "kexec -p" (bsc#1080916). + ------------------------------------------------------------------- Tue Apr 3 11:43:18 UTC 2018 - msuchanek@suse.com diff --git a/kexec-tools.spec b/kexec-tools.spec index b2aa848..07c82d7 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -40,6 +40,8 @@ Patch9: %{name}-Do-not-special-case-the-s-option.patch Patch10: %{name}-Add-option-to-revert-s.patch Patch11: %{name}-Add-option-to-fall-back-to-KEXEC_LOAD.patch Patch12: %{name}-Document-s-c-and-a-options-in-the-man-page.patch +Patch13: %{name}-fix-kexec-p-segfault.patch +Patch14: %{name}-vmcoreinfo-in-xen.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: systemd-rpm-macros @@ -75,6 +77,8 @@ the loaded kernel after it panics. %patch10 -p1 %patch11 -p1 %patch12 -p1 +%patch13 -p1 +%patch14 -p1 %build autoreconf -fvi