[PATCH] arm64: update mapping symbol filter in arm64_verify_symbol
by 赵乾利
From: Qianli Zhao <zhaoqianli(a)xiaomi.com>
Name Meaning of mapping symbol:
$x
$x.<any...>
Start of a sequence of A64 instructions
$c
$c.<any...>
Start of a sequence of C64 instructions
$d
$d.<any...>
Start of a sequence of data items (for example, a literal pool)
Reference documents:
https://documentation-service.arm.com/static/5f9a92f6b1a7c5445f28fee6?token=
Signed-off-by: Qianli Zhao <zhaoqianli(a)xiaomi.com>
---
When use crash-arm64 parsing kdump,"dis" command can not completely parse out the disassembly code(aarch64-objdump is ok),miss some assembly code at the end,such as below:
The queued_spin_lock_slowpath() actual code segment of the function is from 0xffffffdf44b80d48 to ffffffecc41591d4,but "dis" command only dump from 0xffffffdf44b80d48 to 0xffffffdf44b80df0.
crash> dis queued_spin_lock_slowpath
0xffffffdf44b80d48 <$x.1>: str x30, [x18],#8
0xffffffdf44b80d4c <queued_spin_lock_slowpath+4>: stp x29, x30, [sp,#-64]!
....
0xffffffdf44b80dec <queued_spin_lock_slowpath+164>: cbnz w10, 0xffffffdf44b80e9c
0xffffffdf44b80df0 <queued_spin_lock_slowpath+168>: nop
The reason for the issue is that crash-tool thinks next vaild symbol is $x.3,but $x.* is a mapping symbol defined by ARM,this type of symbol needs skip.
ffffffdf44b80d48 (T) queued_spin_lock_slowpath
ffffffdf44b80df4 (t) $x.3
ffffffdf44b80dfc (t) $x.5
ffffffdf44b80e24 (t) $x.7
ffffffdf44b80e2c (t) $x.9
ffffffdf44b80f6c (t) $x.13
ffffffdf44b80f74 (t) $x.15
ffffffdf44b8102c (t) $x.19
ffffffdf44b81034 (t) $x.21
ffffffdf44b810e8 (t) $x.7
ffffffdf44b810e8 (T) rt_mutex_adjust_pi
ffffffdf44b8118c (t) $x.8
This issue will mislead us to analyze assembly issue:
[20332.505051] Call trace:
[20332.505057] queued_spin_lock_slowpath+0x198/0x3a0---->//Beyond code segment?
[20332.505063] do_raw_spin_lock+0x10c/0x12c
[20332.505071] _raw_spin_lock_irqsave+0x3c/0x50
[20332.505080] set_dspp_hist_irq_feature+0x180/0x1d4
[20332.505089] sde_cp_crtc_setfeature+0x168/0x2f4
[20332.505095] sde_cp_crtc_apply_properties+0x46c/0x76c
[20332.505102] sde_crtc_atomic_begin+0x490/0x62c
[20332.505111] drm_atomic_helper_commit_planes+0x5c/0x2bc
[20332.505117] complete_commit+0xa0/0x264
[20332.505123] _msm_drm_commit_work_cb+0x128/0x22c
[20332.505130] kthread_worker_fn+0x110/0x1ac
[20332.505136] kthread+0x160/0x170
[20332.505143] ret_from_fork+0x10/0x18
Reference documents(page 7):
https://documentation-service.arm.com/static/5f9a92f6b1a7c5445f28fee6?token=
---
arm64.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arm64.c b/arm64.c
index fdf77bd..24fd91e 100644
--- a/arm64.c
+++ b/arm64.c
@@ -510,9 +510,11 @@ arm64_verify_symbol(const char *name, ulong value, char type)
((type == 'a') || (type == 'n') || (type == 'N') || (type == 'U')))
return FALSE;
- if (STREQ(name, "$d") || STREQ(name, "$x"))
+ if (STREQ(name, "$d") || STRNEQ(name, "$d.") ||
+ STREQ(name, "$x") || STRNEQ(name, "$x.") ||
+ STREQ(name, "$c") || STRNEQ(name, "$c."))
return FALSE;
-
+
if ((type == 'A') && STRNEQ(name, "__crc_"))
return FALSE;
--
2.7.4
#/******本邮件及其附件含有小米公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件! This e-mail and its attachments contain confidential information from XIAOMI, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!******/#
3 years, 8 months
[PATCH v3 1/1] Support cross-compilation
by Alexander Egorenkov
In order to support cross-compilation of crash-utilty,
the configure tool compiled from configure.c must be built
for the host architecture where the cross-compilation will run
instead of the target architecture where the crash-utility shall run.
Therefore, we need to support two C compilers in Maklefile,
one for the host and one for the target. The old CC makefile variable
shall represent the compiler for the target architecture and
the new HOSTCC makefile variable shall represent the host compiler.
Both variables differ only when a cross-compilation is performed.
Furthermore, there must be a way to override the target architecture
which is deduced from the preprocessor macros defined by the compiler
used for the compilation of configure.c, because otherwise the configure
tool will deduce host's architecture instead of the desired target.
With the new preprocessor define CONF_DEFAULT_TARGET, it is possible to
set the desired target architecture for the compiled crash-utility.
When cross-compiling, set the makefile variable CROSS_COMPILE
to the prefix of the cross-compiler and the default target
architecture will be deduced from it, e.g. like this:
make CROSS_COMPILE=s390x-linux-
and the default target architecture shall be S390X.
Signed-off-by: Alexander Egorenkov <egorenar-dev(a)posteo.net>
---
v2 -> v3:
* Use CROSS_COMPILE makefile variable to pass cross-compiler prefix
v1 -> v2:
* Improved commit message
* Added a note how to cross-compile crash-utilty to README
* Moved CONF_CC makefile variable to correct place location
Makefile | 53 +++++++++++++++++++++++++++++++++++++++++++++++++----
README | 5 +++++
configure.c | 39 +++------------------------------------
3 files changed, 57 insertions(+), 40 deletions(-)
diff --git a/Makefile b/Makefile
index d185719..7185dcd 100644
--- a/Makefile
+++ b/Makefile
@@ -20,15 +20,60 @@
PROGRAM=crash
#
-# Supported targets: X86 ALPHA PPC IA64 PPC64 SPARC64
+# Supported targets: X86 X86_64 IA64 ALPHA PPC PPC64 ARM ARM64 SPARC64 MIPS S390 S390X
# TARGET and GDB_CONF_FLAGS will be configured automatically by configure
#
TARGET=
GDB_CONF_FLAGS=
-ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
+ifneq ($(CROSS_COMPILE),)
+ARCH := $(shell echo $(CROSS_COMPILE) | sed 's:^.*/::g' | cut -d- -f1)
+else
+ARCH := $(shell uname -m)
+endif
+ARCH := $(shell echo $(ARCH) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
+
+CC = $(CROSS_COMPILE)gcc
+HOSTCC = gcc
+
ifeq (${ARCH}, ppc64)
-CONF_FLAGS = -m64
+CONF_FLAGS += -m64
+endif
+
+ifeq (${ARCH}, i386)
+CONF_DEFAULT_TARGET := X86
+else ifeq (${ARCH}, x86_64)
+CONF_DEFAULT_TARGET := X86_64
+else ifeq (${ARCH}, ia64)
+CONF_DEFAULT_TARGET := IA64
+else ifeq (${ARCH}, alpha)
+CONF_DEFAULT_TARGET := ALPHA
+else ifeq (${ARCH}, ppc)
+CONF_DEFAULT_TARGET := PPC
+else ifeq (${ARCH}, ppc64)
+CONF_DEFAULT_TARGET := PPC64
+else ifeq (${ARCH}, ppc64le)
+CONF_DEFAULT_TARGET := PPC64
+else ifeq (${ARCH}, arm)
+CONF_DEFAULT_TARGET := ARM
+else ifeq (${ARCH}, aarch64)
+CONF_DEFAULT_TARGET := ARM64
+else ifeq (${ARCH}, mips)
+CONF_DEFAULT_TARGET := MIPS
+else ifeq (${ARCH}, sparc64)
+CONF_DEFAULT_TARGET := SPARC64
+else ifeq (${ARCH}, s390)
+CONF_DEFAULT_TARGET := S390
+else ifeq (${ARCH}, s390x)
+CONF_DEFAULT_TARGET := S390X
+else
+$(error unsupported architecture ${ARCH})
+endif
+
+CONF_FLAGS += -DCONF_DEFAULT_TARGET=${CONF_DEFAULT_TARGET}
+
+ifneq ($(CROSS_COMPILE),)
+CONF_FLAGS += -DGDB_TARGET_DEFAULT="\"GDB_CONF_FLAGS=--host=$(shell echo $(CROSS_COMPILE) | sed -e 's:^.*/::g' -e 's/-$$//')\""
endif
#
@@ -288,7 +333,7 @@ force:
make_configure: force
@rm -f configure
- @${CC} ${CONF_FLAGS} -o configure configure.c ${WARNING_ERROR} ${WARNING_OPTIONS}
+ @${HOSTCC} ${CONF_FLAGS} -o configure configure.c ${WARNING_ERROR} ${WARNING_OPTIONS}
clean: make_configure
@./configure ${CONF_TARGET_FLAG} -q -b
diff --git a/README b/README
index bfbaef6..f5bd476 100644
--- a/README
+++ b/README
@@ -100,6 +100,11 @@
o On an x86_64 host, an x86_64 binary that can be used to analyze
ppc64le dumpfiles may be built by typing "make target=PPC64".
+ To cross-compile the crash utility, set the makefile variable CROSS_COMPILE to
+ the prefix of the cross-compiler, e.g. like this:
+
+ $ make CROSS_COMPILE=s390x-linux-
+
Traditionally when vmcores are compressed via the makedumpfile(8) facility
the libz compression library is used, and by default the crash utility
only supports libz. Recently makedumpfile has been enhanced to optionally
diff --git a/configure.c b/configure.c
index 7f6d19e..970a547 100644
--- a/configure.c
+++ b/configure.c
@@ -154,7 +154,9 @@ void add_extra_lib(char *);
#define TARGET_CFLAGS_MIPS_ON_X86_64 "TARGET_CFLAGS=-m32 -D_FILE_OFFSET_BITS=64"
#define TARGET_CFLAGS_SPARC64 "TARGET_CFLAGS="
+#ifndef GDB_TARGET_DEFAULT
#define GDB_TARGET_DEFAULT "GDB_CONF_FLAGS="
+#endif
#define GDB_TARGET_ARM_ON_X86 "GDB_CONF_FLAGS=--target=arm-elf-linux"
#define GDB_TARGET_ARM_ON_X86_64 "GDB_CONF_FLAGS=--target=arm-elf-linux CFLAGS=-m32"
#define GDB_TARGET_X86_ON_X86_64 "GDB_CONF_FLAGS=--target=i686-pc-linux-gnu CFLAGS=-m32"
@@ -349,42 +351,7 @@ get_current_configuration(struct supported_gdb_version *sp)
static char buf[512];
char *p;
-#ifdef __alpha__
- target_data.target = ALPHA;
-#endif
-#ifdef __i386__
- target_data.target = X86;
-#endif
-#ifdef __powerpc__
- target_data.target = PPC;
-#endif
-#ifdef __ia64__
- target_data.target = IA64;
-#endif
-#ifdef __s390__
- target_data.target = S390;
-#endif
-#ifdef __s390x__
- target_data.target = S390X;
-#endif
-#ifdef __powerpc64__
- target_data.target = PPC64;
-#endif
-#ifdef __x86_64__
- target_data.target = X86_64;
-#endif
-#ifdef __arm__
- target_data.target = ARM;
-#endif
-#ifdef __aarch64__
- target_data.target = ARM64;
-#endif
-#ifdef __mips__
- target_data.target = MIPS;
-#endif
-#ifdef __sparc_v9__
- target_data.target = SPARC64;
-#endif
+ target_data.target = CONF_DEFAULT_TARGET;
set_initial_target(sp);
--
2.29.2
3 years, 8 months
[PATCH] x86_64: do not process zero size exception stack
by Alexey Makhalov
There is an issue with newer Linux kernel (found on 5.9.y)
where 'bt 0' fails with:
crash> bt 0
PID: 0 TASK: ffffffff95414900 CPU: 0 COMMAND: "swapper/0"
bt: invalid size request: 0 type: "stack contents"
bt: read of stack at fffffe0000012000 failed
The reason is: readmem fails to read content of exception
stack [4]. As you can see it has correct base: fffffe0000012000,
but zero size, See reduced output of 'help -m':
stkinfo: isize: 16384
esize[7]: 4096,4096,4096,4096,0,0,0
NMI_stack_index: 1
exception_stacks:
[0]: DOUBLEFAULT
[1]: NMI
[2]: DEBUG
[3]: MCE
[4]: (unknown)
[5]: (unknown)
[6]: (unknown)
ebase[cpus][7]:
[0]: fffffe0000009000 fffffe000000b000 fffffe000000d000 fffffe000000f000
fffffe0000012000 0000000000000000 0000000000000000
>From https://www.kernel.org/doc/Documentation/x86/kernel-stacks
there are only 4 exception stacks for x86. So I'm not sure what
5th ebase ([4]) is, but its size is zero, (guard page?)
So, solution I use here is to ignore exception stack if its size
is zero.
Signed-off-by: Alexey Makhalov <amakhalov(a)vmware.com>
---
x86_64.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/x86_64.c b/x86_64.c
index fc05e8a..a8c9b2e 100644
--- a/x86_64.c
+++ b/x86_64.c
@@ -5090,7 +5090,7 @@ skip_stage:
ms->stkinfo.esize[estack];
console("x86_64_get_dumpfile_stack_frame: searching %s estack at %lx\n",
ms->stkinfo.exception_stacks[estack], bt->stackbase);
- if (!(bt->stackbase))
+ if (!(bt->stackbase) || !(ms->stkinfo.esize[estack]))
goto skip_stage;
bt->stackbuf = ms->irqstack;
alter_stackbuf(bt);
--
2.11.0
3 years, 8 months
[PATCH] printk: add support for lockless ringbuffer
by HAGIO KAZUHITO(萩尾 一仁)
From: John Ogness <john.ogness(a)linutronix.de>
Linux 5.10 introduces a new lockless ringbuffer. The new ringbuffer
is structured completely different to the previous iterations.
Add support for dumping the ringbuffer with the "log" command.
The new ringbuffer is detected based on the availability of
the "prb" symbol.
Signed-off-by: John Ogness <john.ogness(a)linutronix.de>
Signed-off-by: Kazuhito Hagio <k-hagio-ab(a)nec.com>
---
I've updated John's RFC crash patch to match 5.10-rc4 kernel.
Changes from the RFC patch:
- followed the following kernel commits
cfe2790b163a ("printk: move printk_info into separate array")
74caba7f2a06 ("printk: move dictionary keys to dev_printk_info")
f35efc78add6 ("printk: remove dict ring")
- moved the added members in offset_table and size_table to the end
of them
- print offsets and sizes with "help -o" option
- support "log -T" option
Makefile | 5 ++
defs.h | 30 ++++++++
kernel.c | 7 +-
printk.c | 255 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
symbols.c | 27 +++++++
5 files changed, 323 insertions(+), 1 deletion(-)
create mode 100644 printk.c
diff --git a/Makefile b/Makefile
index d1857190c2fb..f66eba7418d1 100644
--- a/Makefile
+++ b/Makefile
@@ -61,6 +61,7 @@ VMWARE_HFILES=vmware_vmss.h
CFILES=main.c tools.c global_data.c memory.c filesys.c help.c task.c \
kernel.c test.c gdb_interface.c configure.c net.c dev.c bpf.c \
+ printk.c \
alpha.c x86.c ppc.c ia64.c s390.c s390x.c s390dbf.c ppc64.c x86_64.c \
arm.c arm64.c mips.c sparc64.c \
extensions.c remote.c va_server.c va_server_v1.c symbols.c cmdline.c \
@@ -80,6 +81,7 @@ SOURCE_FILES=${CFILES} ${GENERIC_HFILES} ${MCORE_HFILES} \
OBJECT_FILES=main.o tools.o global_data.o memory.o filesys.o help.o task.o \
build_data.o kernel.o test.o gdb_interface.o net.o dev.o bpf.o \
+ printk.o \
alpha.o x86.o ppc.o ia64.o s390.o s390x.o s390dbf.o ppc64.o x86_64.o \
arm.o arm64.o mips.o sparc64.o \
extensions.o remote.o va_server.o va_server_v1.o symbols.o cmdline.o \
@@ -363,6 +365,9 @@ task.o: ${GENERIC_HFILES} task.c
kernel.o: ${GENERIC_HFILES} kernel.c
${CC} -c ${CRASH_CFLAGS} kernel.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+printk.o: ${GENERIC_HFILES} printk.c
+ ${CC} -c ${CRASH_CFLAGS} printk.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+
gdb_interface.o: ${GENERIC_HFILES} gdb_interface.c
${CC} -c ${CRASH_CFLAGS} gdb_interface.c ${WARNING_OPTIONS} ${WARNING_ERROR}
diff --git a/defs.h b/defs.h
index 95949507cae4..e1a18e9d0b4d 100644
--- a/defs.h
+++ b/defs.h
@@ -2106,6 +2106,28 @@ struct offset_table { /* stash of commonly-used offsets */
long irq_common_data_affinity;
long irq_desc_irq_common_data;
long uts_namespace_name;
+ long printk_info_seq;
+ long printk_info_ts_nsec;
+ long printk_info_text_len;
+ long printk_info_level;
+ long printk_info_caller_id;
+ long printk_info_dev_info;
+ long dev_printk_info_subsystem;
+ long dev_printk_info_device;
+ long prb_desc_ring;
+ long prb_text_data_ring;
+ long prb_desc_ring_count_bits;
+ long prb_desc_ring_descs;
+ long prb_desc_ring_infos;
+ long prb_desc_ring_head_id;
+ long prb_desc_ring_tail_id;
+ long prb_desc_state_var;
+ long prb_desc_text_blk_lpos;
+ long prb_data_blk_lpos_begin;
+ long prb_data_blk_lpos_next;
+ long prb_data_ring_size_bits;
+ long prb_data_ring_data;
+ long atomic_long_t_counter;
};
struct size_table { /* stash of commonly-used sizes */
@@ -2265,6 +2287,9 @@ struct size_table { /* stash of commonly-used sizes */
long xa_node;
long zram_table_entry;
long irq_common_data;
+ long printk_info;
+ long printk_ringbuffer;
+ long prb_desc;
};
struct array_table {
@@ -6697,6 +6722,11 @@ int vmware_guestdump_memory_dump(FILE *);
int calc_kaslr_offset(ulong *, ulong *);
/*
+ * printk.c
+ */
+void dump_lockless_record_log(int);
+
+/*
* gnu_binutils.c
*/
diff --git a/kernel.c b/kernel.c
index 98716372c8be..e722ff941527 100644
--- a/kernel.c
+++ b/kernel.c
@@ -5042,6 +5042,11 @@ dump_log(int msg_flags)
struct syment *nsp;
int log_wrap, loglevel, log_buf_len;
+ if (kernel_symbol_exists("prb")) {
+ dump_lockless_record_log(msg_flags);
+ return;
+ }
+
if (kernel_symbol_exists("log_first_idx") &&
kernel_symbol_exists("log_next_idx")) {
dump_variable_length_record_log(msg_flags);
@@ -5289,7 +5294,7 @@ dump_log_entry(char *logptr, int msg_flags)
}
/*
- * Handle the new variable-length-record log_buf.
+ * Handle the variable-length-record log_buf.
*/
static void
dump_variable_length_record_log(int msg_flags)
diff --git a/printk.c b/printk.c
new file mode 100644
index 000000000000..7be721853cf9
--- /dev/null
+++ b/printk.c
@@ -0,0 +1,255 @@
+#include "defs.h"
+#include <ctype.h>
+
+#define DESC_SV_BITS (sizeof(unsigned long) * 8)
+#define DESC_COMMITTED_MASK (1UL << (DESC_SV_BITS - 1))
+#define DESC_REUSE_MASK (1UL << (DESC_SV_BITS - 2))
+#define DESC_FLAGS_MASK (DESC_COMMITTED_MASK | DESC_REUSE_MASK)
+#define DESC_ID_MASK (~DESC_FLAGS_MASK)
+
+/* convenience struct for passing many values to helper functions */
+struct prb_map {
+ char *prb;
+
+ char *desc_ring;
+ unsigned long desc_ring_count;
+ char *descs;
+ char *infos;
+
+ char *text_data_ring;
+ unsigned long text_data_ring_size;
+ char *text_data;
+};
+
+static void
+init_offsets(void)
+{
+ char *n;
+
+ n = "printk_info";
+ STRUCT_SIZE_INIT(printk_info, n);
+ MEMBER_OFFSET_INIT(printk_info_seq, n, "seq");
+ MEMBER_OFFSET_INIT(printk_info_ts_nsec, n, "ts_nsec");
+ MEMBER_OFFSET_INIT(printk_info_text_len, n, "text_len");
+ MEMBER_OFFSET_INIT(printk_info_level, n, "level");
+ MEMBER_OFFSET_INIT(printk_info_caller_id, n, "caller_id");
+ MEMBER_OFFSET_INIT(printk_info_dev_info, n, "dev_info");
+
+ n = "dev_printk_info";
+ MEMBER_OFFSET_INIT(dev_printk_info_subsystem, n, "subsystem");
+ MEMBER_OFFSET_INIT(dev_printk_info_device, n, "device");
+
+ n = "printk_ringbuffer";
+ STRUCT_SIZE_INIT(printk_ringbuffer, n);
+ MEMBER_OFFSET_INIT(prb_desc_ring, n, "desc_ring");
+ MEMBER_OFFSET_INIT(prb_text_data_ring, n, "text_data_ring");
+
+ n = "prb_desc_ring";
+ MEMBER_OFFSET_INIT(prb_desc_ring_count_bits, n, "count_bits");
+ MEMBER_OFFSET_INIT(prb_desc_ring_descs, n, "descs");
+ MEMBER_OFFSET_INIT(prb_desc_ring_infos, n, "infos");
+ MEMBER_OFFSET_INIT(prb_desc_ring_head_id, n, "head_id");
+ MEMBER_OFFSET_INIT(prb_desc_ring_tail_id, n, "tail_id");
+
+ n = "prb_desc";
+ STRUCT_SIZE_INIT(prb_desc, n);
+ MEMBER_OFFSET_INIT(prb_desc_state_var, n, "state_var");
+ MEMBER_OFFSET_INIT(prb_desc_text_blk_lpos, n, "text_blk_lpos");
+
+ n = "prb_data_blk_lpos";
+ MEMBER_OFFSET_INIT(prb_data_blk_lpos_begin, n, "begin");
+ MEMBER_OFFSET_INIT(prb_data_blk_lpos_next, n, "next");
+
+ n = "prb_data_ring";
+ MEMBER_OFFSET_INIT(prb_data_ring_size_bits, n, "size_bits");
+ MEMBER_OFFSET_INIT(prb_data_ring_data, n, "data");
+
+ n = "atomic_long_t";
+ MEMBER_OFFSET_INIT(atomic_long_t_counter, n, "counter");
+}
+
+static void
+dump_record(struct prb_map *m, unsigned long id, int msg_flags)
+{
+ unsigned short text_len;
+ unsigned long state_var;
+ unsigned int caller_id;
+ unsigned char level;
+ unsigned long begin;
+ unsigned long next;
+ char buf[BUFSIZE];
+ uint64_t ts_nsec;
+ ulonglong nanos;
+ ulonglong seq;
+ int ilen = 0, i;
+ char *desc, *info, *text, *p;
+ ulong rem;
+
+ desc = m->descs + ((id % m->desc_ring_count) * SIZE(prb_desc));
+
+ /* skip non-committed record */
+ state_var = ULONG(desc + OFFSET(prb_desc_state_var) +
+ OFFSET(atomic_long_t_counter));
+ if ((state_var & DESC_FLAGS_MASK) != DESC_COMMITTED_MASK)
+ return;
+
+ info = m->infos + ((id % m->desc_ring_count) * SIZE(printk_info));
+
+ seq = ULONGLONG(info + OFFSET(printk_info_seq));
+ caller_id = UINT(info + OFFSET(printk_info_caller_id));
+ if (CRASHDEBUG(1))
+ fprintf(fp, "seq: %llu caller_id: %u\n", seq, caller_id);
+
+ text_len = USHORT(info + OFFSET(printk_info_text_len));
+
+ begin = ULONG(desc + OFFSET(prb_desc_text_blk_lpos) +
+ OFFSET(prb_data_blk_lpos_begin)) %
+ m->text_data_ring_size;
+ next = ULONG(desc + OFFSET(prb_desc_text_blk_lpos) +
+ OFFSET(prb_data_blk_lpos_next)) %
+ m->text_data_ring_size;
+
+ /* skip data-less text blocks */
+ if (begin == next)
+ goto out;
+
+ if ((msg_flags & SHOW_LOG_TEXT) == 0) {
+ ts_nsec = ULONGLONG(info + OFFSET(printk_info_ts_nsec));
+ nanos = (ulonglong)ts_nsec / (ulonglong)1000000000;
+ rem = (ulonglong)ts_nsec % (ulonglong)1000000000;
+ if (msg_flags & SHOW_LOG_CTIME) {
+ time_t t = kt->boot_date.tv_sec + nanos;
+ sprintf(buf, "[%s] ", ctime_tz(&t));
+ } else
+ sprintf(buf, "[%5lld.%06ld] ", nanos, rem/1000);
+
+ ilen += strlen(buf);
+ fprintf(fp, "%s", buf);
+ }
+
+ if (msg_flags & SHOW_LOG_LEVEL) {
+ level = UCHAR(info + OFFSET(printk_info_level)) >> 5;
+ sprintf(buf, "<%x>", level);
+ ilen += strlen(buf);
+ fprintf(fp, "%s", buf);
+ }
+
+ /* handle wrapping data block */
+ if (begin > next)
+ begin = 0;
+
+ /* skip over descriptor ID */
+ begin += sizeof(unsigned long);
+
+ /* handle truncated messages */
+ if (next - begin < text_len)
+ text_len = next - begin;
+
+ text = m->text_data + begin;
+
+ for (i = 0, p = text; i < text_len; i++, p++) {
+ if (*p == '\n')
+ fprintf(fp, "\n%s", space(ilen));
+ else if (isprint(*p) || isspace(*p))
+ fputc(*p, fp);
+ else
+ fputc('.', fp);
+ }
+
+ if (msg_flags & SHOW_LOG_DICT) {
+ text = info + OFFSET(printk_info_dev_info) +
+ OFFSET(dev_printk_info_subsystem);
+ if (strlen(text))
+ fprintf(fp, "\n%sSUBSYSTEM=%s", space(ilen), text);
+
+ text = info + OFFSET(printk_info_dev_info) +
+ OFFSET(dev_printk_info_device);
+ if (strlen(text))
+ fprintf(fp, "\n%sDEVICE=%s", space(ilen), text);
+ }
+out:
+ fprintf(fp, "\n");
+}
+
+/*
+ * Handle the lockless printk_ringbuffer.
+ */
+void
+dump_lockless_record_log(int msg_flags)
+{
+ unsigned long head_id;
+ unsigned long tail_id;
+ unsigned long kaddr;
+ unsigned long id;
+ struct prb_map m;
+
+ if (INVALID_SIZE(printk_info))
+ init_offsets();
+
+ /* setup printk_ringbuffer */
+ get_symbol_data("prb", sizeof(char *), &kaddr);
+ m.prb = GETBUF(SIZE(printk_ringbuffer));
+ if (!readmem(kaddr, KVADDR, m.prb, SIZE(printk_ringbuffer),
+ "printk_ringbuffer contents", RETURN_ON_ERROR|QUIET)) {
+ error(WARNING, "\ncannot read printk_ringbuffer contents\n");
+ goto out_prb;
+ }
+
+ /* setup descriptor ring */
+ m.desc_ring = m.prb + OFFSET(prb_desc_ring);
+ m.desc_ring_count = 1 << UINT(m.desc_ring + OFFSET(prb_desc_ring_count_bits));
+
+ kaddr = ULONG(m.desc_ring + OFFSET(prb_desc_ring_descs));
+ m.descs = GETBUF(SIZE(prb_desc) * m.desc_ring_count);
+ if (!readmem(kaddr, KVADDR, m.descs, SIZE(prb_desc) * m.desc_ring_count,
+ "prb_desc_ring contents", RETURN_ON_ERROR|QUIET)) {
+ error(WARNING, "\ncannot read prb_desc_ring contents\n");
+ goto out_descs;
+ }
+
+ kaddr = ULONG(m.desc_ring + OFFSET(prb_desc_ring_infos));
+ m.infos = GETBUF(SIZE(printk_info) * m.desc_ring_count);
+ if (!readmem(kaddr, KVADDR, m.infos, SIZE(printk_info) * m.desc_ring_count,
+ "prb_info_ring contents", RETURN_ON_ERROR|QUIET)) {
+ error(WARNING, "\ncannot read prb_info_ring contents\n");
+ goto out_infos;
+ }
+
+ /* setup text data ring */
+ m.text_data_ring = m.prb + OFFSET(prb_text_data_ring);
+ m.text_data_ring_size = 1 << UINT(m.text_data_ring + OFFSET(prb_data_ring_size_bits));
+
+ kaddr = ULONG(m.text_data_ring + OFFSET(prb_data_ring_data));
+ m.text_data = GETBUF(m.text_data_ring_size);
+ if (!readmem(kaddr, KVADDR, m.text_data, m.text_data_ring_size,
+ "prb_text_data_ring contents", RETURN_ON_ERROR|QUIET)) {
+ error(WARNING, "\ncannot read prb_text_data_ring contents\n");
+ goto out_text_data;
+ }
+
+ /* ready to go */
+
+ tail_id = ULONG(m.desc_ring + OFFSET(prb_desc_ring_tail_id) +
+ OFFSET(atomic_long_t_counter));
+ head_id = ULONG(m.desc_ring + OFFSET(prb_desc_ring_head_id) +
+ OFFSET(atomic_long_t_counter));
+
+ hq_open();
+
+ for (id = tail_id; id != head_id; id = (id + 1) & DESC_ID_MASK)
+ dump_record(&m, id, msg_flags);
+
+ /* dump head record */
+ dump_record(&m, id, msg_flags);
+
+ hq_close();
+
+out_text_data:
+ FREEBUF(m.text_data);
+out_infos:
+ FREEBUF(m.infos);
+out_descs:
+ FREEBUF(m.descs);
+out_prb:
+ FREEBUF(m.prb);
+}
diff --git a/symbols.c b/symbols.c
index b2f4eb5402d1..a51078d58e6b 100644
--- a/symbols.c
+++ b/symbols.c
@@ -10426,6 +10426,30 @@ dump_offset_table(char *spec, ulong makestruct)
OFFSET(log_level));
fprintf(fp, " log_flags_level: %ld\n",
OFFSET(log_flags_level));
+
+ fprintf(fp, " printk_info_seq: %ld\n", OFFSET(printk_info_seq));
+ fprintf(fp, " printk_info_ts_nseq: %ld\n", OFFSET(printk_info_ts_nsec));
+ fprintf(fp, " printk_info_text_len: %ld\n", OFFSET(printk_info_text_len));
+ fprintf(fp, " printk_info_level: %ld\n", OFFSET(printk_info_level));
+ fprintf(fp, " printk_info_caller_id: %ld\n", OFFSET(printk_info_caller_id));
+ fprintf(fp, " printk_info_dev_info: %ld\n", OFFSET(printk_info_dev_info));
+ fprintf(fp, " dev_printk_info_subsystem: %ld\n", OFFSET(dev_printk_info_subsystem));
+ fprintf(fp, " dev_printk_info_device: %ld\n", OFFSET(dev_printk_info_device));
+ fprintf(fp, " prb_desc_ring: %ld\n", OFFSET(prb_desc_ring));
+ fprintf(fp, " prb_text_data_ring: %ld\n", OFFSET(prb_text_data_ring));
+ fprintf(fp, " prb_desc_ring_count_bits: %ld\n", OFFSET(prb_desc_ring_count_bits));
+ fprintf(fp, " prb_desc_ring_descs: %ld\n", OFFSET(prb_desc_ring_descs));
+ fprintf(fp, " prb_desc_ring_infos: %ld\n", OFFSET(prb_desc_ring_infos));
+ fprintf(fp, " prb_desc_ring_head_id: %ld\n", OFFSET(prb_desc_ring_head_id));
+ fprintf(fp, " prb_desc_ring_tail_id: %ld\n", OFFSET(prb_desc_ring_tail_id));
+ fprintf(fp, " prb_desc_state_var: %ld\n", OFFSET(prb_desc_state_var));
+ fprintf(fp, " prb_desc_text_blk_lpos: %ld\n", OFFSET(prb_desc_text_blk_lpos));
+ fprintf(fp, " prb_data_blk_lpos_begin: %ld\n", OFFSET(prb_data_blk_lpos_begin));
+ fprintf(fp, " prb_data_blk_lpos_next: %ld\n", OFFSET(prb_data_blk_lpos_next));
+ fprintf(fp, " prb_data_ring_size_bits: %ld\n", OFFSET(prb_data_ring_size_bits));
+ fprintf(fp, " prb_data_ring_data: %ld\n", OFFSET(prb_data_ring_data));
+ fprintf(fp, " atomit_long_t_counter: %ld\n", OFFSET(atomic_long_t_counter));
+
fprintf(fp, " sched_rt_entity_my_q: %ld\n",
OFFSET(sched_rt_entity_my_q));
fprintf(fp, " task_group_parent: %ld\n",
@@ -10850,6 +10874,9 @@ dump_offset_table(char *spec, ulong makestruct)
SIZE(xarray));
fprintf(fp, " xa_node: %ld\n",
SIZE(xa_node));
+ fprintf(fp, " printk_info: %ld\n", SIZE(printk_info));
+ fprintf(fp, " printk_ringbuffer: %ld\n", SIZE(printk_ringbuffer));
+ fprintf(fp, " prb_desc: %ld\n", SIZE(prb_desc));
fprintf(fp, "\n array_table:\n");
3 years, 9 months
[PATCH] netdump: bugfix for read elf header
by Qianli Zhao
From: Qianli Zhao <zhaoqianli(a)xiaomi.com>
Without the patch,errors may occur in reading the ELF header,
causing the parsing to fail.
Signed-off-by: Qianli Zhao <zhaoqianli(a)xiaomi.com>
---
When i use crash to parsing a kdump,i got below error.
This error occurs because of the read header less then SAFE_NETDUMP_ELF_HEADER_SIZE,
But can read MIN_NETDUMP_ELF_HEADER_SIZE bytes from the file correctly.
this issue is introduced due to commit:f42db6a33f0e0652df7cce8506352745b4794287
crash 7.2.9
Copyright (C) 2002-2020 Red Hat, Inc.
Copyright (C) 2004, 2005, 2006, 2010 IBM Corporation
Copyright (C) 1999-2006 Hewlett-Packard Co
Copyright (C) 2005, 2006, 2011, 2012 Fujitsu Limited
Copyright (C) 2006, 2007 VA Linux Systems Japan K.K.
Copyright (C) 2005, 2011 NEC Corporation
Copyright (C) 1999, 2002, 2007 Silicon Graphics, Inc.
Copyright (C) 1999, 2000, 2001, 2002 Mission Critical Linux, Inc.
This program is free software, covered by the GNU General Public License,
and you are welcome to change it and/or distribute copies of it under
certain conditions. Enter "help copying" to see the conditions.
This program has absolutely no warranty. Enter "help warranty" for details.
/var/tmp/ramdump_elf_B2R4cQ: ELF header read: No such file or directory
crash: malformed ELF file: /var/tmp/ramdump_elf_B2R4cQ
Usage:
crash [OPTION]... NAMELIST MEMORY-IMAGE[@ADDRESS] (dumpfile form)
crash [OPTION]... [NAMELIST] (live system form)
Enter "crash -h" for details.
---
netdump.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/netdump.c b/netdump.c
index c76d9dd..cb0af41 100644
--- a/netdump.c
+++ b/netdump.c
@@ -142,7 +142,7 @@ is_netdump(char *file, ulong source_query)
if (!read_flattened_format(fd, 0, eheader, size))
goto bailout;
} else {
- if (read(fd, eheader, size) != size) {
+ if (read(fd, eheader, size) < MIN_NETDUMP_ELF_HEADER_SIZE) {
sprintf(buf, "%s: ELF header read", file);
perror(buf);
goto bailout;
--
2.7.4
3 years, 9 months
[PATCH] arm64: update mapping symbol filter in arm64_verify_symbol
by Qianli Zhao
From: Qianli Zhao <zhaoqianli(a)xiaomi.com>
Name Meaning of mapping symbol:
$x
$x.<any...>
Start of a sequence of A64 instructions
$c
$c.<any...>
Start of a sequence of C64 instructions
$d
$d.<any...>
Start of a sequence of data items (for example, a literal pool)
Reference documents:
https://documentation-service.arm.com/static/5f9a92f6b1a7c5445f28fee6?token=
Signed-off-by: Qianli Zhao <zhaoqianli(a)xiaomi.com>
---
When use crash-arm64 parsing kdump,"dis" command can not completely parse out the disassembly code(aarch64-objdump is ok),miss some assembly code at the end,such as below:
The queued_spin_lock_slowpath() actual code segment of the function is from 0xffffffdf44b80d48 to ffffffecc41591d4,but "dis" command only dump from 0xffffffdf44b80d48 to 0xffffffdf44b80df0.
crash> dis queued_spin_lock_slowpath
0xffffffdf44b80d48 <$x.1>: str x30, [x18],#8
0xffffffdf44b80d4c <queued_spin_lock_slowpath+4>: stp x29, x30, [sp,#-64]!
....
0xffffffdf44b80dec <queued_spin_lock_slowpath+164>: cbnz w10, 0xffffffdf44b80e9c
0xffffffdf44b80df0 <queued_spin_lock_slowpath+168>: nop
The reason for the issue is that crash-tool thinks next vaild symbol is $x.3,but $x.* is a mapping symbol defined by ARM,this type of symbol needs skip.
ffffffdf44b80d48 (T) queued_spin_lock_slowpath
ffffffdf44b80df4 (t) $x.3
ffffffdf44b80dfc (t) $x.5
ffffffdf44b80e24 (t) $x.7
ffffffdf44b80e2c (t) $x.9
ffffffdf44b80f6c (t) $x.13
ffffffdf44b80f74 (t) $x.15
ffffffdf44b8102c (t) $x.19
ffffffdf44b81034 (t) $x.21
ffffffdf44b810e8 (t) $x.7
ffffffdf44b810e8 (T) rt_mutex_adjust_pi
ffffffdf44b8118c (t) $x.8
This issue will mislead us to analyze assembly issue:
[20332.505051] Call trace:
[20332.505057] queued_spin_lock_slowpath+0x198/0x3a0---->//Beyond code segment?
[20332.505063] do_raw_spin_lock+0x10c/0x12c
[20332.505071] _raw_spin_lock_irqsave+0x3c/0x50
[20332.505080] set_dspp_hist_irq_feature+0x180/0x1d4
[20332.505089] sde_cp_crtc_setfeature+0x168/0x2f4
[20332.505095] sde_cp_crtc_apply_properties+0x46c/0x76c
[20332.505102] sde_crtc_atomic_begin+0x490/0x62c
[20332.505111] drm_atomic_helper_commit_planes+0x5c/0x2bc
[20332.505117] complete_commit+0xa0/0x264
[20332.505123] _msm_drm_commit_work_cb+0x128/0x22c
[20332.505130] kthread_worker_fn+0x110/0x1ac
[20332.505136] kthread+0x160/0x170
[20332.505143] ret_from_fork+0x10/0x18
Reference documents(page 7):
https://documentation-service.arm.com/static/5f9a92f6b1a7c5445f28fee6?token=
---
arm64.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arm64.c b/arm64.c
index fdf77bd..24fd91e 100644
--- a/arm64.c
+++ b/arm64.c
@@ -510,9 +510,11 @@ arm64_verify_symbol(const char *name, ulong value, char type)
((type == 'a') || (type == 'n') || (type == 'N') || (type == 'U')))
return FALSE;
- if (STREQ(name, "$d") || STREQ(name, "$x"))
+ if (STREQ(name, "$d") || STRNEQ(name, "$d.") ||
+ STREQ(name, "$x") || STRNEQ(name, "$x.") ||
+ STREQ(name, "$c") || STRNEQ(name, "$c."))
return FALSE;
-
+
if ((type == 'A') && STRNEQ(name, "__crc_"))
return FALSE;
--
2.7.4
3 years, 9 months
[PATCH] Clear ununsed exception stack base
by samuelliao(廖生苗)
SEV-ES code may fill the 4th ist to VC_stack, but crash-util has no
support for #VC frames. It break backtrace due the zero-size stack.
So clear all unused stack base to workaround it.
Signed-off-by: samuelliao <samuelliao(a)samuelliao.com>
---
x86_64.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/x86_64.c b/x86_64.c
index 939c8a9..382cff1 100644
--- a/x86_64.c
+++ b/x86_64.c
@@ -1462,7 +1462,10 @@ x86_64_ist_init(void)
for (i = 0; i < MAX_EXCEPTION_STACKS; i++) {
if (ms->stkinfo.ebase[c][i] == 0)
continue;
- ms->stkinfo.ebase[c][i] -= ms->stkinfo.esize[i];
+ if(ms->stkinfo.esize[i] == 0)
+ ms->stkinfo.ebase[c][i] = 0;
+ else
+ ms->stkinfo.ebase[c][i] -= ms->stkinfo.esize[i];
}
}
--
2.18.4
3 years, 9 months
[PATCH] Add support lockless printk ringbuffer
by samuelliao(廖生苗)
Kernel 5.10 introduce new lockless printk ringbuffer.
This patch dump the new log record, with:
1. treat caller_id as dict info
2. no dev_info support, because no user yet
3. only 5.10 finalized format, not intermit impl in git-tree
This patch unified vmcore & symbol version:
1. vmcore version pre-read prb ptr value
2. pass desired readmem addrtype
https://github.com/crash-utility/crash/pull/71
3 years, 9 months
[ANNOUNCE] crash-7.2.9 is available
by HAGIO KAZUHITO(萩尾 一仁)
Download from: https://crash-utility.github.io/
or
https://github.com/crash-utility/crash/releases
The github master branch serves as a development branch that will contain
all patches that are queued for the next release:
$ git clone git://github.com/crash-utility/crash.git
Changelog:
- Fix for an ARM64 gcc-10 compilation error. Without the patch, the
build of the embedded gdb module fails with an error message that
indicates "multiple definition of 'tdesc_aarch64'".
(anderson(a)redhat.com)
- Fix for the "log" command. Without the patch, the command's output
may be truncated, ending with the error message "log: invalid log_buf
entry encountered".
(chenqiwu(a)xiaomi.com)
- Fix to allow the translation of ARM64 FIXMAP addresses located in
the virtual memory region between the end of the vmalloc region and
the beginning of the vmemmap region. Without the patch, reads of
virtual addresses within that region are not recognized properly
and will fail.
(zhaoqianli(a)xiaomi.com)
- 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(a)laoqinren.net)
- Fix for the "bpf -m|-M" options on Linux 5.3 and later kernels that
contain commit 3539b96e041c06e4317082816d90ec09160aeb11, titled
"bpf: group memory related fields in struct bpf_map_memory". Without
the patch, the options prints "(unknown)" for MEMLOCK and UID.
(k-hagio-ab(a)nec.com)
- Enhancement to the "bpf -p|-P" options to display the eBPF program
name string.
(k-hagio-ab(a)nec.com)
- Fix for reading compressed kdump dumpfiles from systems with physical
memory located at extraordinarily high addresses. In a system with
a physical address range from 0x602770ecf000 to 0x6027ffffffff, the
crash utility fails during session initialization due to an integer
overflow, ending with the error message "crash: vmlinux and vmcore
do not match!".
(chenjialong(a)huawei.com)
- Enhancement of the "struct -r" option to support the raw memory
display of a single data structure member. Without the patch, the
option only supported the raw display of a complete data structure.
(asmadeus(a)codewreck.org)
- Modify the display behavior of the "struct -r" option so as to scale
the minimum display size from the size of a per-architecture long
(32-bits or 64-bits) down to 8-bits, 16-bits or 32-bits when the
requested size is equal to one of the smaller sizes.
(asmadeus(a)codewreck.org)
- 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 is incorporated into the
kernel.
(anderson(a)redhat.com)
- Fix for "kmem -[sS]" options on Linux 4.14 and later kernels built
with CONFIG_SLAB_FREELIST_HARDENED enabled. Without the patch, there
will error messages of the type "kmem: <cache name> slab: <address>
invalid freepointer: <obfuscated address>" for caches created during
SLUB bootstrap, as they are likely to have s->random == 0.
(hbathini(a)linux.ibm.com)
- If readmem() receives a user-space address in a page that has been
swapped to the zswap compressed swap cache, an attempt will be made
to find and decompress the page.
(zhaoqianli(a)xiaomi.com)
- Fix for the "mount -n [pid|task]" option when running on a live
system. Without the patch, if the [pid|task] has been created since
the last internal task table refresh, the command fails with the
error message "mount: invalid task or pid value: <value>".
(w(a)laoqinren.net)
- Introduction of the "log -T" option, which translates the leading
timestamp value of each message into human readable format.
(w(a)laoqinren.net)
- When kernels are built with LLVM, the names of many symbols may be
appended with an ".llvm.<number>" string. As a result, commands
such as "irq" fail with the error message irq: neither irq_desc,
_irq_desc, irq_desc_ptrs or irq_desc_tree symbols exist". This
patch adds the LLVM-generated string to the other strings that are
stripped from symbols before they are stored.
(zhaoqianli(a)xiaomi.com)
- Prepare for the introduction of ARM64 8.3 Pointer Authentication
as in-kernel feature. The value of CONFIG_ARM64_KERNELPACMASK
will be exported as a vmcoreinfo entry, and will be used with text
return addresses on the kernel stack.
(amit.kachhap(a)arm.com)
- Several fixes for ARM64 kernels:
(1) Linux kernel patch "arm64: mm: Introduce vabits_actual"
introduced "physvirt_offset", which is not equal to
(PHYS_OFFSET - PAGE_OFFSET) when KASLR is enabled.
physvirt_offset is caculated in arch/arm64/mm/init.c
before memstart_addr (PHYS_OFFSET) is randomized. Let
arm64_VTOP() and arm64_PTOV() use physvirt_offset instead,
whose default value is set to (phys_offset - page_offset)
(2) For ARM64 RAM dumps without any vmcoreinfo and KASLRpassed as
argument, " _stext_vmlinux" is not set. This causes incorrect
calculation of vmalloc_start with VA_BITS_ACTUAL.
(3) For ARM64 RAM dumps For ramdumps without vmcoreinfo, get
CONFIG_ARM64_VA_BITS from in-kernel config. Without this,
vmemmap size is calculated incorrectly.
(4) Fix the vmemmap_start to match with what the kernel uses.
(vinayakm.list(a)gmail.com)
- Replace people.redhat.com references with github equivalents.
(anderson(a)redhat.com)
- Implement support for user-space zram reads on x86_64 for recent
Fedora kernel version 5.6.7-200.fc31. The patch adds the following:
(1) Redefine _PFN_BITS() macro to use MAX_POSSIBLE_PHYSMEM_BITS.
(2) Fix to determine whether address_space.i_pages is a radix tree
or an xarray.
(3) Fix to not mistakenly select the "lzo" compressor when the
kernel has used the default "lzo-rle" compressor.
(4) Since zram may be provided as a kernel module, it would be
necessary to load its debuginfo during the crash session;
therefore perform the zram structure-size/member-offset
initializations when first required instead of during
session initialization.
(5) Handle the zram_table_entry structure member name change
from "value" to "flags".
(d.hatayama(a)jp.fujitsu.com)
- Add support for 1GB huge pages to "vtop" command on x86_64. Without
this patch, the command with a user virtual address corresponding to
a 1GB huge page fails with the error message "vtop: seek error:
physical address: <address> type: "page table".
(lirongqing(a)baidu.com, chukaiping(a)foxmail.com)
- Fix six spelling typos in help.c.
(standby24x7(a)gmail.com)
- Change tcr_el1_t1sz vmcoreinfo entry name to TCR_EL1_T1SZ according
to kernel commit bbdbc11804ff ("arm64/crash_core: Export TCR_EL1.T1SZ
in vmcoreinfo").
(bhsharma(a)redhat.com)
- Fix for a failure of calculating kaslr_offset due to an sadump format
restriction. Without the patch set, calculating kaslr_offset fails
because it is based on the assumption that unused part of register
values in the sadump format are always zero cleared.
(d.hatayama(a)fujitsu.com)
- Support for huge holes in vmem of VMware VMSS dumpfiles. Without the
patch, if the hole is big enough, the multiplication by page size
will truncate as it's operating on a uint32_t.
(minipli(a)grsecurity.net)
- Beautify and extend debug log for VMware VMSS dumpfiles. Without the
patch, the parser's debug log is missing a few line breaks as well as
some crucial information, like control register dumps.
(minipli(a)grsecurity.net)
- Support core files with unusual layout that the ELF program headers
do not directly follow the ELF header, such as vmcores generated with
'vmss2core' tool.
(minipli(a)grsecurity.net)
- Fix for the "log -T" option when crash is started with "--minimal"
option. Without the patch, crash will spin at 100% and continuously
crash at a divide by zero. Disallow the option in minimal mode.
(dwysocha(a)redhat.com)
- Remove raw-view from s390bpf. With kernel commit ecb1ff6833c4
("s390/debug: remove raw view"), the raw-view is no longer supported
by s390 debug feature. Since there has never been a single user of
the raw-view, remove it from crash as well.
(zaslonko(a)linux.ibm.com)
- Support s390 debug feature version 3, which was introduced by kernel
commit 0990d836cecb ("s390/debug: debug feature version 3").
(zaslonko(a)linux.ibm.com)
- Basic support for PaX's split module layout. PaX and grsecurity
kernels split module memory into dedicated r/x and r/w mappings using
'*_rw' and '*_rx' named member variables in 'struct module'. To add
basic support for such kernels, detect the split layout by testing
for the corresponding structure members and use these instead.
(minipli(a)grsecurity.net)
- Fix for the "kmem -i" option on Linux 5.9-rc1 and later kernels that
contain commit 1008fe6dc36d ("block: remove the all_bdevs list").
Without the patch, the option fails halfway with the error message
'kmem: cannot resolve: "all_bdevs"'.
(k-hagio-ab(a)nec.com)
- Fix for the "irq -a" option on Linux 4.3 or later kernels that
contain commit 9df872faa7e1 ("genirq: Move field 'affinity' from
irq_data into irq_common_data"). Without the patch, the option
cannot work with the message "irq: -a option not supported or
applicable on this architecture or kernel".
(k-hagio-ab(a)nec.com)
- Append time zone explicitly to each output of date and time like
"DATE: Thu Nov 29 06:44:02 JST 2018".
(k-hagio-ab(a)nec.com)
- Fixes for the "trace.so" extension module on Linux 5.6 and later
kernels that contain commit:
(1) 1c5eb4481e01 ("tracing: Rename trace_buffer to array_buffer")
(2) 13292494379f ("tracing: Make struct ring_buffer less ambiguous")
With the patch set, rename trace_buffer to array_buffer and
ring_buffer to trace_buffer respectively.
(valentin.schneider(a)arm.com)
- Fix for the "help -D" option listing uninteresting register entries
for SADUMP dumpfiles.
(d.hatayama(a)fujitsu.com)
- Fix for an initialization-time failure due to offset change of the
name member of struct uts_namespace that might be introduced by
linux-next commit 9a56493f6942 ("uts: Use generic ns_common::count").
(egorenar(a)linux.ibm.com)
- Add support for VMware guestdump (debug.guest) and vmem (debug.vmem)
files. To use, the companion debug.vmem file must be present in the
same directory as the debug.guest file.
(amakhalov(a)vmware.com)
- Fix for the "extend" command on a PPC64 targeted x86_64 crash binary.
Without the patch, the command on an x86_64 crash binary that can be
used to analyze ppc64le dumpfiles fails with the error message
"extend: <path to extension>: not an ELF format object".
(aeasi.linux(a)gmail.com, k-hagio-ab(a)nec.com)
- Fix for a failure to match arm/aarch64 ELF format of xendump file.
(goodbach(a)gmail.com)
- Fix for the x86_64 "bt" command in cases where the pt_regs is not
present in the stack. Without the patch, the command can be
incomplete with the error message 'bt: seek error: kernel virtual
address: <address> type: "pt_regs"'.
(dmair(a)suse.com)
- Fix for the crash.ko memory driver build with Linux 5.8 and later
kernels that contain commit fe557319aa06 ("maccess: rename
probe_kernel_{read,write} to copy_{from,to}_kernel_nofault").
Additionally, due to commit 0493cb086353 ("maccess: unexport
probe_kernel_write()"), writing kernel memory is no longer possible
from a module. Without this patch, build with the kernels fails
with the error message "error: implicit declaration of function
'probe_kernel_write'".
(ptesarik(a)suse.com)
- Fix for the memory_driver/Makefile for Linux 5.4 and later kernels
that contain commit 7e35b42591c0 ("kbuild: remove SUBDIRS support").
Without the patch, the "make" command in the memory_driver directory
doesn't build crash memory driver module as expected.
(k-hagio-ab(a)nec.com)
- Improvements of KASLR offset detection for QEMU, VMware VMSS and
SADUMP dumpfiles:
(1) Try all CPUs to provide CR3 and IDTR, because these registers
on CPU0 can be not initialized or clobbered.
(2) Support 5-level page table by using LA57 bit in CR4.
(3) Get KASLR offset by walking page tree.
(amakhalov(a)vmware.com)
- Fix for an initialization-time failure with QEMU dumpfiles with Linux
5.8 and later x86_64 kernels that contain commit 9d06c4027f21
("x86/entry: Convert Divide Error to IDTENTRY"), renamed divide_error
handler to asm_exc_divide_error.
(nborisov(a)suse.com)
- Fix for several compiler warnings on 32-bit architectures when
building with "make warn". Without the patch, gcc generates the
message "warning: format '%ld' expects argument of type 'long int',
but argument 4 has type 'uint64_t' [-Wformat=]" and similar ones as
a result of crash commit 3fedbee9bfbb ("vmware_guestdump: new input
format").
(k-hagio-ab(a)nec.com)
- Speed up session initialization by avoiding unnecessary processing
in the stkptr_to_task() function when sp is 0 on some architectures.
Without the patch, as it runs through each task's stack to find
whether the given address is in its range, on a system with about
1500 CPUs and 165k running tasks, it takes about a day to finish
session initialization. With the patch applied, it only takes about
5-10 minutes.
(hbathini(a)linux.ibm.com)
3 years, 9 months
Re: [Crash-utility] [PATCH] task.c: avoid unnecessary cpu cycles during init
by lijiang
在 2020年11月17日 01:00, crash-utility-request(a)redhat.com 写道:
>> While stkptr_to_task does the job of trying to match a stack pointer
>> to a task, it runs through each task's stack to find whether the given
>> SP falls into its range. This can be a very expensive operation, if
>> the vmcore is from a system running too many tasks. It can get even
>> worse when the total number of CPUs on the system is in the order of
>> thousands. Given the expensive nature of the operation, it must be
>> optimized as much as possible. Possible options to optimize:
>>
>> 1) Get min & max of the stack range in first pass and use these
>> values against the given SP to decide whether or not to proceed
>> with stack lookup.
>> 2) Use multithreading to parallely update irq_tasks.
>> 3) Skip stkptr_to_task() when SP is 0
>>
>> Though option 3 is a low hanging fruit, it significantly improved the
>> time taken between starting crash utility & reaching crash prompt.
>> Implement option 3 to optimize while listing the other two options
>> as TODO items for follow-up.
> It looks like on x86_64 the stkptr_to_task() is not called when starting
> session and I cannot test, but the patch looks safe enough.
>
> Acked-by: Kazuhito Hagio <k-hagio-ab(a)nec.com>
>
> Lianbo, Bhupesh, this is not a fix but huge improvement for some
> machines or situations, so I'd like to pick it up for crash-7.2.9.
Agree with you, this improvement looks good.
> Could you ack this? and my patch for the compiler warnings?
>
Yes. After applying your patch, it doesn't reproduce any more.
Good findings, Kazu.
Thanks.
Lianbo
> Thanks,
> Kazu
>
3 years, 9 months