|
|
435398 |
commit 6d0d95ecc04a70f8448d562ff0fbbae237f5c929
|
|
|
435398 |
Author: Kazuhito Hagio <k-hagio-ab@nec.com>
|
|
|
435398 |
Date: Thu Apr 21 08:58:29 2022 +0900
|
|
|
435398 |
|
|
|
435398 |
[PATCH] Avoid false-positive mem_section validation with vmlinux
|
|
|
435398 |
|
|
|
435398 |
Currently get_mem_section() validates if SYMBOL(mem_section) is the address
|
|
|
435398 |
of the mem_section array first. But there was a report that the first
|
|
|
435398 |
validation wrongly returned TRUE with -x vmlinux and SPARSEMEM_EXTREME
|
|
|
435398 |
(4.15+) on s390x. This leads to crash failing statup with the following
|
|
|
435398 |
seek error:
|
|
|
435398 |
|
|
|
435398 |
crash: seek error: kernel virtual address: 67fffc2800 type: "memory section root table"
|
|
|
435398 |
|
|
|
435398 |
Skip the first validation when satisfying the conditions.
|
|
|
435398 |
|
|
|
435398 |
Reported-by: Dave Wysochanski <dwysocha@redhat.com>
|
|
|
435398 |
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
|
|
435398 |
Reviewed-and-Tested-by: Philipp Rudo <prudo@redhat.com>
|
|
|
435398 |
Reviewed-by: Pingfan Liu <piliu@redhat.com>
|
|
|
435398 |
|
|
|
435398 |
diff --git a/makedumpfile-1.7.1/makedumpfile.c b/makedumpfile-1.7.1/makedumpfile.c
|
|
|
435398 |
index a2f45c84cee3ba57ce3d3cf3f1905e6a03f4fd09..65d1c7c2f02c9ae8ead9de0f0217235fe72b3ca7 100644
|
|
|
435398 |
--- a/makedumpfile-1.7.1/makedumpfile.c
|
|
|
435398 |
+++ b/makedumpfile-1.7.1/makedumpfile.c
|
|
|
435398 |
@@ -3698,6 +3698,22 @@ validate_mem_section(unsigned long *mem_sec,
|
|
|
435398 |
return ret;
|
|
|
435398 |
}
|
|
|
435398 |
|
|
|
435398 |
+/*
|
|
|
435398 |
+ * SYMBOL(mem_section) varies with the combination of memory model and
|
|
|
435398 |
+ * its source:
|
|
|
435398 |
+ *
|
|
|
435398 |
+ * SPARSEMEM
|
|
|
435398 |
+ * vmcoreinfo: address of mem_section root array
|
|
|
435398 |
+ * -x vmlinux: address of mem_section root array
|
|
|
435398 |
+ *
|
|
|
435398 |
+ * SPARSEMEM_EXTREME v1
|
|
|
435398 |
+ * vmcoreinfo: address of mem_section root array
|
|
|
435398 |
+ * -x vmlinux: address of mem_section root array
|
|
|
435398 |
+ *
|
|
|
435398 |
+ * SPARSEMEM_EXTREME v2 (with 83e3c48729d9 and a0b1280368d1) 4.15+
|
|
|
435398 |
+ * vmcoreinfo: address of mem_section root array
|
|
|
435398 |
+ * -x vmlinux: address of pointer to mem_section root array
|
|
|
435398 |
+ */
|
|
|
435398 |
static int
|
|
|
435398 |
get_mem_section(unsigned int mem_section_size, unsigned long *mem_maps,
|
|
|
435398 |
unsigned int num_section)
|
|
|
435398 |
@@ -3710,12 +3726,27 @@ get_mem_section(unsigned int mem_section_size, unsigned long *mem_maps,
|
|
|
435398 |
strerror(errno));
|
|
|
435398 |
return FALSE;
|
|
|
435398 |
}
|
|
|
435398 |
+
|
|
|
435398 |
+ /*
|
|
|
435398 |
+ * There was a report that the first validation wrongly returned TRUE
|
|
|
435398 |
+ * with -x vmlinux and SPARSEMEM_EXTREME v2 on s390x, so skip it.
|
|
|
435398 |
+ * Howerver, leave the fallback validation as it is for the -i option.
|
|
|
435398 |
+ */
|
|
|
435398 |
+ if (is_sparsemem_extreme() && info->name_vmlinux) {
|
|
|
435398 |
+ unsigned long flag = 0;
|
|
|
435398 |
+ if (get_symbol_type_name("mem_section", DWARF_INFO_GET_SYMBOL_TYPE,
|
|
|
435398 |
+ NULL, &flag)
|
|
|
435398 |
+ && !(flag & TYPE_ARRAY))
|
|
|
435398 |
+ goto skip_1st_validation;
|
|
|
435398 |
+ }
|
|
|
435398 |
+
|
|
|
435398 |
ret = validate_mem_section(mem_sec, SYMBOL(mem_section),
|
|
|
435398 |
mem_section_size, mem_maps, num_section);
|
|
|
435398 |
|
|
|
435398 |
if (!ret && is_sparsemem_extreme()) {
|
|
|
435398 |
unsigned long mem_section_ptr;
|
|
|
435398 |
|
|
|
435398 |
+skip_1st_validation:
|
|
|
435398 |
if (!readmem(VADDR, SYMBOL(mem_section), &mem_section_ptr,
|
|
|
435398 |
sizeof(mem_section_ptr)))
|
|
|
435398 |
goto out;
|