summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2024-08-05 01:46:56 +0000
committerCoprDistGit <infra@openeuler.org>2024-08-05 01:46:56 +0000
commite85ec64e12a1b7c0c02ff368de5bd069612f312a (patch)
tree6072b6a094997c7efbd39b9a0f09643d0b1e52f0
parent352b720baadf67f58ca0c9514d1a4abcc5f8a9cb (diff)
automatic import of crash-gcore-commandopeneuler24.03_LTS
-rw-r--r--.gitignore1
-rw-r--r--0001-coredump-fix-building-failure-due-to-undefined-macro.patch60
-rw-r--r--0002-x86-fix-extend-gcore.so-taking-much-time-like-more-t.patch67
-rw-r--r--crash-gcore-command.spec63
-rw-r--r--sources1
5 files changed, 192 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..72ea140 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/crash-gcore-command-1.6.4.tar.gz
diff --git a/0001-coredump-fix-building-failure-due-to-undefined-macro.patch b/0001-coredump-fix-building-failure-due-to-undefined-macro.patch
new file mode 100644
index 0000000..3420893
--- /dev/null
+++ b/0001-coredump-fix-building-failure-due-to-undefined-macro.patch
@@ -0,0 +1,60 @@
+From 33f3c97f7d45c8bb1b43a8d551cb01a9873bb123 Mon Sep 17 00:00:00 2001
+From: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
+Date: Tue, 28 Feb 2023 03:59:16 -0500
+Subject: [PATCH 1/2] coredump: fix building failure due to undefined macros
+ MAPLE_TREE_{COUNT,GATHER}
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+As of the commit 13794ace3830bf0274fe7b2e0e579ad72e31848f (coredump:
+fix failure of executing gcore command due to introduction of maple
+tree management on vma list), gcore.so fails to get built with the
+following error messages with defs.h without maple tree API support:
+
+ libgcore/gcore_coredump.c:189:50: error: ‘MAPLE_TREE_COUNT’ undeclared (first use in this function); did you mean ‘RADIX_TREE_COUNT’?
+ 189 | entry_num = do_maple_tree(mm_mt, MAPLE_TREE_COUNT, NULL);
+ | ^~~~~~~~~~~~~~~~
+ | RADIX_TREE_COUNT
+ libgcore/gcore_coredump.c:189:50: note: each undeclared identifier is reported only once for each function it appears in
+ libgcore/gcore_coredump.c:191:38: error: ‘MAPLE_TREE_GATHER’ undeclared (first use in this function); did you mean ‘RADIX_TREE_GATHER’?
+ 191 | do_maple_tree(mm_mt, MAPLE_TREE_GATHER, entry_list);
+ | ^~~~~~~~~~~~~~~~~
+ | RADIX_TREE_GATHER
+
+This is caused by the missing macros MAPLE_TREE_COUNT and
+MAPLE_TREE_GATHER.
+
+To fix the issue, define the two macros within crash gcore so that
+build is successfully done expecting the resulting binary works well
+when it is ran against new crash utility that has maple tree API
+support.
+
+Signed-off-by: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
+Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
+---
+ src/libgcore/gcore_coredump.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/src/libgcore/gcore_coredump.c b/src/libgcore/gcore_coredump.c
+index fa744d4c26a5..8eece96777be 100644
+--- a/src/libgcore/gcore_coredump.c
++++ b/src/libgcore/gcore_coredump.c
+@@ -128,6 +128,14 @@ void gcore_readmem_user(ulong addr, void *buf, long size, char *type)
+ }
+ }
+
++#if !defined(MAPLE_TREE_COUNT)
++#define MAPLE_TREE_COUNT (1)
++#endif
++
++#if !defined(MAPLE_TREE_GATHER)
++#define MAPLE_TREE_GATHER (4)
++#endif
++
+ ulong __attribute__((weak))
+ do_maple_tree(ulong root, int flag, struct list_pair *lp)
+ {
+--
+2.45.1
+
diff --git a/0002-x86-fix-extend-gcore.so-taking-much-time-like-more-t.patch b/0002-x86-fix-extend-gcore.so-taking-much-time-like-more-t.patch
new file mode 100644
index 0000000..bc22d7e
--- /dev/null
+++ b/0002-x86-fix-extend-gcore.so-taking-much-time-like-more-t.patch
@@ -0,0 +1,67 @@
+From b3af265aa60251f282145bb0eee3b83d8a15ebb7 Mon Sep 17 00:00:00 2001
+From: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
+Date: Mon, 18 Sep 2023 20:45:11 -0400
+Subject: [PATCH 2/2] x86: fix extend gcore.so taking much time like more than
+ 1 hour when huge thread group is present
+
+extend gcore.so command takes lengthy time such as more than 1 hour
+when huge thread group is present.
+
+The root cause of this issue is that we never take into account time
+complexity of function gcore_arch_vsyscall_has_vm_alwaysdump_flag()
+sufficiently, which iterates the task list and vma lists of each task
+to detect existence of VM_ALWAYS flag in a given crash dump and so has
+O(nm) where the n is the length of the task list and the m is the
+total number of vma among all tasks.
+
+To fix this issue, skip this process for the kernels whose version is
+equal to or larger than v3.4.0.
+
+Originally, this process was implemented to detect existence of
+VM_ALWAYS flag that was removed at the commit
+909af768e88867016f427264ae39d27a57b6a8ed (coredump: remove
+VM_ALWAYSDUMP flag) included at Linux kernel v3.4. However, the base
+kernel version of RHEL7.0 GA is 3.10.0-123.el7. Hence, the kernels for
+RHEL7 and later have included the commit. For RHEL7 and later, it's
+sufficient to conclude absence of the flag by checking kernel version
+of a given crash dump.
+
+The issue could still remain on RHEL6 and older, but we think it's
+acceptable because today we rarely handle crash dump files of RHEL6
+and older.
+
+Signed-off-by: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
+Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
+---
+ src/libgcore/gcore_x86.c | 15 +++++++++++++++
+ 1 file changed, 15 insertions(+)
+
+diff --git a/src/libgcore/gcore_x86.c b/src/libgcore/gcore_x86.c
+index 8878f79d4c08..3ddf5109ade0 100644
+--- a/src/libgcore/gcore_x86.c
++++ b/src/libgcore/gcore_x86.c
+@@ -2502,6 +2502,21 @@ int gcore_arch_vsyscall_has_vm_alwaysdump_flag(void)
+ struct task_context *tc;
+ int i;
+
++ /*
++ * The commit 909af768e88867016f427264ae39d27a57b6a8ed
++ * (coredump: remove VM_ALWAYSDUMP flag) of the Linux kernel
++ * was merged at v3.4. We can say VM_ALWAYSDUMP flag doesn't
++ * exist for the version 3.4.0 or later. The base kernel
++ * version of RHEL7.0 GA is 3.10.0-123.el7. Hence, this
++ * condition is expected to match RHEL7 and later RHEL major
++ * versions. On the other hand, the commit
++ * 909af768e88867016f427264ae39d27a57b6a8ed was backported
++ * into the kernel package in RHEL6 and the exploring code is
++ * still needed.
++ */
++ if (THIS_KERNEL_VERSION >= LINUX(3, 4, 0))
++ return FALSE;
++
+ /*
+ * For simplicity, consider that VM_ALWAYSDUMP was already not
+ * present when maple tree was introduced.
+--
+2.45.1
+
diff --git a/crash-gcore-command.spec b/crash-gcore-command.spec
new file mode 100644
index 0000000..1dd2b54
--- /dev/null
+++ b/crash-gcore-command.spec
@@ -0,0 +1,63 @@
+%global reponame crash-gcore
+
+Summary: Gcore extension module for the crash utility
+Name: crash-gcore-command
+Version: 1.6.4
+Release: 1%{?dist}
+License: GPLv2
+Source0: https://github.com/fujitsu/crash-gcore/archive/v%{version}/%{name}-%{version}.tar.gz
+URL: https://github.com/fujitsu/crash-gcore
+ExclusiveOS: Linux
+ExclusiveArch: aarch64 ppc64le x86_64
+BuildRequires: crash-devel >= 5.1.5
+BuildRequires: gcc
+Requires: crash >= 5.1.5
+
+Patch0: 0001-coredump-fix-building-failure-due-to-undefined-macro.patch
+Patch1: 0002-x86-fix-extend-gcore.so-taking-much-time-like-more-t.patch
+
+%description
+Command for creating a core dump file of a user-space task that was
+running in a kernel dump file.
+
+%prep
+%autosetup -n %{reponame}-%{version} -p1
+
+%build
+%make_build CFLAGS="%{optflags} -Wl,-z,now" -C src -f gcore.mk
+
+%install
+install -m 0755 -d %{buildroot}%{_libdir}/crash/extensions
+install -m 0755 -t %{buildroot}%{_libdir}/crash/extensions %{_builddir}/%{reponame}-%{version}/src/gcore.so
+
+%files
+%dir %{_libdir}/crash
+%dir %{_libdir}/crash/extensions
+%{_libdir}/crash/extensions/gcore.so
+%license COPYING
+
+%changelog
+* Fri Jul 05 2024 Lianbo Jiang <lijiang@redhat.com> - 1.6.4-1
+- Rebase to upstream 1.6.4
+
+* Fri Nov 18 2022 Lianbo Jiang <lijiang@redhat.com> - 1.6.3-2
+- Update to the latest commit d2795659986d
+
+* Mon Dec 27 2021 Lianbo Jiang <lijiang@redhat.com> - 1.6.3-1
+- Rebase to upstream 1.6.3
+
+* Wed Dec 15 2021 Lianbo Jiang <lijiang@redhat.com> - 1.6.2-5
+- Rebuild for the compatibility issue
+
+* Tue Dec 07 2021 Lianbo Jiang <lijiang@redhat.com> - 1.6.2-4
+- Fix the hardening issue "FAIL: bind-now test because not linked with -Wl,-z,now"
+
+* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 1.6.2-3
+- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
+ Related: rhbz#1991688
+
+* Thu Apr 15 2021 Mohan Boddu <mboddu@redhat.com> - 1.6.2-2
+- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
+
+* Fri Jan 22 2021 HATAYAMA Daisuke <d.hatayama@fujitsu.com> - 1.6.2-1
+- Initial crash-gcore-command package
diff --git a/sources b/sources
new file mode 100644
index 0000000..eaff044
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+2659f63d447013b44fea0950e92bb77c crash-gcore-command-1.6.4.tar.gz