Package: makedumpfile
Version: 1:1.6.7-1
Severity: normal
Tags: patch
User: [email protected]
Usertags: origin-ubuntu groovy ubuntu-patch

Dear Maintainer,

On some arm systems makedumpfile fails to translate virtual to physical 
addresses properly.
This may result in makedumpfile looping forever exhausting all memory,
or translating a virtual address to an invalid physical address and then 
failing and falling back to cp.
The reason it cannot resolve some addresses is because the PMD mask is wrong.
When physical address mask allows up to 48bits pmd mask should allow the
same, currently pmd mask is set to 40bits (see commit [1]).

For more information please refer to :
https://launchpad.net/bugs/1869465

In Ubuntu, the attached patch was applied to achieve the following:

The patch aligns the PMD_SECTION_MASK with PHYS_MASK and fixed the bug.

  * d/p/align_PMD_SECTION_MASK_with_PHYS_MASK.patch (LP: #1869465) 


Thanks for considering the patch.

[1] 
https://github.com/makedumpfile/makedumpfile/commit/7242ae4cb5288df626f464ced0a8b60fd669100b

-- System Information:
Debian Release: bullseye/sid
  APT prefers focal-updates
  APT policy: (500, 'focal-updates'), (500, 'focal-security'), (500, 'focal'), 
(100, 'focal-backports')
Architecture: amd64 (x86_64)

Kernel: Linux 5.4.0-33-generic (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru 
makedumpfile-1.6.7/debian/patches/align_PMD_SECTION_MASK_with_PHYS_MASK.patch 
makedumpfile-1.6.7/debian/patches/align_PMD_SECTION_MASK_with_PHYS_MASK.patch
--- 
makedumpfile-1.6.7/debian/patches/align_PMD_SECTION_MASK_with_PHYS_MASK.patch   
    1970-01-01 00:00:00.000000000 +0000
+++ 
makedumpfile-1.6.7/debian/patches/align_PMD_SECTION_MASK_with_PHYS_MASK.patch   
    2020-06-04 13:36:01.000000000 +0000
@@ -0,0 +1,34 @@
+From: Michal Suchanek <[email protected]>
+Origin: Upstream, 
https://github.com/makedumpfile/makedumpfile/commit/7242ae4cb5288df626f464ced0a8b60fd669100b
+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1869465
+Date: Mon, 16 Mar 2020 19:39:58 +0100
+Subject: [PATCH] Align PMD_SECTION_MASK with PHYS_MASK
+
+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 <[email protected]>
+---
+ arch/arm64.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+Index: makedumpfile-1.6.7/arch/arm64.c
+===================================================================
+--- makedumpfile-1.6.7.orig/arch/arm64.c
++++ makedumpfile-1.6.7/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
diff -Nru makedumpfile-1.6.7/debian/patches/series 
makedumpfile-1.6.7/debian/patches/series
--- makedumpfile-1.6.7/debian/patches/series    2020-03-17 19:40:38.000000000 
+0000
+++ makedumpfile-1.6.7/debian/patches/series    2020-06-04 13:36:01.000000000 
+0000
@@ -1 +1,2 @@
 0002-adapt-makefile-to-debian.patch
+align_PMD_SECTION_MASK_with_PHYS_MASK.patch

Reply via email to