Commit Graph

443 Commits

Author SHA1 Message Date
Dave Anderson
8df224099b Fix for a "[-Werror=shift-negative-value]" compiler warning that is
generated by "gdb-7.6/opcodes/arm-dis.c" when building crash with
"make target=ARM64" on an x86_64 host with gcc-6.0.0.  Without the
patch, the warning is treated as an error and the build is aborted.
(anderson@redhat.com)
2016-02-02 10:49:06 -05:00
Dave Anderson
835c360273 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/bfd/coff-i386.c
  gdb-7.6/bfd/coff-x86_64.c
  kernel.c
  x86_64.c
  lkcd_common.c

Without the patch, the warnings in the bfd library files are treated
as errors, and abort the build.  The three instances in the top-level
crash source code directory are non-fatal.  There are several other
gdb-specific instances that are non-fatal and are not addressed.
(anderson@redhat.com)
2016-02-02 10:15:11 -05:00
Dave Anderson
1e92f9fad3 Fix for the replacements made to the kernel's cpu_possible_mask,
cpu_online_mask, cpu_present_mask and cpu_active_mask symbols in
this kernel commit for Linux 4.5 and later kernels:

  commit 5aec01b834fd6f8ca49d1aeede665b950d0c148e
  kernel/cpu.c: eliminate cpu_*_mask

Without the patch, behavior is architecture-specific, dependent upon
whether the cpu mask values are used to calculate the number of cpus.
For example, ARM64 crash sessions fail during session initialization
with the error message "crash: zero-size memory allocation! (called
from <address>)", whereas X86_64 sessions come up normally, but
cpu mask values of zero are stored internally.
(anderson@redhat.com)
2016-02-01 16:10:49 -05:00
Dave Anderson
c341345659 The crash utility has not supported Xen dom0 and domU dumpfiles since
since this Linux 3.19 commit:

  commit 054954eb051f35e74b75a566a96fe756015352c8
  xen: switch to linear virtual mapped sparse p2m list

This patch resurrects support for dom0 dumpfiles only.  Without the
patch, the crash session fails during session initialization with the
message "crash: cannot resolve p2m_top".
(daniel.kiper@oracle.com)
2016-01-26 10:18:09 -05:00
Dave Anderson
6f1f78e334 Fix for the changes made to the kernel module structure introduced by
this kernel commit for Linux 4.5 and later kernels:

  commit 7523e4dc5057e157212b4741abd6256e03404cf1
  module: use a structure to encapsulate layout.

Without the patch, the crash session fails during initialization
with the error message: "crash: invalid structure member offset:
module_init_text_size".
(sebott@linux.vnet.ibm.com)
2016-01-20 09:56:36 -05:00
Dave Anderson
63f7707d2b Fix for the "ps -t" option in 3.17 and later kernels that contain
commit ccbf62d8a284cf181ac28c8e8407dd077d90dd4b, which changed the
task_struct.start_time member from a struct timespec to a u64.
Without the patch, the "RUN TIME" value is nonsensical.
(anderson@redhat.com)
2016-01-11 15:53:44 -05:00
Dave Anderson
4641ea1f61 Fix for the "bt" command to properly pull the stack and frame pointer
registers from the NT_PRSTATUS notes of 32-bit tasks running in
user-mode on ARM64.  Without the patch, the "bt" command utilizes
ptregs->sp and ptregs->regs[29] for 32-bit tasks instead of the
architecturally-mapped ptregs->regs[13] and ptregs->regs[11], which
yields unpredictable/invalid results, and possibly a segmentation
violation.
(drjones@redhat.com)
2016-01-05 15:56:34 -05:00
Dave Anderson
e2a2ed3406 Make the "zero excluded" mode default behavior when analyzing SADUMP
dumpfiles because some Fujitsu troubleshooting software assumes the
behavior.  Also, fix the "set -v" option to show the "zero_excluded"
internal variable as "on" if it has been set when analyzing SADUMP
dumpfiles.
(d.hatayama@jp.fujitsu.com)
2016-01-04 12:04:19 -05:00
Dave Anderson
2e29d684a4 Fix for the translation of X86_64 virtual addresses in the vsyscall
region between 0xffffffffff600000 and 0xffffffffffe00000.  Without
the patch, the reading of addresses in that region returns invalid
data; in addition, the "vtop" command for an address in that region
shows an invalid physical address under the "PHYSICAL" column.
(nakajima.akira@nttcom.co.jp, anderson@redhat.com)
2016-01-04 11:40:48 -05:00
Dave Anderson
c0af94a29d Fix for the handling of Xen DomU ELF dumpfiles to prevent the
pre-gathering of p2m frames during session initialization, which
is unnecessary since ELF files contain the mapping information in
their ".xen_p2m" section.  Without the patch, it is possible that the
crash session may be unnecessarily aborted if the p2m frame-gathering
fails, for example, if the CR3 value in the header is invalid.
(ptesarik@suse.com)
2015-12-18 15:02:28 -05:00
Dave Anderson
fd6c2a8c5a crash-7.1.3 -> crash-7.1.4 2015-12-16 11:05:23 -05:00
Dave Anderson
2515ef355f Fix for "crash --osrelease" on Xen kernels that have both VMCOREINFO
and VMCOREINFO_XEN ELF notes.  Without the patch, the command returns
"(unknown)".
(anderson@redhat.com, dietmar.hahn@ts.fujitsu.com)
2015-12-14 09:13:49 -05:00
Dave Anderson
9ba68adb0c Introduction of the "sys -i" option, which displays the kernel's DMI
identification string data if available.
(atomlin@redhat.com, anderson@redhat.com)
2015-12-09 09:25:14 -05:00
Dave Anderson
889f4f665e Added "print_array" as a new internal variable that may be turned
on/off with the "set" command.  When set to "on", gdb's printing of
arrays will be set to "pretty", so that the display of each array
element will consume one line.
(anderson@redhat.com)
2015-12-08 15:46:51 -05:00
Dave Anderson
fa07b6ca33 Enhanced the debug-only display of the first kernel data items read
during session initialization.  This includes the system's cpu maps,
xtime, and utsname data.  These require at least "-d1" as a command
line option value, and are primarily useful as an aide for debugging
suspect dumpfiles that fail during session initialization.
(anderson@redhat.com)
2015-12-03 16:05:34 -05:00
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