import crash-trace-command-3.0-13.el10

c10-beta imports/c10-beta/crash-trace-command-3.0-13.el10
MSVSphere Packaging Team 3 months ago
commit 39358b7972
Signed by: sys_gitsync
GPG Key ID: B2B0B9F29E528FE8

@ -0,0 +1 @@
b9636e856f96e77b2047e12c3d87991ec88b067c SOURCES/crash-trace-command-3.0.tar.gz

1
.gitignore vendored

@ -0,0 +1 @@
SOURCES/crash-trace-command-3.0.tar.gz

@ -0,0 +1,37 @@
From 153629a96b07a8ae96b0b28cce100fde9ea1398d Mon Sep 17 00:00:00 2001
From: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
Date: Thu, 28 Jan 2021 00:08:35 -0500
Subject: [PATCH 1/2] Makefile: set DT_SONAME to trace.so
Fedora never requires SONAME versioning for plugins according to the
Packaging Guidelines:
https://docs.fedoraproject.org/en-US/packaging-guidelines/#_downstream_so_name_versioning
In cases where upstream ships unversioned .so library (so this is
not needed for plugins, drivers, etc.), the packager MUST try to
convince upstream to start versioning it.
On the other hand, fedpkg lint still prints warning if the shared
library doesn't have DT_SONAME. To surpress this, we set DT_SONAME
field to trace.so for in case.
Signed-off-by: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index a9e0a21..b4573b4 100755
--- a/Makefile
+++ b/Makefile
@@ -28,4 +28,4 @@ INCDIR=/usr/include/crash
all: trace.so
trace.so: $(INCDIR)/defs.h trace.c
- gcc $(RPM_OPT_FLAGS) -Wall -I$(INCDIR) -nostartfiles -shared -rdynamic -o trace.so trace.c -fPIC -D$(TARGET) $(TARGET_CFLAGS)
+ gcc $(RPM_OPT_FLAGS) -Wall -I$(INCDIR) -nostartfiles -shared -rdynamic -Wl,-z,now -Wl,-soname,trace.so -o trace.so trace.c -fPIC -D$(TARGET) $(TARGET_CFLAGS)
--
2.29.2

@ -0,0 +1,125 @@
From c5913a960dfa07d64397e6b591e6f0d40ea0b503 Mon Sep 17 00:00:00 2001
From: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
Date: Tue, 26 Sep 2023 02:55:49 -0400
Subject: [PATCH] trace: Support module memory layout change on Linux 6.4
Linux kernel introduced new module memory layout on Linux 6.4 at the
commit ac3b432 (module: replace module_layout with module_memory) and
crash utility supported it at the commit 7750e61 (Support module
memory layout change on Linux 6.4).
In the change, crash utility changed definition and usage of data
structure for kernel modules. However, crash trace also refers to the
data structures. As a result, with the crash utility with the change,
crash trace command results in segmentation fault:
crash> extend trace.so
/usr/lib64/crash/extensions/trace.so: shared object loaded
crash> trace show
Segmentation fault (core dumped)
To fix this issue, let's support the new definition and usage of
struct load_module in crash trace. This is at the same time intended
for crash trace to support the new module memory layout of the Linux
kernel.
On the other hand, there is still inevitable dependency left to size
of struct load_module, one of the data structures of crash utility, in
crash trace. struct symbol_table_data holds an array of objects of
struct load_module in member variable load_modules and we need to know
size of struct load_module in advance to refer to its elements.
struct symbol_table_data {
...snip...
int mods_installed;
struct load_module *current;
struct load_module *load_modules;
Due to this, once crash trace is built with the defs.h including
change of size of struct load_module, it can never be used with the
older crash utility that was built with a different size of struct
load_module.
Because there is no preferable way to tackle the dependency without
altering implementation of crash utility, we have no choice but accept
breaking backward-compatibility for the time being.
Signed-off-by: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
---
trace.c | 49 +++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 45 insertions(+), 4 deletions(-)
diff --git a/trace.c b/trace.c
index c33907f..9e51707 100644
--- a/trace.c
+++ b/trace.c
@@ -2219,14 +2219,11 @@ fail:
return -1;
}
-static int save_proc_kallsyms(int fd)
+static void __save_proc_kallsyms_mod_legacy(void)
{
int i;
struct syment *sp;
- for (sp = st->symtable; sp < st->symend; sp++)
- tmp_fprintf("%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];
@@ -2239,6 +2236,50 @@ static int save_proc_kallsyms(int fd)
sp->name, lm->mod_name);
}
}
+}
+
+#ifdef MODULE_MEMORY
+static void __save_proc_kallsyms_mod_v6_4(void)
+{
+ int i, t;
+ struct syment *sp;
+
+ 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 */
+ tmp_fprintf("%lx %c %s\t[%s]\n", sp->value, 'm',
+ sp->name, lm->mod_name);
+ }
+ }
+ }
+}
+#else
+#define MODULE_MEMORY() (0)
+static inline void __save_proc_kallsyms_mod_v6_4(void)
+{
+}
+#endif
+
+static int save_proc_kallsyms(int fd)
+{
+ struct syment *sp;
+
+ for (sp = st->symtable; sp < st->symend; sp++)
+ tmp_fprintf("%lx %c %s\n", sp->value, sp->type, sp->name);
+
+ if (MODULE_MEMORY())
+ __save_proc_kallsyms_mod_v6_4();
+ else
+ __save_proc_kallsyms_mod_legacy();
if (tmp_file_record_size4(fd))
return -1;
--
2.40.1

@ -0,0 +1,50 @@
From 17c35d075f067d80fee112ae18365b8defa2ca5a Mon Sep 17 00:00:00 2001
From: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
Date: Fri, 19 Feb 2021 11:38:59 +0900
Subject: [PATCH 2/2] Makefile: fix build failure on aarch64 and ppc64le
Currently, there is build failure on aarch64 and ppc64le as follows:
gcc -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mcpu=power8 -mtune=power8 -fasynchronous-unwind-tables -fstack-clash-protection -Wall -I/usr/include/crash -nostartfiles -shared -rdynamic -o trace.so trace.c -fPIC -D
gcc: error: macro name missing after '-D'
The failure is caused by missing arguments for -D option because
TARGET variable is empty.
This commit fixes the issue by defining TARGET variable properly
according to aarch64 and ppc64le.
Signed-off-by: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
---
Makefile | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/Makefile b/Makefile
index b4573b4..0d35d4f 100755
--- a/Makefile
+++ b/Makefile
@@ -6,6 +6,10 @@ ifeq ($(shell arch), ppc64)
TARGET=PPC64
TARGET_CFLAGS=-m64
endif
+ifeq ($(shell arch), ppc64le)
+ TARGET=PPC64
+ TARGET_CFLAGS=-m64
+endif
ifeq ($(shell arch), ia64)
TARGET=IA64
TARGET_CFLAGS=
@@ -22,6 +26,10 @@ ifeq ($(shell arch), s390)
TARGET=S390
TARGET_CFLAGS=
endif
+ifeq ($(shell arch), aarch64)
+ TARGET=ARM64
+ TARGET_CFLAGS=
+endif
INCDIR=/usr/include/crash
--
2.29.2

@ -0,0 +1,79 @@
%global reponame crash-trace
Summary: Trace extension module for the crash utility
Name: crash-trace-command
Version: 3.0
Release: 13%{?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
ExclusiveOS: Linux
ExclusiveArch: aarch64 ppc64le s390x x86_64
BuildRequires: crash-devel >= 7.2.0-2
BuildRequires: gcc
Requires: trace-cmd
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
%description
Command for reading ftrace data from a dump file.
%prep
%autosetup -n %{reponame}-%{version}
%build
%make_build
%install
install -m 0755 -d %{buildroot}%{_libdir}/crash/extensions
install -m 0755 -t %{buildroot}%{_libdir}/crash/extensions %{_builddir}/%{reponame}-%{version}/trace.so
%files
%dir %{_libdir}/crash
%dir %{_libdir}/crash/extensions
%{_libdir}/crash/extensions/trace.so
%license COPYING
%changelog
* Wed Jul 10 2024 Tao Liu <ltao@redhat.com> - 3.0-13
- trace: Support module memory layout change on Linux 6.4
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 3.0-12
- Bump release for June 2024 mass rebuild
* Wed Apr 24 2024 Tao Liu <ltao@redhat.com> - 3.0-11
- Fix the hardening issue "FAIL: bind-now test because not linked with -Wl,-z,now"
- add gating.yaml
* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 3.0-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Fri Jan 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 3.0-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Tue Sep 12 2023 HATAYAMA Daisuke <d.hatayama@fujitsu.com> - 3.0-8
- Migrate to SPDX license format
* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 3.0-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 3.0-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Wed Jul 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 3.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Wed Jan 19 2022 Fedora Release Engineering <releng@fedoraproject.org> - 3.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Fri Feb 19 2021 HATAYAMA Daisuke <d.hatayama@fujitsu.com> - 3.0-2
- Makefile: set DT_SONAME to trace.so
- Makefile: fix build failure on aarch64 and ppc64le
* Fri Jan 22 2021 HATAYAMA Daisuke <d.hatayama@fujitsu.com> - 3.0-1
- Initial crash-trace-command package
Loading…
Cancel
Save