Commit Graph

443 Commits

Author SHA1 Message Date
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
3db3d3992d Fix for the PPC64 "bt" command for non-panicking active tasks in
FADUMP-generated dumpfiles (Firmware Assisted Dump facility).
Without the patch, backtraces of those tasks may be of the form
"#0 [c0000000700b3a90] (null) at c0000000700b3b50  (unreliable)".
This patch uses and displays the ptregs register set saved in the
dumpfile header for the non-panicking active tasks.
(hbathini@linux.vnet.ibm.com)
2017-01-24 14:37:03 -05:00
Dave Anderson
651c824ffe Prevent the livepatch taint flag check during the system banner
display from generating a fatal session-killing error if relevant
kernel symbol names or data structures change in the future (again).
(anderson@redhat.com)
2017-01-19 14:15:50 -05:00
Dave Anderson
e37dd7852f Prepare for the kernel's "taint_flag.true" and "taint_flag.false"
member names to be changed to "c_true" and "c_false", which fixes
build problems when an out-of-tree module defines "true" or "false".
(anderson@redhat.com)
2017-01-17 14:15:11 -05:00
Dave Anderson
33c79e0ba7 Update to the module taint flags handling patch above to account for
the change in size of the module.taints flag from an int to a long,
while allowing for a kernel backport that keeps it as an int.
(anderson@redhat.com)
2017-01-17 10:36:19 -05:00
Dave Anderson
ad1a44f5d9 Fix for support of /proc/kcore as the live memory source in Linux 4.8
and later x86_64 kernels configured with CONFIG_RANDOMIZE_BASE, which
randomizes the unity-mapping PAGE_OFFSET value.  Without the patch,
the crash session fails during session initialization with the error
message "crash: seek error: kernel virtual address: <address>
type: page_offset_base".
(anderson@redhat.com)
2017-01-13 15:38:39 -05:00
Dave Anderson
24a696228c Fix for Linux 4.10 commit 7fd8329ba502ef76dd91db561c7aed696b2c7720
"taint/module: Clean up global and module taint flags handling".
Without the patch, when running against Linux 4.10-rc1 and later
kernels, the crash utility fails during session initialization with
the message "crash: invalid structure size: tnt".
(panand@redhat.com)
2017-01-05 14:55:18 -05:00
Dave Anderson
58225d5106 Fix for the ARM64 "bt" command in Linux 4.10 and later kernels that
are configured with CONFIG_THREAD_INFO_IN_TASK.  Without the patch,
the "bt" command will fail for active tasks in dumpfiles that were
generated by the kdump facility.
(takahiro.akashi@linaro.org)
2017-01-05 09:23:33 -05:00
Dave Anderson
b809cb7d9b For ARM64 dumpfiles with VMCOREINFO, verify the new "VA_BITS" number
against the calculated number.
(anderson@redhat.com)
2017-01-03 09:46:21 -05:00
Dave Anderson
ec02834f48 The 32-bit MIPS PGD_ORDER() macro expects __PGD_ORDER to be signed,
which it isn't now since the internal machdep->pagesize is unsigned.
Without this patch, module loading fails during initialization on a
kernel that has a page size of 16KB, with messages that indicate
"please wait... (gathering module symbol data)" followed by
"crash: invalid size request: 0  type: pgd page".
(rabinv@axis.com)
2016-12-05 13:55:22 -05:00
Dave Anderson
c7a6b862ca Fix for a segmentation violation during session inialization when
running against a 32-bit MIPS ELF kdump or compressed kdump if a
per-cpu NT_PRSTATUS note cannot be be gathered from the dumpfile
header.  Without the the patch, a segmentation violation occurs after
the message "WARNING: cannot find NT_PRSTATUS note for cpu: <number>"
is displayed.
(rabinv@axis.com)
2016-12-05 12:11:10 -05:00
Dave Anderson
3d41b666a5 Fix for the initialization-time loading of kernel module symbols
if the kernel crashed while running a module's initcall.  Without
the patch, the crash session fails during initialation with a message
similar to "crash: store_module_symbols_v2: total: 7 mcnt: 8".
(rabinv@axis.com)
2016-12-05 11:42:54 -05:00
Dave Anderson
59fbaf3e4b Fix for Linux 4.6 commit b03a017bebc403d40aa53a092e79b3020786537d,
which introduced the new slab management type OBJFREELIST_SLAB.
In this mode, the freelist can be an object, and if the slab is full,
there is no freelist.  On the next free, an object is recycled to be
used as the freelist but not cleaned-up.  This patch will go through
only known freed objects, and will prevent "kmem -S" errors that
indicate "invalid/corrupt freelist entry" on kernels configured
with CONFIG_SLAB.
(thgarnie@google.com)
2016-12-02 13:57:11 -05:00
Dave Anderson
01e6fa2073 Mark start of 7.1.8 development with version 7.1.7++ 2016-12-02 13:55:26 -05:00
Dave Anderson
9db1795ae0 crash-7.1.6 -> crash-7.1.7 2016-11-30 13:58:26 -05:00
Dave Anderson
e726a31519 Update of the sample memory_driver/crash.c /dev/crash kernel driver
to version 1.3, which adds support for Linux 4.6 and later ARM64
kernels, kernels configured with CONFIG_HARDENED_USERCOPY, and
S390X kernels use xlate_dev_mem_ptr() and unxlate_dev_mem_ptr()
instead of kmap() and kunmap().
(anderson@redhat.com)
2016-11-22 11:43:40 -05:00
Dave Anderson
c5c2bf0240 In collaboration with an update to the /dev/crash kernel driver, fix
for Linux 4.6 commit a7f8de168ace487fa7b88cb154e413cf40e87fc6, which
allows the ARM64 kernel image to be loaded anywhere in physical
memory.  Without the patch, attempting to run live on an ARM64
Linux 4.6 and later kernel may display the warning message "WARNING:
cannot read linux_banner string", and then fails with the message
"crash: vmlinux and /dev/crash do not match!".  Version 1.3 of the
crash driver is required, which introduces a new ioctl command that
retrieves the ARM64-only "kimage_voffset" value that is required for
virtual-to-physical address translation.
(anderson@redhat.com)
2016-11-21 16:10:52 -05:00
Dave Anderson
13dc25c923 Fix for the s390x "bt" command for active tasks. Since commit
c9f932440b in this crash-7.1.7 release that added support for
the new CONFIG_THREAD_INFO_IN_TASK configuration, the backtrace of
active tasks can be incomplete.
(holzheu@linux.vnet.ibm.com)
2016-11-10 15:03:04 -05:00
Dave Anderson
109dc55f16 Since the Linux 3.10 release, the kernel has offered the ability to
create multiple independent ftrace buffers.  At present, however,
the "trace.c" extension module is only able to extract the primary
buffer.  This patch refactors the trace.c extension module so that
the global instance is passed around as a parameter rather than
accessing it directly, and then locates all of the available
instances and extracts the data from each of them.
(kyle.a.tomsic@gmail.com)
2016-11-09 11:01:03 -05:00
Dave Anderson
83d8cff8d9 Fix for the x86_64 "mach" command display of the vmemmap base address
in Linux 4.9 and later kernels configured with CONFIG_RANDOMIZE_BASE.
Without the patch, the command shows a value of ffffea0000000000 next
to "KERNEL VMEMMAP BASE".
(anderson@redhat.com)
2016-10-27 16:59:13 -04:00
Dave Anderson
0cdd121150 Fix for support of Linux 4.7 and later x86_64 ELF kdump vmcores from
kernels configured with CONFIG_RANDOMIZE_BASE.  Without the patch,
the crash session may fail during initialization with the message
"crash: vmlinux and vmcore do not match!".
(anderson@redhat.com)
2016-10-27 15:25:00 -04:00
Dave Anderson
887bd488c9 Fix for the 32-bit MIPS "bt" command to prevent an empty display
(task header only) for an active task if the epc register in its
exception frame contains 00000000.
(rabinv@axis.com)
2016-10-27 15:00:23 -04:00
Dave Anderson
a888ae2821 Restore the x86_64 "dis" command's symbolic translation of jump
or call target addresses if the kernel was configured with
CONFIG_RANDOMIZE_BASE.
(anderson@redhat.com)
2016-10-25 16:00:05 -04:00
Dave Anderson
774a92f48f Fix for a possible segmentation violation when analyzing Linux 4.7
x86_64 kernels that are configured with CONFIG_RANDOMIZE_BASE.
Depending upon the randomized starting address of the kernel text
and static data, a segmentation violation may occur during session
initialization, just after the patching of the gdb minimal_symbol
values message.
(anderson@redhat.com)
2016-10-25 13:32:22 -04:00
Dave Anderson
49be88a766 When each x86_64 per-cpu cpu_tss.x86_tss.ist[] array member (or in
older kernels, each per-cpu init_tss.x86_hw_tss.ist[] array member),
is compared with its associated per-cpu orig_ist.ist[] array member,
ensure that both exception stack pointers have been initialized
(non-NULL) before printing a WARNING message if they don't match.
(anderson@redhat.com)
2016-10-21 16:23:02 -04:00
Dave Anderson
7e0cb8b516 Fix for Linux commit 0100301bfdf56a2a370c7157b5ab0fbf9313e1cd, which
rewrote the X86_64 switch_to() code by embedding the __switch_to()
call inside a new __switch_to_asm() assembly code ENTRY() function.
Without the patch, the message "crash: cannot determine thread return
address" gets displayed during initialization, and the "bt" command
shows frame #0 starting at "schedule" instead of "__schedule".
(anderson@redhat.com)
2016-10-21 14:31:59 -04:00
Dave Anderson
26c5915ce5 Add support for "help -r" on 32-bit MIPS to display the registers
for each CPU from a dumpfile.
(rabinv@axis.com)
2016-10-20 15:17:00 -04:00
Dave Anderson
5bca61c0eb Fixes for the gathering of the active task registers from 32-bit MIPS
dumpfiles:
 (1) If ELF notes are not available, read them from the kernel's
     crash_notes.
 (2) If an online CPUs did not save its ELF notes, then adjust
     the mapping of each ELF note to its CPU accordingly.
(rabinv@axis.com)
2016-10-20 14:13:30 -04:00
Dave Anderson
c9f932440b Fix for Linux 4.9-rc1 commits 15f4eae70d365bba26854c90b6002aaabb18c8aa
and c65eacbe290b8141554c71b2c94489e73ade8c8d, which have introduced a
new CONFIG_THREAD_INFO_IN_TASK configuration.  This configuration
moves each task's thread_info structure from the base of its kernel
stack into its task_struct.  Without the patch, the crash session
fails during initialization with the error "crash: invalid structure
member offset: thread_info_cpu".
(anderson@redhat.com)
2016-10-20 11:47:08 -04:00
Dave Anderson
fb5713c86f Enable SPARSEMEM support on 32-bit MIPS by setting SECTION_SIZE_BITS
and MAX_PHYSMEM_BITS.
(rabinv@axis.com)
2016-10-19 09:23:44 -04:00
Dave Anderson
b240a8bfe2 Set the default 32-bit MIPS HZ value to 100 if the in-kernel config
data is unavailable, and have the "mach" command display the value.
(rabinv@axis.com)
2016-10-19 09:04:25 -04:00
Dave Anderson
d2d1de65fa Mark start of 7.1.7 development with version 7.1.6++ 2016-10-19 09:03:35 -04:00
Dave Anderson
64531dc850 crash-7.1.5 -> crash-7.1.6 2016-10-13 14:32:43 -04:00
Dave Anderson
df08978f31 Improvement of the "dev -d" option to display I/O statics for disks
whose device driver uses the blk-mq interface.  Currently "dev -d"
always displays 0 in all fields for the blk-mq disk because blk-mq
does not increment/decrement request_list.count[2] on I/O creation
and I/O completion.  The following values are used in blk-mq in such
situations:
  - I/O creation:   blk_mq_ctx.rq_dispatched[2]
  - I/O completion: blk_mq_ctx.rq_completed[2]
So, we can get the counter of in-progress I/Os as follows:
  in progress I/Os == rq_dispatched - rq_completed
This patch displays the result of above calculation for the disk.
It determines whether the device driver uses blk-mq if the
request_queue.mq_ops is not NULL.  The "DRV" field is displayed as
"N/A(MQ)" if the value for in-flight in the device driver does not
exist for blk-mq.
(m.mizuma@jp.fujitsu.com)
2016-10-12 11:28:40 -04:00
Dave Anderson
f08a9c8bce Enhancement to the ARM64 "dis" command when the kernel has enabled
KASLR.  When KASLR is enabled on ARM64, a function call between a
module and the base kernel code will be done via a veneer (PLT) if
the displacement is more than +/-128MB.  As a result, disassembled
code will show a branch to the in-module veneer location instead of
the in-kernel target location.  To avoid confusion, the output of
the "dis" command will translate the veneer location to the target
location preceded by "plt:", for example, "<plt:printk>".
(takahiro.akashi@linaro.org)
2016-10-11 13:50:31 -04:00
Dave Anderson
9a5cbfe998 Exclude ARM64 kernel module linker mapping symbols like "$d" and "$x"
as is done with 32-bit ARM.  Without the patch, a crash session may
fail during the "gathering module symbol data" stage with a message
similar to "crash: store_module_symbols_v2: total: 15 mcnt: 16".
(takahiro.akashi@linaro.org)
2016-10-04 10:57:43 -04:00
Dave Anderson
35b0c4b831 If a "struct" command address argument is expressed using the per-cpu
"symbol:cpuspec" format, and the symbol is a pointer type, i.e., not
the address of the structure, display a WARNING message.
(atomlin@redhat.com)
2016-09-30 11:11:34 -04:00
Dave Anderson
6997fbec4a Fix for the "trace.so" extension module to properly recognize Linux
3.15 and later kernels.  In crash-7.1.6, the MEMBER_OFFSET() macro
has been improved so that it is able to recognize members of embedded
anonymous structures.  However, the module's manner of recognizing
Linux 3.15 and later kernels depended upon MEMBER_OFFSET() failing
to handle anonymous members, and therefore the improvement prevented
the module from successfully loading.
(rabinv@axis.com)
2016-09-29 10:25:53 -04:00
Dave Anderson
437fe6ab74 Change the RESIZEBUF() macro so that it will accept buffer pointers
that are not declared as "char *" types.  Change two prior direct
callers of resizebuf() to use RESIZEBUF(), and fix two prior users of
RESIZEBUF() to correctly calculate the need to resize their buffers.
(anderson@redhat.com)
2016-09-27 11:57:28 -04:00
Dave Anderson
312d354f3b Support for PPC64/BOOK3S virtual address translation for radix MMU.
As both radix and hash MMU are supported in a single kernel on
Power ISA 3.0 based server processors, identify the current MMU
type and set page table index values accordingly.  Also, in Linux
4.7 and later kernels, PPC64/BOOK3S uses the same masked bit values
in page table entries for 4K and 64K page sizes.
(hbathini@linux.vnet.ibm.com)
2016-09-27 10:13:40 -04:00
Dave Anderson
10192898cf Fix for Linux 4.8-rc1 commit 500462a9de657f86edaa102f8ab6bff7f7e43fc2,
in which Thomas Gleixner redesigned the kernel timer mechanism to
switch to a non-cascading wheel.  Without the patch, the "timer"
command fails with the message "timer: zero-size memory allocation!
(called from <address>)"
(anderson@redhat.com)
2016-09-26 11:41:31 -04:00
Dave Anderson
182914debb With the introduction of radix MMU in Power ISA 3.0, there are
changes in kernel page table management accommodating it.  This patch
series makes appropriate changes here to work for such kernels.
Also, this series fixes a few bugs along the way:

  ppc64: fix vtop page translation for 4K pages
  ppc64: Use kernel terminology for each level in 4-level page table
  ppc64/book3s: address changes in kernel v4.5
  ppc64/book3s: address change in page flags for PowerISA v3.0
  ppc64: use physical addresses and unfold pud for 64K page size
  ppc64/book3s: support big endian Linux page tables

The patches are needed for Linux v4.5 and later kernels on all
ppc64 hardware.
(hbathini@linux.vnet.ibm.com)
2016-09-23 09:09:15 -04:00
Dave Anderson
d43ae5e4e5 Fix for Linux 4.1 commit d0a0de21f82bbc1737ea3c831f018d0c2bc6b9c2,
which renamed the x86_64 "init_tss" per-cpu variable to "cpu_tss".
Without the patch, the addresses of the 4 per-cpu exception stacks
cannot be determined, which causes backtraces that originate on
any of the per-cpu DOUBLEFAULT, NMI, DEBUG, or MCE stacks to be
truncated.
(anderson@redhat.com)
2016-09-22 13:40:16 -04:00
Dave Anderson
da79c1bffc Fix to recognize and support x86_64 Linux 4.8-rc1 and later kernels
that are configured with CONFIG_RANDOMIZE_MEMORY, which randomizes
the base addresses of the kernel's unity-map address (PAGE_OFFSET),
and the vmalloc region.  Without the patch, the crash utility fails
with a segmentation violation during session initialization.
(anderson@redhat.com)
2016-09-21 15:58:22 -04:00
Dave Anderson
114c87c031 Implemented new "list -S" and "tree -S" options that are similar to
each command's -s option, but instead of parsing gdb output, member
values are read directly from memory, so the command is much faster
for 1-, 2-, 4-, and 8-byte members.
(Alexandr_Terekhov@epam.com)
2016-09-07 16:35:22 -04:00
Dave Anderson
2a38cb01c8 Speed up session initialization by attempting MEMBER_OFFSET_INIT()
before falling back to ANON_MEMBER_OFFSET_INIT() in several known
cases of structure members that are contained within anonymous
structures.
(anderson@redhat.com)
2016-08-26 14:37:05 -04:00
Dave Anderson
5e6fbde738 Enhancement to determine structure member data if the member is
contained within an anonymous structure or union.  Without the patch,
it is necessary to parse the output of a discrete gdb "printf"
command to determine the offset of such a structure member.
(Alexandr_Terekhov@epam.com)
2016-08-25 14:26:58 -04:00
Dave Anderson
004218c50f Fix the PERCENTAGE of total output of the "kmem -i" SWAP USED line
when the system has no swap pages at all.  Without the patch, both
the PAGES and TOTAL columns show values of zero, but it confusingly
shows "100% of TOTAL SWAP", which upon first glance may seem to
indicate potential memory pressure.
(jsiddle@redhat.com)
2016-08-17 14:49:20 -04:00
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