Skip to content

Commit

Permalink
ppc64: still allow to move on if the emergency stacks info fails to i…
Browse files Browse the repository at this point in the history
…nitialize

Currently crash will fail and then exit, if the initialization of
the emergency stacks information fails. In real customer environments,
sometimes, a vmcore may be partially damaged, although such vmcores
are rare. For example:

  # ./crash ../3.10.0-1127.18.2.el7.ppc64le/vmcore ../3.10.0-1127.18.2.el7.ppc64le/vmlinux  -s
  crash: invalid kernel virtual address: 38  type: "paca->emergency_sp"
  #

Lets try to keep loading vmcore if such issues happen, so call
the readmem() with the RETURN_ON_ERROR instead of FAULT_ON_ERROR,
which allows the crash move on.

Reported-by: Dave Wysochanski <dwysocha@redhat.com>
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
  • Loading branch information
lian-bo committed Oct 10, 2022
1 parent 3b5e3e1 commit 4875514
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions ppc64.c
Expand Up @@ -1224,13 +1224,13 @@ ppc64_init_paca_info(void)
ulong paca_loc;

readmem(symbol_value("paca_ptrs"), KVADDR, &paca_loc, sizeof(void *),
"paca double pointer", FAULT_ON_ERROR);
"paca double pointer", RETURN_ON_ERROR);
readmem(paca_loc, KVADDR, paca_ptr, sizeof(void *) * kt->cpus,
"paca pointers", FAULT_ON_ERROR);
"paca pointers", RETURN_ON_ERROR);
} else if (symbol_exists("paca") &&
(get_symbol_type("paca", NULL, NULL) == TYPE_CODE_PTR)) {
readmem(symbol_value("paca"), KVADDR, paca_ptr, sizeof(void *) * kt->cpus,
"paca pointers", FAULT_ON_ERROR);
"paca pointers", RETURN_ON_ERROR);
} else {
free(paca_ptr);
return;
Expand All @@ -1245,7 +1245,7 @@ ppc64_init_paca_info(void)
for (i = 0; i < kt->cpus; i++)
readmem(paca_ptr[i] + offset, KVADDR, &ms->emergency_sp[i],
sizeof(void *), "paca->emergency_sp",
FAULT_ON_ERROR);
RETURN_ON_ERROR);
}

if (MEMBER_EXISTS("paca_struct", "nmi_emergency_sp")) {
Expand All @@ -1256,7 +1256,7 @@ ppc64_init_paca_info(void)
for (i = 0; i < kt->cpus; i++)
readmem(paca_ptr[i] + offset, KVADDR, &ms->nmi_emergency_sp[i],
sizeof(void *), "paca->nmi_emergency_sp",
FAULT_ON_ERROR);
RETURN_ON_ERROR);
}

if (MEMBER_EXISTS("paca_struct", "mc_emergency_sp")) {
Expand All @@ -1267,7 +1267,7 @@ ppc64_init_paca_info(void)
for (i = 0; i < kt->cpus; i++)
readmem(paca_ptr[i] + offset, KVADDR, &ms->mc_emergency_sp[i],
sizeof(void *), "paca->mc_emergency_sp",
FAULT_ON_ERROR);
RETURN_ON_ERROR);
}

free(paca_ptr);
Expand Down Expand Up @@ -1947,7 +1947,7 @@ ppc64_in_emergency_stack(int cpu, ulong addr, bool verbose)
if (cpu < 0 || cpu >= kt->cpus)
return NONE_STACK;

if (ms->emergency_sp) {
if (ms->emergency_sp && IS_KVADDR(ms->emergency_sp[cpu])) {
top = ms->emergency_sp[cpu];
base = top - STACKSIZE();
if (addr >= base && addr < top) {
Expand All @@ -1957,7 +1957,7 @@ ppc64_in_emergency_stack(int cpu, ulong addr, bool verbose)
}
}

if (ms->nmi_emergency_sp) {
if (ms->nmi_emergency_sp && IS_KVADDR(ms->nmi_emergency_sp[cpu])) {
top = ms->nmi_emergency_sp[cpu];
base = top - STACKSIZE();
if (addr >= base && addr < top) {
Expand All @@ -1967,7 +1967,7 @@ ppc64_in_emergency_stack(int cpu, ulong addr, bool verbose)
}
}

if (ms->mc_emergency_sp) {
if (ms->mc_emergency_sp && IS_KVADDR(ms->mc_emergency_sp[cpu])) {
top = ms->mc_emergency_sp[cpu];
base = top - STACKSIZE();
if (addr >= base && addr < top) {
Expand Down

0 comments on commit 4875514

Please sign in to comment.