Commit Graph

17 Commits

Author SHA1 Message Date
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
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
Dave Anderson
63419fb9a5 Fix for the "bt" command in x86_64 kernels that contain, or have
backports of, kernel commit 4950d6d48a0c43cc61d0bbb76fb10e0214b79c66,
titled "x86/dumpstack: Remove 64-byte gap at end of irq stack".
Without the patch, backtraces fail to transition from the IRQ stack
back to the process stack, showing an error message such as
"bt: cannot transition exception stack to IRQ stack to current
process stack".
(anderson@redhat.com)
2018-01-10 14:11:27 -05:00
Dave Anderson
222e784fb2 Fix for 32-bit X86 kernels configured with CONFIG_RANDOMIZE_BASE.
Without the patch, an invalid kernel PAGE_OFFSET value is calculated
and as a result the session fails during session initialization just
after the patching of the gdb minimal_symbol values message, showing
the warning message "WARNING: cannot read linux_banner string",
followed by "crash: /vmlinux and /dev/crash do not match!".  This
patch also adds a new "--machdep page_offset=<value>" option that
can be used if the CONFIG_PAGE_OFFSET value is not the default
address of 0xc0000000.
(anderson@redhat.com)
2017-02-10 15:07:58 -05:00
Dave Anderson
02826c505b Fix for a possible segmentation violation when analyzing Linux 4.6
and earlier x86_64 kernels configured with CONFIG_RANDOMIZE_BASE.
A segmentation violation may occur during session initialization,
just after the patching of the gdb minimal_symbol values message,
depending upon the value of KERNEL_IMAGE_SIZE, which was variable
in the earlier KASLR kernels.  This patch sets the KERNEL_IMAGE_SIZE
default value to 1GB for those earlier kernels, and also adds a
new "--machdep kernel_image_size=<value>" option that can be
used to override the default KERNEL_IMAGE_SIZE value if necessary.
(anderson@redhat.com)
2017-01-31 15:43:20 -05: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
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
045c00ac34 Added recognition of the new DUMP_DH_COMPRESSED_INCOMPLETE flag in
the header of compressed kdumps, and the new DUMP_ELF_INCOMPLETE flag
in the header of ELF kdumps.  If the makedumpfile(8) facility fails
to complete the creation of compressed or ELF kdump vmcore files
due to ENOSPC or other error, it will mark the vmcore as incomplete.
If either flag is set, the crash utility will issue a warning that
the dumpfile is known to be incomplete during initialization, just
prior to the system banner display.  When reads are attempted on
missing data, a read error will be returned.  As an alternative,
zero-filled data will be returned if the "--zero_excluded" command
line flag is used, or the "zero_excluded" runtime variable is set
to "on".  In either case, the read errors or zero-filled memory
may cause the crash session to fail entirely, cause commands to
fail, or may result in other unpredictable runtime behavior.
(anderson@redhat.com, zhouwj-fnst@cn.fujitsu.com)
2014-10-30 10:42:38 -04:00
Dave Anderson
d5b362edf7 Implement a new "offline" internal crash variable that can be set to
either "show" (the default) or "hide".  When set to "hide", certain
command output associated with offline cpus will be hidden from view,
and the output will indicate that the cpu is "[OFFLINE]".  The new
variable can be set during invocation on the crash command line via
the option "--offline [show|hide]".  During runtime, or in a .crashrc
or other crash input file, the variable can be set by entering
"set offline [show|hide]".  The commands or options that are affected
when the variable is set to "hide" are as follows:

  o  On X86_64 machines, the "bt -E" option will not search exception
     stacks associated with offline cpus.
  o  On X86_64 machines, the "mach" command will append "[OFFLINE]"
     to the addresses of IRQ and exception stacks associated with
     offline cpus.
  o  On X86_64 machines, the "mach -c" command will not display the
     cpuinfo_x86 data structure associated with offline cpus.
  o  The "help -r" option has been fixed so as to not attempt to
     display register sets of offline cpus from ELF kdump vmcores,
     compressed kdump vmcores, and ELF kdump clones created by
     "virsh dump --memory-only".
  o  The "bt -c" option will not accept an offline cpu number.
  o  The "set -c" option will not accept an offline cpu number.
  o  The "irq -s" option will not display statistics associated with
     offline cpus.
  o  The "timer" command will not display hrtimer data associated
     with offline cpus.
  o  The "timer -r" option will not display hrtimer data associated
     with offline cpus.
  o  The "ptov" command will append "[OFFLINE]" when translating a
     per-cpu address offset to a virtal address of an offline cpu.
  o  The "kmem -o" option will append "[OFFLINE]" to the base per-cpu
     virtual address of an offline cpu.
  o  The "kmem -S" option in CONFIG_SLUB kernels will not display
     per-cpu data associated with offline cpus.
  o  When a per-cpu address reference is passed to the "struct"
     command, the data structure will not be displayed for offline
     cpus.
  o  When a per-cpu symbol and cpu reference is passed to the "p"
     command, the data will not be displayed for offline cpus.
  o  When the "ps -[l|m]" option is passed the optional "-C [cpus]"
     option, the tasks queued on offline cpus are not shown.
  o  The "runq" command and the "runq [-t/-m/-g/-d]" options will not
     display runqueue data for offline cpus.
  o  The "ps" command will replace the ">" active task indicator to
     a "-" for offline cpus.

The initial system information banner and the "sys" command will
display the total number of cpus as before, but will append the count
of offline cpus.  Lastly, a fix has been made for the initialization
time determination of the maximum number of per-cpu objects queued
in a CONFIG_SLAB kmem_cache so as to continue checking all cpus
higher than the first offline cpu.  These changes in behavior are not
dependent upon the setting of the crash "offline" variable.
(qiaonuohan@cn.fujitsu.com)
2014-10-06 15:32:37 -04:00
Dave Anderson
25b61f4a2e Implement support for ARM and ARM64 raw RAM dumpfiles. One or
more "ramdump" files may be entered on the crash command line
in an ordered pair format consisting of the RAM dump filename
and the starting physical address expressed in hexadecimal,
connected with an ampersand:

  $ crash vmlinux ramdump@address [ramdump@address]

A temporary ELF header will be created in /var/tmp, and the
combination of the header and the ramdump file(s) will be handled
like a normal ELF vmcore.  The ELF header will only exist during
the crash session.  If desired, an optional "-o <filename>"
may be entered to create a permanent ELF vmcore file from the
ramdump file(s).
(vinayakm.list@gmail.com, paawan1982@yahoo.com, anderson@redhat.com)
2014-07-31 14:58:26 -04:00
Dave Anderson
f9b816565d Document the "--machdep phys_offset=<physical-address>" command
line option for the ARM64 architecture in the crash.8 man page and
the "crash -h" output.
(anderson@redhat.com)
2014-03-28 14:05:22 -04:00
Dave Anderson
2bb552bed2 Correction for the "crash -h" and crash.8 man page documentation of
the "--machdep phys_base=<physical-address>" command line option.
In both places the parameter mistakenly indicated "physbase".
(ptesarik@suse.cz)
2014-03-20 14:00:51 -04:00
Dave Anderson
5645af9598 Increase the internal hash queue head count from 128 to 32768.
The hash queue is used for gathering and verifying lists, and the
original count of 128 may be overwhelmed if a list is extremely
large.  For example, on a 256GB system with 192GB of free pages,
the "kmem -f" command takes hours to complete; with this patch,
the time is reduced to a few minutes.  In addition, a new command
line option "--hash <count>" has been added to allow a user to
override the default hash queue head count of 32768.
(anderson@redhat.com)
2014-03-13 11:56:30 -04:00
Dave Anderson
b8db9a76e9 Added a new "--kaslr=auto" command line option for X86_64 kernels
that that are configured with CONFIG_RANDOMIZE_BASE.  When set to
"auto", the KASLR relocation value will be determined automatically
by comparing the "_stext" symbol value compiled into the vmlinux file
with the _stext symbol value stored in kdump vmcoreinfo data; on live
systems the comparison will be made with the "_stext" symbol value
that is found in /proc/kallsyms.
(ahonig@google.com, anderson@redhat.com)
2014-02-25 15:28:47 -05:00
Dave Anderson
648d0f62c5 Added a new "--kaslr <offset>" command line option for X86 or
X86_64 kernels that are configured with CONFIG_RANDOMIZE_BASE.
The offset value must be equal to the difference between the
symbol values compiled into the vmlinux file and their relocated
value.
(ahonig@google.com, anderson@redhat.com)
2014-02-21 10:32:04 -05:00
Dave Anderson
03e3937ec7 Initial commit: crash-7.0.4 2014-01-28 16:46:11 -05:00