mirror of
https://github.com/crash-utility/crash
synced 2025-02-08 17:36:53 +00:00
Prevent "help -r" and "help -[D|n]" from generating a segmentation
violation when attempting to access non-existent NT_PRSTATUS notes for offline cpus in ELF or compressed kdumps. (anderson@redhat.com)
This commit is contained in:
parent
1818552d18
commit
ac9e38a45f
@ -1801,8 +1801,9 @@ __diskdump_memory_dump(FILE *fp)
|
||||
fprintf(fp, " num_prstatus_notes: %d\n",
|
||||
dd->num_prstatus_notes);
|
||||
for (i = 0; i < dd->num_prstatus_notes; i++) {
|
||||
fprintf(fp, " notes[%d]: %lx (NT_PRSTATUS)\n",
|
||||
i, (ulong)dd->nt_prstatus_percpu[i]);
|
||||
fprintf(fp, " notes[%d]: %lx %s\n",
|
||||
i, (ulong)dd->nt_prstatus_percpu[i],
|
||||
dd->nt_prstatus_percpu[i] ? "(NT_PRSTATUS)" : "");
|
||||
display_ELF_note(dd->machine_type, PRSTATUS_NOTE,
|
||||
dd->nt_prstatus_percpu[i], fp);
|
||||
}
|
||||
@ -2089,7 +2090,8 @@ diskdump_display_regs(int cpu, FILE *ofp)
|
||||
char *user_regs;
|
||||
size_t len;
|
||||
|
||||
if ((cpu < 0) || (cpu >= dd->num_prstatus_notes)) {
|
||||
if ((cpu < 0) || (cpu >= dd->num_prstatus_notes) ||
|
||||
(dd->nt_prstatus_percpu[cpu] == NULL)) {
|
||||
error(INFO, "registers not collected for cpu %d\n", cpu);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user