Commit Graph

116 Commits

Author SHA1 Message Date
Youling Tang
5664c58bd2 MIPS64: Add mips64 architecture support information
Add mips64 architecture support information to the README and help.c files.

Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Youling Tang <tangyouling@loongson.cn>
2021-04-23 10:39:37 +09:00
HATAYAMA Daisuke
7ca9a8e21d Add valgrind support for the crash's custom memory allocator
This adds valgrind support for the crash's custom memory allocator
using the way described in the following valgrind's Memcheck manual:

  https://www.valgrind.org/docs/manual/mc-manual.html#mc-manual.mempools

This helps detecting various memory errors on the crash's custom
memory allocator.

To enable this feature, build crash command as:

  # make valgrind

Then, run crash commnad using valgrind as:

  # valgrind ./crash vmlinux vmcore

Signed-off-by: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
2021-03-05 15:57:15 +09:00
John Pittman
a52f630e40 log: change log level print in older kernels
In older kernels that have the variable-length-record log_buf, the
log level and the log flags/facility are not separated.  Since the
log level is only the last three bits, and the flags/facility and
level are separated in 5.10 and later kernels, only print those last
three bits when using 'log -m'.

[ kh: modified commit message ]

Suggested-by: David Jeffery <djeffery@redhat.com>
Signed-off-by: John Pittman <jpittman@redhat.com>
2021-02-22 09:42:38 +09:00
Yunfeng Ye
33c322e929 mod: Show the base address of module
Currently the "mod" command shows the address of the module struct,
it is inconvenient to know the address range of the module, so extend
to show the base adddress.

[ kh: added help page update ]

Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
2021-01-26 10:34:50 +09:00
John Pittman
e4c1617e17 set: add ability to un-set scope
Currently there is no way to un-set the scope without having to
exit and re-enter crash.  The ability to un-set can come in very
useful when running automated pykdump scripts and needing scope to
be cleared between script runs.  Add the ability by allowing
vaddr 0 to be passed through gdb_set_crash_scope() and
gdb_command_funnel(), taking advantage of the !req->addr check in
gdb_set_crash_block(), enabling 'set scope 0' as a viable command.

Signed-off-by: John Pittman <jpittman@redhat.com>
2021-01-25 12:55:45 +09:00
Kazuhito Hagio
dad9e1eec0 Append time zone to output of date and time
Currently it's not easy to distinguish which time zone the output of
DATE uses:

  crash> sys | grep DATE
        DATE: Thu Nov 29 06:44:02 2018

Let's introduce ctime_tz() function like ctime() but explicitly appends
the time zone to its result string.

        DATE: Thu Nov 29 06:44:02 JST 2018

Resolves: https://github.com/crash-utility/crash/issues/62
Suggested-by: Jacob Wen <jian.w.wen@oracle.com>
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
2020-09-14 16:44:58 +09:00
Masanari Iida
314d8c74ff Fix six spelling typos in help.c 2020-07-09 10:58:15 +09:00
Dave Anderson
0f29a8ac6b Replace people.redhat.com references with github equivalents.
(anderson@redhat.com)
2020-05-08 11:46:04 -04:00
Dave Anderson
c86250bce2 Introduction of the "log -T" option, which translates the leading
timestamp value of each message into human readable format.
(w@laoqinren.net)
2020-04-21 14:37:20 -04:00
Dave Anderson
d379b47f04 Introduce a new ARM64 "--machdep vabits_actual=<value>" command
line option for Linux 5.4 and later dumpfiles, which require the
kernel's dynamically-determined "vabits_actual" value for virtual
address translation.  Without the patch, the crash session fails
during initialization with the error message "crash: cannot determine
VA_BITS_ACTUAL".  This option will become unnecessary when the
proposed TCR_EL1.T1SZ vmcoreinfo entry entry is incorporated into
the kernel.
(anderson@redhat.com)
2020-04-02 15:09:42 -04:00
Dave Anderson
007f844e6d Enhancement to the "bpf -p|-P" options to display the eBPF program
name string.
(k-hagio-ab@nec.com)
2020-03-05 14:25:02 -05:00
Dave Anderson
5dfbc7aa27 Introduction of a new "extend -s" option, which shows all available
shared object extension modules that are located in the directories
that are part of the normal search path that is used when a shared
object is loaded without a fully-qualified pathname.
(w@laoqinren.net)
2020-03-03 09:47:51 -05:00
Dave Anderson
0ab7ac3bea Update copyright to 2020 in crash version output. 2020-01-07 09:34:38 -05:00
Dave Anderson
b259940b22 Fix two typos in the examples section of the "help bt" display, which
mistakenly show "bf -f" and "bf -FF" instead of "bt -f" and "bt -FF".
(austindh.kim@gmail.com)
2019-11-21 09:27:52 -05:00
Dave Anderson
1d2bc0c657 Additional fix for the "kmem -n" option on Linux-5.4-rc1 and later
kernels that contain commit b6c88d3b9d38f9448e0fcf44847a075ea81d5ca2,
titled "drivers/base/memory.c: don't store end_section_nr in memory
blocks".  The initial fix only addressed the x86_64 architecture;
this incremental patch addresses the other architectures.
(msys.mizuma@gmail.com)
2019-10-21 11:46:01 -04:00
Dave Anderson
9937878cce Fix for the "kmem -n" option on Linux-5.4-rc1 and later kernels that
contain commit b6c88d3b9d38f9448e0fcf44847a075ea81d5ca2, titled
"drivers/base/memory.c: don't store end_section_nr in memory blocks".
Without the patch, the command option fails with the error message
"kmem: invalid structure member offset: memory_block_end_section_nr".
(msys.mizuma@gmail.com)
2019-10-17 12:00:23 -04:00
Dave Anderson
e1df72964f Fix for the "kmem -n" option on Linux 5.3-rc1 and later kernels
that contain commit 326e1b8f83a4318b09033ef754f40c785aed5e68,
titled "mm/sparsemem: introduce a SECTION_IS_EARLY flag".  Without
the patch, mem_map addresses containing the flag in bit 3 incorrectly
show it as part of the virtual address; with the patch, the option
displays the new "E" state flag.
(k-hagio@ab.jp.nec.com)
2019-07-26 14:31:33 -04:00
Dave Anderson
e6d8f0d8c7 Implemented a new "error" environment variable that sets the
destination of error messages.  It can be set to either:
  "default": error messages are always displayed on the
     console; if the output of a command is piped to an
     external command or redirected to a file, the error
     messages are also sent to the pipe or file.
  "redirect": if the output of a command is piped to an
     external command or redirected to a file, error messages
     are only sent to the pipe or file; otherwise they are
     displayed on the console.
  "filename": error messages are only sent to the specified
     filename; they are not displayed on the console and
     are not sent to a pipe or file.
(dkwon@redhat.com)
2019-07-15 15:06:37 -04:00
Dave Anderson
6c891b667f Add support for the "count" argument to be used in conjunction with
the "dis -r" and "dis -f" reverse/forward modes of operation.  In
reverse mode, the specified "count" number of instructions leading
up to and including the target address will be displayed.  In forward
mode, the display will be limited to "count" instructions.  Without
the patch, using a count argument in either mode generates a "count
argument ignored" message, and the command proceeds as if it had
not been entered.
(anderson@redhat.com, atomlin@redhat.com)
2019-07-09 15:08:16 -04:00
Dave Anderson
72654f8c62 Introduction of a new "rd -R" option, which will display memory in
reverse order.  Memory will be displayed up to and including the
address argument, which requires that the count argument be greater
than 1 in order to display memory before the specified address.
(anderson@redhat.com)
2019-07-02 15:41:58 -04:00
Dave Anderson
496d503e84 Extend the "timer" command with a new "TTE" column that displays the
remaining time in jiffies until the expiration of a timer entry, and
where a negative value displays the number of jiffies that have
elapsed since a timer has expired.
(oleksandr@redhat.com)
2019-06-26 14:57:49 -04:00
Dave Anderson
a000947e92 Introduction of a new "bt -p" option that generates a backtrace of
the panic task, regardless of the current context.  This option is
only applicable when running against dumpfiles in which the panic
task is known.
(atomlin@redhat.com)
2019-06-19 14:11:01 -04:00
Dave Anderson
3fe4602775 Document the "-N", "-g" and "-z" options in the "help" command's
help page.
(k-hagio@ab.jp.nec.com)
2019-05-07 11:46:22 -04:00
Dave Anderson
a5ed29730a Update the README file to indicate the capability of building an
x86_64 crash binary with "make target=PPC64", which can be used to
analyze ppc64le dumpfiles on an x86_64 host.
(anderson@redhat.com)
2019-04-25 14:30:37 -04:00
Dave Anderson
da8e4c9afc Fix for the "dev" help page to remove the unused -r option letter.
(surendra@chelsio.com)
2019-04-24 09:58:50 -04:00
Dave Anderson
71a4f36767 Linux 4.18 kernels introduced a new CONFIG_PROC_VMCORE_DEVICE_DUMP
configuration in commit 2724273e8fd00b512596a77ee063f49b25f36507,
titled "vmcore: add API to collect hardware dump in second kernel",
in which device drivers may collect a device specific snapshot of the
hardware/firmware state of their underlying devices, and export the
data as a kdump ELF note with type NT_VMCOREDD.  This patch
recognizes the new ELF note(s) in both ELF and compressed kdump
vmcore dumpfiles.  The "help -[nD]" option shows basic information
about each note, and two new "dev" command options have been
introduced.  The "dev -V" option displays an indexed list of each
note, showing the device name, the dumpfile offset, and the size
of each note.  The "dev -v index [file]" option either dumps the
contents of a note to the display screen in a human-readable format,
or copies the note data directly to a specified file.
(surendra@chelsio.com)
2019-04-23 14:36:56 -04:00
Dave Anderson
c4d4717194 Apply initial changes to support kernel address space layout
randomization (KASLR) for s390X.  This is the minimal patch-set
required to process s390x dumps for the kernels configured with
CONFIG_RANDOMIZE_BASE, and to accept the "--kaslr" command line
option.  Only dumpfiles whose headers contain kernel VMCOREINFO
data are supported.
(zaslonko@linux.ibm.com)
2019-04-05 10:31:23 -04:00
Dave Anderson
8618ddd817 First phase of support for ARM64 kernels that are configured with
CONFIG_ARM64_USER_VA_BITS_52, which causes the PTRS_PER_PGD count
to increase from 64 to 1024.  Without the patch, "WARNING: cannot
access vmalloc'd module memory" will be displayed during session
initialization, and the translation of any mapped kernel virtual
address that requires a page table walk will fail, leading to a
myriad of other errors.
(anderson@redhat.com)
2019-02-01 15:01:29 -05:00
Dave Anderson
c63d678798 Fix for Linux 4.20 and later x86_64 kernels which are NOT
configured with CONFIG_RANDOMIZE_BASE.  Linux 4.20 introduced
kernel commit d52888aa2753e3063a9d3a0c9f72f94aa9809c15, titled
"x86/mm: Move LDT remap out of KASLR region on 5-level paging",
which modified the 4-level and 5-level paging PAGE_OFFSET values.
Without this patch, the crash session fails during initialization
with the error message "crash: read error: kernel virtual address:
<address>  type: tss_struct ist array".  For kernels prior to
Linux 4.20.0 which have backports of the kernel commit, the kernel's
PAGE_OFFSET value must be manually specified via the command line
option "--machdep page_offset=ffff888000000000" for kernels with
4-level page tables, or "--machdep page_offset=ff11000000000000"
for kernels with 5-level paging.  (or alternatively the shorter
version "-m page_offset=<address>" may be used).  The command
line option requirement may be revisited in the future.
(anderson@redhat.com)
2019-01-18 14:19:18 -05:00
Dave Anderson
361f050e31 Fix for the "dev -[dD]" options in kernels containing Linux 5.0-rc1
commit 7ff4f8035695984c513598e2d49c8277d5d234ca, titled "block:
remove dead queue members", in which the number of I/Os issued to
a disk driver are no longer stored in the request_queue structure.
Without the patch, the options indicate "dev: -d option not supported
or applicable on this architecture or kernel".  With the patch, the
"DRV" column is not shown.
(m.mizuma@jp.fujitsu.com)
2019-01-07 13:56:15 -05:00
Dave Anderson
1baaafc0a4 Red Hat copyright 2019 2019-01-03 14:57:36 -05:00
Dave Anderson
93d51ee09a Update crash banner copyright year range 2018-11-27 10:02:31 -05:00
Dave Anderson
c88e361635 Added a new "tree -t xarray" option to display of the contents of
an XArray in Linux 4.20 and later kernels.  The implementation is
similar to that of radix tree displays, but in addition, the "-p"
option will also display the index value of each entry in a radix
tree or XArray.
(anderson@redhat.com)
2018-11-16 14:43:43 -05:00
Dave Anderson
e342618cb4 Enhancement to the "kmem -n" option to dump memory block information
if the kernel supports it.  In addition, the memory section data
block has a new "STATE" column added to it.
(m.mizuma@jp.fujitsu.com)
2018-10-04 16:52:22 -04:00
Dave Anderson
e541c5ca27 Introduction of a new "kmem -r" option. With the implementation of
per-cgroup kmem_cache slabs, the number of slab caches displayed by
"kmem -s" can number into the thousands.  Similar to /proc/slabinfo,
this new option displays the accumulated data of the root cache and
its children.  It is limited to Linux 4.11 and later kernels that
contain the "slab_root_caches" list.  Currently the command option
is restricted to kernels configured with CONFIG_SLUB.
(k-hagio@ab.jp.nec.com)
2018-08-24 15:17:12 -04:00
Dave Anderson
e9532aea68 As an addendum to the new "kmem -[sS]" output format, align the slab
cache name string so that it is beneath the "NAME" header column when
the "kmem -I &lt;slab-cache>" option is used to ignore a slab cache,
or if the scan of the metadata of a slab cache enounters corruption.
Also remove a superfluous line from the "help kmem" description of
the "kmem -I" option.
(k-hagio@ab.jp.nec.com, anderson@redhat.com)
2018-08-09 11:20:26 -04:00
Dave Anderson
455da1ae5c Modify the output of the "kmem -[sS]" header and contents such that
the slab cache name string is moved from the second column to the
the last column.  Since the slab cache name strings have become
increasingly longer over time, without the patch, the numerical
column contents may be skewed so far to the right that the output
becomes difficult to read.
(k-hagio@ab.jp.nec.com)
2018-08-08 14:20:21 -04:00
Dave Anderson
a10917ba32 Update for "ps" and "foreach" commands to display and recognize two
new process states, "ID" for the TASK_IDLE macro introduced in
Linux 4.2, and "NE" for the TASK_NEW bit introduced in Linux 4.8.
(k-hagio@ab.jp.nec.com)
2018-07-19 13:43:07 -04:00
Dave Anderson
6596f1121b The existing "list" command uses a hash table to detect duplicate
items as it traverses the list.  The hash table approach has worked
well for many years.  However, with increasing memory sizes and list
sizes, the overhead of the hash table can be substantial, often
leading to commands running for a very long time.  For large lists,
we have found that the existing hash based approach may slow the
system to a crawl and possibly never complete.  You can turn off
the hash with "set hash off" but then there is no loop detection; in
that case, loop detection must be done manually after dumping the
list to disk or some other method.  This patch is an implementation
of the cycle detection algorithm from R. P. Brent as an alternative
algorithm for the "list" command.  The algorithm both avoids the
overhead of the hash table and yet is able to detect a loop.  In
addition, further loop characteristics are printed, such as the
distance to the start of the loop as well as the loop length.
An excellent description of the algorithm can be found here on
the crash-utility mailing list:

https://www.redhat.com/archives/crash-utility/2018-July/msg00019.html

A new "list -B" option has been added to the "list" command to
invoke this new algorithm rather than using the hash table.  In
addition to low memory usage, the output of the list command is
slightly different when a loop is detected.  In addition to printing
the first duplicate entry, the length of the loop, and the distance
to the loop is output.
(dwysocha@redhat.com)
2018-07-11 16:25:59 -04:00
Dave Anderson
9b494b7006 Update for the "kmem -V" option to also dump the global entries that
are contained in the "vm_numa_stat" array that was introduced in
Linux 4.14.  Also, the command output separates the "vm_zone_stat",
"vm_node_stat" and "vm_numa_stat" entries into separate sections with
"VM_ZONE_STAT", "VM_NODE_STAT" and "VM_NUMA_STAT" headers.  Without
the patch, the "vm_zone_stat" and "vm_node_stat" entries are listed
together under a "VM_STAT" header.
(anderson@redhat.com)
2018-06-26 16:00:28 -04:00
Dave Anderson
6946bc2e95 Trivial formatting fix to "bpf" help page.
(anderson@redhat.com)
2018-05-08 15:11:27 -04:00
Dave Anderson
23b23ce165 Second stage of the new "bpf" command. This patch adds additional
per-program and per-map data for the "bpf -p ID" and "bpf -m ID"
options, containing data items shown by the "bpftool prog list"
and "bpftool map list" options; new "bpf -P" and "bpf -M" options
have been added that dump the extra data for all loaded programs
or tasks.
(anderson@redhat.com)
2018-05-07 11:45:21 -04:00
Dave Anderson
dacfbe8ab1 Introduction of a new "bpf" command that displays information about
loaded eBFP (extended Berkeley Packet Filter) programs and maps.
Because of its upstream fluidity, the capabilities of this command
will be an ongoing task.  In its initial form, the command displays
the addresses, basic information, and key data structures of eBPF
programs and maps.  It also translates the bytecode, and disassembles
the jited code, of loaded eBPF programs.
(anderson@redhat.com)
2018-04-19 15:53:40 -04:00
Dave Anderson
9aa345148c Display a fatal error message if the "tree -l" option is attempted
with radix trees.  Without the patch, the option would be silently
ignored.
(neelx@redhat.com)
2018-04-18 09:36:25 -04:00
Dave Anderson
90642e6ffa Added a new "tree -l" option for the rbtree display, which dumps
the tree sorted in linear order, starting with the leftmost node and
progressing to the right.  Also, if a corrupted rb_node pointer is
encountered, do not fail immediately, but rather display the rb_node
address and the corrupt pointer and continue.
(neelx@redhat.com)
2018-04-17 10:12:02 -04:00
Dave Anderson
907196e93d VMware VMSS dumpfiles contain the state of each vCPU at the time
when the VM was suspended.  This patch enables crash to read the
relevant registers from each vCPU state for use as the starting hooks
by the "bt" command.  Also, support for "help -[D|n]" to display
dumpfile contents, and "help -r" to display vCPU register sets has
been implemented.  This is also the first step towards implementing
automatic KASLR offset calculations for VMSS dumpfiles.
(slp@redhat.com)
2018-03-26 13:56:29 -04:00
Dave Anderson
df4679ddb5 Fix the "help foreach" argument list to include the new "gleader"
task qualifier option that was added in version 7.1.2.
(anderson@redhat.com)
2018-03-22 09:22:51 -04:00
Dave Anderson
6de5d2c034 Implemented a new "ps -A" option that restricts the task output to
just the active tasks on each cpu.
(atomlin@redhat.com)
2018-03-01 09:39:29 -05:00
Dave Anderson
b5a331ac2b Add a new "foreach gleader" qualifier option, restricting the output
to user-space tasks that are thread group leaders.
(Jan.Karlsson@sony.com)
2018-02-02 11:28:14 -05:00
Dave Anderson
94d01ce01d Second phase of future support for x86_64 5-level page tables. This
patch is a cleanup/collaboration of the original logic used by the
various vtop functions, where several new common functions have been
added for extracting page table entries from PGD, P4D, PUD, PMD and
PTE pages.  The usage of the former PML4 and UPML pages have been
replaced with the use of the common PGD page, and use the PUD page
in 4-level page table translation.  Support for 5-level page tables
has been incorporated into the the existing x86_64_kvtop() and
x86_64_uvtop_level4() functions.  Backwards compatibility for older
legacy kernels has been maintained.  The third phase of support will
automatically detect whether the kernel proper, and whether an
individual user task, is utilizing 5-level page tables.  This patch
enables support for kernel-only 5-level page tables by entering the
command line option "--machdep vm=5level".
(douly.fnst@cn.fujitsu.com)
2018-01-30 14:28:22 -05:00