Make sanity check in cache_page() strict using function
sanity_check_page_desc().
This sanity check is performed each time cache_page() read a single
entry of page descriptor table. For users who are interested in a
whole part of page descriptor table, suggest to use
--validate_kdump_headers command-line option.
---
diskdump.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/diskdump.c b/diskdump.c
index 9a94e7e..db96fdb 100644
--- a/diskdump.c
+++ b/diskdump.c
@@ -1235,8 +1235,14 @@ cache_page(physaddr_t paddr)
return ret;
/* sanity check */
- if (pd.size > block_size)
+ if (!sanity_check_page_desc(&pd)) {
+ error(INFO, "%s: invalid page descriptor found: paddr/pfn: %llx/%lx\n"
+ "Use --validate_kdump_headers command line option to "
+ "validate a whole part of page descriptor table\n",
+ DISKDUMP_VALID() ? "diskdump" : "compressed kdump",
+ (ulonglong)paddr, pfn);
return READ_ERROR;
+ }
/* read page data */
if (FLAT_FORMAT()) {
--
2.43.1