From f611d607d57bff99520e6f3aebc5c9e34eb5938a9a36cf47d991725f34fb0d05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Tesa=C5=99=C3=ADk?= Date: Wed, 8 Dec 2021 16:31:52 +0000 Subject: [PATCH] Accepting request 936727 from home:ptesarik:branches:Kernel:kdump - Update to 0.9.2 * Isolate fadump initrd within the default one (jsc#SLE-18272) * Bug fixes * Code cleanups - Remove patches that have been upstreamed: * kdump-mounts.cc-Include-sys-ioctl.h.patch * kdump-Add-bootdev-to-dracut-command-line.patch * kdump-do-not-iterate-past-end-of-string.patch * kdump-fix-incorrect-exit-code-checking.patch * kdump-avoid-endless-loop-on-EAI_AGAIN.patch * kdump-install-real-resolv.conf.patch * kdump-Store-kdump-initrd-in-kernel-image-path.patch - Remove patches that have been solved differently: * kdump-on-error-option-yesno.patch OBS-URL: https://build.opensuse.org/request/show/936727 OBS-URL: https://build.opensuse.org/package/show/Kernel:kdump/kdump?expand=0&rev=215 --- kdump-0.9.1.tar.bz2 | 3 - kdump-0.9.2.tar.bz2 | 3 + ...p-Add-bootdev-to-dracut-command-line.patch | 27 ----- ...re-kdump-initrd-in-kernel-image-path.patch | 54 ---------- kdump-avoid-endless-loop-on-EAI_AGAIN.patch | 102 ------------------ kdump-do-not-iterate-past-end-of-string.patch | 27 ----- kdump-fix-incorrect-exit-code-checking.patch | 40 ------- kdump-install-real-resolv.conf.patch | 36 ------- kdump-mounts.cc-Include-sys-ioctl.h.patch | 26 ----- kdump-on-error-option-yesno.patch | 48 --------- kdump-use-pbl.patch | 12 +-- kdump.changes | 18 ++++ kdump.spec | 21 +--- 13 files changed, 28 insertions(+), 389 deletions(-) delete mode 100644 kdump-0.9.1.tar.bz2 create mode 100644 kdump-0.9.2.tar.bz2 delete mode 100644 kdump-Add-bootdev-to-dracut-command-line.patch delete mode 100644 kdump-Store-kdump-initrd-in-kernel-image-path.patch delete mode 100644 kdump-avoid-endless-loop-on-EAI_AGAIN.patch delete mode 100644 kdump-do-not-iterate-past-end-of-string.patch delete mode 100644 kdump-fix-incorrect-exit-code-checking.patch delete mode 100644 kdump-install-real-resolv.conf.patch delete mode 100644 kdump-mounts.cc-Include-sys-ioctl.h.patch delete mode 100644 kdump-on-error-option-yesno.patch diff --git a/kdump-0.9.1.tar.bz2 b/kdump-0.9.1.tar.bz2 deleted file mode 100644 index 54b3a4c..0000000 --- a/kdump-0.9.1.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2bd4a78f909837e438fa5d07a4777d3430dc5d4f95ef09eca9374496f0a360a1 -size 3340445 diff --git a/kdump-0.9.2.tar.bz2 b/kdump-0.9.2.tar.bz2 new file mode 100644 index 0000000..e6913d0 --- /dev/null +++ b/kdump-0.9.2.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:72a45e83999656e39a74bc7859f08ee17d578178467ddd5d5c0bf18efc6b4bcd +size 3352032 diff --git a/kdump-Add-bootdev-to-dracut-command-line.patch b/kdump-Add-bootdev-to-dracut-command-line.patch deleted file mode 100644 index 30bded1..0000000 --- a/kdump-Add-bootdev-to-dracut-command-line.patch +++ /dev/null @@ -1,27 +0,0 @@ -From: Petr Tesarik -Date: Thu, 1 Apr 2021 15:09:52 +0200 -Subject: Add 'bootdev=' to dracut command line -References: bsc#1182309 -Git-commit: fe0777beff90a2479b451f5ef9e918249277c8ff - -If this parameter is missing, dracut will parse the ip= command -line option(s) and create the corresponding initqueue jobs, but it -will not actually run them, unless they are needed to mount the -root filesystem. - -Fixes: 2ad80dd96b91b889db44dd8c955cb127840a2be2 -Signed-off-by: Petr Tesarik ---- - init/module-setup.sh | 1 + - 1 file changed, 1 insertion(+) - ---- a/init/module-setup.sh -+++ b/init/module-setup.sh -@@ -213,6 +213,7 @@ kdump_cmdline_ip() { - - kdump_ifname_config "$kdump_host_if" - -+ echo -n "bootdev=$kdump_iface" - echo -n "$kdump_netif" - - case "$kdump_net_mode" in diff --git a/kdump-Store-kdump-initrd-in-kernel-image-path.patch b/kdump-Store-kdump-initrd-in-kernel-image-path.patch deleted file mode 100644 index f6d7fd9..0000000 --- a/kdump-Store-kdump-initrd-in-kernel-image-path.patch +++ /dev/null @@ -1,54 +0,0 @@ -From: Petr Tesarik -Date: Thu Nov 25 21:40:15 2021 +0100 -Subject: Store kdump initrd in the kernel image path -Upstream: merged -Git-commit: 202eef81d13fb0488f6e462e78ce20841a477c86 - -If the kernel image is a symlink, store the kdump initrd in the -same directory as the symlink. This fixes kdump for usrmerge -kernels, where the kernel image is under /usr. - -Canonical path is still used to get the kernel version. - -References: boo#1190920 -Signed-off-by: Petr Tesarik - ---- - kdumptool/findkernel.cc | 4 +--- - kdumptool/kerneltool.cc | 5 ++--- - 2 files changed, 3 insertions(+), 6 deletions(-) - ---- a/kdumptool/kerneltool.cc -+++ b/kdumptool/kerneltool.cc -@@ -142,7 +142,7 @@ bool KernelTool::stripImageName(const Fi - string &rest) - { - directory = kernelImage.dirName(); -- KString kernel = kernelImage.baseName(); -+ KString kernel = kernelImage.getCanonicalPath().baseName(); - - list imageNames = KernelTool::imageNames(Util::getArch()); - for (list::const_iterator it = imageNames.begin(); -@@ -470,8 +470,7 @@ Kconfig *KernelTool::retrieveKernelConfi - // at first, search for the config on disk - string dir, stripped; - -- if (KernelTool::stripImageName( -- m_kernel.getCanonicalPath(), dir, stripped)) { -+ if (KernelTool::stripImageName(m_kernel, dir, stripped)) { - FilePath config = dir; - config.appendPath("config-" + stripped); - Debug::debug()->dbg("Trying %s for config", config.c_str()); ---- a/kdumptool/findkernel.cc -+++ b/kdumptool/findkernel.cc -@@ -313,9 +313,7 @@ string FindKernel::findInitrd(const File - // use the resolved name, not the symlink to generate the initrd - FilePath dir; - string stripped; -- KernelTool::stripImageName( -- kernelPath.getCanonicalPath(), dir, stripped -- ); -+ KernelTool::stripImageName(kernelPath, dir, stripped); - - string dash; - if (stripped.size() > 0) { diff --git a/kdump-avoid-endless-loop-on-EAI_AGAIN.patch b/kdump-avoid-endless-loop-on-EAI_AGAIN.patch deleted file mode 100644 index c55c5ab..0000000 --- a/kdump-avoid-endless-loop-on-EAI_AGAIN.patch +++ /dev/null @@ -1,102 +0,0 @@ -From: Petr Pavlu -Date: Thu Mar 25 12:48:54 2021 +0100 -Subject: Avoid an endless loop when resolving a hostname fails with EAI_AGAIN -References: bsc#1183070 -Upstream: merged -Git-commit: 716883423f45acf3271c200353dce074d6ffc5be - -Method Routable::resolve() invokes function getaddrinfo() to obtain a -network address for a given hostname. This operation can fail with the -error code EAI_AGAIN to indicate that the name server encountered a -temporary failure. Routable::resolve() reacts to this situation by -calling getaddrinfo() again which can result in an endless loop if the -function continues to return this error code. It is not guaranteed that -the underlying reason for EAI_AGAIN will go away in some bounded time. - -The patch removes the EAI_AGAIN loop in Routable::resolve() and updates -the retry code in Routable::check() to repeatedly attempt resolving a -hostname until it succeeds or a specified timeout for network operations -is reached. - ---- - kdumptool/routable.cc | 38 ++++++++++++++++++++++++++++++-------- - 1 file changed, 30 insertions(+), 8 deletions(-) - ---- a/kdumptool/routable.cc -+++ b/kdumptool/routable.cc -@@ -17,6 +17,7 @@ - * 02110-1301, USA. - */ - -+#include - #include - - #include -@@ -36,6 +37,8 @@ - #include "stringutil.h" - #include "debug.h" - -+using std::min; -+ - //{{{ NetLink ------------------------------------------------------------------ - - #define NETLINK_DEF_RECV_MAX 1024 -@@ -470,9 +473,7 @@ bool Routable::resolve(void) - memset(&hints, 0, sizeof hints); - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_RAW; -- do { -- res = getaddrinfo(raw_host.c_str(), NULL, &hints, &m_ai); -- } while (res == EAI_AGAIN); -+ res = getaddrinfo(raw_host.c_str(), NULL, &hints, &m_ai); - - if (res == 0) - return true; -@@ -480,7 +481,8 @@ bool Routable::resolve(void) - if (res == EAI_SYSTEM) - throw KSystemError("Name resolution failed", errno); - -- if (res != EAI_NONAME && res != EAI_FAIL && res != EAI_NODATA) -+ if (res != EAI_NONAME && res != EAI_FAIL && res != EAI_NODATA && -+ res != EAI_AGAIN) - throw KGaiError("Name resolution failed", res); - - return false; -@@ -489,13 +491,33 @@ bool Routable::resolve(void) - // ----------------------------------------------------------------------------- - bool Routable::check(int timeout) - { -+ // Resolve the target hostname. An attempt is made regularly until the -+ // hostname can be resolved or a specified timeout for network operations -+ // is reached. -+ struct timespec tstop; -+ clock_gettime(CLOCK_MONOTONIC, &tstop); -+ tstop.tv_sec += timeout; -+ -+ while (!resolve()) { -+ struct timespec tsnow; -+ clock_gettime(CLOCK_MONOTONIC, &tsnow); -+ int interval = (tstop.tv_sec - tsnow.tv_sec) * 1000; -+ interval += (tstop.tv_nsec - tsnow.tv_nsec) / 1000000L; -+ if (interval <= 0) -+ return false; -+ -+ // Sleep, at most for 1 second. -+ struct timespec wait_period; -+ interval = min(interval, 1000); -+ wait_period.tv_sec = interval / 1000; -+ wait_period.tv_nsec = (interval % 1000) * 1000 * 1000; -+ nanosleep(&wait_period, NULL); -+ } -+ -+ // Check there is an existing route. - NetLink nl(RTMGRP_IPV4_ROUTE | RTMGRP_IPV6_ROUTE); - nl.setTimeout(timeout); - -- while (!resolve()) -- if (nl.waitRouteChange() != 0) -- return false; -- - while (!hasRoute()) - if (nl.waitRouteChange() != 0) - return false; diff --git a/kdump-do-not-iterate-past-end-of-string.patch b/kdump-do-not-iterate-past-end-of-string.patch deleted file mode 100644 index d794624..0000000 --- a/kdump-do-not-iterate-past-end-of-string.patch +++ /dev/null @@ -1,27 +0,0 @@ -From: Petr Tesarik -Date: Fri May 28 11:30:48 2021 +0200 -Subject: URLParser::extractAuthority(): Do not iterate past end of string -References: bsc#1186037 -Upstream: merged -Git-commit: 208ed364ac926f800f37874d08e5b2c26547974e - -If there is no '/', '?' or '#' at the end of the authority part of -the URL, kdumptool must not crash. - -Signed-off-by: Petr Tesarik - ---- - kdumptool/urlparser.cc | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/kdumptool/urlparser.cc -+++ b/kdumptool/urlparser.cc -@@ -117,7 +117,7 @@ string URLParser::extractAuthority(strin - - it += 2; - string::iterator const start = it; -- while (*it != '/' && *it != '?' && *it != '#') -+ while (it != end && *it != '/' && *it != '?' && *it != '#') - ++it; - - return string(start, it); diff --git a/kdump-fix-incorrect-exit-code-checking.patch b/kdump-fix-incorrect-exit-code-checking.patch deleted file mode 100644 index 6e496f7..0000000 --- a/kdump-fix-incorrect-exit-code-checking.patch +++ /dev/null @@ -1,40 +0,0 @@ -Author: Petr Tesarik -Date: Tue May 25 12:48:08 2021 +0200 -Subject: Fix incorrect exit code checking after "local" with assignment -References: bsc#1184616 LTC#192282 -Upstream: merged -Git-commit: 33abc7c481f62c23727505eafa354253088dae8d - -The "local" keyword cannot be combined with the assignment if the -exit status is needed later. The exit status of the whole -statement is that of the "local" built-in (always zero), -regardless of the the exit status of the assignment. - -Acked-by: Petr Tesarik - ---- - init/load.sh | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - ---- a/init/load.sh -+++ b/init/load.sh -@@ -312,7 +312,8 @@ function load_kdump_fadump() - # Find the desired kernel and initrd - function find_kernel() - { -- local output=$($KDUMPTOOL find_kernel) -+ local output -+ output=$($KDUMPTOOL find_kernel) - test $? -eq 0 || return 1 - - kdump_kernel=$(echo "$output" | grep ^Kernel | cut -f 2) -@@ -325,7 +326,8 @@ function find_kernel() - # Rebuild the kdump initramfs if necessary - function rebuild_kdumprd() - { -- local output=$(mkdumprd -K "$kdump_kernel" -I "$kdump_initrd" 2>&1) -+ local output -+ output=$(mkdumprd -K "$kdump_kernel" -I "$kdump_initrd" 2>&1) - if [ $? -ne 0 ] ; then - echo "$output" - return 1 diff --git a/kdump-install-real-resolv.conf.patch b/kdump-install-real-resolv.conf.patch deleted file mode 100644 index d4894fc..0000000 --- a/kdump-install-real-resolv.conf.patch +++ /dev/null @@ -1,36 +0,0 @@ -From: Petr Pavlu -Date: Thu Mar 25 12:43:32 2021 +0100 -Subject: Install /etc/resolv.conf using its resolved path -References: bsc#1183070 -Upstream: merged -Git-commit: b8439e03d4479f3ffa4b42961a5da18f4b819122 - -Resolve /etc/resolv.conf first to install directly the target file if it -is a symlink. This simplifies the setup and avoids any problems when the -real resolv.conf could be in a location that gets hidden by a mount done -in the kdump environment, for instance, /etc/resolv.conf -> -/run/netconfig/resolv.conf with tmpfs getting mounted on /run. - ---- - init/module-setup.sh | 10 +++++++++- - 1 file changed, 9 insertions(+), 1 deletion(-) - ---- a/init/module-setup.sh -+++ b/init/module-setup.sh -@@ -308,7 +308,15 @@ install() { - - inst_multiple makedumpfile makedumpfile-R.pl kdumptool \ - $KDUMP_REQUIRED_PROGRAMS -- inst_simple /etc/resolv.conf -+ -+ # Install /etc/resolv.conf to provide initial DNS configuration. The file -+ # is resolved first to install directly the target file if it is a symlink. -+ # The real resolv.conf could be in a location that gets hidden by a mount -+ # done in the kdump environment, for instance, /etc/resolv.conf -> -+ # /run/netconfig/resolv.conf with tmpfs getting mounted on /run. -+ local resolv=$(realpath /etc/resolv.conf) -+ inst_simple "$resolv" /etc/resolv.conf -+ - inst_simple /usr/share/zoneinfo/UTC - inst_simple /etc/localtime - } diff --git a/kdump-mounts.cc-Include-sys-ioctl.h.patch b/kdump-mounts.cc-Include-sys-ioctl.h.patch deleted file mode 100644 index 9ad0854..0000000 --- a/kdump-mounts.cc-Include-sys-ioctl.h.patch +++ /dev/null @@ -1,26 +0,0 @@ -From: Petr Tesarik -Date: Fri Mar 5 18:25:14 2021 +0100 -Subject: mounts.cc: Include -Upstream: merged -Git-commit: 9c47874dadcdb39fbb3cededc46bc32449f42374 - -Since the code uses ioctl(), it should include the corresponding -header file. This was not found before release, because including -the header file is not necessary with some glibc versions... - -Signed-off-by: Petr Tesarik - -diff --git a/kdumptool/mounts.cc b/kdumptool/mounts.cc -index 79bf4fc..d792e53 100644 ---- a/kdumptool/mounts.cc -+++ b/kdumptool/mounts.cc -@@ -36,6 +36,9 @@ - #include - #include - -+// for ioctl() -+#include -+ - #include - - #include "global.h" diff --git a/kdump-on-error-option-yesno.patch b/kdump-on-error-option-yesno.patch deleted file mode 100644 index 89bc8de..0000000 --- a/kdump-on-error-option-yesno.patch +++ /dev/null @@ -1,48 +0,0 @@ -From: Lance Wang -Subject: Support yes/no style for KDUMP_CONTINUE_ON_ERROR -References: bsc#1083155 -Upstream: tbd - -The /etc/sysconfig/kdump in latest kdump initrd is generated by -kdumptool. So the value of KDUMP_CONTINUE_ON_ERROR is yes instead -of true. This patch make save_dump.sh support this value. - -Signed-off-by: Lance Wang -Acked-by: Petr Tesarik - ---- - init/save_dump.sh | 22 +++++++++++++--------- - 1 file changed, 13 insertions(+), 9 deletions(-) - ---- a/init/save_dump.sh -+++ b/init/save_dump.sh -@@ -101,16 +101,20 @@ function continue_error() - - echo "Last command failed ($status)." - -- if ! [ "$KDUMP_CONTINUE_ON_ERROR" = "true" -o \ -- "$KDUMP_CONTINUE_ON_ERROR" = "TRUE" ] ; then -- echo -- echo "Something failed. You can try to debug that here." -- echo "Type 'reboot -f' to reboot the system or 'exit' to" -- echo "boot in a normal system that still is running in the" -- echo "kdump environment with restricted memory!" -- bash -- return 1 -+ if [ "$KDUMP_CONTINUE_ON_ERROR" = "yes" -o \ -+ "$KDUMP_CONTINUE_ON_ERROR" = "YES" -o \ -+ "$KDUMP_CONTINUE_ON_ERROR" = "true" -o \ -+ "$KDUMP_CONTINUE_ON_ERROR" = "TRUE" ]; then -+ return 0 - fi -+ -+ echo -+ echo "Something failed. You can try to debug that here." -+ echo "Type 'reboot -f' to reboot the system or 'exit' to" -+ echo "boot in a normal system that still is running in the" -+ echo "kdump environment with restricted memory!" -+ bash -+ return 1 - } - - function rw_fixup() diff --git a/kdump-use-pbl.patch b/kdump-use-pbl.patch index 355de53..0c9dc82 100644 --- a/kdump-use-pbl.patch +++ b/kdump-use-pbl.patch @@ -25,19 +25,15 @@ Acked-by: Petr Tesarik PERMISSIONS --- a/init/load.sh +++ b/init/load.sh -@@ -214,18 +214,10 @@ function fadump_bootloader() +@@ -214,14 +214,10 @@ function fadump_bootloader() local newstate="$1" # check if the old configuration is still valid - boot_opts=$(kdump-bootloader.pl --get) - nofadump_opts=$(echo "$boot_opts" | remove_from_commandline 'fadump') -- old_opts=$($KDUMPTOOL -F /dev/null -C <(echo "$boot_opts") \ -- dump_config --usage dump --format kernel --nodefault) if [ "$newstate" = on ] ; then -- curr_opts=$($KDUMPTOOL dump_config --usage dump --format kernel --nodefault) -- if [ "$old_opts" != "$curr_opts" -o \ -- "$boot_opts" = "$nofadump_opts" ] ; then -- kdump-bootloader.pl --update fadump=on "$curr_opts" +- if [ "$boot_opts" = "$nofadump_opts" ] ; then +- kdump-bootloader.pl --update fadump=on - fi - elif [ "$boot_opts" != "$nofadump_opts" ] ; then - kdump-bootloader.pl --update @@ -78,7 +74,7 @@ Acked-by: Petr Tesarik - my $param = $rawparam; - $param =~ s/"//g; - $param =~ s/=(.*)//; -- if (! ($param =~ /^KDUMP(TOOL)?_|^MAKEDUMPFILE_|^fadump$/)) { +- if (! ($param =~ /^fadump$/)) { - $result .= " " if length($result); - $result .= $rawparam; - } diff --git a/kdump.changes b/kdump.changes index 9d2752f..5051be4 100644 --- a/kdump.changes +++ b/kdump.changes @@ -1,3 +1,21 @@ +------------------------------------------------------------------- +Wed Dec 8 15:06:58 UTC 2021 - Petr Tesařík + +- Update to 0.9.2 + * Isolate fadump initrd within the default one (jsc#SLE-18272) + * Bug fixes + * Code cleanups +- Remove patches that have been upstreamed: + * kdump-mounts.cc-Include-sys-ioctl.h.patch + * kdump-Add-bootdev-to-dracut-command-line.patch + * kdump-do-not-iterate-past-end-of-string.patch + * kdump-fix-incorrect-exit-code-checking.patch + * kdump-avoid-endless-loop-on-EAI_AGAIN.patch + * kdump-install-real-resolv.conf.patch + * kdump-Store-kdump-initrd-in-kernel-image-path.patch +- Remove patches that have been solved differently: + * kdump-on-error-option-yesno.patch + ------------------------------------------------------------------- Thu Nov 25 21:04:51 UTC 2021 - Petr Tesařík diff --git a/kdump.spec b/kdump.spec index b79d886..4e8be1e 100644 --- a/kdump.spec +++ b/kdump.spec @@ -24,7 +24,7 @@ %define dracutlibdir %{_prefix}/lib/dracut Name: kdump -Version: 0.9.1 +Version: 0.9.2 Release: 0 Summary: Script for kdump License: GPL-2.0-or-later @@ -34,14 +34,6 @@ Source: %{name}-%{version}.tar.bz2 Source2: %{name}-rpmlintrc Patch1: %{name}-fillupdir-fixes.patch Patch9: %{name}-use-pbl.patch -Patch10: %{name}-on-error-option-yesno.patch -Patch11: %{name}-mounts.cc-Include-sys-ioctl.h.patch -Patch12: %{name}-Add-bootdev-to-dracut-command-line.patch -Patch13: %{name}-do-not-iterate-past-end-of-string.patch -Patch14: %{name}-fix-incorrect-exit-code-checking.patch -Patch15: %{name}-avoid-endless-loop-on-EAI_AGAIN.patch -Patch16: %{name}-install-real-resolv.conf.patch -Patch17: %{name}-Store-kdump-initrd-in-kernel-image-path.patch BuildRequires: asciidoc BuildRequires: cmake BuildRequires: gcc-c++ @@ -97,14 +89,6 @@ after a crash dump has occured. %patch1 -p1 %endif %patch9 -p1 -%patch10 -p1 -%patch11 -p1 -%patch12 -p1 -%patch13 -p1 -%patch14 -p1 -%patch15 -p1 -%patch16 -p1 -%patch17 -p1 %build export CXXFLAGS="%{optflags} -std=c++11" @@ -198,11 +182,12 @@ rm %{_localstatedir}/log/dump >/dev/null 2>&1 || true %{_fillupdir}/sysconfig.kdump %dir %{dracutlibdir} %dir %{dracutlibdir}/modules.d -%{dracutlibdir}/modules.d/99kdump/ +%{dracutlibdir}/modules.d/* %dir /lib/kdump /lib/kdump/* %dir /usr/lib/kdump /usr/lib/kdump/70-kdump.rules +/usr/lib/kdump/kdump-save %{_unitdir}/kdump.service %{_unitdir}/kdump-early.service %{_sbindir}/rckdump