Rebase to upstream crash-8.0.5 196c4b79c13d1c

Release: crash-8.0.5-2

Resolves: RHEL-43414

Signed-off-by: Tao Liu <ltao@redhat.com>
This commit is contained in:
Tao Liu 2024-06-19 14:40:52 +08:00
parent 3caa7e97fc
commit e83d5f939a
30 changed files with 1397 additions and 166345 deletions

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,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,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,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,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,16 +0,0 @@
--- crash-7.0.7/gdb-7.6.patch.orig
+++ crash-7.0.7/gdb-7.6.patch
@@ -1678,3 +1678,13 @@
fprintf_filtered(gdb_stdout, "\n");
lastval++;
}
+--- gdb-7.6/gdb/aarch64-linux-nat.c.orig
++++ gdb-7.6/gdb/aarch64-linux-nat.c
+@@ -32,6 +32,7 @@
+ #include "elf/common.h"
+
+ #include <sys/ptrace.h>
++#include <asm/ptrace.h>
+ #include <sys/utsname.h>
+
+ #include "gregset.h"

View File

@ -1,38 +0,0 @@
diff --git a/gdb-7.6.patch b/gdb-7.6.patch
index f6c311d..f64b55f 100644
--- a/gdb-7.6.patch
+++ b/gdb-7.6.patch
@@ -2471,3 +2471,33 @@ diff -up gdb-7.6/opcodes/configure.orig gdb-7.6/opcodes/configure
#else
# error "!__i386__ && !__x86_64__"
#endif
+--- gdb-7.6/gdb/features/aarch64.c.orig
++++ gdb-7.6/gdb/features/aarch64.c
+@@ -5,7 +5,6 @@
+ #include "osabi.h"
+ #include "target-descriptions.h"
+
+-struct target_desc *tdesc_aarch64;
+ static void
+ initialize_tdesc_aarch64 (void)
+ {
+--- gdb-7.6/gdb/aarch64-linux-nat.c.orig
++++ gdb-7.6/gdb/aarch64-linux-nat.c
+@@ -37,6 +37,7 @@
+
+ #include "gregset.h"
+
++extern struct target_desc *tdesc_aarch64;
+ #include "features/aarch64.c"
+
+ /* Defines ps_err_e, struct ps_prochandle. */
+--- gdb-7.6/gdb/aarch64-tdep.c.orig
++++ gdb-7.6/gdb/aarch64-tdep.c
+@@ -52,6 +52,7 @@
+ #include "gdb_assert.h"
+ #include "vec.h"
+
++struct target_desc *tdesc_aarch64;
+ #include "features/aarch64.c"
+ #include "features/aarch64-without-fpu.c"
+

View File

@ -1,154 +0,0 @@
--- crash-5.1.7/gdb-7.0.patch.orig
+++ crash-5.1.7/gdb-7.0.patch
@@ -1838,3 +1838,151 @@
a = relocation;
b = val & howto->src_mask;
+--- gdb-7.0/bfd/elf32-arm.c.orig
++++ gdb-7.0/bfd/elf32-arm.c
+@@ -3438,7 +3438,6 @@ arm_build_one_stub (struct bfd_hash_entr
+ struct elf32_arm_link_hash_table *htab;
+ asection *stub_sec;
+ bfd *stub_bfd;
+- bfd_vma stub_addr;
+ bfd_byte *loc;
+ bfd_vma sym_value;
+ int template_size;
+@@ -3471,10 +3470,6 @@ arm_build_one_stub (struct bfd_hash_entr
+
+ stub_bfd = stub_sec->owner;
+
+- /* This is the address of the start of the stub. */
+- stub_addr = stub_sec->output_section->vma + stub_sec->output_offset
+- + stub_entry->stub_offset;
+-
+ /* This is the address of the stub destination. */
+ sym_value = (stub_entry->target_value
+ + stub_entry->target_section->output_offset
+@@ -3660,16 +3655,14 @@ find_stub_size_and_template (enum elf32_
+
+ static bfd_boolean
+ arm_size_one_stub (struct bfd_hash_entry *gen_entry,
+- void * in_arg)
++ void * in_arg __attribute__ ((unused)))
+ {
+ struct elf32_arm_stub_hash_entry *stub_entry;
+- struct elf32_arm_link_hash_table *htab;
+ const insn_sequence *template_sequence;
+ int template_size, size;
+
+ /* Massage our args to the form they really have. */
+ stub_entry = (struct elf32_arm_stub_hash_entry *) gen_entry;
+- htab = (struct elf32_arm_link_hash_table *) in_arg;
+
+ BFD_ASSERT((stub_entry->stub_type > arm_stub_none)
+ && stub_entry->stub_type < ARRAY_SIZE(stub_definitions));
+@@ -5147,7 +5140,6 @@ record_vfp11_erratum_veneer (struct bfd_
+ struct bfd_link_hash_entry *bh;
+ bfd_vma val;
+ struct _arm_elf_section_data *sec_data;
+- int errcount;
+ elf32_vfp11_erratum_list *newerr;
+
+ hash_table = elf32_arm_hash_table (link_info);
+@@ -5186,7 +5178,7 @@ record_vfp11_erratum_veneer (struct bfd_
+ myh->forced_local = 1;
+
+ /* Link veneer back to calling location. */
+- errcount = ++(sec_data->erratumcount);
++ sec_data->erratumcount += 1;
+ newerr = bfd_zmalloc (sizeof (elf32_vfp11_erratum_list));
+
+ newerr->type = VFP11_ERRATUM_ARM_VENEER;
+@@ -6035,9 +6027,8 @@ bfd_elf32_arm_vfp11_erratum_scan (bfd *a
+ {
+ elf32_vfp11_erratum_list *newerr
+ = bfd_zmalloc (sizeof (elf32_vfp11_erratum_list));
+- int errcount;
+
+- errcount = ++(elf32_arm_section_data (sec)->erratumcount);
++ elf32_arm_section_data (sec)->erratumcount += 1;
+
+ newerr->u.b.vfp_insn = veneer_of_insn;
+
+@@ -6747,8 +6738,6 @@ elf32_arm_final_link_relocate (reloc_how
+ unsigned long r_symndx;
+ bfd_byte * hit_data = contents + rel->r_offset;
+ bfd * dynobj = NULL;
+- Elf_Internal_Shdr * symtab_hdr;
+- struct elf_link_hash_entry ** sym_hashes;
+ bfd_vma * local_got_offsets;
+ asection * sgot = NULL;
+ asection * splt = NULL;
+@@ -6785,8 +6774,6 @@ elf32_arm_final_link_relocate (reloc_how
+ sgot = bfd_get_section_by_name (dynobj, ".got");
+ splt = bfd_get_section_by_name (dynobj, ".plt");
+ }
+- symtab_hdr = & elf_symtab_hdr (input_bfd);
+- sym_hashes = elf_sym_hashes (input_bfd);
+ local_got_offsets = elf_local_got_offsets (input_bfd);
+ r_symndx = ELF32_R_SYM (rel->r_info);
+
+@@ -8886,7 +8873,7 @@ elf32_arm_relocate_section (bfd *
+ }
+ else
+ {
+- bfd_boolean warned;
++ bfd_boolean warned __attribute__((unused));
+
+ RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
+ r_symndx, symtab_hdr, sym_hashes,
+@@ -10740,7 +10727,6 @@ elf32_arm_check_relocs (bfd *abfd, struc
+ const Elf_Internal_Rela *rel_end;
+ bfd *dynobj;
+ asection *sreloc;
+- bfd_vma *local_got_offsets;
+ struct elf32_arm_link_hash_table *htab;
+ bfd_boolean needs_plt;
+ unsigned long nsyms;
+@@ -10763,7 +10749,6 @@ elf32_arm_check_relocs (bfd *abfd, struc
+ }
+
+ dynobj = elf_hash_table (info)->dynobj;
+- local_got_offsets = elf_local_got_offsets (abfd);
+
+ symtab_hdr = & elf_symtab_hdr (abfd);
+ sym_hashes = elf_sym_hashes (abfd);
+@@ -12864,10 +12849,8 @@ elf32_arm_output_map_sym (output_arch_sy
+ bfd_vma offset)
+ {
+ static const char *names[3] = {"$a", "$t", "$d"};
+- struct elf32_arm_link_hash_table *htab;
+ Elf_Internal_Sym sym;
+
+- htab = elf32_arm_hash_table (osi->info);
+ sym.st_value = osi->sec->output_section->vma
+ + osi->sec->output_offset
+ + offset;
+@@ -12962,10 +12945,8 @@ static bfd_boolean
+ elf32_arm_output_stub_sym (output_arch_syminfo *osi, const char *name,
+ bfd_vma offset, bfd_vma size)
+ {
+- struct elf32_arm_link_hash_table *htab;
+ Elf_Internal_Sym sym;
+
+- htab = elf32_arm_hash_table (osi->info);
+ sym.st_value = osi->sec->output_section->vma
+ + osi->sec->output_offset
+ + offset;
+@@ -12982,7 +12963,6 @@ arm_map_one_stub (struct bfd_hash_entry
+ {
+ struct elf32_arm_stub_hash_entry *stub_entry;
+ struct bfd_link_info *info;
+- struct elf32_arm_link_hash_table *htab;
+ asection *stub_sec;
+ bfd_vma addr;
+ char *stub_name;
+@@ -12999,7 +12979,6 @@ arm_map_one_stub (struct bfd_hash_entry
+
+ info = osi->info;
+
+- htab = elf32_arm_hash_table (info);
+ stub_sec = stub_entry->stub_sec;
+
+ /* Ensure this stub is attached to the current section being

View File

@ -1,35 +0,0 @@
--- crash-5.1.8/gdb-7.0.patch.orig
+++ crash-5.1.8/gdb-7.0.patch
@@ -1986,3 +1986,32 @@
stub_sec = stub_entry->stub_sec;
/* Ensure this stub is attached to the current section being
+--- gdb-7.0/bfd/elf32-arm.c.orig
++++ gdb-7.0/bfd/elf32-arm.c
+@@ -12962,7 +12962,6 @@ arm_map_one_stub (struct bfd_hash_entry
+ void * in_arg)
+ {
+ struct elf32_arm_stub_hash_entry *stub_entry;
+- struct bfd_link_info *info;
+ asection *stub_sec;
+ bfd_vma addr;
+ char *stub_name;
+@@ -12977,8 +12976,6 @@ arm_map_one_stub (struct bfd_hash_entry
+ stub_entry = (struct elf32_arm_stub_hash_entry *) gen_entry;
+ osi = (output_arch_syminfo *) in_arg;
+
+- info = osi->info;
+-
+ stub_sec = stub_entry->stub_sec;
+
+ /* Ensure this stub is attached to the current section being
+--- gdb-7.0/bfd/cpu-arm.c.orig
++++ gdb-7.0/bfd/cpu-arm.c
+@@ -262,6 +262,7 @@ arm_check_note (bfd *abfd,
+ }
+
+ /* FIXME: We should probably check the type as well. */
++ (void) type;
+
+ if (description_return != NULL)
+ * description_return = descr;

View File

@ -1,203 +0,0 @@
commit 4809b16f7e629929a10ab8b15816b4f6f775aa82
Author: Jim Blandy <jimb@codesourcery.com>
Date: Thu Dec 13 19:02:51 2007 +0000
commit 35fb264aa9a28b8d117df1e5a19fa3bfaf5a2cc8
Author: Jim Blandy <jimb@codesourcery.com>
Date: Mon Dec 17 18:38:30 2007 +0000
Cherry-picked and backported these, since gdb would crash reading dwarf 3
DW_AT_data_member_location that gcc generates now.
-- Lubomir Rintel <lkundrak@v3.sk>
diff -urp gdb-6.1.orig/gdb/ChangeLog gdb-6.1/gdb/ChangeLog
--- gdb-6.1.orig/gdb/ChangeLog 2009-08-08 17:04:24.836969960 +0200
+++ gdb-6.1/gdb/ChangeLog 2009-08-08 17:00:21.682970174 +0200
@@ -1,3 +1,14 @@
+2007-12-13 Jim Blandy <jimb@codesourcery.com>
+
+ * dwarf2read.c (attr_form_is_constant): New function.
+ (dwarf2_add_field): Use it and attr_form_is_section_offset to
+ recognize DW_AT_data_member_location attributes. Use
+ dwarf2_get_attr_constant_value when the attribute is a constant.
+
+ * dwarf2read.c (attr_form_is_section_offset): New function.
+ (dwarf_add_member_fn, read_common_block, read_partial_die)
+ (dwarf2_symbol_mark_computed): Use it, instead of writing it out.
+
2004-04-03 GDB Administrator <gdbadmin@sourceware.org>
GDB 6.1 released.
diff -urp gdb-6.1.orig/gdb/dwarf2read.c gdb-6.1/gdb/dwarf2read.c
--- gdb-6.1.orig/gdb/dwarf2read.c 2009-06-30 17:31:20.000000000 +0200
+++ gdb-6.1/gdb/dwarf2read.c 2009-08-08 17:20:00.031969143 +0200
@@ -922,6 +922,10 @@ static void dwarf_decode_macros (struct
static int attr_form_is_block (struct attribute *);
+static int attr_form_is_section_offset (struct attribute *);
+
+static int attr_form_is_constant (struct attribute *);
+
static void
dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym,
struct dwarf2_cu *cu);
@@ -2618,8 +2622,16 @@ dwarf2_add_field (struct field_info *fip
attr = dwarf2_attr (die, DW_AT_data_member_location, cu);
if (attr)
{
- FIELD_BITPOS (*fp) =
- decode_locdesc (DW_BLOCK (attr), cu) * bits_per_byte;
+ if (attr_form_is_section_offset (attr))
+ {
+ dwarf2_complex_location_expr_complaint ();
+ FIELD_BITPOS (*fp) = 0;
+ }
+ else if (attr_form_is_constant (attr))
+ FIELD_BITPOS (*fp) = dwarf2_get_attr_constant_value (attr, 0);
+ else
+ FIELD_BITPOS (*fp) =
+ decode_locdesc (DW_BLOCK (attr), cu) * bits_per_byte;
}
else
FIELD_BITPOS (*fp) = 0;
@@ -2939,7 +2951,7 @@ dwarf2_add_member_fn (struct field_info
{
fnp->voffset = decode_locdesc (DW_BLOCK (attr), cu) + 2;
}
- else if (attr->form == DW_FORM_data4 || attr->form == DW_FORM_data8)
+ else if (attr_form_is_section_offset (attr))
{
dwarf2_complex_location_expr_complaint ();
}
@@ -3482,7 +3494,7 @@ read_common_block (struct die_info *die,
{
base = decode_locdesc (DW_BLOCK (attr), cu);
}
- else if (attr->form == DW_FORM_data4 || attr->form == DW_FORM_data8)
+ else if (attr_form_is_section_offset (attr))
{
dwarf2_complex_location_expr_complaint ();
}
@@ -4392,7 +4404,7 @@ read_partial_die (struct partial_die_inf
{
part_die->locdesc = DW_BLOCK (&attr);
}
- else if (attr.form == DW_FORM_data4 || attr.form == DW_FORM_data8)
+ else if (attr_form_is_section_offset (&attr))
{
dwarf2_complex_location_expr_complaint ();
}
@@ -8030,11 +8042,51 @@ attr_form_is_block (struct attribute *at
|| attr->form == DW_FORM_block);
}
+/* Return non-zero if ATTR's value is a section offset (classes
+ lineptr, loclistptr, macptr or rangelistptr). In this case,
+ you may use DW_UNSND (attr) to retrieve the offset. */
+static int
+attr_form_is_section_offset (struct attribute *attr)
+{
+ return (attr->form == DW_FORM_data4
+ || attr->form == DW_FORM_data8);
+}
+
+
+/* Return non-zero if ATTR's value falls in the 'constant' class, or
+ zero otherwise. When this function returns true, you can apply
+ dwarf2_get_attr_constant_value to it.
+
+ However, note that for some attributes you must check
+ attr_form_is_section_offset before using this test. DW_FORM_data4
+ and DW_FORM_data8 are members of both the constant class, and of
+ the classes that contain offsets into other debug sections
+ (lineptr, loclistptr, macptr or rangelistptr). The DWARF spec says
+ that, if an attribute's can be either a constant or one of the
+ section offset classes, DW_FORM_data4 and DW_FORM_data8 should be
+ taken as section offsets, not constants. */
+static int
+attr_form_is_constant (struct attribute *attr)
+{
+ switch (attr->form)
+ {
+ case DW_FORM_sdata:
+ case DW_FORM_udata:
+ case DW_FORM_data1:
+ case DW_FORM_data2:
+ case DW_FORM_data4:
+ case DW_FORM_data8:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
static void
dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym,
struct dwarf2_cu *cu)
{
- if (attr->form == DW_FORM_data4 || attr->form == DW_FORM_data8)
+ if (attr_form_is_section_offset (attr))
{
struct dwarf2_loclist_baton *baton;
diff -urp gdb-6.1.orig/gdb/ChangeLog gdb-6.1/gdb/ChangeLog
--- gdb-6.1.orig/gdb/ChangeLog 2009-08-08 20:49:34.000000000 +0200
+++ gdb-6.1/gdb/ChangeLog 2009-08-09 13:04:25.842288308 +0200
@@ -1,3 +1,11 @@
+2007-12-17 Jim Blandy <jimb@codesourcery.com>
+
+ * dwarf2read.c (dwarf2_add_field): Correctly scale all byte
+ offsets obtained from DW_AT_data_member_location before recording
+ them in FIELD_BITPOS (*fp).
+
+ * dwarf2read.c (attr_form_is_section_offset): Doc fixes.
+
2007-12-13 Jim Blandy <jimb@codesourcery.com>
* dwarf2read.c (attr_form_is_constant): New function.
diff -urp gdb-6.1.orig/gdb/dwarf2read.c gdb-6.1/gdb/dwarf2read.c
--- gdb-6.1.orig/gdb/dwarf2read.c 2009-08-08 20:49:34.000000000 +0200
+++ gdb-6.1/gdb/dwarf2read.c 2009-08-09 13:04:25.864291129 +0200
@@ -2622,16 +2622,19 @@ dwarf2_add_field (struct field_info *fip
attr = dwarf2_attr (die, DW_AT_data_member_location, cu);
if (attr)
{
+ int byte_offset;
+
if (attr_form_is_section_offset (attr))
{
dwarf2_complex_location_expr_complaint ();
- FIELD_BITPOS (*fp) = 0;
+ byte_offset = 0;
}
else if (attr_form_is_constant (attr))
- FIELD_BITPOS (*fp) = dwarf2_get_attr_constant_value (attr, 0);
+ byte_offset = dwarf2_get_attr_constant_value (attr, 0);
else
- FIELD_BITPOS (*fp) =
- decode_locdesc (DW_BLOCK (attr), cu) * bits_per_byte;
+ byte_offset = decode_locdesc (DW_BLOCK (attr), cu);
+
+ FIELD_BITPOS (*fp) = byte_offset * bits_per_byte;
}
else
FIELD_BITPOS (*fp) = 0;
@@ -8042,9 +8045,14 @@ attr_form_is_block (struct attribute *at
|| attr->form == DW_FORM_block);
}
-/* Return non-zero if ATTR's value is a section offset (classes
- lineptr, loclistptr, macptr or rangelistptr). In this case,
- you may use DW_UNSND (attr) to retrieve the offset. */
+/* Return non-zero if ATTR's value is a section offset --- classes
+ lineptr, loclistptr, macptr or rangelistptr --- or zero, otherwise.
+ You may use DW_UNSND (attr) to retrieve such offsets.
+
+ Section 7.5.4, "Attribute Encodings", explains that no attribute
+ may have a value that belongs to more than one of these classes; it
+ would be ambiguous if we did, because we use the same forms for all
+ of them. */
static int
attr_form_is_section_offset (struct attribute *attr)
{

View File

@ -1,225 +0,0 @@
Use proper compiler flags as mandated by the packaging guidelines.
Lubomir Rintel <lkundrak@v3.sk>
diff -up crash-4.0-8.11/Makefile.optflags crash-4.0-8.11/Makefile
--- crash-4.0-8.11/Makefile.optflags 2009-06-30 17:31:20.000000000 +0200
+++ crash-4.0-8.11/Makefile 2009-08-09 13:21:51.025292368 +0200
@@ -224,7 +224,7 @@ GDB_FLAGS=
# TARGET_CFLAGS will be configured automatically by configure
TARGET_CFLAGS=
-CFLAGS=-g -D${TARGET} ${TARGET_CFLAGS}
+CRASH_CFLAGS=${CFLAGS} -D${TARGET} ${TARGET_CFLAGS}
TAR_FILES=${SOURCE_FILES} Makefile COPYING README .rh_rpm_package crash.8 \
${EXTENSION_SOURCE_FILES}
@@ -287,7 +287,7 @@ clean:
@(cd extensions; make --no-print-directory -i clean)
make_build_data: force
- cc -c ${CFLAGS} build_data.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} build_data.c ${WARNING_OPTIONS} ${WARNING_ERROR}
install:
/usr/bin/install ${PROGRAM} ${INSTALLDIR}
@@ -309,150 +309,150 @@ nowarn: make_configure
@make --no-print-directory gdb_merge
main.o: ${GENERIC_HFILES} main.c
- cc -c ${CFLAGS} main.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} main.c ${WARNING_OPTIONS} ${WARNING_ERROR}
cmdline.o: ${GENERIC_HFILES} cmdline.c
- cc -c ${CFLAGS} ${GDB_FLAGS} cmdline.c -I${READLINE_DIRECTORY} ${WARNING_OPTIONS}
+ cc -c ${CRASH_CFLAGS} ${GDB_FLAGS} cmdline.c -I${READLINE_DIRECTORY} ${WARNING_OPTIONS}
tools.o: ${GENERIC_HFILES} tools.c
- cc -c ${CFLAGS} tools.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} tools.c ${WARNING_OPTIONS} ${WARNING_ERROR}
global_data.o: ${GENERIC_HFILES} global_data.c
- cc -c ${CFLAGS} global_data.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} global_data.c ${WARNING_OPTIONS} ${WARNING_ERROR}
symbols.o: ${GENERIC_HFILES} symbols.c
- cc -c ${CFLAGS} ${GDB_FLAGS} symbols.c -I${BFD_DIRECTORY} -I${GDB_INCLUDE_DIRECTORY} ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} ${GDB_FLAGS} symbols.c -I${BFD_DIRECTORY} -I${GDB_INCLUDE_DIRECTORY} ${WARNING_OPTIONS} ${WARNING_ERROR}
filesys.o: ${GENERIC_HFILES} filesys.c
- cc -c ${CFLAGS} filesys.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} filesys.c ${WARNING_OPTIONS} ${WARNING_ERROR}
help.o: ${GENERIC_HFILES} help.c
- cc -c ${CFLAGS} ${GDB_FLAGS} help.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} ${GDB_FLAGS} help.c ${WARNING_OPTIONS} ${WARNING_ERROR}
memory.o: ${GENERIC_HFILES} memory.c
- cc -c ${CFLAGS} memory.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} memory.c ${WARNING_OPTIONS} ${WARNING_ERROR}
test.o: ${GENERIC_HFILES} test.c
- cc -c ${CFLAGS} test.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} test.c ${WARNING_OPTIONS} ${WARNING_ERROR}
task.o: ${GENERIC_HFILES} task.c
- cc -c ${CFLAGS} ${GDB_FLAGS} task.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} ${GDB_FLAGS} task.c ${WARNING_OPTIONS} ${WARNING_ERROR}
kernel.o: ${GENERIC_HFILES} kernel.c
- cc -c ${CFLAGS} ${GDB_FLAGS} kernel.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} ${GDB_FLAGS} kernel.c ${WARNING_OPTIONS} ${WARNING_ERROR}
gdb_interface.o: ${GENERIC_HFILES} gdb_interface.c
- cc -c ${CFLAGS} ${GDB_FLAGS} gdb_interface.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} ${GDB_FLAGS} gdb_interface.c ${WARNING_OPTIONS} ${WARNING_ERROR}
va_server.o: ${MCORE_HFILES} va_server.c
- cc -c ${CFLAGS} va_server.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} va_server.c ${WARNING_OPTIONS} ${WARNING_ERROR}
va_server_v1.o: ${MCORE_HFILES} va_server_v1.c
- cc -c ${CFLAGS} va_server_v1.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} va_server_v1.c ${WARNING_OPTIONS} ${WARNING_ERROR}
lkcd_common.o: ${GENERIC_HFILES} ${LKCD_DUMP_HFILES} lkcd_common.c
- cc -c ${CFLAGS} lkcd_common.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} lkcd_common.c ${WARNING_OPTIONS} ${WARNING_ERROR}
lkcd_v1.o: ${GENERIC_HFILES} ${LKCD_DUMP_HFILES} lkcd_v1.c
- cc -c ${CFLAGS} -DMCLX lkcd_v1.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} -DMCLX lkcd_v1.c ${WARNING_OPTIONS} ${WARNING_ERROR}
lkcd_v2_v3.o: ${GENERIC_HFILES} ${LKCD_DUMP_HFILES} lkcd_v2_v3.c
- cc -c ${CFLAGS} -DMCLX lkcd_v2_v3.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} -DMCLX lkcd_v2_v3.c ${WARNING_OPTIONS} ${WARNING_ERROR}
lkcd_v5.o: ${GENERIC_HFILES} ${LKCD_DUMP_HFILES} lkcd_v5.c
- cc -c ${CFLAGS} -DMCLX lkcd_v5.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} -DMCLX lkcd_v5.c ${WARNING_OPTIONS} ${WARNING_ERROR}
lkcd_v7.o: ${GENERIC_HFILES} ${LKCD_DUMP_HFILES} lkcd_v7.c
- cc -c ${CFLAGS} -DMCLX lkcd_v7.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} -DMCLX lkcd_v7.c ${WARNING_OPTIONS} ${WARNING_ERROR}
lkcd_v8.o: ${GENERIC_HFILES} ${LKCD_DUMP_HFILES} lkcd_v8.c
- cc -c ${CFLAGS} -DMCLX lkcd_v8.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} -DMCLX lkcd_v8.c ${WARNING_OPTIONS} ${WARNING_ERROR}
net.o: ${GENERIC_HFILES} net.c
- cc -c ${CFLAGS} net.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} net.c ${WARNING_OPTIONS} ${WARNING_ERROR}
dev.o: ${GENERIC_HFILES} dev.c
- cc -c ${CFLAGS} dev.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} dev.c ${WARNING_OPTIONS} ${WARNING_ERROR}
# remote.c functionality has been deprecated
remote.o: ${GENERIC_HFILES} remote.c
- @cc -c ${CFLAGS} remote.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ @cc -c ${CRASH_CFLAGS} remote.c ${WARNING_OPTIONS} ${WARNING_ERROR}
remote_daemon.o: ${GENERIC_HFILES} remote.c
- cc -c ${CFLAGS} -DDAEMON remote.c -o remote_daemon.o ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} -DDAEMON remote.c -o remote_daemon.o ${WARNING_OPTIONS} ${WARNING_ERROR}
x86.o: ${GENERIC_HFILES} ${REDHAT_HFILES} x86.c
- cc -c ${CFLAGS} -DMCLX x86.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} -DMCLX x86.c ${WARNING_OPTIONS} ${WARNING_ERROR}
alpha.o: ${GENERIC_HFILES} alpha.c
- cc -c ${CFLAGS} ${GDB_FLAGS} alpha.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} ${GDB_FLAGS} alpha.c ${WARNING_OPTIONS} ${WARNING_ERROR}
ppc.o: ${GENERIC_HFILES} ppc.c
- cc -c ${CFLAGS} ppc.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} ppc.c ${WARNING_OPTIONS} ${WARNING_ERROR}
ia64.o: ${GENERIC_HFILES} ${REDHAT_HFILES} ia64.c
- cc -c ${CFLAGS} ia64.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} ia64.c ${WARNING_OPTIONS} ${WARNING_ERROR}
ppc64.o: ${GENERIC_HFILES} ppc64.c
- cc -c ${CFLAGS} ppc64.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} ppc64.c ${WARNING_OPTIONS} ${WARNING_ERROR}
x86_64.o: ${GENERIC_HFILES} ${REDHAT_HFILES} x86_64.c
- cc -c ${CFLAGS} x86_64.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} x86_64.c ${WARNING_OPTIONS} ${WARNING_ERROR}
s390.o: ${GENERIC_HFILES} ${IBM_HFILES} s390.c
- cc -c ${CFLAGS} s390.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} s390.c ${WARNING_OPTIONS} ${WARNING_ERROR}
s390x.o: ${GENERIC_HFILES} ${IBM_HFILES} s390x.c
- cc -c ${CFLAGS} s390x.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} s390x.c ${WARNING_OPTIONS} ${WARNING_ERROR}
s390dbf.o: ${GENERIC_HFILES} ${IBM_HFILES} s390dbf.c
- cc -c ${CFLAGS} s390dbf.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} s390dbf.c ${WARNING_OPTIONS} ${WARNING_ERROR}
s390_dump.o: ${GENERIC_HFILES} ${IBM_HFILES} s390_dump.c
- cc -c ${CFLAGS} s390_dump.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} s390_dump.c ${WARNING_OPTIONS} ${WARNING_ERROR}
netdump.o: ${GENERIC_HFILES} ${REDHAT_HFILES} netdump.c
- cc -c ${CFLAGS} netdump.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} netdump.c ${WARNING_OPTIONS} ${WARNING_ERROR}
netdump_daemon.o: ${GENERIC_HFILES} ${REDHAT_HFILES} netdump.c
- cc -c ${CFLAGS} -DDAEMON netdump.c -o netdump_daemon.o ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} -DDAEMON netdump.c -o netdump_daemon.o ${WARNING_OPTIONS} ${WARNING_ERROR}
diskdump.o: ${GENERIC_HFILES} ${REDHAT_HFILES} diskdump.c
- cc -c ${CFLAGS} diskdump.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} diskdump.c ${WARNING_OPTIONS} ${WARNING_ERROR}
xendump.o: ${GENERIC_HFILES} ${REDHAT_HFILES} xendump.c
- cc -c ${CFLAGS} xendump.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} xendump.c ${WARNING_OPTIONS} ${WARNING_ERROR}
extensions.o: ${GENERIC_HFILES} extensions.c
- cc -c ${CFLAGS} extensions.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} extensions.c ${WARNING_OPTIONS} ${WARNING_ERROR}
lkcd_x86_trace.o: ${GENERIC_HFILES} ${LKCD_TRACE_HFILES} lkcd_x86_trace.c
- cc -c ${CFLAGS} -DREDHAT lkcd_x86_trace.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} -DREDHAT lkcd_x86_trace.c ${WARNING_OPTIONS} ${WARNING_ERROR}
unwind_x86_32_64.o: ${GENERIC_HFILES} ${UNWIND_HFILES} unwind_x86_32_64.c
- cc -c ${CFLAGS} unwind_x86_32_64.c -o unwind_x86_32_64.o ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} unwind_x86_32_64.c -o unwind_x86_32_64.o ${WARNING_OPTIONS} ${WARNING_ERROR}
unwind_v1.o: ${GENERIC_HFILES} ${UNWIND_HFILES} unwind.c unwind_decoder.c
- cc -c ${CFLAGS} -DREDHAT -DUNWIND_V1 unwind.c -o unwind_v1.o ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} -DREDHAT -DUNWIND_V1 unwind.c -o unwind_v1.o ${WARNING_OPTIONS} ${WARNING_ERROR}
unwind_v2.o: ${GENERIC_HFILES} ${UNWIND_HFILES} unwind.c unwind_decoder.c
- cc -c ${CFLAGS} -DREDHAT -DUNWIND_V2 unwind.c -o unwind_v2.o ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} -DREDHAT -DUNWIND_V2 unwind.c -o unwind_v2.o ${WARNING_OPTIONS} ${WARNING_ERROR}
unwind_v3.o: ${GENERIC_HFILES} ${UNWIND_HFILES} unwind.c unwind_decoder.c
- cc -c ${CFLAGS} -DREDHAT -DUNWIND_V3 unwind.c -o unwind_v3.o ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} -DREDHAT -DUNWIND_V3 unwind.c -o unwind_v3.o ${WARNING_OPTIONS} ${WARNING_ERROR}
lkcd_fix_mem.o: ${GENERIC_HFILES} ${LKCD_HFILES} lkcd_fix_mem.c
- cc -c ${CFLAGS} -DMCLX lkcd_fix_mem.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} -DMCLX lkcd_fix_mem.c ${WARNING_OPTIONS} ${WARNING_ERROR}
xen_hyper.o: ${GENERIC_HFILES} xen_hyper.c
- cc -c ${CFLAGS} xen_hyper.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} xen_hyper.c ${WARNING_OPTIONS} ${WARNING_ERROR}
xen_hyper_command.o: ${GENERIC_HFILES} xen_hyper_command.c
- cc -c ${CFLAGS} xen_hyper_command.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} xen_hyper_command.c ${WARNING_OPTIONS} ${WARNING_ERROR}
xen_hyper_global_data.o: ${GENERIC_HFILES} xen_hyper_global_data.c
- cc -c ${CFLAGS} xen_hyper_global_data.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} xen_hyper_global_data.c ${WARNING_OPTIONS} ${WARNING_ERROR}
xen_hyper_dump_tables.o: ${GENERIC_HFILES} xen_hyper_dump_tables.c
- cc -c ${CFLAGS} xen_hyper_dump_tables.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+ cc -c ${CRASH_CFLAGS} xen_hyper_dump_tables.c ${WARNING_OPTIONS} ${WARNING_ERROR}
${PROGRAM}: force
@make --no-print-directory all

View File

@ -1,17 +0,0 @@
--- a/gdb-10.2.patch
+++ b/gdb-10.2.patch
@@ -2078,3 +2078,14 @@ exit 0
return new_type;
}
+--- gdb-10.2/gnulib/import/libc-config.h.orig
++++ gdb-10.2/gnulib/import/libc-config.h
+@@ -156,7 +156,7 @@
+ #undef __warndecl
+
+ /* Include our copy of glibc <sys/cdefs.h>. */
+-#include <cdefs.h>
++#include <sys/cdefs.h>
+
+ /* <cdefs.h> __inline is too pessimistic for non-GCC. */
+ #undef __inline

81032
crash.patch

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@
Summary: Kernel analysis utility for live systems, netdump, diskdump, kdump, LKCD or mcore dumpfiles Summary: Kernel analysis utility for live systems, netdump, diskdump, kdump, LKCD or mcore dumpfiles
Name: crash Name: crash
Version: 8.0.5 Version: 8.0.5
Release: 1%{?dist} Release: 2%{?dist}
License: GPL-3.0-only License: GPL-3.0-only
Source0: https://github.com/crash-utility/crash/archive/crash-%{version}.tar.gz Source0: https://github.com/crash-utility/crash/archive/crash-%{version}.tar.gz
Source1: http://ftp.gnu.org/gnu/gdb/gdb-10.2.tar.gz Source1: http://ftp.gnu.org/gnu/gdb/gdb-10.2.tar.gz
@ -19,6 +19,15 @@ Provides: bundled(libiberty)
Provides: bundled(gdb) = 10.2 Provides: bundled(gdb) = 10.2
Patch0: lzo_snappy_zstd.patch Patch0: lzo_snappy_zstd.patch
Patch1: crash-8.0.5_build.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
%description %description
The core analysis suite is a self-contained tool that can be used to The core analysis suite is a self-contained tool that can be used to
@ -40,6 +49,15 @@ offered by Mission Critical Linux, or the LKCD kernel patch.
%setup -n %{name}-%{version} -q %setup -n %{name}-%{version} -q
%patch -P 0 -p1 -b lzo_snappy_zstd.patch %patch -P 0 -p1 -b lzo_snappy_zstd.patch
%patch -P 1 -p1 %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
%build %build
@ -65,6 +83,9 @@ cp -p defs.h %{buildroot}%{_includedir}/crash
%{_includedir}/* %{_includedir}/*
%changelog %changelog
* 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 * Thu May 16 2024 Lianbo Jiang <lijiang@redhat.com> - 8.0.5-1
- Rebase to upstream crash 8.0.5 - Rebase to upstream crash 8.0.5

View File

@ -1,65 +0,0 @@
--- crash-7.0.5/kernel.c.orig
+++ crash-7.0.5/kernel.c
@@ -8980,6 +8980,12 @@ get_log_from_vmcoreinfo(char *file, char
fprintf(fp, "OFFSET(log.ts_nsec): %ld\n",
vmc->log_ts_nsec_OFFSET);
free(string);
+ } else if ((string = vmcoreinfo_read_string("OFFSET(printk_log.ts_nsec)"))) {
+ vmc->log_ts_nsec_OFFSET = dtol(string, RETURN_ON_ERROR, NULL);
+ if (CRASHDEBUG(1))
+ fprintf(fp, "OFFSET(printk_log.ts_nsec): %ld\n",
+ vmc->log_ts_nsec_OFFSET);
+ free(string);
}
if ((string = vmcoreinfo_read_string("OFFSET(log.len)"))) {
vmc->log_len_OFFSET = dtol(string, RETURN_ON_ERROR, NULL);
@@ -8987,6 +8993,12 @@ get_log_from_vmcoreinfo(char *file, char
fprintf(fp, "OFFSET(log.len): %ld\n",
vmc->log_len_OFFSET);
free(string);
+ } else if ((string = vmcoreinfo_read_string("OFFSET(printk_log.len)"))) {
+ vmc->log_len_OFFSET = dtol(string, RETURN_ON_ERROR, NULL);
+ if (CRASHDEBUG(1))
+ fprintf(fp, "OFFSET(printk_log.len): %ld\n",
+ vmc->log_len_OFFSET);
+ free(string);
}
if ((string = vmcoreinfo_read_string("OFFSET(log.text_len)"))) {
vmc->log_text_len_OFFSET = dtol(string, RETURN_ON_ERROR, NULL);
@@ -8994,6 +9006,12 @@ get_log_from_vmcoreinfo(char *file, char
fprintf(fp, "OFFSET(log.text_len): %ld\n",
vmc->log_text_len_OFFSET);
free(string);
+ } else if ((string = vmcoreinfo_read_string("OFFSET(printk_log.text_len)"))) {
+ vmc->log_text_len_OFFSET = dtol(string, RETURN_ON_ERROR, NULL);
+ if (CRASHDEBUG(1))
+ fprintf(fp, "OFFSET(printk_log.text_len): %ld\n",
+ vmc->log_text_len_OFFSET);
+ free(string);
}
if ((string = vmcoreinfo_read_string("OFFSET(log.dict_len)"))) {
vmc->log_dict_len_OFFSET = dtol(string, RETURN_ON_ERROR, NULL);
@@ -9001,12 +9019,23 @@ get_log_from_vmcoreinfo(char *file, char
fprintf(fp, "OFFSET(log.dict_len): %ld\n",
vmc->log_dict_len_OFFSET);
free(string);
+ } else if ((string = vmcoreinfo_read_string("OFFSET(printk_log.dict_len)"))) {
+ vmc->log_dict_len_OFFSET = dtol(string, RETURN_ON_ERROR, NULL);
+ if (CRASHDEBUG(1))
+ fprintf(fp, "OFFSET(printk_log.dict_len): %ld\n",
+ vmc->log_dict_len_OFFSET);
+ free(string);
}
if ((string = vmcoreinfo_read_string("SIZE(log)"))) {
vmc->log_SIZE = dtol(string, RETURN_ON_ERROR, NULL);
if (CRASHDEBUG(1))
fprintf(fp, "SIZE(log): %ld\n", vmc->log_SIZE);
free(string);
+ } else if ((string = vmcoreinfo_read_string("SIZE(printk_log)"))) {
+ vmc->log_SIZE = dtol(string, RETURN_ON_ERROR, NULL);
+ if (CRASHDEBUG(1))
+ fprintf(fp, "SIZE(printk_log): %ld\n", vmc->log_SIZE);
+ free(string);
}
/*

View File

@ -1,34 +0,0 @@
commit 5649088bccc35f1a824e2b0c6482397b13c94abd
Author: Dave Anderson <anderson@redhat.com>
Date: Thu May 5 09:01:35 2016 -0400
Fix for a "[-Werror=misleading-indentation]" compiler warning that
is generated by gdb-7.6/bfd/elf64-s390.c when building S390X in a
Fedora Rawhide environment with gcc-6.0.0.
(anderson@redhat.com)
diff --git a/gdb-7.6.patch b/gdb-7.6.patch
index 920ea1c..794555f 100644
--- a/gdb-7.6.patch
+++ b/gdb-7.6.patch
@@ -2206,3 +2206,20 @@ diff -up gdb-7.6/bfd/elf64-ppc.c.orig gdb-7.6/bfd/elf64-ppc.c
+ gi->finished = 1;
+}
#endif
+--- gdb-7.6/bfd/elf64-s390.c.orig
++++ gdb-7.6/bfd/elf64-s390.c
+@@ -323,10 +323,10 @@ elf_s390_reloc_name_lookup (bfd *abfd AT
+ && strcasecmp (elf_howto_table[i].name, r_name) == 0)
+ return &elf_howto_table[i];
+
+- if (strcasecmp (elf64_s390_vtinherit_howto.name, r_name) == 0)
+- return &elf64_s390_vtinherit_howto;
+- if (strcasecmp (elf64_s390_vtentry_howto.name, r_name) == 0)
+- return &elf64_s390_vtentry_howto;
++ if (strcasecmp (elf64_s390_vtinherit_howto.name, r_name) == 0)
++ return &elf64_s390_vtinherit_howto;
++ if (strcasecmp (elf64_s390_vtentry_howto.name, r_name) == 0)
++ return &elf64_s390_vtentry_howto;
+
+ return NULL;
+ }

View File

@ -1,241 +0,0 @@
--- crash-5.1.2/gdb-7.0.patch.orig
+++ crash-5.1.2/gdb-7.0.patch
@@ -1316,3 +1316,238 @@
if (! verilog_write_record (abfd,
location,
+--- gdb-7.0/bfd/elf64-x86-64.c.orig
++++ gdb-7.0/bfd/elf64-x86-64.c
+@@ -2628,7 +2628,7 @@ elf64_x86_64_relocate_section (bfd *outp
+ }
+ else
+ {
+- bfd_boolean warned;
++ bfd_boolean warned ATTRIBUTE_UNUSED;
+
+ RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
+ r_symndx, symtab_hdr, sym_hashes,
+@@ -3284,10 +3284,9 @@ elf64_x86_64_relocate_section (bfd *outp
+ movl $x@tpoff, %rax
+ */
+
+- unsigned int val, type, type2;
++ unsigned int val, type;
+
+ type = bfd_get_8 (input_bfd, contents + roff - 3);
+- type2 = bfd_get_8 (input_bfd, contents + roff - 2);
+ val = bfd_get_8 (input_bfd, contents + roff - 1);
+ bfd_put_8 (output_bfd, 0x48 | ((type >> 2) & 1),
+ contents + roff - 3);
+@@ -3532,12 +3531,6 @@ elf64_x86_64_relocate_section (bfd *outp
+ movq x@gottpoff(%rip), %rax # before xchg %ax,%ax
+ */
+
+- unsigned int val, type, type2;
+-
+- type = bfd_get_8 (input_bfd, contents + roff - 3);
+- type2 = bfd_get_8 (input_bfd, contents + roff - 2);
+- val = bfd_get_8 (input_bfd, contents + roff - 1);
+-
+ /* Now modify the instruction as appropriate. To
+ turn a leaq into a movq in the form we use it, it
+ suffices to change the second byte from 0x8d to
+@@ -3563,10 +3556,6 @@ elf64_x86_64_relocate_section (bfd *outp
+ Change it to:
+ xchg %ax,%ax. */
+
+- unsigned int val, type;
+-
+- type = bfd_get_8 (input_bfd, contents + roff);
+- val = bfd_get_8 (input_bfd, contents + roff + 1);
+ bfd_put_8 (output_bfd, 0x66, contents + roff);
+ bfd_put_8 (output_bfd, 0x90, contents + roff + 1);
+ continue;
+--- gdb-7.0/bfd/elf.c.orig
++++ gdb-7.0/bfd/elf.c
+@@ -4832,7 +4832,6 @@ static bfd_boolean
+ prep_headers (bfd *abfd)
+ {
+ Elf_Internal_Ehdr *i_ehdrp; /* Elf file header, internal form */
+- Elf_Internal_Phdr *i_phdrp = 0; /* Program header table, internal form */
+ struct elf_strtab_hash *shstrtab;
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+
+@@ -4900,7 +4899,6 @@ prep_headers (bfd *abfd)
+ else
+ {
+ i_ehdrp->e_phentsize = 0;
+- i_phdrp = 0;
+ i_ehdrp->e_phoff = 0;
+ }
+
+@@ -4948,7 +4946,6 @@ bfd_boolean
+ _bfd_elf_write_object_contents (bfd *abfd)
+ {
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+- Elf_Internal_Ehdr *i_ehdrp;
+ Elf_Internal_Shdr **i_shdrp;
+ bfd_boolean failed;
+ unsigned int count, num_sec;
+@@ -4958,7 +4955,6 @@ _bfd_elf_write_object_contents (bfd *abf
+ return FALSE;
+
+ i_shdrp = elf_elfsections (abfd);
+- i_ehdrp = elf_elfheader (abfd);
+
+ failed = FALSE;
+ bfd_map_over_sections (abfd, bed->s->write_relocs, &failed);
+--- gdb-7.0/bfd/elf-eh-frame.c.orig
++++ gdb-7.0/bfd/elf-eh-frame.c
+@@ -1241,8 +1241,6 @@ _bfd_elf_eh_frame_section_offset (bfd *o
+ bfd_vma offset)
+ {
+ struct eh_frame_sec_info *sec_info;
+- struct elf_link_hash_table *htab;
+- struct eh_frame_hdr_info *hdr_info;
+ unsigned int lo, hi, mid;
+
+ if (sec->sec_info_type != ELF_INFO_TYPE_EH_FRAME)
+@@ -1252,9 +1250,6 @@ _bfd_elf_eh_frame_section_offset (bfd *o
+ if (offset >= sec->rawsize)
+ return offset - sec->rawsize + sec->size;
+
+- htab = elf_hash_table (info);
+- hdr_info = &htab->eh_info;
+-
+ lo = 0;
+ hi = sec_info->count;
+ mid = 0;
+--- gdb-7.0/bfd/elf-eh-frame.c.orig
++++ gdb-7.0/bfd/elf-eh-frame.c
+@@ -1236,7 +1236,7 @@ _bfd_elf_maybe_strip_eh_frame_hdr (struc
+
+ bfd_vma
+ _bfd_elf_eh_frame_section_offset (bfd *output_bfd ATTRIBUTE_UNUSED,
+- struct bfd_link_info *info,
++ struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ asection *sec,
+ bfd_vma offset)
+ {
+--- gdb-7.0/bfd/elf32-i386.c.orig
++++ gdb-7.0/bfd/elf32-i386.c
+@@ -2909,7 +2909,7 @@ elf_i386_relocate_section (bfd *output_b
+ }
+ else
+ {
+- bfd_boolean warned;
++ bfd_boolean warned ATTRIBUTE_UNUSED;
+
+ RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
+ r_symndx, symtab_hdr, sym_hashes,
+--- gdb-7.0/bfd/aoutx.h.orig
++++ gdb-7.0/bfd/aoutx.h
+@@ -5233,8 +5233,6 @@ aout_link_write_symbols (struct aout_fin
+ static bfd_boolean
+ aout_link_input_bfd (struct aout_final_link_info *finfo, bfd *input_bfd)
+ {
+- bfd_size_type sym_count;
+-
+ BFD_ASSERT (bfd_get_format (input_bfd) == bfd_object);
+
+ /* If this is a dynamic object, it may need special handling. */
+@@ -5248,8 +5246,6 @@ aout_link_input_bfd (struct aout_final_l
+ if (! aout_get_external_symbols (input_bfd))
+ return FALSE;
+
+- sym_count = obj_aout_external_sym_count (input_bfd);
+-
+ /* Write out the symbols and get a map of the new indices. The map
+ is placed into finfo->symbol_map. */
+ if (! aout_link_write_symbols (finfo, input_bfd))
+--- gdb-7.0/bfd/peXXigen.c.orig
++++ gdb-7.0/bfd/peXXigen.c
+@@ -1919,7 +1919,6 @@ pe_print_reloc (bfd * abfd, void * vfile
+ FILE *file = (FILE *) vfile;
+ bfd_byte *data = 0;
+ asection *section = bfd_get_section_by_name (abfd, ".reloc");
+- bfd_size_type datasize;
+ bfd_size_type i;
+ bfd_size_type start, stop;
+
+@@ -1932,7 +1931,6 @@ pe_print_reloc (bfd * abfd, void * vfile
+ fprintf (file,
+ _("\n\nPE File Base Relocations (interpreted .reloc section contents)\n"));
+
+- datasize = section->size;
+ if (! bfd_malloc_and_get_section (abfd, section, &data))
+ {
+ if (data != NULL)
+--- gdb-7.0/bfd/archive64.c.orig
++++ gdb-7.0/bfd/archive64.c
+@@ -43,7 +43,6 @@ bfd_elf64_archive_slurp_armap (bfd *abfd
+ {
+ struct artdata *ardata = bfd_ardata (abfd);
+ char nextname[17];
+- file_ptr arhdrpos;
+ bfd_size_type i, parsed_size, nsymz, stringsize, carsym_size, ptrsize;
+ struct areltdata *mapdata;
+ bfd_byte int_buf[8];
+@@ -55,7 +54,6 @@ bfd_elf64_archive_slurp_armap (bfd *abfd
+ ardata->symdefs = NULL;
+
+ /* Get the name of the first element. */
+- arhdrpos = bfd_tell (abfd);
+ i = bfd_bread (nextname, 16, abfd);
+ if (i == 0)
+ return TRUE;
+--- gdb-7.0/opcodes/i386-dis.c.orig
++++ gdb-7.0/opcodes/i386-dis.c
+@@ -9410,7 +9410,6 @@ print_insn (bfd_vma pc, disassemble_info
+ int sizeflag;
+ const char *p;
+ struct dis_private priv;
+- unsigned char op;
+ char prefix_obuf[32];
+ char *prefix_obufp;
+
+@@ -9607,8 +9606,6 @@ print_insn (bfd_vma pc, disassemble_info
+ return 1;
+ }
+
+- op = 0;
+-
+ if (*codep == 0x0f)
+ {
+ unsigned char threebyte;
+@@ -11595,7 +11592,6 @@ static void
+ OP_sI (int bytemode, int sizeflag)
+ {
+ bfd_signed_vma op;
+- bfd_signed_vma mask = -1;
+
+ switch (bytemode)
+ {
+@@ -11604,7 +11600,6 @@ OP_sI (int bytemode, int sizeflag)
+ op = *codep++;
+ if ((op & 0x80) != 0)
+ op -= 0x100;
+- mask = 0xffffffff;
+ break;
+ case v_mode:
+ USED_REX (REX_W);
+@@ -11613,11 +11608,9 @@ OP_sI (int bytemode, int sizeflag)
+ else if (sizeflag & DFLAG)
+ {
+ op = get32s ();
+- mask = 0xffffffff;
+ }
+ else
+ {
+- mask = 0xffffffff;
+ op = get16 ();
+ if ((op & 0x8000) != 0)
+ op -= 0x10000;
+@@ -11626,7 +11619,6 @@ OP_sI (int bytemode, int sizeflag)
+ break;
+ case w_mode:
+ op = get16 ();
+- mask = 0xffffffff;
+ if ((op & 0x8000) != 0)
+ op -= 0x10000;
+ break;

View File

@ -1,61 +0,0 @@
--- crash-7.1.6/gdb-7.6.patch.orig
+++ crash-7.1.6/gdb-7.6.patch
@@ -2299,3 +2299,58 @@ diff -up gdb-7.6/bfd/elf64-ppc.c.orig gd
do_cleanups (old_chain);
}
+--- gdb-7.6/gdb/gdb_proc_service.h.orig
++++ gdb-7.6/gdb/gdb_proc_service.h
+@@ -115,7 +115,7 @@ extern pid_t ps_getpid (struct ps_procha
+ /* Fetch the special per-thread address associated with the given LWP.
+ This call is only used on a few platforms (most use a normal register).
+ The meaning of the `int' parameter is machine-dependent. */
+-extern ps_err_e ps_get_thread_area (const struct ps_prochandle *,
++extern ps_err_e ps_get_thread_area (struct ps_prochandle *,
+ lwpid_t, int, psaddr_t *);
+
+
+--- gdb-7.6/gdb/amd64-linux-nat.c.orig
++++ gdb-7.6/gdb/amd64-linux-nat.c
+@@ -493,7 +493,7 @@ amd64_linux_new_fork (struct lwp_info *p
+ a request for a thread's local storage address. */
+
+ ps_err_e
+-ps_get_thread_area (const struct ps_prochandle *ph,
++ps_get_thread_area (struct ps_prochandle *ph,
+ lwpid_t lwpid, int idx, void **base)
+ {
+ if (gdbarch_bfd_arch_info (target_gdbarch ())->bits_per_word == 32)
+--- gdb-7.6/gdb/aarch64-linux-nat.c.orig
++++ gdb-7.6/gdb/aarch64-linux-nat.c
+@@ -750,7 +750,7 @@ aarch64_linux_new_fork (struct lwp_info
+ storage (or its descriptor). */
+
+ ps_err_e
+-ps_get_thread_area (const struct ps_prochandle *ph,
++ps_get_thread_area (struct ps_prochandle *ph,
+ lwpid_t lwpid, int idx, void **base)
+ {
+ struct iovec iovec;
+--- gdb-7.6/gdb/arm-linux-nat.c.orig
++++ gdb-7.6/gdb/arm-linux-nat.c
+@@ -613,7 +613,7 @@ supply_fpregset (struct regcache *regcac
+ /* Fetch the thread-local storage pointer for libthread_db. */
+
+ ps_err_e
+-ps_get_thread_area (const struct ps_prochandle *ph,
++ps_get_thread_area (struct ps_prochandle *ph,
+ lwpid_t lwpid, int idx, void **base)
+ {
+ if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
+--- gdb-7.6/gdb/i386-linux-nat.c.orig
++++ gdb-7.6/gdb/i386-linux-nat.c
+@@ -849,7 +849,7 @@ i386_linux_new_fork (struct lwp_info *pa
+ storage (or its descriptor). */
+
+ ps_err_e
+-ps_get_thread_area (const struct ps_prochandle *ph,
++ps_get_thread_area (struct ps_prochandle *ph,
+ lwpid_t lwpid, int idx, void **base)
+ {
+ /* NOTE: cagney/2003-08-26: The definition of this buffer is found

View File

@ -1,61 +0,0 @@
--- crash-7.1.8/gdb-7.6.patch.orig
+++ crash-7.1.8/gdb-7.6.patch
@@ -2323,3 +2323,58 @@ diff -up gdb-7.6/opcodes/configure.orig
NO_WERROR="-Wno-error"
fi
+--- gdb-7.6/gdb/gdb_proc_service.h.orig
++++ gdb-7.6/gdb/gdb_proc_service.h
+@@ -115,7 +115,7 @@ extern pid_t ps_getpid (struct ps_procha
+ /* Fetch the special per-thread address associated with the given LWP.
+ This call is only used on a few platforms (most use a normal register).
+ The meaning of the `int' parameter is machine-dependent. */
+-extern ps_err_e ps_get_thread_area (const struct ps_prochandle *,
++extern ps_err_e ps_get_thread_area (struct ps_prochandle *,
+ lwpid_t, int, psaddr_t *);
+
+
+--- gdb-7.6/gdb/amd64-linux-nat.c.orig
++++ gdb-7.6/gdb/amd64-linux-nat.c
+@@ -493,7 +493,7 @@ amd64_linux_new_fork (struct lwp_info *p
+ a request for a thread's local storage address. */
+
+ ps_err_e
+-ps_get_thread_area (const struct ps_prochandle *ph,
++ps_get_thread_area (struct ps_prochandle *ph,
+ lwpid_t lwpid, int idx, void **base)
+ {
+ if (gdbarch_bfd_arch_info (target_gdbarch ())->bits_per_word == 32)
+--- gdb-7.6/gdb/aarch64-linux-nat.c.orig
++++ gdb-7.6/gdb/aarch64-linux-nat.c
+@@ -750,7 +750,7 @@ aarch64_linux_new_fork (struct lwp_info
+ storage (or its descriptor). */
+
+ ps_err_e
+-ps_get_thread_area (const struct ps_prochandle *ph,
++ps_get_thread_area (struct ps_prochandle *ph,
+ lwpid_t lwpid, int idx, void **base)
+ {
+ struct iovec iovec;
+--- gdb-7.6/gdb/arm-linux-nat.c.orig
++++ gdb-7.6/gdb/arm-linux-nat.c
+@@ -613,7 +613,7 @@ supply_fpregset (struct regcache *regcac
+ /* Fetch the thread-local storage pointer for libthread_db. */
+
+ ps_err_e
+-ps_get_thread_area (const struct ps_prochandle *ph,
++ps_get_thread_area (struct ps_prochandle *ph,
+ lwpid_t lwpid, int idx, void **base)
+ {
+ if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
+--- gdb-7.6/gdb/i386-linux-nat.c.orig
++++ gdb-7.6/gdb/i386-linux-nat.c
+@@ -849,7 +849,7 @@ i386_linux_new_fork (struct lwp_info *pa
+ storage (or its descriptor). */
+
+ ps_err_e
+-ps_get_thread_area (const struct ps_prochandle *ph,
++ps_get_thread_area (struct ps_prochandle *ph,
+ lwpid_t lwpid, int idx, void **base)
+ {
+ /* NOTE: cagney/2003-08-26: The definition of this buffer is found

View File

@ -1,32 +0,0 @@
commit db07dbf5a7e19806b1629bd4125e6643978c6f9f
Author: Dave Anderson <anderson@redhat.com>
Date: Thu Feb 19 16:16:33 2015 -0500
Prepare for the future increment of Linux 3.x to 4.x.
(anderson@redhat.com)
diff --git a/kernel.c b/kernel.c
index cf858c2..a5e0c64 100644
--- a/kernel.c
+++ b/kernel.c
@@ -1211,7 +1211,8 @@ verify_namelist()
sprintf(buffer3, "(unknown)");
while (fgets(buffer, BUFSIZE-1, pipe)) {
if (!strstr(buffer, "Linux version 2.") &&
- !strstr(buffer, "Linux version 3."))
+ !strstr(buffer, "Linux version 3.") &&
+ !strstr(buffer, "Linux version 4."))
continue;
if (strstr(buffer, kt->proc_version)) {
@@ -4909,7 +4910,8 @@ debug_kernel_version(char *namelist)
argc = 0;
while (fgets(buf, BUFSIZE-1, pipe)) {
if (!strstr(buf, "Linux version 2.") &&
- !strstr(buf, "Linux version 3."))
+ !strstr(buf, "Linux version 3.") &&
+ !strstr(buf, "Linux version 4."))
continue;
argc = parse_line(buf, arglist);

View File

@ -1,159 +0,0 @@
--- crash-5.1.7/gdb-7.0.patch.orig
+++ crash-5.1.7/gdb-7.0.patch
@@ -1685,3 +1685,156 @@
add_symbol_to_list (sym, &global_symbols);
}
child_die = sibling_die (child_die);
+--- gdb-7.0/bfd/elf64-ppc.c.orig
++++ gdb-7.0/bfd/elf64-ppc.c
+@@ -4764,7 +4764,7 @@ ppc64_elf_check_relocs (bfd *abfd, struc
+ {
+ struct ppc_link_hash_table *htab;
+ Elf_Internal_Shdr *symtab_hdr;
+- struct elf_link_hash_entry **sym_hashes, **sym_hashes_end;
++ struct elf_link_hash_entry **sym_hashes;
+ const Elf_Internal_Rela *rel;
+ const Elf_Internal_Rela *rel_end;
+ asection *sreloc;
+@@ -4793,10 +4793,6 @@ ppc64_elf_check_relocs (bfd *abfd, struc
+ symtab_hdr = &elf_symtab_hdr (abfd);
+
+ sym_hashes = elf_sym_hashes (abfd);
+- sym_hashes_end = (sym_hashes
+- + symtab_hdr->sh_size / sizeof (Elf64_External_Sym)
+- - symtab_hdr->sh_info);
+-
+ sreloc = NULL;
+ opd_sym_map = NULL;
+ if (strcmp (bfd_get_section_name (abfd, sec), ".opd") == 0)
+@@ -5672,6 +5668,9 @@ ppc64_elf_gc_sweep_hook (bfd *abfd, stru
+ elf_section_data (sec)->local_dynrel = NULL;
+
+ htab = ppc_hash_table (info);
++ if (htab == NULL)
++ return FALSE;
++
+ symtab_hdr = &elf_symtab_hdr (abfd);
+ sym_hashes = elf_sym_hashes (abfd);
+ local_got_ents = elf_local_got_ents (abfd);
+@@ -6790,7 +6789,6 @@ ppc64_elf_edit_opd (bfd *obfd, struct bf
+ Elf_Internal_Rela *relstart, *rel, *relend;
+ Elf_Internal_Shdr *symtab_hdr;
+ Elf_Internal_Sym *local_syms;
+- struct elf_link_hash_entry **sym_hashes;
+ bfd_vma offset;
+ struct _opd_sec_data *opd;
+ bfd_boolean need_edit, add_aux_fields;
+@@ -6812,7 +6810,6 @@ ppc64_elf_edit_opd (bfd *obfd, struct bf
+
+ local_syms = NULL;
+ symtab_hdr = &elf_symtab_hdr (ibfd);
+- sym_hashes = elf_sym_hashes (ibfd);
+
+ /* Read the relocations. */
+ relstart = _bfd_elf_link_read_relocs (ibfd, sec, NULL, NULL,
+@@ -7664,7 +7661,6 @@ ppc64_elf_edit_toc (bfd *obfd ATTRIBUTE_
+ asection *toc, *sec;
+ Elf_Internal_Shdr *symtab_hdr;
+ Elf_Internal_Sym *local_syms;
+- struct elf_link_hash_entry **sym_hashes;
+ Elf_Internal_Rela *relstart, *rel;
+ unsigned long *skip, *drop;
+ unsigned char *used;
+@@ -7679,7 +7675,6 @@ ppc64_elf_edit_toc (bfd *obfd ATTRIBUTE_
+
+ local_syms = NULL;
+ symtab_hdr = &elf_symtab_hdr (ibfd);
+- sym_hashes = elf_sym_hashes (ibfd);
+
+ /* Look at sections dropped from the final link. */
+ skip = NULL;
+--- gdb-7.0/bfd/elf32-ppc.c.orig
++++ gdb-7.0/bfd/elf32-ppc.c
+@@ -4735,7 +4735,6 @@ ppc_elf_tls_optimize (bfd *obfd ATTRIBUT
+ }
+ else
+ {
+- Elf_Internal_Sym *sym;
+ bfd_signed_vma *lgot_refs;
+ struct plt_entry **local_plt;
+ char *lgot_masks;
+@@ -4754,7 +4753,6 @@ ppc_elf_tls_optimize (bfd *obfd ATTRIBUT
+ return FALSE;
+ }
+ }
+- sym = locsyms + r_symndx;
+ lgot_refs = elf_local_got_refcounts (ibfd);
+ if (lgot_refs == NULL)
+ abort ();
+@@ -5941,7 +5939,7 @@ ppc_elf_relax_section (bfd *abfd,
+ for (irel = internal_relocs; irel < irelend; irel++)
+ {
+ unsigned long r_type = ELF32_R_TYPE (irel->r_info);
+- bfd_vma reladdr, toff, roff;
++ bfd_vma toff, roff;
+ asection *tsec;
+ struct one_fixup *f;
+ size_t insn_offset = 0;
+@@ -6125,7 +6123,6 @@ ppc_elf_relax_section (bfd *abfd,
+ continue;
+
+ roff = irel->r_offset;
+- reladdr = isec->output_section->vma + isec->output_offset + roff;
+
+ /* If the branch is in range, no need to do anything. */
+ if (tsec != bfd_und_section_ptr
+--- gdb-7.0/bfd/coffcode.h.orig
++++ gdb-7.0/bfd/coffcode.h
+@@ -3527,7 +3527,9 @@ coff_write_object_contents (bfd * abfd)
+ asection *current;
+ bfd_boolean hasrelocs = FALSE;
+ bfd_boolean haslinno = FALSE;
++#ifdef COFF_IMAGE_WITH_PE
+ bfd_boolean hasdebug = FALSE;
++#endif
+ file_ptr scn_base;
+ file_ptr reloc_base;
+ file_ptr lineno_base;
+@@ -3630,9 +3632,9 @@ coff_write_object_contents (bfd * abfd)
+ current = current->next)
+ {
+ struct internal_scnhdr section;
++#ifdef COFF_IMAGE_WITH_PE
+ bfd_boolean is_reloc_section = FALSE;
+
+-#ifdef COFF_IMAGE_WITH_PE
+ if (strcmp (current->name, DOT_RELOC) == 0)
+ {
+ is_reloc_section = TRUE;
+@@ -3731,9 +3733,11 @@ coff_write_object_contents (bfd * abfd)
+ #endif
+ if (current->lineno_count != 0)
+ haslinno = TRUE;
++#ifdef COFF_IMAGE_WITH_PE
+ if ((current->flags & SEC_DEBUGGING) != 0
+ && ! is_reloc_section)
+ hasdebug = TRUE;
++#endif
+
+ #ifdef RS6000COFF_C
+ #ifndef XCOFF64
+--- gdb-7.0/bfd/coff-rs6000.c.orig
++++ gdb-7.0/bfd/coff-rs6000.c
+@@ -3068,7 +3068,7 @@ xcoff_complain_overflow_bitfield_func (i
+ bfd_vma relocation;
+ struct reloc_howto_struct *howto;
+ {
+- bfd_vma addrmask, fieldmask, signmask, ss;
++ bfd_vma fieldmask, signmask, ss;
+ bfd_vma a, b, sum;
+
+ /* Get the values to be added together. For signed and unsigned
+@@ -3076,7 +3076,6 @@ xcoff_complain_overflow_bitfield_func (i
+ the size of an address. For bitfields, all the bits matter.
+ See also bfd_check_overflow. */
+ fieldmask = N_ONES (howto->bitsize);
+- addrmask = N_ONES (bfd_arch_bits_per_address (input_bfd)) | fieldmask;
+ a = relocation;
+ b = val & howto->src_mask;
+

View File

@ -1,169 +0,0 @@
--- crash-6.0.8/gdb-7.3.1.patch.orig
+++ crash-6.0.8/gdb-7.3.1.patch
@@ -1526,3 +1526,166 @@ diff -up gdb-7.3.1/gdb/psymtab.c.orig gd
+ return NULL;
+}
#endif
+--- gdb-7.3.1/gdb/arm-linux-nat.c.orig
++++ gdb-7.3.1/gdb/arm-linux-nat.c
+@@ -1203,7 +1203,7 @@ arm_linux_remove_watchpoint (CORE_ADDR a
+ static int
+ arm_linux_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p)
+ {
+- struct siginfo *siginfo_p = linux_nat_get_siginfo (inferior_ptid);
++ siginfo_t *siginfo_p = linux_nat_get_siginfo (inferior_ptid);
+ int slot = siginfo_p->si_errno;
+
+ /* This must be a hardware breakpoint. */
+--- gdb-7.3.1/gdb/ia64-linux-nat.c.orig
++++ gdb-7.3.1/gdb/ia64-linux-nat.c
+@@ -640,7 +640,7 @@ static int
+ ia64_linux_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p)
+ {
+ CORE_ADDR psr;
+- struct siginfo *siginfo_p;
++ siginfo_t *siginfo_p;
+ struct regcache *regcache = get_current_regcache ();
+
+ siginfo_p = linux_nat_get_siginfo (inferior_ptid);
+--- gdb-7.3.1/gdb/ppc-linux-nat.c.orig
++++ gdb-7.3.1/gdb/ppc-linux-nat.c
+@@ -2161,7 +2161,7 @@ ppc_linux_thread_exit (struct thread_inf
+ static int
+ ppc_linux_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p)
+ {
+- struct siginfo *siginfo_p;
++ siginfo_t *siginfo_p;
+
+ siginfo_p = linux_nat_get_siginfo (inferior_ptid);
+
+--- gdb-7.3.1/gdb/alpha-linux-tdep.c.orig
++++ gdb-7.3.1/gdb/alpha-linux-tdep.c
+@@ -115,7 +115,7 @@ alpha_linux_sigcontext_addr (struct fram
+ /* __NR_rt_sigreturn has a couple of structures on the stack. This is:
+
+ struct rt_sigframe {
+- struct siginfo info;
++ siginfo_t info;
+ struct ucontext uc;
+ };
+
+--- gdb-7.3.1/gdb/procfs.c.orig
++++ gdb-7.3.1/gdb/procfs.c
+@@ -263,7 +263,7 @@ typedef struct sigaction gdb_sigaction_t
+ #ifdef HAVE_PR_SIGINFO64_T
+ typedef pr_siginfo64_t gdb_siginfo_t;
+ #else
+-typedef struct siginfo gdb_siginfo_t;
++typedef siginfo_t gdb_siginfo_t;
+ #endif
+
+ /* On mips-irix, praddset and prdelset are defined in such a way that
+--- gdb-7.3.1/gdb/amd64-linux-nat.c.orig
++++ gdb-7.3.1/gdb/amd64-linux-nat.c
+@@ -695,13 +695,13 @@ siginfo_from_compat_siginfo (siginfo_t *
+ INF. */
+
+ static int
+-amd64_linux_siginfo_fixup (struct siginfo *native, gdb_byte *inf, int direction)
++amd64_linux_siginfo_fixup (siginfo_t *native, gdb_byte *inf, int direction)
+ {
+ /* Is the inferior 32-bit? If so, then do fixup the siginfo
+ object. */
+ if (gdbarch_addr_bit (get_frame_arch (get_current_frame ())) == 32)
+ {
+- gdb_assert (sizeof (struct siginfo) == sizeof (compat_siginfo_t));
++ gdb_assert (sizeof (siginfo_t) == sizeof (compat_siginfo_t));
+
+ if (direction == 0)
+ compat_siginfo_from_siginfo ((struct compat_siginfo *) inf, native);
+--- gdb-7.3.1/gdb/linux-nat.h.orig
++++ gdb-7.3.1/gdb/linux-nat.h
+@@ -60,7 +60,7 @@ struct lwp_info
+
+ /* Non-zero si_signo if this LWP stopped with a trap. si_addr may
+ be the address of a hardware watchpoint. */
+- struct siginfo siginfo;
++ siginfo_t siginfo;
+
+ /* STOPPED_BY_WATCHPOINT is non-zero if this LWP stopped with a data
+ watchpoint trap. */
+@@ -160,7 +160,7 @@ void linux_nat_set_new_thread (struct ta
+ that ptrace returns, and the layout in the architecture of the
+ inferior. */
+ void linux_nat_set_siginfo_fixup (struct target_ops *,
+- int (*) (struct siginfo *,
++ int (*) (siginfo_t *,
+ gdb_byte *,
+ int));
+
+@@ -169,7 +169,7 @@ void linux_nat_set_siginfo_fixup (struct
+ void linux_nat_switch_fork (ptid_t new_ptid);
+
+ /* Return the saved siginfo associated with PTID. */
+-struct siginfo *linux_nat_get_siginfo (ptid_t ptid);
++siginfo_t *linux_nat_get_siginfo (ptid_t ptid);
+
+ /* Compute and return the processor core of a given thread. */
+ int linux_nat_core_of_thread_1 (ptid_t ptid);
+--- gdb-7.3.1/gdb/linux-nat.c.orig
++++ gdb-7.3.1/gdb/linux-nat.c
+@@ -214,7 +214,7 @@ static void (*linux_nat_new_thread) (pti
+ /* The method to call, if any, when the siginfo object needs to be
+ converted between the layout returned by ptrace, and the layout in
+ the architecture of the inferior. */
+-static int (*linux_nat_siginfo_fixup) (struct siginfo *,
++static int (*linux_nat_siginfo_fixup) (siginfo_t *,
+ gdb_byte *,
+ int);
+
+@@ -3945,7 +3945,7 @@ linux_nat_mourn_inferior (struct target_
+ layout of the inferiors' architecture. */
+
+ static void
+-siginfo_fixup (struct siginfo *siginfo, gdb_byte *inf_siginfo, int direction)
++siginfo_fixup (siginfo_t *siginfo, gdb_byte *inf_siginfo, int direction)
+ {
+ int done = 0;
+
+@@ -3957,9 +3957,9 @@ siginfo_fixup (struct siginfo *siginfo,
+ if (!done)
+ {
+ if (direction == 1)
+- memcpy (siginfo, inf_siginfo, sizeof (struct siginfo));
++ memcpy (siginfo, inf_siginfo, sizeof (siginfo_t));
+ else
+- memcpy (inf_siginfo, siginfo, sizeof (struct siginfo));
++ memcpy (inf_siginfo, siginfo, sizeof (siginfo_t));
+ }
+ }
+
+@@ -3969,8 +3969,8 @@ linux_xfer_siginfo (struct target_ops *o
+ const gdb_byte *writebuf, ULONGEST offset, LONGEST len)
+ {
+ int pid;
+- struct siginfo siginfo;
+- gdb_byte inf_siginfo[sizeof (struct siginfo)];
++ siginfo_t siginfo;
++ gdb_byte inf_siginfo[sizeof (siginfo_t)];
+
+ gdb_assert (object == TARGET_OBJECT_SIGNAL_INFO);
+ gdb_assert (readbuf || writebuf);
+@@ -5784,7 +5784,7 @@ linux_nat_set_new_thread (struct target_
+ inferior. */
+ void
+ linux_nat_set_siginfo_fixup (struct target_ops *t,
+- int (*siginfo_fixup) (struct siginfo *,
++ int (*siginfo_fixup) (siginfo_t *,
+ gdb_byte *,
+ int))
+ {
+@@ -5793,7 +5793,7 @@ linux_nat_set_siginfo_fixup (struct targ
+ }
+
+ /* Return the saved siginfo associated with PTID. */
+-struct siginfo *
++siginfo_t *
+ linux_nat_get_siginfo (ptid_t ptid)
+ {
+ struct lwp_info *lp = find_lwp_pid (ptid);

View File

@ -1,32 +0,0 @@
--- crash-7.0.4/cmdline.c.orig
+++ crash-7.0.4/cmdline.c
@@ -42,7 +42,8 @@ static int verify_args_input_file(char *
#define READLINE_LIBRARY
#include <readline.h>
-#include <rldefs.h>
+#define vi_mode 0
+#define emacs_mode 1
#include <history.h>
static void readline_init(void);
--- crash-7.0.4/Makefile.orig
+++ crash-7.0.4/Makefile
@@ -200,7 +200,7 @@ TAR_FILES=${SOURCE_FILES} Makefile ${GPL
${EXTENSION_SOURCE_FILES} ${MEMORY_DRIVER_FILES}
CSCOPE_FILES=${SOURCE_FILES}
-READLINE_DIRECTORY=./${GDB}/readline
+READLINE_DIRECTORY=/usr/include/readline
BFD_DIRECTORY=./${GDB}/bfd
GDB_INCLUDE_DIRECTORY=./${GDB}/include
@@ -228,7 +228,7 @@ gdb_merge: force
@rm -f ${PROGRAM}
@if [ ! -f ${GDB}/config.status ]; then \
(cd ${GDB}; ./configure ${GDB_CONF_FLAGS} --with-separate-debug-dir=/usr/lib/debug \
- --with-bugurl="" --with-expat=no --with-python=no; \
+ --with-bugurl="" --with-expat=no --with-python=no --with-system-readline; \
make --no-print-directory CRASH_TARGET=${TARGET}; echo ${TARGET} > crash.target) \
else (cd ${GDB}/gdb; make --no-print-directory CRASH_TARGET=${TARGET};); fi
@if [ ! -f ${PROGRAM} ]; then \

View File

@ -1,32 +0,0 @@
--- crash-7.0.7/cmdline.c.orig
+++ crash-7.0.7/cmdline.c
@@ -42,7 +42,8 @@ static int verify_args_input_file(char *
#define READLINE_LIBRARY
#include <readline.h>
-#include <rldefs.h>
+#define vi_mode 0
+#define emacs_mode 1
#include <history.h>
static void readline_init(void);
--- crash-7.0.7/Makefile.orig
+++ crash-7.0.7/Makefile
@@ -200,7 +200,7 @@ TAR_FILES=${SOURCE_FILES} Makefile ${GPL
${EXTENSION_SOURCE_FILES} ${MEMORY_DRIVER_FILES}
CSCOPE_FILES=${SOURCE_FILES}
-READLINE_DIRECTORY=./${GDB}/readline
+READLINE_DIRECTORY=/usr/include/readline
BFD_DIRECTORY=./${GDB}/bfd
GDB_INCLUDE_DIRECTORY=./${GDB}/include
@@ -228,7 +228,7 @@ gdb_merge: force
@rm -f ${PROGRAM}
@if [ ! -f ${GDB}/config.status ]; then \
(cd ${GDB}; ./configure ${GDB_CONF_FLAGS} --with-separate-debug-dir=/usr/lib/debug \
- --with-bugurl="" --with-expat=no --with-python=no; \
+ --with-bugurl="" --with-expat=no --with-python=no --with-system-readline; \
make --no-print-directory CRASH_TARGET=${TARGET}; echo ${TARGET} > crash.target) \
else make --no-print-directory rebuild; fi
@if [ ! -f ${PROGRAM} ]; then \

View File

@ -1,32 +0,0 @@
--- crash-7.2.9/cmdline.c.orig
+++ crash-7.2.9/cmdline.c
@@ -46,7 +46,8 @@ static int verify_args_input_file(char *
#define READLINE_LIBRARY
#include <readline.h>
-#include <rldefs.h>
+#define vi_mode 0
+#define emacs_mode 1
#include <history.h>
static void readline_init(void);
--- crash-7.2.9/Makefile.orig
+++ crash-7.2.9/Makefile
@@ -205,7 +205,7 @@ TAR_FILES=${SOURCE_FILES} Makefile ${GPL
${EXTENSION_SOURCE_FILES} ${MEMORY_DRIVER_FILES}
CSCOPE_FILES=${SOURCE_FILES}
-READLINE_DIRECTORY=./${GDB}/readline
+READLINE_DIRECTORY=/usr/include/readline
BFD_DIRECTORY=./${GDB}/bfd
GDB_INCLUDE_DIRECTORY=./${GDB}/include
@@ -233,7 +233,7 @@ gdb_merge: force
@rm -f ${PROGRAM}
@if [ ! -f ${GDB}/config.status ]; then \
(cd ${GDB}; ./configure ${GDB_CONF_FLAGS} --with-separate-debug-dir=/usr/lib/debug \
- --with-bugurl="" --with-expat=no --with-python=no --disable-sim; \
+ --with-bugurl="" --with-expat=no --with-python=no --disable-sim --with-system-readline; \
make --no-print-directory CRASH_TARGET=${TARGET}; echo ${TARGET} > crash.target) \
else make --no-print-directory rebuild; fi
@if [ ! -f ${PROGRAM} ]; then \