Workaround for segfault by "makedumpfile --mem-usage" on PPC64
Resolves: RHEL-41117 Upstream: Fedora Conflict: None Signed-off-by: Lichen Liu <lichliu@redhat.com>
This commit is contained in:
parent
67a3085fff
commit
f812cb511f
@ -0,0 +1,58 @@
|
||||
From 900190de6b67b2de410cfc8023c1b198a416ceb3 Mon Sep 17 00:00:00 2001
|
||||
From: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Date: Mon, 22 Jul 2024 14:31:43 +0900
|
||||
Subject: [PATCH] [PATCH] Workaround for segfault by "makedumpfile --mem-usage"
|
||||
on PPC64
|
||||
|
||||
"makedumpfile --mem-usage /proc/kcore" can cause a segmentation fault on
|
||||
PPC64, because the readmem() of the following code path uses cache
|
||||
before it's initialized in initial().
|
||||
|
||||
show_mem_usage
|
||||
get_page_offset
|
||||
get_versiondep_info_ppc64
|
||||
readmem
|
||||
...
|
||||
initial
|
||||
cache_init
|
||||
|
||||
The get_page_offset() is needed to get vmcoreinfo from /proc/kcore data,
|
||||
so we can avoid calling it when a vmcoreinfo exists in the ELF NOTE
|
||||
segment of /proc/kcore, i.e. on Linux 4.19 and later.
|
||||
|
||||
(Note: for older kernels, we will need another way to fix it.)
|
||||
|
||||
Reported-by: Lichen Liu <lichliu@redhat.com>
|
||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
---
|
||||
makedumpfile.c | 12 ++++++------
|
||||
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/makedumpfile.c b/makedumpfile.c
|
||||
index 5b34712..7d1dfcc 100644
|
||||
--- a/makedumpfile.c
|
||||
+++ b/makedumpfile.c
|
||||
@@ -12019,14 +12019,14 @@ int show_mem_usage(void)
|
||||
DEBUG_MSG("Read vmcoreinfo from NOTE segment: %d\n", vmcoreinfo);
|
||||
}
|
||||
|
||||
- if (!get_page_offset())
|
||||
- return FALSE;
|
||||
+ if (!vmcoreinfo) {
|
||||
+ if (!get_page_offset())
|
||||
+ return FALSE;
|
||||
|
||||
- /* paddr_to_vaddr() on arm64 needs phys_base. */
|
||||
- if (!get_phys_base())
|
||||
- return FALSE;
|
||||
+ /* paddr_to_vaddr() on arm64 needs phys_base. */
|
||||
+ if (!get_phys_base())
|
||||
+ return FALSE;
|
||||
|
||||
- if (!vmcoreinfo) {
|
||||
if (!get_sys_kernel_vmcoreinfo(&vmcoreinfo_addr, &vmcoreinfo_len))
|
||||
return FALSE;
|
||||
|
||||
--
|
||||
2.45.2
|
||||
|
||||
@ -29,6 +29,7 @@ BuildRequires: gettext
|
||||
|
||||
Patch0: 0001-PATCH-Fix-failure-of-hugetlb-pages-exclusion-on-Linu.patch
|
||||
Patch1: 0002-PATCH-Fix-wrong-exclusion-of-Slab-pages-on-Linux-6.1.patch
|
||||
Patch2: 0001-PATCH-Workaround-for-segfault-by-makedumpfile-mem-us.patch
|
||||
|
||||
%description
|
||||
makedumpfile is a tool to compress and filter out unneeded data from kernel
|
||||
|
||||
Loading…
Reference in New Issue
Block a user