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
This commit is contained in:
Petr Tesařík 2020-04-07 08:20:44 +00:00 committed by Git OBS Bridge
parent 3e06f0f7ed
commit 61fcefb89b
5 changed files with 95 additions and 25 deletions

View File

@ -0,0 +1,45 @@
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

View File

@ -0,0 +1,39 @@
From 7242ae4cb5288df626f464ced0a8b60fd669100b Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de>
Date: Mon, 16 Mar 2020 19:39:58 +0100
Subject: [PATCH] [PATCH] Align PMD_SECTION_MASK with PHYS_MASK
Patch-mainline: expected 1.6.8
Git-commit: 7242ae4cb5288df626f464ced0a8b60fd669100b
Reportedly on some arm64 systems makedumpfile loops forever exhausting
all memory when filtering kernel core. It turns out the reason is it
cannot resolve some addresses because the PMD mask is wrong. When
physical address mask allows up to 48bits pmd mask should allow the
same.
I suppose you would need a system that needs physical addresses over 1TB
to be able to reproduce this. This may be either because you have a lot
of memory or because the firmware mapped some memory above 1TB for some
reason.
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
arch/arm64.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64.c b/arch/arm64.c
index 43164ccc32d4..54d60b440850 100644
--- a/arch/arm64.c
+++ b/arch/arm64.c
@@ -81,7 +81,7 @@ static unsigned long kimage_voffset;
* Remove the highest order bits that are not a part of the
* physical address in a section
*/
-#define PMD_SECTION_MASK ((1UL << 40) - 1)
+#define PMD_SECTION_MASK ((1UL << PHYS_MASK_SHIFT) - 1)
#define PMD_TYPE_MASK 3
#define PMD_TYPE_SECT 1
--
2.23.0

View File

@ -1,24 +0,0 @@
Subject: Align PMD_SECTION_MASK with CONFIG_ARM64_VA_BITS
References: bsc#1142715
Since SUSE 4.12 kernel the VA renge is increased to 48 bits.
Upstream proposed to export the VA range in vmcoreinfo but we did not backport
the patch.
Link: https://lists.infradead.org/pipermail/kexec/2019-November/023966.html
Link: https://patchwork.kernel.org/cover/11266557/
diff -ur makedumpfile-1.6.7.orig/arch/arm64.c makedumpfile-1.6.7/arch/arm64.c
--- makedumpfile-1.6.7.orig/arch/arm64.c 2020-01-15 19:09:56.000000000 +0100
+++ makedumpfile-1.6.7/arch/arm64.c 2020-03-04 14:38:02.281783810 +0100
@@ -81,7 +81,7 @@
* Remove the highest order bits that are not a part of the
* physical address in a section
*/
-#define PMD_SECTION_MASK ((1UL << 40) - 1)
+#define PMD_SECTION_MASK ((1UL << 48) - 1)
#define PMD_TYPE_MASK 3
#define PMD_TYPE_SECT 1

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Wed Apr 1 06:11:18 UTC 2020 - Michal Suchanek <msuchanek@suse.de>
- 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).
-------------------------------------------------------------------
Wed Mar 4 13:45:23 UTC 2020 - Michal Suchanek <msuchanek@suse.com>

View File

@ -43,7 +43,8 @@ Source99: %{name}-rpmlintrc
Patch1: %{name}-override-libtinfo.patch
Patch2: %{name}-ppc64-VA-range-SUSE.patch
Patch3: %{name}-PN_XNUM.patch
Patch4: %{name}-arm64-VA-range-SUSE.patch
Patch4: %{name}-arm64-Align-PMD_SECTION_MASK-with-PHYS_MASK.patch
Patch5: %{name}-Fix-cd_header-offset-overflow-with-large-pfn.patch
BuildRequires: libdw-devel
BuildRequires: libelf-devel
BuildRequires: libeppic-devel