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

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