Blob Blame History Raw
From 19b3a91646958089f8ce90ca518c8262bfc8ca88 Mon Sep 17 00:00:00 2001
From: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
Date: Tue, 20 Oct 2015 16:12:01 +0900
Subject: [PATCH 2/2] [PATCH 2/2] sadump: Perform explicit zero page filtering.

Currently, crash utility faces different behaviors on reading zero
pages that are filtered out on the kdump-compressed format originating
from kdump ELF and from sadump formats: the former succeeds in reading
zero pages but the latter fails. This is a design bug. To fix this
issue, perform zero pages filtering explicitly if some pages are
filtered out.

Signed-off-by: Takao Indoh <indou.takao@jp.fujitsu.com>
Signed-off-by: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
---
 makedumpfile-1.5.7/sadump_info.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/makedumpfile-1.5.7/sadump_info.c b/makedumpfile-1.5.7/sadump_info.c
index 4740683..20376f0 100644
--- a/makedumpfile-1.5.7/sadump_info.c
+++ b/makedumpfile-1.5.7/sadump_info.c
@@ -874,6 +874,21 @@ sadump_initialize_bitmap_memory(void)
 	bmp->offset = si->sub_hdr_offset + sh->block_size * sh->sub_hdr_size;
 	si->ram_bitmap = bmp;
 
+	/*
+	 * Perform explicitly zero filtering. Without this processing
+	 * crash utility faces different behaviors on reading zero
+	 * pages that are filtered out on the kdump-compressed format
+	 * originating from kdump ELF and from sadump formats: the
+	 * former succeeds in reading zero pages but the latter fails.
+	 */
+	for (pfn = 0; pfn < si->max_mapnr; pfn++) {
+		if (sadump_is_ram(pfn) &&
+		    !sadump_is_dumpable(info->bitmap_memory, pfn)) {
+			info->dump_level |= DL_EXCLUDE_ZERO;
+			break;
+		}
+	}
+
 	return TRUE;
 }
 
@@ -1049,9 +1064,8 @@ readpage_sadump(unsigned long long paddr, void *bufptr)
 	}
 
 	if (!sadump_is_dumpable(info->bitmap_memory, pfn)) {
-		ERRMSG("pfn(%llx) is excluded from %s.\n", pfn,
-		       info->name_memory);
-		return FALSE;
+		memset(bufptr, 0, info->page_size);
+		return TRUE;
 	}
 
 	block = pfn_to_block(pfn);
-- 
2.1.0