SHA256
1
0
forked from pool/kdump

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
This commit is contained in:
Petr Tesařík 2021-12-08 16:31:52 +00:00 committed by Git OBS Bridge
parent 0d7b1fc32d
commit f611d607d5
13 changed files with 28 additions and 389 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2bd4a78f909837e438fa5d07a4777d3430dc5d4f95ef09eca9374496f0a360a1
size 3340445

3
kdump-0.9.2.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:72a45e83999656e39a74bc7859f08ee17d578178467ddd5d5c0bf18efc6b4bcd
size 3352032

View File

@ -1,27 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
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 <ptesarik@suse.com>
---
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

View File

@ -1,54 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
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 <ptesarik@suse.com>
---
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<string> imageNames = KernelTool::imageNames(Util::getArch());
for (list<string>::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) {

View File

@ -1,102 +0,0 @@
From: Petr Pavlu <petr.pavlu@suse.com>
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 <algorithm>
#include <string.h>
#include <unistd.h>
@@ -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;

View File

@ -1,27 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
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 <ptesarik@suse.com>
---
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);

View File

@ -1,40 +0,0 @@
Author: Petr Tesarik <ptesarik@suse.com>
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 <ptesarik@suse.com>
---
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

View File

@ -1,36 +0,0 @@
From: Petr Pavlu <petr.pavlu@suse.com>
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
}

View File

@ -1,26 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Fri Mar 5 18:25:14 2021 +0100
Subject: mounts.cc: Include <sys/ioctl.h>
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 <ptesarik@suse.com>
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 <sys/stat.h>
#include <fcntl.h>
+// for ioctl()
+#include <sys/ioctl.h>
+
#include <linux/btrfs.h>
#include "global.h"

View File

@ -1,48 +0,0 @@
From: Lance Wang <lzwang@suse.com>
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 <lzwang@suse.com>
Acked-by: Petr Tesarik <ptesarik@suse.com>
---
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()

View File

@ -25,19 +25,15 @@ Acked-by: Petr Tesarik <ptesarik@suse.com>
PERMISSIONS PERMISSIONS
--- a/init/load.sh --- a/init/load.sh
+++ b/init/load.sh +++ b/init/load.sh
@@ -214,18 +214,10 @@ function fadump_bootloader() @@ -214,14 +214,10 @@ function fadump_bootloader()
local newstate="$1" local newstate="$1"
# check if the old configuration is still valid # check if the old configuration is still valid
- boot_opts=$(kdump-bootloader.pl --get) - boot_opts=$(kdump-bootloader.pl --get)
- nofadump_opts=$(echo "$boot_opts" | remove_from_commandline 'fadump') - 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 if [ "$newstate" = on ] ; then
- curr_opts=$($KDUMPTOOL dump_config --usage dump --format kernel --nodefault) - if [ "$boot_opts" = "$nofadump_opts" ] ; then
- if [ "$old_opts" != "$curr_opts" -o \ - kdump-bootloader.pl --update fadump=on
- "$boot_opts" = "$nofadump_opts" ] ; then
- kdump-bootloader.pl --update fadump=on "$curr_opts"
- fi - fi
- elif [ "$boot_opts" != "$nofadump_opts" ] ; then - elif [ "$boot_opts" != "$nofadump_opts" ] ; then
- kdump-bootloader.pl --update - kdump-bootloader.pl --update
@ -78,7 +74,7 @@ Acked-by: Petr Tesarik <ptesarik@suse.com>
- my $param = $rawparam; - my $param = $rawparam;
- $param =~ s/"//g; - $param =~ s/"//g;
- $param =~ s/=(.*)//; - $param =~ s/=(.*)//;
- if (! ($param =~ /^KDUMP(TOOL)?_|^MAKEDUMPFILE_|^fadump$/)) { - if (! ($param =~ /^fadump$/)) {
- $result .= " " if length($result); - $result .= " " if length($result);
- $result .= $rawparam; - $result .= $rawparam;
- } - }

View File

@ -1,3 +1,21 @@
-------------------------------------------------------------------
Wed Dec 8 15:06:58 UTC 2021 - Petr Tesařík <ptesarik@suse.com>
- 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 <ptesarik@suse.com> Thu Nov 25 21:04:51 UTC 2021 - Petr Tesařík <ptesarik@suse.com>

View File

@ -24,7 +24,7 @@
%define dracutlibdir %{_prefix}/lib/dracut %define dracutlibdir %{_prefix}/lib/dracut
Name: kdump Name: kdump
Version: 0.9.1 Version: 0.9.2
Release: 0 Release: 0
Summary: Script for kdump Summary: Script for kdump
License: GPL-2.0-or-later License: GPL-2.0-or-later
@ -34,14 +34,6 @@ Source: %{name}-%{version}.tar.bz2
Source2: %{name}-rpmlintrc Source2: %{name}-rpmlintrc
Patch1: %{name}-fillupdir-fixes.patch Patch1: %{name}-fillupdir-fixes.patch
Patch9: %{name}-use-pbl.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: asciidoc
BuildRequires: cmake BuildRequires: cmake
BuildRequires: gcc-c++ BuildRequires: gcc-c++
@ -97,14 +89,6 @@ after a crash dump has occured.
%patch1 -p1 %patch1 -p1
%endif %endif
%patch9 -p1 %patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%build %build
export CXXFLAGS="%{optflags} -std=c++11" export CXXFLAGS="%{optflags} -std=c++11"
@ -198,11 +182,12 @@ rm %{_localstatedir}/log/dump >/dev/null 2>&1 || true
%{_fillupdir}/sysconfig.kdump %{_fillupdir}/sysconfig.kdump
%dir %{dracutlibdir} %dir %{dracutlibdir}
%dir %{dracutlibdir}/modules.d %dir %{dracutlibdir}/modules.d
%{dracutlibdir}/modules.d/99kdump/ %{dracutlibdir}/modules.d/*
%dir /lib/kdump %dir /lib/kdump
/lib/kdump/* /lib/kdump/*
%dir /usr/lib/kdump %dir /usr/lib/kdump
/usr/lib/kdump/70-kdump.rules /usr/lib/kdump/70-kdump.rules
/usr/lib/kdump/kdump-save
%{_unitdir}/kdump.service %{_unitdir}/kdump.service
%{_unitdir}/kdump-early.service %{_unitdir}/kdump-early.service
%{_sbindir}/rckdump %{_sbindir}/rckdump