2.0.28 upstream release

Upstream tag: v2.0.28
Upstream commit: adef8a8e

Signed-off-by: Coiby Xu <coxu@redhat.com>
This commit is contained in:
Coiby Xu 2024-01-17 13:46:51 +08:00
parent 73c9eb71e9
commit d78cab14bc
7 changed files with 9 additions and 399 deletions

View File

@ -1,30 +0,0 @@
From 056c179cd3c2af0c3bd2762a8a3bfd1340278e9e Mon Sep 17 00:00:00 2001
From: Simon Horman <horms@kernel.org>
Date: Fri, 1 Sep 2023 09:37:24 +0200
Subject: [PATCH 1/4] kexec-tools 2.0.27.git
Add .git to version so it doesn't look like a release.
This is just so when people build code from git it can
be identified as such from the version string.
Signed-off-by: Simon Horman <horms@kernel.org>
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 192976c..352eefe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,7 +4,7 @@ dnl
dnl
dnl ---Required
-AC_INIT(kexec-tools, 2.0.27)
+AC_INIT(kexec-tools, 2.0.27.git)
AC_CONFIG_AUX_DIR(./config)
AC_CONFIG_HEADERS([include/config.h])
AC_LANG(C)
--
2.41.0

View File

@ -1,43 +0,0 @@
From c3f35ff06e54daf452ac49a4381cf2643c934866 Mon Sep 17 00:00:00 2001
From: Leah Neukirchen <leah@vuxu.org>
Date: Mon, 28 Aug 2023 11:58:15 +0200
Subject: [PATCH 2/4] build: fix tarball creation
The fix in 41b77edac did not work, bsdtar still complains about
"hardlink pointing to itself".
Simplify the code instead: since the staging directory contains
exactly the files we want, just package it as a whole.
Signed-off-by: Leah Neukirchen <leah@vuxu.org>
Signed-off-by: Simon Horman <horms@kernel.org>
---
Makefile.in | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index 09bbd5c..3cad22a 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -179,8 +179,6 @@ GENERATED_SRCS:= $(SPEC)
TARBALL=$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar
TARBALL.gz=$(TARBALL).gz
SRCS:= $(dist)
-PSRCS:=$(foreach s, $(SRCS), $(PACKAGE_NAME)-$(PACKAGE_VERSION)/$(s))
-PGSRCS:=$(foreach s, $(GENERATED_SRCS), $(PACKAGE_NAME)-$(PACKAGE_VERSION)/$(s))
MAN_PAGES:=$(KEXEC_MANPAGE) $(VMCORE_DMESG_MANPAGE)
BINARIES_i386:=$(KEXEC_TEST)
@@ -223,8 +221,7 @@ $(TARBALL): $(SRCS) $(GENERATED_SRCS)
$(MKDIR) $(PACKAGE_NAME)-$(PACKAGE_VERSION)
$(TAR) -c $(SRCS) $(GENERATED_SRCS) | \
$(TAR) -C $(PACKAGE_NAME)-$(PACKAGE_VERSION) -x
- $(TAR) -cf $@ $(PSRCS)
- $(TAR) -rf $@ $(PGSRCS)
+ $(TAR) -cf $@ $(PACKAGE_NAME)-$(PACKAGE_VERSION)
$(RM) -rf $(PACKAGE_NAME)-$(PACKAGE_VERSION)
$(TARBALL.gz): $(TARBALL)
--
2.41.0

View File

@ -1,134 +0,0 @@
From 8f08e3b51f25f585dc62f8e7aadc6095e06417cc Mon Sep 17 00:00:00 2001
From: Dave Young <dyoung@redhat.com>
Date: Thu, 14 Sep 2023 16:49:59 +0800
Subject: [PATCH 3/4] zboot: enable arm64 kexec_load for zboot image
kexec_file_load support of zboot kernel image decompressed the vmlinuz,
so in kexec_load code just load the kernel with reading the decompressed
kernel fd into a new buffer and use it directly.
Signed-off-by: Dave Young <dyoung@redhat.com>
Tested-by: Baoquan He <bhe@redhat.com>
Reviewed-by: Pingfan Liu <piliu@redhat.com>
Signed-off-by: Simon Horman <horms@kernel.org>
---
include/kexec-pe-zboot.h | 3 ++-
kexec/arch/arm64/kexec-vmlinuz-arm64.c | 26 +++++++++++++++++++++++---
kexec/kexec-pe-zboot.c | 4 +++-
kexec/kexec.c | 2 +-
kexec/kexec.h | 1 +
5 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/include/kexec-pe-zboot.h b/include/kexec-pe-zboot.h
index e2e0448..374916c 100644
--- a/include/kexec-pe-zboot.h
+++ b/include/kexec-pe-zboot.h
@@ -11,5 +11,6 @@ struct linux_pe_zboot_header {
uint32_t compress_type;
};
-int pez_prepare(const char *crude_buf, off_t buf_sz, int *kernel_fd);
+int pez_prepare(const char *crude_buf, off_t buf_sz, int *kernel_fd,
+ off_t *kernel_size);
#endif
diff --git a/kexec/arch/arm64/kexec-vmlinuz-arm64.c b/kexec/arch/arm64/kexec-vmlinuz-arm64.c
index c0ee47c..e291a34 100644
--- a/kexec/arch/arm64/kexec-vmlinuz-arm64.c
+++ b/kexec/arch/arm64/kexec-vmlinuz-arm64.c
@@ -34,6 +34,7 @@
#include "arch/options.h"
static int kernel_fd = -1;
+static off_t decompressed_size;
/* Returns:
* -1 : in case of error/invalid format (not a valid PE+compressed ZBOOT format.
@@ -72,7 +73,7 @@ int pez_arm64_probe(const char *kernel_buf, off_t kernel_size)
return -1;
}
- ret = pez_prepare(buf, buf_sz, &kernel_fd);
+ ret = pez_prepare(buf, buf_sz, &kernel_fd, &decompressed_size);
if (!ret) {
/* validate the arm64 specific header */
@@ -98,8 +99,27 @@ bad_header:
int pez_arm64_load(int argc, char **argv, const char *buf, off_t len,
struct kexec_info *info)
{
- info->kernel_fd = kernel_fd;
- return image_arm64_load(argc, argv, buf, len, info);
+ if (kernel_fd > 0 && decompressed_size > 0) {
+ char *kbuf;
+ off_t nread;
+ int fd;
+
+ info->kernel_fd = kernel_fd;
+ fd = dup(kernel_fd);
+ if (fd < 0) {
+ dbgprintf("%s: dup fd failed.\n", __func__);
+ return -1;
+ }
+ kbuf = slurp_fd(fd, NULL, decompressed_size, &nread);
+ if (!kbuf || nread != decompressed_size) {
+ dbgprintf("%s: slurp_fd failed.\n", __func__);
+ return -1;
+ }
+ return image_arm64_load(argc, argv, kbuf, decompressed_size, info);
+ }
+
+ dbgprintf("%s: wrong kernel file descriptor.\n", __func__);
+ return -1;
}
void pez_arm64_usage(void)
diff --git a/kexec/kexec-pe-zboot.c b/kexec/kexec-pe-zboot.c
index 2f2e052..3abd17d 100644
--- a/kexec/kexec-pe-zboot.c
+++ b/kexec/kexec-pe-zboot.c
@@ -37,7 +37,8 @@
*
* crude_buf: the content, which is read from the kernel file without any processing
*/
-int pez_prepare(const char *crude_buf, off_t buf_sz, int *kernel_fd)
+int pez_prepare(const char *crude_buf, off_t buf_sz, int *kernel_fd,
+ off_t *kernel_size)
{
int ret = -1;
int fd = 0;
@@ -110,6 +111,7 @@ int pez_prepare(const char *crude_buf, off_t buf_sz, int *kernel_fd)
goto fail_bad_header;
}
+ *kernel_size = decompressed_size;
dbgprintf("%s: done\n", __func__);
ret = 0;
diff --git a/kexec/kexec.c b/kexec/kexec.c
index c3b182e..1edbd34 100644
--- a/kexec/kexec.c
+++ b/kexec/kexec.c
@@ -489,7 +489,7 @@ static int add_backup_segments(struct kexec_info *info,
return 0;
}
-static char *slurp_fd(int fd, const char *filename, off_t size, off_t *nread)
+char *slurp_fd(int fd, const char *filename, off_t size, off_t *nread)
{
char *buf;
off_t progress;
diff --git a/kexec/kexec.h b/kexec/kexec.h
index ed3b499..0933389 100644
--- a/kexec/kexec.h
+++ b/kexec/kexec.h
@@ -267,6 +267,7 @@ extern void die(const char *fmt, ...)
__attribute__ ((format (printf, 1, 2)));
extern void *xmalloc(size_t size);
extern void *xrealloc(void *ptr, size_t size);
+extern char *slurp_fd(int fd, const char *filename, off_t size, off_t *nread);
extern char *slurp_file(const char *filename, off_t *r_size);
extern char *slurp_file_mmap(const char *filename, off_t *r_size);
extern char *slurp_file_len(const char *filename, off_t size, off_t *nread);
--
2.41.0

View File

@ -1,171 +0,0 @@
From 2495ccfc52069ecec46031587c94b03ae66ed5d2 Mon Sep 17 00:00:00 2001
From: Dave Young <dyoung@redhat.com>
Date: Thu, 14 Sep 2023 16:50:00 +0800
Subject: [PATCH 4/4] zboot: add loongarch kexec_load support
Copy arm64 code and change for loongarch so that the kexec -c can load
a zboot image.
Note: probe zboot image first otherwise the pei-loongarch file type will
be used.
Signed-off-by: Dave Young <dyoung@redhat.com>
Signed-off-by: Simon Horman <horms@kernel.org>
---
kexec/arch/loongarch/Makefile | 1 +
kexec/arch/loongarch/image-header.h | 1 +
kexec/arch/loongarch/kexec-loongarch.c | 1 +
kexec/arch/loongarch/kexec-loongarch.h | 4 +
kexec/arch/loongarch/kexec-pez-loongarch.c | 90 ++++++++++++++++++++++
5 files changed, 97 insertions(+)
create mode 100644 kexec/arch/loongarch/kexec-pez-loongarch.c
diff --git a/kexec/arch/loongarch/Makefile b/kexec/arch/loongarch/Makefile
index 3b33b96..cee7e56 100644
--- a/kexec/arch/loongarch/Makefile
+++ b/kexec/arch/loongarch/Makefile
@@ -6,6 +6,7 @@ loongarch_KEXEC_SRCS += kexec/arch/loongarch/kexec-elf-loongarch.c
loongarch_KEXEC_SRCS += kexec/arch/loongarch/kexec-pei-loongarch.c
loongarch_KEXEC_SRCS += kexec/arch/loongarch/kexec-elf-rel-loongarch.c
loongarch_KEXEC_SRCS += kexec/arch/loongarch/crashdump-loongarch.c
+loongarch_KEXEC_SRCS += kexec/arch/loongarch/kexec-pez-loongarch.c
loongarch_MEM_REGIONS = kexec/mem_regions.c
diff --git a/kexec/arch/loongarch/image-header.h b/kexec/arch/loongarch/image-header.h
index 3b75765..223d81f 100644
--- a/kexec/arch/loongarch/image-header.h
+++ b/kexec/arch/loongarch/image-header.h
@@ -33,6 +33,7 @@ struct loongarch_image_header {
};
static const uint8_t loongarch_image_pe_sig[2] = {'M', 'Z'};
+static const uint8_t loongarch_pe_machtype[6] = {'P','E', 0x0, 0x0, 0x64, 0x62};
/**
* loongarch_header_check_pe_sig - Helper to check the loongarch image header.
diff --git a/kexec/arch/loongarch/kexec-loongarch.c b/kexec/arch/loongarch/kexec-loongarch.c
index f47c998..62ff8fd 100644
--- a/kexec/arch/loongarch/kexec-loongarch.c
+++ b/kexec/arch/loongarch/kexec-loongarch.c
@@ -165,6 +165,7 @@ int get_memory_ranges(struct memory_range **range, int *ranges,
struct file_type file_type[] = {
{"elf-loongarch", elf_loongarch_probe, elf_loongarch_load, elf_loongarch_usage},
+ {"pez-loongarch", pez_loongarch_probe, pez_loongarch_load, pez_loongarch_usage},
{"pei-loongarch", pei_loongarch_probe, pei_loongarch_load, pei_loongarch_usage},
};
int file_types = sizeof(file_type) / sizeof(file_type[0]);
diff --git a/kexec/arch/loongarch/kexec-loongarch.h b/kexec/arch/loongarch/kexec-loongarch.h
index 5120a26..2c7624f 100644
--- a/kexec/arch/loongarch/kexec-loongarch.h
+++ b/kexec/arch/loongarch/kexec-loongarch.h
@@ -27,6 +27,10 @@ int pei_loongarch_probe(const char *buf, off_t len);
int pei_loongarch_load(int argc, char **argv, const char *buf, off_t len,
struct kexec_info *info);
void pei_loongarch_usage(void);
+int pez_loongarch_probe(const char *kernel_buf, off_t kernel_size);
+int pez_loongarch_load(int argc, char **argv, const char *buf, off_t len,
+ struct kexec_info *info);
+void pez_loongarch_usage(void);
int loongarch_process_image_header(const struct loongarch_image_header *h);
diff --git a/kexec/arch/loongarch/kexec-pez-loongarch.c b/kexec/arch/loongarch/kexec-pez-loongarch.c
new file mode 100644
index 0000000..942a47c
--- /dev/null
+++ b/kexec/arch/loongarch/kexec-pez-loongarch.c
@@ -0,0 +1,90 @@
+/*
+ * LoongArch PE compressed Image (vmlinuz, ZBOOT) support.
+ * Based on arm64 code
+ */
+
+#define _GNU_SOURCE
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include "kexec.h"
+#include "kexec-loongarch.h"
+#include <kexec-pe-zboot.h>
+#include "arch/options.h"
+
+static int kernel_fd = -1;
+static off_t decompressed_size;
+
+/* Returns:
+ * -1 : in case of error/invalid format (not a valid PE+compressed ZBOOT format.
+ */
+int pez_loongarch_probe(const char *kernel_buf, off_t kernel_size)
+{
+ int ret = -1;
+ const struct loongarch_image_header *h;
+ char *buf;
+ off_t buf_sz;
+
+ buf = (char *)kernel_buf;
+ buf_sz = kernel_size;
+ if (!buf)
+ return -1;
+ h = (const struct loongarch_image_header *)buf;
+
+ dbgprintf("%s: PROBE.\n", __func__);
+ if (buf_sz < sizeof(struct loongarch_image_header)) {
+ dbgprintf("%s: Not large enough to be a PE image.\n", __func__);
+ return -1;
+ }
+ if (!loongarch_header_check_pe_sig(h)) {
+ dbgprintf("%s: Not an PE image.\n", __func__);
+ return -1;
+ }
+
+ if (buf_sz < sizeof(struct loongarch_image_header) + h->pe_header) {
+ dbgprintf("%s: PE image offset larger than image.\n", __func__);
+ return -1;
+ }
+
+ if (memcmp(&buf[h->pe_header],
+ loongarch_pe_machtype, sizeof(loongarch_pe_machtype))) {
+ dbgprintf("%s: PE header doesn't match machine type.\n", __func__);
+ return -1;
+ }
+
+ ret = pez_prepare(buf, buf_sz, &kernel_fd, &decompressed_size);
+
+ /* Fixme: add sanity check of the decompressed kernel before return */
+ return ret;
+}
+
+int pez_loongarch_load(int argc, char **argv, const char *buf, off_t len,
+ struct kexec_info *info)
+{
+ if (kernel_fd > 0 && decompressed_size > 0) {
+ char *kbuf;
+ off_t nread;
+
+ info->kernel_fd = kernel_fd;
+ /*
+ * slurp_fd will close kernel_fd, but it is safe here
+ * due to no kexec_file_load support.
+ */
+ kbuf = slurp_fd(kernel_fd, NULL, decompressed_size, &nread);
+ if (!kbuf || nread != decompressed_size) {
+ dbgprintf("%s: slurp_fd failed.\n", __func__);
+ return -1;
+ }
+ return pei_loongarch_load(argc, argv, kbuf, decompressed_size, info);
+ }
+
+ dbgprintf("%s: wrong kernel file descriptor.\n", __func__);
+ return -1;
+}
+
+void pez_loongarch_usage(void)
+{
+ printf(
+" An LoongArch vmlinuz, PE image of a compressed, little endian.\n"
+" kernel, built with ZBOOT enabled.\n\n");
+}
--
2.41.0

View File

@ -1,3 +1,3 @@
This repository is maintained by packit.
https://packit.dev/
The file was generated using packit 0.80.0.
The file was generated using packit 0.87.1.

View File

@ -4,8 +4,8 @@
%global mkdf_shortver %(c=%{mkdf_ver}; echo ${c:0:7})
Name: kexec-tools
Version: 2.0.27
Release: 5%{?dist}
Version: 2.0.28
Release: 1%{?dist}
License: GPL-2.0-only
Summary: The kexec/kdump userspace component
@ -105,18 +105,6 @@ Requires: systemd-udev%{?_isa}
#
# Patches 601 onward are generic patches
#
# kexec-tools 2.0.27.git
# Author: Simon Horman <horms@kernel.org>
Patch602: 0001-kexec-tools-2.0.27.git.patch
# build: fix tarball creation
# Author: Leah Neukirchen <leah@vuxu.org>
Patch603: 0002-build-fix-tarball-creation.patch
# zboot: enable arm64 kexec_load for zboot image
# Author: Dave Young <dyoung@redhat.com>
Patch604: 0003-zboot-enable-arm64-kexec_load-for-zboot-image.patch
# zboot: add loongarch kexec_load support
# Author: Dave Young <dyoung@redhat.com>
Patch605: 0004-zboot-add-loongarch-kexec_load-support.patch
%description
kexec-tools provides /sbin/kexec binary that facilitates a new
@ -132,10 +120,6 @@ mkdir -p -m755 kcp
tar -z -x -v -f %{SOURCE9}
tar -z -x -v -f %{SOURCE19}
%patch602 -p1
%patch603 -p1
%patch604 -p1
%patch605 -p1
%ifarch ppc
%define archdef ARCH=ppc
@ -375,6 +359,11 @@ fi
%endif
%changelog
* Wed Jan 17 2024 Coiby Xu <coxu@redhat.com> - 2.0.28-1
- kexec-tools 2.0.28 (Simon Horman)
- Use the same /etc/resolve.conf in kdump initrd if it's managed manually
- dracut-module-setup: consolidate s390 network device config
* Mon Dec 11 2023 Coiby Xu <coxu@redhat.com> - 2.0.27-5
- Let %post scriptlet always exits with the zero exit status

View File

@ -1,4 +1,3 @@
SHA512 (kexec-tools-2.0.27.tar.xz) = 30b5ef7c2075dfd11fd1c3c33abe6b60673400257668d60145be08a2472356c7191a0810095da0fa32e327b9806a7578c73129ac0550d26c28ea6571c88c7b3c
SHA512 (makedumpfile-1.7.2.tar.gz) = 324e303dd5f507703f66e2bd5dc9d24f9f50ba797be70c05702008ba77078f61ffcc884796ddf9ab737de1d124c3a9d881ab5ce4f3f459690ec00055af25ea9e
SHA512 (kexec-tools-2.0.28.tar.xz) = 889a7bf1d26bb309e4ff7ce1c8dbcf48c01e47221ea3acf1c4ef2a98a652c496e31bddcdb627d3adebd85f7541d1fb9122c60e741e10b3726e31a9733cadc753
SHA512 (eppic-e8844d3.tar.gz) = d86b9f90c57e694107272d8f71b87f66a30743b9530480fb6f665026bbada4c6b0205a83e40b5383663a945681cfbfcf1ee79469fc219ddf679473c4b2290763
SHA512 (makedumpfile-1.7.4.tar.gz) = 6c3455b711bd4e120173ee07fcc5ff708ae6d34eaee0f4c135eca7ee0e0475b4d391429c23cf68e848b156ee3edeab956e693a390d67ccc634c43224c7129a96