Blame SOURCES/kexec-tools-2.0.20-makedumpfile-PATCH-Fix-cd_header-offset-overflow-with-large-pfn.patch

f8bec6
From 6e4b2dfaed5e5e5c617e0e45f969c1f571c13e27 Mon Sep 17 00:00:00 2001
f8bec6
From: Jialong Chen <chenjialong@huawei.com>
f8bec6
Date: Mon, 23 Mar 2020 16:42:01 -0400
f8bec6
Subject: [PATCH 7/7] [PATCH] Fix cd_header offset overflow with large pfn
f8bec6
f8bec6
In function write_kdump_pages_and_bitmap_cyclic(), cd_header->offset is
f8bec6
calculated by the following formula:
f8bec6
f8bec6
    cd_header->offset
f8bec6
        = (DISKDUMP_HEADER_BLOCKS + dh->sub_hdr_size + dh->bitmap_blocks)
f8bec6
        * dh->block_size;
f8bec6
f8bec6
However, the variables of the right side are only int and unsigned int,
f8bec6
so if dh->bitmap_blocks is very large, it causes an interger overflow.
f8bec6
f8bec6
As a result, makedumpfile created a broken vmcore in a system with a
f8bec6
physical address range from 0x602770ecf000 to 0x6027ffffffff, and the
f8bec6
crash utility failed during session initialization, ending with the
f8bec6
error message "crash: vmlinux and vmcore do not match!".
f8bec6
f8bec6
Signed-off-by: Jialong Chen <chenjialong@huawei.com>
f8bec6
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
f8bec6
---
f8bec6
 diskdump_mod.h | 2 +-
f8bec6
 1 file changed, 1 insertion(+), 1 deletion(-)
f8bec6
f8bec6
diff --git a/makedumpfile-1.6.7/diskdump_mod.h b/makedumpfile-1.6.7/diskdump_mod.h
f8bec6
index 2676817..3733953 100644
f8bec6
--- a/makedumpfile-1.6.7/diskdump_mod.h
f8bec6
+++ b/makedumpfile-1.6.7/diskdump_mod.h
f8bec6
@@ -22,7 +22,7 @@
f8bec6
 #define DISK_DUMP_SIGNATURE		"DISKDUMP"
f8bec6
 #define KDUMP_SIGNATURE			"KDUMP   "
f8bec6
 #define SIG_LEN (sizeof(DUMP_PARTITION_SIGNATURE) - 1)
f8bec6
-#define DISKDUMP_HEADER_BLOCKS		(1)
f8bec6
+#define DISKDUMP_HEADER_BLOCKS		(1UL)
f8bec6
 
f8bec6
 /*
f8bec6
  * These are all remnants of the old "diskdump" facility,
f8bec6
-- 
f8bec6
2.7.5
f8bec6