Rebase makedumpfile to 1.7.2

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2173791
Upstream: makedumpfile

Signed-off-by: Pingfan Liu <piliu@redhat.com>
This commit is contained in:
Pingfan Liu 2023-04-04 11:57:04 +08:00
parent 595b588d52
commit 1de6db08f4
5 changed files with 21 additions and 99 deletions

4
.gitignore vendored
View File

@ -1,6 +1,6 @@
SOURCES/1.7.1.tar.gz
SOURCES/1.7.2.tar.gz
SOURCES/eppic_050615.tar.gz
SOURCES/kexec-tools-2.0.25.tar.xz
/1.7.1.tar.gz
/eppic_050615.tar.gz
/kexec-tools-2.0.25.tar.xz
/1.7.2.tar.gz

View File

@ -1,76 +0,0 @@
commit 6d0d95ecc04a70f8448d562ff0fbbae237f5c929
Author: Kazuhito Hagio <k-hagio-ab@nec.com>
Date: Thu Apr 21 08:58:29 2022 +0900
[PATCH] Avoid false-positive mem_section validation with vmlinux
Currently get_mem_section() validates if SYMBOL(mem_section) is the address
of the mem_section array first. But there was a report that the first
validation wrongly returned TRUE with -x vmlinux and SPARSEMEM_EXTREME
(4.15+) on s390x. This leads to crash failing statup with the following
seek error:
crash: seek error: kernel virtual address: 67fffc2800 type: "memory section root table"
Skip the first validation when satisfying the conditions.
Reported-by: Dave Wysochanski <dwysocha@redhat.com>
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
Reviewed-and-Tested-by: Philipp Rudo <prudo@redhat.com>
Reviewed-by: Pingfan Liu <piliu@redhat.com>
diff --git a/makedumpfile-1.7.1/makedumpfile.c b/makedumpfile-1.7.1/makedumpfile.c
index a2f45c84cee3ba57ce3d3cf3f1905e6a03f4fd09..65d1c7c2f02c9ae8ead9de0f0217235fe72b3ca7 100644
--- a/makedumpfile-1.7.1/makedumpfile.c
+++ b/makedumpfile-1.7.1/makedumpfile.c
@@ -3698,6 +3698,22 @@ validate_mem_section(unsigned long *mem_sec,
return ret;
}
+/*
+ * SYMBOL(mem_section) varies with the combination of memory model and
+ * its source:
+ *
+ * SPARSEMEM
+ * vmcoreinfo: address of mem_section root array
+ * -x vmlinux: address of mem_section root array
+ *
+ * SPARSEMEM_EXTREME v1
+ * vmcoreinfo: address of mem_section root array
+ * -x vmlinux: address of mem_section root array
+ *
+ * SPARSEMEM_EXTREME v2 (with 83e3c48729d9 and a0b1280368d1) 4.15+
+ * vmcoreinfo: address of mem_section root array
+ * -x vmlinux: address of pointer to mem_section root array
+ */
static int
get_mem_section(unsigned int mem_section_size, unsigned long *mem_maps,
unsigned int num_section)
@@ -3710,12 +3726,27 @@ get_mem_section(unsigned int mem_section_size, unsigned long *mem_maps,
strerror(errno));
return FALSE;
}
+
+ /*
+ * There was a report that the first validation wrongly returned TRUE
+ * with -x vmlinux and SPARSEMEM_EXTREME v2 on s390x, so skip it.
+ * Howerver, leave the fallback validation as it is for the -i option.
+ */
+ if (is_sparsemem_extreme() && info->name_vmlinux) {
+ unsigned long flag = 0;
+ if (get_symbol_type_name("mem_section", DWARF_INFO_GET_SYMBOL_TYPE,
+ NULL, &flag)
+ && !(flag & TYPE_ARRAY))
+ goto skip_1st_validation;
+ }
+
ret = validate_mem_section(mem_sec, SYMBOL(mem_section),
mem_section_size, mem_maps, num_section);
if (!ret && is_sparsemem_extreme()) {
unsigned long mem_section_ptr;
+skip_1st_validation:
if (!readmem(VADDR, SYMBOL(mem_section), &mem_section_ptr,
sizeof(mem_section_ptr)))
goto out;

View File

@ -13,7 +13,7 @@ Source4: kdump.sysconfig.i386
Source5: kdump.sysconfig.ppc64
Source7: mkdumprd
Source8: gen-kdump-conf.sh
Source9: https://github.com/makedumpfile/makedumpfile/archive/1.7.1.tar.gz
Source9: https://github.com/makedumpfile/makedumpfile/archive/1.7.2.tar.gz
Source10: kexec-kdump-howto.txt
Source12: mkdumprd.8
Source13: 98-kexec.rules
@ -111,7 +111,6 @@ Patch602: rhelonly-kexec-tools-2.0.18-eppic-fix-issues-with-hardening-flags.patc
# Patches 701 onward for makedumpfile
Patch701: rhelonly-kexec-tools-2.0.20-makedumpfile-arm64-Add-support-for-ARMv8.2-LVA-52-bi.patch
Patch702: kexec-tools-2.0.24-makedumpfile-Avoid_false_positive_mem_section_validation_with_vmlinux.patch
%description
kexec-tools provides /usr/sbin/kexec binary that facilitates a new
@ -131,7 +130,6 @@ tar -z -x -v -f %{SOURCE19}
%patch602 -p1
%patch701 -p1
%patch702 -p1
%ifarch ppc
%define archdef ARCH=ppc
@ -164,8 +162,8 @@ cp %{SOURCE31} .
make
%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64
make -C eppic/libeppic
make -C makedumpfile-1.7.1 LINKTYPE=dynamic USELZO=on USESNAPPY=on USEZSTD=on
make -C makedumpfile-1.7.1 LDFLAGS="$LDFLAGS -I../eppic/libeppic -L../eppic/libeppic" eppic_makedumpfile.so
make -C makedumpfile-1.7.2 LINKTYPE=dynamic USELZO=on USESNAPPY=on USEZSTD=on
make -C makedumpfile-1.7.2 LDFLAGS="$LDFLAGS -I../eppic/libeppic -L../eppic/libeppic" eppic_makedumpfile.so
%endif
%install
@ -226,13 +224,13 @@ install -m 755 -D %{SOURCE32} $RPM_BUILD_ROOT%{_prefix}/lib/kernel/install.d/60-
%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64
install -m 755 makedumpfile-1.7.1/makedumpfile $RPM_BUILD_ROOT/usr/sbin/makedumpfile
install -m 644 makedumpfile-1.7.1/makedumpfile.8 $RPM_BUILD_ROOT/%{_mandir}/man8/makedumpfile.8
install -m 644 makedumpfile-1.7.1/makedumpfile.conf.5 $RPM_BUILD_ROOT/%{_mandir}/man5/makedumpfile.conf.5
install -m 644 makedumpfile-1.7.1/makedumpfile.conf $RPM_BUILD_ROOT/%{_sysconfdir}/makedumpfile.conf.sample
install -m 755 makedumpfile-1.7.1/eppic_makedumpfile.so $RPM_BUILD_ROOT/%{_libdir}/eppic_makedumpfile.so
install -m 755 makedumpfile-1.7.2/makedumpfile $RPM_BUILD_ROOT/usr/sbin/makedumpfile
install -m 644 makedumpfile-1.7.2/makedumpfile.8 $RPM_BUILD_ROOT/%{_mandir}/man8/makedumpfile.8
install -m 644 makedumpfile-1.7.2/makedumpfile.conf.5 $RPM_BUILD_ROOT/%{_mandir}/man5/makedumpfile.conf.5
install -m 644 makedumpfile-1.7.2/makedumpfile.conf $RPM_BUILD_ROOT/%{_sysconfdir}/makedumpfile.conf.sample
install -m 755 makedumpfile-1.7.2/eppic_makedumpfile.so $RPM_BUILD_ROOT/%{_libdir}/eppic_makedumpfile.so
mkdir -p $RPM_BUILD_ROOT/usr/share/makedumpfile/eppic_scripts/
install -m 644 makedumpfile-1.7.1/eppic_scripts/* $RPM_BUILD_ROOT/usr/share/makedumpfile/eppic_scripts/
install -m 644 makedumpfile-1.7.2/eppic_scripts/* $RPM_BUILD_ROOT/usr/share/makedumpfile/eppic_scripts/
%endif
%define remove_dracut_prefix() %(echo -n %1|sed 's/.*dracut-//g')

View File

@ -12,10 +12,10 @@ Signed-off-by: Pingfan Liu <piliu@redhat.com>
makedumpfile.h | 1 +
3 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/makedumpfile-1.7.1/arch/arm64.c b/makedumpfile-1.7.1/arch/arm64.c
diff --git a/makedumpfile-1.7.2/arch/arm64.c b/makedumpfile-1.7.2/arch/arm64.c
index 1072178..95beae6 100644
--- a/makedumpfile-1.7.1/arch/arm64.c
+++ b/makedumpfile-1.7.1/arch/arm64.c
--- a/makedumpfile-1.7.2/arch/arm64.c
+++ b/makedumpfile-1.7.2/arch/arm64.c
@@ -50,6 +50,7 @@ static int va_bits;
static int vabits_actual;
static int flipped_va;
@ -51,10 +51,10 @@ index 1072178..95beae6 100644
kimage_voffset = NUMBER(kimage_voffset);
info->section_size_bits = SECTIONS_SIZE_BITS;
diff --git a/makedumpfile-1.7.1/makedumpfile.c b/makedumpfile-1.7.1/makedumpfile.c
diff --git a/makedumpfile-1.7.2/makedumpfile.c b/makedumpfile-1.7.2/makedumpfile.c
index 3ad4443..018ea4c 100644
--- a/makedumpfile-1.7.1/makedumpfile.c
+++ b/makedumpfile-1.7.1/makedumpfile.c
--- a/makedumpfile-1.7.2/makedumpfile.c
+++ b/makedumpfile-1.7.2/makedumpfile.c
@@ -2417,6 +2417,7 @@ write_vmcoreinfo_data(void)
WRITE_NUMBER("HUGETLB_PAGE_DTOR", HUGETLB_PAGE_DTOR);
@ -71,10 +71,10 @@ index 3ad4443..018ea4c 100644
READ_NUMBER("VA_BITS", VA_BITS);
READ_NUMBER("TCR_EL1_T1SZ", TCR_EL1_T1SZ);
READ_NUMBER_UNSIGNED("PHYS_OFFSET", PHYS_OFFSET);
diff --git a/makedumpfile-1.7.1/makedumpfile.h b/makedumpfile-1.7.1/makedumpfile.h
diff --git a/makedumpfile-1.7.2/makedumpfile.h b/makedumpfile-1.7.2/makedumpfile.h
index e59239d..b6236dd 100644
--- a/makedumpfile-1.7.1/makedumpfile.h
+++ b/makedumpfile-1.7.1/makedumpfile.h
--- a/makedumpfile-1.7.2/makedumpfile.h
+++ b/makedumpfile-1.7.2/makedumpfile.h
@@ -2064,6 +2064,7 @@ struct number_table {
long phys_base;
long KERNEL_IMAGE_SIZE;

View File

@ -1,3 +1,3 @@
SHA512 (1.7.1.tar.gz) = 93e36487b71f567d3685b151459806cf36017e52bf3ee68dd448382b279a422d1a8abef72e291ccb8206f2149ccd08ba484ec0027d1caab3fa1edbc3d28c3632
SHA512 (1.7.2.tar.gz) = 324e303dd5f507703f66e2bd5dc9d24f9f50ba797be70c05702008ba77078f61ffcc884796ddf9ab737de1d124c3a9d881ab5ce4f3f459690ec00055af25ea9e
SHA512 (eppic_050615.tar.gz) = de23c3cd59ded23f2f0092c194b2169e78fcd385a8df7daf34b36f3bb2d5ddac2cdd3657bbe640beec447725988e928962baf62cf9deff8849da734390280a4f
SHA512 (kexec-tools-2.0.25.tar.xz) = 6fd3fe11d428c5bb2ce318744146e03ddf752cc77632064bdd7418ef3ad355ad2e2db212d68a5bc73554d78f786901beb42d72bd62e2a4dae34fb224b667ec6b