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