|
|
134b35 |
commit 8717902685706faf48d2c27eb943822ae8829ccc
|
|
|
134b35 |
Author: Dave Anderson <anderson@redhat.com>
|
|
|
134b35 |
Date: Mon May 1 15:14:36 2017 -0400
|
|
|
134b35 |
|
|
|
134b35 |
Fix for the "snap.so" extension module to pass the KASLR relocation
|
|
|
134b35 |
offset value in the dumpfile header for kernels that are compiled
|
|
|
134b35 |
with CONFIG_RANDOMIZE_BASE. Without the patch, it is necessary to
|
|
|
134b35 |
use the "--kaslr=<offset>" command line option, or the session
|
|
|
134b35 |
fails with the message "WARNING: cannot read linux_banner string",
|
|
|
134b35 |
followed by "crash: vmlinux and vmcore do not match!".
|
|
|
134b35 |
(anderson@redhat.com)
|
|
|
134b35 |
|
|
|
134b35 |
diff --git a/extensions/snap.c b/extensions/snap.c
|
|
|
134b35 |
index 91af859..7c94618 100644
|
|
|
134b35 |
--- a/extensions/snap.c
|
|
|
134b35 |
+++ b/extensions/snap.c
|
|
|
134b35 |
@@ -1,7 +1,7 @@
|
|
|
134b35 |
/* snap.c - capture live memory into a kdump or netdump dumpfile
|
|
|
134b35 |
*
|
|
|
134b35 |
- * Copyright (C) 2009, 2013 David Anderson
|
|
|
134b35 |
- * Copyright (C) 2009, 2013 Red Hat, Inc. All rights reserved.
|
|
|
134b35 |
+ * Copyright (C) 2009, 2013, 2014, 2017 David Anderson
|
|
|
134b35 |
+ * Copyright (C) 2009, 2013, 2014, 2017 Red Hat, Inc. All rights reserved.
|
|
|
134b35 |
*
|
|
|
134b35 |
* This program is free software; you can redistribute it and/or modify
|
|
|
134b35 |
* it under the terms of the GNU General Public License as published by
|
|
|
134b35 |
@@ -423,7 +423,10 @@ generate_elf_header(int type, int fd, char *filename)
|
|
|
134b35 |
ushort e_machine;
|
|
|
134b35 |
int num_segments;
|
|
|
134b35 |
struct node_table *nt;
|
|
|
134b35 |
- ulonglong task_struct;
|
|
|
134b35 |
+ struct SNAP_info {
|
|
|
134b35 |
+ ulonglong task_struct;
|
|
|
134b35 |
+ ulonglong relocate;
|
|
|
134b35 |
+ } SNAP_info;
|
|
|
134b35 |
|
|
|
134b35 |
num_segments = vt->numnodes;
|
|
|
134b35 |
|
|
|
134b35 |
@@ -606,9 +609,10 @@ generate_elf_header(int type, int fd, char *filename)
|
|
|
134b35 |
notes->p_filesz += len;
|
|
|
134b35 |
|
|
|
134b35 |
/* NT_TASKSTRUCT note */
|
|
|
134b35 |
- task_struct = CURRENT_TASK();
|
|
|
134b35 |
+ SNAP_info.task_struct = CURRENT_TASK();
|
|
|
134b35 |
+ SNAP_info.relocate = kt->relocate;
|
|
|
134b35 |
len = dump_elf_note (ptr, NT_TASKSTRUCT, "SNAP",
|
|
|
134b35 |
- (char *)&task_struct, sizeof(ulonglong));
|
|
|
134b35 |
+ (char *)&SNAP_info, sizeof(struct SNAP_info));
|
|
|
134b35 |
offset += len;
|
|
|
134b35 |
ptr += len;
|
|
|
134b35 |
notes->p_filesz += len;
|
|
|
134b35 |
diff --git a/netdump.c b/netdump.c
|
|
|
134b35 |
index 409bc43..0772e02 100644
|
|
|
134b35 |
--- a/netdump.c
|
|
|
134b35 |
+++ b/netdump.c
|
|
|
134b35 |
@@ -1172,8 +1172,9 @@ netdump_memory_dump(FILE *fp)
|
|
|
134b35 |
netdump_print(" nt_prpsinfo: %lx\n", nd->nt_prpsinfo);
|
|
|
134b35 |
netdump_print(" nt_taskstruct: %lx\n", nd->nt_taskstruct);
|
|
|
134b35 |
netdump_print(" task_struct: %lx\n", nd->task_struct);
|
|
|
134b35 |
- netdump_print(" page_size: %d\n", nd->page_size);
|
|
|
134b35 |
+ netdump_print(" relocate: %lx\n", nd->relocate);
|
|
|
134b35 |
netdump_print(" switch_stack: %lx\n", nd->switch_stack);
|
|
|
134b35 |
+ netdump_print(" page_size: %d\n", nd->page_size);
|
|
|
134b35 |
dump_xen_kdump_data(fp);
|
|
|
134b35 |
netdump_print(" num_prstatus_notes: %d\n", nd->num_prstatus_notes);
|
|
|
134b35 |
netdump_print(" num_qemu_notes: %d\n", nd->num_qemu_notes);
|
|
|
134b35 |
@@ -1912,8 +1913,6 @@ dump_Elf32_Nhdr(Elf32_Off offset, int store)
|
|
|
134b35 |
if (store) {
|
|
|
134b35 |
nd->nt_taskstruct = (void *)note;
|
|
|
134b35 |
nd->task_struct = *((ulong *)(ptr + note->n_namesz));
|
|
|
134b35 |
- nd->switch_stack = *((ulong *)
|
|
|
134b35 |
- (ptr + note->n_namesz + sizeof(ulong)));
|
|
|
134b35 |
}
|
|
|
134b35 |
break;
|
|
|
134b35 |
case NT_DISKDUMP:
|
|
|
134b35 |
@@ -2160,8 +2159,19 @@ dump_Elf64_Nhdr(Elf64_Off offset, int store)
|
|
|
134b35 |
if (store) {
|
|
|
134b35 |
nd->nt_taskstruct = (void *)note;
|
|
|
134b35 |
nd->task_struct = *((ulong *)(ptr + note->n_namesz));
|
|
|
134b35 |
- nd->switch_stack = *((ulong *)
|
|
|
134b35 |
- (ptr + note->n_namesz + sizeof(ulong)));
|
|
|
134b35 |
+ if (pc->flags2 & SNAP) {
|
|
|
134b35 |
+ if (note->n_descsz == 16) {
|
|
|
134b35 |
+ nd->relocate = *((ulong *)
|
|
|
134b35 |
+ (ptr + note->n_namesz + sizeof(ulong)));
|
|
|
134b35 |
+ if (nd->relocate) {
|
|
|
134b35 |
+ kt->relocate = nd->relocate;
|
|
|
134b35 |
+ kt->flags |= RELOC_SET;
|
|
|
134b35 |
+ kt->flags2 |= KASLR;
|
|
|
134b35 |
+ }
|
|
|
134b35 |
+ }
|
|
|
134b35 |
+ } else if (machine_type("IA64"))
|
|
|
134b35 |
+ nd->switch_stack = *((ulong *)
|
|
|
134b35 |
+ (ptr + note->n_namesz + sizeof(ulong)));
|
|
|
134b35 |
}
|
|
|
134b35 |
break;
|
|
|
134b35 |
case NT_DISKDUMP:
|
|
|
134b35 |
diff --git a/netdump.h b/netdump.h
|
|
|
134b35 |
index b63eed7..ec6691c 100644
|
|
|
134b35 |
--- a/netdump.h
|
|
|
134b35 |
+++ b/netdump.h
|
|
|
134b35 |
@@ -1,7 +1,7 @@
|
|
|
134b35 |
/* netdump.h
|
|
|
134b35 |
*
|
|
|
134b35 |
- * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 David Anderson
|
|
|
134b35 |
- * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Red Hat, Inc. All rights reserved.
|
|
|
134b35 |
+ * Copyright (C) 2002-2009, 2017 David Anderson
|
|
|
134b35 |
+ * Copyright (C) 2002-2009, 2017 Red Hat, Inc. All rights reserved.
|
|
|
134b35 |
*
|
|
|
134b35 |
* This program is free software; you can redistribute it and/or modify
|
|
|
134b35 |
* it under the terms of the GNU General Public License as published by
|
|
|
134b35 |
@@ -77,6 +77,7 @@ struct vmcore_data {
|
|
|
134b35 |
ulonglong backup_src_start;
|
|
|
134b35 |
ulong backup_src_size;
|
|
|
134b35 |
ulonglong backup_offset;
|
|
|
134b35 |
+ ulong relocate;
|
|
|
134b35 |
};
|
|
|
134b35 |
|
|
|
134b35 |
#define DUMP_ELF_INCOMPLETE 0x1 /* dumpfile is incomplete */
|
|
|
134b35 |
|
|
|
134b35 |
commit c85a70ba752ac31e729a753a03b836dc5591714b
|
|
|
134b35 |
Author: Dave Anderson <anderson@redhat.com>
|
|
|
134b35 |
Date: Mon May 1 15:40:21 2017 -0400
|
|
|
134b35 |
|
|
|
134b35 |
The native gdb "disassemble" command fails if the kernel has been
|
|
|
134b35 |
compiled with CONFIG_RANDOMIZE_BASE because the embedded gdb module
|
|
|
134b35 |
still operates under the assumption that the (non-relocated) text
|
|
|
134b35 |
locations in the vmlinux file are correct. The error message that
|
|
|
134b35 |
is issued is somewhat confusing, indicating "No function contains
|
|
|
134b35 |
specified address". This patch simply clarifies the error message
|
|
|
134b35 |
to indicate "crash: the gdb "disassemble" command is prohibited
|
|
|
134b35 |
because the kernel text was relocated by KASLR; use the crash "dis"
|
|
|
134b35 |
command instead."
|
|
|
134b35 |
(anderson@redhat.com)
|
|
|
134b35 |
|
|
|
134b35 |
diff --git a/gdb_interface.c b/gdb_interface.c
|
|
|
134b35 |
index 2f7f30d..873787b 100644
|
|
|
134b35 |
--- a/gdb_interface.c
|
|
|
134b35 |
+++ b/gdb_interface.c
|
|
|
134b35 |
@@ -737,6 +737,13 @@ is_restricted_command(char *cmd, ulong flags)
|
|
|
134b35 |
newline, newline, pc->program_name);
|
|
|
134b35 |
}
|
|
|
134b35 |
}
|
|
|
134b35 |
+
|
|
|
134b35 |
+ if (kt->relocate &&
|
|
|
134b35 |
+ STRNEQ("disassemble", cmd) && STRNEQ(cmd, "disas"))
|
|
|
134b35 |
+ error(FATAL,
|
|
|
134b35 |
+ "the gdb \"disassemble\" command is prohibited because the kernel text\n"
|
|
|
134b35 |
+ "%swas relocated%s; use the crash \"dis\" command instead.\n",
|
|
|
134b35 |
+ space(strlen(pc->curcmd)+2), kt->flags2 & KASLR ? " by KASLR" : "");
|
|
|
134b35 |
|
|
|
134b35 |
return FALSE;
|
|
|
134b35 |
}
|
|
|
134b35 |
|
|
|
134b35 |
commit 14cbcd58c14cbb34912ebce75c99e8bf35d39aef
|
|
|
134b35 |
Author: Dave Anderson <anderson@redhat.com>
|
|
|
134b35 |
Date: Tue May 2 15:45:23 2017 -0400
|
|
|
134b35 |
|
|
|
134b35 |
Fix for the "mach -m" command in Linux 4.9 and later kernels that
|
|
|
134b35 |
contain commit 475339684ef19e46f4702e2d185a869a5c454688, titled
|
|
|
134b35 |
"x86/e820: Prepare e280 code for switch to dynamic storage", in
|
|
|
134b35 |
which the "e820" symbol was changed from a static e820map structure
|
|
|
134b35 |
to a pointer to an e820map structure. Without the patch, the
|
|
|
134b35 |
command either displays just the header, or the header with several
|
|
|
134b35 |
nonsensical entries.
|
|
|
134b35 |
(anderson@redhat.com)
|
|
|
134b35 |
|
|
|
134b35 |
diff --git a/x86_64.c b/x86_64.c
|
|
|
134b35 |
index fbef125..74a0268 100644
|
|
|
134b35 |
--- a/x86_64.c
|
|
|
134b35 |
+++ b/x86_64.c
|
|
|
134b35 |
@@ -5332,7 +5332,10 @@ x86_64_display_memmap(void)
|
|
|
134b35 |
ulonglong addr, size;
|
|
|
134b35 |
uint type;
|
|
|
134b35 |
|
|
|
134b35 |
- e820 = symbol_value("e820");
|
|
|
134b35 |
+ if (get_symbol_type("e820", NULL, NULL) == TYPE_CODE_PTR)
|
|
|
134b35 |
+ get_symbol_data("e820", sizeof(void *), &e820);
|
|
|
134b35 |
+ else
|
|
|
134b35 |
+ e820 = symbol_value("e820");
|
|
|
134b35 |
if (CRASHDEBUG(1))
|
|
|
134b35 |
dump_struct("e820map", e820, RADIX(16));
|
|
|
134b35 |
buf = (char *)GETBUF(SIZE(e820map));
|
|
|
134b35 |
|
|
|
134b35 |
commit a4a538caca140a8e948bbdae2be311168db7a1eb
|
|
|
134b35 |
Author: Dave Anderson <anderson@redhat.com>
|
|
|
134b35 |
Date: Tue May 2 16:51:53 2017 -0400
|
|
|
134b35 |
|
|
|
134b35 |
Fix for Linux 4.10 and later kdump dumpfiles, or kernels that have
|
|
|
134b35 |
backported commit 401721ecd1dcb0a428aa5d6832ee05ffbdbffbbe, titled
|
|
|
134b35 |
"kexec: export the value of phys_base instead of symbol address".
|
|
|
134b35 |
Without the patch, if the x86_64 "phys_base" value in the VMCOREINFO
|
|
|
134b35 |
note is a negative negative decimal number, the crash session fails
|
|
|
134b35 |
during session intialization with a "page excluded" or "seek error"
|
|
|
134b35 |
when reading "page_offset_base".
|
|
|
134b35 |
(anderson@redhat.com)
|
|
|
134b35 |
|
|
|
134b35 |
diff --git a/x86_64.c b/x86_64.c
|
|
|
134b35 |
index 74a0268..04364f9 100644
|
|
|
134b35 |
--- a/x86_64.c
|
|
|
134b35 |
+++ b/x86_64.c
|
|
|
134b35 |
@@ -6219,11 +6219,14 @@ x86_64_calc_phys_base(void)
|
|
|
134b35 |
* Linux 4.10 exports it in VMCOREINFO (finally).
|
|
|
134b35 |
*/
|
|
|
134b35 |
if ((p1 = pc->read_vmcoreinfo("NUMBER(phys_base)"))) {
|
|
|
134b35 |
- machdep->machspec->phys_base = dtol(p1, QUIET, NULL);
|
|
|
134b35 |
- free(p1);
|
|
|
134b35 |
+ if (*p1 == '-')
|
|
|
134b35 |
+ machdep->machspec->phys_base = dtol(p1+1, QUIET, NULL) * -1;
|
|
|
134b35 |
+ else
|
|
|
134b35 |
+ machdep->machspec->phys_base = dtol(p1, QUIET, NULL);
|
|
|
134b35 |
if (CRASHDEBUG(1))
|
|
|
134b35 |
- fprintf(fp, "VMCOREINFO: phys_base: %lx\n",
|
|
|
134b35 |
- machdep->machspec->phys_base);
|
|
|
134b35 |
+ fprintf(fp, "VMCOREINFO: NUMBER(phys_base): %s -> %lx\n",
|
|
|
134b35 |
+ p1, machdep->machspec->phys_base);
|
|
|
134b35 |
+ free(p1);
|
|
|
134b35 |
return;
|
|
|
134b35 |
}
|
|
|
134b35 |
|
|
|
134b35 |
|
|
|
134b35 |
commit ad3b84766beefedcfaa191dfd597f136f660a5b6
|
|
|
134b35 |
Author: Dave Anderson <anderson@redhat.com>
|
|
|
134b35 |
Date: Wed May 3 10:29:37 2017 -0400
|
|
|
134b35 |
|
|
|
134b35 |
Fix for the PPC64 "pte" command. Without the patch, if the target
|
|
|
134b35 |
PTE references a present page, the physical address is incorrect.
|
|
|
134b35 |
(anderson@redhat.com)
|
|
|
134b35 |
|
|
|
134b35 |
diff --git a/ppc64.c b/ppc64.c
|
|
|
134b35 |
index 15025d5..84cec09 100644
|
|
|
134b35 |
--- a/ppc64.c
|
|
|
134b35 |
+++ b/ppc64.c
|
|
|
134b35 |
@@ -1,7 +1,7 @@
|
|
|
134b35 |
/* ppc64.c -- core analysis suite
|
|
|
134b35 |
*
|
|
|
134b35 |
- * Copyright (C) 2004-2015 David Anderson
|
|
|
134b35 |
- * Copyright (C) 2004-2015 Red Hat, Inc. All rights reserved.
|
|
|
134b35 |
+ * Copyright (C) 2004-2015,2017 David Anderson
|
|
|
134b35 |
+ * Copyright (C) 2004-2015,2017 Red Hat, Inc. All rights reserved.
|
|
|
134b35 |
* Copyright (C) 2004, 2006 Haren Myneni, IBM Corporation
|
|
|
134b35 |
*
|
|
|
134b35 |
* This program is free software; you can redistribute it and/or modify
|
|
|
134b35 |
@@ -1507,6 +1507,8 @@ ppc64_translate_pte(ulong pte, void *physaddr, ulonglong pte_rpn_shift)
|
|
|
134b35 |
char *arglist[MAXARGS];
|
|
|
134b35 |
ulong paddr;
|
|
|
134b35 |
|
|
|
134b35 |
+ if (STREQ(pc->curcmd, "pte"))
|
|
|
134b35 |
+ pte_rpn_shift = machdep->machspec->pte_rpn_shift;
|
|
|
134b35 |
paddr = PTOB(pte >> pte_rpn_shift);
|
|
|
134b35 |
page_present = !!(pte & _PAGE_PRESENT);
|
|
|
134b35 |
|
|
|
134b35 |
@@ -1517,12 +1519,12 @@ ppc64_translate_pte(ulong pte, void *physaddr, ulonglong pte_rpn_shift)
|
|
|
134b35 |
|
|
|
134b35 |
sprintf(ptebuf, "%lx", pte);
|
|
|
134b35 |
len1 = MAX(strlen(ptebuf), strlen("PTE"));
|
|
|
134b35 |
- fprintf(fp, "%s ", mkstring(buf, len1, CENTER|LJUST, "PTE"));
|
|
|
134b35 |
|
|
|
134b35 |
if (!page_present && pte) {
|
|
|
134b35 |
swap_location(pte, buf);
|
|
|
134b35 |
if ((c = parse_line(buf, arglist)) != 3)
|
|
|
134b35 |
error(FATAL, "cannot determine swap location\n");
|
|
|
134b35 |
+ fprintf(fp, "%s ", mkstring(buf2, len1, CENTER|LJUST, "PTE"));
|
|
|
134b35 |
|
|
|
134b35 |
len2 = MAX(strlen(arglist[0]), strlen("SWAP"));
|
|
|
134b35 |
len3 = MAX(strlen(arglist[2]), strlen("OFFSET"));
|
|
|
134b35 |
@@ -1541,6 +1543,7 @@ ppc64_translate_pte(ulong pte, void *physaddr, ulonglong pte_rpn_shift)
|
|
|
134b35 |
return page_present;
|
|
|
134b35 |
}
|
|
|
134b35 |
|
|
|
134b35 |
+ fprintf(fp, "%s ", mkstring(buf, len1, CENTER|LJUST, "PTE"));
|
|
|
134b35 |
sprintf(physbuf, "%lx", paddr);
|
|
|
134b35 |
len2 = MAX(strlen(physbuf), strlen("PHYSICAL"));
|
|
|
134b35 |
fprintf(fp, "%s ", mkstring(buf, len2, CENTER|LJUST, "PHYSICAL"));
|