Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package kexec-tools for openSUSE:Factory checked in at 2024-03-07 18:27:59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kexec-tools (Old) and /work/SRC/openSUSE:Factory/.kexec-tools.new.1770 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kexec-tools" Thu Mar 7 18:27:59 2024 rev:153 rq:1155729 version:2.0.28 Changes: -------- --- /work/SRC/openSUSE:Factory/kexec-tools/kexec-tools.changes 2024-01-31 23:54:06.097750175 +0100 +++ /work/SRC/openSUSE:Factory/.kexec-tools.new.1770/kexec-tools.changes 2024-03-07 18:28:19.098582674 +0100 @@ -1,0 +2,24 @@ +Wed Mar 6 16:46:15 UTC 2024 - Jiri Bohac <[email protected]> + +- update to 2.0.28: + * LoongArch: Load vmlinux.efi to the link address + * LoongArch: Fix an issue with relocatable vmlinux + * m68k: fix getrandom() use with uclibc + * lzma: Relax memory limit for lzma decompressor + * kexec: ppc64: print help to stdout instead of stderr + * kexec/loongarch64: fix 'make dist' file loss issue + * crashdump/x86: set the elfcorehdr segment size for hotplug + * crashdump/x86: identify elfcorehdr segment for hotplug + * crashdump: exclude elfcorehdr segment from digest for hotplug + * crashdump: setup general hotplug support + * crashdump: introduce the hotplug command line options + * kexec: define KEXEC_UPDATE_ELFCOREHDR + * kexec: update manpage with explicit mention of clean kexec + * zboot: add loongarch kexec_load support + * zboot: enable arm64 kexec_load for zboot image +- drop 6419b008fde783fd0cc2cc266bd1c9cf35e99a0e.patch, upstream +- add fix-building-on-x86_64-with-binutils-2.41.patch: + * fix assembling on binutils >= 2.42 +- refresh kexec-tools-disable-test.patch + +------------------------------------------------------------------- Old: ---- 6419b008fde783fd0cc2cc266bd1c9cf35e99a0e.patch kexec-tools-2.0.27.tar.sign kexec-tools-2.0.27.tar.xz New: ---- fix-building-on-x86_64-with-binutils-2.41.patch kexec-tools-2.0.28.tar.sign kexec-tools-2.0.28.tar.xz BETA DEBUG BEGIN: Old: * zboot: enable arm64 kexec_load for zboot image - drop 6419b008fde783fd0cc2cc266bd1c9cf35e99a0e.patch, upstream - add fix-building-on-x86_64-with-binutils-2.41.patch: BETA DEBUG END: BETA DEBUG BEGIN: New:- drop 6419b008fde783fd0cc2cc266bd1c9cf35e99a0e.patch, upstream - add fix-building-on-x86_64-with-binutils-2.41.patch: * fix assembling on binutils >= 2.42 BETA DEBUG END: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kexec-tools.spec ++++++ --- /var/tmp/diff_new_pack.qfrrXo/_old 2024-03-07 18:28:19.814609096 +0100 +++ /var/tmp/diff_new_pack.qfrrXo/_new 2024-03-07 18:28:19.814609096 +0100 @@ -18,7 +18,7 @@ # Temporarily bump version to aid package split Name: kexec-tools -Version: 2.0.27 +Version: 2.0.28 Release: 0 Summary: Tools for loading replacement kernels into memory License: GPL-2.0-or-later @@ -29,13 +29,13 @@ Source2: kexec-tools.keyring Source3: kexec-load.service Source4: %{name}-rpmlintrc -Patch0: 6419b008fde783fd0cc2cc266bd1c9cf35e99a0e.patch Patch3: %{name}-disable-test.patch Patch4: %{name}-vmcoreinfo-in-xen.patch # https://patchwork.kernel.org/project/linux-riscv/patch/[email protected]/ Patch5: %{name}-riscv64.patch Patch10: %{name}-SYS_getrandom.patch Patch11: kexec-dont-use-kexec_file_load-on-xen.patch +Patch12: fix-building-on-x86_64-with-binutils-2.41.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: systemd-rpm-macros ++++++ fix-building-on-x86_64-with-binutils-2.41.patch ++++++ From: Michel Lind <[email protected]> Subject: Fix building on x86_64 with binutils 2.41 Git-commit: 328de8e00e298f00d7ba6b25dc3950147e9642e6 Patch-mainline: References: Acked-by: Jiri Bohac <[email protected]> Newer versions of the GNU assembler (observed with binutils 2.41) will complain about the ".arch i386" in files assembled with "as --64", with the message "Error: 64bit mode not supported on 'i386'". Fix by moving ".arch i386" below the relevant ".code32" directive, so that the assembler is no longer expecting 64-bit instructions to be used by the time that the ".arch i386" directive is encountered. Based on similar iPXE fix: https://github.com/ipxe/ipxe/commit/6ca597eee Signed-off-by: Michel Lind <[email protected]> Signed-off-by: Simon Horman <[email protected]> diff --git a/purgatory/arch/i386/entry32-16-debug.S b/purgatory/arch/i386/entry32-16-debug.S index 5167944..12e1164 100644 --- a/purgatory/arch/i386/entry32-16-debug.S +++ b/purgatory/arch/i386/entry32-16-debug.S @@ -25,10 +25,10 @@ .globl entry16_debug_pre32 .globl entry16_debug_first32 .globl entry16_debug_old_first32 - .arch i386 .balign 16 entry16_debug: .code32 + .arch i386 /* Compute where I am running at (assumes esp valid) */ call 1f 1: popl %ebx diff --git a/purgatory/arch/i386/entry32-16.S b/purgatory/arch/i386/entry32-16.S index c051aab..eace095 100644 --- a/purgatory/arch/i386/entry32-16.S +++ b/purgatory/arch/i386/entry32-16.S @@ -20,10 +20,10 @@ #undef i386 .text .globl entry16, entry16_regs - .arch i386 .balign 16 entry16: .code32 + .arch i386 /* Compute where I am running at (assumes esp valid) */ call 1f 1: popl %ebx diff --git a/purgatory/arch/i386/entry32.S b/purgatory/arch/i386/entry32.S index f7a494f..8ce9e31 100644 --- a/purgatory/arch/i386/entry32.S +++ b/purgatory/arch/i386/entry32.S @@ -20,10 +20,10 @@ #undef i386 .text - .arch i386 .globl entry32, entry32_regs entry32: .code32 + .arch i386 /* Setup a gdt that should that is generally usefully */ lgdt %cs:gdt diff --git a/purgatory/arch/i386/setup-x86.S b/purgatory/arch/i386/setup-x86.S index 201bb2c..a212eed 100644 --- a/purgatory/arch/i386/setup-x86.S +++ b/purgatory/arch/i386/setup-x86.S @@ -21,10 +21,10 @@ #undef i386 .text - .arch i386 .globl purgatory_start purgatory_start: .code32 + .arch i386 /* Load a gdt so I know what the segment registers are */ lgdt %cs:gdt -- 2.43.0 ++++++ kexec-tools-2.0.27.tar.xz -> kexec-tools-2.0.28.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.27/Makefile.in new/kexec-tools-2.0.28/Makefile.in --- old/kexec-tools-2.0.27/Makefile.in 2023-05-24 13:47:18.000000000 +0200 +++ new/kexec-tools-2.0.28/Makefile.in 2023-09-01 09:41:06.000000000 +0200 @@ -179,8 +179,6 @@ 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 @@ $(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) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.27/configure new/kexec-tools-2.0.28/configure --- old/kexec-tools-2.0.27/configure 2023-08-28 09:50:57.000000000 +0200 +++ new/kexec-tools-2.0.28/configure 2024-01-11 12:29:32.000000000 +0100 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for kexec-tools 2.0.27. +# Generated by GNU Autoconf 2.71 for kexec-tools 2.0.28. # # # Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, @@ -607,8 +607,8 @@ # Identity of this package. PACKAGE_NAME='kexec-tools' PACKAGE_TARNAME='kexec-tools' -PACKAGE_VERSION='2.0.27' -PACKAGE_STRING='kexec-tools 2.0.27' +PACKAGE_VERSION='2.0.28' +PACKAGE_STRING='kexec-tools 2.0.28' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1302,7 +1302,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures kexec-tools 2.0.27 to adapt to many kinds of systems. +\`configure' configures kexec-tools 2.0.28 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1369,7 +1369,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of kexec-tools 2.0.27:";; + short | recursive ) echo "Configuration of kexec-tools 2.0.28:";; esac cat <<\_ACEOF @@ -1460,7 +1460,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -kexec-tools configure 2.0.27 +kexec-tools configure 2.0.28 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. @@ -1630,6 +1630,68 @@ as_fn_set_status $ac_retval } # ac_fn_c_try_link + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case <limits.h> declares $2. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. */ + +#include <limits.h> +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main (void) +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + eval "$3=yes" +else $as_nop + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func ac_configure_args_raw= for ac_arg do @@ -1654,7 +1716,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by kexec-tools $as_me 2.0.27, which was +It was created by kexec-tools $as_me 2.0.28, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw @@ -5414,6 +5476,14 @@ fi +ac_fn_c_check_func "$LINENO" "memfd_create" "ac_cv_func_memfd_create" +if test "x$ac_cv_func_memfd_create" = xyes +then : + printf "%s\n" "#define HAVE_MEMFD_CREATE 1" >>confdefs.h + +fi + + if test "$CC" = "no"; then as_fn_error $? "cc not found" "$LINENO" 5; fi if test "$CPP" = "no"; then as_fn_error $? "cpp not found" "$LINENO" 5; fi if test "$LD" = "no"; then as_fn_error $? "ld not found" "$LINENO" 5; fi @@ -5946,7 +6016,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by kexec-tools $as_me 2.0.27, which was +This file was extended by kexec-tools $as_me 2.0.28, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -6010,7 +6080,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -kexec-tools config.status 2.0.27 +kexec-tools config.status 2.0.28 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.27/configure.ac new/kexec-tools-2.0.28/configure.ac --- old/kexec-tools-2.0.27/configure.ac 2023-08-28 09:50:03.000000000 +0200 +++ new/kexec-tools-2.0.28/configure.ac 2024-01-11 12:27:57.000000000 +0100 @@ -4,7 +4,7 @@ dnl dnl ---Required -AC_INIT(kexec-tools, 2.0.27) +AC_INIT(kexec-tools, 2.0.28) AC_CONFIG_AUX_DIR(./config) AC_CONFIG_HEADERS([include/config.h]) AC_LANG(C) @@ -208,6 +208,9 @@ AC_MSG_NOTICE([The kexec_status call is not available])) fi +dnl Check if libc has the memfd_create() syscall wrapper +AC_CHECK_FUNCS([memfd_create]) + dnl ---Sanity checks if test "$CC" = "no"; then AC_MSG_ERROR([cc not found]); fi if test "$CPP" = "no"; then AC_MSG_ERROR([cpp not found]); fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.27/include/config.h new/kexec-tools-2.0.28/include/config.h --- old/kexec-tools-2.0.27/include/config.h 2023-08-28 09:50:58.000000000 +0200 +++ new/kexec-tools-2.0.28/include/config.h 2024-01-11 12:29:33.000000000 +0100 @@ -25,6 +25,9 @@ /* Define to 1 if you have the `z' library (-lz). */ #define HAVE_LIBZ 1 +/* Define to 1 if you have the `memfd_create' function. */ +#define HAVE_MEMFD_CREATE 1 + /* Define to 1 if you have the <stdint.h> header file. */ #define HAVE_STDINT_H 1 @@ -56,7 +59,7 @@ #define PACKAGE_NAME "kexec-tools" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "kexec-tools 2.0.27" +#define PACKAGE_STRING "kexec-tools 2.0.28" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "kexec-tools" @@ -65,7 +68,7 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "2.0.27" +#define PACKAGE_VERSION "2.0.28" /* Define to 1 if all of the C90 standard headers exist (not just the ones required in a freestanding environment). This macro is provided for diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.27/include/config.h.in new/kexec-tools-2.0.28/include/config.h.in --- old/kexec-tools-2.0.27/include/config.h.in 2023-08-28 09:50:46.000000000 +0200 +++ new/kexec-tools-2.0.28/include/config.h.in 2024-01-03 11:09:24.000000000 +0100 @@ -24,6 +24,9 @@ /* Define to 1 if you have the `z' library (-lz). */ #undef HAVE_LIBZ +/* Define to 1 if you have the `memfd_create' function. */ +#undef HAVE_MEMFD_CREATE + /* Define to 1 if you have the <stdint.h> header file. */ #undef HAVE_STDINT_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.27/include/kexec-pe-zboot.h new/kexec-tools-2.0.28/include/kexec-pe-zboot.h --- old/kexec-tools-2.0.27/include/kexec-pe-zboot.h 2023-08-11 09:28:08.000000000 +0200 +++ new/kexec-tools-2.0.28/include/kexec-pe-zboot.h 2023-09-20 13:46:27.000000000 +0200 @@ -11,5 +11,6 @@ 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.27/kexec/arch/arm64/kexec-vmlinuz-arm64.c new/kexec-tools-2.0.28/kexec/arch/arm64/kexec-vmlinuz-arm64.c --- old/kexec-tools-2.0.27/kexec/arch/arm64/kexec-vmlinuz-arm64.c 2023-08-11 09:28:08.000000000 +0200 +++ new/kexec-tools-2.0.28/kexec/arch/arm64/kexec-vmlinuz-arm64.c 2023-09-20 13:46:27.000000000 +0200 @@ -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 @@ 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 @@ 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.27/kexec/arch/i386/crashdump-x86.c new/kexec-tools-2.0.28/kexec/arch/i386/crashdump-x86.c --- old/kexec-tools-2.0.27/kexec/arch/i386/crashdump-x86.c 2023-05-24 13:47:18.000000000 +0200 +++ new/kexec-tools-2.0.28/kexec/arch/i386/crashdump-x86.c 2023-10-04 14:08:17.000000000 +0200 @@ -956,6 +956,17 @@ } else { memsz = bufsz; } + + /* For hotplug support, override the minimum necessary size just + * computed with the value from /sys/kernel/crash_elfcorehdr_size. + * Properly align the size as well. + */ + if (do_hotplug) { + memsz = _ALIGN(elfcorehdrsz, align); + } + + /* Record the location of the elfcorehdr for hotplug handling */ + info->elfcorehdr = elfcorehdr = add_buffer(info, tmp, bufsz, memsz, align, min_base, max_addr, -1); dbgprintf("Created elf header segment at 0x%lx\n", elfcorehdr); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.27/kexec/arch/loongarch/Makefile new/kexec-tools-2.0.28/kexec/arch/loongarch/Makefile --- old/kexec-tools-2.0.27/kexec/arch/loongarch/Makefile 2023-05-24 13:47:18.000000000 +0200 +++ new/kexec-tools-2.0.28/kexec/arch/loongarch/Makefile 2023-10-11 10:55:25.000000000 +0200 @@ -6,6 +6,7 @@ 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 @@ -18,5 +19,6 @@ dist += kexec/arch/loongarch/Makefile $(loongarch_KEXEC_SRCS) \ kexec/arch/loongarch/kexec-loongarch.h \ kexec/arch/loongarch/image-header.h \ + kexec/arch/loongarch/iomem.h \ kexec/arch/loongarch/crashdump-loongarch.h \ kexec/arch/loongarch/include/arch/options.h diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.27/kexec/arch/loongarch/image-header.h new/kexec-tools-2.0.28/kexec/arch/loongarch/image-header.h --- old/kexec-tools-2.0.27/kexec/arch/loongarch/image-header.h 2023-05-24 13:47:18.000000000 +0200 +++ new/kexec-tools-2.0.28/kexec/arch/loongarch/image-header.h 2023-09-20 13:46:27.000000000 +0200 @@ -33,6 +33,7 @@ }; 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.27/kexec/arch/loongarch/iomem.h new/kexec-tools-2.0.28/kexec/arch/loongarch/iomem.h --- old/kexec-tools-2.0.27/kexec/arch/loongarch/iomem.h 1970-01-01 01:00:00.000000000 +0100 +++ new/kexec-tools-2.0.28/kexec/arch/loongarch/iomem.h 2023-05-24 13:47:18.000000000 +0200 @@ -0,0 +1,10 @@ +#ifndef IOMEM_H +#define IOMEM_H + +#define SYSTEM_RAM "System RAM\n" +#define KERNEL_CODE "Kernel code\n" +#define KERNEL_DATA "Kernel data\n" +#define CRASH_KERNEL "Crash kernel\n" +#define IOMEM_RESERVED "Reserved\n" + +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.27/kexec/arch/loongarch/kexec-loongarch.c new/kexec-tools-2.0.28/kexec/arch/loongarch/kexec-loongarch.c --- old/kexec-tools-2.0.27/kexec/arch/loongarch/kexec-loongarch.c 2023-05-24 13:47:18.000000000 +0200 +++ new/kexec-tools-2.0.28/kexec/arch/loongarch/kexec-loongarch.c 2023-12-02 13:42:17.000000000 +0100 @@ -165,6 +165,7 @@ 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]); @@ -264,9 +265,13 @@ hole = ULONG_MAX; } } else { - hole = locate_hole(info, - loongarch_mem.text_offset + loongarch_mem.image_size, - MiB(1), 0, ULONG_MAX, 1); + unsigned long hole_min; + unsigned long hole_max; + + hole_min = loongarch_mem.text_offset; + hole_max = hole_min + loongarch_mem.image_size; + hole = locate_hole(info, loongarch_mem.image_size, + MiB(1), hole_min, hole_max, 1); if (hole == ULONG_MAX) dbgprintf("%s: locate_hole failed\n", __func__); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.27/kexec/arch/loongarch/kexec-loongarch.h new/kexec-tools-2.0.28/kexec/arch/loongarch/kexec-loongarch.h --- old/kexec-tools-2.0.27/kexec/arch/loongarch/kexec-loongarch.h 2023-08-01 08:52:18.000000000 +0200 +++ new/kexec-tools-2.0.28/kexec/arch/loongarch/kexec-loongarch.h 2023-09-20 13:46:27.000000000 +0200 @@ -27,6 +27,10 @@ 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.27/kexec/arch/loongarch/kexec-pez-loongarch.c new/kexec-tools-2.0.28/kexec/arch/loongarch/kexec-pez-loongarch.c --- old/kexec-tools-2.0.27/kexec/arch/loongarch/kexec-pez-loongarch.c 1970-01-01 01:00:00.000000000 +0100 +++ new/kexec-tools-2.0.28/kexec/arch/loongarch/kexec-pez-loongarch.c 2023-09-20 13:46:27.000000000 +0200 @@ -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"); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.27/kexec/arch/m68k/bootinfo.c new/kexec-tools-2.0.28/kexec/arch/m68k/bootinfo.c --- old/kexec-tools-2.0.27/kexec/arch/m68k/bootinfo.c 2023-05-24 13:47:18.000000000 +0200 +++ new/kexec-tools-2.0.28/kexec/arch/m68k/bootinfo.c 2023-12-02 13:42:17.000000000 +0100 @@ -1,3 +1,4 @@ +#define _GNU_SOURCE #include <stdio.h> #include <stdlib.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.27/kexec/arch/ppc64/kexec-elf-ppc64.c new/kexec-tools-2.0.28/kexec/arch/ppc64/kexec-elf-ppc64.c --- old/kexec-tools-2.0.27/kexec/arch/ppc64/kexec-elf-ppc64.c 2023-08-01 08:52:18.000000000 +0200 +++ new/kexec-tools-2.0.28/kexec/arch/ppc64/kexec-elf-ppc64.c 2023-12-02 13:41:15.000000000 +0100 @@ -482,15 +482,15 @@ void elf_ppc64_usage(void) { - fprintf(stderr, " --command-line=<Command line> command line to append.\n"); - fprintf(stderr, " --append=<Command line> same as --command-line.\n"); - fprintf(stderr, " --ramdisk=<filename> Initial RAM disk.\n"); - fprintf(stderr, " --initrd=<filename> same as --ramdisk.\n"); - fprintf(stderr, " --devicetreeblob=<filename> Specify device tree blob file.\n"); - fprintf(stderr, " "); - fprintf(stderr, "Not applicable while using --kexec-file-syscall.\n"); - fprintf(stderr, " --reuse-cmdline Use kernel command line from running system.\n"); - fprintf(stderr, " --dtb=<filename> same as --devicetreeblob.\n"); + printf(" --command-line=<Command line> command line to append.\n"); + printf(" --append=<Command line> same as --command-line.\n"); + printf(" --ramdisk=<filename> Initial RAM disk.\n"); + printf(" --initrd=<filename> same as --ramdisk.\n"); + printf(" --devicetreeblob=<filename> Specify device tree blob file.\n"); + printf(" "); + printf("Not applicable while using --kexec-file-syscall.\n"); + printf(" --reuse-cmdline Use kernel command line from running system.\n"); + printf(" --dtb=<filename> same as --devicetreeblob.\n"); - fprintf(stderr, "elf support is still broken\n"); + printf("elf support is still broken\n"); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.27/kexec/arch/ppc64/kexec-ppc64.c new/kexec-tools-2.0.28/kexec/arch/ppc64/kexec-ppc64.c --- old/kexec-tools-2.0.27/kexec/arch/ppc64/kexec-ppc64.c 2023-05-24 13:47:18.000000000 +0200 +++ new/kexec-tools-2.0.28/kexec/arch/ppc64/kexec-ppc64.c 2023-12-02 13:41:15.000000000 +0100 @@ -910,9 +910,9 @@ void arch_usage(void) { - fprintf(stderr, " --elf64-core-headers Prepare core headers in ELF64 format\n"); - fprintf(stderr, " --dt-no-old-root Do not reuse old kernel root= param.\n" \ - " while creating flatten device tree.\n"); + printf(" --elf64-core-headers Prepare core headers in ELF64 format\n"); + printf(" --dt-no-old-root Do not reuse old kernel root= param.\n" + " while creating flatten device tree.\n"); } struct arch_options_t arch_options = { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.27/kexec/arch/ppc64/kexec-zImage-ppc64.c new/kexec-tools-2.0.28/kexec/arch/ppc64/kexec-zImage-ppc64.c --- old/kexec-tools-2.0.27/kexec/arch/ppc64/kexec-zImage-ppc64.c 2023-05-24 13:47:18.000000000 +0200 +++ new/kexec-tools-2.0.28/kexec/arch/ppc64/kexec-zImage-ppc64.c 2023-12-02 13:41:15.000000000 +0100 @@ -180,5 +180,5 @@ void zImage_ppc64_usage(void) { - fprintf(stderr, "zImage support is still broken\n"); + printf("zImage support is still broken\n"); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.27/kexec/kexec-elf-exec.c new/kexec-tools-2.0.28/kexec/kexec-elf-exec.c --- old/kexec-tools-2.0.27/kexec/kexec-elf-exec.c 2023-05-24 13:47:18.000000000 +0200 +++ new/kexec-tools-2.0.28/kexec/kexec-elf-exec.c 2023-12-02 13:42:17.000000000 +0100 @@ -39,12 +39,13 @@ unsigned long first, last; size_t i; - /* Note on arm64: + /* Note on arm64 and loongarch64: * arm64's vmlinux has virtual address in physical address * field of PT_LOAD segments. So the following validity check * and relocation makes no sense on arm64. + * This is also applies to LoongArch. */ - if (ehdr->e_machine == EM_AARCH64) + if (ehdr->e_machine == EM_AARCH64 || ehdr->e_machine == EM_LOONGARCH) return 0; first = ULONG_MAX; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.27/kexec/kexec-pe-zboot.c new/kexec-tools-2.0.28/kexec/kexec-pe-zboot.c --- old/kexec-tools-2.0.27/kexec/kexec-pe-zboot.c 2023-08-11 09:28:08.000000000 +0200 +++ new/kexec-tools-2.0.28/kexec/kexec-pe-zboot.c 2023-09-20 13:46:27.000000000 +0200 @@ -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 @@ goto fail_bad_header; } + *kernel_size = decompressed_size; dbgprintf("%s: done\n", __func__); ret = 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.27/kexec/kexec-syscall.h new/kexec-tools-2.0.28/kexec/kexec-syscall.h --- old/kexec-tools-2.0.27/kexec/kexec-syscall.h 2023-05-24 13:47:18.000000000 +0200 +++ new/kexec-tools-2.0.28/kexec/kexec-syscall.h 2023-10-04 14:08:17.000000000 +0200 @@ -112,6 +112,7 @@ #define KEXEC_ON_CRASH 0x00000001 #define KEXEC_PRESERVE_CONTEXT 0x00000002 +#define KEXEC_UPDATE_ELFCOREHDR 0x00000004 #define KEXEC_ARCH_MASK 0xffff0000 /* Flags for kexec file based system call */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.27/kexec/kexec.8 new/kexec-tools-2.0.28/kexec/kexec.8 --- old/kexec-tools-2.0.27/kexec/kexec.8 2023-05-24 13:47:18.000000000 +0200 +++ new/kexec-tools-2.0.28/kexec/kexec.8 2023-10-04 14:08:17.000000000 +0200 @@ -95,8 +95,15 @@ .RB "\-\-append=" "root=/dev/hda1" "\ \-\-initrd=" /boot/initrd .RE .PP -After this kernel is loaded, it can be booted to at any time using the -command: +After this kernel is loaded, assuming the user-space supports kexec-based +rebooting, it can be booted to, with a clean shutdown, using the command: + +.RS +.BR reboot +.RE +.PP +Alternatively, it can also be booted to, without calling shutdown(8), with +the command: .RS .BR kexec \ \-e @@ -132,6 +139,12 @@ Open a help file for .BR kexec . .TP +.B \-\-hotplug +Setup for kernel modification of the elfcorehdr. This option performs +the steps needed to support kernel updates to the elfcorehdr in the +presence of hot un/plug and/or on/offline events. This option only +useful for KEXEC_LOAD syscall. +.TP .B \-i\ (\-\-no-checks) Fast reboot, no memory integrity checks. .TP diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.27/kexec/kexec.c new/kexec-tools-2.0.28/kexec/kexec.c --- old/kexec-tools-2.0.27/kexec/kexec.c 2023-08-11 09:28:08.000000000 +0200 +++ new/kexec-tools-2.0.28/kexec/kexec.c 2023-10-04 14:08:17.000000000 +0200 @@ -31,6 +31,10 @@ #include <sys/mount.h> #include <sys/types.h> #include <sys/stat.h> +#ifndef HAVE_MEMFD_CREATE +#include <linux/memfd.h> +#include <sys/syscall.h> +#endif #include <sys/reboot.h> #include <sys/mman.h> #include <unistd.h> @@ -58,6 +62,8 @@ unsigned long long mem_min = 0; unsigned long long mem_max = ULONG_MAX; +unsigned long elfcorehdrsz = 0; +int do_hotplug = 0; static unsigned long kexec_flags = 0; /* Flags for kexec file (fd) based syscall */ static unsigned long kexec_file_flags = 0; @@ -489,7 +495,7 @@ 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; @@ -638,6 +644,13 @@ return kernel_buf; } +#ifndef HAVE_MEMFD_CREATE +static int memfd_create(const char *name, unsigned int flags) +{ + return syscall(SYS_memfd_create, name, flags); +} +#endif + static int copybuf_memfd(const char *kernel_buf, size_t size) { int fd, count; @@ -687,6 +700,14 @@ if (info->segment[i].mem == (void *)info->rhdr.rel_addr) { continue; } + + /* Don't include elfcorehdr in the checksum, if hotplug + * support enabled. + */ + if (do_hotplug && (info->segment[i].mem == (void *)info->elfcorehdr)) { + continue; + } + sha256_update(&ctx, info->segment[i].buf, info->segment[i].bufsz); nullsz = info->segment[i].memsz - info->segment[i].bufsz; @@ -1069,6 +1090,7 @@ " back to the compatibility syscall when file based\n" " syscall is not supported or the kernel did not\n" " understand the image (default)\n" + " --hotplug Setup for kernel modification of elfcorehdr.\n" " -d, --debug Enable debugging to help spot a failure.\n" " -S, --status Return 1 if the type (by default crash) is loaded,\n" " 0 if not.\n" @@ -1579,6 +1601,9 @@ case OPT_PRINT_CKR_SIZE: print_crashkernel_region_size(); return 0; + case OPT_HOTPLUG: + do_hotplug = 1; + break; default: break; } @@ -1625,6 +1650,24 @@ die("--load-live-update can only be used with xen\n"); } + /* NOTE: Xen KEXEC_LIVE_UPDATE and KEXEC_UPDATE_ELFCOREHDR collide */ + if (do_hotplug) { + const char *ces = "/sys/kernel/crash_elfcorehdr_size"; + char *buf, *endptr = NULL; + off_t nread = 0; + buf = slurp_file_len(ces, sizeof(buf)-1, &nread); + if (buf) { + if (buf[nread-1] == '\n') + buf[nread-1] = '\0'; + elfcorehdrsz = strtoul(buf, &endptr, 0); + } + if (!elfcorehdrsz || (endptr && *endptr != '\0')) + die("Path %s does not exist, the kernel needs CONFIG_CRASH_HOTPLUG\n", ces); + dbgprintf("ELFCOREHDR_SIZE %lu\n", elfcorehdrsz); + /* Indicate to the kernel it is ok to modify the elfcorehdr */ + kexec_flags |= KEXEC_UPDATE_ELFCOREHDR; + } + fileind = optind; /* Reset getopt for the next pass; called in other source modules */ opterr = 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.27/kexec/kexec.h new/kexec-tools-2.0.28/kexec/kexec.h --- old/kexec-tools-2.0.27/kexec/kexec.h 2023-08-11 09:28:08.000000000 +0200 +++ new/kexec-tools-2.0.28/kexec/kexec.h 2023-10-04 14:08:17.000000000 +0200 @@ -170,6 +170,7 @@ int command_line_len; int skip_checks; + unsigned long elfcorehdr; }; struct arch_map_entry { @@ -232,7 +233,8 @@ #define OPT_PRINT_CKR_SIZE 262 #define OPT_LOAD_LIVE_UPDATE 263 #define OPT_EXEC_LIVE_UPDATE 264 -#define OPT_MAX 265 +#define OPT_HOTPLUG 265 +#define OPT_MAX 266 #define KEXEC_OPTIONS \ { "help", 0, 0, OPT_HELP }, \ { "version", 0, 0, OPT_VERSION }, \ @@ -259,6 +261,7 @@ { "debug", 0, 0, OPT_DEBUG }, \ { "status", 0, 0, OPT_STATUS }, \ { "print-ckr-size", 0, 0, OPT_PRINT_CKR_SIZE }, \ + { "hotplug", 0, 0, OPT_HOTPLUG }, \ #define KEXEC_OPT_STR "h?vdfixyluet:pscaS" @@ -267,6 +270,7 @@ __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); @@ -296,6 +300,9 @@ extern char purgatory[]; extern size_t purgatory_size; +extern unsigned long elfcorehdrsz; +extern int do_hotplug; + #define BOOTLOADER "kexec" #define BOOTLOADER_VERSION PACKAGE_VERSION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.27/kexec/lzma.c new/kexec-tools-2.0.28/kexec/lzma.c --- old/kexec-tools-2.0.27/kexec/lzma.c 2023-05-24 13:47:18.000000000 +0200 +++ new/kexec-tools-2.0.28/kexec/lzma.c 2023-12-02 13:42:17.000000000 +0100 @@ -73,7 +73,7 @@ ret = lzma_alone_encoder(&lzfile->strm, &opt_lzma); } else { ret = lzma_auto_decoder(&lzfile->strm, - UINT64_C(64) * 1024 * 1024, 0); + UINT64_C(128) * 1024 * 1024, 0); } if (ret != LZMA_OK) { fclose(fp); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.27/kexec-tools.spec new/kexec-tools-2.0.28/kexec-tools.spec --- old/kexec-tools-2.0.27/kexec-tools.spec 2023-08-28 09:53:33.000000000 +0200 +++ new/kexec-tools-2.0.28/kexec-tools.spec 2024-01-11 12:31:08.000000000 +0100 @@ -1,6 +1,6 @@ Summary: Load one kernel from another Name: kexec-tools -Version: 2.0.27 +Version: 2.0.28 Release: 0 License: GPL Group: Development/Tools ++++++ kexec-tools-disable-test.patch ++++++ --- /var/tmp/diff_new_pack.qfrrXo/_old 2024-03-07 18:28:20.058618099 +0100 +++ /var/tmp/diff_new_pack.qfrrXo/_new 2024-03-07 18:28:20.062618247 +0100 @@ -8,10 +8,12 @@ Makefile.in | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) ---- a/Makefile.in -+++ b/Makefile.in -@@ -173,8 +173,11 @@ PSRCS:=$(foreach s, $(SRCS), $(PACKAGE_N - PGSRCS:=$(foreach s, $(GENERATED_SRCS), $(PACKAGE_NAME)-$(PACKAGE_VERSION)/$(s)) +Index: kexec-tools-2.0.28/Makefile.in +=================================================================== +--- kexec-tools-2.0.28.orig/Makefile.in ++++ kexec-tools-2.0.28/Makefile.in +@@ -181,8 +181,11 @@ TARBALL.gz=$(TARBALL).gz + SRCS:= $(dist) MAN_PAGES:=$(KEXEC_MANPAGE) $(VMCORE_DMESG_MANPAGE) -BINARIES_i386:=$(KEXEC_TEST)
