The -e option excludes the page structures (vmemmap) which represent excluded pages and greatly shortens the dump of a very large memory system. This option is only for x86_64.
But currently it does not support KASLR-enabled vmcore, as a result, it excludes incorrect pages and can create a broken dumpfile without errors on KASLR-enabled system. Patch 1/3 fixes this issue.
Patch 2/3 fixes an issue that some boundary vmemmap pages that should be excluded are not excluded correctly.
Patch 3/3 fixes an issue that the -e option does some unnecessary processing with no effect and marks the dump DUMP_DH_EXCLUDED_VMEMMAP unexpectedly on architectures other than x86_64.
Kazuhito Hagio (3): makedumpfile: x86_64: Fix incorrect exclusion by -e option with KASLR makedumpfile: Fix exclusion range in find_vmemmap_pages() makedumpfile: Fix inconsistent return value from find_vmemmap()
...xclusion-range-in-find_vmemmap_pages.patch | 37 ++ ...stent-return-value-from-find_vmemmap.patch | 327 ++++++++++++++++++ ...-Fix-incorrect-exclusion-by-e-option.patch | 41 +++ kexec-tools.spec | 6 + 4 files changed, 411 insertions(+) create mode 100644 kexec-tools-2.0.20-makedumpfile-Fix-exclusion-range-in-find_vmemmap_pages.patch create mode 100644 kexec-tools-2.0.20-makedumpfile-Fix-inconsistent-return-value-from-find_vmemmap.patch create mode 100644 kexec-tools-2.0.20-makedumpfile-x86_64-Fix-incorrect-exclusion-by-e-option.patch
Backport from the makedumpfile devel branch in upstream.
commit aa5ab4cf6c7335392094577380d2eaee8a0a8d52 Author: Kazuhito Hagio k-hagio@ab.jp.nec.com Date: Thu Aug 29 12:26:34 2019 -0400
[PATCH] x86_64: Fix incorrect exclusion by -e option with KASLR
The -e option uses info->vmemmap_start for creating a table to determine the positions of page structures that should be excluded, but it is a hardcoded value even with KASLR-enabled vmcore. As a result, the option excludes incorrect pages from it.
To fix this, get the vmemmap start address from info->mem_map_data.
Signed-off-by: Kazuhito Hagio k-hagio@ab.jp.nec.com
Signed-off-by: Kazuhito Hagio k-hagio@ab.jp.nec.com --- ...-Fix-incorrect-exclusion-by-e-option.patch | 41 +++++++++++++++++++ kexec-tools.spec | 2 + 2 files changed, 43 insertions(+) create mode 100644 kexec-tools-2.0.20-makedumpfile-x86_64-Fix-incorrect-exclusion-by-e-option.patch
diff --git a/kexec-tools-2.0.20-makedumpfile-x86_64-Fix-incorrect-exclusion-by-e-option.patch b/kexec-tools-2.0.20-makedumpfile-x86_64-Fix-incorrect-exclusion-by-e-option.patch new file mode 100644 index 0000000..c557c5f --- /dev/null +++ b/kexec-tools-2.0.20-makedumpfile-x86_64-Fix-incorrect-exclusion-by-e-option.patch @@ -0,0 +1,41 @@ +From aa5ab4cf6c7335392094577380d2eaee8a0a8d52 Mon Sep 17 00:00:00 2001 +From: Kazuhito Hagio k-hagio@ab.jp.nec.com +Date: Thu, 29 Aug 2019 12:26:34 -0400 +Subject: [PATCH] x86_64: Fix incorrect exclusion by -e option with KASLR + +The -e option uses info->vmemmap_start for creating a table to determine +the positions of page structures that should be excluded, but it is a +hardcoded value even with KASLR-enabled vmcore. As a result, the option +excludes incorrect pages from it. + +To fix this, get the vmemmap start address from info->mem_map_data. + +Signed-off-by: Kazuhito Hagio k-hagio@ab.jp.nec.com +--- + arch/x86_64.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/makedumpfile-1.6.6/arch/x86_64.c b/makedumpfile-1.6.6/arch/x86_64.c +index 3c0fdc5..4eeaf49 100644 +--- a/makedumpfile-1.6.6/arch/x86_64.c ++++ b/makedumpfile-1.6.6/arch/x86_64.c +@@ -679,6 +679,16 @@ find_vmemmap_x86_64() + if (NUMBER(sme_mask) != NOT_FOUND_NUMBER) + pmask &= ~(NUMBER(sme_mask)); + ++ /* ++ * vmemmap region can be randomized by KASLR. ++ * (currently we don't utilize info->vmemmap_end on x86_64.) ++ */ ++ if (info->mem_map_data && ++ info->mem_map_data[0].mem_map != NOT_MEMMAP_ADDR) ++ info->vmemmap_start = info->mem_map_data[0].mem_map; ++ ++ DEBUG_MSG("vmemmap_start: %16lx\n", info->vmemmap_start); ++ + pagestructsize = size_table.page; + hugepagesize = PTRS_PER_PMD * info->page_size; + vaddr_base = info->vmemmap_start; +-- +2.20.1 + diff --git a/kexec-tools.spec b/kexec-tools.spec index 71898da..3fd41a7 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -77,6 +77,7 @@ Patch0: kexec-tools-2.0.20-fix-broken-multiboot2-buliding-for-i386.patch # # Patches 101 through 200 are meant for x86_64 kexec-tools enablement # +Patch101: kexec-tools-2.0.20-makedumpfile-x86_64-Fix-incorrect-exclusion-by-e-option.patch
# # Patches 301 through 400 are meant for ppc64 kexec-tools enablement @@ -112,6 +113,7 @@ tar -z -x -v -f %{SOURCE19} %patch0 -p1 %patch601 -p1 %patch602 -p1 +%patch101 -p1
%ifarch ppc %define archdef ARCH=ppc
Backport from the makedumpfile devel branch in upstream.
commit b461971bfac0f193a0c274c3b657d158e07d4995 Author: Kazuhito Hagio k-hagio@ab.jp.nec.com Date: Thu Aug 29 14:51:56 2019 -0400
[PATCH] Fix exclusion range in find_vmemmap_pages()
In the function, since pfn ranges are literally start and end, not start and end+1, if the struct page of endpfn is at the last in a vmemmap page, the vmemmap page is dropped by the following code, and not excluded.
npfns_offset = endpfn - vmapp->rep_pfn_start; vmemmap_offset = npfns_offset * size_table.page; // round down to page boundary vmemmap_offset -= (vmemmap_offset % pagesize);
We can use (endpfn+1) here to fix.
Signed-off-by: Kazuhito Hagio k-hagio@ab.jp.nec.com
Signed-off-by: Kazuhito Hagio k-hagio@ab.jp.nec.com --- ...xclusion-range-in-find_vmemmap_pages.patch | 37 +++++++++++++++++++ kexec-tools.spec | 2 + 2 files changed, 39 insertions(+) create mode 100644 kexec-tools-2.0.20-makedumpfile-Fix-exclusion-range-in-find_vmemmap_pages.patch
diff --git a/kexec-tools-2.0.20-makedumpfile-Fix-exclusion-range-in-find_vmemmap_pages.patch b/kexec-tools-2.0.20-makedumpfile-Fix-exclusion-range-in-find_vmemmap_pages.patch new file mode 100644 index 0000000..2c94711 --- /dev/null +++ b/kexec-tools-2.0.20-makedumpfile-Fix-exclusion-range-in-find_vmemmap_pages.patch @@ -0,0 +1,37 @@ +From b461971bfac0f193a0c274c3b657d158e07d4995 Mon Sep 17 00:00:00 2001 +From: Kazuhito Hagio k-hagio@ab.jp.nec.com +Date: Thu, 29 Aug 2019 14:51:56 -0400 +Subject: [PATCH] Fix exclusion range in find_vmemmap_pages() + +In the function, since pfn ranges are literally start and end, not start +and end+1, if the struct page of endpfn is at the last in a vmemmap page, +the vmemmap page is dropped by the following code, and not excluded. + + npfns_offset = endpfn - vmapp->rep_pfn_start; + vmemmap_offset = npfns_offset * size_table.page; + // round down to page boundary + vmemmap_offset -= (vmemmap_offset % pagesize); + +We can use (endpfn+1) here to fix. + +Signed-off-by: Kazuhito Hagio k-hagio@ab.jp.nec.com +--- + makedumpfile.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/makedumpfile-1.6.6/makedumpfile.c b/makedumpfile-1.6.6/makedumpfile.c +index 88df788..37df77d 100644 +--- a/makedumpfile-1.6.6/makedumpfile.c ++++ b/makedumpfile-1.6.6/makedumpfile.c +@@ -6315,7 +6315,7 @@ find_vmemmap_pages(unsigned long startpfn, unsigned long endpfn, unsigned long * + start_vmemmap_pfn = vmapp->vmap_pfn_start + vmemmap_pfns; + *vmappfn = start_vmemmap_pfn; + +- npfns_offset = endpfn - vmapp->rep_pfn_start; ++ npfns_offset = (endpfn+1) - vmapp->rep_pfn_start; + vmemmap_offset = npfns_offset * size_table.page; + // round down to page boundary + vmemmap_offset -= (vmemmap_offset % pagesize); +-- +2.20.1 + diff --git a/kexec-tools.spec b/kexec-tools.spec index 3fd41a7..4d356ad 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -78,6 +78,7 @@ Patch0: kexec-tools-2.0.20-fix-broken-multiboot2-buliding-for-i386.patch # Patches 101 through 200 are meant for x86_64 kexec-tools enablement # Patch101: kexec-tools-2.0.20-makedumpfile-x86_64-Fix-incorrect-exclusion-by-e-option.patch +Patch102: kexec-tools-2.0.20-makedumpfile-Fix-exclusion-range-in-find_vmemmap_pages.patch
# # Patches 301 through 400 are meant for ppc64 kexec-tools enablement @@ -114,6 +115,7 @@ tar -z -x -v -f %{SOURCE19} %patch601 -p1 %patch602 -p1 %patch101 -p1 +%patch102 -p1
%ifarch ppc %define archdef ARCH=ppc
Backport from the makedumpfile devel branch in upstream.
commit 8425342a52b23d462f10bceeeb1c8a3a43d56bf0 Author: Kazuhito Hagio k-hagio@ab.jp.nec.com Date: Fri Sep 6 09:50:34 2019 -0400
[PATCH] Fix inconsistent return value from find_vmemmap()
When -e option is given, the find_vmemmap() returns FAILED(1) if it failed on x86_64, but on architectures other than that, it is stub_false() and returns FALSE(0).
if (info->flag_excludevm) { if (find_vmemmap() == FAILED) { ERRMSG("Can't find vmemmap pages\n");
#define find_vmemmap() stub_false()
As a result, on the architectures other than x86_64, the -e option does some unnecessary processing with no effect, and marks the dump DUMP_DH_EXCLUDED_VMEMMAP unexpectedly.
Also, the functions for the -e option return COMPLETED or FAILED, which are for command return value, not for function return value.
So let's fix the issue by following the common style that returns TRUE or FALSE, and avoid confusion.
Signed-off-by: Kazuhito Hagio k-hagio@ab.jp.nec.com
Signed-off-by: Kazuhito Hagio k-hagio@ab.jp.nec.com --- ...stent-return-value-from-find_vmemmap.patch | 327 ++++++++++++++++++ kexec-tools.spec | 2 + 2 files changed, 329 insertions(+) create mode 100644 kexec-tools-2.0.20-makedumpfile-Fix-inconsistent-return-value-from-find_vmemmap.patch
diff --git a/kexec-tools-2.0.20-makedumpfile-Fix-inconsistent-return-value-from-find_vmemmap.patch b/kexec-tools-2.0.20-makedumpfile-Fix-inconsistent-return-value-from-find_vmemmap.patch new file mode 100644 index 0000000..61cbda0 --- /dev/null +++ b/kexec-tools-2.0.20-makedumpfile-Fix-inconsistent-return-value-from-find_vmemmap.patch @@ -0,0 +1,327 @@ +From 8425342a52b23d462f10bceeeb1c8a3a43d56bf0 Mon Sep 17 00:00:00 2001 +From: Kazuhito Hagio k-hagio@ab.jp.nec.com +Date: Fri, 6 Sep 2019 09:50:34 -0400 +Subject: [PATCH] Fix inconsistent return value from find_vmemmap() + +When -e option is given, the find_vmemmap() returns FAILED(1) if +it failed on x86_64, but on architectures other than that, it is +stub_false() and returns FALSE(0). + + if (info->flag_excludevm) { + if (find_vmemmap() == FAILED) { + ERRMSG("Can't find vmemmap pages\n"); + + #define find_vmemmap() stub_false() + +As a result, on the architectures other than x86_64, the -e option +does some unnecessary processing with no effect, and marks the dump +DUMP_DH_EXCLUDED_VMEMMAP unexpectedly. + +Also, the functions for the -e option return COMPLETED or FAILED, +which are for command return value, not for function return value. + +So let's fix the issue by following the common style that returns +TRUE or FALSE, and avoid confusion. + +Signed-off-by: Kazuhito Hagio k-hagio@ab.jp.nec.com +--- + arch/x86_64.c | 12 ++++----- + makedumpfile.c | 70 ++++++++++++++++++++++++-------------------------- + 2 files changed, 40 insertions(+), 42 deletions(-) + +diff --git a/makedumpfile-1.6.6/arch/x86_64.c b/makedumpfile-1.6.6/arch/x86_64.c +index 4eeaf4925f43..876644f932be 100644 +--- a/makedumpfile-1.6.6/arch/x86_64.c ++++ b/makedumpfile-1.6.6/arch/x86_64.c +@@ -673,7 +673,7 @@ find_vmemmap_x86_64() + + if (init_level4_pgt == NOT_FOUND_SYMBOL) { + ERRMSG("init_level4_pgt/init_top_pgt not found\n"); +- return FAILED; ++ return FALSE; + } + + if (NUMBER(sme_mask) != NOT_FOUND_NUMBER) +@@ -715,7 +715,7 @@ find_vmemmap_x86_64() + if (!readmem(PADDR, (unsigned long long)pgdp, (void *)&pud_addr, + sizeof(unsigned long))) { + ERRMSG("Can't get pgd entry for slot %d.\n", pgd_index); +- return FAILED; ++ return FALSE; + } + + /* mask the pgd entry for the address of the pud page */ +@@ -726,7 +726,7 @@ find_vmemmap_x86_64() + if (!readmem(PADDR, (unsigned long long)pud_addr, (void *)pud_page, + PTRS_PER_PUD * sizeof(unsigned long))) { + ERRMSG("Can't get pud entry for pgd slot %ld.\n", pgdindex); +- return FAILED; ++ return FALSE; + } + /* step thru each pmd address in the pud page */ + /* pudp points to an entry in the pud page */ +@@ -739,7 +739,7 @@ find_vmemmap_x86_64() + if (!readmem(PADDR, pmd_addr, (void *)pmd_page, + PTRS_PER_PMD * sizeof(unsigned long))) { + ERRMSG("Can't get pud entry for slot %ld.\n", pudindex); +- return FAILED; ++ return FALSE; + } + /* pmdp points to an entry in the pmd */ + for (pmdp = (unsigned long *)pmd_page, pmdindex = 0; +@@ -815,7 +815,7 @@ find_vmemmap_x86_64() + num_pmds_valid++; + if (!(pmd & _PAGE_PSE)) { + printf("vmemmap pmd not huge, abort\n"); +- return FAILED; ++ return FALSE; + } + } else { + if (last_valid) { +@@ -947,7 +947,7 @@ find_vmemmap_x86_64() + i++; + } while (cur != vmaphead); + nr_gvmem_pfns = i; +- return COMPLETED; ++ return TRUE; + } + + #endif /* x86_64 */ +diff --git a/makedumpfile-1.6.6/makedumpfile.c b/makedumpfile-1.6.6/makedumpfile.c +index 37df77d181dd..af4db3c006c9 100644 +--- a/makedumpfile-1.6.6/makedumpfile.c ++++ b/makedumpfile-1.6.6/makedumpfile.c +@@ -6213,20 +6213,20 @@ init_save_control() + flags = O_RDWR|O_CREAT|O_TRUNC; + if ((sc.sc_fd = open(sc.sc_filename, flags, S_IRUSR|S_IWUSR)) < 0) { + ERRMSG("Can't open the pfn file %s.\n", sc.sc_filename); +- return FAILED; ++ return FALSE; + } + unlink(sc.sc_filename); + + sc.sc_buf = malloc(info->page_size); + if (!sc.sc_buf) { + ERRMSG("Can't allocate a page for pfn buf.\n"); +- return FAILED; ++ return FALSE; + } + sc.sc_buflen = info->page_size; + sc.sc_bufposition = 0; + sc.sc_fileposition = 0; + sc.sc_filelen = 0; +- return COMPLETED; ++ return TRUE; + } + + /* +@@ -6243,7 +6243,7 @@ save_deletes(unsigned long startpfn, unsigned long numpfns) + if (i != sc.sc_buflen) { + ERRMSG("save: Can't write a page to %s\n", + sc.sc_filename); +- return FAILED; ++ return FALSE; + } + sc.sc_filelen += sc.sc_buflen; + sc.sc_bufposition = 0; +@@ -6252,12 +6252,12 @@ save_deletes(unsigned long startpfn, unsigned long numpfns) + scp->startpfn = startpfn; + scp->numpfns = numpfns; + sc.sc_bufposition += sizeof(struct sc_entry); +- return COMPLETED; ++ return TRUE; + } + + /* + * Get a starting pfn and number of pfns for delete from bitmap. +- * Return 0 for success, 1 for 'no more' ++ * Return TRUE(1) for success, FALSE(0) for 'no more' + */ + int + get_deletes(unsigned long *startpfn, unsigned long *numpfns) +@@ -6266,14 +6266,14 @@ get_deletes(unsigned long *startpfn, unsigned long *numpfns) + struct sc_entry *scp; + + if (sc.sc_fileposition >= sc.sc_filelen) { +- return FAILED; ++ return FALSE; + } + + if (sc.sc_bufposition == sc.sc_buflen) { + i = read(sc.sc_fd, sc.sc_buf, sc.sc_buflen); + if (i <= 0) { + ERRMSG("Can't read a page from %s.\n", sc.sc_filename); +- return FAILED; ++ return FALSE; + } + sc.sc_bufposition = 0; + } +@@ -6282,7 +6282,7 @@ get_deletes(unsigned long *startpfn, unsigned long *numpfns) + *numpfns = scp->numpfns; + sc.sc_bufposition += sizeof(struct sc_entry); + sc.sc_fileposition += sizeof(struct sc_entry); +- return COMPLETED; ++ return TRUE; + } + + /* +@@ -6290,7 +6290,7 @@ get_deletes(unsigned long *startpfn, unsigned long *numpfns) + * that represent them. + * (pfn ranges are literally start and end, not start and end+1) + * see the array of vmemmap pfns and the pfns they represent: gvmem_pfns +- * Return COMPLETED for delete, FAILED for not to delete. ++ * Return TRUE(1) for delete, FALSE(0) for not to delete. + */ + int + find_vmemmap_pages(unsigned long startpfn, unsigned long endpfn, unsigned long *vmappfn, +@@ -6323,12 +6323,12 @@ find_vmemmap_pages(unsigned long startpfn, unsigned long endpfn, unsigned long * + end_vmemmap_pfn = vmapp->vmap_pfn_start + vmemmap_pfns; + npages = end_vmemmap_pfn - start_vmemmap_pfn; + if (npages == 0) +- return FAILED; ++ return FALSE; + *nmapnpfns = npages; +- return COMPLETED; ++ return TRUE; + } + } +- return FAILED; ++ return FALSE; + } + + /* +@@ -6359,12 +6359,12 @@ find_unused_vmemmap_pages(void) + if (lseek(bitmap1->fd, new_offset1, SEEK_SET) < 0 ) { + ERRMSG("Can't seek the bitmap(%s). %s\n", + bitmap1->file_name, strerror(errno)); +- return FAILED; ++ return FALSE; + } + if (read(bitmap1->fd, bitmap1->buf, BUFSIZE_BITMAP) != BUFSIZE_BITMAP) { + ERRMSG("Can't read the bitmap(%s). %s\n", + bitmap1->file_name, strerror(errno)); +- return FAILED; ++ return FALSE; + } + bitmap1->no_block = pfn / PFN_BUFBITMAP; + +@@ -6372,12 +6372,12 @@ find_unused_vmemmap_pages(void) + if (lseek(bitmap2->fd, new_offset2, SEEK_SET) < 0 ) { + ERRMSG("Can't seek the bitmap(%s). %s\n", + bitmap2->file_name, strerror(errno)); +- return FAILED; ++ return FALSE; + } + if (read(bitmap2->fd, bitmap2->buf, BUFSIZE_BITMAP) != BUFSIZE_BITMAP) { + ERRMSG("Can't read the bitmap(%s). %s\n", + bitmap2->file_name, strerror(errno)); +- return FAILED; ++ return FALSE; + } + bitmap2->no_block = pfn / PFN_BUFBITMAP; + +@@ -6422,12 +6422,11 @@ find_unused_vmemmap_pages(void) + endpfn = startpfn + + (numwords * BITS_PER_WORD) - 1; + if (find_vmemmap_pages(startpfn, endpfn, +- &vmapstartpfn, &vmapnumpfns) == +- COMPLETED) { +- if (save_deletes(vmapstartpfn, +- vmapnumpfns) == FAILED) { ++ &vmapstartpfn, &vmapnumpfns)) { ++ if (!save_deletes(vmapstartpfn, ++ vmapnumpfns)) { + ERRMSG("save_deletes failed\n"); +- return FAILED; ++ return FALSE; + } + deleted_pages += vmapnumpfns; + } +@@ -6444,11 +6443,10 @@ find_unused_vmemmap_pages(void) + not start and end + 1 */ + endpfn = startpfn + (numwords * BITS_PER_WORD) - 1; + if (find_vmemmap_pages(startpfn, endpfn, +- &vmapstartpfn, &vmapnumpfns) == COMPLETED) { +- if (save_deletes(vmapstartpfn, vmapnumpfns) +- == FAILED) { ++ &vmapstartpfn, &vmapnumpfns)) { ++ if (!save_deletes(vmapstartpfn, vmapnumpfns)) { + ERRMSG("save_deletes failed\n"); +- return FAILED; ++ return FALSE; + } + deleted_pages += vmapnumpfns; + } +@@ -6457,7 +6455,7 @@ find_unused_vmemmap_pages(void) + } + PROGRESS_MSG("\nExcluded %ld unused vmemmap pages\n", deleted_pages); + +- return COMPLETED; ++ return TRUE; + } + + /* +@@ -6468,7 +6466,7 @@ delete_unused_vmemmap_pages(void) + { + unsigned long startpfn, numpfns, pfn, i; + +- while (get_deletes(&startpfn, &numpfns) == COMPLETED) { ++ while (get_deletes(&startpfn, &numpfns)) { + for (i = 0, pfn = startpfn; i < numpfns; i++, pfn++) { + clear_bit_on_2nd_bitmap_for_kernel(pfn, (struct cycle *)0); + // note that this is never to be used in cyclic mode! +@@ -6496,23 +6494,23 @@ reset_save_control() + { + int i; + if (sc.sc_bufposition == 0) +- return COMPLETED; ++ return TRUE; + + i = write(sc.sc_fd, sc.sc_buf, sc.sc_buflen); + if (i != sc.sc_buflen) { + ERRMSG("reset: Can't write a page to %s\n", + sc.sc_filename); +- return FAILED; ++ return FALSE; + } + sc.sc_filelen += sc.sc_bufposition; + + if (lseek(sc.sc_fd, 0, SEEK_SET) < 0) { + ERRMSG("Can't seek the pfn file %s).", sc.sc_filename); +- return FAILED; ++ return FALSE; + } + sc.sc_fileposition = 0; + sc.sc_bufposition = sc.sc_buflen; /* trigger 1st read */ +- return COMPLETED; ++ return TRUE; + } + + int +@@ -6602,11 +6600,11 @@ create_2nd_bitmap(struct cycle *cycle) + + /* --exclude-unused-vm means exclude vmemmap page structures for unused pages */ + if (info->flag_excludevm) { +- if (init_save_control() == FAILED) ++ if (!init_save_control()) + return FALSE; +- if (find_unused_vmemmap_pages() == FAILED) ++ if (!find_unused_vmemmap_pages()) + return FALSE; +- if (reset_save_control() == FAILED) ++ if (!reset_save_control()) + return FALSE; + delete_unused_vmemmap_pages(); + finalize_save_control(); +@@ -10095,7 +10093,7 @@ create_dumpfile(void) + + /* create an array of translations from pfn to vmemmap pages */ + if (info->flag_excludevm) { +- if (find_vmemmap() == FAILED) { ++ if (!find_vmemmap()) { + ERRMSG("Can't find vmemmap pages\n"); + info->flag_excludevm = 0; + } +-- +2.18.1 + diff --git a/kexec-tools.spec b/kexec-tools.spec index 4d356ad..a4c3b9c 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -96,6 +96,7 @@ Patch102: kexec-tools-2.0.20-makedumpfile-Fix-exclusion-range-in-find_vmemmap_pa # Patch601: kexec-tools-2.0.20-makedumpfile-Do-not-proceed-when-get_num_dumpable_cyclic-fails.patch Patch602: kexec-tools-2.0.20-makedumpfile-Increase-SECTION_MAP_LAST_BIT-to-4.patch +Patch603: kexec-tools-2.0.20-makedumpfile-Fix-inconsistent-return-value-from-find_vmemmap.patch
%description kexec-tools provides /sbin/kexec binary that facilitates a new @@ -116,6 +117,7 @@ tar -z -x -v -f %{SOURCE19} %patch602 -p1 %patch101 -p1 %patch102 -p1 +%patch603 -p1
%ifarch ppc %define archdef ARCH=ppc
On Tue, Sep 10, 2019 at 4:55 AM Kazuhito Hagio k-hagio@ab.jp.nec.com wrote:
The -e option excludes the page structures (vmemmap) which represent excluded pages and greatly shortens the dump of a very large memory system. This option is only for x86_64.
But currently it does not support KASLR-enabled vmcore, as a result, it excludes incorrect pages and can create a broken dumpfile without errors on KASLR-enabled system. Patch 1/3 fixes this issue.
Patch 2/3 fixes an issue that some boundary vmemmap pages that should be excluded are not excluded correctly.
Patch 3/3 fixes an issue that the -e option does some unnecessary processing with no effect and marks the dump DUMP_DH_EXCLUDED_VMEMMAP unexpectedly on architectures other than x86_64.
Kazuhito Hagio (3): makedumpfile: x86_64: Fix incorrect exclusion by -e option with KASLR makedumpfile: Fix exclusion range in find_vmemmap_pages() makedumpfile: Fix inconsistent return value from find_vmemmap()
...xclusion-range-in-find_vmemmap_pages.patch | 37 ++ ...stent-return-value-from-find_vmemmap.patch | 327 ++++++++++++++++++ ...-Fix-incorrect-exclusion-by-e-option.patch | 41 +++ kexec-tools.spec | 6 + 4 files changed, 411 insertions(+) create mode 100644 kexec-tools-2.0.20-makedumpfile-Fix-exclusion-range-in-find_vmemmap_pages.patch create mode 100644 kexec-tools-2.0.20-makedumpfile-Fix-inconsistent-return-value-from-find_vmemmap.patch create mode 100644 kexec-tools-2.0.20-makedumpfile-x86_64-Fix-incorrect-exclusion-by-e-option.patch
-- 2.23.0 _______________________________________________ kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org
Thanks for the patch! Looks good and ACK.
-- Best Regards, Kairui Song