Sync from SUSE:SLFO:Main crash revision 27fa679933d6ecc4bf9248e54616d054

This commit is contained in:
Adrian Schröter 2024-05-03 11:53:27 +02:00
commit 4bfa86ed8c
35 changed files with 5635 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
Module.supported Normal file
View File

@ -0,0 +1 @@
crash.ko

22
README.SUSE Normal file
View File

@ -0,0 +1,22 @@
Changes in the SUSE package
===========================
- Emacs is the default editing mode, can still be overwritten to vi mode via
command line or configuration file
- added the Crash Whitepaper from
http://people.redhat.com/anderson/.crash_whitepaper/
As-of May 30th 2020 the Crash Whitepaper has been moved to
https://crash-utility.github.io/crash_whitepaper.html
- fix for LKCD header (SLES9 has another header format than SLES10) in IA64
SIAL
====
To use the SIAL extension, install crash-sial and load it with "extend sial.so"
in crash. If you want to have the sial extension automatically loaded at
startup, add this command to your ~/.crashrc configuration file.
Place custom scripts in /usr/share/sial/crash (system wide) or ~/.sial (per
user).

BIN
crash-8.0.4.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,39 @@
From 28fa7bd09013455b5ddc020dea4706278cda0d65 Mon Sep 17 00:00:00 2001
From: Hari Bathini <hbathini@linux.ibm.com>
Date: Wed, 20 Jun 2018 01:34:22 +0530
Subject: book3s/ppc64: Increase the VA range
Upstream: no, adapts the below upstream commit for SLE15 SP1
Git-commit: 28fa7bd09013455b5ddc020dea4706278cda0d65
Fix for PPC64 kernel virtual address translation in Linux 4.17 and
later kernels with commit c2b4d8b7417a59b7f9a52d0d8402f5257cbbd398,
titled "powerpc/mm/hash64: Increase the VA range", in which the
maximum virtual address value has been increased to 4PB. Without
the patch, the translation/access of high vmalloc space addresses
fails; for example, the "kmem -[sS]" option fails the translation
of per-cpu kmem_cache_cpu addresses located in vmalloc space, with
the error messages "kmem: invalid kernel virtual address: <address>
type: kmem_cache_cpu.freelist" and "kmem: invalid kernel virtual
address: <address> type: kmem_cache_cpu.page", and the "vtop"
command shows the addresses as "(not mapped)". (hbathini@linux.ibm.com)
[note: apply on 4.12+ for SLE 15 SP1 - incompatible with SLE 15 SP0]
---
Index: crash-7.2.8/ppc64.c
===================================================================
--- crash-7.2.8.orig/ppc64.c
+++ crash-7.2.8/ppc64.c
@@ -519,8 +519,9 @@ ppc64_init(int when)
if (THIS_KERNEL_VERSION >= LINUX(4,12,0)) {
ms->l2_index_size = PMD_INDEX_SIZE_L4_64K_4_12;
- if (THIS_KERNEL_VERSION >= LINUX(4,17,0))
- ms->l3_index_size = PUD_INDEX_SIZE_L4_64K_4_17;
+ if (THIS_KERNEL_VERSION >= LINUX(4,17,0) ||
+ is_SLE15SP1())
+ ms->l3_index_size = PUD_INDEX_SIZE_L4_64K_4_17;
else
ms->l3_index_size = PUD_INDEX_SIZE_L4_64K_4_12;
ms->l4_index_size = PGD_INDEX_SIZE_L4_64K_4_12;

View File

@ -0,0 +1,52 @@
From 599a6579aa916df7800f8e889d68e4287e4520dd Mon Sep 17 00:00:00 2001
From: Hari Bathini <hbathini@linux.ibm.com>
Date: Thu, 27 Sep 2018 02:06:49 +0530
Subject: ppc64: increase MAX_PHYSMEM_BITS to 128TB
Upstream: no, adapts the below upstream commit for SLE15 SP1
Git-commit: 599a6579aa916df7800f8e889d68e4287e4520dd
With Linux 4.19-rc1 commit 7d4340bb92a9df78e6e28152f3dd89d9bd82146b,
titled "powerpc/mm: Increase MAX_PHYSMEM_BITS to 128TB with
SPARSEMEM_VMEMMAP config", the PPC64 MAX_PHYSMEM_BITS value has been
bumped up to 47. The appropriate update has been made in this patch.
(hbathini@linux.ibm.com)
[note: apply on 4.12+ for SLE 15 SP1 - incompatible with SLE 15 SP0]
---
Index: crash-7.2.8/defs.h
===================================================================
--- crash-7.2.8.orig/defs.h
+++ crash-7.2.8/defs.h
@@ -6896,6 +6896,9 @@ extern struct lkcd_environment *lkcd;
#define is_SLES9() \
((THIS_KERNEL_VERSION == LINUX(2,6,5)) && kt->is_suse_kernel)
+#define is_SLE15SP1() \
+ ((THIS_KERNEL_VERSION >= LINUX(4,12,0)) && kt->is_suse_kernel)
+
/*
* gdb_interface.c
*/
Index: crash-7.2.8/ppc64.c
===================================================================
--- crash-7.2.8.orig/ppc64.c
+++ crash-7.2.8/ppc64.c
@@ -244,9 +244,14 @@ static int set_ppc64_max_physmem_bits(vo
*/
machdep->max_physmem_bits = _MAX_PHYSMEM_BITS_4_20;
} else if ((machdep->flags & VMEMMAP) &&
- ((THIS_KERNEL_VERSION >= LINUX(4,19,0)) || is_RHEL8())) {
- /* SPARSEMEM_VMEMMAP & v4.19 kernel or later, or RHEL8 */
- machdep->max_physmem_bits = _MAX_PHYSMEM_BITS_4_19;
+ ((THIS_KERNEL_VERSION >= LINUX(4,19,0)) ||
+ is_RHEL8() ||
+ is_SLE15SP1())) {
+ /*
+ * SPARSEMEM_VMEMMAP & v4.19 kernel or later,
+ * or RHEL8 or SLE-15-SP1
+ */
+ machdep->max_physmem_bits = _MAX_PHYSMEM_BITS_4_19;
} else if (THIS_KERNEL_VERSION >= LINUX(3,7,0))
machdep->max_physmem_bits = _MAX_PHYSMEM_BITS_3_7;
else

View File

@ -0,0 +1,38 @@
This patch fix a problem that crash cannot open a dumpfile which is
captured by sadump in KASLR enabled kernel.
When KASLR feature is enabled, a kernel is placed on the memory randomly
and therefore crash cannot open a dumpfile captured by sadump because
addresses of kernel symbols in System.map or vmlinux are different from
actual addresses.
To solve this problem, we need to calculate kaslr offset(the difference
between original symbol address and actual address) and phys_base, and
adjust symbol table of crash. In the case of dumpfile of kdump, these
information is included in the header, but dumpfile of sadump does not
have such a information.
This patch calculate kaslr offset and phys_base to solve this problem.
Please see the comment in the calc_kaslr_offset() for the detail idea.
The basic idea is getting register (IDTR and CR3) from dump header, and
calculate kaslr_offset/phys_base using them.
Signed-off-by: Takao Indoh <indou.takao@jp.fujitsu.com>
---
symbols.c | 3 +++
1 file changed, 3 insertions(+)
Index: b/symbols.c
===================================================================
--- a/symbols.c
+++ b/symbols.c
@@ -1209,6 +1209,9 @@ symname_hash_install(struct syment *spn)
}
}
}
+
+ if (SADUMP_DUMPFILE())
+ kt->flags2 |= KASLR_CHECK;
}
/*

View File

@ -0,0 +1,72 @@
From: Petr Tesarik <ptesarik@suse.cz>
Subject: Automatically detect compressed booted kernel
References: bnc#777516, bnc#828260
Upstream: not yet
Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
---
filesys.c | 26 ++++++++++++++++++++++----
1 file changed, 22 insertions(+), 4 deletions(-)
Index: b/filesys.c
===================================================================
--- a/filesys.c
+++ b/filesys.c
@@ -588,6 +588,7 @@ static int
find_booted_kernel(void)
{
char kernel[BUFSIZE];
+ char *real_kernel;
char buffer[BUFSIZE];
char **searchdirs;
int i, preferred, wrapped;
@@ -637,16 +638,24 @@ find_booted_kernel(void)
sprintf(kernel, "%s%s", searchdirs[i], dp->d_name);
if (mount_point(kernel) ||
- !file_readable(kernel) ||
- !is_kernel(kernel))
+ !file_readable(kernel))
continue;
+ if (!is_compressed_kernel(kernel, &real_kernel))
+ real_kernel = kernel;
+
if (CRASHDEBUG(1))
fprintf(fp, "find_booted_kernel: check: %s\n",
kernel);
- found = match_file_string(kernel, kt->proc_version, buffer);
-
+ if (!is_kernel(real_kernel)) {
+ if (real_kernel != kernel)
+ free(real_kernel);
+ continue;
+ }
+
+ found = match_file_string(real_kernel, kt->proc_version, buffer);
+
if (found)
break;
}
@@ -666,10 +675,19 @@ find_booted_kernel(void)
if (CRASHDEBUG(1))
fprintf(fp, "find_booted_kernel: found: %s\n",
pc->namelist);
+ if (real_kernel != kernel) {
+ pc->namelist_orig = pc->namelist;
+ pc->namelist = real_kernel;
+ }
return TRUE;
}
}
+ if (real_kernel != kernel) {
+ remove(real_kernel);
+ free(real_kernel);
+ }
+
error(INFO,
"cannot find booted kernel -- please enter namelist argument\n\n");
return FALSE;

View File

@ -0,0 +1,67 @@
From: Petr Tesarik <ptesarik@suse.cz>
Subject: Search debuginfo files in the original directory
References: bnc#723639
If debuginfo is in a separate file and the kernel image is compressed,
then it should be found in the same directory as the original (compressed)
image, not in the directory with the uncompressed image (TMPDIR).
Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
---
symbols.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
Index: b/symbols.c
===================================================================
--- a/symbols.c
+++ b/symbols.c
@@ -240,9 +240,9 @@ symtab_init(void)
* Pull a bait-and-switch on st->bfd if we've got a separate
* .gnu_debuglink file that matches the CRC. Not done for kerntypes.
*/
- if (!(LKCD_KERNTYPES()) &&
- !(bfd_get_file_flags(st->bfd) & HAS_SYMS)) {
- if (!check_gnu_debuglink(st->bfd))
+ if (!(LKCD_KERNTYPES())) {
+ if (!check_gnu_debuglink(st->bfd) &&
+ !(bfd_get_file_flags(st->bfd) & HAS_SYMS))
no_debugging_data(FATAL);
}
@@ -304,13 +304,16 @@ check_gnu_debuglink(bfd *bfd)
char *contents;
int crc_offset;
unsigned long crc32;
+ char *namelist;
char *dirname;
char *namelist_debug;
char **matching;
+ namelist = pc->namelist_orig ? pc->namelist_orig : pc->namelist;
+
sect = bfd_get_section_by_name(bfd, ".gnu_debuglink");
if (!sect) {
- error(INFO, "%s: no .gnu_debuglink section\n", pc->namelist);
+ error(INFO, "%s: no .gnu_debuglink section\n", namelist);
return FALSE;
}
@@ -331,14 +334,14 @@ check_gnu_debuglink(bfd *bfd)
contents, crc32);
if ((pc->debuginfo_file = (char *)
- malloc(((strlen(pc->namelist) + strlen("/.debug/") +
+ malloc(((strlen(namelist) + strlen("/.debug/") +
+ strlen(".debug") + strlen(" /usr/lib/debug/boot/ "))*10)
+ strlen(pc->namelist_debug ? pc->namelist_debug : " "))) == NULL)
error(FATAL, "debuginfo file name malloc: %s\n",
strerror(errno));
- dirname = GETBUF(strlen(pc->namelist)+1);
- strcpy(dirname, pc->namelist);
+ dirname = GETBUF(strlen(namelist)+1);
+ strcpy(dirname, namelist);
for (i = strlen(dirname)-1; i >= 0; i--)
{

View File

@ -0,0 +1,27 @@
From 1917e50265c15ff00c6f40b64720ef173f550059 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Wed, 10 Nov 2021 12:30:27 +0100
Subject: [PATCH] crash: enable zstd support
---
CFLAGS.extra | 2 +-
LDFLAGS.extra | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/CFLAGS.extra b/CFLAGS.extra
index 4fafcff..825d5ee 100644
--- a/CFLAGS.extra
+++ b/CFLAGS.extra
@@ -1 +1 @@
--DLZO -DSNAPPY
+-DLZO -DSNAPPY -DZSTD
diff --git a/LDFLAGS.extra b/LDFLAGS.extra
index 83f3661..ffc6ee8 100644
--- a/LDFLAGS.extra
+++ b/LDFLAGS.extra
@@ -1 +1 @@
--llzo2 -lsnappy
+-llzo2 -lsnappy -lzstd
--
2.33.1

View File

@ -0,0 +1,13 @@
Index: b/extensions/Makefile
===================================================================
--- a/extensions/Makefile
+++ b/extensions/Makefile
@@ -32,6 +32,8 @@ link_defs:
@rm -f defs.h
@ln ../defs.h
+defs.h: link_defs
+
$(CONTRIB_SO): %.so: %.c defs.h
@if [ -f $*.mk ]; then \
$(MAKE) -f $*.mk; \

1
crash-gdb-10.2.series Normal file
View File

@ -0,0 +1 @@
gdb-gnulib-define-warndecl.patch

View File

@ -0,0 +1,31 @@
From: Petr Tesarik <petr@tesarici.cz>
Subject: gnulib: Provide a definition of __warndecl
Upstream: never, compatibility with SLE12 only
The local copy of string.h includes the system string.h. Older glibc makes
use of the __warndecl macro, but gnulib's cdefs.h does not provide one.
Signed-off-by: Petr Tesarik <petr@tesarici.cz>
---
gdb-10.2/gnulib/import/cdefs.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
--- a/gnulib/import/cdefs.h
+++ b/gnulib/import/cdefs.h
@@ -704,4 +704,16 @@ _Static_assert (0, "IEEE 128-bits long d
# define __attribute_returns_twice__ /* Ignore. */
#endif
+#if __GNUC_PREREQ (4,3)
+# define __warndecl(name, msg) \
+ extern void name (void) __attribute__((__warning__ (msg)))
+# define __warnattr(msg) __attribute__((__warning__ (msg)))
+# define __errordecl(name, msg) \
+ extern void name (void) __attribute__((__error__ (msg)))
+#else
+# define __warndecl(name, msg) extern void name (void)
+# define __warnattr(msg)
+# define __errordecl(name, msg) extern void name (void)
+#endif
+
#endif /* sys/cdefs.h */

1
crash-kmp-preamble Normal file
View File

@ -0,0 +1 @@
Requires: kernel-%1

View File

@ -0,0 +1,30 @@
---
main.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
Index: b/main.c
===================================================================
--- a/main.c
+++ b/main.c
@@ -1183,12 +1183,6 @@ setup_environment(int argc, char **argv)
pc->flags |= READLINE;
pc->editing_mode = "no_mode";
- if ((p1 = getenv("EDITOR"))) {
- if (strstr(p1, "vi"))
- pc->editing_mode = "vi";
- if (strstr(p1, "emacs"))
- pc->editing_mode = "emacs";
- }
/*
* Resolve $HOME .rc file first, then the one in the local directory.
@@ -1238,7 +1232,7 @@ setup_environment(int argc, char **argv)
}
if (STREQ(pc->editing_mode, "no_mode"))
- pc->editing_mode = "vi";
+ pc->editing_mode = "emacs";
machdep_init(SETUP_ENV);
}

32
crash-patch-gdb.patch Normal file
View File

@ -0,0 +1,32 @@
From: Petr Tesarik <ptesarik@suse.cz>
Subject: Apply custom patches to gdb
Upstream: never
Enhance the crash specfile to allow applying custom patches.
Update jeffm 17 Sep 2014: What used to be in the series file is now in
gdb-7.6-ppc64le-support.patch. We used to apply it unconditionally so
we'll continue to do so.
Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
---
Makefile | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
Index: b/Makefile
===================================================================
--- a/Makefile
+++ b/Makefile
@@ -293,6 +293,11 @@ gdb_unzip:
gdb_patch:
if [ -f ${GDB}.patch ] && [ -s ${GDB}.patch ]; then \
patch -p0 < ${GDB}.patch; cp ${GDB}.patch ${GDB}; fi
+ if [ -f ${GDB}.series ]; then \
+ while read p; do \
+ patch -d ${GDB} -p1 -F0 < "$$p" ; \
+ done < ${GDB}.series ; \
+ fi
library: ${OBJECT_FILES}
ar -rs ${PROGRAM}lib.a ${OBJECT_FILES}

4
crash-rpmlintrc Normal file
View File

@ -0,0 +1,4 @@
addFilter("devel-file-in-non-devel-package .*/usr/share/sial/crash.*")
# crash-7.0.9.tar compresses better with gzip than with bzip2
addFilter(" source-or-patch-not-bzipped crash-7.0.9.tar.gz")
addFilter(" source-or-patch-not-compressed bz2 crash-7.0.9.tar.gz")

15
crash-sial-ps-2.6.29.diff Normal file
View File

@ -0,0 +1,15 @@
diff -Nurp sial-scripts-2008-02-08.orig//ps.c sial-scripts-2008-02-08/ps.c
--- sial-scripts-2008-02-08.orig//ps.c 2010-03-12 19:59:03.227788951 +0100
+++ sial-scripts-2008-02-08/ps.c 2010-03-12 19:59:16.690665574 +0100
@@ -192,7 +192,11 @@ string cmd;
printf("%p %7d %7d %7d 0x%02x 0x%08x %5d:%-5d %s\n"
, t
+#if LINUX_RELEASE > 0x02061d
+ , t->real_cred->uid
+#else
, t->uid
+#endif
, t->pid
#if LINUX_2_6_X
, t->parent->pid

75
crash-sles9-quirk.patch Normal file
View File

@ -0,0 +1,75 @@
From: Bernhard Walle <bwalle@suse.de>
Subject: [PATCH] Add quirk for SLES9 LKCD header
Upstream: never
On SLES9, we have a different header on IA64:
SLES 10:
typedef struct __dump_header_asm {
uint64_t dha_magic_number;
uint32_t dha_version;
uint32_t dha_header_size;
uint64_t dha_pt_regs;
struct pt_regs dha_regs;
uint64_t dha_rnat;
uint64_t dha_pfs;
uint64_t dha_bspstore;
uint32_t dha_smp_num_cpus;
uint32_t dha_dumping_cpu;
struct pt_regs dha_smp_regs[NR_CPUS];
uint64_t dha_smp_current_task[NR_CPUS];
uint64_t dha_stack[NR_CPUS];
uint64_t dha_stack_ptr[NR_CPUS];
uint64_t dha_kernel_addr;
} __attribute__((packed)) dump_header_asm_t;
SLES 9:
typedef struct __dump_header_asm {
uint64_t dha_magic_number;
uint32_t dha_version;
uint32_t dha_header_size;
uint64_t dha_kernel_addr;
uint64_t dha_pt_regs;
struct pt_regs dha_regs;
uint64_t dha_rnat;
uint64_t dha_pfs;
uint64_t dha_bspstore;
uint32_t dha_smp_num_cpus;
uint32_t dha_dumping_cpu;
struct pt_regs dha_smp_regs[NR_CPUS];
uint64_t dha_smp_current_task[NR_CPUS];
uint64_t dha_stack[NR_CPUS];
uint64_t dha_stack_ptr[NR_CPUS];
} __attribute__((packed)) dump_header_asm_t;
That patch tries to guess if it's a SLES 9 or a SLES 10 header
at runtime.
Signed-off-by: Bernhard Walle <bwalle@suse.de>
---
lkcd_v8.c | 11 +++++++++++
1 file changed, 11 insertions(+)
--- a/lkcd_v8.c
+++ b/lkcd_v8.c
@@ -130,6 +130,17 @@ lkcd_dump_init_v8_arch(dump_header_t *dh
goto err;
}
+#if IA64
+ /* SLES9 on IA64? */
+ if ( *((uint64_t *)(hdr_buf + hdr_size - sizeof(uint64_t))) <= NR_CPUS) {
+ uint64_t kernel_addr;
+ kernel_addr = ((dump_header_asm_t *)hdr_buf)->dha_pt_regs;
+ memmove(hdr_buf + offsetof(dump_header_asm_t, dha_pt_regs),
+ hdr_buf + offsetof(dump_header_asm_t, dha_regs),
+ hdr_size - offsetof(dump_header_asm_t, dha_regs));
+ *((uint64_t *)(hdr_buf + hdr_size - sizeof(uint64_t))) = kernel_addr;
+ }
+#endif
/*
* Though we have KL_NR_CPUS is 128, the header size is different

105
crash-sles9-time.patch Normal file
View File

@ -0,0 +1,105 @@
From: Alan Tyson <atyson@hp.com>
Subject: [PATCH] Fix "uptime" and "ps -t" for SLES9
References: 352836
This patch adds a quirk for SLES9 jiffies initialisation and corrects the time
data in "uptime" and "ps -t" command.
Acked-by: Bernhard Walle <bwalle@suse.de>
---
defs.h | 8 ++++++++
kernel.c | 9 ++++++++-
task.c | 11 +++++++++++
3 files changed, 27 insertions(+), 1 deletion(-)
Index: b/defs.h
===================================================================
--- a/defs.h
+++ b/defs.h
@@ -767,6 +767,7 @@ struct kernel_table {
ulong p2m_missing;
} pvops_xen;
int highest_irq;
+ int is_suse_kernel;
#define IKCONFIG_AVAIL 0x1 /* kernel contains ikconfig data */
#define IKCONFIG_LOADED 0x2 /* ikconfig data is currently loaded */
int ikconfig_flags;
@@ -7674,6 +7675,13 @@ extern struct lkcd_environment *lkcd;
#endif /* LKCD_COMMON */
+
+/*
+ * SUSE specific
+ */
+#define is_SLES9() \
+ ((THIS_KERNEL_VERSION == LINUX(2,6,5)) && kt->is_suse_kernel)
+
/*
* gdb_interface.c
*/
Index: b/kernel.c
===================================================================
--- a/kernel.c
+++ b/kernel.c
@@ -315,6 +315,12 @@ kernel_init()
verify_version();
+ /*
+ * check if we have a suse kernel (this is the module supported
+ * patch of agruen@suse.de
+ */
+ kt->is_suse_kernel = symbol_exists("unsupported");
+
if (symbol_exists("__per_cpu_offset")) {
if (LKCD_KERNTYPES())
i = get_cpus_possible();
@@ -5852,7 +5858,7 @@ get_uptime(char *buf, ulonglong *j64p)
if (symbol_exists("jiffies_64")) {
get_symbol_data("jiffies_64", sizeof(ulonglong), &jiffies_64);
- if (THIS_KERNEL_VERSION >= LINUX(2,6,0)) {
+ if (THIS_KERNEL_VERSION >= LINUX(2,6,0) && !is_SLES9()) {
wrapped = (jiffies_64 & 0xffffffff00000000ULL);
if (wrapped) {
wrapped -= 0x100000000ULL;
@@ -6454,6 +6460,7 @@ no_cpu_flags:
fprintf(fp, " p2m_mid_missing: %lx\n", kt->pvops_xen.p2m_mid_missing);
fprintf(fp, " p2m_missing: %lx\n", kt->pvops_xen.p2m_missing);
}
+ fprintf(fp, " is_suse_kernel: %d\n", kt->is_suse_kernel);
}
/*
Index: b/task.c
===================================================================
--- a/task.c
+++ b/task.c
@@ -4687,6 +4687,12 @@ start_time_timespec(void)
default:
break;
}
+ /* SLES9 stores start_time in nanoseconds, so set TIMESPEC in order */
+ /* to do the right calculations in convert_start_time */
+ if (is_SLES9()) {
+ tt->flags |= TIMESPEC;
+ return TRUE;
+ }
tt->flags |= NO_TIMESPEC;
@@ -4710,6 +4716,11 @@ convert_start_time(ulonglong start_time,
ulong tmp1, tmp2;
ulonglong wrapped;
+ /* SLES9's start_time is neither jiffies nor a timespec. It's ns */
+ if (is_SLES9()) {
+ start_time = start_time / 1000000000;
+ }
+
switch(tt->flags & (TIMESPEC | NO_TIMESPEC | START_TIME_NSECS))
{
case START_TIME_NSECS:

View File

@ -0,0 +1,34 @@
From: David Mair <dmair@suse.com>
Date: 2017-05-25 10:27:21 -0600
Subject: Avoid printing a read error for a failed read that can be retried
References: bnc#1038839
Upstream: tbd
When reading a memory image fails it may not be an error if it is still
possible to switch image and retry the read. Fix the error message output
to only occur if no retries are intended.
---
Index: b/memory.c
===================================================================
--- a/memory.c
+++ b/memory.c
@@ -2442,8 +2442,6 @@ readmem(ulonglong addr, int memtype, voi
goto readmem_error;
case READ_ERROR:
- if (PRINT_ERROR_MESSAGE)
- error(INFO, READ_ERRMSG, memtype_string(memtype, 0), addr, type);
if ((pc->flags & DEVMEM) && (kt->flags & PRE_KERNEL_INIT) &&
!(error_handle & NO_DEVMEM_SWITCH) && devmem_is_restricted() &&
switch_to_proc_kcore()) {
@@ -2451,6 +2449,8 @@ readmem(ulonglong addr, int memtype, voi
return(readmem(addr, memtype, bufptr, size,
type, error_handle));
}
+ if (PRINT_ERROR_MESSAGE)
+ error(INFO, READ_ERRMSG, memtype_string(memtype, 0), addr, type);
goto readmem_error;
case PAGE_EXCLUDED:

59
crash-usrmerge.patch Normal file
View File

@ -0,0 +1,59 @@
From: Ludwig Nussel <lnussel@suse.de>
Subject: debug info is in /usr/lib/debug/usr/lib/modules
References: boo#1190434
Upstream: to be done (must not break Red Hat)
---
defs.h | 2 +-
help.c | 2 +-
symbols.c | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
Index: b/defs.h
===================================================================
--- a/defs.h
+++ b/defs.h
@@ -413,7 +413,7 @@ struct number_option {
#define PIPE_OPTIONS (FROM_COMMAND_LINE | FROM_INPUT_FILE | REDIRECT_TO_PIPE | \
REDIRECT_TO_STDPIPE | REDIRECT_TO_FILE)
-#define DEFAULT_REDHAT_DEBUG_LOCATION "/usr/lib/debug/lib/modules"
+#define DEFAULT_REDHAT_DEBUG_LOCATION "/usr/lib/debug/usr/lib/modules"
#define MEMORY_DRIVER_MODULE "crash"
#define MEMORY_DRIVER_DEVICE "/dev/crash"
Index: b/help.c
===================================================================
--- a/help.c
+++ b/help.c
@@ -9649,7 +9649,7 @@ README_ENTER_DIRECTORY,
README_MEMORY_DRIVER,
"",
" If the kernel file is stored in /boot, /, /boot/efi, or in any /usr/src",
-" or /usr/lib/debug/lib/modules subdirectory, then no command line arguments",
+" or " DEFAULT_REDHAT_DEBUG_LOCATION " subdirectory, then no command line arguments",
" are required -- the first kernel found that matches /proc/version will be",
" used as the namelist.",
" ",
Index: b/symbols.c
===================================================================
--- a/symbols.c
+++ b/symbols.c
@@ -335,7 +335,7 @@ check_gnu_debuglink(bfd *bfd)
if ((pc->debuginfo_file = (char *)
malloc(((strlen(namelist) + strlen("/.debug/") +
- + strlen(".debug") + strlen(" /usr/lib/debug/boot/ "))*10)
+ + strlen(".debug") + strlen(" /usr/lib/debug/usr/lib/modules/ "))*10)
+ strlen(pc->namelist_debug ? pc->namelist_debug : " "))) == NULL)
error(FATAL, "debuginfo file name malloc: %s\n",
strerror(errno));
@@ -411,7 +411,7 @@ check_gnu_debuglink(bfd *bfd)
}
}
- sprintf(pc->debuginfo_file, "/usr/lib/debug/boot/%s", contents);
+ sprintf(pc->debuginfo_file, "/usr/lib/debug/%s/%s", dirname, contents);
if (separate_debug_file_exists(pc->debuginfo_file, crc32, &exists)) {
if (CRASHDEBUG(1))
fprintf(fp, "%s: CRC matches\n", pc->debuginfo_file);

4452
crash.changes Normal file

File diff suppressed because it is too large Load Diff

352
crash.spec Normal file
View File

@ -0,0 +1,352 @@
#
# spec file for package crash
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
# needssslcertforbuild
%define whitepaper_version 2003
%define scripts_version 2008-02-08
%define gcore_version 2023-02-28
%if 0%{!?have_snappy:1}
%if 0%{?suse_version} >= 1310
%define have_snappy 1
%else
%define have_snappy 0
%endif
%endif
%if 0%{!?have_zstd:1}
%if 0%{?suse_version} >= 1550 || 0%{?sle_version} >= 150200
# the zstd patch depends on the snappy patch
%define have_zstd %{have_snappy}
%else
%define have_zstd 0
%endif
%endif
%ifarch %ix86 x86_64
%define build_gcore 1
%else
%define build_gcore 0
%endif
%define build_kmp 1
%if 0%{?suse_version} <= 1500 && 0%{?suse_version} >= 1315
# kernel is missing on 32bit SLE - cannot build a KMP
%ifarch %ix86 s390
%define build_kmp 0
%endif
%endif
# kernel is missing on 32-bit ppc
%ifarch ppc
%define build_kmp 0
%endif
Name: crash
URL: https://crash-utility.github.io/
Summary: Crash utility for live systems; netdump, diskdump, LKCD or mcore dumpfiles
License: GFDL-1.2-only AND GPL-3.0-or-later
Group: Development/Tools/Debuggers
Version: 8.0.4
Release: 0
Source: https://github.com/crash-utility/crash/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: https://ftp.gnu.org/gnu/gdb/gdb-10.2.tar.gz
Source2: crash_whitepaper-%{whitepaper_version}.tar.bz2
Source3: README.SUSE
Source4: sial-scripts-%{scripts_version}.tar.bz2
Source5: gcore-%{gcore_version}.tar.bz2
Source6: Module.supported
Source7: https://ftp.gnu.org/gnu/gdb/gdb-10.2.tar.gz.sig
Source8: gnu.keyring
Source95: get-kernel-flavors.sh
Source96: depmod.sh
Source97: mkinitrd.sh
Source98: %{name}-kmp-preamble
Source99: crash-rpmlintrc
Source100: %{name}-gdb-10.2.series
Source101: %{name}-gdb-gnulib-define-warndecl.patch
Patch1: %{name}-make-emacs-default.diff
Patch2: %{name}-sles9-quirk.patch
Patch4: %{name}-sles9-time.patch
Patch9: %{name}-debuginfo-compressed.patch
Patch10: %{name}_enable_lzo_support.patch
Patch11: %{name}-compressed-booted-kernel.patch
Patch13: %{name}-patch-gdb.patch
Patch15: %{name}_enable_snappy_support.patch
Patch18: %{name}-stop_read_error_when_intent_is_retry.patch
Patch21: %{name}-allow-use-of-sadump-captured-KASLR-kernel.patch
Patch23: %{name}-SLE15-SP1-With-Linux-4.19-rc1-up-MAX_PHYSMEM_BITS-to-128TB.patch
Patch24: %{name}-SLE15-SP1-Fix-for-PPC64-kernel-virtual-address-translation-in.patch
Patch30: %{name}-enable-zstd-support.patch
Patch32: %{name}-extensions-rule-for-defs.patch
Patch90: %{name}-sial-ps-2.6.29.diff
Patch99: %{name}-usrmerge.patch
BuildRequires: bison
BuildRequires: flex
BuildRequires: gcc-c++
BuildRequires: lzo-devel
BuildRequires: makeinfo
BuildRequires: ncurses-devel
%if %{have_snappy}
BuildRequires: snappy-devel
%endif
%if %{have_zstd}
BuildRequires: libzstd-devel
%endif
BuildRequires: libelf-devel
BuildRequires: zlib-devel
Requires: /usr/bin/nm
ExclusiveArch: %ix86 x86_64 ia64 s390 s390x ppc ppc64 ppc64le alpha aarch64 %arm riscv64
%if 0%{?build_kmp}
BuildRequires: kernel-syms
%ifarch x86_64
%if 0%{?suse_version} >= 1520 && 0%{?suse_version} < 1550
BuildRequires: kernel-syms-rt
%endif
%endif
%if 0%{?suse_version} >= 1130
BuildRequires: kernel-devel
%endif
%if %{defined kernel_module_package_buildreqs}
BuildRequires: %kernel_module_package_buildreqs
%endif
BuildRequires: module-init-tools
%endif
%if 0%{?build_kmp} && %{defined suse_kernel_module_package}
%suse_kernel_module_package -n crash -p %_sourcedir/%{name}-kmp-preamble um
%define arch %_target_cpu
%define kmp_pkg KMP
%endif
%description
The core analysis suite is a self-contained tool that can be used to
investigate either live systems, kernel core dumps created from the
netdump and diskdump packages from Red Hat Linux, the mcore kernel
patch offered by Mission Critical Linux, or the LKCD kernel patch.
Authors:
--------
David Anderson <anderson@redhat.com>
%package doc
Requires: %{name} = %{version}
Summary: Documentation for Crash
License: GFDL-1.2-only
Group: Development/Tools/Debuggers
%description doc
This subpackage contains the crash whitepaper from Dave Anderson.
Authors:
--------
David Anderson <anderson@redhat.com>
%package devel
Requires: %{name} = %{version}
Summary: Development files for crash
License: GPL-2.0-or-later
Group: Development/Tools/Debuggers
Requires: zlib-devel
%description devel
This files are required to build extensions for crash.
Crash is the core analysis suite that can be used to investigate either
live systems, kernel core dumps created from the netdump and diskdump
packages from Red Hat Linux, the mcore kernel patch offered by Mission
Critical Linux, or the LKCD kernel patch.
Authors:
--------
David Anderson <anderson@redhat.com>
%if %build_gcore
%package gcore
Requires: %{name} = %{version}
Summary: Gcore extension for crash
License: GPL-2.0-or-later
Group: Development/Tools/Debuggers
%description gcore
Create a core dump file of a user-space task that was running in a
kernel dumpfile.
Authors:
--------
Daisuke Hatayama <d.hatayama@jp.fujitsu.com>
%endif
%package %kmp_pkg
Summary: Memory driver for the crash utility
License: GPL-2.0-only
Group: System/Kernel
%description %kmp_pkg
To run the crash utility on a live system, a memory device must be present.
Due to many limitations of the /dev/mem interface, a separate kernel module
is provided to access all RAM through the /dev/crash device.
Authors:
--------
David Anderson <anderson@redhat.com>
# Compatibility cruft
# there is no %%license prior to SLE12
%if %{undefined _defaultlicensedir}
%define license %doc
%else
# filesystem before SLE12 SP3 lacks /usr/share/licenses
%if 0%(test ! -d %{_defaultlicensedir} && echo 1)
%define _defaultlicensedir %{_defaultdocdir}
%endif
%endif
# End of compatibility cruft
%prep
%setup -q -a 2 -a 4
ln -s %{SOURCE1} .
%patch1 -p1
%patch2 -p1
%patch4 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch13 -p1
%patch18 -p1
%patch21 -p1
# Patches for SLE 15 SP1 potentially break support for SLE15 and SLE 12 SP4
# Don't apply on these (and earlier) versions - see bsc#1148197
%if 0%{?sle_version} > 120400 && 0%{?sle_version} != 150000
%patch23 -p1
%patch24 -p1
%endif
%if %{have_snappy}
%patch15 -p1
%endif
%if %{have_zstd}
%patch30 -p1
%endif
## GDB patches
for f in %{S:100} %{S:101}; do
base=`basename "$f"`
cp "$f" "${base#%{name}-}"
done
%patch32 -p1
## SIAL patches
cd sial-scripts-%{scripts_version}
%patch90 -p1
cd -
cd extensions
## gcore extension
tar xfvj %{S:5}
cd -
cp %{S:3} .
mkdir kbuild
cp %{S:6} memory_driver
%if 0%{?suse_version} > 1550
%patch99 -p1
%endif
%build
%ifarch ppc64le ppc64
# for ppc64le use -mfull-toc needed by lto as per boo#1146646
export CFLAGS="$RPM_OPT_FLAGS -fno-builtin-memset -fno-strict-aliasing -mfull-toc"
%else
export CFLAGS="$RPM_OPT_FLAGS -fno-builtin-memset -fno-strict-aliasing"
%endif
export GDB="gdb-%{gdb_version}"
make RPMPKG="`cat .rh_rpm_package`" %{?jobs:-j%jobs}
make extensions %{?jobs:-j%jobs}
%if 0%{?build_kmp}
export EXTRA_CFLAGS='-DVERSION=\"%version\"'
for flavor in %flavors_to_build; do
rm -rf kbuild/$flavor
cp -r memory_driver kbuild/$flavor
make -C /usr/src/linux-obj/%arch/$flavor modules \
M=$PWD/kbuild/$flavor
done
%endif
%install
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_libdir}
make DESTDIR=%{buildroot} install
mkdir -p %{buildroot}%{_mandir}/man8
install -m 0644 crash.8 %{buildroot}%{_mandir}/man8/crash.8
# devel files
mkdir -p $RPM_BUILD_ROOT/%{_includedir}/crash
install -m 0644 defs.h $RPM_BUILD_ROOT/%{_includedir}/crash
# permissions
chmod 644 COPYING3
# extensions
mkdir -p $RPM_BUILD_ROOT/%{_libdir}/crash/extensions
install -m 0644 extensions/dminfo.so extensions/snap.so \
$RPM_BUILD_ROOT/%{_libdir}/crash/extensions
%if %build_gcore
install -m 0644 extensions/gcore.so $RPM_BUILD_ROOT/%{_libdir}/crash/extensions
%endif
%if 0%{?build_kmp}
# memory driver module
export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
export INSTALL_MOD_DIR=updates
for flavor in %flavors_to_build; do
make -C /usr/src/linux-obj/%arch/$flavor modules_install \
M=$PWD/kbuild/$flavor
done
%endif
%files
%defattr(-,root,root)
%{_bindir}/crash
%{_mandir}/man8/crash.8*
%license COPYING3
%doc README README.SUSE
%dir %{_libdir}/crash
%dir %{_libdir}/crash/extensions
%{_libdir}/crash/extensions/dminfo.so
%{_libdir}/crash/extensions/snap.so
%files devel
%defattr(-,root,root)
%{_includedir}/*
%files doc
%defattr(-,root,root)
%doc crash_whitepaper/*
%if %build_gcore
%files gcore
%defattr(-,root,root)
%{_libdir}/crash/extensions/gcore.so
%doc extensions/README.gcore
%endif
%changelog

View File

@ -0,0 +1,13 @@
---
CFLAGS.extra | 1 +
LDFLAGS.extra | 1 +
2 files changed, 2 insertions(+)
--- /dev/null
+++ b/CFLAGS.extra
@@ -0,0 +1 @@
+-DLZO
--- /dev/null
+++ b/LDFLAGS.extra
@@ -0,0 +1 @@
+-llzo2

View File

@ -0,0 +1,21 @@
From: Petr Tesarik <ptesarik@suse.cz>
Subject: enably snappy support
Upstream: never, configurable default
Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
---
CFLAGS.extra | 2 +-
LDFLAGS.extra | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
--- a/CFLAGS.extra
+++ b/CFLAGS.extra
@@ -1 +1 @@
--DLZO
+-DLZO -DSNAPPY
--- a/LDFLAGS.extra
+++ b/LDFLAGS.extra
@@ -1 +1 @@
--llzo2
+-llzo2 -lsnappy

BIN
crash_whitepaper-2003.tar.bz2 (Stored with Git LFS) Normal file

Binary file not shown.

6
depmod.sh Normal file
View File

@ -0,0 +1,6 @@
# Need to call depmod when the list of modules changes
for kernelrelease in $KERNELRELEASES; do
if [ -e /boot/System.map-$kernelrelease ]; then
depmod -a -F /boot/System.map-$kernelrelease $kernelrelease
fi
done

BIN
gcore-2023-02-28.tar.bz2 (Stored with Git LFS) Normal file

Binary file not shown.

BIN
gdb-10.2.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

BIN
gdb-10.2.tar.gz.sig Normal file

Binary file not shown.

10
get-kernel-flavors.sh Normal file
View File

@ -0,0 +1,10 @@
#! /bin/sh
arch=$1
flavors=
for flavor in $(ls /usr/src/linux-obj/$arch 2>/dev/null); do
if [ "$flavor" = um ]; then
continue
fi
flavors="$flavors $flavor"
done
echo $flavors

BIN
gnu.keyring Normal file

Binary file not shown.

25
mkinitrd.sh Normal file
View File

@ -0,0 +1,25 @@
# If one of the modules in this package is in the initrd,
# we need to recreate the initrd.
if [ -e /etc/sysconfig/kernel -a -f /etc/fstab ]; then
source /etc/sysconfig/kernel
run_mkinitrd=
for module in $INITRD_MODULES; do
case " $MODULES " in
*" $module "*)
run_mkinitrd=1
break ;;
esac
done
if [ -n "$run_mkinitrd" ]; then
for kernelrelease in $KERNELRELEASES; do
for image in vmlinuz image vmlinux linux bzImage; do
if [ -f /boot/$image-$kernelrelease ]; then
/sbin/mkinitrd -k /boot/$image-$kernelrelease \
-i /boot/initrd-$kernelrelease \
|| exit 1
fi
done
done
fi
fi

BIN
sial-scripts-2008-02-08.tar.bz2 (Stored with Git LFS) Normal file

Binary file not shown.