Compare commits

...

No commits in common. "c8" and "c10s" have entirely different histories.
c8 ... c10s

37 changed files with 2875 additions and 2475 deletions

56
.gitignore vendored
View File

@ -1,2 +1,54 @@
SOURCES/crash-8.0.4.tar.gz
SOURCES/gdb-10.2.tar.gz
crash-4.0-8.11.tar.gz
crash-4.0.9.tar.gz
crash-5.0.6.tar.gz
/crash-5.1.2.tar.gz
/crash-5.1.5.tar.gz
/crash-5.1.7.tar.gz
/crash-5.1.8.tar.gz
/crash-6.0.0.tar.gz
/crash-6.0.2.tar.gz
/crash-6.0.5.tar.gz
/crash-6.0.6.tar.gz
/crash-6.0.8.tar.gz
/crash-6.0.9.tar.gz
/crash-6.1.0.tar.gz
/crash-6.1.1.tar.gz
/crash-6.1.2.tar.gz
/crash-6.1.4.tar.gz
/crash-6.1.6.tar.gz
/crash-7.0.1.tar.gz
/crash-7.0.2.tar.gz
/crash-7.0.3.tar.gz
/crash-7.0.4.tar.gz
/crash-7.0.5.tar.gz
/crash-7.0.7.tar.gz
/crash-7.0.8.tar.gz
/crash-7.0.9.tar.gz
/crash-7.1.0.tar.gz
/crash-7.1.1.tar.gz
/crash-7.1.2.tar.gz
/crash-7.1.3.tar.gz
/crash-7.1.4.tar.gz
/crash-7.1.5.tar.gz
/crash-7.1.6.tar.gz
/crash-7.1.7.tar.gz
/crash-7.1.8.tar.gz
/crash-7.1.9.tar.gz
/crash-7.2.0.tar.gz
/crash-7.2.1.tar.gz
/crash-7.2.3.tar.gz
/crash-7.2.4.tar.gz
/crash-7.2.5.tar.gz
/crash-7.2.6.tar.gz
/crash-7.2.7.tar.gz
/crash-7.2.8.tar.gz
/crash-7.2.9.tar.gz
/crash-7.3.0.tar.gz
/crash-8.0.0.tar.gz
/crash-8.0.1.tar.gz
/crash-8.0.2.tar.gz
/crash-8.0.3.tar.gz
/crash-8.0.4.tar.gz
/crash-8.0.5.tar.gz
/gdb-7.6.tar.gz
/gdb-10.2.tar.gz

View File

@ -0,0 +1,492 @@
From a584e9752fb2198c7f6d0130d8a94b17581f33c6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Yulong=20TANG=20=E6=B1=A4=E7=8E=89=E9=BE=99?=
<yulong.tang@nio.com>
Date: Tue, 20 Feb 2024 15:09:49 +0800
Subject: [PATCH 1/9] Adding the zram decompression algorithm "lzo-rle"
Port the improved decompression method for "lzo" in the kernel to
support decompression of "lzorle".
Since Linux 5.1, the default compression algorithm for zram was changed
from "lzo" to "lzo-rle". The crash-utility only supports decompression
for "lzo", when parsing vmcore files that utilize zram compression, such
as when using the gcore command to detach process core dump files,
parsing cannot be completed successfully.
before:
crash> gcore -v 0 1
gcore: WARNING: only the lzo compressor is supported
gcore: WARNING: only the lzo compressor is supported
gcore: WARNING: only the lzo compressor is supported
gcore: WARNING: only the lzo compressor is supported
after:
crash> gcore -v 0 1
Saved core.1.init
Signed-off-by: yulong.tang <yulong.t...@nio.com>
Reviewed-by: Tao Liu <l...@redhat.com>
Signed-off-by: Kazuhito Hagio <k-hagio...@nec.com>
---
Makefile | 13 +-
diskdump.c | 3 +
lzorle_decompress.c | 295 ++++++++++++++++++++++++++++++++++++++++++++
lzorle_decompress.h | 75 +++++++++++
4 files changed, 383 insertions(+), 3 deletions(-)
create mode 100644 lzorle_decompress.c
create mode 100644 lzorle_decompress.h
diff --git a/Makefile b/Makefile
index 9e97313..60dad18 100644
--- a/Makefile
+++ b/Makefile
@@ -60,6 +60,7 @@ SADUMP_HFILES=sadump.h
UNWIND_HFILES=unwind.h unwind_i.h rse.h unwind_x86.h unwind_x86_64.h
VMWARE_HFILES=vmware_vmss.h
MAPLE_TREE_HFILES=maple_tree.h
+LZORLE_HFILES=lzorle_decompress.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 \
@@ -74,12 +75,14 @@ CFILES=main.c tools.c global_data.c memory.c filesys.c help.c task.c \
xen_hyper.c xen_hyper_command.c xen_hyper_global_data.c \
xen_hyper_dump_tables.c kvmdump.c qemu.c qemu-load.c sadump.c ipcs.c \
ramdump.c vmware_vmss.c vmware_guestdump.c \
- xen_dom0.c kaslr_helper.c sbitmap.c maple_tree.c
+ xen_dom0.c kaslr_helper.c sbitmap.c maple_tree.c \
+ lzorle_decompress.c
SOURCE_FILES=${CFILES} ${GENERIC_HFILES} ${MCORE_HFILES} \
${REDHAT_CFILES} ${REDHAT_HFILES} ${UNWIND_HFILES} \
${LKCD_DUMP_HFILES} ${LKCD_TRACE_HFILES} ${LKCD_OBSOLETE_HFILES}\
- ${IBM_HFILES} ${SADUMP_HFILES} ${VMWARE_HFILES} ${MAPLE_TREE_HFILES}
+ ${IBM_HFILES} ${SADUMP_HFILES} ${VMWARE_HFILES} ${MAPLE_TREE_HFILES} \
+ ${LZORLE_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 \
@@ -94,7 +97,8 @@ OBJECT_FILES=main.o tools.o global_data.o memory.o filesys.o help.o task.o \
xen_hyper.o xen_hyper_command.o xen_hyper_global_data.o \
xen_hyper_dump_tables.o kvmdump.o qemu.o qemu-load.o sadump.o ipcs.o \
ramdump.o vmware_vmss.o vmware_guestdump.o \
- xen_dom0.o kaslr_helper.o sbitmap.o maple_tree.o
+ xen_dom0.o kaslr_helper.o sbitmap.o maple_tree.o \
+ lzorle_decompress.o
MEMORY_DRIVER_FILES=memory_driver/Makefile memory_driver/crash.c memory_driver/README
@@ -546,6 +550,9 @@ bpf.o: ${GENERIC_HFILES} bpf.c
maple_tree.o: ${GENERIC_HFILES} ${MAPLE_TREE_HFILES} maple_tree.c
${CC} -c ${CRASH_CFLAGS} maple_tree.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+lzorle_decompress.o: lzorle_decompress.c
+ ${CC} -c ${CRASH_CFLAGS} lzorle_decompress.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+
${PROGRAM}: force
@$(MAKE) all
diff --git a/diskdump.c b/diskdump.c
index 3ae7bf2..4a473e1 100644
--- a/diskdump.c
+++ b/diskdump.c
@@ -28,6 +28,7 @@
#include "xen_dom0.h"
#include "vmcore.h"
#include "maple_tree.h"
+#include "lzorle_decompress.h"
#define BITMAP_SECT_LEN 4096
@@ -3069,6 +3070,8 @@ try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong
" with lzo library\n");
return 0;
#endif
+ } else if (STREQ(name, "lzo-rle")) {
+ decompressor = (void *)&lzorle_decompress_safe;
} else { /* todo: support more compressor */
error(WARNING, "only the lzo compressor is supported\n");
return 0;
diff --git a/lzorle_decompress.c b/lzorle_decompress.c
new file mode 100644
index 0000000..6c810ea
--- /dev/null
+++ b/lzorle_decompress.c
@@ -0,0 +1,295 @@
+/* lzorle_decompress.h
+ *
+ * from kernel lib/lzo/lzo1x_decompress_safe.c
+ *
+ * Copyright (C) 1996-2012 Markus F.X.J. Oberhumer <mar...@oberhumer.com>
+ * Copyright (C) 2024 NIO
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include "defs.h"
+#include "lzorle_decompress.h"
+
+/* This MAX_255_COUNT is the maximum number of times we can add 255 to a base
+ * count without overflowing an integer. The multiply will overflow when
+ * multiplying 255 by more than MAXINT/255. The sum will overflow earlier
+ * depending on the base count. Since the base count is taken from a u8
+ * and a few bits, it is safe to assume that it will always be lower than
+ * or equal to 2*255, thus we can always prevent any overflow by accepting
+ * two less 255 steps. See Documentation/lzo.txt for more information.
+ */
+#define MAX_255_COUNT ((((ulong)~0) / 255) - 2)
+
+static inline uint16_t get_unaligned_le16 (const uint8_t *p) {
+ return p[0] | p[1] << 8;
+}
+
+int lzorle_decompress_safe(const unsigned char *in, ulong in_len,
+ unsigned char *out, ulong *out_len, void *other/* NOT USED */) {
+ unsigned char *op;
+ const unsigned char *ip;
+ ulong t, next;
+ ulong state = 0;
+ const unsigned char *m_pos;
+ const unsigned char * const ip_end = in + in_len;
+ unsigned char * const op_end = out + *out_len;
+
+ unsigned char bitstream_version;
+
+ static int efficient_unaligned_access = -1;
+
+ if (efficient_unaligned_access == -1) {
+#if defined(ARM) || defined(ARM64) || defined(X86) || defined(X86_64) || defined(PPC) || defined(PPC64) || defined(S390)|| defined(S390X)
+ efficient_unaligned_access = TRUE;
+#else
+ efficient_unaligned_access = FALSE;
+#endif
+
+ if ((kt->ikconfig_flags & IKCONFIG_AVAIL) &&
+ (get_kernel_config("CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS", NULL) == IKCONFIG_Y))
+ efficient_unaligned_access = TRUE;
+ }
+
+ op = out;
+ ip = in;
+
+ if (in_len < 3)
+ goto input_overrun;
+
+ if (in_len >= 5 && *ip == 17) {
+ bitstream_version = ip[1];
+ ip += 2;
+ } else {
+ bitstream_version = 0;
+ }
+
+ if (*ip > 17) {
+ t = *ip++ - 17;
+ if (t < 4) {
+ next = t;
+ goto match_next;
+ }
+ goto copy_literal_run;
+ }
+
+ for (;;) {
+ t = *ip++;
+ if (t < 16) {
+ if (state == 0) {
+ if (t == 0) {
+ ulong offset;
+ const unsigned char *ip_last = ip;
+
+ while (*ip == 0) {
+ ip++;
+ NEED_IP(1);
+ }
+ offset = ip - ip_last;
+ if (offset > MAX_255_COUNT)
+ return LZO_E_ERROR;
+
+ offset = (offset << 8) - offset;
+ t += offset + 15 + *ip++;
+ }
+ t += 3;
+copy_literal_run:
+ if (efficient_unaligned_access &&
+ (HAVE_IP(t + 15) && HAVE_OP(t + 15))) {
+ const unsigned char *ie = ip + t;
+ unsigned char *oe = op + t;
+ do {
+ COPY8(op, ip);
+ op += 8;
+ ip += 8;
+ COPY8(op, ip);
+ op += 8;
+ ip += 8;
+ } while (ip < ie);
+ ip = ie;
+ op = oe;
+ } else {
+ NEED_OP(t);
+ NEED_IP(t + 3);
+ do {
+ *op++ = *ip++;
+ } while (--t > 0);
+ }
+ state = 4;
+ continue;
+ } else if (state != 4) {
+ next = t & 3;
+ m_pos = op - 1;
+ m_pos -= t >> 2;
+ m_pos -= *ip++ << 2;
+ TEST_LB(m_pos);
+ NEED_OP(2);
+ op[0] = m_pos[0];
+ op[1] = m_pos[1];
+ op += 2;
+ goto match_next;
+ } else {
+ next = t & 3;
+ m_pos = op - (1 + M2_MAX_OFFSET);
+ m_pos -= t >> 2;
+ m_pos -= *ip++ << 2;
+ t = 3;
+ }
+ } else if (t >= 64) {
+ next = t & 3;
+ m_pos = op - 1;
+ m_pos -= (t >> 2) & 7;
+ m_pos -= *ip++ << 3;
+ t = (t >> 5) - 1 + (3 - 1);
+ } else if (t >= 32) {
+ t = (t & 31) + (3 - 1);
+ if (t == 2) {
+ ulong offset;
+ const unsigned char *ip_last = ip;
+
+ while (*ip == 0) {
+ ip++;
+ NEED_IP(1);
+ }
+ offset = ip - ip_last;
+ if (offset > MAX_255_COUNT)
+ return LZO_E_ERROR;
+
+ offset = (offset << 8) - offset;
+ t += offset + 31 + *ip++;
+ NEED_IP(2);
+ }
+ m_pos = op - 1;
+
+ next = get_unaligned_le16(ip);
+ ip += 2;
+ m_pos -= next >> 2;
+ next &= 3;
+ } else {
+ NEED_IP(2);
+ next = get_unaligned_le16(ip);
+ if (((next & 0xfffc) == 0xfffc) &&
+ ((t & 0xf8) == 0x18) &&
+ bitstream_version) {
+ NEED_IP(3);
+ t &= 7;
+ t |= ip[2] << 3;
+ t += MIN_ZERO_RUN_LENGTH;
+ NEED_OP(t);
+ memset(op, 0, t);
+ op += t;
+ next &= 3;
+ ip += 3;
+ goto match_next;
+ } else {
+ m_pos = op;
+ m_pos -= (t & 8) << 11;
+ t = (t & 7) + (3 - 1);
+ if (t == 2) {
+ ulong offset;
+ const unsigned char *ip_last = ip;
+
+ while (*ip == 0) {
+ ip++;
+ NEED_IP(1);
+ }
+ offset = ip - ip_last;
+ if (offset > MAX_255_COUNT)
+ return LZO_E_ERROR;
+
+ offset = (offset << 8) - offset;
+ t += offset + 7 + *ip++;
+ NEED_IP(2);
+ next = get_unaligned_le16(ip);
+ }
+ ip += 2;
+ m_pos -= next >> 2;
+ next &= 3;
+ if (m_pos == op)
+ goto eof_found;
+ m_pos -= 0x4000;
+ }
+ }
+ TEST_LB(m_pos);
+
+ if (efficient_unaligned_access &&
+ (op - m_pos >= 8)) {
+ unsigned char *oe = op + t;
+ if (HAVE_OP(t + 15)) {
+ do {
+ COPY8(op, m_pos);
+ op += 8;
+ m_pos += 8;
+ COPY8(op, m_pos);
+ op += 8;
+ m_pos += 8;
+ } while (op < oe);
+ op = oe;
+ if (HAVE_IP(6)) {
+ state = next;
+ COPY4(op, ip);
+ op += next;
+ ip += next;
+ continue;
+ }
+ } else {
+ NEED_OP(t);
+ do {
+ *op++ = *m_pos++;
+ } while (op < oe);
+ }
+ } else {
+ unsigned char *oe = op + t;
+ NEED_OP(t);
+ op[0] = m_pos[0];
+ op[1] = m_pos[1];
+ op += 2;
+ m_pos += 2;
+ do {
+ *op++ = *m_pos++;
+ } while (op < oe);
+ }
+match_next:
+ state = next;
+ t = next;
+ if (efficient_unaligned_access &&
+ (HAVE_IP(6) && HAVE_OP(4))) {
+ COPY4(op, ip);
+ op += t;
+ ip += t;
+ } else {
+ NEED_IP(t + 3);
+ NEED_OP(t);
+ while (t > 0) {
+ *op++ = *ip++;
+ t--;
+ }
+ }
+ }
+
+eof_found:
+ *out_len = op - out;
+ return (t != 3 ? LZO_E_ERROR :
+ ip == ip_end ? LZO_E_OK :
+ ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN);
+
+input_overrun:
+ *out_len = op - out;
+ return LZO_E_INPUT_OVERRUN;
+
+output_overrun:
+ *out_len = op - out;
+ return LZO_E_OUTPUT_OVERRUN;
+
+lookbehind_overrun:
+ *out_len = op - out;
+ return LZO_E_LOOKBEHIND_OVERRUN;
+}
diff --git a/lzorle_decompress.h b/lzorle_decompress.h
new file mode 100644
index 0000000..62d961b
--- /dev/null
+++ b/lzorle_decompress.h
@@ -0,0 +1,75 @@
+/* lzorle_decompress.h
+ *
+ * from kernel lib/lzo/lzodefs.h
+ *
+ * Copyright (C) 1996-2012 Markus F.X.J. Oberhumer <mar...@oberhumer.com>
+ * Copyright (C) 2024 NIO
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef LZODEFS_H
+#define LZODEFS_H
+
+#define COPY4(dst, src) memcpy((dst), (src), sizeof(uint32_t))
+#define COPY8(dst, src) memcpy((dst), (src), sizeof(uint64_t))
+
+#define M1_MAX_OFFSET 0x0400
+#define M2_MAX_OFFSET 0x0800
+#define M3_MAX_OFFSET 0x4000
+#define M4_MAX_OFFSET_V0 0xbfff
+#define M4_MAX_OFFSET_V1 0xbffe
+
+#define M1_MIN_LEN 2
+#define M1_MAX_LEN 2
+#define M2_MIN_LEN 3
+#define M2_MAX_LEN 8
+#define M3_MIN_LEN 3
+#define M3_MAX_LEN 33
+#define M4_MIN_LEN 3
+#define M4_MAX_LEN 9
+
+#define M1_MARKER 0
+#define M2_MARKER 64
+#define M3_MARKER 32
+#define M4_MARKER 16
+
+#define MIN_ZERO_RUN_LENGTH 4
+#define MAX_ZERO_RUN_LENGTH (2047 + MIN_ZERO_RUN_LENGTH)
+
+#define lzo_dict_t unsigned short
+#define D_BITS 13
+#define D_SIZE (1u << D_BITS)
+#define D_MASK (D_SIZE - 1)
+#define D_HIGH ((D_MASK >> 1) + 1)
+
+#define LZO_E_OK 0
+#define LZO_E_ERROR (-1)
+#define LZO_E_OUT_OF_MEMORY (-2)
+#define LZO_E_NOT_COMPRESSIBLE (-3)
+#define LZO_E_INPUT_OVERRUN (-4)
+#define LZO_E_OUTPUT_OVERRUN (-5)
+#define LZO_E_LOOKBEHIND_OVERRUN (-6)
+#define LZO_E_EOF_NOT_FOUND (-7)
+#define LZO_E_INPUT_NOT_CONSUMED (-8)
+#define LZO_E_NOT_YET_IMPLEMELZO_HFILESNTED (-9)
+#define LZO_E_INVALID_ARGUMENT (-10)
+
+#define HAVE_IP(x) ((unsigned long)(ip_end - ip) >= (unsigned long)(x))
+#define HAVE_OP(x) ((unsigned long)(op_end - op) >= (unsigned long)(x))
+#define NEED_IP(x) if (!HAVE_IP(x)) goto input_overrun
+#define NEED_OP(x) if (!HAVE_OP(x)) goto output_overrun
+#define TEST_LB(m_pos) if ((m_pos) < out) goto lookbehind_overrun
+
+int lzorle_decompress_safe(const unsigned char *in, unsigned long in_len,
+ unsigned char *out, unsigned long *out_len, void *other/* NOT USED */);
+
+#endif
--
2.40.1

View File

@ -0,0 +1,127 @@
From 3452fe802bf94d15879b3c5fd17c793a2b67a231 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?HAGIO=20KAZUHITO=28=E8=90=A9=E5=B0=BE=E3=80=80=E4=B8=80?=
=?UTF-8?q?=E4=BB=81=29?= <k-hagio-ab@nec.com>
Date: Tue, 11 Jun 2024 02:40:55 +0000
Subject: [PATCH 1/2] Fix "kmem -i" and "swap" commands on Linux 6.10-rc1 and
later kernels
Kernel commit 798cb7f9aec3 ("swapon(2)/swapoff(2): don't bother with
block size") removed swap_info_struct.old_block_size member at Linux
6.10-rc1. The crash-utility has used this to determine whether a swap
is a partition or file and to determine the way to get the swap path.
Withtout the patch, the "kmem -i" and "swap" commands fail with the
following error messsage:
crash> kmem -i
...
TOTAL HUGE 13179392 50.3 GB ----
HUGE FREE 13179392 50.3 GB 100% of TOTAL HUGE
swap: invalid (optional) structure member offsets: swap_info_struct_swap_device or swap_info_struct_old_block_size
FILE: memory.c LINE: 16032 FUNCTION: dump_swap_info()
The swap_file member of recent swap_info_struct is a pointer to a
struct file (once upon a time it was dentry), use this fact directly.
Tested-by: Li Zhijian <lizhijian@fujitsu.com>
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
---
defs.h | 1 +
filesys.c | 1 +
memory.c | 28 +++++++++++++++++++++++-----
symbols.c | 1 +
4 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/defs.h b/defs.h
index da856c0..49e6923 100644
--- a/defs.h
+++ b/defs.h
@@ -2242,6 +2242,7 @@ struct offset_table { /* stash of commonly-used offsets */
long log_caller_id;
long vmap_node_busy;
long rb_list_head;
+ long file_f_inode;
};
struct size_table { /* stash of commonly-used sizes */
diff --git a/filesys.c b/filesys.c
index 81fe856..406ebb2 100644
--- a/filesys.c
+++ b/filesys.c
@@ -2038,6 +2038,7 @@ vfs_init(void)
MEMBER_OFFSET_INIT(file_f_dentry, "file", "f_dentry");
MEMBER_OFFSET_INIT(file_f_vfsmnt, "file", "f_vfsmnt");
MEMBER_OFFSET_INIT(file_f_count, "file", "f_count");
+ MEMBER_OFFSET_INIT(file_f_inode, "file", "f_inode");
MEMBER_OFFSET_INIT(path_mnt, "path", "mnt");
MEMBER_OFFSET_INIT(path_dentry, "path", "dentry");
if (INVALID_MEMBER(file_f_dentry)) {
diff --git a/memory.c b/memory.c
index acb8507..a74ebaf 100644
--- a/memory.c
+++ b/memory.c
@@ -16075,6 +16075,8 @@ dump_swap_info(ulong swapflags, ulong *totalswap_pages, ulong *totalused_pages)
char buf3[BUFSIZE];
char buf4[BUFSIZE];
char buf5[BUFSIZE];
+ int swap_file_is_file =
+ STREQ(MEMBER_TYPE_NAME("swap_info_struct", "swap_file"), "file");
if (!symbol_exists("nr_swapfiles"))
error(FATAL, "nr_swapfiles doesn't exist in this kernel!\n");
@@ -16118,9 +16120,21 @@ dump_swap_info(ulong swapflags, ulong *totalswap_pages, ulong *totalused_pages)
swap_file = ULONG(vt->swap_info_struct +
OFFSET(swap_info_struct_swap_file));
- swap_device = INT(vt->swap_info_struct +
- OFFSET_OPTION(swap_info_struct_swap_device,
- swap_info_struct_old_block_size));
+ /* Linux 6.10 and later */
+ if (INVALID_MEMBER(swap_info_struct_swap_device) &&
+ INVALID_MEMBER(swap_info_struct_old_block_size) &&
+ swap_file_is_file) {
+ ulong inode;
+ ushort mode;
+ readmem(swap_file + OFFSET(file_f_inode), KVADDR, &inode,
+ sizeof(ulong), "swap_file.f_inode", FAULT_ON_ERROR);
+ readmem(inode + OFFSET(inode_i_mode), KVADDR, &mode,
+ sizeof(ushort), "inode.i_mode", FAULT_ON_ERROR);
+ swap_device = S_ISBLK(mode);
+ } else
+ swap_device = INT(vt->swap_info_struct +
+ OFFSET_OPTION(swap_info_struct_swap_device,
+ swap_info_struct_old_block_size));
pages = INT(vt->swap_info_struct +
OFFSET(swap_info_struct_pages));
@@ -16161,8 +16175,12 @@ dump_swap_info(ulong swapflags, ulong *totalswap_pages, ulong *totalused_pages)
OFFSET(swap_info_struct_swap_vfsmnt));
get_pathname(swap_file, buf, BUFSIZE,
1, vfsmnt);
- } else if (VALID_MEMBER
- (swap_info_struct_old_block_size)) {
+ } else if (VALID_MEMBER(swap_info_struct_old_block_size) ||
+ swap_file_is_file) {
+ /*
+ * Linux 6.10 and later kernels do not have old_block_size,
+ * but this still should work, if swap_file is file.
+ */
devname = vfsmount_devname(file_to_vfsmnt(swap_file),
buf1, BUFSIZE);
get_pathname(file_to_dentry(swap_file),
diff --git a/symbols.c b/symbols.c
index f3c94b0..69a1fbb 100644
--- a/symbols.c
+++ b/symbols.c
@@ -10522,6 +10522,7 @@ dump_offset_table(char *spec, ulong makestruct)
OFFSET(file_f_count));
fprintf(fp, " file_f_path: %ld\n",
OFFSET(file_f_path));
+ fprintf(fp, " file_f_inode: %ld\n", OFFSET(file_f_inode));
fprintf(fp, " path_mnt: %ld\n",
OFFSET(path_mnt));
fprintf(fp, " path_dentry: %ld\n",
--
2.40.1

View File

@ -0,0 +1,68 @@
From af895b219876b293d551e6dec825aba3905c0588 Mon Sep 17 00:00:00 2001
From: "qiwu.chen" <qiwu.chen@transsion.com>
Date: Wed, 24 Jul 2024 01:36:09 +0000
Subject: [PATCH 1/5] arm64: fix a potential segfault when unwind frame
The range of frame->fp is checked insufficiently, which may lead to a wrong
next fp. As a result, bt->stackbuf will be accessed out of range, and segfault.
crash> bt
[Detaching after fork from child process 11409]
PID: 7661 TASK: ffffff81858aa500 CPU: 4 COMMAND: "sh"
#0 [ffffffc008003f50] local_cpu_stop at ffffffdd7669444c
Thread 1 "crash" received signal SIGSEGV, Segmentation fault.
0x00005555558266cc in arm64_unwind_frame (bt=0x7fffffffd8f0, frame=0x7fffffffd080) at
arm64.c:2821
2821 frame->fp = GET_STACK_ULONG(fp);
(gdb) bt
arm64.c:2821
out>) at main.c:1338
gdb_interface.c:81
(gdb) p /x *(struct bt_info*) 0x7fffffffd8f0
$3 = {task = 0xffffff81858aa500, flags = 0x0, instptr = 0xffffffdd76694450, stkptr =
0xffffffc008003f40, bptr = 0x0, stackbase = 0xffffffc027288000,
stacktop = 0xffffffc02728c000, stackbuf = 0x555556115a40, tc = 0x55559d16fdc0, hp = 0x0,
textlist = 0x0, ref = 0x0, frameptr = 0xffffffc008003f50,
call_target = 0x0, machdep = 0x0, debug = 0x0, eframe_ip = 0x0, radix = 0x0, cpumask =
0x0}
(gdb) p /x *(struct arm64_stackframe*) 0x7fffffffd080
$4 = {fp = 0xffffffc008003f50, sp = 0xffffffc008003f60, pc = 0xffffffdd76694450}
crash> bt -S 0xffffffc008003f50
PID: 7661 TASK: ffffff81858aa500 CPU: 4 COMMAND: "sh"
bt: non-process stack address for this task: ffffffc008003f50
(valid range: ffffffc027288000 - ffffffc02728c000)
Check frame->fp value sufficiently before access it. Only frame->fp within
the range of bt->stackbase and bt->stacktop will be regarded as valid.
Signed-off-by: qiwu.chen <qiwu.chen@transsion.com>
---
arm64.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arm64.c b/arm64.c
index b3040d7..624dba2 100644
--- a/arm64.c
+++ b/arm64.c
@@ -2814,7 +2814,7 @@ arm64_unwind_frame(struct bt_info *bt, struct arm64_stackframe *frame)
low = frame->sp;
high = (low + stack_mask) & ~(stack_mask);
- if (fp < low || fp > high || fp & 0xf)
+ if (fp < low || fp > high || fp & 0xf || !INSTACK(fp, bt))
return FALSE;
frame->sp = fp + 0x10;
@@ -3024,7 +3024,7 @@ arm64_unwind_frame_v2(struct bt_info *bt, struct arm64_stackframe *frame,
low = frame->sp;
high = (low + stack_mask) & ~(stack_mask);
- if (fp < low || fp > high || fp & 0xf)
+ if (fp < low || fp > high || fp & 0xf || !INSTACK(fp, bt))
return FALSE;
if (CRASHDEBUG(1))
--
2.40.1

View File

@ -0,0 +1,111 @@
From af2ac4c41df6d87f090613ecf3521ca073754cb0 Mon Sep 17 00:00:00 2001
From: chenguanyou <chenguanyou@xiaomi.com>
Date: Wed, 24 Apr 2024 17:00:20 +0800
Subject: [PATCH 2/9] Cleanup: replace struct zspage_5_17 with union
This patch is a refactoring on commit [1], and has no functional
change. The reason is that the structure of zspage has not changed,
just new bits have been introduced. So a union is better to reduce
code replication.
[1] 0172e35083b5 ("Fix "rd" command to display data on zram on Linux 5.17 and later")
Signed-off-by: chenguanyou <chenguanyou@xiaomi.com>
---
defs.h | 32 +++++++++++++++-----------------
diskdump.c | 15 ++++++---------
2 files changed, 21 insertions(+), 26 deletions(-)
diff --git a/defs.h b/defs.h
index 3cb8e63..01f316e 100644
--- a/defs.h
+++ b/defs.h
@@ -7407,28 +7407,26 @@ ulong try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulon
#define SECTORS_PER_PAGE (1 << SECTORS_PER_PAGE_SHIFT)
struct zspage {
- struct {
- unsigned int fullness : 2;
- unsigned int class : 9;
- unsigned int isolated : 3;
- unsigned int magic : 8;
+ union {
+ unsigned int flag_bits;
+ struct {
+ unsigned int fullness : 2;
+ unsigned int class : 9;
+ unsigned int isolated : 3;
+ unsigned int magic : 8;
+ } v0;
+ struct {
+ unsigned int huge : 1;
+ unsigned int fullness : 2;
+ unsigned int class : 9;
+ unsigned int isolated : 3;
+ unsigned int magic : 8;
+ } v5_17;
};
unsigned int inuse;
unsigned int freeobj;
};
-struct zspage_5_17 {
- struct {
- unsigned int huge : 1;
- unsigned int fullness : 2;
- unsigned int class : 9;
- unsigned int isolated : 3;
- unsigned int magic : 8;
- };
- unsigned int inuse;
- unsigned int freeobj;
-};
-
/*
* makedumpfile.c
*/
diff --git a/diskdump.c b/diskdump.c
index 4a473e1..1f7118c 100644
--- a/diskdump.c
+++ b/diskdump.c
@@ -2820,7 +2820,6 @@ zram_object_addr(ulong pool, ulong handle, unsigned char *zram_buf)
{
ulong obj, off, class, page, zspage;
struct zspage zspage_s;
- struct zspage_5_17 zspage_5_17_s;
physaddr_t paddr;
unsigned int obj_idx, class_idx, size;
ulong pages[2], sizes[2];
@@ -2834,15 +2833,13 @@ zram_object_addr(ulong pool, ulong handle, unsigned char *zram_buf)
readmem(page + OFFSET(page_private), KVADDR, &zspage,
sizeof(void *), "page_private", FAULT_ON_ERROR);
+ readmem(zspage, KVADDR, &zspage_s, sizeof(struct zspage), "zspage", FAULT_ON_ERROR);
if (VALID_MEMBER(zspage_huge)) {
- readmem(zspage, KVADDR, &zspage_5_17_s,
- sizeof(struct zspage_5_17), "zspage_5_17", FAULT_ON_ERROR);
- class_idx = zspage_5_17_s.class;
- zs_magic = zspage_5_17_s.magic;
+ class_idx = zspage_s.v5_17.class;
+ zs_magic = zspage_s.v5_17.magic;
} else {
- readmem(zspage, KVADDR, &zspage_s, sizeof(struct zspage), "zspage", FAULT_ON_ERROR);
- class_idx = zspage_s.class;
- zs_magic = zspage_s.magic;
+ class_idx = zspage_s.v0.class;
+ zs_magic = zspage_s.v0.magic;
}
if (zs_magic != ZSPAGE_MAGIC)
@@ -2888,7 +2885,7 @@ zram_object_addr(ulong pool, ulong handle, unsigned char *zram_buf)
out:
if (VALID_MEMBER(zspage_huge)) {
- if (!zspage_5_17_s.huge)
+ if (!zspage_s.v5_17.huge)
return (zram_buf + ZS_HANDLE_SIZE);
} else {
readmem(page, KVADDR, &obj, sizeof(void *), "page flags", FAULT_ON_ERROR);
--
2.40.1

View File

@ -0,0 +1,31 @@
From ce4ddc742fbdde2fc966e79a19d6aa962e79448a Mon Sep 17 00:00:00 2001
From: Li Zhijian <lizhijian@fujitsu.com>
Date: Tue, 2 Jul 2024 14:31:30 +0800
Subject: [PATCH 2/2] List: enable LIST_HEAD_FORMAT for -r option
Currently, the LIST_HEAD_FORMAT is not set, 'list -r' will list the
traversal results in order, not in the reverse order. This is not
the expected behavior.
Let's enable the LIST_HEAD_FORMAT for -r option by default.
Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
---
tools.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools.c b/tools.c
index 0f2db10..1022d57 100644
--- a/tools.c
+++ b/tools.c
@@ -3370,6 +3370,7 @@ cmd_list(void)
break;
case 'r':
+ ld->flags |= LIST_HEAD_FORMAT;
ld->flags |= LIST_HEAD_REVERSE;
break;
--
2.40.1

View File

@ -0,0 +1,126 @@
From 1c6da3eaff820708d4286324051d153a01766b02 Mon Sep 17 00:00:00 2001
From: bevis_chen <bevis_chen@asus.com>
Date: Thu, 25 Jul 2024 09:38:59 +0800
Subject: [PATCH 2/5] arm64: Fix bt command show wrong stacktrace on ramdump
source
For ramdump(Qcom phone device) case with the kernel option
CONFIG_ARM64_PTR_AUTH_KERNEL enabled, the bt command may print
incorrect stacktrace as below:
crash> bt 16930
PID: 16930 TASK: ffffff89b3eada00 CPU: 2 COMMAND: "Firebase Backgr"
#0 [ffffffc034c437f0] __switch_to at ffffffe0036832d4
#1 [ffffffc034c43850] __kvm_nvhe_$d.2314 at 6be732e004cf05a0
#2 [ffffffc034c438b0] __kvm_nvhe_$d.2314 at 86c54c6004ceff80
#3 [ffffffc034c43950] __kvm_nvhe_$d.2314 at 55d6f96003a7b120
...
PC: 00000073f5294840 LR: 00000070d8f39ba4 SP: 00000070d4afd5d0
X29: 00000070d4afd600 X28: b4000071efcda7f0 X27: 00000070d4afe000
X26: 0000000000000000 X25: 00000070d9616000 X24: 0000000000000000
X23: 0000000000000000 X22: 0000000000000000 X21: 0000000000000000
X20: b40000728fd27520 X19: b40000728fd27550 X18: 000000702daba000
X17: 00000073f5294820 X16: 00000070d940f9d8 X15: 00000000000000bf
X14: 0000000000000000 X13: 00000070d8ad2fac X12: b40000718fce5040
X11: 0000000000000000 X10: 0000000000000070 X9: 0000000000000001
X8: 0000000000000062 X7: 0000000000000020 X6: 0000000000000000
X5: 0000000000000000 X4: 0000000000000000 X3: 0000000000000000
X2: 0000000000000002 X1: 0000000000000080 X0: b40000728fd27550
ORIG_X0: b40000728fd27550 SYSCALLNO: ffffffff PSTATE: 40001000
Crash tool can not get the KERNELPACMASK value from the vmcoreinfo, need
to calculate its value based on the vabits.
With the patch:
crash> bt 16930
PID: 16930 TASK: ffffff89b3eada00 CPU: 2 COMMAND: "Firebase Backgr"
#0 [ffffffc034c437f0] __switch_to at ffffffe0036832d4
#1 [ffffffc034c43850] __schedule at ffffffe004cf05a0
#2 [ffffffc034c438b0] preempt_schedule_common at ffffffe004ceff80
#3 [ffffffc034c43950] unmap_page_range at ffffffe003a7b120
#4 [ffffffc034c439f0] unmap_vmas at ffffffe003a80a64
#5 [ffffffc034c43ac0] exit_mmap at ffffffe003a945c4
#6 [ffffffc034c43b10] __mmput at ffffffe00372c818
#7 [ffffffc034c43b40] mmput at ffffffe00372c0d0
#8 [ffffffc034c43b90] exit_mm at ffffffe00373d0ac
#9 [ffffffc034c43c00] do_exit at ffffffe00373bedc
PC: 00000073f5294840 LR: 00000070d8f39ba4 SP: 00000070d4afd5d0
X29: 00000070d4afd600 X28: b4000071efcda7f0 X27: 00000070d4afe000
X26: 0000000000000000 X25: 00000070d9616000 X24: 0000000000000000
X23: 0000000000000000 X22: 0000000000000000 X21: 0000000000000000
X20: b40000728fd27520 X19: b40000728fd27550 X18: 000000702daba000
X17: 00000073f5294820 X16: 00000070d940f9d8 X15: 00000000000000bf
X14: 0000000000000000 X13: 00000070d8ad2fac X12: b40000718fce5040
X11: 0000000000000000 X10: 0000000000000070 X9: 0000000000000001
X8: 0000000000000062 X7: 0000000000000020 X6: 0000000000000000
X5: 0000000000000000 X4: 0000000000000000 X3: 0000000000000000
X2: 0000000000000002 X1: 0000000000000080 X0: b40000728fd27550
ORIG_X0: b40000728fd27550 SYSCALLNO: ffffffff PSTATE: 40001000
Related kernel commits:
689eae42afd7 ("arm64: mask PAC bits of __builtin_return_address")
de1702f65feb ("arm64: move PAC masks to <asm/pointer_auth.h>")
Signed-off-by: bevis_chen <bevis_chen@asus.com>
---
arm64.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/arm64.c b/arm64.c
index 624dba2..78e6609 100644
--- a/arm64.c
+++ b/arm64.c
@@ -92,6 +92,7 @@ static void arm64_get_crash_notes(void);
static void arm64_calc_VA_BITS(void);
static int arm64_is_uvaddr(ulong, struct task_context *);
static void arm64_calc_KERNELPACMASK(void);
+static void arm64_recalc_KERNELPACMASK(void);
static int arm64_get_vmcoreinfo(unsigned long *vaddr, const char *label, int base);
struct kernel_range {
@@ -581,6 +582,16 @@ arm64_init(int when)
if (!machdep->hz)
machdep->hz = 100;
+
+ /*
+ * Let's calculate the KERNELPACMASK value based on the
+ * vabits, see:
+ * arch/arm64/kernel/vmcore_info.c
+ * arch/arm64/include/asm/pointer_auth.h
+ */
+ if(!machdep->machspec->CONFIG_ARM64_KERNELPACMASK)
+ arm64_recalc_KERNELPACMASK();
+
arm64_irq_stack_init();
arm64_overflow_stack_init();
arm64_stackframe_init();
@@ -4921,6 +4932,24 @@ static void arm64_calc_KERNELPACMASK(void)
}
}
+#define GENMASK_UL(h, l) \
+ (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h))))
+
+static void arm64_recalc_KERNELPACMASK(void){
+ /*
+ * Check if PAC is enabled according to the existence of
+ * kernel symbol 'ptrauth_keys_kernel'.
+ */
+ if (STRUCT_EXISTS("ptrauth_keys_kernel") &&
+ machdep->machspec->VA_BITS_ACTUAL){
+ machdep->machspec->CONFIG_ARM64_KERNELPACMASK =
+ GENMASK_UL(63, machdep->machspec->VA_BITS_ACTUAL);
+ if (CRASHDEBUG(1))
+ fprintf(fp, "CONFIG_ARM64_KERNELPACMASK: %lx\n",
+ machdep->machspec->CONFIG_ARM64_KERNELPACMASK);
+ }
+}
+
#endif /* ARM64 */
--
2.40.1

View File

@ -0,0 +1,261 @@
From 93d7f647c45b80b584db815f78b7130508642c60 Mon Sep 17 00:00:00 2001
From: Kuan-Ying Lee <kuan-ying.lee@canonical.com>
Date: Sat, 13 Jul 2024 21:22:52 +0800
Subject: [PATCH 3/5] arm64: Introduction of support for 16K page with 3-level
table support
Introduction of ARM64 support for 16K page size with 3-level page
table and 47 VA bits.
Signed-off-by: Kuan-Ying Lee <kuan-ying.lee@canonical.com>
---
arm64.c | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
defs.h | 16 ++++++++
2 files changed, 126 insertions(+), 4 deletions(-)
diff --git a/arm64.c b/arm64.c
index 78e6609..067c879 100644
--- a/arm64.c
+++ b/arm64.c
@@ -42,6 +42,7 @@ static int arm64_kvtop(struct task_context *, ulong, physaddr_t *, int);
static int arm64_uvtop(struct task_context *, ulong, physaddr_t *, int);
static int arm64_vtop_2level_64k(ulong, ulong, physaddr_t *, int);
static int arm64_vtop_3level_64k(ulong, ulong, physaddr_t *, int);
+static int arm64_vtop_3level_16k(ulong, ulong, physaddr_t *, int);
static int arm64_vtop_3level_4k(ulong, ulong, physaddr_t *, int);
static int arm64_vtop_4level_4k(ulong, ulong, physaddr_t *, int);
static ulong arm64_get_task_pgd(ulong);
@@ -262,8 +263,7 @@ arm64_init(int when)
machdep->pagesize = 4096;
break;
case 2:
- /* TODO: machdep->pagesize = 16384; */
- error(FATAL, "16K pages not supported.");
+ machdep->pagesize = 16384;
break;
case 3:
machdep->pagesize = 65536;
@@ -393,6 +393,26 @@ arm64_init(int when)
error(FATAL, "cannot malloc ptbl space.");
break;
+ case 16384:
+ if (machdep->machspec->VA_BITS > PGDIR_SHIFT_L3_16K) {
+ machdep->flags |= VM_L3_16K;
+ if (!machdep->ptrs_per_pgd)
+ machdep->ptrs_per_pgd = PTRS_PER_PGD_L3_16K;
+ if ((machdep->pgd =
+ (char *)malloc(machdep->ptrs_per_pgd * 8)) == NULL)
+ error(FATAL, "cannot malloc pgd space.");
+ if ((machdep->pmd =
+ (char *)malloc(PTRS_PER_PMD_L3_16K * 8)) == NULL)
+ error(FATAL, "cannot malloc pmd space.");
+ if ((machdep->ptbl =
+ (char *)malloc(PTRS_PER_PTE_L3_16K * 8)) == NULL)
+ error(FATAL, "cannot malloc ptbl space.");
+ } else {
+ error(FATAL, "we only support 47 bits, 3 level for 16K page now.");
+ }
+ machdep->pud = NULL; /* not used */
+ break;
+
case 65536:
if (kernel_symbol_exists("idmap_ptrs_per_pgd") &&
readmem(symbol_value("idmap_ptrs_per_pgd"), KVADDR,
@@ -1029,6 +1049,8 @@ arm64_dump_machdep_table(ulong arg)
fprintf(fp, "%sVM_L2_64K", others++ ? "|" : "");
if (machdep->flags & VM_L3_64K)
fprintf(fp, "%sVM_L3_64K", others++ ? "|" : "");
+ if (machdep->flags & VM_L3_16K)
+ fprintf(fp, "%sVM_L3_16K", others++ ? "|" : "");
if (machdep->flags & VM_L3_4K)
fprintf(fp, "%sVM_L3_4K", others++ ? "|" : "");
if (machdep->flags & VM_L4_4K)
@@ -1076,6 +1098,8 @@ arm64_dump_machdep_table(ulong arg)
"arm64_vtop_3level_4k" :
machdep->flags & VM_L4_4K ?
"arm64_vtop_4level_4k" :
+ machdep->flags & VM_L3_16K ?
+ "arm64_vtop_3level_16k" :
machdep->flags & VM_L3_64K ?
"arm64_vtop_3level_64k" : "arm64_vtop_2level_64k");
fprintf(fp, " kvtop: arm64_kvtop()->%s()\n",
@@ -1083,6 +1107,8 @@ arm64_dump_machdep_table(ulong arg)
"arm64_vtop_3level_4k" :
machdep->flags & VM_L4_4K ?
"arm64_vtop_4level_4k" :
+ machdep->flags & VM_L3_16K ?
+ "arm64_vtop_3level_16k" :
machdep->flags & VM_L3_64K ?
"arm64_vtop_3level_64k" : "arm64_vtop_2level_64k");
fprintf(fp, " get_task_pgd: arm64_get_task_pgd()\n");
@@ -1118,6 +1144,7 @@ arm64_dump_machdep_table(ulong arg)
fprintf(fp, " last_pgd_read: %lx\n", machdep->last_pgd_read);
fprintf(fp, " last_pud_read: ");
if ((PAGESIZE() == 65536) ||
+ (PAGESIZE() == 16384) ||
((PAGESIZE() == 4096) && !(machdep->flags & VM_L4_4K)))
fprintf(fp, "(not used)\n");
else
@@ -1772,7 +1799,7 @@ arm64_kvtop(struct task_context *tc, ulong kvaddr, physaddr_t *paddr, int verbos
kernel_pgd = vt->kernel_pgd[0];
*paddr = 0;
- switch (machdep->flags & (VM_L2_64K|VM_L3_64K|VM_L3_4K|VM_L4_4K))
+ switch (machdep->flags & (VM_L2_64K|VM_L3_64K|VM_L3_4K|VM_L4_4K|VM_L3_16K))
{
case VM_L2_64K:
return arm64_vtop_2level_64k(kernel_pgd, kvaddr, paddr, verbose);
@@ -1782,6 +1809,8 @@ arm64_kvtop(struct task_context *tc, ulong kvaddr, physaddr_t *paddr, int verbos
return arm64_vtop_3level_4k(kernel_pgd, kvaddr, paddr, verbose);
case VM_L4_4K:
return arm64_vtop_4level_4k(kernel_pgd, kvaddr, paddr, verbose);
+ case VM_L3_16K:
+ return arm64_vtop_3level_16k(kernel_pgd, kvaddr, paddr, verbose);
default:
return FALSE;
}
@@ -1797,7 +1826,7 @@ arm64_uvtop(struct task_context *tc, ulong uvaddr, physaddr_t *paddr, int verbos
*paddr = 0;
- switch (machdep->flags & (VM_L2_64K|VM_L3_64K|VM_L3_4K|VM_L4_4K))
+ switch (machdep->flags & (VM_L2_64K|VM_L3_64K|VM_L3_4K|VM_L4_4K|VM_L3_16K))
{
case VM_L2_64K:
return arm64_vtop_2level_64k(user_pgd, uvaddr, paddr, verbose);
@@ -1807,6 +1836,8 @@ arm64_uvtop(struct task_context *tc, ulong uvaddr, physaddr_t *paddr, int verbos
return arm64_vtop_3level_4k(user_pgd, uvaddr, paddr, verbose);
case VM_L4_4K:
return arm64_vtop_4level_4k(user_pgd, uvaddr, paddr, verbose);
+ case VM_L3_16K:
+ return arm64_vtop_3level_16k(user_pgd, uvaddr, paddr, verbose);
default:
return FALSE;
}
@@ -1823,6 +1854,7 @@ arm64_uvtop(struct task_context *tc, ulong uvaddr, physaddr_t *paddr, int verbos
#define PMD_TYPE_SECT 1
#define PMD_TYPE_TABLE 2
#define SECTION_PAGE_MASK_2MB ((long)(~((MEGABYTES(2))-1)))
+#define SECTION_PAGE_MASK_32MB ((long)(~((MEGABYTES(32))-1)))
#define SECTION_PAGE_MASK_512MB ((long)(~((MEGABYTES(512))-1)))
#define SECTION_PAGE_MASK_1GB ((long)(~((GIGABYTES(1))-1)))
@@ -1965,6 +1997,80 @@ no_page:
return FALSE;
}
+static int
+arm64_vtop_3level_16k(ulong pgd, ulong vaddr, physaddr_t *paddr, int verbose)
+{
+ ulong *pgd_base, *pgd_ptr, pgd_val;
+ ulong *pmd_base, *pmd_ptr, pmd_val;
+ ulong *pte_base, *pte_ptr, pte_val;
+
+ if (verbose)
+ fprintf(fp, "PAGE DIRECTORY: %lx\n", pgd);
+
+ pgd_base = (ulong *)pgd;
+ FILL_PGD(pgd_base, KVADDR, machdep->ptrs_per_pgd * sizeof(ulong));
+ pgd_ptr = pgd_base + (((vaddr) >> PGDIR_SHIFT_L3_16K) & (machdep->ptrs_per_pgd - 1));
+ pgd_val = ULONG(machdep->pgd + PGDIR_OFFSET_L3_16K(pgd_ptr));
+ if (verbose)
+ fprintf(fp, " PGD: %lx => %lx\n", (ulong)pgd_ptr, pgd_val);
+ if (!pgd_val)
+ goto no_page;
+
+ /*
+ * #define __PAGETABLE_PUD_FOLDED
+ */
+
+ pmd_base = (ulong *)PTOV(PTE_TO_PHYS(pgd_val));
+ FILL_PMD(pmd_base, KVADDR, PTRS_PER_PMD_L3_16K * sizeof(ulong));
+ pmd_ptr = pmd_base + (((vaddr) >> PMD_SHIFT_L3_16K) & (PTRS_PER_PMD_L3_16K - 1));
+ pmd_val = ULONG(machdep->pmd + PAGEOFFSET(pmd_ptr));
+ if (verbose)
+ fprintf(fp, " PMD: %lx => %lx\n", (ulong)pmd_ptr, pmd_val);
+ if (!pmd_val)
+ goto no_page;
+
+ if ((pmd_val & PMD_TYPE_MASK) == PMD_TYPE_SECT) {
+ ulong sectionbase = PTE_TO_PHYS(pmd_val) & SECTION_PAGE_MASK_32MB;
+ if (verbose) {
+ fprintf(fp, " PAGE: %lx (32MB%s)\n\n", sectionbase,
+ IS_ZEROPAGE(sectionbase) ? ", ZERO PAGE" : "");
+ arm64_translate_pte(pmd_val, 0, 0);
+ }
+ *paddr = sectionbase + (vaddr & ~SECTION_PAGE_MASK_32MB);
+ return TRUE;
+ }
+
+ pte_base = (ulong *)PTOV(PTE_TO_PHYS(pmd_val));
+ FILL_PTBL(pte_base, KVADDR, PTRS_PER_PTE_L3_16K * sizeof(ulong));
+ pte_ptr = pte_base + (((vaddr) >> machdep->pageshift) & (PTRS_PER_PTE_L3_16K - 1));
+ pte_val = ULONG(machdep->ptbl + PAGEOFFSET(pte_ptr));
+ if (verbose)
+ fprintf(fp, " PTE: %lx => %lx\n", (ulong)pte_ptr, pte_val);
+ if (!pte_val)
+ goto no_page;
+
+ if (pte_val & PTE_VALID) {
+ *paddr = PTE_TO_PHYS(pte_val) + PAGEOFFSET(vaddr);
+ if (verbose) {
+ fprintf(fp, " PAGE: %lx %s\n\n", PAGEBASE(*paddr),
+ IS_ZEROPAGE(PAGEBASE(*paddr)) ? "(ZERO PAGE)" : "");
+ arm64_translate_pte(pte_val, 0, 0);
+ }
+ } else {
+ if (IS_UVADDR(vaddr, NULL))
+ *paddr = pte_val;
+ if (verbose) {
+ fprintf(fp, "\n");
+ arm64_translate_pte(pte_val, 0, 0);
+ }
+ goto no_page;
+ }
+
+ return TRUE;
+no_page:
+ return FALSE;
+}
+
static int
arm64_vtop_3level_4k(ulong pgd, ulong vaddr, physaddr_t *paddr, int verbose)
{
diff --git a/defs.h b/defs.h
index 49e6923..1b7649d 100644
--- a/defs.h
+++ b/defs.h
@@ -3302,6 +3302,21 @@ typedef signed int s32;
#define PGDIR_MASK_48VA (~(PGDIR_SIZE_48VA - 1))
#define PGDIR_OFFSET_48VA(X) (((ulong)(X)) & (PGDIR_SIZE_48VA - 1))
+/*
+ * 3-levels / 16K pages
+ * 47-bit VA
+ */
+#define PTRS_PER_PGD_L3_16K ((1UL) << (47 - 36))
+#define PTRS_PER_PMD_L3_16K (2048)
+#define PTRS_PER_PTE_L3_16K (2048)
+#define PGDIR_SHIFT_L3_16K (36)
+#define PGDIR_SIZE_L3_16K ((1UL) << PGDIR_SHIFT_L3_16K)
+#define PGDIR_MASK_L3_16K (~(PGDIR_SIZE_L3_16K-1))
+#define PMD_SHIFT_L3_16K (25)
+#define PMD_SIZE_L3_16K (1UL << PMD_SHIFT_L3_16K)
+#define PMD_MASK_L3_16K (~(PMD_SIZE_L3_16K-1))
+#define PGDIR_OFFSET_L3_16K(X) (((ulong)(X)) & ((machdep->ptrs_per_pgd * 8) - 1))
+
/*
* 3-levels / 64K pages
*/
@@ -3367,6 +3382,7 @@ typedef signed int s32;
#define HAS_PHYSVIRT_OFFSET (0x800)
#define OVERFLOW_STACKS (0x1000)
#define ARM64_MTE (0x2000)
+#define VM_L3_16K (0x4000)
/*
* Get kimage_voffset from /dev/crash
--
2.40.1

View File

@ -0,0 +1,59 @@
From 568c6f049ad4a20918afeb2db9bb7a15b17d9ff2 Mon Sep 17 00:00:00 2001
From: Guanyou Chen <chenguanyou9338@gmail.com>
Date: Wed, 17 Apr 2024 19:55:40 +0800
Subject: [PATCH 3/9] arm64: section_size_bits compatible with macro
definitions
Compatible with google android GKI changes,
SECTION_SIZE_BITS = 27 when defined 4K_PAGES or 16K_PAGES.
SECTION_SIZE_BITS = 29 when defined 64K_PAGES.
Before android-12-gki:
crash> help -m | grep section_size_bits
section_size_bits: 30
The first PFN error, the physical address should be 0x40000000.
crash> kmem -p
PAGE PHYSICAL MAPPING INDEX CNT FLAGS
ffffffff06e00000 200000000 ffffff80edf4fa12 ffffffff070f3640 1
4000000000002000 private
After android-12-gki:
crash> help -m | grep section
section_size_bits: 27
crash> kmem -p
PAGE PHYSICAL MAPPING INDEX CNT FLAGS
fffffffeffe00000 40000000 0 0 1 1000 reserved
Link: https://lore.kernel.org/lkml/15cf9a2359197fee0168f820c5c904650d07939e.1610146597.git.sudaraja@codeaurora.org
Link: https://lore.kernel.org/all/43843c5e092bfe3ec4c41e3c8c78a7ee35b69bb0.1611206601.git.sudaraja@codeaurora.org
Link: https://cs.android.com/android/_/android/kernel/common/+/673e9ab6b64f981159aeff3b65675bb7dbedecd8
Signed-off-by: chenguanyou <chenguanyou@xiaomi.com>
---
arm64.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/arm64.c b/arm64.c
index af0e0d7..b3040d7 100644
--- a/arm64.c
+++ b/arm64.c
@@ -1628,7 +1628,14 @@ arm64_get_section_size_bits(void)
if ((ret = get_kernel_config("CONFIG_MEMORY_HOTPLUG", NULL)) == IKCONFIG_Y) {
if ((ret = get_kernel_config("CONFIG_HOTPLUG_SIZE_BITS", &string)) == IKCONFIG_STR)
machdep->section_size_bits = atol(string);
- }
+ }
+
+ /* arm64: reduce section size for sparsemem */
+ if ((ret = get_kernel_config("CONFIG_ARM64_4K_PAGES", NULL)) == IKCONFIG_Y
+ || (ret = get_kernel_config("CONFIG_ARM64_16K_PAGES", NULL)) == IKCONFIG_Y)
+ machdep->section_size_bits = _SECTION_SIZE_BITS_5_12;
+ else if ((ret = get_kernel_config("CONFIG_ARM64_64K_PAGES", NULL)) == IKCONFIG_Y)
+ machdep->section_size_bits = _SECTION_SIZE_BITS_5_12_64K;
}
if (CRASHDEBUG(1))
--
2.40.1

View File

@ -0,0 +1,44 @@
From 38f26cc8b9304e79e7f8adb5fd8e6a533c70cfd2 Mon Sep 17 00:00:00 2001
From: Lianbo Jiang <lijiang@redhat.com>
Date: Tue, 6 Aug 2024 14:31:45 +0800
Subject: [PATCH 4/5] LoongArch64: fix incorrect code in the main()
The commit c3939d2e1930 contains incorrect code that starts with "+",
for example:
- !machine_type("S390X") && !machine_type("RISCV64"))
+ !machine_type("S390X") && !machine_type("RISCV64") &&
++ !machine_type("LOONGARCH64"))
See the main() in the main.c
...
} else if (STREQ(long_options[option_index].name, "kaslr")) {
if (!machine_type("X86_64") &&
!machine_type("ARM64") && !machine_type("X86") &&
!machine_type("S390X") && !machine_type("RISCV64") &&
+ !machine_type("LOONGARCH64"))
Let's remove it from the main().
Link: https://lists.crash-utility.osci.io/archives/list/devel@lists.crash-utility.osci.io/message/LH3IRUA6ZDVFZFLWKW5EWR3DKE6MY25Z/
Fixes: c3939d2e1930 ("LoongArch64: Add "--kaslr" command line option support")
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
---
main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/main.c b/main.c
index 0b6b927..71bcc15 100644
--- a/main.c
+++ b/main.c
@@ -229,7 +229,7 @@ main(int argc, char **argv)
if (!machine_type("X86_64") &&
!machine_type("ARM64") && !machine_type("X86") &&
!machine_type("S390X") && !machine_type("RISCV64") &&
-+ !machine_type("LOONGARCH64"))
+ !machine_type("LOONGARCH64"))
error(INFO, "--kaslr not valid "
"with this machine type.\n");
else if (STREQ(optarg, "auto"))
--
2.40.1

View File

@ -0,0 +1,45 @@
From 3879e9104826d5ae14a0824ec47ab60056a249a7 Mon Sep 17 00:00:00 2001
From: Alexander Gordeev <agordeev@linux.ibm.com>
Date: Wed, 10 Apr 2024 14:55:35 +0200
Subject: [PATCH 4/9] Reflect __{start,end}_init_task kernel symbols rename
Kernel commit 8f69cba096b5 ("x86: Rename __{start,end}_init_task to
__{start,end}_init_stack") leads to failure when crash loading:
crash: invalid count request: 0
Assume both __{start,end}_init_task and __{start,end}_init_stack
symbols could exist for backward compatibility.
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
---
task.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/task.c b/task.c
index ebdb5be..d52ce0b 100644
--- a/task.c
+++ b/task.c
@@ -496,10 +496,17 @@ task_init(void)
((len = SIZE(thread_union)) != STACKSIZE())) {
machdep->stacksize = len;
} else if (!VALID_SIZE(thread_union) && !VALID_SIZE(task_union)) {
- if (kernel_symbol_exists("__start_init_task") &&
- kernel_symbol_exists("__end_init_task")) {
+ len = 0;
+ if (kernel_symbol_exists("__start_init_stack") &&
+ kernel_symbol_exists("__end_init_stack")) {
+ len = symbol_value("__end_init_stack");
+ len -= symbol_value("__start_init_stack");
+ } else if (kernel_symbol_exists("__start_init_task") &&
+ kernel_symbol_exists("__end_init_task")) {
len = symbol_value("__end_init_task");
len -= symbol_value("__start_init_task");
+ }
+ if (len) {
ASSIGN_SIZE(thread_union) = len;
machdep->stacksize = len;
}
--
2.40.1

View File

@ -0,0 +1,139 @@
From f615f8fab7bf3d2d5d5cb00518124a06e6846be4 Mon Sep 17 00:00:00 2001
From: Tao Liu <ltao@redhat.com>
Date: Wed, 17 Jul 2024 16:17:00 +1200
Subject: [PATCH 5/5] Fix "irq -a" exceeding the memory range issue
Previously without the patch, there was an error observed as follows:
crash> irq -a
IRQ NAME AFFINITY
0 timer 0-191
4 ttyS0 0-23,96-119
...
84 smartpqi 72-73,168
irq: page excluded: kernel virtual address: ffff97d03ffff000 type: "irq_desc affinity"
The reason is the reading of irq affinity exceeded the memory range, see
the following debug info:
Thread 1 "crash" hit Breakpoint 1, generic_get_irq_affinity (irq=85) at kernel.c:7373
7375 irq_desc_addr = get_irq_desc_addr(irq);
(gdb) p/x irq_desc_addr
$1 = 0xffff97d03f21e800
crash> struct irq_desc 0xffff97d03f21e800
struct irq_desc {
irq_common_data = {
state_use_accessors = 425755136,
node = 3,
handler_data = 0x0,
msi_desc = 0xffff97ca51b83480,
affinity = 0xffff97d03fffee60,
effective_affinity = 0xffff97d03fffe6c0
},
crash> whatis cpumask_t
typedef struct cpumask {
unsigned long bits[128];
} cpumask_t;
SIZE: 1024
In order to get the affinity, crash will read the memory range 0xffff97d03fffee60
~ 0xffff97d03fffee60 + 1024(0x400) by line:
readmem(affinity_ptr, KVADDR, affinity, len,
"irq_desc affinity", FAULT_ON_ERROR);
However the reading will exceed the effective memory range:
crash> kmem 0xffff97d03fffee60
CACHE OBJSIZE ALLOCATED TOTAL SLABS SSIZE NAME
ffff97c900044400 32 123297 162944 1273 4k kmalloc-32
SLAB MEMORY NODE TOTAL ALLOCATED FREE
fffffca460ffff80 ffff97d03fffe000 3 128 81 47
FREE / [ALLOCATED]
[ffff97d03fffee60]
PAGE PHYSICAL MAPPING INDEX CNT FLAGS
fffffca460ffff80 83fffe000 dead000000000001 ffff97d03fffe340 1 d7ffffe0000800 slab
crash> kmem ffff97d03ffff000
PAGE PHYSICAL MAPPING INDEX CNT FLAGS
fffffca460ffffc0 83ffff000 0 0 1 d7ffffe0004000 reserved
crash> dmesg
...
[ 0.000000] BIOS-e820: [mem 0x00000000fe000000-0x00000000fe00ffff] reserved
[ 0.000000] BIOS-e820: [mem 0x0000000100000000-0x000000083fffefff] usable
[ 0.000000] BIOS-e820: [mem 0x000000083ffff000-0x000000083fffffff] reserved
...
The beginning physical address, aka 0x83fffe000, is located in the usable
area and is readable, however the later physical address, starting from
0x83ffff000, is located in reserved region and not readable. In fact,
the affinity member is allocated by alloc_cpumask_var_node(), for the 192 CPUs
system, the allocated size is only 24, and we can see it is within
the kmalloc-32 slab. So it is incorrect to read 1024 length(given by
STRUCT_SIZE("cpumask_t")), only 24 is enough.
Since there are plenty of places in crash which takes the value of
STRUCT_SIZE("cpumask_t"), and works fine for the past, this patch will
not modify them all, only the one which encountered this issue(hunk in
kernel.c), and the one with the same DIV_ROUND_UP() (hunk in tools.c).
Signed-off-by: Tao Liu <ltao@redhat.com>
---
kernel.c | 8 +++++---
tools.c | 10 +++++++---
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/kernel.c b/kernel.c
index 8a9d498..adb19ad 100644
--- a/kernel.c
+++ b/kernel.c
@@ -7362,7 +7362,7 @@ void
generic_get_irq_affinity(int irq)
{
ulong irq_desc_addr;
- long len;
+ long len, len_cpumask;
ulong affinity_ptr;
ulong *affinity;
ulong tmp_addr;
@@ -7382,8 +7382,10 @@ generic_get_irq_affinity(int irq)
if (!action)
return;
- if ((len = STRUCT_SIZE("cpumask_t")) < 0)
- len = DIV_ROUND_UP(kt->cpus, BITS_PER_LONG) * sizeof(ulong);
+ len = DIV_ROUND_UP(kt->cpus, BITS_PER_LONG) * sizeof(ulong);
+ len_cpumask = STRUCT_SIZE("cpumask_t");
+ if (len_cpumask > 0)
+ len = len_cpumask > len ? len : len_cpumask;
affinity = (ulong *)GETBUF(len);
if (VALID_MEMBER(irq_common_data_affinity))
diff --git a/tools.c b/tools.c
index 1022d57..2b78b95 100644
--- a/tools.c
+++ b/tools.c
@@ -6718,9 +6718,13 @@ swap64(uint64_t val, int swap)
ulong *
get_cpumask_buf(void)
{
- int cpulen;
- if ((cpulen = STRUCT_SIZE("cpumask_t")) < 0)
- cpulen = DIV_ROUND_UP(kt->cpus, BITS_PER_LONG) * sizeof(ulong);
+ int cpulen, len_cpumask;
+
+ cpulen = DIV_ROUND_UP(kt->cpus, BITS_PER_LONG) * sizeof(ulong);
+ len_cpumask = STRUCT_SIZE("cpumask_t");
+ if (len_cpumask > 0)
+ cpulen = len_cpumask > cpulen ? cpulen : len_cpumask;
+
return (ulong *)GETBUF(cpulen);
}
--
2.40.1

View File

@ -0,0 +1,143 @@
From 48764a14bc5856f0b0bb30685336c68b832154fc Mon Sep 17 00:00:00 2001
From: Lianbo Jiang <lijiang@redhat.com>
Date: Fri, 7 Jun 2024 15:29:23 +0800
Subject: [PATCH 5/9] x86_64: fix for adding top_of_kernel_stack_padding for
kernel stack
With Kernel commit 65c9cc9e2c14 ("x86/fred: Reserve space for the FRED
stack frame") in Linux 6.9-rc1 and later, x86_64 will add extra padding
('TOP_OF_KERNEL_STACK_PADDING (2 * 8)', see: arch/x86/include/asm\
/thread_info.h,) for kernel stack when the CONFIG_X86_FRED is enabled.
As a result, the pt_regs will be moved downwards due to the offset of
padding, and the values of registers read from pt_regs will be incorrect
as below.
Without the patch:
crash> bt
PID: 2040 TASK: ffff969136fc4180 CPU: 16 COMMAND: "bash"
#0 [ffffa996409aba38] machine_kexec at ffffffff9f881eb7
#1 [ffffa996409aba90] __crash_kexec at ffffffff9fa1e49e
#2 [ffffa996409abb48] panic at ffffffff9f91a6cd
#3 [ffffa996409abbc8] sysrq_handle_crash at ffffffffa0015076
#4 [ffffa996409abbd0] __handle_sysrq at ffffffffa0015640
#5 [ffffa996409abc00] write_sysrq_trigger at ffffffffa0015ce5
#6 [ffffa996409abc28] proc_reg_write at ffffffff9fd35bf5
#7 [ffffa996409abc40] vfs_write at ffffffff9fc8d462
#8 [ffffa996409abcd0] ksys_write at ffffffff9fc8dadf
#9 [ffffa996409abd08] do_syscall_64 at ffffffffa0517429
#10 [ffffa996409abf40] entry_SYSCALL_64_after_hwframe at ffffffffa060012b
[exception RIP: unknown or invalid address]
RIP: 0000000000000246 RSP: 0000000000000000 RFLAGS: 0000002b
RAX: 0000000000000002 RBX: 00007f9b9f5b13e0 RCX: 000055cee7486fb0
RDX: 0000000000000001 RSI: 0000000000000001 RDI: 00007f9b9f4fda57
RBP: 0000000000000246 R8: 00007f9b9f4fda57 R9: ffffffffffffffda
R10: 0000000000000000 R11: 00007f9b9f5b14e0 R12: 0000000000000002
R13: 000055cee7486fb0 R14: 0000000000000002 R15: 00007f9b9f5fb780
ORIG_RAX: 0000000000000033 CS: 7ffe65327978 SS: 0000
bt: WARNING: possibly bogus exception frame
crash>
With the patch:
crash> bt
PID: 2040 TASK: ffff969136fc4180 CPU: 16 COMMAND: "bash"
#0 [ffffa996409aba38] machine_kexec at ffffffff9f881eb7
#1 [ffffa996409aba90] __crash_kexec at ffffffff9fa1e49e
#2 [ffffa996409abb48] panic at ffffffff9f91a6cd
#3 [ffffa996409abbc8] sysrq_handle_crash at ffffffffa0015076
#4 [ffffa996409abbd0] __handle_sysrq at ffffffffa0015640
#5 [ffffa996409abc00] write_sysrq_trigger at ffffffffa0015ce5
#6 [ffffa996409abc28] proc_reg_write at ffffffff9fd35bf5
#7 [ffffa996409abc40] vfs_write at ffffffff9fc8d462
#8 [ffffa996409abcd0] ksys_write at ffffffff9fc8dadf
#9 [ffffa996409abd08] do_syscall_64 at ffffffffa0517429
#10 [ffffa996409abf40] entry_SYSCALL_64_after_hwframe at ffffffffa060012b
RIP: 00007f9b9f4fda57 RSP: 00007ffe65327978 RFLAGS: 00000246
RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007f9b9f4fda57
RDX: 0000000000000002 RSI: 000055cee7486fb0 RDI: 0000000000000001
RBP: 000055cee7486fb0 R8: 0000000000000000 R9: 00007f9b9f5b14e0
R10: 00007f9b9f5b13e0 R11: 0000000000000246 R12: 0000000000000002
R13: 00007f9b9f5fb780 R14: 0000000000000002 R15: 00007f9b9f5f69e0
ORIG_RAX: 0000000000000001 CS: 0033 SS: 002b
crash>
Link: https://www.mail-archive.com/devel@lists.crash-utility.osci.io/msg00754.html
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
---
defs.h | 1 +
kernel.c | 1 +
symbols.c | 1 +
x86_64.c | 6 ++++--
4 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/defs.h b/defs.h
index 01f316e..42d8759 100644
--- a/defs.h
+++ b/defs.h
@@ -2414,6 +2414,7 @@ struct size_table { /* stash of commonly-used sizes */
long maple_tree;
long maple_node;
long module_memory;
+ long fred_frame;
};
struct array_table {
diff --git a/kernel.c b/kernel.c
index 1728b70..cd3d604 100644
--- a/kernel.c
+++ b/kernel.c
@@ -668,6 +668,7 @@ kernel_init()
STRUCT_SIZE_INIT(softirq_state, "softirq_state");
STRUCT_SIZE_INIT(softirq_action, "softirq_action");
STRUCT_SIZE_INIT(desc_struct, "desc_struct");
+ STRUCT_SIZE_INIT(fred_frame, "fred_frame");
STRUCT_SIZE_INIT(char_device_struct, "char_device_struct");
if (VALID_STRUCT(char_device_struct)) {
diff --git a/symbols.c b/symbols.c
index b7627a8..301ce35 100644
--- a/symbols.c
+++ b/symbols.c
@@ -11847,6 +11847,7 @@ dump_offset_table(char *spec, ulong makestruct)
fprintf(fp, " task_struct_flags: %ld\n", SIZE(task_struct_flags));
fprintf(fp, " task_struct_policy: %ld\n", SIZE(task_struct_policy));
fprintf(fp, " thread_info: %ld\n", SIZE(thread_info));
+ fprintf(fp, " fred_frame: %ld\n", SIZE(fred_frame));
fprintf(fp, " softirq_state: %ld\n",
SIZE(softirq_state));
fprintf(fp, " softirq_action: %ld\n",
diff --git a/x86_64.c b/x86_64.c
index 0c21eb8..6777c93 100644
--- a/x86_64.c
+++ b/x86_64.c
@@ -4086,10 +4086,11 @@ in_exception_stack:
if (!irq_eframe && !is_kernel_thread(bt->tc->task) &&
(GET_STACKBASE(bt->tc->task) == bt->stackbase)) {
+ long stack_padding_size = SIZE(fred_frame) > 0 ? (2*8) : 0;
user_mode_eframe = bt->stacktop - SIZE(pt_regs);
if (last_process_stack_eframe < user_mode_eframe)
x86_64_exception_frame(EFRAME_PRINT, 0, bt->stackbuf +
- (bt->stacktop - bt->stackbase) - SIZE(pt_regs),
+ (bt->stacktop - stack_padding_size - bt->stackbase) - SIZE(pt_regs),
bt, ofp);
}
@@ -4407,10 +4408,11 @@ in_exception_stack:
if (!irq_eframe && !is_kernel_thread(bt->tc->task) &&
(GET_STACKBASE(bt->tc->task) == bt->stackbase)) {
+ long stack_padding_size = SIZE(fred_frame) > 0 ? (2*8) : 0;
user_mode_eframe = bt->stacktop - SIZE(pt_regs);
if (last_process_stack_eframe < user_mode_eframe)
x86_64_exception_frame(EFRAME_PRINT, 0, bt->stackbuf +
- (bt->stacktop - bt->stackbase) - SIZE(pt_regs),
+ (bt->stacktop - stack_padding_size - bt->stackbase) - SIZE(pt_regs),
bt, ofp);
}
--
2.40.1

View File

@ -0,0 +1,304 @@
From 7c2c90d0b06a0dad00819b7f22be204664a698ff Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?HAGIO=20KAZUHITO=28=E8=90=A9=E5=B0=BE=E3=80=80=E4=B8=80?=
=?UTF-8?q?=E4=BB=81=29?= <k-hagio-ab@nec.com>
Date: Wed, 5 Jun 2024 07:30:03 +0000
Subject: [PATCH 6/9] Fix "kmem -v" option on Linux 6.9 and later kernels
The following kernel commits removed vmap_area_list and vmap_area_root
rb-tree, and introduced vmap_nodes.
55c49fee57af mm/vmalloc: remove vmap_area_list
d093602919ad mm: vmalloc: remove global vmap_area_root rb-tree
Without the patch, the "kmem -v" option and functions that use
dump_vmlist() fail with or without an error:
crash> kmem -v
VM_STRUCT ADDRESS RANGE SIZE
kmem: invalid kernel virtual address: ccccccccccccccd4 type: "vmlist addr"
crash> kmem -v
crash>
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
---
defs.h | 4 ++
memory.c | 135 +++++++++++++++++++++++++++++++++++++++++++++---------
symbols.c | 3 ++
3 files changed, 120 insertions(+), 22 deletions(-)
diff --git a/defs.h b/defs.h
index 42d8759..da856c0 100644
--- a/defs.h
+++ b/defs.h
@@ -2240,6 +2240,8 @@ struct offset_table { /* stash of commonly-used offsets */
long mnt_namespace_nr_mounts;
long mount_mnt_node;
long log_caller_id;
+ long vmap_node_busy;
+ long rb_list_head;
};
struct size_table { /* stash of commonly-used sizes */
@@ -2415,6 +2417,7 @@ struct size_table { /* stash of commonly-used sizes */
long maple_node;
long module_memory;
long fred_frame;
+ long vmap_node;
};
struct array_table {
@@ -2679,6 +2682,7 @@ struct vm_table { /* kernel VM-related data */
#define SLAB_OVERLOAD_PAGE (0x8000000)
#define SLAB_CPU_CACHE (0x10000000)
#define SLAB_ROOT_CACHES (0x20000000)
+#define USE_VMAP_NODES (0x40000000)
#define IS_FLATMEM() (vt->flags & FLATMEM)
#define IS_DISCONTIGMEM() (vt->flags & DISCONTIGMEM)
diff --git a/memory.c b/memory.c
index 34ed646..acb8507 100644
--- a/memory.c
+++ b/memory.c
@@ -235,6 +235,7 @@ static void dump_slab_objects(struct meminfo *);
static void dump_slab_objects_percpu(struct meminfo *);
static void dump_vmlist(struct meminfo *);
static void dump_vmap_area(struct meminfo *);
+static int get_vmap_area_list_from_nodes(ulong **);
static int dump_page_lists(struct meminfo *);
static void dump_kmeminfo(void);
static int page_to_phys(ulong, physaddr_t *);
@@ -433,9 +434,15 @@ vm_init(void)
if (VALID_MEMBER(vmap_area_va_start) &&
VALID_MEMBER(vmap_area_va_end) &&
VALID_MEMBER(vmap_area_list) &&
- VALID_MEMBER(vmap_area_vm) &&
- kernel_symbol_exists("vmap_area_list"))
- vt->flags |= USE_VMAP_AREA;
+ VALID_MEMBER(vmap_area_vm)) {
+ if (kernel_symbol_exists("vmap_nodes")) {
+ STRUCT_SIZE_INIT(vmap_node, "vmap_node");
+ MEMBER_OFFSET_INIT(vmap_node_busy, "vmap_node", "busy");
+ MEMBER_OFFSET_INIT(rb_list_head, "rb_list", "head");
+ vt->flags |= USE_VMAP_NODES;
+ } else if (kernel_symbol_exists("vmap_area_list"))
+ vt->flags |= USE_VMAP_AREA;
+ }
if (kernel_symbol_exists("hstates")) {
STRUCT_SIZE_INIT(hstate, "hstate");
@@ -8957,7 +8964,7 @@ dump_vmlist(struct meminfo *vi)
physaddr_t paddr;
int mod_vmlist;
- if (vt->flags & USE_VMAP_AREA) {
+ if (vt->flags & (USE_VMAP_AREA|USE_VMAP_NODES)) {
dump_vmap_area(vi);
return;
}
@@ -9067,6 +9074,77 @@ next_entry:
vi->retval = verified;
}
+static int
+sort_by_va_start(const void *arg1, const void *arg2)
+{
+ ulong va_start1, va_start2;
+
+ readmem(*(ulong *)arg1 + OFFSET(vmap_area_va_start), KVADDR, &va_start1,
+ sizeof(void *), "vmap_area.va_start", FAULT_ON_ERROR);
+ readmem(*(ulong *)arg2 + OFFSET(vmap_area_va_start), KVADDR, &va_start2,
+ sizeof(void *), "vmap_area.va_start", FAULT_ON_ERROR);
+
+ return va_start1 < va_start2 ? -1 : (va_start1 == va_start2 ? 0 : 1);
+}
+
+/* Linux 6.9 and later kernels use "vmap_nodes". */
+static int
+get_vmap_area_list_from_nodes(ulong **list_ptr)
+{
+ int i, cnt, c;
+ struct list_data list_data, *ld = &list_data;
+ uint nr_vmap_nodes;
+ ulong vmap_nodes, list_head;
+ ulong *list, *ptr;
+
+ get_symbol_data("nr_vmap_nodes", sizeof(uint), &nr_vmap_nodes);
+ get_symbol_data("vmap_nodes", sizeof(ulong), &vmap_nodes);
+
+ /* count up all vmap_areas. */
+ cnt = 0;
+ for (i = 0; i < nr_vmap_nodes; i++) {
+ BZERO(ld, sizeof(struct list_data));
+ list_head = vmap_nodes + SIZE(vmap_node) * i +
+ OFFSET(vmap_node_busy) + OFFSET(rb_list_head);
+ readmem(list_head, KVADDR, &ld->start, sizeof(void *),
+ "rb_list.head", FAULT_ON_ERROR);
+ ld->list_head_offset = OFFSET(vmap_area_list);
+ ld->end = list_head;
+ c = do_list(ld);
+ if (c < 0)
+ return -1;
+
+ cnt += c;
+ }
+
+ list = ptr = (ulong *)GETBUF(sizeof(void *) * cnt);
+
+ /* gather all vmap_areas into a list. */
+ for (i = 0; i < nr_vmap_nodes; i++) {
+ BZERO(ld, sizeof(struct list_data));
+ ld->flags = LIST_ALLOCATE;
+ list_head = vmap_nodes + SIZE(vmap_node) * i +
+ OFFSET(vmap_node_busy) + OFFSET(rb_list_head);
+ readmem(list_head, KVADDR, &ld->start, sizeof(void *),
+ "rb_list.head", FAULT_ON_ERROR);
+ ld->list_head_offset = OFFSET(vmap_area_list);
+ ld->end = list_head;
+ c = do_list(ld);
+ if (c < 0)
+ return -1;
+
+ memcpy(ptr, ld->list_ptr, sizeof(void *) * c);
+ ptr += c;
+
+ FREEBUF(ld->list_ptr);
+ }
+
+ qsort(list, cnt, sizeof(void *), sort_by_va_start);
+
+ *list_ptr = list;
+ return cnt;
+}
+
static void
dump_vmap_area(struct meminfo *vi)
{
@@ -9080,26 +9158,37 @@ dump_vmap_area(struct meminfo *vi)
char buf2[BUFSIZE];
char buf3[BUFSIZE];
char buf4[BUFSIZE];
+ ulong *list_ptr;
#define VM_VM_AREA 0x4 /* mm/vmalloc.c */
- vmap_area_buf = GETBUF(SIZE(vmap_area));
start = count = verified = size = 0;
- ld = &list_data;
- BZERO(ld, sizeof(struct list_data));
- ld->flags = LIST_HEAD_FORMAT|LIST_HEAD_POINTER|LIST_ALLOCATE;
- get_symbol_data("vmap_area_list", sizeof(void *), &ld->start);
- ld->list_head_offset = OFFSET(vmap_area_list);
- ld->end = symbol_value("vmap_area_list");
- cnt = do_list(ld);
- if (cnt < 0) {
- FREEBUF(vmap_area_buf);
- error(WARNING, "invalid/corrupt vmap_area_list\n");
- vi->retval = 0;
- return;
+ if (vt->flags & USE_VMAP_NODES) {
+ cnt = get_vmap_area_list_from_nodes(&list_ptr);
+ if (cnt < 0) {
+ error(WARNING, "invalid/corrupt vmap_nodes.busy list\n");
+ vi->retval = 0;
+ return;
+ }
+ } else {
+ ld = &list_data;
+ BZERO(ld, sizeof(struct list_data));
+ ld->flags = LIST_HEAD_FORMAT|LIST_HEAD_POINTER|LIST_ALLOCATE;
+ get_symbol_data("vmap_area_list", sizeof(void *), &ld->start);
+ ld->list_head_offset = OFFSET(vmap_area_list);
+ ld->end = symbol_value("vmap_area_list");
+ cnt = do_list(ld);
+ if (cnt < 0) {
+ error(WARNING, "invalid/corrupt vmap_area_list\n");
+ vi->retval = 0;
+ return;
+ }
+ list_ptr = ld->list_ptr;
}
+ vmap_area_buf = GETBUF(SIZE(vmap_area));
+
for (i = 0; i < cnt; i++) {
if (!(pc->curcmd_flags & HEADER_PRINTED) && (i == 0) &&
!(vi->flags & (GET_HIGHEST|GET_PHYS_TO_VMALLOC|
@@ -9116,7 +9205,7 @@ dump_vmap_area(struct meminfo *vi)
pc->curcmd_flags |= HEADER_PRINTED;
}
- readmem(ld->list_ptr[i], KVADDR, vmap_area_buf,
+ readmem(list_ptr[i], KVADDR, vmap_area_buf,
SIZE(vmap_area), "vmap_area struct", FAULT_ON_ERROR);
if (VALID_MEMBER(vmap_area_flags) &&
@@ -9158,7 +9247,7 @@ dump_vmap_area(struct meminfo *vi)
}
fprintf(fp, "%s%s %s%s %s - %s %7ld\n",
mkstring(buf1,VADDR_PRLEN, LONG_HEX|CENTER|LJUST,
- MKSTR(ld->list_ptr[i])), space(MINSPACE-1),
+ MKSTR(list_ptr[i])), space(MINSPACE-1),
mkstring(buf2,VADDR_PRLEN, LONG_HEX|CENTER|LJUST,
MKSTR(vm_struct)), space(MINSPACE-1),
mkstring(buf3, VADDR_PRLEN, LONG_HEX|RJUST,
@@ -9179,14 +9268,14 @@ dump_vmap_area(struct meminfo *vi)
if (vi->flags & GET_PHYS_TO_VMALLOC) {
vi->retval = pcheck +
PAGEOFFSET(vi->spec_addr);
- FREEBUF(ld->list_ptr);
+ FREEBUF(list_ptr);
return;
} else
fprintf(fp,
"%s%s %s%s %s - %s %7ld\n",
mkstring(buf1,VADDR_PRLEN,
LONG_HEX|CENTER|LJUST,
- MKSTR(ld->list_ptr[i])),
+ MKSTR(list_ptr[i])),
space(MINSPACE-1),
mkstring(buf2, VADDR_PRLEN,
LONG_HEX|CENTER|LJUST,
@@ -9204,7 +9293,7 @@ dump_vmap_area(struct meminfo *vi)
}
FREEBUF(vmap_area_buf);
- FREEBUF(ld->list_ptr);
+ FREEBUF(list_ptr);
if (vi->flags & GET_HIGHEST)
vi->retval = start+size;
@@ -14001,6 +14090,8 @@ dump_vm_table(int verbose)
fprintf(fp, "%sSLAB_ROOT_CACHES", others++ ? "|" : "");\
if (vt->flags & USE_VMAP_AREA)
fprintf(fp, "%sUSE_VMAP_AREA", others++ ? "|" : "");\
+ if (vt->flags & USE_VMAP_NODES)
+ fprintf(fp, "%sUSE_VMAP_NODES", others++ ? "|" : "");\
if (vt->flags & CONFIG_NUMA)
fprintf(fp, "%sCONFIG_NUMA", others++ ? "|" : "");\
if (vt->flags & VM_EVENT)
diff --git a/symbols.c b/symbols.c
index 301ce35..107920f 100644
--- a/symbols.c
+++ b/symbols.c
@@ -10167,6 +10167,8 @@ dump_offset_table(char *spec, ulong makestruct)
fprintf(fp, " vmap_area_flags: %ld\n",
OFFSET(vmap_area_flags));
fprintf(fp, " vmap_area_purge_list: %ld\n", OFFSET(vmap_area_purge_list));
+ fprintf(fp, " vmap_node_busy: %ld\n", OFFSET(vmap_node_busy));
+ fprintf(fp, " rb_list_head: %ld\n", OFFSET(rb_list_head));
fprintf(fp, " module_size_of_struct: %ld\n",
OFFSET(module_size_of_struct));
@@ -12041,6 +12043,7 @@ dump_offset_table(char *spec, ulong makestruct)
SIZE(task_group));
fprintf(fp, " vmap_area: %ld\n",
SIZE(vmap_area));
+ fprintf(fp, " vmap_node: %ld\n", SIZE(vmap_node));
fprintf(fp, " hrtimer_clock_base: %ld\n",
SIZE(hrtimer_clock_base));
fprintf(fp, " hrtimer_base: %ld\n",
--
2.40.1

View File

@ -0,0 +1,70 @@
From 6752571d8d782d07537a258a1ec8919ebd1308ad Mon Sep 17 00:00:00 2001
From: Lianbo Jiang <lijiang@redhat.com>
Date: Wed, 5 Jun 2024 16:28:58 +0800
Subject: [PATCH 7/9] X86 64: fix for crash session loading failure
Kernel commit 223b5e57d0d5 ("mm/execmem, arch: convert remaining
overrides of module_alloc to execmem") makes crash session loading
failure as below:
# ./crash -s
crash: seek error: kernel virtual address: ffffffff826bb418 type: "page_offset_base"
For X86 64 architecture, currently crash will search for symbol
"module_load_offset" to determine if the KASLR is enabled, and go
into the relevant code block. But the symbols "module_load_offset"
has been removed since Linux v6.10-rc1, which caused the current
failure.
And this issue can occur with live debugging and core dump file
debugging.
Let's check the symbol "kaslr_regions" instead of "module_load_offset"
to fix it.
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
---
symbols.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/symbols.c b/symbols.c
index 107920f..f3c94b0 100644
--- a/symbols.c
+++ b/symbols.c
@@ -619,9 +619,9 @@ strip_symbol_end(const char *name, char *buf)
* or in /proc/kallsyms on a live system.
*
* Setting KASLR_CHECK will trigger a search for "module_load_offset"
- * during the initial symbol sort operation, and if found, will
- * set (RELOC_AUTO|KASLR). On live systems, the search is done
- * here by checking /proc/kallsyms.
+ * or "kaslr_regions" during the initial symbol sort operation, and
+ * if found, will set (RELOC_AUTO|KASLR). On live systems, the search
+ * is done here by checking /proc/kallsyms.
*/
static void
kaslr_init(void)
@@ -646,7 +646,8 @@ kaslr_init(void)
st->_stext_vmlinux = UNINITIALIZED;
if (ACTIVE() && /* Linux 3.15 */
- (symbol_value_from_proc_kallsyms("module_load_offset") != BADVAL)) {
+ ((symbol_value_from_proc_kallsyms("kaslr_regions") != BADVAL) ||
+ (symbol_value_from_proc_kallsyms("module_load_offset") != BADVAL))) {
kt->flags2 |= (RELOC_AUTO|KASLR);
st->_stext_vmlinux = UNINITIALIZED;
}
@@ -14251,7 +14252,9 @@ numeric_forward(const void *P_x, const void *P_y)
st->_stext_vmlinux = valueof(y);
}
if (kt->flags2 & KASLR_CHECK) {
- if (STREQ(x->name, "module_load_offset") ||
+ if (STREQ(x->name, "kaslr_regions") ||
+ STREQ(y->name, "kaslr_regions") ||
+ STREQ(x->name, "module_load_offset") ||
STREQ(y->name, "module_load_offset")) {
kt->flags2 &= ~KASLR_CHECK;
kt->flags2 |= (RELOC_AUTO|KASLR);
--
2.40.1

View File

@ -0,0 +1,82 @@
From a20eb05de3c1cab954d49eb8bb9dc7fe5224caa0 Mon Sep 17 00:00:00 2001
From: Lianbo Jiang <lijiang@redhat.com>
Date: Wed, 5 Jun 2024 17:30:33 +0800
Subject: [PATCH 8/9] Fix for failing to load kernel module
In some kernel modules such as libie.ko, the mem[MOD_TEXT].size
may be zero, currently crash will only check its value to determine
if the module is valid, otherwise it fails to load kernel module with
the following warning and error:
WARNING: invalid kernel module size: 0
KERNEL: /lib/modules/6.10.0-rc1+/build/vmlinux
DUMPFILE: /proc/kcore
CPUS: 64
DATE: Wed Jun 5 12:49:02 IDT 2024
UPTIME: 5 days, 05:57:21
LOAD AVERAGE: 0.28, 0.06, 0.02
TASKS: 806
NODENAME: xxxx
RELEASE: 6.10.0-rc1+
VERSION: #1 SMP PREEMPT_DYNAMIC Fri May 31 04:56:59 IDT 2024
MACHINE: x86_64 (2100 Mhz)
MEMORY: 1.6 GB
PID: 203686
COMMAND: "crash"
TASK: ffff9f9bf66d0000 [THREAD_INFO: ffff9f9bf66d0000]
CPU: 52
STATE: TASK_RUNNING (ACTIVE)
crash> mod
mod: cannot access vmalloc'd module memory
crash>
Lets count the module size to check if the module is valid, that will
avoid the current failure.
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
---
kernel.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/kernel.c b/kernel.c
index cd3d604..8a9d498 100644
--- a/kernel.c
+++ b/kernel.c
@@ -3822,9 +3822,21 @@ module_init(void)
case KALLSYMS_V2:
if (THIS_KERNEL_VERSION >= LINUX(2,6,27)) {
numksyms = UINT(modbuf + OFFSET(module_num_symtab));
- if (MODULE_MEMORY())
- /* check mem[MOD_TEXT].size only */
- size = UINT(modbuf + OFFSET(module_mem) + OFFSET(module_memory_size));
+ if (MODULE_MEMORY()) {
+ /*
+ * The mem[MOD_TEXT].size may be zero, lets count
+ * the module size as below.
+ */
+ int t;
+ size = 0;
+ for_each_mod_mem_type(t) {
+ if (t == MOD_INIT_TEXT)
+ break;
+ size += UINT(modbuf + OFFSET(module_mem) +
+ SIZE(module_memory) * t +
+ OFFSET(module_memory_size));
+ }
+ }
else
size = UINT(modbuf + MODULE_OFFSET2(module_core_size, rx));
} else {
@@ -3927,7 +3939,7 @@ verify_modules(void)
for (i = 0, found = FALSE; i < kt->mods_installed; i++) {
lm = &st->load_modules[i];
- if (!kvtop(NULL, lm->mod_base, &paddr, 0)) {
+ if (lm->mod_base && !kvtop(NULL, lm->mod_base, &paddr, 0)) {
irregularities++;
break;
}
--
2.40.1

View File

@ -0,0 +1,69 @@
From 196c4b79c13d1c0e6d7b21c8321eca07d3838d6a Mon Sep 17 00:00:00 2001
From: Lianbo Jiang <lijiang@redhat.com>
Date: Wed, 12 Jun 2024 11:00:00 +0800
Subject: [PATCH 9/9] X86 64: fix a regression issue about kernel stack padding
The commit 48764a14bc58 may cause a regression issue when the CONFIG_X86_FRED
is not enabled, this is because the SIZE(fred_frame) will call the
SIZE_verify() to determine if the fred_frame is valid, otherwise it will
emit an error:
crash> bt 1
bt: invalid structure size: fred_frame
FILE: x86_64.c LINE: 4089 FUNCTION: x86_64_low_budget_back_trace_cmd()
[/home/k-hagio/bin/crash] error trace: 588df3 => 5cbc72 => 5eb3e1 => 5eb366
PID: 1 TASK: ffff9f94c024b980 CPU: 2 COMMAND: "systemd"
#0 [ffffade44001bca8] __schedule at ffffffffb948ebbb
#1 [ffffade44001bd10] schedule at ffffffffb948f04d
#2 [ffffade44001bd20] schedule_hrtimeout_range_clock at ffffffffb9494fef
#3 [ffffade44001bda8] ep_poll at ffffffffb8c91be8
#4 [ffffade44001be48] do_epoll_wait at ffffffffb8c91d11
#5 [ffffade44001be80] __x64_sys_epoll_wait at ffffffffb8c92590
#6 [ffffade44001bed0] do_syscall_64 at ffffffffb947f459
#7 [ffffade44001bf50] entry_SYSCALL_64_after_hwframe at ffffffffb96000ea
5eb366: SIZE_verify.part.42+70
5eb3e1: SIZE_verify+49
5cbc72: x86_64_low_budget_back_trace_cmd+3010
588df3: back_trace+1523
bt: invalid structure size: fred_frame
FILE: x86_64.c LINE: 4089 FUNCTION: x86_64_low_budget_back_trace_cmd()
Let's replace the SIZE(fred_frame) with the VALID_SIZE(fred_frame) to
fix it.
Fixes: 48764a14bc58 ("x86_64: fix for adding top_of_kernel_stack_padding for kernel stack")
Reported-by: Kazuhito Hagio <k-hagio-ab@nec.com>
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
---
x86_64.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/x86_64.c b/x86_64.c
index 6777c93..469d26b 100644
--- a/x86_64.c
+++ b/x86_64.c
@@ -4086,7 +4086,7 @@ in_exception_stack:
if (!irq_eframe && !is_kernel_thread(bt->tc->task) &&
(GET_STACKBASE(bt->tc->task) == bt->stackbase)) {
- long stack_padding_size = SIZE(fred_frame) > 0 ? (2*8) : 0;
+ long stack_padding_size = VALID_SIZE(fred_frame) ? (2*8) : 0;
user_mode_eframe = bt->stacktop - SIZE(pt_regs);
if (last_process_stack_eframe < user_mode_eframe)
x86_64_exception_frame(EFRAME_PRINT, 0, bt->stackbuf +
@@ -4408,7 +4408,7 @@ in_exception_stack:
if (!irq_eframe && !is_kernel_thread(bt->tc->task) &&
(GET_STACKBASE(bt->tc->task) == bt->stackbase)) {
- long stack_padding_size = SIZE(fred_frame) > 0 ? (2*8) : 0;
+ long stack_padding_size = VALID_SIZE(fred_frame) ? (2*8) : 0;
user_mode_eframe = bt->stacktop - SIZE(pt_regs);
if (last_process_stack_eframe < user_mode_eframe)
x86_64_exception_frame(EFRAME_PRINT, 0, bt->stackbuf +
--
2.40.1

View File

@ -1,142 +0,0 @@
From 38acd02c7fc09843ffb10fc2d695cccdd10cc7f6 Mon Sep 17 00:00:00 2001
From: Chengen Du <chengen.du@canonical.com>
Date: Fri, 17 Nov 2023 11:45:33 +0800
Subject: [PATCH 01/14] Fix "rd" command for zram data display in Linux 6.2 and
later
Kernel commit 7ac07a26dea7 ("zram: preparation for multi-zcomp support")
replaced "compressor" member with "comp_algs" in the zram struct.
Without the patch, the "rd" command can triggers the following error:
rd: WARNING: Some pages are swapped out to zram. Please run mod -s zram.
rd: invalid user virtual address: ffff7d23f010 type: "64-bit UVADDR"
Related kernel commit:
84b33bf78889 ("zram: introduce recompress sysfs knob")
Signed-off-by: Chengen Du <chengen.du@canonical.com>
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
---
defs.h | 1 +
diskdump.c | 47 ++++++++++++++++++++++++++++++-----------------
2 files changed, 31 insertions(+), 17 deletions(-)
diff --git a/defs.h b/defs.h
index 788f63ada739..2cae5b61e589 100644
--- a/defs.h
+++ b/defs.h
@@ -2227,6 +2227,7 @@ struct offset_table { /* stash of commonly-used offsets */
long module_memory_size;
long irq_data_irq;
long zspage_huge;
+ long zram_comp_algs;
};
struct size_table { /* stash of commonly-used sizes */
diff --git a/diskdump.c b/diskdump.c
index 0fe46f4644d0..25054d96313e 100644
--- a/diskdump.c
+++ b/diskdump.c
@@ -2757,6 +2757,8 @@ diskdump_device_dump_info(FILE *ofp)
static ulong ZRAM_FLAG_SHIFT;
static ulong ZRAM_FLAG_SAME_BIT;
+static ulong ZRAM_COMP_PRIORITY_BIT1;
+static ulong ZRAM_COMP_PRIORITY_MASK;
static void
zram_init(void)
@@ -2765,6 +2767,8 @@ zram_init(void)
MEMBER_OFFSET_INIT(zram_mempoll, "zram", "mem_pool");
MEMBER_OFFSET_INIT(zram_compressor, "zram", "compressor");
+ if (INVALID_MEMBER(zram_compressor))
+ MEMBER_OFFSET_INIT(zram_comp_algs, "zram", "comp_algs");
MEMBER_OFFSET_INIT(zram_table_flag, "zram_table_entry", "flags");
if (INVALID_MEMBER(zram_table_flag))
MEMBER_OFFSET_INIT(zram_table_flag, "zram_table_entry", "value");
@@ -2782,6 +2786,8 @@ zram_init(void)
ZRAM_FLAG_SHIFT = 1 << zram_flag_shift;
ZRAM_FLAG_SAME_BIT = 1 << (zram_flag_shift+1);
+ ZRAM_COMP_PRIORITY_BIT1 = ZRAM_FLAG_SHIFT + 7;
+ ZRAM_COMP_PRIORITY_MASK = 0x3;
if (CRASHDEBUG(1))
fprintf(fp, "zram_flag_shift: %ld\n", zram_flag_shift);
@@ -2981,9 +2987,9 @@ try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong
ulong zram, zram_table_entry, sector, index, entry, flags, size,
outsize, off;
- if (INVALID_MEMBER(zram_compressor)) {
+ if (INVALID_MEMBER(zram_mempoll)) {
zram_init();
- if (INVALID_MEMBER(zram_compressor)) {
+ if (INVALID_MEMBER(zram_mempoll)) {
error(WARNING,
"Some pages are swapped out to zram. "
"Please run mod -s zram.\n");
@@ -2997,8 +3003,28 @@ try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong
if (!get_disk_name_private_data(pte_val, vaddr, NULL, &zram))
return 0;
- readmem(zram + OFFSET(zram_compressor), KVADDR, name,
- sizeof(name), "zram compressor", FAULT_ON_ERROR);
+ if (THIS_KERNEL_VERSION >= LINUX(2, 6, 0))
+ swp_offset = (ulonglong)__swp_offset(pte_val);
+ else
+ swp_offset = (ulonglong)SWP_OFFSET(pte_val);
+
+ sector = swp_offset << (PAGESHIFT() - 9);
+ index = sector >> SECTORS_PER_PAGE_SHIFT;
+ readmem(zram, KVADDR, &zram_table_entry,
+ sizeof(void *), "zram_table_entry", FAULT_ON_ERROR);
+ zram_table_entry += (index * SIZE(zram_table_entry));
+ readmem(zram_table_entry + OFFSET(zram_table_flag), KVADDR, &flags,
+ sizeof(void *), "zram_table_flag", FAULT_ON_ERROR);
+ if (VALID_MEMBER(zram_compressor))
+ readmem(zram + OFFSET(zram_compressor), KVADDR, name, sizeof(name),
+ "zram compressor", FAULT_ON_ERROR);
+ else {
+ ulong comp_alg_addr;
+ uint32_t prio = (flags >> ZRAM_COMP_PRIORITY_BIT1) & ZRAM_COMP_PRIORITY_MASK;
+ readmem(zram + OFFSET(zram_comp_algs) + sizeof(const char *) * prio, KVADDR,
+ &comp_alg_addr, sizeof(comp_alg_addr), "zram comp_algs", FAULT_ON_ERROR);
+ read_string(comp_alg_addr, name, sizeof(name));
+ }
if (STREQ(name, "lzo")) {
#ifdef LZO
if (!(dd->flags & LZO_SUPPORTED)) {
@@ -3019,12 +3045,6 @@ try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong
return 0;
}
- if (THIS_KERNEL_VERSION >= LINUX(2, 6, 0)) {
- swp_offset = (ulonglong)__swp_offset(pte_val);
- } else {
- swp_offset = (ulonglong)SWP_OFFSET(pte_val);
- }
-
zram_buf = (unsigned char *)GETBUF(PAGESIZE());
/* lookup page from swap cache */
off = PAGEOFFSET(vaddr);
@@ -3034,15 +3054,8 @@ try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong
goto out;
}
- sector = swp_offset << (PAGESHIFT() - 9);
- index = sector >> SECTORS_PER_PAGE_SHIFT;
- readmem(zram, KVADDR, &zram_table_entry,
- sizeof(void *), "zram_table_entry", FAULT_ON_ERROR);
- zram_table_entry += (index * SIZE(zram_table_entry));
readmem(zram_table_entry, KVADDR, &entry,
sizeof(void *), "entry of table", FAULT_ON_ERROR);
- readmem(zram_table_entry + OFFSET(zram_table_flag), KVADDR, &flags,
- sizeof(void *), "zram_table_flag", FAULT_ON_ERROR);
if (!entry || (flags & ZRAM_FLAG_SAME_BIT)) {
int count;
ulong *same_buf = (ulong *)GETBUF(PAGESIZE());
--
2.41.0

View File

@ -1,168 +0,0 @@
From d65e5d3eae0dd06a5308a5cb00c05fee60594093 Mon Sep 17 00:00:00 2001
From: Kazuhito Hagio <k-hagio-ab@nec.com>
Date: Mon, 20 Nov 2023 13:22:56 +0900
Subject: [PATCH 02/14] Fix typos in offset_table and missing "help -o" items
A few of zram related members in the offset_table have typos and
irregular naming rule, also they are not present in the "help -o"
output. Let's fix these.
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
---
defs.h | 8 ++++----
diskdump.c | 24 ++++++++++++------------
memory.c | 2 +-
symbols.c | 12 ++++++++++++
4 files changed, 29 insertions(+), 17 deletions(-)
diff --git a/defs.h b/defs.h
index 2cae5b61e589..5218a94fe4a4 100644
--- a/defs.h
+++ b/defs.h
@@ -2112,13 +2112,13 @@ struct offset_table { /* stash of commonly-used offsets */
long bpf_prog_aux_name;
long page_private;
long swap_info_struct_bdev;
- long zram_mempoll;
+ long zram_mem_pool;
long zram_compressor;
- long zram_table_flag;
- long zspoll_size_class;
+ long zram_table_entry_flags;
+ long zs_pool_size_class;
long size_class_size;
long gendisk_private_data;
- long zram_table_entry;
+ long zram_table_entry; /* unused; but cannot remove */
long module_core_size_rw;
long module_core_size_rx;
long module_init_size_rw;
diff --git a/diskdump.c b/diskdump.c
index 25054d96313e..f20f3ac519a1 100644
--- a/diskdump.c
+++ b/diskdump.c
@@ -2765,15 +2765,15 @@ zram_init(void)
{
long zram_flag_shift;
- MEMBER_OFFSET_INIT(zram_mempoll, "zram", "mem_pool");
+ MEMBER_OFFSET_INIT(zram_mem_pool, "zram", "mem_pool");
MEMBER_OFFSET_INIT(zram_compressor, "zram", "compressor");
if (INVALID_MEMBER(zram_compressor))
MEMBER_OFFSET_INIT(zram_comp_algs, "zram", "comp_algs");
- MEMBER_OFFSET_INIT(zram_table_flag, "zram_table_entry", "flags");
- if (INVALID_MEMBER(zram_table_flag))
- MEMBER_OFFSET_INIT(zram_table_flag, "zram_table_entry", "value");
+ MEMBER_OFFSET_INIT(zram_table_entry_flags, "zram_table_entry", "flags");
+ if (INVALID_MEMBER(zram_table_entry_flags))
+ MEMBER_OFFSET_INIT(zram_table_entry_flags, "zram_table_entry", "value");
STRUCT_SIZE_INIT(zram_table_entry, "zram_table_entry");
- MEMBER_OFFSET_INIT(zspoll_size_class, "zs_pool", "size_class");
+ MEMBER_OFFSET_INIT(zs_pool_size_class, "zs_pool", "size_class");
MEMBER_OFFSET_INIT(size_class_size, "size_class", "size");
MEMBER_OFFSET_INIT(zspage_huge, "zspage", "huge");
@@ -2826,7 +2826,7 @@ zram_object_addr(ulong pool, ulong handle, unsigned char *zram_buf)
if (zs_magic != ZSPAGE_MAGIC)
error(FATAL, "zspage magic incorrect: %x\n", zs_magic);
- class = pool + OFFSET(zspoll_size_class);
+ class = pool + OFFSET(zs_pool_size_class);
class += (class_idx * sizeof(void *));
readmem(class, KVADDR, &class, sizeof(void *), "size_class", FAULT_ON_ERROR);
readmem(class + OFFSET(size_class_size), KVADDR,
@@ -2987,9 +2987,9 @@ try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong
ulong zram, zram_table_entry, sector, index, entry, flags, size,
outsize, off;
- if (INVALID_MEMBER(zram_mempoll)) {
+ if (INVALID_MEMBER(zram_mem_pool)) {
zram_init();
- if (INVALID_MEMBER(zram_mempoll)) {
+ if (INVALID_MEMBER(zram_mem_pool)) {
error(WARNING,
"Some pages are swapped out to zram. "
"Please run mod -s zram.\n");
@@ -3013,8 +3013,8 @@ try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong
readmem(zram, KVADDR, &zram_table_entry,
sizeof(void *), "zram_table_entry", FAULT_ON_ERROR);
zram_table_entry += (index * SIZE(zram_table_entry));
- readmem(zram_table_entry + OFFSET(zram_table_flag), KVADDR, &flags,
- sizeof(void *), "zram_table_flag", FAULT_ON_ERROR);
+ readmem(zram_table_entry + OFFSET(zram_table_entry_flags), KVADDR, &flags,
+ sizeof(void *), "zram_table_entry.flags", FAULT_ON_ERROR);
if (VALID_MEMBER(zram_compressor))
readmem(zram + OFFSET(zram_compressor), KVADDR, name, sizeof(name),
"zram compressor", FAULT_ON_ERROR);
@@ -3072,8 +3072,8 @@ try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong
goto out;
}
- readmem(zram + OFFSET(zram_mempoll), KVADDR, &zram,
- sizeof(void *), "zram_mempoll", FAULT_ON_ERROR);
+ readmem(zram + OFFSET(zram_mem_pool), KVADDR, &zram,
+ sizeof(void *), "zram.mem_pool", FAULT_ON_ERROR);
obj_addr = zram_object_addr(zram, entry, zram_buf);
if (obj_addr == NULL) {
diff --git a/memory.c b/memory.c
index 86ccec5e2bac..791194a405d4 100644
--- a/memory.c
+++ b/memory.c
@@ -519,7 +519,7 @@ vm_init(void)
"swap_info_struct", "old_block_size");
MEMBER_OFFSET_INIT(swap_info_struct_bdev, "swap_info_struct", "bdev");
- MEMBER_OFFSET_INIT(zspoll_size_class, "zs_pool", "size_class");
+ MEMBER_OFFSET_INIT(zs_pool_size_class, "zs_pool", "size_class");
MEMBER_OFFSET_INIT(size_class_size, "size_class", "size");
MEMBER_OFFSET_INIT(block_device_bd_inode, "block_device", "bd_inode");
diff --git a/symbols.c b/symbols.c
index 8e8b4c31d915..176c95026f03 100644
--- a/symbols.c
+++ b/symbols.c
@@ -10304,6 +10304,7 @@ dump_offset_table(char *spec, ulong makestruct)
OFFSET(page_active));
fprintf(fp, " page_compound_head: %ld\n",
OFFSET(page_compound_head));
+ fprintf(fp, " page_private: %ld\n", OFFSET(page_private));
fprintf(fp, " trace_print_flags_mask: %ld\n",
OFFSET(trace_print_flags_mask));
@@ -10330,6 +10331,7 @@ dump_offset_table(char *spec, ulong makestruct)
OFFSET(swap_info_struct_inuse_pages));
fprintf(fp, "swap_info_struct_old_block_size: %ld\n",
OFFSET(swap_info_struct_old_block_size));
+ fprintf(fp, " swap_info_struct_bdev: %ld\n", OFFSET(swap_info_struct_bdev));
fprintf(fp, " block_device_bd_inode: %ld\n",
OFFSET(block_device_bd_inode));
fprintf(fp, " block_device_bd_list: %ld\n",
@@ -11359,6 +11361,8 @@ dump_offset_table(char *spec, ulong makestruct)
OFFSET(gendisk_part0));
fprintf(fp, " gendisk_queue: %ld\n",
OFFSET(gendisk_queue));
+ fprintf(fp, " gendisk_private_data: %ld\n", OFFSET(gendisk_private_data));
+
fprintf(fp, " hd_struct_dev: %ld\n",
OFFSET(hd_struct_dev));
fprintf(fp, " hd_struct_dkstats: %ld\n",
@@ -11765,6 +11769,14 @@ dump_offset_table(char *spec, ulong makestruct)
fprintf(fp, " maple_metadata_end: %ld\n", OFFSET(maple_metadata_end));
fprintf(fp, " maple_metadata_gap: %ld\n", OFFSET(maple_metadata_gap));
+ fprintf(fp, " zram_mem_pool: %ld\n", OFFSET(zram_mem_pool));
+ fprintf(fp, " zram_compressor: %ld\n", OFFSET(zram_compressor));
+ fprintf(fp, " zram_comp_algs: %ld\n", OFFSET(zram_comp_algs));
+ fprintf(fp, " zram_table_entry_flags: %ld\n", OFFSET(zram_table_entry_flags));
+ fprintf(fp, " zs_pool_size_class: %ld\n", OFFSET(zs_pool_size_class));
+ fprintf(fp, " size_class_size: %ld\n", OFFSET(size_class_size));
+ fprintf(fp, " zspage_huge: %ld\n", OFFSET(zspage_huge));
+
fprintf(fp, "\n size_table:\n");
fprintf(fp, " page: %ld\n", SIZE(page));
fprintf(fp, " page_flags: %ld\n", SIZE(page_flags));
--
2.41.0

View File

@ -1,78 +0,0 @@
From 582febffa8b3567339148c2bb916fc70f2fc546e Mon Sep 17 00:00:00 2001
From: Johan Erlandsson <johan.erlandsson@sony.com>
Date: Fri, 20 Oct 2023 19:10:52 +0200
Subject: [PATCH 03/14] zram: Fixes for lookup_swap_cache()
Fix the following three issues:
(1) swap cache missing page tree offset
The radix or xarray start at an offset inside struct address_space.
(2) swap cache entries are pointer to struct page
The entries in radix, xarray (swap cache) are address to struct page.
(3) exclude shadow entries from swap cache lookup
radix or xarray can contain shadow entries from previous page
entries. These should be ignored when looking for a page pointer.
Without the patch,
- lookup_swap_cache() returns NULL since do_xarray() call returns FALSE,
- in try_zram_decompress(), since 'entry' is NULL, page is filled with 0,
if (!entry || (flags & ZRAM_FLAG_SAME_BIT)) {
and pages in swap cache will be seen to be a 'zero' page.
Signed-off-by: Johan Erlandsson <johan.erlandsson@sony.com>
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
---
diskdump.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/diskdump.c b/diskdump.c
index f20f3ac519a1..660c25729dad 100644
--- a/diskdump.c
+++ b/diskdump.c
@@ -27,6 +27,7 @@
#include "diskdump.h"
#include "xen_dom0.h"
#include "vmcore.h"
+#include "maple_tree.h"
#define BITMAP_SECT_LEN 4096
@@ -2877,11 +2878,16 @@ out:
return zram_buf;
}
+static inline bool radix_tree_exceptional_entry(ulong entry)
+{
+ return entry & RADIX_TREE_EXCEPTIONAL_ENTRY;
+}
+
static unsigned char *
lookup_swap_cache(ulonglong pte_val, unsigned char *zram_buf)
{
ulonglong swp_offset;
- ulong swp_type, swp_space, page;
+ ulong swp_type, swp_space;
struct list_pair lp;
physaddr_t paddr;
static int is_xarray = -1;
@@ -2907,10 +2913,13 @@ lookup_swap_cache(ulonglong pte_val, unsigned char *zram_buf)
swp_space += (swp_offset >> SWAP_ADDRESS_SPACE_SHIFT) * SIZE(address_space);
lp.index = swp_offset;
- if ((is_xarray ? do_xarray : do_radix_tree)(swp_space, RADIX_TREE_SEARCH, &lp)) {
- readmem((ulong)lp.value, KVADDR, &page, sizeof(void *),
- "swap_cache page", FAULT_ON_ERROR);
- if (!is_page_ptr(page, &paddr)) {
+ if ((is_xarray ? do_xarray : do_radix_tree)
+ (swp_space+OFFSET(address_space_page_tree), RADIX_TREE_SEARCH, &lp)) {
+ if ((is_xarray ? xa_is_value : radix_tree_exceptional_entry)((ulong)lp.value)) {
+ /* ignore shadow values */
+ return NULL;
+ }
+ if (!is_page_ptr((ulong)lp.value, &paddr)) {
error(WARNING, "radix page: %lx: not a page pointer\n", lp.value);
return NULL;
}
--
2.41.0

View File

@ -1,171 +0,0 @@
From f2ee6fa6c841ddc37ba665909dafbc7294c34d64 Mon Sep 17 00:00:00 2001
From: Tao Liu <ltao@redhat.com>
Date: Fri, 17 Nov 2023 15:52:19 +0800
Subject: [PATCH 04/14] symbols: expand all kernel module symtable if not all
expanded previously
There is an issue that, for kernel modules, "dis -rl" fails to display
modules code line number data after execute "bt" command in crash.
Without the patch:
crsah> mod -S
crash> bt
PID: 1500 TASK: ff2bd8b093524000 CPU: 16 COMMAND: "lpfc_worker_0"
#0 [ff2c9f725c39f9e0] machine_kexec at ffffffff8e0686d3
...snip...
#8 [ff2c9f725c39fcc0] __lpfc_sli_release_iocbq_s4 at ffffffffc0f2f425 [lpfc]
...snip...
crash> dis -rl ffffffffc0f60f82
0xffffffffc0f60eb0 <lpfc_nlp_get>: nopl 0x0(%rax,%rax,1) [FTRACE NOP]
0xffffffffc0f60eb5 <lpfc_nlp_get+5>: push %rbp
0xffffffffc0f60eb6 <lpfc_nlp_get+6>: push %rbx
0xffffffffc0f60eb7 <lpfc_nlp_get+7>: test %rdi,%rdi
With the patch:
crash> mod -S
crash> bt
PID: 1500 TASK: ff2bd8b093524000 CPU: 16 COMMAND: "lpfc_worker_0"
#0 [ff2c9f725c39f9e0] machine_kexec at ffffffff8e0686d3
...snip...
#8 [ff2c9f725c39fcc0] __lpfc_sli_release_iocbq_s4 at ffffffffc0f2f425 [lpfc]
...snip...
crash> dis -rl ffffffffc0f60f82
/usr/src/debug/kernel-4.18.0-425.13.1.el8_7/linux-4.18.0-425.13.1.el8_7.x86_64/drivers/scsi/lpfc/lpfc_hbadisc.c: 6756
0xffffffffc0f60eb0 <lpfc_nlp_get>: nopl 0x0(%rax,%rax,1) [FTRACE NOP]
/usr/src/debug/kernel-4.18.0-425.13.1.el8_7/linux-4.18.0-425.13.1.el8_7.x86_64/drivers/scsi/lpfc/lpfc_hbadisc.c: 6759
0xffffffffc0f60eb5 <lpfc_nlp_get+5>: push %rbp
The root cause is, after kernel module been loaded by mod command, the symtable
is not expanded in gdb side. crash bt or dis command will trigger such an
expansion. However the symtable expansion is different for the 2 commands:
The stack trace of "dis -rl" for symtable expanding:
#0 0x00000000008d8d9f in add_compunit_symtab_to_objfile ...
#1 0x00000000006d3293 in buildsym_compunit::end_symtab_with_blockvector ...
#2 0x00000000006d336a in buildsym_compunit::end_symtab_from_static_block ...
#3 0x000000000077e8e9 in process_full_comp_unit ...
#4 process_queue ...
#5 dw2_do_instantiate_symtab ...
#6 0x000000000077ed67 in dw2_instantiate_symtab ...
#7 0x000000000077f75e in dw2_expand_all_symtabs ...
#8 0x00000000008f254d in gdb_get_line_number ...
#9 0x00000000008f22af in gdb_command_funnel_1 ...
#10 0x00000000008f2003 in gdb_command_funnel ...
#11 0x00000000005b7f02 in gdb_interface ...
#12 0x00000000005f5bd8 in get_line_number ...
#13 0x000000000059e574 in cmd_dis ...
The stack trace of "bt" for symtable expanding:
#0 0x00000000008d8d9f in add_compunit_symtab_to_objfile ...
#1 0x00000000006d3293 in buildsym_compunit::end_symtab_with_blockvector ...
#2 0x00000000006d336a in buildsym_compunit::end_symtab_from_static_block ...
#3 0x000000000077e8e9 in process_full_comp_unit ...
#4 process_queue ...
#5 dw2_do_instantiate_symtab ...
#6 0x000000000077ed67 in dw2_instantiate_symtab ...
#7 0x000000000077f8ed in dw2_lookup_symbol ...
#8 0x00000000008e6d03 in lookup_symbol_via_quick_fns ...
#9 0x00000000008e7153 in lookup_symbol_in_objfile ...
#10 0x00000000008e73c6 in lookup_symbol_global_or_static_iterator_cb ...
#11 0x00000000008b99c4 in svr4_iterate_over_objfiles_in_search_order ...
#12 0x00000000008e754e in lookup_global_or_static_symbol ...
#13 0x00000000008e75da in lookup_static_symbol ...
#14 0x00000000008e632c in lookup_symbol_aux ...
#15 0x00000000008e5a7a in lookup_symbol_in_language ...
#16 0x00000000008e5b30 in lookup_symbol ...
#17 0x00000000008f2a4a in gdb_get_datatype ...
#18 0x00000000008f22c0 in gdb_command_funnel_1 ...
#19 0x00000000008f2003 in gdb_command_funnel ...
#20 0x00000000005b7f02 in gdb_interface ...
#21 0x00000000005f8a9f in datatype_info ...
#22 0x0000000000599947 in cpu_map_size ...
#23 0x00000000005a975d in get_cpus_online ...
#24 0x0000000000637a8b in diskdump_get_prstatus_percpu ...
#25 0x000000000062f0e4 in get_netdump_regs_x86_64 ...
#26 0x000000000059fe68 in back_trace ...
#27 0x00000000005ab1cb in cmd_bt ...
For the stacktrace of "dis -rl", it calls dw2_expand_all_symtabs() to expand
all symtable of the objfile, or "*.ko.debug" in our case. However for
the stacktrace of "bt", it doesn't expand all, but only a subset of symtable
which is enough to find a symbol by dw2_lookup_symbol(). As a result, the
objfile->compunit_symtabs, which is the head of a single linked list of
struct compunit_symtab, is not NULL but didn't contain all symtables. It
will not be reinitialized in gdb_get_line_number() by "dis -rl" because
!objfile_has_full_symbols(objfile) check will fail, so it cannot display
the proper code line number data.
Since objfile_has_full_symbols(objfile) check cannot ensure all symbols
been expanded, this patch add a new member as a flag for struct objfile
to record if all symbols have been expanded. The flag will be set only ofter
expand_all_symtabs been called.
Signed-off-by: Tao Liu <ltao@redhat.com>
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
---
gdb-10.2.patch | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
diff --git a/gdb-10.2.patch b/gdb-10.2.patch
index d81030d946e8..2f7d585105aa 100644
--- a/gdb-10.2.patch
+++ b/gdb-10.2.patch
@@ -3187,3 +3187,53 @@ exit 0
result = stringtab + symbol_entry->_n._n_n._n_offset;
}
else
+--- gdb-10.2/gdb/objfiles.h.orig
++++ gdb-10.2/gdb/objfiles.h
+@@ -712,6 +712,8 @@ struct objfile
+ next time. If an objfile does not have the symbols, it will
+ never have them. */
+ bool skip_jit_symbol_lookup = false;
++
++ bool all_symtabs_expanded = false;
+ };
+
+ /* A deleter for objfile. */
+--- gdb-10.2/gdb/symfile.c.orig
++++ gdb-10.2/gdb/symfile.c
+@@ -1133,8 +1133,10 @@ symbol_file_add_with_addrs (bfd *abfd, const char *name,
+ printf_filtered (_("Expanding full symbols from %ps...\n"),
+ styled_string (file_name_style.style (), name));
+
+- if (objfile->sf)
++ if (objfile->sf) {
+ objfile->sf->qf->expand_all_symtabs (objfile);
++ objfile->all_symtabs_expanded = true;
++ }
+ }
+
+ /* Note that we only print a message if we have no symbols and have
+--- gdb-10.2/gdb/symtab.c.orig
++++ gdb-10.2/gdb/symtab.c
+@@ -7097,8 +7097,9 @@ gdb_get_line_number(struct gnu_request *req)
+ */
+ if (req->lm) {
+ objfile = req->lm->loaded_objfile;
+- if (!objfile_has_full_symbols(objfile) && objfile->sf) {
++ if (!objfile->all_symtabs_expanded && objfile->sf) {
+ objfile->sf->qf->expand_all_symtabs(objfile);
++ objfile->all_symtabs_expanded = true;
+ sal = find_pc_line(pc, 0);
+ }
+ }
+@@ -7761,8 +7765,10 @@ iterate_datatypes (struct gnu_request *req)
+ {
+ for (objfile *objfile : current_program_space->objfiles ())
+ {
+- if (objfile->sf)
++ if (objfile->sf) {
+ objfile->sf->qf->expand_all_symtabs(objfile);
++ objfile->all_symtabs_expanded = true;
++ }
+
+ for (compunit_symtab *cust : objfile->compunits ())
+ {
--
2.41.0

View File

@ -1,67 +0,0 @@
From 0c5ef6a4a3a2759915ffe72b1366dce2f32f65c5 Mon Sep 17 00:00:00 2001
From: Tao Liu <ltao@redhat.com>
Date: Tue, 14 Nov 2023 16:32:07 +0800
Subject: [PATCH 05/14] symbols: skip load .init.* sections if module was
successfully initialized
There might be address overlap of one modules .init.text symbols and
another modules .text symbols. As a result, gdb fails to translate the
address to symbol name correctly:
crash> sym -m virtio_blk | grep MODULE
ffffffffc00a4000 MODULE START: virtio_blk
ffffffffc00a86ec MODULE END: virtio_blk
crash> gdb info address floppy_module_init
Symbol "floppy_module_init" is a function at address 0xffffffffc00a4131.
Since the .init.* sections of a module had been freed by kernel if the
module was initialized successfully, there is no need to load the .init.*
sections data from "*.ko.debug" in gdb to create such an overlap.
lm->mod_init_module_ptr is used as a flag of whether module is freed.
Without the patch:
crash> mod -S
crash> struct blk_mq_ops 0xffffffffc00a7160
struct blk_mq_ops {
queue_rq = 0xffffffffc00a45b0 <floppy_module_init+1151>, <-- translated from module floppy
map_queue = 0xffffffff813015c0 <blk_mq_map_queue>,
...snip...
complete = 0xffffffffc00a4370 <floppy_module_init+575>,
init_request = 0xffffffffc00a4260 <floppy_module_init+303>,
...snip...
}
With the patch:
crash> mod -S
crash> struct blk_mq_ops 0xffffffffc00a7160
struct blk_mq_ops {
queue_rq = 0xffffffffc00a45b0 <virtio_queue_rq>, <-- translated from module virtio_blk
map_queue = 0xffffffff813015c0 <blk_mq_map_queue>,
...snip...
complete = 0xffffffffc00a4370 <virtblk_request_done>,
init_request = 0xffffffffc00a4260 <virtblk_init_request>,
...snip...
}
Signed-off-by: Tao Liu <ltao@redhat.com>
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
---
symbols.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/symbols.c b/symbols.c
index 176c95026f03..5d919910164e 100644
--- a/symbols.c
+++ b/symbols.c
@@ -13295,7 +13295,7 @@ add_symbol_file_kallsyms(struct load_module *lm, struct gnu_request *req)
shift_string_right(req->buf, strlen(buf));
BCOPY(buf, req->buf, strlen(buf));
retval = TRUE;
- } else {
+ } else if (lm->mod_init_module_ptr || !STRNEQ(section_name, ".init.")) {
sprintf(buf, " -s %s 0x%lx", section_name, section_vaddr);
while ((len + strlen(buf)) >= buflen) {
RESIZEBUF(req->buf, buflen, buflen * 2);
--
2.41.0

View File

@ -1,47 +0,0 @@
From c15da07526291a5c357010cb4aaf4bde6151e642 Mon Sep 17 00:00:00 2001
From: Johan Erlandsson <johan.erlandsson@sony.com>
Date: Wed, 19 Apr 2023 11:26:04 +0200
Subject: [PATCH 06/14] use NR_SWAPCACHE when nr_swapper_spaces isn't available
In 5.12 the following change was introduced:
b6038942480e ("mm: memcg: add swapcache stat for memcg v2")
Then the variable 'nr_swapper_spaces' is not read (unless
CONFIG_DEBUG_VM=y). In GKI builds this variable is then optimized
out. But the same change provided a new way to obtain the same
information, using NR_SWAPCACHE.
Reported-by: xueguolun <xueguolun@xiaomi.com>
Signed-off-by: Johan Erlandsson <johan.erlandsson@sony.com>
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
---
memory.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/memory.c b/memory.c
index 791194a405d4..b84e974a3325 100644
--- a/memory.c
+++ b/memory.c
@@ -8486,7 +8486,7 @@ dump_kmeminfo(void)
ulong hugetlb_total_pages, hugetlb_total_free_pages = 0;
int done_hugetlb_calc = 0;
long nr_file_pages, nr_slab;
- ulong swapper_space_nrpages;
+ long swapper_space_nrpages;
ulong pct;
uint tmp;
struct meminfo meminfo;
@@ -8609,7 +8609,9 @@ dump_kmeminfo(void)
char *swapper_space = GETBUF(SIZE(address_space));
swapper_space_nrpages = 0;
- if (symbol_exists("nr_swapper_spaces") &&
+ if (dump_vm_stat("NR_SWAPCACHE", &swapper_space_nrpages, 0)) {
+ ;
+ } else if (symbol_exists("nr_swapper_spaces") &&
(len = get_array_length("nr_swapper_spaces",
NULL, 0))) {
char *nr_swapper_space =
--
2.41.0

View File

@ -1,43 +0,0 @@
From 2e513114e7d77fadc88011f186ef943ccf397d35 Mon Sep 17 00:00:00 2001
From: Alexander Gordeev <agordeev@linux.ibm.com>
Date: Wed, 29 Nov 2023 13:47:34 +0100
Subject: [PATCH 07/14] Fix identity_map_base value dump on S390
Kernel virtual base instead of identity base is printed
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
---
s390.c | 2 +-
s390x.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/s390.c b/s390.c
index 42f5cc63ae52..a8b2bcca86c7 100644
--- a/s390.c
+++ b/s390.c
@@ -183,7 +183,7 @@ s390_dump_machdep_table(ulong arg)
fprintf(fp, ")\n");
fprintf(fp, " kvbase: %lx\n", machdep->kvbase);
- fprintf(fp, " identity_map_base: %lx\n", machdep->kvbase);
+ fprintf(fp, " identity_map_base: %lx\n", machdep->identity_map_base);
fprintf(fp, " pagesize: %d\n", machdep->pagesize);
fprintf(fp, " pageshift: %d\n", machdep->pageshift);
fprintf(fp, " pagemask: %llx\n", machdep->pagemask);
diff --git a/s390x.c b/s390x.c
index d7ee3755fc0b..096c072186f5 100644
--- a/s390x.c
+++ b/s390x.c
@@ -650,7 +650,7 @@ s390x_dump_machdep_table(ulong arg)
fprintf(fp, ")\n");
fprintf(fp, " kvbase: %lx\n", machdep->kvbase);
- fprintf(fp, " identity_map_base: %lx\n", machdep->kvbase);
+ fprintf(fp, " identity_map_base: %lx\n", machdep->identity_map_base);
fprintf(fp, " pagesize: %d\n", machdep->pagesize);
fprintf(fp, " pageshift: %d\n", machdep->pageshift);
fprintf(fp, " pagemask: %llx\n", machdep->pagemask);
--
2.41.0

View File

@ -1,70 +0,0 @@
From 4c78eb4a9199631fe94845cb3fbd6376aae1251d Mon Sep 17 00:00:00 2001
From: Alexander Gordeev <agordeev@linux.ibm.com>
Date: Wed, 29 Nov 2023 13:47:35 +0100
Subject: [PATCH 08/14] s390x: fix virtual vs physical address confusion
Physical and virtual addresses are the same on S390X.
That led to missing to use PTOV and VTOP macros where
they actually expected.
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
---
s390x.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/s390x.c b/s390x.c
index 096c072186f5..957b839a5fa9 100644
--- a/s390x.c
+++ b/s390x.c
@@ -311,7 +311,7 @@ static struct s390x_cpu *s390x_cpu_get(struct bt_info *bt)
readmem(lowcore_ptr + cpu * sizeof(long), KVADDR,
&prefix, sizeof(long), "lowcore_ptr", FAULT_ON_ERROR);
for (i = 0; i < s390x_cpu_cnt; i++) {
- if (s390x_cpu_vec[i].prefix == prefix)
+ if (s390x_cpu_vec[i].prefix == VTOP(prefix))
return &s390x_cpu_vec[i];
}
error(FATAL, "cannot determine CPU for task: %lx\n", bt->task);
@@ -985,12 +985,12 @@ int s390x_vtop(ulong table, ulong vaddr, physaddr_t *phys_addr, int verbose)
verbose);
if (!entry)
return FALSE;
- table = entry & ~0xfffULL;
+ table = PTOV(entry & ~0xfffULL);
/* Check if this a 2GB page */
if ((entry & 0x400ULL) && (level == 1)) {
/* Add the 2GB frame offset & return the final value. */
table &= ~0x7fffffffULL;
- *phys_addr = table + (vaddr & 0x7fffffffULL);
+ *phys_addr = VTOP(table + (vaddr & 0x7fffffffULL));
return TRUE;
}
len = entry & 0x3ULL;
@@ -1001,12 +1001,12 @@ int s390x_vtop(ulong table, ulong vaddr, physaddr_t *phys_addr, int verbose)
if (entry & 0x400ULL) {
/* Add the 1MB page offset and return the final value. */
table &= ~0xfffffULL;
- *phys_addr = table + (vaddr & 0xfffffULL);
+ *phys_addr = VTOP(table + (vaddr & 0xfffffULL));
return TRUE;
}
/* Get the page table entry */
- entry = _kl_pg_table_deref_s390x(vaddr, entry & ~0x7ffULL, verbose);
+ entry = _kl_pg_table_deref_s390x(vaddr, PTOV(entry & ~0x7ffULL), verbose);
if (!entry)
return FALSE;
@@ -1033,7 +1033,7 @@ s390x_vmalloc_start(void)
{
unsigned long highmem_addr,high_memory;
highmem_addr=symbol_value("high_memory");
- readmem(highmem_addr, PHYSADDR, &high_memory,sizeof(long),
+ readmem(highmem_addr, KVADDR, &high_memory,sizeof(long),
"highmem",FAULT_ON_ERROR);
return high_memory;
}
--
2.41.0

View File

@ -1,323 +0,0 @@
From d0164e7e480ad2ffd3fe73fe53c46087e5e137a6 Mon Sep 17 00:00:00 2001
From: Alexander Gordeev <agordeev@linux.ibm.com>
Date: Thu, 7 Dec 2023 16:54:06 +0100
Subject: [PATCH 09/14] s390x: uncouple physical and virtual memory spaces
Rework VTOP and PTOV macros to reflect the future
uncoupling of physical and virtual address spaces
in kernel. Existing versions are not affected.
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
---
defs.h | 20 +++++-
s390x.c | 212 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 228 insertions(+), 4 deletions(-)
diff --git a/defs.h b/defs.h
index 5218a94fe4a4..20237b72a10b 100644
--- a/defs.h
+++ b/defs.h
@@ -4564,9 +4564,9 @@ struct efi_memory_desc_t {
#define _64BIT_
#define MACHINE_TYPE "S390X"
-#define PTOV(X) ((unsigned long)(X)+(machdep->kvbase))
-#define VTOP(X) ((unsigned long)(X)-(machdep->kvbase))
-#define IS_VMALLOC_ADDR(X) (vt->vmalloc_start && (ulong)(X) >= vt->vmalloc_start)
+#define PTOV(X) s390x_PTOV((ulong)(X))
+#define VTOP(X) s390x_VTOP((ulong)(X))
+#define IS_VMALLOC_ADDR(X) s390x_IS_VMALLOC_ADDR(X)
#define PTRS_PER_PTE 512
#define PTRS_PER_PMD 1024
#define PTRS_PER_PGD 2048
@@ -6827,7 +6827,21 @@ void get_s390_panicmsg(char *);
* s390x.c
*/
#ifdef S390X
+
+struct machine_specific
+{
+ ulong (*virt_to_phys)(ulong vaddr);
+ ulong (*phys_to_virt)(ulong paddr);
+ int (*is_vmalloc_addr)(ulong vaddr);
+ ulong __kaslr_offset_phys;
+ ulong amode31_start;
+ ulong amode31_end;
+};
+
void s390x_init(int);
+ulong s390x_PTOV(ulong);
+ulong s390x_VTOP(ulong);
+int s390x_IS_VMALLOC_ADDR(ulong);
void s390x_dump_machdep_table(ulong);
#define display_idt_table() \
error(FATAL, "-d option is not applicable to S390X architecture\n")
diff --git a/s390x.c b/s390x.c
index 957b839a5fa9..794ae825906d 100644
--- a/s390x.c
+++ b/s390x.c
@@ -47,6 +47,7 @@
#define S390X_PSW_MASK_PSTATE 0x0001000000000000UL
#define S390X_LC_VMCORE_INFO 0xe0c
+#define S390X_LC_OS_INFO 0xe18
/*
* Flags for Region and Segment table entries.
@@ -168,6 +169,19 @@ static struct line_number_hook s390x_line_number_hooks[];
static int s390x_is_uvaddr(ulong, struct task_context *);
static int s390x_get_kvaddr_ranges(struct vaddr_range *);
static int set_s390x_max_physmem_bits(void);
+static ulong s390x_generic_VTOP(ulong vaddr);
+static ulong s390x_generic_PTOV(ulong paddr);
+static int s390x_generic_IS_VMALLOC_ADDR(ulong vaddr);
+static ulong s390x_vr_VTOP(ulong vaddr);
+static ulong s390x_vr_PTOV(ulong paddr);
+static int s390x_vr_IS_VMALLOC_ADDR(ulong vaddr);
+static int s390x_vr_is_kvaddr(ulong);
+
+struct machine_specific s390x_machine_specific = {
+ .virt_to_phys = s390x_generic_VTOP,
+ .phys_to_virt = s390x_generic_PTOV,
+ .is_vmalloc_addr = s390x_generic_IS_VMALLOC_ADDR,
+};
/*
* struct lowcore name (old: "_lowcore", new: "lowcore")
@@ -546,6 +560,191 @@ static void s390x_check_kaslr(void)
free(vmcoreinfo);
}
+#define OS_INFO_VERSION_MAJOR 1
+#define OS_INFO_VERSION_MINOR 1
+
+#define OS_INFO_VMCOREINFO 0
+#define OS_INFO_REIPL_BLOCK 1
+#define OS_INFO_FLAGS_ENTRY 2
+#define OS_INFO_RESERVED 3
+#define OS_INFO_IDENTITY_BASE 4
+#define OS_INFO_KASLR_OFFSET 5
+#define OS_INFO_KASLR_OFF_PHYS 6
+#define OS_INFO_VMEMMAP 7
+#define OS_INFO_AMODE31_START 8
+#define OS_INFO_AMODE31_END 9
+
+struct os_info_entry {
+ union {
+ __u64 addr;
+ __u64 val;
+ };
+ __u64 size;
+ __u32 csum;
+} __attribute__((packed));
+
+struct os_info {
+ __u64 magic;
+ __u32 csum;
+ __u16 version_major;
+ __u16 version_minor;
+ __u64 crashkernel_addr;
+ __u64 crashkernel_size;
+ struct os_info_entry entry[10];
+ __u8 reserved[3864];
+} __attribute__((packed));
+
+struct vm_info {
+ __u64 __identity_base;
+ __u64 __kaslr_offset;
+ __u64 __kaslr_offset_phys;
+ __u64 amode31_start;
+ __u64 amode31_end;
+};
+
+static bool
+vmcoreinfo_read_u64(const char *key, __u64 *val)
+{
+ char *string;
+
+ string = pc->read_vmcoreinfo(key);
+ if (string) {
+ *val = strtoul(string, NULL, 16);
+ free(string);
+ return true;
+ }
+
+ return false;
+}
+
+static bool vmcoreinfo_read_vm_info(struct vm_info *_vm_info)
+{
+ struct vm_info vm_info;
+
+ if (!vmcoreinfo_read_u64("IDENTITYBASE", &vm_info.__identity_base) ||
+ !vmcoreinfo_read_u64("KERNELOFFSET", &vm_info.__kaslr_offset) ||
+ !vmcoreinfo_read_u64("KERNELOFFPHYS", &vm_info.__kaslr_offset_phys) ||
+ !vmcoreinfo_read_u64("SAMODE31", &vm_info.amode31_start) ||
+ !vmcoreinfo_read_u64("EAMODE31", &vm_info.amode31_end))
+ return false;
+
+ *_vm_info = vm_info;
+
+ return true;
+}
+
+static bool os_info_read_vm_info(struct vm_info *vm_info)
+{
+ struct os_info os_info;
+ ulong addr;
+
+ if (!readmem(S390X_LC_OS_INFO, PHYSADDR, &addr,
+ sizeof(addr), "s390x os_info ptr",
+ QUIET|RETURN_ON_ERROR))
+ return false;
+
+ if (addr == 0)
+ return true;
+
+ if (!readmem(addr, PHYSADDR, &os_info,
+ offsetof(struct os_info, reserved), "s390x os_info header",
+ QUIET|RETURN_ON_ERROR))
+ return false;
+
+ vm_info->__identity_base = os_info.entry[OS_INFO_IDENTITY_BASE].val;
+ vm_info->__kaslr_offset = os_info.entry[OS_INFO_KASLR_OFFSET].val;
+ vm_info->__kaslr_offset_phys = os_info.entry[OS_INFO_KASLR_OFF_PHYS].val;
+ vm_info->amode31_start = os_info.entry[OS_INFO_AMODE31_START].val;
+ vm_info->amode31_end = os_info.entry[OS_INFO_AMODE31_END].val;
+
+ return true;
+}
+
+static bool vm_info_empty(struct vm_info *vm_info)
+{
+ return !vm_info->__kaslr_offset;
+}
+
+static bool s390x_init_vm(void)
+{
+ struct vm_info vm_info;
+
+ if (pc->flags & PROC_KCORE) {
+ if (!vmcoreinfo_read_vm_info(&vm_info))
+ return true;
+ } else {
+ if (!os_info_read_vm_info(&vm_info))
+ return false;
+ }
+ if (vm_info_empty(&vm_info))
+ return true;
+
+ machdep->identity_map_base = vm_info.__identity_base;
+ machdep->kvbase = vm_info.__kaslr_offset;
+ machdep->machspec->__kaslr_offset_phys = vm_info.__kaslr_offset_phys;
+ machdep->machspec->amode31_start = vm_info.amode31_start;
+ machdep->machspec->amode31_end = vm_info.amode31_end;
+
+ machdep->is_kvaddr = s390x_vr_is_kvaddr;
+ machdep->machspec->virt_to_phys = s390x_vr_VTOP;
+ machdep->machspec->phys_to_virt = s390x_vr_PTOV;
+ machdep->machspec->is_vmalloc_addr = s390x_vr_IS_VMALLOC_ADDR;
+
+ return true;
+}
+
+static ulong s390x_generic_VTOP(ulong vaddr)
+{
+ return vaddr - machdep->kvbase;
+}
+
+static ulong s390x_generic_PTOV(ulong paddr)
+{
+ return paddr + machdep->kvbase;
+}
+
+static int s390x_generic_IS_VMALLOC_ADDR(ulong vaddr)
+{
+ return vt->vmalloc_start && vaddr >= vt->vmalloc_start;
+}
+
+static ulong s390x_vr_VTOP(ulong vaddr)
+{
+ if (vaddr < LOWCORE_SIZE)
+ return vaddr;
+ if ((vaddr < machdep->machspec->amode31_end) &&
+ (vaddr >= machdep->machspec->amode31_start))
+ return vaddr;
+ if (vaddr < machdep->kvbase)
+ return vaddr - machdep->identity_map_base;
+ return vaddr - machdep->kvbase + machdep->machspec->__kaslr_offset_phys;
+}
+
+static ulong s390x_vr_PTOV(ulong paddr)
+{
+ return paddr + machdep->identity_map_base;
+}
+
+static int s390x_vr_IS_VMALLOC_ADDR(ulong vaddr)
+{
+ return (vaddr >= vt->vmalloc_start && vaddr < machdep->kvbase);
+}
+
+ulong s390x_VTOP(ulong vaddr)
+{
+ return machdep->machspec->virt_to_phys(vaddr);
+}
+
+ulong s390x_PTOV(ulong paddr)
+{
+ return machdep->machspec->phys_to_virt(paddr);
+}
+
+int s390x_IS_VMALLOC_ADDR(ulong vaddr)
+{
+ return machdep->machspec->is_vmalloc_addr(vaddr);
+}
+
/*
* Do all necessary machine-specific setup here. This is called several
* times during initialization.
@@ -560,6 +759,7 @@ s390x_init(int when)
machdep->process_elf_notes = s390x_process_elf_notes;
break;
case PRE_SYMTAB:
+ machdep->machspec = &s390x_machine_specific;
machdep->verify_symbol = s390x_verify_symbol;
if (pc->flags & KERNEL_DEBUG_QUERY)
return;
@@ -587,6 +787,8 @@ s390x_init(int when)
machdep->kvbase = 0;
machdep->identity_map_base = 0;
machdep->is_kvaddr = generic_is_kvaddr;
+ if (!s390x_init_vm())
+ error(FATAL, "cannot initialize VM parameters.");
machdep->is_uvaddr = s390x_is_uvaddr;
machdep->eframe_search = s390x_eframe_search;
machdep->back_trace = s390x_back_trace_cmd;
@@ -681,7 +883,9 @@ s390x_dump_machdep_table(ulong arg)
fprintf(fp, " dis_filter: s390x_dis_filter()\n");
fprintf(fp, " cmd_mach: s390x_cmd_mach()\n");
fprintf(fp, " get_smp_cpus: s390x_get_smp_cpus()\n");
- fprintf(fp, " is_kvaddr: generic_is_kvaddr()\n");
+ fprintf(fp, " is_kvaddr: %s()\n", machdep->is_kvaddr == s390x_vr_is_kvaddr ?
+ "s390x_vr_is_kvaddr" :
+ "generic_is_kvaddr");
fprintf(fp, " is_uvaddr: s390x_is_uvaddr()\n");
fprintf(fp, " verify_paddr: generic_verify_paddr()\n");
fprintf(fp, " get_kvaddr_ranges: s390x_get_kvaddr_ranges()\n");
@@ -702,6 +906,12 @@ s390x_dump_machdep_table(ulong arg)
fprintf(fp, " machspec: %lx\n", (ulong)machdep->machspec);
}
+static int
+s390x_vr_is_kvaddr(ulong vaddr)
+{
+ return (vaddr < LOWCORE_SIZE) || (vaddr >= machdep->identity_map_base);
+}
+
/*
* Check if address is in context's address space
*/
--
2.41.0

View File

@ -1,160 +0,0 @@
From 5187a0320cc54a9cb8b326cf012e69795950a716 Mon Sep 17 00:00:00 2001
From: Song Shuai <songshuaishuai@tinylab.org>
Date: Tue, 12 Dec 2023 18:20:50 +0800
Subject: [PATCH 10/14] RISCV64: Dump NT_PRSTATUS in 'help -n'
With the patch we can get full dump of "struct elf_prstatus" in 'help -n':
```
crash> help -n
<snip>
Elf64_Nhdr:
n_namesz: 5 ("CORE")
n_descsz: 376
n_type: 1 (NT_PRSTATUS)
si.signo: 0 si.code: 0 si.errno: 0
cursig: 0 sigpend: 0 sighold: 0
pid: 1 ppid: 0 pgrp: 0 sid:0
utime: 0.000000 stime: 0.000000
cutime: 0.000000 cstime: 0.000000
epc: ffffffff8000a1dc ra: ffffffff800af958 sp: ff6000001fc501c0
gp: ffffffff81515d38 tp: ff600000000d8000 t0: 6666666666663c5b
t1: ff600000000d88c8 t2: 666666666666663c s0: ff6000001fc50320
s1: ffffffff815170d8 a0: ff6000001fc501c8 a1: c0000000ffffefff
a2: 0000000000000000 a3: 0000000000000001 a4: 0000000000000000
a5: ff60000001782c00 a6: 000000000130e0f0 a7: 0000000000000000
s2: ffffffff81517820 s3: ff6000001fc501c8 s4: 000000000000000f
s5: 0000000000000000 s6: ff20000000013e60 s7: 0000000000000000
s8: ff60000000861000 s9: 00007fffc3641694 s10: 00007fffc3641690
s11: 00005555796ed240 t3: 0000000000010297 t4: ffffffff80c17810
t5: ffffffff8195e7b8 t6: ff6000001fc50048
0000000000000000 0000000000000000
0000000000000000 0000000000000000
0000000000000001 0000000000000000
0000000000000000 0000000000000000
0000000000000000 0000000000000000
0000000000000000 0000000000000000
0000000000000000 0000000000000000
ffffffff8000a1dc ffffffff800af958
ff6000001fc501c0 ffffffff81515d38
ff600000000d8000 6666666666663c5b
<snip>
```
Signed-off-by: Song Shuai <songshuaishuai@tinylab.org>
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
---
netdump.c | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 84 insertions(+)
diff --git a/netdump.c b/netdump.c
index 390786364959..32586b6809d3 100644
--- a/netdump.c
+++ b/netdump.c
@@ -2578,6 +2578,8 @@ dump_Elf64_Nhdr(Elf64_Off offset, int store)
display_ELF_note(EM_PPC64, PRSTATUS_NOTE, note, nd->ofp);
if (machine_type("ARM64") && (note->n_type == NT_PRSTATUS))
display_ELF_note(EM_AARCH64, PRSTATUS_NOTE, note, nd->ofp);
+ if (machine_type("RISCV64") && (note->n_type == NT_PRSTATUS))
+ display_ELF_note(EM_RISCV, PRSTATUS_NOTE, note, nd->ofp);
}
for (i = lf = 0; i < note->n_descsz/sizeof(ulonglong); i++) {
if (((i%2)==0)) {
@@ -3399,6 +3401,80 @@ display_prstatus_arm64(void *note_ptr, FILE *ofp)
space(sp), pr->pr_reg[33], pr->pr_fpvalid);
}
+struct riscv64_elf_siginfo {
+ int si_signo;
+ int si_code;
+ int si_errno;
+};
+
+struct riscv64_elf_prstatus {
+ struct riscv64_elf_siginfo pr_info;
+ short pr_cursig;
+ unsigned long pr_sigpend;
+ unsigned long pr_sighold;
+ pid_t pr_pid;
+ pid_t pr_ppid;
+ pid_t pr_pgrp;
+ pid_t pr_sid;
+ struct timeval pr_utime;
+ struct timeval pr_stime;
+ struct timeval pr_cutime;
+ struct timeval pr_cstime;
+/* elf_gregset_t pr_reg; => typedef struct user_regs_struct elf_gregset_t; */
+ unsigned long pr_reg[32];
+ int pr_fpvalid;
+};
+
+static void
+display_prstatus_riscv64(void *note_ptr, FILE *ofp)
+{
+ struct riscv64_elf_prstatus *pr;
+ Elf64_Nhdr *note;
+ int sp;
+
+ note = (Elf64_Nhdr *)note_ptr;
+ pr = (struct riscv64_elf_prstatus *)(
+ (char *)note + sizeof(Elf64_Nhdr) + note->n_namesz);
+ pr = (struct riscv64_elf_prstatus *)roundup((ulong)pr, 4);
+ sp = nd->num_prstatus_notes ? 25 : 22;
+
+ fprintf(ofp,
+ "%ssi.signo: %d si.code: %d si.errno: %d\n"
+ "%scursig: %d sigpend: %lx sighold: %lx\n"
+ "%spid: %d ppid: %d pgrp: %d sid:%d\n"
+ "%sutime: %01lld.%06d stime: %01lld.%06d\n"
+ "%scutime: %01lld.%06d cstime: %01lld.%06d\n",
+ space(sp), pr->pr_info.si_signo, pr->pr_info.si_code, pr->pr_info.si_errno,
+ space(sp), pr->pr_cursig, pr->pr_sigpend, pr->pr_sighold,
+ space(sp), pr->pr_pid, pr->pr_ppid, pr->pr_pgrp, pr->pr_sid,
+ space(sp), (long long)pr->pr_utime.tv_sec, (int)pr->pr_utime.tv_usec,
+ (long long)pr->pr_stime.tv_sec, (int)pr->pr_stime.tv_usec,
+ space(sp), (long long)pr->pr_cutime.tv_sec, (int)pr->pr_cutime.tv_usec,
+ (long long)pr->pr_cstime.tv_sec, (int)pr->pr_cstime.tv_usec);
+ fprintf(ofp,
+ "%sepc: %016lx ra: %016lx sp: %016lx\n"
+ "%s gp: %016lx tp: %016lx t0: %016lx\n"
+ "%s t1: %016lx t2: %016lx s0: %016lx\n"
+ "%s s1: %016lx a0: %016lx a1: %016lx\n"
+ "%s a2: %016lx a3: %016lx a4: %016lx\n"
+ "%s a5: %016lx a6: %016lx a7: %016lx\n"
+ "%s s2: %016lx s3: %016lx s4: %016lx\n"
+ "%s s5: %016lx s6: %016lx s7: %016lx\n"
+ "%s s8: %016lx s9: %016lx s10: %016lx\n"
+ "%ss11: %016lx t3: %016lx t4: %016lx\n"
+ "%s t5: %016lx t6: %016lx\n",
+ space(sp), pr->pr_reg[0], pr->pr_reg[1], pr->pr_reg[2],
+ space(sp), pr->pr_reg[3], pr->pr_reg[4], pr->pr_reg[5],
+ space(sp), pr->pr_reg[6], pr->pr_reg[7], pr->pr_reg[8],
+ space(sp), pr->pr_reg[9], pr->pr_reg[10], pr->pr_reg[11],
+ space(sp), pr->pr_reg[12], pr->pr_reg[13], pr->pr_reg[14],
+ space(sp), pr->pr_reg[15], pr->pr_reg[16], pr->pr_reg[17],
+ space(sp), pr->pr_reg[18], pr->pr_reg[19], pr->pr_reg[20],
+ space(sp), pr->pr_reg[21], pr->pr_reg[22], pr->pr_reg[23],
+ space(sp), pr->pr_reg[24], pr->pr_reg[25], pr->pr_reg[26],
+ space(sp), pr->pr_reg[27], pr->pr_reg[28], pr->pr_reg[29],
+ space(sp), pr->pr_reg[30], pr->pr_reg[31]);
+}
void
display_ELF_note(int machine, int type, void *note, FILE *ofp)
@@ -3449,6 +3525,14 @@ display_ELF_note(int machine, int type, void *note, FILE *ofp)
break;
}
break;
+ case EM_RISCV:
+ switch (type)
+ {
+ case PRSTATUS_NOTE:
+ display_prstatus_riscv64(note, ofp);
+ break;
+ }
+ break;
default:
return;
--
2.41.0

View File

@ -1,87 +0,0 @@
From 9b69093e623f1d54c373b1e091900d40576c059b Mon Sep 17 00:00:00 2001
From: Song Shuai <songshuaishuai@tinylab.org>
Date: Tue, 12 Dec 2023 18:20:51 +0800
Subject: [PATCH 11/14] RISCV64: Fix 'bt' output when no ra on the stack top
Same as the Linux commit f766f77a74f5 ("riscv/stacktrace: Fix
stack output without ra on the stack top").
When a function doesn't have a callee, then it will not
push ra into the stack, such as lkdtm functions, so
correct the FP of the second frame and use pt_regs to get
the right PC of the second frame.
Before this patch, the `bt -f` outputs only the first frame with
the wrong PC and FP of next frame:
```
crash> bt -f
PID: 1 TASK: ff600000000e0000 CPU: 1 COMMAND: "sh"
#0 [ff20000000013cf0] lkdtm_EXCEPTION at ffffffff805303c0
[PC: ffffffff805303c0 RA: ff20000000013d10 SP: ff20000000013cf0 SIZE: 16] <- wrong next PC
ff20000000013cf0: 0000000000000001 ff20000000013d10 <- next FP
ff20000000013d00: ff20000000013d40
crash>
```
After this patch, the `bt` outputs the full frames:
```
crash> bt
PID: 1 TASK: ff600000000e0000 CPU: 1 COMMAND: "sh"
#0 [ff20000000013cf0] lkdtm_EXCEPTION at ffffffff805303c0
#1 [ff20000000013d00] lkdtm_do_action at ffffffff8052fe36
#2 [ff20000000013d10] direct_entry at ffffffff80530018
#3 [ff20000000013d40] full_proxy_write at ffffffff80305044
#4 [ff20000000013d80] vfs_write at ffffffff801b68b4
#5 [ff20000000013e30] ksys_write at ffffffff801b6c4a
#6 [ff20000000013e80] __riscv_sys_write at ffffffff801b6cc4
#7 [ff20000000013e90] do_trap_ecall_u at ffffffff80836798
crash>
```
Acked-by: Kazuhito Hagio <k-hagio-ab@nec.com>
Signed-off-by: Song Shuai <songshuaishuai@tinylab.org>
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
---
riscv64.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/riscv64.c b/riscv64.c
index 0aaa14b2671e..872be594d72b 100644
--- a/riscv64.c
+++ b/riscv64.c
@@ -747,11 +747,14 @@ riscv64_back_trace_cmd(struct bt_info *bt)
{
struct riscv64_unwind_frame current, previous;
struct stackframe curr_frame;
+ struct riscv64_register * regs;
int level = 0;
if (bt->flags & BT_REGS_NOT_FOUND)
return;
+ regs = (struct riscv64_register *) bt->machdep;
+
current.pc = bt->instptr;
current.sp = bt->stkptr;
current.fp = bt->frameptr;
@@ -788,8 +791,16 @@ riscv64_back_trace_cmd(struct bt_info *bt)
sizeof(curr_frame), "get stack frame", RETURN_ON_ERROR))
return;
- previous.pc = curr_frame.ra;
- previous.fp = curr_frame.fp;
+ /* correct PC and FP of the second frame when the first frame has no callee */
+
+ if (regs && (regs->regs[RISCV64_REGS_EPC] == current.pc) && curr_frame.fp & 0x7){
+ previous.pc = regs->regs[RISCV64_REGS_RA];
+ previous.fp = curr_frame.ra;
+ } else {
+ previous.pc = curr_frame.ra;
+ previous.fp = curr_frame.fp;
+ }
+
previous.sp = current.fp;
riscv64_dump_backtrace_entry(bt, symbol, &current, &previous, level++);
--
2.41.0

View File

@ -1,265 +0,0 @@
From 19d3c56c9fca9dea49dced0414becc6d1b12e9fc Mon Sep 17 00:00:00 2001
From: Huang Shijie <shijie@os.amperecomputing.com>
Date: Thu, 14 Dec 2023 15:15:20 +0800
Subject: [PATCH 12/14] arm64: rewrite the arm64_get_vmcoreinfo_ul to
arm64_get_vmcoreinfo
Rewrite the arm64_get_vmcoreinfo_ul to arm64_get_vmcoreinfo,
add a new parameter "base" for it.
Also use it to simplify the arm64 code.
Signed-off-by: Huang Shijie <shijie@os.amperecomputing.com>
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
---
arm64.c | 99 +++++++++++++++++++++++----------------------------------
1 file changed, 39 insertions(+), 60 deletions(-)
diff --git a/arm64.c b/arm64.c
index 2b6b0e588d4e..57965c6cb3c8 100644
--- a/arm64.c
+++ b/arm64.c
@@ -92,6 +92,7 @@ static void arm64_get_crash_notes(void);
static void arm64_calc_VA_BITS(void);
static int arm64_is_uvaddr(ulong, struct task_context *);
static void arm64_calc_KERNELPACMASK(void);
+static int arm64_get_vmcoreinfo(unsigned long *vaddr, const char *label, int base);
struct kernel_range {
unsigned long modules_vaddr, modules_end;
@@ -124,7 +125,6 @@ void
arm64_init(int when)
{
ulong value;
- char *string;
struct machine_specific *ms;
#if defined(__x86_64__)
@@ -160,11 +160,8 @@ arm64_init(int when)
if (!ms->kimage_voffset && STREQ(pc->live_memsrc, "/dev/crash"))
ioctl(pc->mfd, DEV_CRASH_ARCH_DATA, &ms->kimage_voffset);
- if (!ms->kimage_voffset &&
- (string = pc->read_vmcoreinfo("NUMBER(kimage_voffset)"))) {
- ms->kimage_voffset = htol(string, QUIET, NULL);
- free(string);
- }
+ if (!ms->kimage_voffset)
+ arm64_get_vmcoreinfo(&ms->kimage_voffset, "NUMBER(kimage_voffset)", NUM_HEX);
if (ms->kimage_voffset ||
(ACTIVE() && (symbol_value_from_proc_kallsyms("kimage_voffset") != BADVAL))) {
@@ -185,11 +182,8 @@ arm64_init(int when)
if (kernel_symbol_exists("kimage_voffset"))
machdep->flags |= NEW_VMEMMAP;
- if (!machdep->pagesize &&
- (string = pc->read_vmcoreinfo("PAGESIZE"))) {
- machdep->pagesize = atoi(string);
- free(string);
- }
+ if (!machdep->pagesize && arm64_get_vmcoreinfo(&value, "PAGESIZE", NUM_DEC))
+ machdep->pagesize = (unsigned int)value;
if (!machdep->pagesize) {
/*
@@ -443,9 +437,8 @@ arm64_init(int when)
arm64_get_section_size_bits();
if (!machdep->max_physmem_bits) {
- if ((string = pc->read_vmcoreinfo("NUMBER(MAX_PHYSMEM_BITS)"))) {
- machdep->max_physmem_bits = atol(string);
- free(string);
+ if (arm64_get_vmcoreinfo(&machdep->max_physmem_bits, "NUMBER(MAX_PHYSMEM_BITS)", NUM_DEC)) {
+ /* nothing */
} else if (machdep->machspec->VA_BITS == 52) /* guess */
machdep->max_physmem_bits = _MAX_PHYSMEM_BITS_52;
else if (THIS_KERNEL_VERSION >= LINUX(3,17,0))
@@ -573,16 +566,28 @@ static int arm64_get_struct_page_max_shift(struct machine_specific *ms)
}
/* Return TRUE if we succeed, return FALSE on failure. */
-static int arm64_get_vmcoreinfo_ul(unsigned long *vaddr, const char* label)
+static int
+arm64_get_vmcoreinfo(unsigned long *vaddr, const char *label, int base)
{
+ int err = 0;
char *string = pc->read_vmcoreinfo(label);
if (!string)
return FALSE;
- *vaddr = strtoul(string, NULL, 0);
+ switch (base) {
+ case NUM_HEX:
+ *vaddr = strtoul(string, NULL, 16);
+ break;
+ case NUM_DEC:
+ *vaddr = strtoul(string, NULL, 10);
+ break;
+ default:
+ err++;
+ error(INFO, "Unknown type:%#x, (NUM_HEX|NUM_DEC)\n", base);
+ }
free(string);
- return TRUE;
+ return err ? FALSE: TRUE;
}
/*
@@ -594,21 +599,21 @@ static struct kernel_range *arm64_get_range_v5_18(struct machine_specific *ms)
struct kernel_range *r = &tmp_range;
/* Get the MODULES_VADDR ~ MODULES_END */
- if (!arm64_get_vmcoreinfo_ul(&r->modules_vaddr, "NUMBER(MODULES_VADDR)"))
+ if (!arm64_get_vmcoreinfo(&r->modules_vaddr, "NUMBER(MODULES_VADDR)", NUM_HEX))
return NULL;
- if (!arm64_get_vmcoreinfo_ul(&r->modules_end, "NUMBER(MODULES_END)"))
+ if (!arm64_get_vmcoreinfo(&r->modules_end, "NUMBER(MODULES_END)", NUM_HEX))
return NULL;
/* Get the VMEMMAP_START ~ VMEMMAP_END */
- if (!arm64_get_vmcoreinfo_ul(&r->vmemmap_vaddr, "NUMBER(VMEMMAP_START)"))
+ if (!arm64_get_vmcoreinfo(&r->vmemmap_vaddr, "NUMBER(VMEMMAP_START)", NUM_HEX))
return NULL;
- if (!arm64_get_vmcoreinfo_ul(&r->vmemmap_end, "NUMBER(VMEMMAP_END)"))
+ if (!arm64_get_vmcoreinfo(&r->vmemmap_end, "NUMBER(VMEMMAP_END)", NUM_HEX))
return NULL;
/* Get the VMALLOC_START ~ VMALLOC_END */
- if (!arm64_get_vmcoreinfo_ul(&r->vmalloc_start_addr, "NUMBER(VMALLOC_START)"))
+ if (!arm64_get_vmcoreinfo(&r->vmalloc_start_addr, "NUMBER(VMALLOC_START)", NUM_HEX))
return NULL;
- if (!arm64_get_vmcoreinfo_ul(&r->vmalloc_end, "NUMBER(VMALLOC_END)"))
+ if (!arm64_get_vmcoreinfo(&r->vmalloc_end, "NUMBER(VMALLOC_END)", NUM_HEX))
return NULL;
return r;
@@ -888,12 +893,7 @@ range_failed:
/* Get the size of struct page {} */
static void arm64_get_struct_page_size(struct machine_specific *ms)
{
- char *string;
-
- string = pc->read_vmcoreinfo("SIZE(page)");
- if (string)
- ms->struct_page_size = atol(string);
- free(string);
+ arm64_get_vmcoreinfo(&ms->struct_page_size, "SIZE(page)", NUM_DEC);
}
/*
@@ -1469,16 +1469,12 @@ arm64_calc_phys_offset(void)
physaddr_t paddr;
ulong vaddr;
struct syment *sp;
- char *string;
if ((machdep->flags & NEW_VMEMMAP) &&
ms->kimage_voffset && (sp = kernel_symbol_search("memstart_addr"))) {
if (pc->flags & PROC_KCORE) {
- if ((string = pc->read_vmcoreinfo("NUMBER(PHYS_OFFSET)"))) {
- ms->phys_offset = htol(string, QUIET, NULL);
- free(string);
+ if (arm64_get_vmcoreinfo(&ms->phys_offset, "NUMBER(PHYS_OFFSET)", NUM_HEX))
return;
- }
vaddr = symbol_value_from_proc_kallsyms("memstart_addr");
if (vaddr == BADVAL)
vaddr = sp->value;
@@ -1560,9 +1556,8 @@ arm64_get_section_size_bits(void)
} else
machdep->section_size_bits = _SECTION_SIZE_BITS;
- if ((string = pc->read_vmcoreinfo("NUMBER(SECTION_SIZE_BITS)"))) {
- machdep->section_size_bits = atol(string);
- free(string);
+ if (arm64_get_vmcoreinfo(&machdep->section_size_bits, "NUMBER(SECTION_SIZE_BITS)", NUM_DEC)) {
+ /* nothing */
} else if (kt->ikconfig_flags & IKCONFIG_AVAIL) {
if ((ret = get_kernel_config("CONFIG_MEMORY_HOTPLUG", NULL)) == IKCONFIG_Y) {
if ((ret = get_kernel_config("CONFIG_HOTPLUG_SIZE_BITS", &string)) == IKCONFIG_STR)
@@ -1581,15 +1576,11 @@ arm64_get_section_size_bits(void)
static int
arm64_kdump_phys_base(ulong *phys_offset)
{
- char *string;
struct syment *sp;
physaddr_t paddr;
- if ((string = pc->read_vmcoreinfo("NUMBER(PHYS_OFFSET)"))) {
- *phys_offset = htol(string, QUIET, NULL);
- free(string);
+ if (arm64_get_vmcoreinfo(phys_offset, "NUMBER(PHYS_OFFSET)", NUM_HEX))
return TRUE;
- }
if ((machdep->flags & NEW_VMEMMAP) &&
machdep->machspec->kimage_voffset &&
@@ -4592,10 +4583,9 @@ static int
arm64_set_va_bits_by_tcr(void)
{
ulong value;
- char *string;
- if ((string = pc->read_vmcoreinfo("NUMBER(TCR_EL1_T1SZ)")) ||
- (string = pc->read_vmcoreinfo("NUMBER(tcr_el1_t1sz)"))) {
+ if (arm64_get_vmcoreinfo(&value, "NUMBER(TCR_EL1_T1SZ)", NUM_HEX) ||
+ arm64_get_vmcoreinfo(&value, "NUMBER(tcr_el1_t1sz)", NUM_HEX)) {
/* See ARMv8 ARM for the description of
* TCR_EL1.T1SZ and how it can be used
* to calculate the vabits_actual
@@ -4604,10 +4594,9 @@ arm64_set_va_bits_by_tcr(void)
* Basically:
* vabits_actual = 64 - T1SZ;
*/
- value = 64 - strtoll(string, NULL, 0);
+ value = 64 - value;
if (CRASHDEBUG(1))
fprintf(fp, "vmcoreinfo : vabits_actual: %ld\n", value);
- free(string);
machdep->machspec->VA_BITS_ACTUAL = value;
machdep->machspec->VA_BITS = value;
machdep->machspec->VA_START = _VA_START(machdep->machspec->VA_BITS_ACTUAL);
@@ -4623,13 +4612,8 @@ arm64_calc_VA_BITS(void)
int bitval;
struct syment *sp;
ulong vabits_actual, value;
- char *string;
- if ((string = pc->read_vmcoreinfo("NUMBER(VA_BITS)"))) {
- value = atol(string);
- free(string);
- machdep->machspec->CONFIG_ARM64_VA_BITS = value;
- }
+ arm64_get_vmcoreinfo(&machdep->machspec->CONFIG_ARM64_VA_BITS, "NUMBER(VA_BITS)", NUM_DEC);
if (kernel_symbol_exists("vabits_actual")) {
if (pc->flags & PROC_KCORE) {
@@ -4754,9 +4738,7 @@ arm64_calc_virtual_memory_ranges(void)
ulong PUD_SIZE = UNINITIALIZED;
if (!machdep->machspec->CONFIG_ARM64_VA_BITS) {
- if ((string = pc->read_vmcoreinfo("NUMBER(VA_BITS)"))) {
- value = atol(string);
- free(string);
+ if (arm64_get_vmcoreinfo(&value, "NUMBER(VA_BITS)", NUM_DEC)) {
machdep->machspec->CONFIG_ARM64_VA_BITS = value;
} else if (kt->ikconfig_flags & IKCONFIG_AVAIL) {
if ((ret = get_kernel_config("CONFIG_ARM64_VA_BITS",
@@ -4852,11 +4834,8 @@ arm64_swp_offset(ulong pte)
static void arm64_calc_KERNELPACMASK(void)
{
ulong value;
- char *string;
- if ((string = pc->read_vmcoreinfo("NUMBER(KERNELPACMASK)"))) {
- value = htol(string, QUIET, NULL);
- free(string);
+ if (arm64_get_vmcoreinfo(&value, "NUMBER(KERNELPACMASK)", NUM_HEX)) {
machdep->machspec->CONFIG_ARM64_KERNELPACMASK = value;
if (CRASHDEBUG(1))
fprintf(fp, "CONFIG_ARM64_KERNELPACMASK: %lx\n", value);
--
2.41.0

View File

@ -1,36 +0,0 @@
From 38435c3acec075b076353ca28f557a0dfe1341c3 Mon Sep 17 00:00:00 2001
From: Li Zhijian <lizhijian@fujitsu.com>
Date: Fri, 15 Dec 2023 10:44:21 +0800
Subject: [PATCH 13/14] help.c: Remove "kmem -l" help messages
"kmem -l" option has existed when crash git project initialization, but
its help message was not accurate (extra arguments a|i|ic|id was missing).
In addition, those symbols required by the -l option were for very old
kernels, at least 2.6 kernels don't contain them. Also, this option has
not been fixed for a long time.
Instead of document this option, hide it from help messages.
Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
---
help.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/help.c b/help.c
index cc7ab20e343e..d80e843703c1 100644
--- a/help.c
+++ b/help.c
@@ -6888,8 +6888,6 @@ char *help_kmem[] = {
" members of the associated page struct are displayed.",
" address when used with -c, the address must be a page pointer address;",
" the page_hash_table entry containing the page is displayed.",
-" address when used with -l, the address must be a page pointer address;",
-" the page address is displayed if it is contained with the list.",
" address when used with -v, the address can be a mapped kernel virtual",
" address or physical address; the mapped region containing the",
" address is displayed.\n",
--
2.41.0

View File

@ -1,65 +0,0 @@
From 53d2577cef98b76b122aade94349637a11e06138 Mon Sep 17 00:00:00 2001
From: Tao Liu <ltao@redhat.com>
Date: Tue, 26 Dec 2023 09:19:28 +0800
Subject: [PATCH 14/14] x86_64: check bt->bptr before calculate framesize
Previously the value of bt->bptr is not checked, which may led to a
wrong prev_sp and framesize. As a result, bt->stackbuf[] will be
accessed out of range, and segfault.
Before:
crash> set debug 1
crash> bt
...snip...
--- <NMI exception stack> ---
#8 [ffffffff9a603e10] __switch_to_asm at ffffffff99800214
rsp: ffffffff9a603e10 textaddr: ffffffff99800214 -> spo: 0 bpo: 0 spr: 0 bpr: 0 type: 0 end: 0
#9 [ffffffff9a603e40] __schedule at ffffffff9960dfb1
rsp: ffffffff9a603e40 textaddr: ffffffff9960dfb1 -> spo: 16 bpo: -16 spr: 4 bpr: 1 type: 0 end: 0
rsp: ffffffff9a603e40 rbp: ffffb9ca076e7ca8 prev_sp: ffffb9ca076e7cb8 framesize: 1829650024
Segmentation fault (core dumped)
(gdb) p/x bt->stackbase
$1 = 0xffffffff9a600000
(gdb) p/x bt->stacktop
$2 = 0xffffffff9a604000
After:
crash> set debug 1
crash> bt
...snip...
--- <NMI exception stack> ---
#8 [ffffffff9a603e10] __switch_to_asm at ffffffff99800214
rsp: ffffffff9a603e10 textaddr: ffffffff99800214 -> spo: 0 bpo: 0 spr: 0 bpr: 0 type: 0 end: 0
#9 [ffffffff9a603e40] __schedule at ffffffff9960dfb1
rsp: ffffffff9a603e40 textaddr: ffffffff9960dfb1 -> spo: 16 bpo: -16 spr: 4 bpr: 1 type: 0 end: 0
#10 [ffffffff9a603e98] schedule_idle at ffffffff9960e87c
rsp: ffffffff9a603e98 textaddr: ffffffff9960e87c -> spo: 8 bpo: 0 spr: 5 bpr: 0 type: 0 end: 0
rsp: ffffffff9a603e98 prev_sp: ffffffff9a603ea8 framesize: 0
...snip...
Check bt->bptr value before calculate framesize. Only bt->bptr within
the range of bt->stackbase and bt->stacktop will be regarded as valid.
Signed-off-by: Tao Liu <ltao@redhat.com>
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
---
x86_64.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/x86_64.c b/x86_64.c
index 42ade4817ad9..f59991f8c4c5 100644
--- a/x86_64.c
+++ b/x86_64.c
@@ -8649,7 +8649,7 @@ x86_64_get_framesize(struct bt_info *bt, ulong textaddr, ulong rsp, char *stack_
if (CRASHDEBUG(1))
fprintf(fp, "rsp: %lx prev_sp: %lx framesize: %d\n",
rsp, prev_sp, framesize);
- } else if ((korc->sp_reg == ORC_REG_BP) && bt->bptr) {
+ } else if ((korc->sp_reg == ORC_REG_BP) && bt->bptr && INSTACK(bt->bptr, bt)) {
prev_sp = bt->bptr + korc->sp_offset;
framesize = (prev_sp - (rsp + 8) - 8);
if (CRASHDEBUG(1))
--
2.41.0

View File

@ -1,743 +0,0 @@
#
# crash core analysis suite
#
Summary: Kernel analysis utility for live systems, netdump, diskdump, kdump, LKCD or mcore dumpfiles
Name: crash
Version: 8.0.4
Release: 2%{?dist}.alma
License: GPLv3
Group: Development/Debuggers
Source0: https://github.com/crash-utility/crash/archive/crash-%{version}.tar.gz
Source1: http://ftp.gnu.org/gnu/gdb/gdb-10.2.tar.gz
URL: https://crash-utility.github.io
ExclusiveOS: Linux
ExclusiveArch: %{ix86} ia64 x86_64 ppc ppc64 s390 s390x %{arm} aarch64 ppc64le
BuildRequires: ncurses-devel zlib-devel lzo-devel bison snappy-devel wget patch texinfo libzstd-devel
BuildRequires: gcc gcc-c++ make
Requires: binutils
Provides: bundled(libiberty)
Provides: bundled(gdb) = 10.2
Patch0: lzo_snappy_zstd.patch
Patch1: crash-8.0.4_build.patch
Patch2: 0001-Fix-rd-command-for-zram-data-display-in-Linux-6.2-an.patch
Patch3: 0002-Fix-typos-in-offset_table-and-missing-help-o-items.patch
Patch4: 0003-zram-Fixes-for-lookup_swap_cache.patch
Patch5: 0004-symbols-expand-all-kernel-module-symtable-if-not-all.patch
Patch6: 0005-symbols-skip-load-.init.-sections-if-module-was-succ.patch
Patch7: 0006-use-NR_SWAPCACHE-when-nr_swapper_spaces-isn-t-availa.patch
Patch8: 0007-Fix-identity_map_base-value-dump-on-S390.patch
Patch9: 0008-s390x-fix-virtual-vs-physical-address-confusion.patch
Patch10: 0009-s390x-uncouple-physical-and-virtual-memory-spaces.patch
Patch11: 0010-RISCV64-Dump-NT_PRSTATUS-in-help-n.patch
Patch12: 0011-RISCV64-Fix-bt-output-when-no-ra-on-the-stack-top.patch
Patch13: 0012-arm64-rewrite-the-arm64_get_vmcoreinfo_ul-to-arm64_g.patch
Patch14: 0013-help.c-Remove-kmem-l-help-messages.patch
Patch15: 0014-x86_64-check-bt-bptr-before-calculate-framesize.patch
%description
The core analysis suite is a self-contained tool that can be used to
investigate either live systems, kernel core dumps created from the
netdump, diskdump and kdump packages from AlmaLinux, the mcore kernel patch
offered by Mission Critical Linux, or the LKCD kernel patch.
%package devel
Requires: %{name} = %{version}, zlib-devel lzo-devel snappy-devel
Summary: kernel crash analysis utility for live systems, netdump, diskdump, kdump, LKCD or mcore dumpfiles
Group: Development/Debuggers
%description devel
The core analysis suite is a self-contained tool that can be used to
investigate either live systems, kernel core dumps created from the
netdump, diskdump and kdump packages from AlmaLinux, the mcore kernel patch
offered by Mission Critical Linux, or the LKCD kernel patch.
%prep
%setup -n %{name}-%{version} -q
%patch -P 0 -p1 -b lzo_snappy_zstd.patch
%patch -P 1 -p1 -b crash-8.0.4_build.patch
%patch -P 2 -p1
%patch -P 3 -p1
%patch -P 4 -p1
%patch -P 5 -p1
%patch -P 6 -p1
%patch -P 7 -p1
%patch -P 8 -p1
%patch -P 9 -p1
%patch -P 10 -p1
%patch -P 11 -p1
%patch -P 12 -p1
%patch -P 13 -p1
%patch -P 14 -p1
%patch -P 15 -p1
%build
cp %{SOURCE1} .
make -j`nproc` RPMPKG="%{version}-%{release}" CFLAGS="%{optflags}" CXXFLAGS="%{optflags}" LDFLAGS="%{build_ldflags}"
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}%{_bindir}
%make_install
mkdir -p %{buildroot}%{_mandir}/man8
cp -p crash.8 %{buildroot}%{_mandir}/man8/crash.8
mkdir -p %{buildroot}%{_includedir}/crash
chmod 0644 defs.h
cp -p defs.h %{buildroot}%{_includedir}/crash
%clean
rm -rf %{buildroot}
%files
%{_bindir}/crash
%{_mandir}/man8/crash.8*
%doc README COPYING3
%files devel
%{_includedir}/*
%changelog
* Wed Mar 27 2024 Eduard Abdullin <eabdullin@almalinux.org> - 8.0.4-2.alma
- AlmaLinux changes
* Tue Jan 02 2024 Lianbo Jiang <lijiang@redhat.com> - 8.0.4-2
- Fix the "dis -lr" not displaying the source file names
and line numbers
- Fix incorrect symbol translation by the 'struct blk_mq_ops'
* Fri Nov 17 2023 Lianbo Jiang <lijiang@redhat.com> - 8.0.4-1
- Rebase to upstream crash 8.0.4
* Thu Sep 07 2023 Lianbo Jiang <lijiang@redhat.com> - 8.0.3-1
- Rebase to upstream crash-utility 8.0.3
- Backport the latest patches from upstream crash-utility
* Thu Jun 15 2023 Lianbo Jiang <lijiang@redhat.com> - 7.3.2-8
- arm64: Fix again segfault in arm64_is_kernel_exception_frame()
- Fix invalid structure size error during crash startup on ppc64
* Wed Jun 07 2023 Lianbo Jiang <lijiang@redhat.com> - 7.3.2-7
- Fix segfault caused by failure of stopping CPUs
* Mon May 08 2023 Lianbo Jiang <lijiang@redhat.com> - 7.3.2-6
- Fix for freelist pointer on PPC64le, ARM64 and S390x
* Mon May 08 2023 Lianbo Jiang <lijiang@redhat.com> - 7.3.2-5
- Update to the latest upstream commit 47216437e79a
- ("Fix "net" command on kernel configured with CONFIG_IPV6=m")
* Mon Nov 21 2022 Lianbo Jiang <lijiang@redhat.com> - 7.3.2-4
- Fix for commit 2145b2bb79c5, there are different behaviors between gdb-7.6 and gdb-10.2
* Thu Nov 17 2022 Lianbo Jiang <lijiang@redhat.com> - 7.3.2-3
- Update to the latest commit a158590f475c from master branch
* Thu Jun 16 2022 Lianbo Jiang <lijiang@redhat.com> - 7.3.2-2
- Enhance "dev -d|-D" options to support blk-mq sbitmap
* Mon May 16 2022 Lianbo Jiang <lijiang@redhat.com> - 7.3.2-1
- Rebase to upstream crash 7.3.2
* Tue Feb 08 2022 Lianbo Jiang <lijiang@redhat.com> - 7.3.1-5
- Rebuild for osci badfuncs issue
* Mon Feb 07 2022 Lianbo Jiang <lijiang@redhat.com> - 7.3.1-4
- Fix segfault on aarch64 for "bt -a|-c" command
- Fix HZ calculation on Linux 5.14 and later
- Fix for "timer -r" option to display all the per-CPU clocks
* Mon Dec 13 2021 Lianbo Jiang <lijiang@redhat.com> - 7.3.1-3
- Fix segmentation fault caused by crash extension modules
- Support the overflow stack exception handling on aarch64
* Tue Dec 07 2021 Lianbo Jiang <lijiang@redhat.com> - 7.3.1-2
- Enable ZSTD feature support
* Fri Nov 26 2021 Lianbo Jiang <lijiang@redhat.com> - 7.3.1-1
- Rebase to the latest crash-7.3.1
* Thu Nov 18 2021 Lianbo Jiang <lijiang@redhat.com> - 7.3.0-3
- Fix for "sched: Change task_struct::state"
- Fix for "sched: move CPU field back into thread_info if THREAD_INFO_IN_TASK=y"
- Fix live debugging with lockdown=integrity
- Fix 'waitq' command for Linux 4.13 and later kernels
- Fix for "kmem -s|-S" option on Linux 5.7 and later kernels
* Fri May 14 2021 Lianbo Jiang <lijiang@redhat.com> - 7.3.0-2
- Update the sha512 hash in the sources file to solve the
compilation issues
* Thu May 13 2021 Lianbo Jiang <lijiang@redhat.com> - 7.3.0-1
- Rebase to upstream 7.3.0
* Tue Dec 1 2020 Bhupesh Sharma <bhsharma@redhat.com> - 7.2.9-2
- Fix the sources file to add gdb-7.6 tarball
[The line was somehow removed when using rhpkg new-sources to
update the crash tarball location]
Resolves: rhbz#1881854
* Tue Dec 1 2020 Bhupesh Sharma <bhsharma@redhat.com> - 7.2.9-1
- Rebase to upstream crash version 7.2.9
- Also minimize the rhel-only patches to the bare minimum.
Resolves: rhbz#1881854
* Thu Nov 5 2020 Bhupesh Sharma <bhsharma@redhat.com> - 7.2.8-8
- crash/arm64: Fix arm64 read error with 'idmap_ptrs_per_pgd' symbol with debug kernel
Resolves: rhbz#1876039
* Mon Aug 17 2020 Bhupesh Sharma <bhsharma@redhat.com> - 7.2.8-7
- crash/sadump, kaslr: fix failure of calculating kaslr_offset due to an sadump format restriction
Resolves: rhbz#1855527
* Fri Aug 7 2020 Bhupesh Sharma <bhsharma@redhat.com> - 7.2.8-6
- aarch64: Revert to reading CONFIG_ARM64_USER_VA_BITS_52 and CONFIG_ARM64_PA_BITS=52 for 52-bit VA/PA space.
Resolves: rhbz#1861086
* Mon Jul 27 2020 Bhupesh Sharma <bhsharma@redhat.com> - 7.2.8-5
- aarch64: Support reading extended 52-bit address space via crash-utility
Resolves: rhbz#1861086
* Fri Jul 10 2020 Bhupesh Sharma <bhsharma@redhat.com> - 7.2.8-4
- Replace people.redhat.com references with github equivalents.
Resolves: rhbz#1851745
* Mon Jun 22 2020 Bhupesh Sharma <bhsharma@redhat.com> - 7.2.8-3
- Fix for reading compressed kdump dumpfiles from systems with physical memory
Resolves: rhbz#1819606
* Mon Jun 8 2020 Bhupesh Sharma <bhsharma@redhat.com> - 7.2.8-2
- Remove wget from BuildRequires section
Resolves: rhbz#1838322
* Fri Jun 5 2020 Bhupesh Sharma <bhsharma@redhat.com> - 7.2.8-1
- Rebase to latest upstream release 7.2.8
Resolves: rhbz#1838322
* Mon Feb 3 2020 Dave Anderson <anderson@redhat.com> - 7.2.7-3
- Rebase to github commit 6c1c8ac6
Resolves: rhbz#1738619
- Fix "log -a" option
Resolves: rhbz#1785537
- Fix for ELF kdump vmcores form s390x KASLR kernels
Resolves: rhbz#1786996
* Mon Nov 11 2019 Dave Anderson <anderson@redhat.com> - 7.2.7-2
- Rebase to latest upstream sources
Resolves: rhbz#1738619
- Support for KASLR on s390x
Resolves: rhbz# 1753172
* Mon Jun 10 2019 Dave Anderson <anderson@redhat.com> - 7.2.6-2
- Fix "p" command regression
Resolves: rhbz#1718417
- Fix arm64 debug kernel read error message during initialization
Resolves: rhbz#1718736
* Mon May 6 2019 Dave Anderson <anderson@redhat.com> - 7.2.6-1
- Rebase to latest upstream sources
Resolves: rhbz#1686560
- Utilize the VMCOREINFO PT_NOTE in /proc/kcore header
Resolves: rhbz#1627528
- Support extraction of CONFIG_PROC_VMCORE_DEVICE_DUMP data from dumpfile header
Resolves: rhbz#1702535
* Thu Feb 14 2019 Dave Anderson <anderson@redhat.com> - 7.2.3-18
- Fix "files -c" and "files -p" options
Resolves: rhbz#1673285
* Mon Feb 11 2019 Dave Anderson <anderson@redhat.com> - 7.2.3-17
- Support for CONFIG_ARM64_USER_VA_BITS_52 and CONFIG_ARM64_PA_BITS=52
Resolves: rhbz#1670099
* Tue Jan 8 2019 Dave Anderson <anderson@redhat.com> - 7.2.3-16
- Resurrect "dev -p" option.
- Fix "dev -[dD]" options to account for request_queue.in_flight[] removal.
Resolves: rhbz#1662039
- Command line input fixes
Resolves: rhbz#1664061
* Thu Dec 13 2018 Dave Anderson <anderson@redhat.com> - 7.2.3-15
- Increase ppc64 MAX_PHYSMEM_BITS to match 4.18.0-35.el8 kernel backport
Resolves: rhbz#1658628
* Thu Nov 29 2018 Dave Anderson <anderson@redhat.com> - 7.2.3-14
- Fix for ARM64 "ps -s" memory allocation failure
Resolves: rhbz#1654582
* Thu Oct 25 2018 Dave Anderson <anderson@redhat.com> - 7.2.3-13
- Change "bt" warnings when exception RIP is legitimate mapped address
Resolves: rhbz#1642221
* Mon Oct 15 2018 Dave Anderson <anderson@redhat.com> - 7.2.3-12
- Address covscan issues
Resolves: rhbz#1602466
- Fix for x86_64 5-level pagetable vmalloc range expansion
Resolves: rhbz#1637125
* Wed Oct 4 2018 Dave Anderson <anderson@redhat.com> - 7.2.3-11
- Fix ppc64 backtrace issues
Resolves: rhbz#1633525
* Wed Sep 19 2018 Dave Anderson <anderson@redhat.com> - 7.2.3-10
- Address annocheck build issues
Resolves: rhbz#1624101
* Thu Aug 9 2018 Dave Anderson <anderson@redhat.com> - 7.2.3-9
- Fix for live system (/proc/kcore) access when KALSR is in effect
Resolves: rhbz#1611916
* Mon Jul 16 2018 Dave Anderson <anderson@redhat.com> - 7.2.3-8
- Rebase to github commits 9b494b70_to_eb823b79
Resolves: rhbz#1563495
* Fri Jun 22 2018 Dave Anderson <anderson@redhat.com> - 7.2.3-7
- Rebase to github commits 28fa7bd0 to 02efd083
Resolves: rhbz#1590751
Resolves: rhbz#1592746
* Tue Jun 12 2018 Dave Anderson <anderson@redhat.com> - 7.2.3-6
- github commit 1926150e: fix ppc64/ppc6le stacksize calculation
* Fri Jun 8 2018 Dave Anderson <anderson@redhat.com> - 7.2.3-5
- Remove /dev/mem readmem error message and /proc/kcore switch messages
Resolves: rhbz#1585944
* Fri Jun 1 2018 Dave Anderson <anderson@redhat.com> - 7.2.3-4
- Rebase to latest upstream sources
* Tue Nov 21 2017 Dave Anderson <anderson@redhat.com> - 7.2.0-2
- Rebase to github commits da9bd35a to e2efacdd
Resolves: rhbz#1497316
* Wed Nov 1 2017 Dave Anderson <anderson@redhat.com> - 7.2.0-1
- Rebase to upstream version 7.2.0
- Rebase to github commits da9bd35a_to_e2efacdd.patch
Resolves: rhbz#1497316
- ppc64le: fix for "WARNING: cannot access vmalloc'd module memory"
Resolves: rhbz#1485391
- Support for analyzing an SADUMP crash dump if KASLR is enabled
Resolves: rhbz#1504467
* Wed May 3 2017 Dave Anderson <anderson@redhat.com> - 7.1.9-2
- Rebase to github commits 87179026 to ad3b8476
Resolves: rhbz#1393534
- Prohibit native gdb disassemble command when KASLR
Resolves: rhbz#1445649
* Mon Apr 24 2017 Dave Anderson <anderson@redhat.com> - 7.1.9-1
- Rebase to upstream version 7.1.9
Resolves: rhbz#1393534
- Fix gdb "set scope" option for KASLR kernels.
Resolves: rhbz#1440725
- Fix for the determination of the x86_64 "phys_base" value when it is
not passed in the VMCOREINFO data of ELF vmcores
Resolves: rhbz#1439170
* Wed Mar 8 2017 Dave Anderson <anderson@redhat.com> - 7.1.8-2
- mod [-sS] command may erroneously reassign module symbol addresses
Resolves: rhbz#1430091
* Fri Feb 24 2017 Dave Anderson <anderson@redhat.com> - 7.1.8-1
- Rebase to upstream version 7.1.8
Resolves: rhbz#1393534
- POWER9 - Power ISA 3.0 related support for crash utility
Resolves: rhbz#1368711
- crash package update - ppc64/ppc64le
Resolves: rhbz#1384944
- exception RIP: unknown or invalid address
Resolves: rhbz#1350457
- Crash does not always parse correctly the modules symbol tables
Resolves: rhbz#1360415
- ARM64: crash live system from: WARNING: cannot read linux_banner string
Resolves: rhbz#1392007
- kmem: invalid structure member offset: page_count
Resolves: rhbz#1392011
- Kernel address space randomization [KASLR] support
Resolves: rhbz#1392658
- invalid structure size: tnt
Resolves: rhbz#1420653
* Wed Sep 14 2016 Dave Anderson <anderson@redhat.com> - 7.1.5-2
- Fix for kernel module symbol gathering when the ordering of module
symbol name strings does not match the order of the kernel_symbol
structures.
- Resolves: rhbz#1375130
* Thu Apr 28 2016 Dave Anderson <anderson@redhat.com> - 7.1.5-1
- Rebase to upstream version 7.1.5
Resolves: rhbz#1292566
- Decode clflushopt instruction
Resolves: rhbz#1262479
- Support AArch64 QEMU generated dumps
Resolves: rhbz#1299873
- crash: zero-size memory allocation (aarch64)
Resolves: rhbz#1312738
* Tue Apr 5 2016 Dave Anderson <anderson@redhat.com> - 7.1.2-4
- crash: fails to read excluded pages by default on sadump-related format
Resolves: rhbz#1304260
* Mon Nov 23 2015 Dave Anderson <anderson@redhat.com> - 7.1.2-3
- crash fails to read or wrongly reads some parts of memory in sadump vmcore format
Resolves: rhbz#1282997
* Tue Aug 4 2015 Dave Anderson <anderson@redhat.com> - 7.1.2-2
- Fix "kmem -s <address>", "bt -F[F]", and "rd -S[S]" options in kernels
configured with CONFIG_SLUB having multiple-page slabs.
Resolves: rhbz#1244003
- Fix for SIGSEGV generated by "bt -[f|F]" in ARM64 kernels.
Resolves: rhbz#1248859
* Mon Jul 13 2015 Dave Anderson <anderson@redhat.com> - 7.1.2-1
- Rebase to upstream version 7.1.2
Resolves: rhbz#1207696
- Fix several ppc64 backtrace issues
Resolves: rhbz#1235447
* Fri Jun 05 2015 Dave Anderson <anderson@redhat.com> - 7.1.1-2
- ARM64 backtrace enhancements
Resolves: rhbz#1227508
* Thu May 28 2015 Dave Anderson <anderson@redhat.com> - 7.1.1-1
- Rebase to upstream version 7.1.1
Resolves: rhbz#1207696
- Display s390x vector registers from a kernel dump.
Resolves: rhbz#1182161
- Fix date displayed on initial system banner and by the "sys" command on ARM64.
Resolves: rhbz#1223044
- Fix ARM64 page size calculation on 4.1 and later kernels.
Resolves: rhbz#1222645
* Tue Apr 21 2015 Dave Anderson <anderson@redhat.com> - 7.0.9-6
- Calculate ARM64 virtual memory layout based upon struct page size
Resolves: rhbz#1204941
* Tue Apr 7 2015 Dave Anderson <anderson@redhat.com> - 7.0.9-5
- Support new sadump format that can represent more than 16 TB physical memory space
Resolves: rhbz#1182383
* Mon Jan 26 2015 Dave Anderson <anderson@redhat.com> - 7.0.9-4
Fix ppc64 "bt" command for active tasks in compressed kdumps.
Resolves: rhbz#1184401
* Mon Jan 12 2015 Dave Anderson <anderson@redhat.com> - 7.0.9-3
Fix "bt" command mislabeling errors.
Resolves: rhbz#1179476
* Mon Dec 08 2014 Dave Anderson <anderson@redhat.com> - 7.0.9-2
- Use registers from QEMU-generated ELF and compressed kdump headers
for active task backtraces.
- Resolves: rhbz#1169555
* Fri Nov 14 2014 Dave Anderson <anderson@redhat.com> - 7.0.9-1
- Rebase to upstream version 7.0.9.
- Resolves: rhbz#1110513
* Tue Sep 23 2014 Dave Anderson <anderson@redhat.com> - 7.0.8-2
- Fix ps performance patch regression on live systems.
- Resolves: rhbz#1134177
- Minor build-related fixes for ppc64le.
- Resolves: rhbz#1123991
* Fri Sep 12 2014 Dave Anderson <anderson@redhat.com> - 7.0.8-1
- Rebase to upstream version 7.0.8.
- Resolves: rhbz#1110513
- Fix to calculate the physical base address of dumpfiles created
by a "virsh dump" of an OVMF guest.
- Resolves: rhbz#1080698
- Support for aarch64 architecture.
- Resolves: rhbz#1110551
- Fix to prevent crash from spinning endlessly on a corrupted/truncated
dumpfile whose bitmap data is not wholly contained within the file.
- Resolves: rhbz#1114088
- Support for ppc64le architecture.
- Resolves: rhbz#1123991
* Tue Jan 28 2014 Daniel Mach <dmach@redhat.com> - 7.0.2-6
- Mass rebuild 2014-01-24
* Fri Jan 24 2014 Dave Anderson <anderson@redhat.com> - 7.0.2-5
- Fix for a missing kernel-mode exception frame dump by the x86_64
"bt" command if a page fault was generated by a bogus RIP.
- Resolves: rhbz#1057353
- Fix for the x86_64 "bt" command to prevent an unwarranted message
indicating "WARNING: possibly bogus exception frame" generated
from a blocked kernel thread that was in the process of exec'ing
a user process via the call_usermodehelper() facility.
- Resolves: rhbz#1057357
* Fri Jan 10 2014 Dave Anderson <anderson@redhat.com> - 7.0.2-4
- Fixes for "kmem -S" command for CONFIG_SLUB.
- Resolves: rhbz#1045591
- Increase S390X NR_CPUS
- Resolves: rhbz#1051156
* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 7.0.2-3
- Mass rebuild 2013-12-27
* Tue Oct 29 2013 Dave Anderson <anderson@redhat.com> - 7.0.2-2
- Compressed kdump 46-bit physical memory support
Resolves: rhbz#1015250
- Fix incorrect backtrace for dumps taken with "virsh dump --memory-only"
Resolves: rhbz#1020469
- Fix cpu number display on systems with more than 254 cpus
Resolves: rhbz#1020536
* Wed Sep 04 2013 Dave Anderson <anderson@redhat.com> - 7.0.2-1
- Update to latest upstream release
- Fix for ppc64 embedded gdb NULL pointer translation sigsegv
- Fix for bt -F failure
* Fri Jul 26 2013 Dave Anderson <anderson@redhat.com> - 7.0.1-4
- Add lzo-devel and snappy-devel to crash-devel Requires line
* Tue Jul 23 2013 Dave Anderson <anderson@redhat.com> - 7.0.1-3
- Build with snappy compression support
* Tue Jul 9 2013 Dave Anderson <anderson@redhat.com> - 7.0.1-2
- Fix for ppc64 Linux 3.10 vmalloc/user-space virtual address translation
* Tue Jun 18 2013 Dave Anderson <anderson@redhat.com> - 7.0.1-1
- Update to latest upstream release
- Build with LZO support
* Tue Apr 9 2013 Dave Anderson <anderson@redhat.com> - 6.1.6-1
- Update to latest upstream release
* Tue Feb 19 2013 Dave Anderson <anderson@redhat.com> - 6.1.4-1
- Update to latest upstream release
* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 6.1.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Wed Jan 9 2013 Dave Anderson <anderson@redhat.com> - 6.1.2-1
- Update to latest upstream release
* Tue Nov 27 2012 Dave Anderson <anderson@redhat.com> - 6.1.1-1
- Update to latest upstream release
* Mon Sep 1 2012 Dave Anderson <anderson@redhat.com> - 6.1.0-1
- Add ppc to ExclusiveArch list
- Update to latest upstream release
* Tue Aug 21 2012 Dave Anderson <anderson@redhat.com> - 6.0.9-1
- Update to latest upstream release
* Wed Jul 18 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 6.0.8-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Mon Jul 1 2012 Dave Anderson <anderson@redhat.com> - 6.0.8-1
- Update to latest upstream release.
- Replace usage of "struct siginfo" with "siginfo_t".
* Mon Apr 30 2012 Dave Anderson <anderson@redhat.com> - 6.0.6-1
- Update to latest upstream release
* Mon Mar 26 2012 Dave Anderson <anderson@redhat.com> - 6.0.5-1
- Update to latest upstream release
* Wed Jan 4 2012 Dave Anderson <anderson@redhat.com> - 6.0.2-1
- Update to latest upstream release
* Wed Oct 26 2011 Dave Anderson <anderson@redhat.com> - 6.0.0-1
- Update to latest upstream release
* Tue Sep 20 2011 Dave Anderson <anderson@redhat.com> - 5.1.8-1
- Update to latest upstream release
- Additional fixes for gcc-4.6 -Werror compile failures for ARM architecture.
* Thu Sep 1 2011 Dave Anderson <anderson@redhat.com> - 5.1.7-2
- Fixes for gcc-4.6 -Werror compile failures for ARM architecture.
* Wed Aug 17 2011 Dave Anderson <anderson@redhat.com> - 5.1.7-1
- Update to latest upstream release
- Fixes for gcc-4.6 -Werror compile failures for ppc64/ppc.
* Tue May 31 2011 Peter Robinson <pbrobinson@gmail.com> - 5.1.5-1
- Update to latest upstream release
- Add ARM to the Exclusive arch
* Wed Feb 25 2011 Dave Anderson <anderson@redhat.com> - 5.1.2-2
- Fixes for gcc-4.6 -Werror compile failures in gdb module.
* Wed Feb 23 2011 Dave Anderson <anderson@redhat.com> - 5.1.2-1
- Upstream version.
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.0.6-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Tue Jul 20 2010 Dave Anderson <anderson@redhat.com> - 5.0.6-2
- Bump version.
* Tue Jul 20 2010 Dave Anderson <anderson@redhat.com> - 5.0.6-1
- Update to upstream version.
* Fri Sep 11 2009 Dave Anderson <anderson@redhat.com> - 4.0.9-2
Bump version.
* Fri Sep 11 2009 Dave Anderson <anderson@redhat.com> - 4.0.9-1
- Update to upstream release, which allows the removal of the
Revision tag workaround, the crash-4.0-8.11-dwarf3.patch and
the crash-4.0-8.11-optflags.patch
* Sun Aug 05 2009 Lubomir Rintel <lkundrak@v3.sk> - 4.0.8.11-2
- Fix reading of dwarf 3 DW_AT_data_member_location
- Use proper compiler flags
* Wed Aug 05 2009 Lubomir Rintel <lkundrak@v3.sk> - 4.0.8.11-1
- Update to later upstream release
- Fix abuse of Revision tag
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.0-9.7.2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
* Tue Feb 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.0-8.7.2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
* Thu Feb 19 2009 Dave Anderson <anderson@redhat.com> - 4.0-7.7.2
- Replace exclusive arch i386 with ix86.
* Thu Feb 19 2009 Dave Anderson <anderson@redhat.com> - 4.0-7.7.1
- Updates to this file per crash merge review
- Update to upstream version 4.0-7.7. Full changelog viewable in:
http://people.redhat.com/anderson/crash.changelog.html
* Tue Jul 15 2008 Tom "spot" Callaway <tcallawa@redhat.com> 4.0-7
- fix license tag
* Tue Apr 29 2008 Dave Anderson <anderson@redhat.com> - 4.0-6.3
- Added crash-devel subpackage
- Updated crash.patch to match upstream version 4.0-6.3
* Wed Feb 20 2008 Dave Anderson <anderson@redhat.com> - 4.0-6.0.5
- Second attempt at addressing the GCC 4.3 build, which failed due
to additional ptrace.h includes in the lkcd vmdump header files.
* Wed Feb 20 2008 Dave Anderson <anderson@redhat.com> - 4.0-6.0.4
- First attempt at addressing the GCC 4.3 build, which failed on x86_64
because ptrace-abi.h (included by ptrace.h) uses the "u32" typedef,
which relies on <asm/types.h>, and include/asm-x86_64/types.h
does not not typedef u32 as done in include/asm-x86/types.h.
* Mon Feb 18 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 4.0-6.0.3
- Autorebuild for GCC 4.3
* Wed Jan 23 2008 Dave Anderson <anderson@redhat.com> - 4.0-5.0.3
- Updated crash.patch to match upstream version 4.0-5.0.
* Wed Aug 29 2007 Dave Anderson <anderson@redhat.com> - 4.0-4.6.2
- Updated crash.patch to match upstream version 4.0-4.6.
* Wed Sep 13 2006 Dave Anderson <anderson@redhat.com> - 4.0-3.3
- Updated crash.patch to match upstream version 4.0-3.3.
- Support for x86_64 relocatable kernels. BZ #204557
* Mon Aug 7 2006 Dave Anderson <anderson@redhat.com> - 4.0-3.1
- Updated crash.patch to match upstream version 4.0-3.1.
- Added kdump reference to description.
- Added s390 and s390x to ExclusiveArch list. BZ #199125
- Removed LKCD v1 pt_regs references for s390/s390x build.
- Removed LKCD v2_v3 pt_regs references for for s390/s390x build.
* Fri Jul 14 2006 Jesse Keating <jkeating@redhat.com> - 4.0-3
- rebuild
* Mon May 15 2006 Dave Anderson <anderson@redhat.com> - 4.0-2.26.4
- Updated crash.patch such that <asm/page.h> is not #include'd
by s390_dump.c; IBM did not make the file s390[s] only; BZ #192719
* Mon May 15 2006 Dave Anderson <anderson@redhat.com> - 4.0-2.26.3
- Updated crash.patch such that <asm/page.h> is not #include'd
by vas_crash.h; only ia64 build complained; BZ #191719
* Mon May 15 2006 Dave Anderson <anderson@redhat.com> - 4.0-2.26.2
- Updated crash.patch such that <asm/segment.h> is not #include'd
by lkcd_x86_trace.c; also for BZ #191719
* Mon May 15 2006 Dave Anderson <anderson@redhat.com> - 4.0-2.26.1
- Updated crash.patch to bring it up to 4.0-2.26, which should
address BZ #191719 - "crash fails to build in mock"
* Tue Feb 07 2006 Jesse Keating <jkeating@redhat.com> - 4.0-2.18.1
- rebuilt for new gcc4.1 snapshot and glibc changes
* Wed Jan 04 2006 Dave Anderson <anderson@redhat.com> 4.0-2.18
- Updated source package to crash-4.0.tar.gz, and crash.patch
to bring it up to 4.0-2.18.
* Fri Dec 09 2005 Jesse Keating <jkeating@redhat.com>
- rebuilt
* Thu Mar 03 2005 Dave Anderson <anderson@redhat.com> 3.10-13
- Compiler error- and warning-related fixes for gcc 4 build.
- Update to enhance x86 and x86_64 gdb disassembly output so as to
symbolically display call targets from kernel module text without
requiring module debuginfo data.
- Fix hole where an ia64 vmcore could be mistakenly accepted as a
usable dumpfile on an x86_64 machine, leading eventually to a
non-related error message.
* Wed Mar 02 2005 Dave Anderson <anderson@redhat.com> 3.10-12
- rebuild (gcc 4)
* Thu Feb 10 2005 Dave Anderson <anderson@redhat.com> 3.10-9
- Updated source package to crash-3.10.tar.gz, containing
IBM's final ppc64 processor support for RHEL4
- Fixes potential "bt -a" hang on dumpfile where netdump IPI interrupted
an x86 process while executing the instructions just after it had entered
the kernel for a syscall, but before calling the handler. BZ #139437
- Update to handle backtraces in dumpfiles generated on IA64 with the
INIT switch (functionality intro'd in RHEL3-U5 kernel). BZ #139429
- Fix for handling ia64 and x86_64 machines booted with maxcpus=1 on
an SMP kernel. BZ #139435
- Update to handle backtraces in dumpfiles generated on x86_64 from the
NMI exception stack (functionality intro'd in RHEL3-U5 kernel).
- "kmem -[sS]" beefed up to more accurately verify slab cache chains
and report errors found.
- Fix for ia64 INIT switch-generated backtrace handling when
init_handler_platform() is inlined into ia64_init_handler();
properly handles both RHEL3 and RHEL4 kernel patches.
BZ #138350
- Update to enhance ia64 gdb disassembly output so as to
symbolically display call targets from kernel module
text without requiring module debuginfo data.
* Wed Jul 14 2004 Dave Anderson <anderson@redhat.com> 3.8-5
- bump release for fc3
* Tue Jul 13 2004 Dave Anderson <anderson@redhat.com> 3.8-4
- Fix for gcc 3.4.x/gdb issue where vmlinux was mistakenly presumed non-debug
* Fri Jun 25 2004 Dave Anderson <anderson@redhat.com> 3.8-3
- remove (harmless) error message during ia64 diskdump invocation when
an SMP system gets booted with maxcpus=1
- several 2.6 kernel specific updates
* Thu Jun 17 2004 Dave Anderson <anderson@redhat.com> 3.8-2
- updated source package to crash-3.8.tar.gz
- diskdump support
- x86_64 processor support
* Mon Sep 22 2003 Dave Anderson <anderson@redhat.com> 3.7-5
- make bt recovery code start fix-up only upon reaching first faulting frame
* Fri Sep 19 2003 Dave Anderson <anderson@redhat.com> 3.7-4
- fix "bt -e" and bt recovery code to recognize new __KERNEL_CS and DS
* Wed Sep 10 2003 Dave Anderson <anderson@redhat.com> 3.7-3
- patch to recognize per-cpu GDT changes that redefine __KERNEL_CS and DS
* Wed Sep 10 2003 Dave Anderson <anderson@redhat.com> 3.7-2
- patches for netdump active_set determination and slab info gathering
* Wed Aug 20 2003 Dave Anderson <anderson@redhat.com> 3.7-1
- updated source package to crash-3.7.tar.gz
* Wed Jul 23 2003 Dave Anderson <anderson@redhat.com> 3.6-1
- removed Packager, Distribution, and Vendor tags
- updated source package to crash-3.6.tar.gz
* Fri Jul 18 2003 Jay Fenlason <fenlason@redhat.com> 3.5-2
- remove ppc from arch list, since it doesn't work with ppc64 kernels
- remove alpha from the arch list since we don't build it any more
* Fri Jul 18 2003 Matt Wilson <msw@redhat.com> 3.5-1
- use %%defattr(-,root,root)
* Tue Jul 15 2003 Jay Fenlason <fenlason@redhat.com>
- Updated spec file as first step in turning this into a real RPM for taroon.
- Wrote man page.

View File

@ -1,5 +1,5 @@
--- crash-8.0.4/Makefile.orig
+++ crash-8.0.4/Makefile
--- crash-8.0.5/Makefile.orig
+++ crash-8.0.5/Makefile
@@ -204,7 +204,7 @@ GDB_FLAGS=
# TARGET_CFLAGS will be configured automatically by configure
TARGET_CFLAGS=
@ -18,8 +18,8 @@
@echo "../../${PROGRAM} ../../${PROGRAM}lib.a" > ${GDB}/gdb/mergeobj
@rm -f ${PROGRAM}
@if [ ! -f ${GDB}/config.status ]; then \
--- crash-8.0.4/configure.c.orig
+++ crash-8.0.4/configure.c
--- crash-8.0.5/configure.c.orig
+++ crash-8.0.5/configure.c
@@ -810,7 +810,8 @@ build_configure(struct supported_gdb_version *sp)
fprintf(fp2, "%s\n", sp->GDB);
sprintf(target_data.gdb_version, "%s", &sp->GDB[4]);

634
crash.spec Normal file
View File

@ -0,0 +1,634 @@
#
# crash core analysis suite
#
Summary: Kernel analysis utility for live systems, netdump, diskdump, kdump, LKCD or mcore dumpfiles
Name: crash
Version: 8.0.5
Release: 5%{?dist}
License: GPL-3.0-only
Source0: https://github.com/crash-utility/crash/archive/crash-%{version}.tar.gz
Source1: http://ftp.gnu.org/gnu/gdb/gdb-10.2.tar.gz
URL: https://crash-utility.github.io
ExclusiveOS: Linux
ExclusiveArch: %{ix86} ia64 x86_64 ppc ppc64 s390 s390x %{arm} aarch64 ppc64le
BuildRequires: ncurses-devel zlib-devel lzo-devel snappy-devel bison wget patch texinfo libzstd-devel
BuildRequires: gcc gcc-c++
BuildRequires: make
Requires: binutils
Provides: bundled(libiberty)
Provides: bundled(gdb) = 10.2
Patch0: lzo_snappy_zstd.patch
Patch1: crash-8.0.5_build.patch
Patch2: 0001-Adding-the-zram-decompression-algorithm-lzo-rle.patch
Patch3: 0002-Cleanup-replace-struct-zspage_5_17-with-union.patch
Patch4: 0003-arm64-section_size_bits-compatible-with-macro-defini.patch
Patch5: 0004-Reflect-__-start-end-_init_task-kernel-symbols-renam.patch
Patch6: 0005-x86_64-fix-for-adding-top_of_kernel_stack_padding-fo.patch
Patch7: 0006-Fix-kmem-v-option-on-Linux-6.9-and-later-kernels.patch
Patch8: 0007-X86-64-fix-for-crash-session-loading-failure.patch
Patch9: 0008-Fix-for-failing-to-load-kernel-module.patch
Patch10: 0009-X86-64-fix-a-regression-issue-about-kernel-stack-pad.patch
Patch11: 0001-Fix-kmem-i-and-swap-commands-on-Linux-6.10-rc1-and-l.patch
Patch12: 0002-List-enable-LIST_HEAD_FORMAT-for-r-option.patch
Patch13: 0001-arm64-fix-a-potential-segfault-when-unwind-frame.patch
Patch14: 0002-arm64-Fix-bt-command-show-wrong-stacktrace-on-ramdum.patch
Patch15: 0003-arm64-Introduction-of-support-for-16K-page-with-3-le.patch
Patch16: 0004-LoongArch64-fix-incorrect-code-in-the-main.patch
Patch17: 0005-Fix-irq-a-exceeding-the-memory-range-issue.patch
%description
The core analysis suite is a self-contained tool that can be used to
investigate either live systems, kernel core dumps created from the
netdump, diskdump and kdump packages from Red Hat Linux, the mcore kernel patch
offered by Mission Critical Linux, or the LKCD kernel patch.
%package devel
Requires: %{name} = %{version}, zlib-devel
Summary: kernel crash analysis utility for live systems, netdump, diskdump, kdump, LKCD or mcore dumpfiles
%description devel
The core analysis suite is a self-contained tool that can be used to
investigate either live systems, kernel core dumps created from the
netdump, diskdump and kdump packages from Red Hat Linux, the mcore kernel patch
offered by Mission Critical Linux, or the LKCD kernel patch.
%prep
%setup -n %{name}-%{version} -q
%patch -P 0 -p1 -b lzo_snappy_zstd.patch
%patch -P 1 -p1
%patch -P 2 -p1
%patch -P 3 -p1
%patch -P 4 -p1
%patch -P 5 -p1
%patch -P 6 -p1
%patch -P 7 -p1
%patch -P 8 -p1
%patch -P 9 -p1
%patch -P 10 -p1
%patch -P 11 -p1
%patch -P 12 -p1
%patch -P 13 -p1
%patch -P 14 -p1
%patch -P 15 -p1
%patch -P 16 -p1
%patch -P 17 -p1
%build
cp %{SOURCE1} .
make -j`nproc` RPMPKG="%{version}-%{release}" CFLAGS="%{optflags}" CXXFLAGS="%{optflags}" LDFLAGS="%{build_ldflags}"
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}%{_bindir}
%make_install
mkdir -p %{buildroot}%{_mandir}/man8
cp -p crash.8 %{buildroot}%{_mandir}/man8/crash.8
mkdir -p %{buildroot}%{_includedir}/crash
chmod 0644 defs.h
cp -p defs.h %{buildroot}%{_includedir}/crash
%files
%{_bindir}/crash
%{_mandir}/man8/crash.8*
%doc README COPYING3
%files devel
%{_includedir}/*
%changelog
* Wed Aug 7 2024 Tao Liu <ltao@redhat.com> - 8.0.5-5
- Rebase to upstream crash 8.0.5 f615f8fab7bf3
* Wed Jul 3 2024 Tao Liu <ltao@redhat.com> - 8.0.5-4
- Rebase to upstream crash 8.0.5 ce4ddc742fbdd
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 8.0.5-3
- Bump release for June 2024 mass rebuild
* Thu Jun 20 2024 Tao Liu <ltao@redhat.com> - 8.0.5-2
- Rebase to upstream crash 8.0.5 196c4b79c13d1
* Thu May 16 2024 Lianbo Jiang <lijiang@redhat.com> - 8.0.5-1
- Rebase to upstream crash 8.0.5
* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 8.0.4-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Fri Jan 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 8.0.4-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Thu Dec 28 2023 Lianbo Jiang <lijiang@redhat.com> - 8.0.4-2
- Update to the latest upstream commit: 53d2577cef98
* Thu Nov 16 2023 Lianbo Jiang <lijiang@redhat.com> - 8.0.4-1
- Rebase to upstream crash 8.0.4
* Tue Jul 25 2023 Lianbo Jiang <lijiang@redhat.com> - 8.0.3-5
- Fix warning about kernel version inconsistency during crash startup
* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 8.0.3-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Tue Jun 27 2023 Lianbo Jiang <lijiang@redhat.com> - 8.0.3-3
- Support module memory layout change on Linux 6.4
* Sun Jun 25 2023 Sérgio Basto <sergio@serjux.com> - 8.0.3-2
- Migrate to SPDX license format
* Fri Apr 28 2023 Lianbo Jiang <lijiang@redhat.com> - 8.0.3-1
- Rebase to upstream crash 8.0.3
* Fri Mar 10 2023 Lianbo Jiang <lijiang@redhat.com> - 8.0.2-4
- Fix "kmem -n" option to display memory blocks on Linux 6.3-rc1 and later
- gdb: Fix an assertion failure in dw2_find_pc_sect_compunit_symtab()
- Fix for "net -n" option to properly deal with an invalid argument
- Fix C99 compatibility issues in embedded copy of GDB
- Enhance "net" command to display IPv6 address of network interface
- Fix for "search -u" option failing in maple tree kernel
- x86_64: Fix "bt" command on kernels with random_kstack_offset=on
- Fix for "dis" command to correctly display the offset of disassembly code
- Fix for "bt" command unnecessarily printing an exception frame
- Fix for "kmem -i" option to not print invalid values for CACHED
- Fix for "net -s" option to show IPv6 addresses on Linux 3.13 and later
- Fix "kmem -s|-S" not working properly on RHEL8.6 and later
- Fix for "bt" command printing "bogus exception frame" warning
* Tue Feb 07 2023 Lianbo Jiang <lijiang@redhat.com> - 8.0.2-3
- Update to the latest upstream commit <46344aa2f92b>
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 8.0.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Thu Nov 17 2022 Lianbo Jiang <lijiang@redhat.com> - 8.0.2-1
- Rebase to upstream crash 8.0.2
* Thu Sep 22 2022 Lianbo Jiang <lijiang@redhat.com> - 8.0.1-4
- Update to the latest upstream commit <3b5e3e1583a1>
* Wed Jul 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 8.0.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Fri Jun 10 2022 Lianbo Jiang <lijiang@redhat.com> - 8.0.1-2
- Update to the latest upstream commit <c07068266b41>
* Sun May 01 2022 Lianbo Jiang <lijiang@redhat.com> - 8.0.1-1
- Rebase to upstream crash 8.0.1
* Wed Feb 09 2022 Lianbo Jiang <lijiang@redhat.com> - 8.0.0-6
- Update to the latest upstream commit <5f390ed811b0>
- Fix for cdefs issue on ppc64le
* Wed Jan 19 2022 Fedora Release Engineering <releng@fedoraproject.org> - 8.0.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Fri Dec 10 2021 Lianbo Jiang <lijiang@redhat.com> - 8.0.0-4
- Fix segmentation fault caused by crash extension modules
- Support the overflow stack exception handling on aarch64
* Mon Dec 06 2021 Lianbo Jiang <lijiang@redhat.com> - 8.0.0-3
- Enable ZSTD feature
* Fri Nov 26 2021 Lianbo Jiang <lijiang@redhat.com> - 8.0.0-2
- Enable LTO and Hardened package
* Wed Nov 24 2021 Lianbo Jiang <lijiang@redhat.com> - 8.0.0-1
- Rebase to upstream 8.0.0
* Sat Nov 06 2021 Lianbo Jiang <lijiang@redhat.com> - 7.3.0-5
- Update to the latest upstream: commit <68870c83d299>
* Tue Oct 12 2021 Lianbo Jiang <lijiang@redhat.com> - 7.3.0-4
- Update to gdb-10.2
* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 7.3.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Tue Jul 13 2021 Lianbo Jiang <lijiang@redhat.com> - 7.3.0-2
- Update to the latest upstream <f53b73e8380b>
* Fri May 07 2021 Lianbo Jiang <lijiang@redhat.com> - 7.3.0-1
- Rebase to upstream 7.3.0
* Mon Mar 08 2021 Lianbo Jiang <lijiang@redhat.com> - 7.2.9-5
- Fix Segmentation fault
- Update to the latest upstream: commit <9c0c6c1b3750>
* Fri Feb 05 2021 Lianbo Jiang <lijiang@redhat.com> - 7.2.9-4
- Update to the latest upstream: commit <fdb41f0b6fa4>
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 7.2.9-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Fri Dec 11 2020 Lianbo Jiang <lijiang@redhat.com> - 7.2.9-2
- Add support for lockless ringbuffer
* Wed Nov 25 2020 Lianbo Jiang <lijiang@redhat.com> - 7.2.9-1
- Update to latest upstream release
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 7.2.8-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Mon Jul 13 2020 Tom Stellard <tstellar@redhat.com> - 7.2.8-4
- Use make macros
- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
* Tue Jun 30 2020 Jeff Law <law@redhat.com> - 7.2.8-3
- Disable LTO
* Fri Jan 31 2020 Dave Anderson <anderson@redhat.com> - 7.2.8-2
- Update to latest upstream release
- Fix aarch64 build for gcc-10 -fno-common
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 7.2.7-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Mon Sep 23 2019 Dave Anderson <anderson@redhat.com> - 7.2.7-1
- Update to latest upstream release
* Wed Jul 24 2019 Fedora Release Engineering <releng@fedoraproject.org> - 7.2.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Mon May 6 2019 Dave Anderson <anderson@redhat.com> - 7.2.6-1
- Update to latest upstream release
* Sun Feb 17 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 7.2.5-3
- Rebuild for readline 8.0
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 7.2.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Fri Jan 11 2019 Dave Anderson <anderson@redhat.com> - 7.2.5-1
- Update to latest upstream release
* Mon Sep 24 2018 Dave Anderson <anderson@redhat.com> - 7.2.4-1
- Update to latest upstream release
* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 7.2.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Fri May 18 2018 Dave Anderson <anderson@redhat.com> - 7.2.3-1
- Update to latest upstream release
* Fri Feb 23 2018 Dave Anderson <anderson@redhat.com> - 7.2.1-2
- Use RPM build flags for LDFLAGS
* Fri Feb 16 2018 Dave Anderson <anderson@redhat.com> - 7.2.1-1
- Update to latest upstream release
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 7.2.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Mon Oct 2 2017 Dave Anderson <anderson@redhat.com> - 7.2.0-1
- Update to latest upstream release
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 7.1.9-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 7.1.9-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Mon Apr 24 2017 Dave Anderson <anderson@redhat.com> - 7.1.9-1
- Update to latest upstream release
* Thu Feb 23 2017 Dave Anderson <anderson@redhat.com> - 7.1.8-1
- Update to latest upstream release
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 7.1.7-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Thu Jan 12 2017 Igor Gnatenko <ignatenko@redhat.com> - 7.1.7-2
- Rebuild for readline 7.x
* Tue Dec 6 2016 Dave Anderson <anderson@redhat.com> - 7.1.7-1
- Update to latest upstream release
* Fri Oct 14 2016 Dave Anderson <anderson@redhat.com> - 7.1.6-1
- Update to latest upstream release
- Fix for RHBZ#1044119 - crash bundles gdb
* Thu May 5 2016 Dave Anderson <anderson@redhat.com> - 7.1.5-2
- BZ #1333295 - FTBFS due compiler warnings in elf64-s390.c
* Thu Apr 28 2016 Dave Anderson <anderson@redhat.com> - 7.1.5-1
- Update to latest upstream release
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 7.1.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Thu Dec 17 2015 Dave Anderson <anderson@redhat.com> - 7.1.4-1
- Update to latest upstream release
* Thu Sep 3 2015 Dave Anderson <anderson@redhat.com> - 7.1.3-1
- Update to latest upstream release
* Mon Jul 13 2015 Dave Anderson <anderson@redhat.com> - 7.1.2-1
- Update to latest upstream release
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 7.1.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Thu May 28 2015 Dave Anderson <anderson@redhat.com> - 7.1.1-1
- Update to latest upstream release
* Mon Mar 2 2015 Dave Anderson <anderson@redhat.com> - 7.1.0-3
- Support increment of Linux version from 3 to 4
* Sat Feb 21 2015 Till Maas <opensource@till.name> - 7.1.0-2
- Rebuilt for Fedora 23 Change
https://fedoraproject.org/wiki/Changes/Harden_all_packages_with_position-independent_code
* Tue Feb 10 2015 Dave Anderson <anderson@redhat.com> - 7.1.0-1
- Update to latest upstream release
* Fri Nov 15 2014 Dave Anderson <anderson@redhat.com> - 7.0.9-1
- Update to latest upstream release
* Mon Sep 15 2014 Dave Anderson <anderson@redhat.com> - 7.0.8-1
- Update to latest upstream release
- Add ppc64le as supported architecture for crash package (BZ #1136050)
* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 7.0.7-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
* Wed Jul 02 2014 Dave Anderson <anderson@redhat.com> - 7.0.7-2
- Fix FTBS for aarch64 (BZ #1114588)
* Wed Jun 11 2014 Dave Anderson <anderson@redhat.com> - 7.0.7-1
- Update to latest upstream release
- Fix Fedora_21_Mass_Rebuild FTBFS (BZ #1106090)
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 7.0.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Fri Feb 28 2014 Dave Anderson <anderson@redhat.com> - 7.0.5-1
- Update to latest upstream release
- Use system readline library
- Fix "crash --log vmcore" command for 3.11 and later kernels.
* Tue Dec 17 2013 Toshio Kuratomi <toshio@fedoraproject.org> - 7.0.4-2
- crash bundles gdb which bundles libiberty. Add virtual Provides for
libiberty tracking. Open a bug for unbundling gdb RHBZ#1044119
* Mon Dec 16 2013 Dave Anderson <anderson@redhat.com> - 7.0.4-1
- Update to latest upstream release
* Tue Oct 29 2013 Dave Anderson <anderson@redhat.com> - 7.0.3-1
- Update to latest upstream release
* Wed Sep 04 2013 Dave Anderson <anderson@redhat.com> - 7.0.2-1
- Update to latest upstream release
- Build with lzo and snappy compression capability
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 7.0.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Mon Jun 17 2013 Dave Anderson <anderson@redhat.com> - 7.0.1-1
- Update to latest upstream release
- Add aarch64 as an exclusive arch
* Tue Apr 9 2013 Dave Anderson <anderson@redhat.com> - 6.1.6-1
- Update to latest upstream release
* Tue Feb 19 2013 Dave Anderson <anderson@redhat.com> - 6.1.4-1
- Update to latest upstream release
* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 6.1.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Wed Jan 9 2013 Dave Anderson <anderson@redhat.com> - 6.1.2-1
- Update to latest upstream release
* Tue Nov 27 2012 Dave Anderson <anderson@redhat.com> - 6.1.1-1
- Update to latest upstream release
* Mon Sep 1 2012 Dave Anderson <anderson@redhat.com> - 6.1.0-1
- Add ppc to ExclusiveArch list
- Update to latest upstream release
* Tue Aug 21 2012 Dave Anderson <anderson@redhat.com> - 6.0.9-1
- Update to latest upstream release
* Wed Jul 18 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 6.0.8-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Mon Jul 1 2012 Dave Anderson <anderson@redhat.com> - 6.0.8-1
- Update to latest upstream release.
- Replace usage of "struct siginfo" with "siginfo_t".
* Mon Apr 30 2012 Dave Anderson <anderson@redhat.com> - 6.0.6-1
- Update to latest upstream release
* Mon Mar 26 2012 Dave Anderson <anderson@redhat.com> - 6.0.5-1
- Update to latest upstream release
* Wed Jan 4 2012 Dave Anderson <anderson@redhat.com> - 6.0.2-1
- Update to latest upstream release
* Wed Oct 26 2011 Dave Anderson <anderson@redhat.com> - 6.0.0-1
- Update to latest upstream release
* Tue Sep 20 2011 Dave Anderson <anderson@redhat.com> - 5.1.8-1
- Update to latest upstream release
- Additional fixes for gcc-4.6 -Werror compile failures for ARM architecture.
* Thu Sep 1 2011 Dave Anderson <anderson@redhat.com> - 5.1.7-2
- Fixes for gcc-4.6 -Werror compile failures for ARM architecture.
* Wed Aug 17 2011 Dave Anderson <anderson@redhat.com> - 5.1.7-1
- Update to latest upstream release
- Fixes for gcc-4.6 -Werror compile failures for ppc64/ppc.
* Tue May 31 2011 Peter Robinson <pbrobinson@gmail.com> - 5.1.5-1
- Update to latest upstream release
- Add ARM to the Exclusive arch
* Wed Feb 25 2011 Dave Anderson <anderson@redhat.com> - 5.1.2-2
- Fixes for gcc-4.6 -Werror compile failures in gdb module.
* Wed Feb 23 2011 Dave Anderson <anderson@redhat.com> - 5.1.2-1
- Upstream version.
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.0.6-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Tue Jul 20 2010 Dave Anderson <anderson@redhat.com> - 5.0.6-2
- Bump version.
* Tue Jul 20 2010 Dave Anderson <anderson@redhat.com> - 5.0.6-1
- Update to upstream version.
* Fri Sep 11 2009 Dave Anderson <anderson@redhat.com> - 4.0.9-2
Bump version.
* Fri Sep 11 2009 Dave Anderson <anderson@redhat.com> - 4.0.9-1
- Update to upstream release, which allows the removal of the
Revision tag workaround, the crash-4.0-8.11-dwarf3.patch and
the crash-4.0-8.11-optflags.patch
* Sun Aug 05 2009 Lubomir Rintel <lkundrak@v3.sk> - 4.0.8.11-2
- Fix reading of dwarf 3 DW_AT_data_member_location
- Use proper compiler flags
* Wed Aug 05 2009 Lubomir Rintel <lkundrak@v3.sk> - 4.0.8.11-1
- Update to later upstream release
- Fix abuse of Revision tag
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.0-9.7.2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
* Tue Feb 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.0-8.7.2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
* Thu Feb 19 2009 Dave Anderson <anderson@redhat.com> - 4.0-7.7.2
- Replace exclusive arch i386 with ix86.
* Thu Feb 19 2009 Dave Anderson <anderson@redhat.com> - 4.0-7.7.1
- Updates to this file per crash merge review
- Update to upstream version 4.0-7.7. Full changelog viewable in:
http://people.redhat.com/anderson/crash.changelog.html
* Tue Jul 15 2008 Tom "spot" Callaway <tcallawa@redhat.com> 4.0-7
- fix license tag
* Tue Apr 29 2008 Dave Anderson <anderson@redhat.com> - 4.0-6.3
- Added crash-devel subpackage
- Updated crash.patch to match upstream version 4.0-6.3
* Wed Feb 20 2008 Dave Anderson <anderson@redhat.com> - 4.0-6.0.5
- Second attempt at addressing the GCC 4.3 build, which failed due
to additional ptrace.h includes in the lkcd vmdump header files.
* Wed Feb 20 2008 Dave Anderson <anderson@redhat.com> - 4.0-6.0.4
- First attempt at addressing the GCC 4.3 build, which failed on x86_64
because ptrace-abi.h (included by ptrace.h) uses the "u32" typedef,
which relies on <asm/types.h>, and include/asm-x86_64/types.h
does not not typedef u32 as done in include/asm-x86/types.h.
* Mon Feb 18 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 4.0-6.0.3
- Autorebuild for GCC 4.3
* Wed Jan 23 2008 Dave Anderson <anderson@redhat.com> - 4.0-5.0.3
- Updated crash.patch to match upstream version 4.0-5.0.
* Wed Aug 29 2007 Dave Anderson <anderson@redhat.com> - 4.0-4.6.2
- Updated crash.patch to match upstream version 4.0-4.6.
* Wed Sep 13 2006 Dave Anderson <anderson@redhat.com> - 4.0-3.3
- Updated crash.patch to match upstream version 4.0-3.3.
- Support for x86_64 relocatable kernels. BZ #204557
* Mon Aug 7 2006 Dave Anderson <anderson@redhat.com> - 4.0-3.1
- Updated crash.patch to match upstream version 4.0-3.1.
- Added kdump reference to description.
- Added s390 and s390x to ExclusiveArch list. BZ #199125
- Removed LKCD v1 pt_regs references for s390/s390x build.
- Removed LKCD v2_v3 pt_regs references for for s390/s390x build.
* Fri Jul 14 2006 Jesse Keating <jkeating@redhat.com> - 4.0-3
- rebuild
* Mon May 15 2006 Dave Anderson <anderson@redhat.com> - 4.0-2.26.4
- Updated crash.patch such that <asm/page.h> is not #include'd
by s390_dump.c; IBM did not make the file s390[s] only; BZ #192719
* Mon May 15 2006 Dave Anderson <anderson@redhat.com> - 4.0-2.26.3
- Updated crash.patch such that <asm/page.h> is not #include'd
by vas_crash.h; only ia64 build complained; BZ #191719
* Mon May 15 2006 Dave Anderson <anderson@redhat.com> - 4.0-2.26.2
- Updated crash.patch such that <asm/segment.h> is not #include'd
by lkcd_x86_trace.c; also for BZ #191719
* Mon May 15 2006 Dave Anderson <anderson@redhat.com> - 4.0-2.26.1
- Updated crash.patch to bring it up to 4.0-2.26, which should
address BZ #191719 - "crash fails to build in mock"
* Tue Feb 07 2006 Jesse Keating <jkeating@redhat.com> - 4.0-2.18.1
- rebuilt for new gcc4.1 snapshot and glibc changes
* Wed Jan 04 2006 Dave Anderson <anderson@redhat.com> 4.0-2.18
- Updated source package to crash-4.0.tar.gz, and crash.patch
to bring it up to 4.0-2.18.
* Fri Dec 09 2005 Jesse Keating <jkeating@redhat.com>
- rebuilt
* Thu Mar 03 2005 Dave Anderson <anderson@redhat.com> 3.10-13
- Compiler error- and warning-related fixes for gcc 4 build.
- Update to enhance x86 and x86_64 gdb disassembly output so as to
symbolically display call targets from kernel module text without
requiring module debuginfo data.
- Fix hole where an ia64 vmcore could be mistakenly accepted as a
usable dumpfile on an x86_64 machine, leading eventually to a
non-related error message.
* Wed Mar 02 2005 Dave Anderson <anderson@redhat.com> 3.10-12
- rebuild (gcc 4)
* Thu Feb 10 2005 Dave Anderson <anderson@redhat.com> 3.10-9
- Updated source package to crash-3.10.tar.gz, containing
IBM's final ppc64 processor support for RHEL4
- Fixes potential "bt -a" hang on dumpfile where netdump IPI interrupted
an x86 process while executing the instructions just after it had entered
the kernel for a syscall, but before calling the handler. BZ #139437
- Update to handle backtraces in dumpfiles generated on IA64 with the
INIT switch (functionality intro'd in RHEL3-U5 kernel). BZ #139429
- Fix for handling ia64 and x86_64 machines booted with maxcpus=1 on
an SMP kernel. BZ #139435
- Update to handle backtraces in dumpfiles generated on x86_64 from the
NMI exception stack (functionality intro'd in RHEL3-U5 kernel).
- "kmem -[sS]" beefed up to more accurately verify slab cache chains
and report errors found.
- Fix for ia64 INIT switch-generated backtrace handling when
init_handler_platform() is inlined into ia64_init_handler();
properly handles both RHEL3 and RHEL4 kernel patches.
BZ #138350
- Update to enhance ia64 gdb disassembly output so as to
symbolically display call targets from kernel module
text without requiring module debuginfo data.
* Wed Jul 14 2004 Dave Anderson <anderson@redhat.com> 3.8-5
- bump release for fc3
* Tue Jul 13 2004 Dave Anderson <anderson@redhat.com> 3.8-4
- Fix for gcc 3.4.x/gdb issue where vmlinux was mistakenly presumed non-debug
* Fri Jun 25 2004 Dave Anderson <anderson@redhat.com> 3.8-3
- remove (harmless) error message during ia64 diskdump invocation when
an SMP system gets booted with maxcpus=1
- several 2.6 kernel specific updates
* Thu Jun 17 2004 Dave Anderson <anderson@redhat.com> 3.8-2
- updated source package to crash-3.8.tar.gz
- diskdump support
- x86_64 processor support
* Mon Sep 22 2003 Dave Anderson <anderson@redhat.com> 3.7-5
- make bt recovery code start fix-up only upon reaching first faulting frame
* Fri Sep 19 2003 Dave Anderson <anderson@redhat.com> 3.7-4
- fix "bt -e" and bt recovery code to recognize new __KERNEL_CS and DS
* Wed Sep 10 2003 Dave Anderson <anderson@redhat.com> 3.7-3
- patch to recognize per-cpu GDT changes that redefine __KERNEL_CS and DS
* Wed Sep 10 2003 Dave Anderson <anderson@redhat.com> 3.7-2
- patches for netdump active_set determination and slab info gathering
* Wed Aug 20 2003 Dave Anderson <anderson@redhat.com> 3.7-1
- updated source package to crash-3.7.tar.gz
* Wed Jul 23 2003 Dave Anderson <anderson@redhat.com> 3.6-1
- removed Packager, Distribution, and Vendor tags
- updated source package to crash-3.6.tar.gz
* Fri Jul 18 2003 Jay Fenlason <fenlason@redhat.com> 3.5-2
- remove ppc from arch list, since it doesn't work with ppc64 kernels
- remove alpha from the arch list since we don't build it any more
* Fri Jul 18 2003 Matt Wilson <msw@redhat.com> 3.5-1
- use %%defattr(-,root,root)
* Tue Jul 15 2003 Jay Fenlason <fenlason@redhat.com>
- Updated spec file as first step in turning this into a real RPM for taroon.
- Wrote man page.

6
gating.yaml Normal file
View File

@ -0,0 +1,6 @@
--- !Policy
product_versions:
- rhel-10
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: kernel-qe.kernel-ci.general-kdump.tier0.functional}

View File

@ -1,5 +1,5 @@
--- crash-8.0.4/Makefile.orig
+++ crash-8.0.4/Makefile
--- crash-8.0.5/Makefile.orig
+++ crash-8.0.5/Makefile
@@ -256,7 +256,7 @@ all: make_configure
gdb_merge: force
@if [ ! -f ${GDB}/README ]; then \
@ -9,8 +9,8 @@
@echo "../../${PROGRAM} ../../${PROGRAM}lib.a" > ${GDB}/gdb/mergeobj
@rm -f ${PROGRAM}
@if [ ! -f ${GDB}/config.status ]; then \
--- crash-8.0.4/diskdump.c.orig
+++ crash-8.0.4/diskdump.c
--- crash-8.0.5/diskdump.c.orig
+++ crash-8.0.5/diskdump.c
@@ -23,6 +23,9 @@
* GNU General Public License for more details.
*/

2
sources Normal file
View File

@ -0,0 +1,2 @@
SHA512 (crash-8.0.5.tar.gz) = 0e199899fcc479eeebd1177a88dfe26725d9f63361d5ff7dbf9cb0f8425d3c6b8d60aada0a4312f61eecfe0ed0cca346034e12accbf5896446db8d9fb7d55e05
SHA512 (gdb-10.2.tar.gz) = aa89caf47c1c84366020377d47e7c51ddbc48e5b7686f244e38797c8eb88411cf57fcdc37eb669961efb41ceeac4181747f429625fd1acce7712cb9a1fea9c41