From ffec91b90c2debe80ff79a8b96707fe5c55cde6a Mon Sep 17 00:00:00 2001 From: Tao Liu Date: Thu, 13 Aug 2026 16:06:55 +1200 Subject: [PATCH] Release 3.0-15 Fix segmentation fault during executing trace dump -s Related: RHEL-235439 Signed-off-by: Tao Liu --- ...-fault-during-executing-trace-dump-s.patch | 103 ++++++++++++++++++ crash-trace-command.spec | 6 +- 2 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 0001-Fix-segmentation-fault-during-executing-trace-dump-s.patch diff --git a/0001-Fix-segmentation-fault-during-executing-trace-dump-s.patch b/0001-Fix-segmentation-fault-during-executing-trace-dump-s.patch new file mode 100644 index 0000000..e98a540 --- /dev/null +++ b/0001-Fix-segmentation-fault-during-executing-trace-dump-s.patch @@ -0,0 +1,103 @@ +From 2106a9d04020192f6f286171a060c4d2300059b7 Mon Sep 17 00:00:00 2001 +From: HATAYAMA Daisuke +Date: Wed, 5 Mar 2025 07:14:51 +0000 +Subject: [PATCH] Fix segmentation fault during executing trace dump -s + +Currently, trace dump -s results in segmentation fault on the vmcore +corresponding to kernel-core-6.13.5-200.fc41.x86_64: + + crash> trace dump -s trace_dump_dir + Segmentation fault (core dumped) + +This is caused by the commit c5913a960dfa07d64397e6b591e6f0d40ea0b503 +(trace: Support module memory layout change on Linux 6.4) that added +support of the module memory layout change on Linux kernel 6.4, where +the implementation on function dump_kallsyms() was overlooked. + +Fix this issue by introducing a new version of dump_kallsyms() for the +new module memory layout. +--- + trace.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++--- + 1 file changed, 50 insertions(+), 3 deletions(-) + +diff --git a/trace.c b/trace.c +index 9e51707da5f7..dc5252e56569 100644 +--- a/trace.c ++++ b/trace.c +@@ -1628,7 +1628,52 @@ static int dump_saved_cmdlines(const char *dump_tracing_dir) + return 0; + } + +-static int dump_kallsyms(const char *dump_tracing_dir) ++#ifdef MODULE_MEMORY ++static int dump_kallsyms_mod_v6_4(const char *dump_tracing_dir) ++{ ++ char path[PATH_MAX]; ++ FILE *out; ++ int i, t; ++ struct syment *sp; ++ ++ snprintf(path, sizeof(path), "%s/kallsyms", dump_tracing_dir); ++ out = fopen(path, "w"); ++ if (out == NULL) ++ return -1; ++ ++ for (sp = st->symtable; sp < st->symend; sp++) ++ fprintf(out, "%lx %c %s\n", sp->value, sp->type, sp->name); ++ ++ for (i = 0; i < st->mods_installed; i++) { ++ struct load_module *lm = &st->load_modules[i]; ++ ++ for_each_mod_mem_type(t) { ++ if (!lm->symtable[t]) ++ continue; ++ ++ for (sp = lm->symtable[t]; sp <= lm->symend[t]; sp++) { ++ if (!strncmp(sp->name, "_MODULE_", strlen("_MODULE_"))) ++ continue; ++ ++ /* Currently sp->type for modules is not trusted */ ++ fprintf(out, "%lx %c %s\t[%s]\n", sp->value, 'm', ++ sp->name, lm->mod_name); ++ } ++ } ++ } ++ ++ fclose(out); ++ return 0; ++} ++#else ++#define MODULE_MEMORY() (0) ++static int dump_kallsyms_mod_v6_4(const char *dump_tracing_dir) ++{ ++ return 0; ++} ++#endif ++ ++static int dump_kallsyms_legacy(const char *dump_tracing_dir) + { + char path[PATH_MAX]; + FILE *out; +@@ -1700,7 +1745,10 @@ static int populate_ftrace_dir_tree(struct trace_instance *ti, + + if (flags & FTRACE_DUMP_SYMBOLS) { + /* Dump all symbols of the kernel */ +- dump_kallsyms(root); ++ if (MODULE_MEMORY()) ++ dump_kallsyms_mod_v6_4(root); ++ else ++ dump_kallsyms_legacy(root); + } + + return TRUE; +@@ -2263,7 +2311,6 @@ static void __save_proc_kallsyms_mod_v6_4(void) + } + } + #else +-#define MODULE_MEMORY() (0) + static inline void __save_proc_kallsyms_mod_v6_4(void) + { + } +-- +2.54.0 + diff --git a/crash-trace-command.spec b/crash-trace-command.spec index c3da346..2fb2027 100644 --- a/crash-trace-command.spec +++ b/crash-trace-command.spec @@ -3,7 +3,7 @@ Summary: Trace extension module for the crash utility Name: crash-trace-command Version: 3.0 -Release: 14%{?dist} +Release: 15%{?dist} License: GPL-2.0-only Source: https://github.com/fujitsu/crash-trace/archive/v%{version}/%{name}-%{version}.tar.gz URL: https://github.com/fujitsu/crash-trace @@ -17,6 +17,7 @@ Requires: crash >= 7.2.0-2 Patch0001: 0001-Makefile-set-DT_SONAME-to-trace.so.patch Patch0002: 0002-Makefile-fix-build-failure-on-aarch64-and-ppc64le.patch Patch0003: 0001-trace-Support-module-memory-layout-change-on-Linux-6.patch +Patch0004: 0001-Fix-segmentation-fault-during-executing-trace-dump-s.patch %description Command for reading ftrace data from a dump file. @@ -38,6 +39,9 @@ install -m 0755 -t %{buildroot}%{_libdir}/crash/extensions %{_builddir}/%{repona %license COPYING %changelog +* Thu Aug 13 2026 Tao Liu - 3.0-15 +- Fix segmentation fault during executing trace dump -s + * Tue Oct 29 2024 Troy Dawson - 3.0-14 - Bump release for October 2024 mass rebuild: Resolves: RHEL-64018