makedumpfile/makedumpfile-Fix-cd_header-offset-overflow-with-large-pfn.patch
Petr Tesařík 61fcefb89b Accepting request 790398 from home:michals
- Refresh patch with upstream version
  - makedumpfile-arm64-VA-range-SUSE.patch
  + makedumpfile-arm64-Align-PMD_SECTION_MASK-with-PHYS_MASK.patch
- makedumpfile-Fix-cd_header-offset-overflow-with-large-pfn.patch: Fix integer
  overflow with large memory configuration (bsc#1168234).

OBS-URL: https://build.opensuse.org/request/show/790398
OBS-URL: https://build.opensuse.org/package/show/Kernel:kdump/makedumpfile?expand=0&rev=143
2020-04-07 08:20:44 +00:00

46 lines
1.5 KiB
Diff

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