Commit Graph

478 Commits

Author SHA1 Message Date
Dave Anderson
58feffd9fd Added a new "list -l <offset>" option that can only be used in
conjunction with "-s", and requires that the "start" address is the
address of a list_head, or other similar list linkage structure whose
first member points to the next linkage structure.  The "-l <offset>"
argument is the offset of the embedded list linkage structure in the
specified "-s" data structure; it can be either a number of bytes or
expressed in "struct.member" format.
(anderson@redhat.com)
2015-12-02 15:13:45 -05:00
Dave Anderson
9ef911789a Fix for 32-bit ARM kernels that are configured with CONFIG_SLAB
and contain percpu array_cache structures that were allocated with
vmalloc().  Without the patch, during session initialization there
will be error messages of the form: "crash: kmem_cache: <vaddr>:
invalid array_cache pointer: <vaddr>", and during runtime, the
"kmem -[sS]" commands will show kmem_cache lines that marked as
"[INVALID/CORRUPTED]".
(anderson@redhat.com)
2015-12-02 11:24:32 -05:00
Dave Anderson
c4887936fa Introduced a general-purpose handler to register data structures that
the kernel has dynamically downsized from the size indicated by the
debuginfo data.  At this time, only "kmem_cache" and "task_struct"
structures that have been downsized are registered, but others may be
added in the future.  If a downsized data structure is passed to gdb
for display, gdb will request a read of the "full" data structure,
which may flow into a memory region that was either filtered by
makedumpfile(8), or perhaps into non-existent memory, thereby killing
the generating command immediately due to a partial read.  With this
patch, commands such as "struct" and "task" that reference downsized
data structures will have their reads flagged to return successfully
if partial read error occurs.
(anderson@redhat.com)
2015-11-30 15:55:26 -05:00
Dave Anderson
34ca7f4e35 Map CTRL-l to clear the screen while in vi insertion mode. Without
the patch, it displays "^L".
(kwalker@redhat.com)
2015-11-28 11:23:34 -05:00
Dave Anderson
5812f08da5 The s390 stand-alone dump tools may write the kernel memory directly
to a block device.  When running the crash utility against such a
block device, a misleading warning message such as this is displayed:

  WARNING: /dev/sda1: may be truncated or incomplete
  PT_LOAD p_offset: 16384
  p_filesz: 5497558138880
  bytes required: 5497558155264
  dumpfile size: 0

With the patch, the warning message above will be replaced by a note
using this format:

  NOTE: /dev/sda1: No dump complete check for block devices

(holzheu@linux.vnet.ibm.com)
2015-11-25 15:33:26 -05:00
Dave Anderson
d963c2c152 Update to the previous QEMU-specific patch to handle kdump dumpfiles
which have offline cpus, and therefore will not contain associated
NT_PRSTATUS notes in the dumpfile header.  Without the patch, if
there are any offline cpus, a segmentation violation is generated
during session initialization.
(anderson@redhat.com)
2015-11-23 14:24:56 -05:00
Dave Anderson
b2d8f20407 Fix for the handling of ARM and ARM64 QEMU-generated ELF dumpfiles
and compressed kdump clones.  The patch utilizes the NT_PRSTATUS
notes in the dumpfile headers instead of reading them from the
kernel's "crash_notes", which are not initialized when QEMU generates
a dumpfile.  Without the patch, these warning messages are displayed
during session initialization:

  WARNING: invalid note (n_type != NT_PRSTATUS)
  WARNING: cannot retrieve registers for active tasks

and running "bt" on an active task causes a segmentation violation.
(drjones@redhat.com)
2015-11-23 13:59:18 -05:00
Dave Anderson
2d8895c36a Update for the determination of the ARM64 page size for kernels
containing this Linux 4.4 commit:

  commit 9d372c9fab34cd8803141871195141995f85c7f7
  arm64: Add page size to the kernel image header

Without the patch, the kernel page size is calculated by looking
at the size of the "swapper_pg_dir" page directory.  With this
update, the page size can be determined by checking a flag built
into the kernel image header, available in the "_kernel_flags_le"
absolute symbol.
(drjones@redhat.com)
2015-11-20 12:05:58 -05:00
Dave Anderson
34842b66a1 Fix for a segmentation violation when attempting to run live on a
a system without the crash.ko memory driver, and whose kernel was
configured with CONFIG_STRICT_DEVMEM.  Without the patch, if any
-d<value> is entered on the command line, the crash session fails
during initialization.
(dmair@suse.com)
2015-11-20 11:28:47 -05:00
Dave Anderson
d83b0f76aa Fix for the "kmem -s <address>" command in Linux 3.13 and later
kernels configured with CONFIG_SLAB.  Without the patch, if the
address argument is contained within an object in a tail page of a
multi-page slab, the command fails with the message "kmem: address
is not allocated in slab subsystem: <address>".  Furthermore, in
Linux 4.4 and later kernels configured with CONFIG_SLAB, addresses
that are contained within an object in a tail page of a multi-page
slab will not be marked by their slab cache name by the "rd -S" and
"bt -F" commands.
(anderson@redhat.com)
2015-11-18 16:21:26 -05:00
Dave Anderson
80b49a879e Fix for the handling of dynamically-sized task_struct structures in
Linux 4.2 and later kernels, which contain these commits:

  commit 5aaeb5c01c5b6c0be7b7aadbf3ace9f3a4458c3d
  x86/fpu, sched: Introduce CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT and
                  use it on x86
  commit 0c8c0f03e3a292e031596484275c14cf39c0ab7a
  x86/fpu, sched: Dynamically allocate 'struct fpu'

Without the patch, when running on a filtered kdump dumpfile, it is
possible that error messages like this will be seen when gathering
the tasks running on a system: "crash: page excluded: kernel virtual
address: <task_struct address>  type: "fill_task_struct".
(ats-kumagai@wm.jp.nec.com)
2015-11-17 13:26:56 -05:00
Dave Anderson
3ae38386bc Fix for the handling of compound pages in Linux 4.4 and later kernels,
which contain this kernel commit:

  commit 1d798ca3f16437c71ff63e36597ff07f9c12e4d6
  mm: make compound_head() robust

The commit above removes the PG_tail and PG_compound page.flags bits
and the page.first_page member, and introduces a page.compound_head
member, which is a pointer to the head page and whose bit 0 acts as
the tail flag.  Without the patch, a SLAB or SLUB warning message
that indicates "cannot determine how compound pages are linked" is
displayed during initialization, and any command that tracks compound
pages will be affected.
(anderson@redhat.com)
2015-11-09 16:27:50 -05:00
Dave Anderson
7ce8469f8b Added recognition of the new DUMP_DH_EXCLUDED_VMEMMAP flag in the
header of compressed kdumps, which is set by the new -e option to
the makedumpfile(8) facility.  The -e option excludes kernel pages
that contain nothing but kernel page structures for pages that are
not being included in the dump.  If the bit is set in the dumpfile,
the crash utility will issue a warning that the dumpfile is known to
be incomplete during initialization, just prior to the system banner
display.
(anderson@redhat.com)
2015-10-29 14:43:45 -04:00
Dave Anderson
3ed7a4e788 Fix for the "kmem -i" command in Linux 2.6.27 and later kernels to
prevent the possibility that an arbitrary address may be accessed
when calculating the number of total huge pages.  Without the patch,
the command's "COMMIT LIMIT" and "COMMITTED" values may be invalid.
(atomlin@redhat.com)
2015-10-29 11:26:00 -04:00
Dave Anderson
5e887f898c Fix for the behavior of the --zero_excluded option when used with
SADUMP dumpfiles.  Without the patch, the behavior of --zero_excluded
option is the opposite to what is expected: reads of filtered pages
return successfully with zero-filled memory, while reads of filtered
filtered pages fail when --zero_excluded option has been specified.
(d.hatayama@jp.fujitsu.com)
2015-10-20 11:54:59 -04:00
Dave Anderson
ebca719c19 Fix for bitmap-handling in SADUMP dumpfiles, which associate each bit
in a bitmap with a physical page in the reverse order that is used
in kdump-compressed format.  The bug had not been detected for a long
time because bitmaps in SADUMP formats consist mostly of 0x00 and
0xff excluding a very limited amount of memory space for firmware.
(indou.takao@jp.fujitsu.com, d.hatayama@jp.fujitsu.com)
2015-10-20 11:48:05 -04:00
Dave Anderson
7d310950a6 Display a machine-type mismatch warning if a little-endian PPC64
compressed kdump created by makedumpfile(8) is used as an argument
with a non-PPC64 crash utility binary.  Without the patch, the
dumpfile is accepted, and the session subsequently fails with a
message indicating that that the vmlinux and dumpfile do not match.
(anderson@redhat.com)
2015-10-06 09:44:46 -04:00
Dave Anderson
4602d53a0e Since Linux v4.1, specifically, "MIPS: Rearrange PTE bits into fixed
positions.", commit be0c37c985eddc46d0d67543898c086f60460e2e, the
MIPS PTE bits are at fixed locations.  Since they are macros in the
kernel, this patch adds an explicit kernel version check in order to
determine and set their values.
(rabinv@axis.com)
2015-10-01 16:00:26 -04:00
Dave Anderson
9531d0f551 For many years, Xen Dom0 dumps could only be saved in ELF format.
Since makedumpfile commit 349a0ed1, it is now possible to save Xen
dumps in compressed kdump format.  This patch set adds support for
these files.  Two new files, xen_dom0.c and xen_dom0.h, have been
added to provide the common functionality required by both ELF and
compressed kdump formats.
(ptesarik@suse.cz)
2015-09-25 09:14:57 -04:00
Dave Anderson
c667f595db Fix for the extensions/trace.c extension module for Linux 4.2 and
later kernels.  Without the patch, the module fails to load, with
the message "failed to init the offset, struct:ftrace_event_call,
member:list".
(anderson@redhat.com)
2015-09-24 11:41:37 -04:00
Dave Anderson
e980093166 Fix for the "dis" command to support three new x86 instruction
extensions that have been added to the Intel instruction set for
hardware platforms that support them.  The newly-added instructions
"clflushopt", "clwb", and "pcommit" prepend 0x66 as a prefix byte to
the "clflush", "xsaveopt" and "sfence" instructions respectively.
Without the patch:

  "clflushopt" is disassembled as: "data16" followed by "clflush"
  "clwb" is disassembled as: "data16" followed by "xsaveopt"
  "pcommit" is disassembled as: "data16" followed by "sfence"

The "clflushopt" instruction was introduced in Linux 3.15 in the
clflushopt() function.  The "clwb" and "pcommit" instructions were
introduced in Linux 4.1 in the clwb() and pcommit_sfence() functions.
(anderson@redhat.com)
2015-09-21 16:56:32 -04:00
Dave Anderson
b285e59cd5 Fix for the X86_64 "bt" command in Linux 4.2 and later kernels
that are configured with both CONFIG_HAVE_COPY_THREAD_TLS and
CONFIG_FRAME_POINTER.  Without the patch, the fact that the kernel
was compiled with framepointers is not recognized, which may result
in backtraces containing stale frame references.
(anderson@redhat.com)
2015-09-11 13:47:52 -04:00
Dave Anderson
0901bd1753 Fix for the ARM64 "vtop" command when translating kernel virtual
addresses within a 2MB or 512MB huge page in which the PGD or PMD
contains software-defined PTE bits.  Without the patch, the "PAGE:"
address value will show the software-defined bits, the command will
not display the related page structure translation, and will end with
the message "WARNING: sparsemem: invalid section number: <number>".
(Johan.Erlandsson@sonymobile.com, anderson@redhat.com)
2015-09-08 13:32:03 -04:00
Dave Anderson
d9931d53b6 crash-7.1.2 -> crash-7.1.3 2015-09-03 11:13:59 -04:00
Dave Anderson
9254c7f206 Added a new "--src <directory>" command line option for use by the
"dis -s" option if the kernel source code is not located in the
standard location that is compiled into the kernel's debuginfo data.
The directory argument should point to the top-level directory of the
kernel source tree.
(anderson@redhat.com)
2015-09-01 16:23:24 -04:00
Dave Anderson
b80d7120c1 Implemented a new "dis -s" option, which displays the filename and
line number that is associated with a specified text location,
followed by a source code listing if it is available on the host
machine. The line associated with the text location will be marked
with an asterisk; depending upon gdb's internal "listsize" variable,
several lines will precede the marked location. If a "count" argument
is entered, it specifies the number of source code lines to be
displayed after the marked location; otherwise the remaining source
code of the containing function will be displayed.
(anderson@redhat.com)
2015-09-01 16:18:36 -04:00
Dave Anderson
c4bb18f5fc Fix for the "timer" command on Linux 4.2 and later kernels, which
contain this kernel commit that modifies the tvec_root and tvec
data structures:

  commit bc7a34b8b9ebfb0f4b8a35a72a0b134fd6c5ef50
  timer: Use hlist for the timer wheel hash buckets

Without the patch, the "timer" command will spew messages indicating
"timer: invalid list entry: 0", followed by "timer: ignoring faulty
timer list at index <number> of timer array".
(anderson@redhat.com)
2015-08-25 16:14:27 -04:00
Dave Anderson
4744ba766d If the method of determining how compound pages are linked cannot be
accomplished due to page struct related changes in upstream kernels,
issue a WARNING message during session initialization.
(anderson@redhat.com)
2015-08-19 14:22:32 -04:00
Dave Anderson
b3c6380340 Reduce the unnecessary error messages if a directory is used as a
command line argument.  Without the patch, six error messages are
displayed:

  crash: unable to read dump file /tmp
  /tmp: ELF header read: Is a directory
  /tmp: ELF header read: Is a directory
  crash: /tmp: read: Is a directory
  read_maps: unable to read header from /tmp, errno = 1
  crash: vmw: Failed to read '/tmp': [Error 21] Is a directory

With the patch applied, the functions that generate those messages
are not called; only the standard "not a supported file format",
and "Usage" messages will be displayed.
(anderson@redhat.com)
2015-08-18 16:37:16 -04:00
Dave Anderson
2152a1fdea Minor cleanup and error handling fix-up for the "dis" command.
Without the patch, if the target address of "dis -r" or "dis -f"
is not an exact address of an instruction, "dis -r" will continue
beyond the target address, and "dis -f" will show nothing.
(anderson@redhat.com)
2015-08-14 11:14:06 -04:00
Dave Anderson
2e3d3f20d3 Fix for the "dis" command on architectures with variable-length
instructions.  Without the patch, "dis [-f] <function>" may continue
beyond the end of a function, disassembling the memory that is in
between the target function and the next function.
(anderson@redhat.com)
2015-08-14 10:19:56 -04:00
Dave Anderson
cc5244d86b Fix for the S390X "dis" command to prevent jump target addresses
from being displayed as kernel system call alias/wrapper names, for
example, "SyS_read+<offset>" instead of "sys_read+<offset>".
(anderson@redhat.com)
2015-08-14 09:17:30 -04:00
Dave Anderson
48add7d9b6 Fix for the PPC64 "dis" command to prevent conditional branch
target addresses from being displayed as kernel system call
alias/wrapper names, for example, "SyS_read+<offset>" instead
of "sys_read+<offset>".
(anderson@redhat.com)
2015-08-13 16:38:14 -04:00
Dave Anderson
0807455490 Fix for the ARM64 "dis" command to prevent branch target addresses
from being displayed as kernel system call alias/wrapper names, for
example, "SyS_read+<offset>" instead of "sys_read+<offset>".
(anderson@redhat.com)
2015-08-12 16:02:16 -04:00
Dave Anderson
4935c333a6 Introduction of the "dis -f <address>" option, which disassembles
from the target address until the end of the function.
(atomlin@redhat.com)
2015-08-12 13:49:15 -04:00
Dave Anderson
3c2fc5f2a0 When searching all kernel stacks for evidence of a panic task in
"live" s390x dumpfiles created by the VMDUMP, stand-alone dump, or
"virsh dump" facilities, none of which explicitly mark the dumpfile
as a "live dump", run a standard "bt" backtrace on each kernel stack
instead of the text-address-only "bt -t".  Without the patch, an
invalid text reference may be found in a task's kernel stack due to
the common zero-based user and kernel virtual address space ranges of
the s390x, causing the task to be mistakenly set as the "PANIC" task.
(holzheu@linux.vnet.ibm.com)
2015-08-12 09:30:29 -04:00
Dave Anderson
9681db206b Second part of:
Do not search for a panic task in s390x dumpfiles that are marked
  as a "live dump"...
The first part prevented a search of the active tasks; this part
prevents the last-ditch search of all tasks.
(anderson@redhat.com)
2015-08-11 10:42:21 -04:00
Dave Anderson
67b4843394 Mark the "crash" task that generated a snapshot vmcore utilizing the
the "snap.so" extension module as "(ACTIVE)" in the STATE field of
the initial system banner and the "set" command.  Without the patch,
the task's STATE field shows it as the "(PANIC)" task.
(anderson@redhat.com)
2015-08-11 10:27:04 -04:00
Dave Anderson
a640cbb1b5 Do not search for a panic task in s390x dumpfiles that are marked as
a "live dump".  Without the patch, an exhaustive, unnecessary, search
of all kernel stacks that looks for evidence of a system crash may
find an invalid reference in a task's kernel stack due to the common
zero-based user and kernel virtual address space ranges of the s390x,
causing the task to be mistakenly set as the "PANIC" task.
(holzheu@linux.vnet.ibm.com, anderson@redhat.com)
2015-08-10 14:03:27 -04:00
Dave Anderson
8119552763 Fix for the RSS value displayed by the "ps" command in Linux 2.6.34
and later big-endian machines.  Without the patch, a task's RSS value
will be erroneously calculated by using twice its file pages instead
of adding its file pages with its anonymous pages.
(anderson@redhat.com)
2015-08-05 15:04:25 -04:00
Dave Anderson
e90f049c22 If a kdump dumpfile is marked as incomplete in its ELF or compressed
kdump header, and the user has not used the --zero_excluded command
line option, append a note to the incomplete dump WARNING message
shown during invocation that suggests the use of --zero_excluded.
(zhouwj-fnst@cn.fujitsu.com)
2015-08-04 11:50:02 -04:00
Dave Anderson
9f809b8e2c Fix for the extensions/trace.c extension module to account for
kernels that are not configured with CONFIG_TRACE_MAX_TRACER.
Without the patch, the module fails to load with the error message
"failed to init the offset, struct: trace_array, member: max_offset".
(rabinv@axis.com)
2015-08-03 14:14:23 -04:00
Dave Anderson
9c102f9948 Fix for a segmentation violation generated by the ARM64 "bt -[f|F]"
options when analyzing the active tasks in vmcores generated by the
kdump facility.  This bug is a regression that was introduced in
crash-7.1.2 by commit 15a58e4070, which
was an enhancement of the ARM64 backtrace capability for active tasks
in kdump vmcores.
(anderson@redhat.com)
2015-08-03 13:55:02 -04:00
Dave Anderson
2e3b89ed93 Fix for the "kmem -s <address>", "bt -F[F]", and "rd -S[S]"
options in kernels configured with CONFIG_SLUB.  Without the patch,
if a referenced slab object address comes from a slab cache that
utilizes a multiple-page slab, and the object is located within
a tail page of that slab cache, it will not be recognized as a slab
object.  The "bt -F[F]" and "rd -S[S]" options will just show the
object address, and the "kmem -s <address>" object will indicate
"kmem: address is not allocated in slab subsystem: <address>".
This bug is a regression that was introduced in crash-7.1.0 by commit
8b2cb365d7, which addressed a bug where
stale slab object addresses were incorrectly being recognized as
valid slab objects.
(anderson@redhat.com)
2015-07-17 10:41:32 -04:00
Dave Anderson
8eb8fcc719 Fix for the "crash --osrelease" option for flattened format dumpfiles
in the unlikely event that the dumpfile header does not contain the
VMCOREINFO note section from the original ELF /proc/vmcore.  Without
the patch, the command displays nothing instead of showing "unknown".
(anderson@redhat.com)
2015-07-14 14:56:11 -04:00
Dave Anderson
94b8342c71 crash-7.1.1 -> crash-7.1.2 2015-07-13 10:42:01 -04:00
Dave Anderson
b3be954095 If a symbol or symbol+offset argument is passed to the "dis" command,
and there are multiple text symbols with the same symbol name, then
display a message indicating that there are "duplicate text symbols
found", followed by a list of the symbols.  Without the patch, the
duplicate symbol with the lowest virtual address is used.
(atomlin@redhat.com, anderson@redhat.com)
2015-07-09 16:52:30 -04:00
Dave Anderson
21874fe737 Export the previously static symbol_name_count() function, which
returns a count of symbols with the same name.  Export a new
is_symbol_text() function, which checks whether specified symbol
entry is a type 't' or 'T'.
(atomlin@redhat.com, anderson@redhat.com)
2015-07-09 12:56:29 -04:00
Dave Anderson
a8921b155f Update the extensions/eppic.mk file to clone the eppic source code
from https://github.com/lucchouina/eppic.git.
(lucchouina@gmail.com)
2015-07-09 10:45:18 -04:00
Dave Anderson
203853b71e Fix compiler warning generated by extensions/trace.c when compiled
with gcc version 5.  Without the patch, the message "warning: the
use of 'mktemp' is dangerous, better use 'mkstemp'" is generated.
(anderson@redhat.com)
2015-07-08 09:14:18 -04:00