Update makedumpfile to 1.7.0

Signed-off-by: Coiby Xu <coxu@redhat.com>
This commit is contained in:
Coiby Xu 2021-11-01 14:13:16 +08:00
parent 6936fbc1b2
commit 8b9948df33
5 changed files with 2 additions and 154 deletions

View File

@ -1,42 +0,0 @@
From 646456862df8926ba10dd7330abf3bf0f887e1b6 Mon Sep 17 00:00:00 2001
From: Kazuhito Hagio <k-hagio-ab@nec.com>
Date: Wed, 26 May 2021 14:31:26 +0900
Subject: [PATCH] Increase SECTION_MAP_LAST_BIT to 5
* Required for kernel 5.12
Kernel commit 1f90a3477df3 ("mm: teach pfn_to_online_page() about
ZONE_DEVICE section collisions") added a section flag
(SECTION_TAINT_ZONE_DEVICE) and causes makedumpfile an error on
some machines like this:
__vtop4_x86_64: Can't get a valid pmd_pte.
readmem: Can't convert a virtual address(ffffe2bdc2000000) to physical address.
readmem: type_addr: 0, addr:ffffe2bdc2000000, size:32768
__exclude_unnecessary_pages: Can't read the buffer of struct page.
create_2nd_bitmap: Can't exclude unnecessary pages.
Increase SECTION_MAP_LAST_BIT to 5 to fix this. The bit had not
been used until the change, so we can just increase the value.
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
---
makedumpfile.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/makedumpfile-1.6.9/makedumpfile.h b/makedumpfile-1.6.9/makedumpfile.h
index 93aa774..79046f2 100644
--- a/makedumpfile-1.6.9/makedumpfile.h
+++ b/makedumpfile-1.6.9/makedumpfile.h
@@ -195,7 +195,7 @@ isAnon(unsigned long mapping)
* 2. it has been verified that (1UL<<2) was never set, so it is
* safe to mask that bit off even in old kernels.
*/
-#define SECTION_MAP_LAST_BIT (1UL<<4)
+#define SECTION_MAP_LAST_BIT (1UL<<5)
#define SECTION_MAP_MASK (~(SECTION_MAP_LAST_BIT-1))
#define NR_SECTION_ROOTS() divideup(num_section, SECTIONS_PER_ROOT())
#define SECTION_NR_TO_PFN(sec) ((sec) << PFN_SECTION_SHIFT())
--
2.29.2

View File

@ -1,60 +0,0 @@
From 38d921a2ef50ebd36258097553626443ffe27496 Mon Sep 17 00:00:00 2001
From: Coiby Xu <coxu@redhat.com>
Date: Tue, 15 Jun 2021 18:26:31 +0800
Subject: [PATCH] check for invalid physical address of /proc/kcore
when finding max_paddr
Kernel commit 464920104bf7adac12722035bfefb3d772eb04d8 ("/proc/kcore:
update physical address for kcore ram and text") sets an invalid paddr
(0xffffffffffffffff = -1) for PT_LOAD segments of not direct mapped
regions:
$ readelf -l /proc/kcore
...
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
NOTE 0x0000000000000120 0x0000000000000000 0x0000000000000000
0x0000000000002320 0x0000000000000000 0x0
LOAD 0x1000000000010000 0xd000000000000000 0xffffffffffffffff
^^^^^^^^^^^^^^^^^^
0x0001f80000000000 0x0001f80000000000 RWE 0x10000
makedumpfile uses max_paddr to calculate the number of sections for
sparse memory model thus wrong number is obtained based on max_paddr
(-1). This error could lead to the failure of copying /proc/kcore
for RHEL-8.5 on ppc64le machine [1]:
$ makedumpfile /proc/kcore vmcore1
get_mem_section: Could not validate mem_section.
get_mm_sparsemem: Can't get the address of mem_section.
makedumpfile Failed.
Let's check if the phys_start of the segment is a valid physical
address to fix this problem.
[1] https://bugzilla.redhat.com/show_bug.cgi?id=1965267
Reported-by: Xiaoying Yan <yiyan@redhat.com>
Signed-off-by: Coiby Xu <coxu@redhat.com>
---
elf_info.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/makedumpfile-1.6.9/elf_info.c b/makedumpfile-1.6.9/elf_info.c
index e8affb7..bc24083 100644
--- a/makedumpfile-1.6.9/elf_info.c
+++ b/makedumpfile-1.6.9/elf_info.c
@@ -628,7 +628,7 @@ get_max_paddr(void)
for (i = 0; i < num_pt_loads; i++) {
pls = &pt_loads[i];
- if (max_paddr < pls->phys_end)
+ if (pls->phys_start != NOT_PADDR && max_paddr < pls->phys_end)
max_paddr = pls->phys_end;
}
return max_paddr;
--
2.29.2

View File

@ -1,43 +0,0 @@
From 9a6f589d99dcef114c89fde992157f5467028c8f Mon Sep 17 00:00:00 2001
From: Tao Liu <ltao@redhat.com>
Date: Fri, 18 Jun 2021 18:28:04 +0800
Subject: [PATCH] check for invalid physical address of /proc/kcore
when making ELF dumpfile
Previously when executing makedumpfile with -E option against
/proc/kcore, makedumpfile will fail:
# makedumpfile -E -d 31 /proc/kcore kcore.dump
...
write_elf_load_segment: Can't convert physaddr(ffffffffffffffff) to an offset.
makedumpfile Failed.
It's because /proc/kcore contains PT_LOAD program headers which have
physaddr (0xffffffffffffffff). With -E option, makedumpfile will
try to convert the physaddr to an offset and fails.
Skip the PT_LOAD program headers which have such physaddr.
Signed-off-by: Tao Liu <ltao@redhat.com>
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
---
makedumpfile.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/makedumpfile-1.6.9/makedumpfile.c b/makedumpfile-1.6.9/makedumpfile.c
index 894c88e..fcb571f 100644
--- a/makedumpfile-1.6.9/makedumpfile.c
+++ b/makedumpfile-1.6.9/makedumpfile.c
@@ -7764,7 +7764,7 @@ write_elf_pages_cyclic(struct cache_data *cd_header, struct cache_data *cd_page)
if (!get_phdr_memory(i, &load))
return FALSE;
- if (load.p_type != PT_LOAD)
+ if (load.p_type != PT_LOAD || load.p_paddr == NOT_PADDR)
continue;
off_memory= load.p_offset;
--
2.29.2

View File

@ -1,6 +1,6 @@
%global eppic_ver e8844d3793471163ae4a56d8f95897be9e5bd554
%global eppic_shortver %(c=%{eppic_ver}; echo ${c:0:7})
%global mkdf_ver 1.6.9
%global mkdf_ver 1.7.0
%global mkdf_shortver %(c=%{mkdf_ver}; echo ${c:0:7})
Name: kexec-tools
@ -108,9 +108,6 @@ Requires: systemd-udev%{?_isa}
#
# Patches 601 onward are generic patches
#
Patch601: ./kexec-tools-2.0.22-makedumpfile-Increase-SECTION_MAP_LAST_BIT-to-5.patch
Patch602: ./kexec-tools-2.0.22-makedumpfile-check-for-invalid-physical-address-proc-kcore-when-finding-max_paddr.patch
Patch603: ./kexec-tools-2.0.22-makedumpfile-check-for-invalid-physical-address-proc-kcore-when-making-ELF-dumpfile.patch
%description
kexec-tools provides /sbin/kexec binary that facilitates a new
@ -126,10 +123,6 @@ mkdir -p -m755 kcp
tar -z -x -v -f %{SOURCE9}
tar -z -x -v -f %{SOURCE19}
%patch601 -p1
%patch602 -p1
%patch603 -p1
%ifarch ppc
%define archdef ARCH=ppc
%endif

View File

@ -1,3 +1,3 @@
SHA512 (eppic-e8844d3.tar.gz) = d86b9f90c57e694107272d8f71b87f66a30743b9530480fb6f665026bbada4c6b0205a83e40b5383663a945681cfbfcf1ee79469fc219ddf679473c4b2290763
SHA512 (kexec-tools-2.0.22.tar.xz) = 7580860f272eee5af52139809f12961e5a5d3a65f4e191183ca9c845410425d25818945ac14ed04a60e6ce474dc2656fc6a14041177b0bf703f450820c7d6aba
SHA512 (makedumpfile-1.6.9.tar.gz) = 9982985498ae641d390c3b87d92aecd263a502f1a4a9e96e145d86d8778b9e778e4ee98034ef4dbe12ed5586c57278917ea5f3c9ae2989ad1ac051215e03b3d9
SHA512 (makedumpfile-1.7.0.tar.gz) = 579a1fb79d023a1419fc8612a02a04dda3e3b3d72455566433ab6bec08627aa9a176c55566393a081a7aae3fd0543800196596b25445b21b16346556723e9cf7