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

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