Commit Graph

595 Commits

Author SHA1 Message Date
Dave Anderson
2399cce9b7 Fix for the gathering of module symbol name strings during session
initialization.  In the unlikely case where the ordering of module
symbol name strings does not match the order of the kernel_symbol
structures, a faulty module symbol list entry may be created that
contains a bogus name string.
(sebastien.piechurski@bull.net)
2016-08-16 14:40:48 -04:00
Dave Anderson
b349598bb7 Fix for the ARM64 "bt -R <symbol>" option if the only reference
to the kernel text symbol in a backtrace is contained within the
"[PC: <address> [<symbol+offset>]" line of an exception frame
dump.  Without the patch, the reference will only be picked up if
the PC's hexadecimal address value is used.
(anderson@redhat.com)
2016-07-20 12:27:25 -04:00
Dave Anderson
4978028e9e Fix for the X86_64 "bt -R <symbol>" option if the only reference
to the kernel text symbol in a backtrace is contained within the
"[exception RIP: <symbol+offset>]" line of an exception frame
dump.  Without the patch, the reference will only be picked up if
the exception RIP's hexadecimal value is used.
(anderson@redhat.com)
2016-07-20 12:09:53 -04:00
Dave Anderson
e9685ddcb1 Fix for the failure of the "dis <symbol>" option in the extremely
unlikely case where the symbol's name string is composed entirely of
hexadecimal characters.  For example, without the patch, "dis f"
fails with the error message "dis: WARNING: f: no associated kernel
symbol found" followed by "0xf: Cannot access memory at address 0xf".
(anderson@redhat.com)
2016-07-14 11:41:41 -04:00
Dave Anderson
69a2cfa0c8 Fix for the failure of the "sym <symbol>" option in the extremely
unlikely case where the symbol's name string is composed entirely of
hexadecimal characters.  For example, without the patch, "sym e820"
fails with the error message "sym: invalid address: e820".
(anderson@redhat.com)
2016-07-14 11:38:08 -04:00
Dave Anderson
09fdac65d1 Incorporated Takahiro Akashi's alternative backtrace method as a
"bt" option, which can be accessed using "bt -o", and where "bt -O"
will toggle the original and optional methods as the default.  The
original backtrace method has adopted two changes/features from
the optional method:
  (1) ORIG_X0 and SYSCALLNO registers are not displayed in kernel
      exception frames.
  (2) stackframe entry text locations are modified to be the PC
      address of the branch instruction instead of the subsequent
      "return" PC address contained in the stackframe link register.
Accordingly, these are the essential differences between the original
and optional methods:
  (1) optional: the backtrace will start with the IPI exception frame
      located on the process stack.
  (2) original: the starting point of backtraces for the active,
      non-crashing, tasks, will continue to have crash_save_cpu()
      on the IRQ stack as the starting point.
  (3) optional: the exception entry stackframe adjusted to be located
      farther down in the IRQ stack.
  (4) optional: bt -f does not display IRQ stack memory above the
      adjusted exception entry stackframe.
  (5) optional: may display "(Next exception frame might be wrong)".
(takahiro.akashi@linaro.org, anderson@redhat.com)
2016-07-13 16:37:14 -04:00
Dave Anderson
6341fe52dd Fix for the extensions/trace.c extension module to account for the
Linux 4.7 kernel commit dcb0b5575d24 that changed the bit index for
the TRACE_EVENT_FL_TRACEPOINT flag.  Without the patch, the "extend"
command fails to load the trace.so module, with the error message
"extend: /path/to/crash/extensions/trace.so: no commands registered:
shared object unloaded".  The patch reads the flag's enum value
dynamically instead of using a hard-coded value.
(namhyung@gmail.com)
2016-07-13 14:29:28 -04:00
Dave Anderson
7bdaf442dc Fix for the "bt -[eE]" options on ARM64 to recognize kernel exception
frames in VHE enabled systems, in which the kernel runs in EL2.
(takahiro.akashi@linaro.org)
2016-06-30 14:17:34 -04:00
Dave Anderson
15994b89b9 Fix to recognize a kernel thread that has user space virtual memory
attached to it.  While kernel threads typically do not have an
mm_struct referencing a user-space virtual address space, they can
either temporarily reference one for a user-space copy operation, or
in the case of KVM "vhost" kernel threads, keep a reference to the
user space of the "quem-kvm" task that created them.  Without the
patch, they will be mistaken for user tasks; the "bt" command will
display an invalid kernel-entry exception frame that indicates
"[exception RIP: unknown or invalid address]", the "ps" command
will not enclose the command name with brackets, and the "ps -[uk]"
and "foreach [user|kernel]" options will show the kernel thread as
a user task.
(anderson@redhat.com)
2016-06-28 14:08:32 -04:00
Dave Anderson
db55297531 Introduction of a new "bt -v" option that checks the kernel stack of
all tasks for evidence of stack overflows.  It does so by verifying
the thread_info.task address, ensuring the thread_info.cpu value is
a valid cpu number, and checking the end of the stack for the
STACK_END_MAGIC value.
(anderson@redhat.com)
2016-06-22 15:28:11 -04:00
Dave Anderson
e47e2277f1 Enhancement of the error message generated by the "tree -t radix"
option when a duplicate entry is encountered.  Without the patch,
the error message shows the address of the radix_tree_node that
contains the duplicate entry, for example, "tree: duplicate tree
entry: <radix_tree_node>".  It has been changed to also display
the radix_tree_node.slots[] array index and the duplicate entry
value, for example, "tree: duplicate tree entry: radix_tree_node:
<radix_tree_node> slots[<index>]: <entry>".
(anderson@redhat.com)
2016-06-21 15:23:57 -04:00
Dave Anderson
ac080651b6 Fix for the introduction of ARM64 support for 64K pages with 3-level
page tables in crash-7.1.5, which fails to translate user space
virtual addresses.  Without the patch, "vtop <user-space address>"
fails to translate all user-space addresses, and any command that
needs to either translate or read user-space memory, such as "vm -p",
"ps -a", and "rd -u" will fail.
(anderson@redhat.com)
2016-06-17 11:29:39 -04:00
Dave Anderson
d1db3ff758 Improvement of the ARM64 "bt -f" display such that in most cases,
each stack frame level delimiter will be set to the stack address
location containing the old FP and old LR pair.
(takahiro.akashi@linaro.org)
2016-06-15 16:00:20 -04:00
Dave Anderson
cad8f4cddc Linux 3.15 and later kernels configured with CONFIG_RANDOMIZE_BASE
could be identified because of the "randomize_modules" kernel symbol,
and if it existed, the "--kaslr=<offset>" and/or "--kaslr=auto"
options were unnecessary.  Since the "randomize_modules" symbol was
removed in Linux 4.1, this patch has replaced the KASLR identifier
with the "module_load_offset" symbol, which was also introduced in
Linux 3.15, but still remains.
(anderson@redhat.com)
2016-06-15 11:40:07 -04:00
Dave Anderson
7c90b71940 Implemented support for the redesigned ARM64 kernel virtual memory
layout and associated KASLR support that was introduced in Linux 4.6.
The kernel text and static data has been moved from unity-mapped
memory into the vmalloc region, and its start address can be
randomized if CONFIG_RANDOMIZE_BASE is configured.  Related support
is being put into the kernel's kdump code, the kexec-tools package,
and makedumpfile(8); with that in place, the analysis of Linux 4.6
ARM64 dumpfiles with or without KASLR enabled should work normally
by entering "crash vmlinux vmcore".  On live systems, Linux 4.6 ARM64
kernels will only work automatically if CONFIG_RANDOMIZE_BASE is not
configured.  Unfortunately, if CONFIG_RANDOMIZE_BASE is configured
on a live system, two --machdep command line arguments are required,
at least for the time being.  The arguments are:

  --machdep phys_offset=<base physical address>
  --machdep kimage_voffset=<kernel kimage_voffset value>

Without the patch, any attempt to analyze a Linux 4.6 ARM64 kernel
fails during initialization with a stream of "read error" messages
followed by "crash: vmlinux and vmcore do not match!".
(takahiro.akashi@linaro.org)
2016-06-14 16:18:18 -04:00
Dave Anderson
be11f09182 Introduction of ARM64 support for 4K pages with 4-level page tables
and 48 VA bits.
(takahiro.akashi@linaro.org)
2016-06-07 15:41:42 -04:00
Dave Anderson
14b3eadfd8 Fix for the ARM64 "bt" command in Linux 4.5 and later kernels which
are not configured with CONFIG_FUNCTION_GRAPH_TRACER.  Without the
patch, backtraces that originate from a per-cpu IRQ stack will dump
an invalid exception frame before transitioning to the process stack.
(anderson@redhat.com)
2016-06-07 14:58:24 -04:00
Dave Anderson
2d53b97a47 Fix for the ARM64 "bt" command in Linux 4.5 and later kernels which
use per-cpu IRQ stacks.  Without the patch, if an active non-crashing
task was running in user space when it received the shutdown IPI from
the crashing task, the "-- <IRQ stack> ---" transition marker from
the IRQ stack to the process stack is not displayed, and a message
indicating "bt: WARNING: arm64_unwind_frame: on IRQ stack: oriq_sp:
<address> fp: 0 (?)" gets displayed.
(anderson@redhat.com)
2016-06-07 11:44:05 -04:00
Dave Anderson
bced530fcf Fix for an ARM64 crash-7.1.5 "bt" regression for a task that has
called panic().  Without the patch, the backtrace may fail with a
message such as "bt: WARNING: corrupt prstatus? pstate=0x20000000,
but no user frame found" followed by "bt: WARNING: cannot determine
starting stack frame for task &lt;address>".  The pstate register
warning will still be displayed (as it is essentially a kdump bug),
but the backtrace will proceed normally.
(anderson@redhat.com)
2016-05-26 10:30:12 -04:00
Dave Anderson
8ceb1ac628 Fix for Linux commit 0139aa7b7fa12ceef095d99dc36606a5b10ab83a, which
renamed the page._count member to page._refcount.  Without the patch,
certain "kmem" commands fail with the "kmem: invalid structure member
offset: page_count".
(anderson@redhat.com)
2016-05-23 11:23:01 -04:00
Dave Anderson
7136bf8495 Fix for Linux commit edf14cdbf9a0e5ab52698ca66d07a76ade0d5c46, which
has appended a NULL entry as the final member of the pageflag_names[]
array.  Without the patch, a message that indicates "crash: failed to
read pageflag_names entry" is displayed during session initialization
in Linux 4.6 kernels.
(andrej.skvortzov@gmail.com)
2016-05-19 14:01:19 -04:00
Dave Anderson
8cb8e85de6 Recognize and parse the new QEMU_VM_CONFIGURATION and QEMU_VM_FOOTER
sections used for live migration of KVM guests, which are seen in
the "kvmdump" format generated if "virsh dump" is used without the
"--memory-only" option.
(pagupta@redhat.com)
2016-05-16 11:13:54 -04:00
Dave Anderson
5649088bcc Fix for a "[-Werror=misleading-indentation]" compiler warning that
is generated by gdb-7.6/bfd/elf64-s390.c when building S390X in a
Fedora Rawhide environment with gcc-6.0.0.
(anderson@redhat.com)
2016-05-05 09:01:35 -04:00
Dave Anderson
67a815b874 Added support for x86_64 ramdump files. Without the patch, the crash
session fails immediately with the message "ramdump: unsupported
machine type: X86_64".
(anderson@redhat.com)
2016-05-04 14:34:53 -04:00
Dave Anderson
7eb61b3e7b Fix for the support of ELF vmcores created by the KVM "virsh dump
--memory-only" facility if the guest kernel was not configured with
CONFIG_KEXEC, or CONFIG_KEXEC_CORE in Linux 4.3 and later kernels.
Without the patch, the crash session fails during initialization with
the message "crash: cannot resolve kexec_crash_image".
(hirofumi@mail.parknet.co.jp)
2016-05-04 14:24:46 -04:00
Dave Anderson
89ed9d0a7f Introduction of support for "live" ramdump files, such as those that
are specified by the QEMU mem-path argument of a memory-backend-file
object.  This allows the running of a live crash session against a
QEMU guest from the host machine.  In this example, the /tmp/MEM file
on a QEMU host represents the guest's physical memory:

  $ qemu-kvm ...other-options... \
  -object memory-backend-file,id=MEM,size=128m,mem-path=/tmp/MEM,share=on \
  -numa node,memdev=MEM -m 128

and a live session run can be run against the guest kernel like so:

  $ crash <path-to-guest-vmlinux> live:/tmp/MEM@0

By prepending the ramdump image name with "live:", the crash session will
act as if it were running a normal live session.
(oleg@redhat.com)
2016-05-04 11:50:19 -04:00
Dave Anderson
a6c585b1ea Mark start of 7.1.6 development with version 7.1.5++ 2016-05-04 11:46:52 -04:00
Dave Anderson
c89b9de0eb crash-7.1.4 -> crash-7.1.5 2016-04-27 15:34:21 -04:00
Dave Anderson
956e309ff1 Account for the Linux 3.17 increase of the ARM64 MAX_PHYSMEM_BITS
definition from 40 to 48.
(Johan.Erlandsson.sonymobile.com)
2016-04-27 10:03:19 -04:00
Dave Anderson
fd2f8ef41e Introduction of support for the 64-bit SPARC V9 architecture. This
version supports running against a live kernel.  Compressed kdump
support is also here, but the crash dump support for the kernel,
kexec-tools, and makedumpfile is still pending.  Initial work was
done by Karl Volz with help from Bob Picco.
(dave.kleikamp@oracle.com)
2016-04-26 14:45:59 -04:00
Dave Anderson
569002249b When reading a task's task_struct.flags field, check for its size,
which was changed from an unsigned long to an unsigned int.
(dave.kleikamp@oracle.com)
2016-04-25 16:06:52 -04:00
Dave Anderson
aad859ec10 Fix for the x86_64 "vm -p" command to properly emulate the kernel's
pte_present() function, which checks for either _PAGE_PRESENT or
_PAGE_PROTNONE to be set.  Without the patch, user pages whose PTE
does not have _PAGE_PRESENT bit set are misconstrued as SWAP pages
with an "(unknown swap location") along with a bogus OFFSET value.
(anderson@redhat.com)
2016-04-25 15:02:25 -04:00
Dave Anderson
1230512818 Fix for the "vm -p" and "vtop <user virtual address>" commands if
a user page is swapped out.  Without the patch, the "/dev" component
of the swap file pathname may be missing from its display.
(anderson@redhat.com)
2016-04-22 17:04:33 -04:00
Dave Anderson
ab91852f94 Introduction of ARM64 support for 64K pages with 3-level page tables
and 48 VA bits.  Until now, support has only existed for 64K pages
with 2-level page tables, and 4K pages with 3-level page tables.
(jim.hull@hpe.com)
2016-04-22 14:51:37 -04:00
Dave Anderson
3064aad387 Fix for the "vm -p" option on kernels that are not configured with
CONFIG_SWAP.  Without the patch, the command may fail prematurely
with the message "nr_swapfiles doesn't exist in this kernel".
(rabinv@axis.com)
2016-04-22 09:42:56 -04:00
Dave Anderson
7f324a4144 Fix for "kmem -[sS]" options for kernels configured with CONFIG_SLUB.
Without the patch, if a freelist pointer is corrupt, the address of
the slab page being referenced may not be displayed by the error
message, showing something like: "kmem: kmalloc-32: slab: 0 invalid
freepointer: 6e652f323a302d74".
(hirofumi@mail.parknet.co.jp)
2016-04-21 11:26:19 -04:00
Dave Anderson
f6918567d7 Fix for "kmem -[sS]" options for kernels configured with CONFIG_SLUB.
Without the patch, the count displayed in the ALLOCATED column may
be too large, and the "kmem -S" display of allocated/free status of
individual objects may be incorrect.
(hirofumi@mail.parknet.co.jp)
2016-04-21 11:09:27 -04:00
Dave Anderson
dc20e27e0b Include sys/macros.h explicitly in filesys.c for the definitions
of major(), minor() and makedev().  These functions are defined
in the sys/sysmacros.h header, not sys/types.h.  Linux C libraries
are updating to drop the implicit include, so we need to include
it explicitly.
(vapier@gentoo.org)
2016-04-21 09:51:04 -04:00
Dave Anderson
61dfedefcf Apply a fuzz factor of zero to the re-application of a modified
version of the gdb-7.6.patch in a pre-existing build directory.
Without the patch, it is possible that a previously-applied patch
could be applied a second time without the fuzz restriction.
(anderson@redhat.com)
2016-04-21 09:44:54 -04:00
Dave Anderson
7b5be97daa Introduction of the "whatis -r" and "whatis -m" options. The -r
option searches for data structures of a specified size or within a
range of specified sizes.  The -m option searches for data structures
that contain a member of a given type.  If a structure contains
another structure, the members of the embedded structure will also
be subject to the search.  The type string may be a substring of the
data type name.  The output displays the size and name of the data
structure.
(Alexandr_Terekhov@epam.com, anderson@redhat.com)
2016-04-15 16:13:28 -04:00
Dave Anderson
1269b13567 Fixes to address two gcc-4.1.2 compiler warnings introduced by the
previous patch:
  memory.c: In function ‘count_cpu_partial’:
  memory.c:17958: warning: comparison is always false due to limited
                  range of data type
  memory.c: In function ‘count_partial’:
  memory.c:18729: warning: comparison is always false due to limited
                  range of data type
(anderson@redhat.com)
2016-04-13 12:06:13 -04:00
Dave Anderson
76a71fed90 Improvement of the accuracy of the allocated objects count for each
kmem_cache shown by "kmem -s" in kernels configured with CONFIG_SLUB.
Without the patch, the values under the ALLOCATED column may be too
large because cached per-cpu objects are counted as allocated.
(vinayakm.list@gmail.com)
2016-04-12 16:51:50 -04:00
Dave Anderson
c1eb2b99e2 Fix for the "irq -s" option for Linux 4.2 and later kernels. Without
the patch, the irq_chip.name string (e.g. "IO-APIC", "PCI-MSI", etc.)
is missing from the display.
(rabin.vincent@axis.com)
2016-04-08 12:00:55 -04:00
Dave Anderson
0c47739aee Fix for the "dis <function | address>" option if the function or
address is the highest text symbol value in a kernel module.  Without
the patch, the disassembly may continue past the end of the function,
or may show nothing at all.  The patch utilizes in-kernel kallsyms
symbol size information instead of disassembling until reaching the
address of the next symbol in the module.
(anderson@redhat.com)
2016-03-31 16:58:55 -04:00
Dave Anderson
04ab5c560a Put 2016 copyright in initial banner. 2016-03-01 16:16:48 -05:00
Dave Anderson
098cdab16d Fix for the changes made to the kernel module structure introduced by
this kernel commit for Linux 4.5 and later kernels:

  commit 8244062ef1e54502ef55f54cced659913f244c3e
  modules: fix longstanding /proc/kallsyms vs module insertion race.

Without the patch, the crash session fails during initialization
with the error message: "crash: invalid structure member offset:
module_num_symtab".
(anderson@redhat.com)
2016-02-12 14:32:53 -05:00
Dave Anderson
0fd7502221 Further fix for the replacements made to the kernel's cpu_online_mask,
cpu_possible_mask, cpu_present_mask and cpu_active_mask symbols in
the kernel commit for Linux 4.5 and later kernels for when the
crash session is brought up with "crash -d<debug-level>".  Without
the patch, the cpus found in each mask are displayed like this
example:

             cpu_possible_(null): cpus: 0 1 2 3 4 5 6 7
              cpu_present_(null): cpus: 0 1
               cpu_online_(null): cpus: 0 1
               cpu_active_(null): cpus: 0 1

The "(null)" string segments above should read "mask".
(anderson@redhat.com)
2016-02-12 11:22:06 -05:00
Dave Anderson
7a0d2c9e12 Fixes for "[-Werror=misleading-indentation]" compiler warnings that
are generated by the following files, when building X86_64 in a
Fedora Rawhide environment with gcc-6.0.0:

  gdb-7.6/gdb/ada-lang.c
  gdb-7.6/gdb/linux-record.c
  gdb-7.6/gdb/inflow.c
  gdb-7.6/gdb/printcmd.c
  gdb-7.6/gdb/c-typeprint.c

Without the patch, warnings in the gdb-7.6/gdb directory are not
treated as errors, and are non-fatal to the build.
(anderson@redhat.com)
2016-02-10 15:50:49 -05:00
Dave Anderson
0eadd7fc84 Implement support for per-cpu IRQ stacks on the ARM64 architecture,
which were introduced in Linux 4.5 by this commit:

  commit 132cd887b5c54758d04bf25c52fa48f45e843a30
  arm64: Modify stack trace and dump for use with irq_stack

Without the patch, if an active task was operating on its per-cpu
IRQ stack on dumpfiles generated by kdump, its backtrace would start
at the exception frame that was laid down on the process stack.
This patch also adds support for "bt -E" to search IRQ stacks for
exception frames, and the "mach" command displays the addresses
of each per-cpu IRQ stack.
(anderson@redhat.com)
2016-02-10 11:59:09 -05:00
Dave Anderson
1e770f68b0 Configure the embedded gdb module with "--disable-sim" in order to
bypass the unnecessary build of the libsim.a library.
(anderson@redhat.com)
2016-02-03 11:21:25 -05:00