From 49cbba11eac563957a72c0562f84fb3c13f9ab68 Mon Sep 17 00:00:00 2001 From: Ming Wang Date: Mon, 14 Oct 2024 16:35:09 +0800 Subject: [PATCH] [PATCH v2] Fix incorrect page exclusion in exclude_nodata_pages() The calculation of the starting PFN for exclusion in exclude_nodata_pages() was rounding down, potentially excluding the last valid page of a LOAD segment. This commit fixes the issue by rounding up the calculated PFN to the nearest page boundary, ensuring that the last valid page is included and not erroneously excluded. Signed-off-by: Ming Wang Signed-off-by: wangming --- ...ge-exclusion-in-exclude_nodata_pages.patch | 26 +++++++++++++++++++ kexec-tools.spec | 7 ++++- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 Fix-incorrect-page-exclusion-in-exclude_nodata_pages.patch diff --git a/Fix-incorrect-page-exclusion-in-exclude_nodata_pages.patch b/Fix-incorrect-page-exclusion-in-exclude_nodata_pages.patch new file mode 100644 index 0000000..4eefd63 --- /dev/null +++ b/Fix-incorrect-page-exclusion-in-exclude_nodata_pages.patch @@ -0,0 +1,26 @@ +From fe71ffabcc7e5787b0bcf0b4cfcdab83182b84fd Mon Sep 17 00:00:00 2001 +From: Ming Wang +Date: Mon, 14 Oct 2024 16:23:08 +0800 +Subject: [PATCH] Fix incorrect page exclusion in exclude_nodata_pages() + +Signed-off-by: Ming Wang +--- + makedumpfile-1.7.4/makedumpfile.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/makedumpfile-1.7.4/makedumpfile.c b/makedumpfile-1.7.4/makedumpfile.c +index a6ec9d4..4ddbf4d 100644 +--- a/makedumpfile-1.7.4/makedumpfile.c ++++ b/makedumpfile-1.7.4/makedumpfile.c +@@ -5192,7 +5192,7 @@ exclude_nodata_pages(struct cycle *cycle) + NULL, &file_size)) { + unsigned long long pfn, pfn_end; + +- pfn = paddr_to_pfn(phys_start + file_size); ++ pfn = paddr_to_pfn(roundup(phys_start + file_size, PAGESIZE())); + pfn_end = paddr_to_pfn(roundup(phys_end, PAGESIZE())); + + if (pfn < cycle->start_pfn) +-- +2.41.0 + diff --git a/kexec-tools.spec b/kexec-tools.spec index 0c7c76f..249408d 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -3,7 +3,7 @@ %global mkdf_ver 1.7.4 %global mkdf_shortver %(c=%{mkdf_ver}; echo ${c:0:7}) -%define anolis_release 6 +%define anolis_release 7 Name: kexec-tools Version: 2.0.26 @@ -93,6 +93,7 @@ Patch0001: loongarch64-fix-some-functional-issues-and-compilati.patch Patch0002: kexec-tools-rv64-support.patch Patch0003: loongarch64-fix-kernel-image-size-error.patch Patch0004: Fix-building-on-x86_64-with-binutils-2.41.patch +Patch0005: Fix-incorrect-page-exclusion-in-exclude_nodata_pages.patch %description kexec-tools provides /sbin/kexec binary that facilitates a new @@ -120,6 +121,7 @@ tar -z -x -v -f %{SOURCE19} %patch0002 -p1 %patch0003 -p1 %patch0004 -p1 +%patch0005 -p1 %build autoreconf @@ -348,6 +350,9 @@ done %doc TODO AUTHORS %changelog +* Mon Oct 14 2024 Ming Wang - 2.0.26-7 +- Fix incorrect page exclusion in exclude_nodata_pages() + * Tue Jun 4 2024 Ming Wang - 2.0.26-6 - Backport upstream patch for loongarch and x86_64 -- Gitee