It is not necessary to distinguish between different kernel
versions. Kernel commit 2d070eab2e82 merely reuses a previously
unused bit (see clarification in kernel commit def9b71ee651a). The
bit was always zero even before that commit, so it is safe to mask
it off even for kernel versions before 4.13, removing some of the
complexity.

More importantly, makedumpfile fails on kernels which backport the
patch on top of an older version (for example SLES15).

Signed-off-by: Petr Tesarik <ptesa...@suse.com>
---
 makedumpfile.c | 5 +----
 makedumpfile.h | 1 -
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/makedumpfile.c b/makedumpfile.c
index ed138d3..b180eb3 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -3337,10 +3337,7 @@ section_mem_map_addr(unsigned long addr)
                return NOT_KV_ADDR;
        }
        map = ULONG(mem_section + OFFSET(mem_section.section_mem_map));
-       if (info->kernel_version < KERNEL_VERSION(4, 13, 0))
-               map &= SECTION_MAP_MASK_4_12;
-       else
-               map &= SECTION_MAP_MASK;
+       map &= SECTION_MAP_MASK;
        free(mem_section);
 
        return map;
diff --git a/makedumpfile.h b/makedumpfile.h
index 01eece2..548aab0 100644
--- a/makedumpfile.h
+++ b/makedumpfile.h
@@ -186,7 +186,6 @@ isAnon(unsigned long mapping)
 #define SECTION_NR_TO_ROOT(sec)        ((sec) / SECTIONS_PER_ROOT())
 #define SECTION_IS_ONLINE      (1UL<<2)
 #define SECTION_MAP_LAST_BIT   (1UL<<3)
-#define SECTION_MAP_MASK_4_12  (~(SECTION_IS_ONLINE-1))
 #define SECTION_MAP_MASK       (~(SECTION_MAP_LAST_BIT-1))
 #define NR_SECTION_ROOTS()     divideup(num_section, SECTIONS_PER_ROOT())
 #define SECTION_NR_TO_PFN(sec) ((sec) << PFN_SECTION_SHIFT())
-- 
2.13.6

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

Reply via email to