[PATCH] makedumpfile: Fix cyclic mode to scrub data with -E option.

Atsushi Kumagai kumagai-atsushi at mxc.nes.nec.co.jp
Wed Jan 23 00:31:02 EST 2013


Hello,

I found a bug in cyclic mode, I'll merge this patch to next version.


Thanks
Atsushi Kumagai

--
In cyclic mode, get_loads_dumpfile_cyclic() is called as setup for
writing phase. But get_loads_dumpfile_cyclic() calls filter_data_buffer()
via read_pfn(), then filter_info is consumed. As a result, filter_info
doesn't exist at the moment when it is actually necessary to scrub data.

That's why --config option doesn't work correctly in cyclic mode
with -E option.

Signed-off-by: Atsushi Kumagai <kumagai-atsushi at mxc.nes.nec.co.jp>
---
 makedumpfile.c |   14 ++++++++++++--
 1 files changed, 12 insertios(+), 2 deletions(-)

diff --git a/makedumpfile.c b/makedumpfile.c
index ebdc31a..4187b84 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -5207,6 +5207,7 @@ get_loads_dumpfile_cyclic(void)
 	long page_size = info->page_size;
 	unsigned char buf[info->page_size];
 	unsigned long long pfn, pfn_start, pfn_end, num_excluded;
+	unsigned long long paddr;
 	unsigned long frac_head, frac_tail;
 	Elf64_Phdr load;
 
@@ -5260,8 +5261,12 @@ get_loads_dumpfile_cyclic(void)
 			 * Exclude zero pages.
 			 */
 			if (info->dump_level & DL_EXCLUDE_ZERO) {
-				if (!read_pfn(pfn, buf))
+				paddr = pfn_to_paddr(pfn);
+				if (!readmem(PADDR, paddr, buf, page_size)) {
+					ERRMSG("Can't get the page data(pfn:%llx,max_mapnr:%llx).\n",
+					       pfn, info->max_mapnr);
 					return FALSE;
+				}
 				if (is_zero_page(buf, page_size)) {
 					num_excluded++;
 					continue;
@@ -5291,6 +5296,7 @@ write_elf_pages_cyclic(struct cache_data *cd_header, struct cache_data *cd_page)
 	long page_size = info->page_size;
 	unsigned char buf[info->page_size];
 	unsigned long long pfn, pfn_start, pfn_end, paddr, num_excluded;
+	unsigned long long paddr_buf;
 	unsigned long long num_dumpable, per;
 	unsigned long long memsz, filesz;
 	unsigned long frac_head, frac_tail;
@@ -5370,8 +5376,12 @@ write_elf_pages_cyclic(struct cache_data *cd_header, struct cache_data *cd_page)
 			 * Exclude zero pages.
 			 */
 			if (info->dump_level & DL_EXCLUDE_ZERO) {
-				if (!read_pfn(pfn, buf))
+				paddr_buf = pfn_to_paddr(pfn);
+				if (!readmem(PADDR, paddr_buf, buf, page_size)) {
+					ERRMSG("Can't get the page data(pfn:%llx max_mapnr:%llx).\n",
+					       pfn, info->max_mapnr);
 					return FALSE;
+				}
 				if (is_zero_page(buf, page_size)) {
 					pfn_zero++;
 					num_excluded++;
-- 
1.7.1



More information about the kexec mailing list