kexec-tools/kexec-tools-2.0.14-makedumpfile-initial-call-cache_init-a-bit-early.patch
Pratyush Anand 86a81de3e5 Fix makedumpfile --mem-usage /proc/kcore
Patches have been taken from kexec-tools and makedumpfile to fix issue
with `makedumpfile --mem-usage /proc/kcore`.

Two of the patches is from kexec-tools and rest are from makedumpfile.
All the patches have been acked upstream and applies without conflict.

Kexec-tools patches:
(kexec-tools-2.0.14-x86-x86_64-Fix-format-warning-with-die.patch), which
fixes koji build issue.

kexec-tools-2.0.14-build_mem_phdrs-check-if-p_paddr-is-invalid.patch fixes
the regresssion caused by kernel /proc/kcore fix to use -1 as default value
of p_paddr for pt_loads. Without his patch kexec -p will fail with latest
kernel.

Other makedumpfile patches are backported to support --mem-usage while
kernel kaslr being enabled. Details please see the patch log of the individual
patches.

All the patches are backport of upstream commits.

Patches has been tested with kernel 4.11.0-0.rc1.git0.1.fc26.x86_64.

    # makedumpfile --mem-usage /proc/kcore -f
    The kernel version is not supported.
    The makedumpfile operation may be incomplete.

    TYPE            PAGES                   EXCLUDABLE      DESCRIPTION
    ----------------------------------------------------------------------
    ZERO            1960                    yes             Pages filled
    with zero
    NON_PRI_CACHE   22850                   yes             Cache pages
    without private flag
    PRI_CACHE       1517                    yes             Cache pages with
    private flag
    USER            32522                   yes             User process
    pages
    FREE            1898981                 yes             Free pages
    KERN_DATA       78721                   no              Dumpable kernel
    data

    page size:              4096
    Total pages on system:  2036551
    Total size on system:   8341712896       Byte

We won't need to pass -f once fedora kernel is rebased with v4.12.

Signed-off-by: Pratyush Anand <panand@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
2017-03-17 10:14:17 +08:00

48 lines
1.4 KiB
Diff

From 8e2834bac4f62da3894da297f083068431be6d80 Mon Sep 17 00:00:00 2001
Message-Id: <8e2834bac4f62da3894da297f083068431be6d80.1489471500.git.panand@redhat.com>
In-Reply-To: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand@redhat.com>
References: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand@redhat.com>
From: Pratyush Anand <panand@redhat.com>
Date: Thu, 2 Mar 2017 17:37:11 +0900
Subject: [PATCH 2/7] [PATCH v3 2/7] initial(): call cache_init() a bit early
Call cache_init() before get_kcore_dump_loads(), because latter uses
cache_search().
Call path is like this :
get_kcore_dump_loads() -> process_dump_load() -> vaddr_to_paddr() ->
vtop4_x86_64() -> readmem() -> cache_search()
Signed-off-by: Pratyush Anand <panand@redhat.com>
---
makedumpfile.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/makedumpfile-1.6.1/makedumpfile.c b/makedumpfile-1.6.1/makedumpfile.c
index 6942047199de..3b8e9810468d 100644
--- a/makedumpfile-1.6.1/makedumpfile.c
+++ b/makedumpfile-1.6.1/makedumpfile.c
@@ -3878,6 +3878,9 @@ initial(void)
if (!get_value_for_old_linux())
return FALSE;
+ if (!is_xen_memory() && !cache_init())
+ return FALSE;
+
if (info->flag_mem_usage && !get_kcore_dump_loads())
return FALSE;
@@ -4000,9 +4003,6 @@ out:
}
}
- if (!is_xen_memory() && !cache_init())
- return FALSE;
-
if (debug_info && !get_machdep_info())
return FALSE;
--
2.9.3