SHA256
1
0
forked from pool/kdump

Accepting request 603630 from home:ptesarik:branches:Kernel:kdump

- Update to 0.9.0
  o Remove support for mkinitrd(8).
- Drop patches now in mainline:
  o kdump-Don-t-split-by-default.patch
  o kdump-Dont-exit-even-if-initrd-is-not-built.patch
  o kdump-KDUMP_SSH_IDENTITY-cfg.patch
  o kdump-KDUMP_SSH_IDENTITY.patch
  o kdump-Limit-kdump-cpus-to-number-provided-by-config.patch
  o kdump-Routable-preferred-source-address.patch
  o kdump-URLTransfer-complete-target.patch
  o kdump-aarch64.patch
  o kdump-activate-QETH-devices.patch
  o kdump-additional-mounts-in-dracut-module.patch
  o kdump-always-copy-timezone.patch
  o kdump-always-kexec_load-if-kexec_file_load-fails.patch
  o kdump-always-pass-kernelver-to-dracut.patch
  o kdump-bail-out-if-no-default-interface.patch
  o kdump-bind-mount-sysroot.patch
  o kdump-bootloader-filter-out-KDUMPTOOL_FLAGS.patch
  o kdump-calibrate-adjust-sizeof-struct-page.patch
  o kdump-calibrate-do-not-add-KDUMP_PHYS_LOAD-to-RAM.patch
  o kdump-calibrate-update-kernel-text-data-size.patch
  o kdump-calibrate-update-user-space-requirements.patch
  o kdump-cmake-compat.patch
  o kdump-do-not-check-bind-mount.patch
  o kdump-do-not-free-fadump-memory-when-immediate-reboot-is-requested.patch
  o kdump-do-not-touch-dracut-vars-if-not-kdumprd.patch
  o kdump-explicitly-request-zFCP-devices.patch
  o kdump-fail-if-fadump-cannot-be-registered.patch
  o kdump-fix-m_threads-missing-initialization.patch
  o kdump-fix-missing-index-of-kdump_Host.patch
  o kdump-fix-save_dump-to-NFS.patch
  o kdump-fix-service-files.patch
  o kdump-invoke-subcommand-destructors-on-exit.patch
  o kdump-kdump_echo-and-kdump_logger-helpers.patch
  o kdump-move-class-SystemCPU-to-header-file.patch
  o kdump-multithreading-by-default.patch
  o kdump-no-crashkernel-in-Xen-PV-DomU.patch
  o kdump-no-xen-secondary-kernel.patch
  o kdump-nokaslr.patch
  o kdump-nsswitch.conf-filtering.patch
  o kdump-pass-IPv6-address-prefix-separately.patch
  o kdump-pass-all-IP-routes-to-kdump-environment.patch
  o kdump-pre-generate-mount-units.patch
  o kdump-prepend-IP-address.patch
  o kdump-remount-sysroot-readwrite.patch
  o kdump-remove-IPv6-brackets-for-getaddrinfo.patch
  o kdump-run-mkinitrd-if-fadump-is-active.patch
  o kdump-skip-IPv4-if-no-address.patch
  o kdump-source-save_dump.patch
  o kdump-treat-KDUMP_CPUS-0-as-all-available-CPUs.patch
  o kdump-try-both-kexec_load-and-kexec_file_load.patch
  o kdump-use-bus-id-to-identify-qeth-devices.patch
  o kdump-x86_64-kexec-file-syscall.patch
- Remove kdump-cmake-compat.patch: Since mkinitrd support has been
  removed, compatibility with SLE11 is no longer needed.

OBS-URL: https://build.opensuse.org/request/show/603630
OBS-URL: https://build.opensuse.org/package/show/Kernel:kdump/kdump?expand=0&rev=166
This commit is contained in:
Petr Tesařík 2018-05-04 07:41:54 +00:00 committed by Git OBS Bridge
parent a4929c8e6f
commit f18116a174
55 changed files with 66 additions and 4147 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:00e4ba5d9b424c7051e28b4014a0d341670ba1f3969226452d52007649e521fc
size 3336777

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

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:717398896b1d0a9f8cb9edcb1317177edacb41c2caccc17b84b4a21d2252dd01
size 3336207

View File

@ -1,45 +0,0 @@
From 51a68c31497d1895602d5c6851e23a9027d9675d Mon Sep 17 00:00:00 2001
From: Ankit Kumar <ankit@linux.vnet.ibm.com>
Date: Thu, 10 Aug 2017 15:04:32 +0530
Subject: [PATCH] Don't split by default
References: bsc#1036223, bsc#1068234
Patch-mainline: v0.8.17
Git-commit: 51a68c31497d1895602d5c6851e23a9027d9675d
Currently, we are default'ing to "SPILT" as well as multi-threading
when KDUMPTOOL_FLAGS="". Ensure split is enabled only when it is set
explicitly with KDUMPTOOL_FLAGS="SPLIT".
Signed-off-by: Ankit Kumar <ankit@linux.vnet.ibm.com>
---
kdumptool/savedump.cc | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/kdumptool/savedump.cc b/kdumptool/savedump.cc
index ec66e63bd29b..e832bf98b762 100644
--- a/kdumptool/savedump.cc
+++ b/kdumptool/savedump.cc
@@ -294,15 +294,12 @@ void SaveDump::saveDump(const RootDirURLVector &urlv)
if (cpus > online_cpus)
cpus = online_cpus;
}
- if (!config->kdumptoolContainsFlag("NOSPLIT") &&
- !config->kdumptoolContainsFlag("SINGLE") &&
+ if (!config->kdumptoolContainsFlag("SINGLE") &&
cpus > 1) {
- if (!useElf)
- m_split = cpus;
- else
- cerr << "Splitting ELF dumps is not supported." << endl;
- if (config->kdumptoolContainsFlag("SPLIT")) {
+ /* The check for NOSPLIT is for backward compatibility */
+ if (config->kdumptoolContainsFlag("SPLIT") &&
+ !config->kdumptoolContainsFlag("NOSPLIT")) {
if (!useElf)
m_split = cpus;
else
--
2.13.6

View File

@ -1,50 +0,0 @@
From 086068496508087b68029ae31a93ed5d3e4ac2cb Mon Sep 17 00:00:00 2001
From: Ankit Kumar <ankit@linux.vnet.ibm.com>
Date: Mon, 7 Aug 2017 20:35:04 +0530
Subject: [PATCH] Don't exit even if initrd is not built
References: bsc#1047781
Patch-mainline: v0.8.17
Git-commit: 086068496508087b68029ae31a93ed5d3e4ac2cb
In case where there is no change in kdump config, new initrd won't be
built. Restarting kdump.service in above case exits as initrd is same
as older. As control doesn't proceed further, it fails to enable dump
configuration.
This patch fixes above mentioned issue by proceeding further and enabling
dump configuration.
Signed-off-by: Ankit Kumar <ankit@linux.vnet.ibm.com>
Acked-by: Michal Suchanek <msuchanek@suse.de>
---
init/load.sh | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/init/load.sh b/init/load.sh
index 4fc7a82e7199..6910bc546d9c 100755
--- a/init/load.sh
+++ b/init/load.sh
@@ -309,13 +309,13 @@ if [ "$1" = "--update" ] ; then
rebuild_kdumprd || exit 1
after=$(stat -c %Y $kdump_initrd)
- # If the initial ram disk was not updated,
- # do not execute kexec again. This script
- # is called from kdump.service and
+ # This script is called from kdump.service and
# kdump-rebuild-initrd.service.
- if [ "$before" = "$after" ] ; then
- exit 0
- fi
+ # Proceed further even if there is no change in initrd
+ # because restart kdump.service unloads kdump/fadump and
+ # in next service start below enablement will be required
+ # otherwise kdump/fadump won't be enabled and leads to panic
+ # on crash.
fi
if [ "$KDUMP_FADUMP" = "yes" ] ; then
--
2.13.6

View File

@ -1,32 +0,0 @@
Date: Tue May 16 13:30:14 2017 +0200
From: Petr Tesarik <ptesarik@suse.com>
Subject: Add KDUMP_SSH_IDENTITY to the config file template
References: FATE#321583
Git-commit: c257bdb31fa65133fe3a380b09e61566fefef4fe
Upstream: v0.8.17
Also put the new option to the config file template, so it can be
modified using the standard /etc/sysconfig editor.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
sysconfig.kdump.in | 10 ++++++++++
1 file changed, 10 insertions(+)
--- a/sysconfig.kdump.in
+++ b/sysconfig.kdump.in
@@ -383,3 +383,13 @@ KDUMP_NOTIFICATION_CC=""
#
# See also: kdump(5)
KDUMP_HOST_KEY=""
+
+## Type: string
+## Default: ""
+## ServiceRestart: kdump
+#
+# List of SSH identity files for public key authentication. If empty, kdump
+# will try all standard OpenSSH identities for the 'root' user.
+#
+# See also: kdump(5)
+KDUMP_SSH_IDENTITY=""

View File

@ -1,101 +0,0 @@
Date: Tue May 16 13:23:49 2017 +0200
From: Petr Tesarik <ptesarik@suse.com>
Subject: Add KDUMP_SSH_IDENTITY config option
References: FATE#321583
Git-commit: 3e7e5f020024eed5c6d944e0ff9554772cbdb896
Git-commit: d7e6f45461bf0f899cfedf564d985cf5cd41f331
Git-commit: f0a43757c99635ece304fc9c011c0b82acd86f64
Upstream: v0.8.17
Make the SSH private file configurable.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
doc/man/kdump.5.txt.in | 10 ++++++++++
init/setup-kdump.functions | 39 ++++++++++++++++++++++++++++-----------
kdumptool/define_opt.h | 1 +
3 files changed, 39 insertions(+), 11 deletions(-)
--- a/doc/man/kdump.5.txt.in
+++ b/doc/man/kdump.5.txt.in
@@ -643,7 +643,17 @@ Example (broken into lines for readabili
Default: ""
+KDUMP_SSH_IDENTITY
+~~~~~~~~~~~~~~~~~~
+List of SSH identity files for public key authentication. If empty, kdump
+will try all standard OpenSSH identities for the 'root' user (rsa, dsa,
+ecdsa, ed25519, in this order). The path to every identity file is relative
+to +~root/.ssh+, or an absolute path can be given.
+
+Example: "/root/.ssh/id_kdump_rsa"
+
+Default: ""
URL FORMAT
----------
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -935,6 +935,29 @@ function kdump_modify_multipath()
} # }}}
#
+# Copy SSH identity file(s) and update the target config file
+# Parameters:
+# 1) dest: root of the temporary area
+function kdump_copy_ssh_ident() # {{{
+{
+ local sshdir="$1/kdump/.ssh"
+ local ssh_conf="$sshdir/config"
+ local f
+
+ shift
+ for f in "$@"; do
+ test "${f:0:1}" = "/" || f=~root/".ssh/$f"
+ test -f "$f" || continue
+
+ cp "$f" "$sshdir/"
+ test -f "${f}.pub" && cp "${f}.pub" "$sshdir/"
+ test -f "${f}-cert.pub" && cp "${f}-cert.pub" "$sshdir/"
+ f=$( basename $f )
+ echo "IdentityFile /kdump/.ssh/${f}" >> "$ssh_conf"
+ done
+} # }}}
+
+#
# Copy SSH keys and create a config file in the target
# Parameters:
# 1) dest: root of the temporary area
@@ -952,17 +975,11 @@ function kdump_init_ssh() # {{{
echo "StrictHostKeyChecking yes" >> "$ssh_conf"
echo "UserKnownHostsFile /kdump/.ssh/known_hosts" >> "$ssh_conf"
- local type
- for type in rsa dsa ecdsa ed25519
- do
- if [ -f /root/.ssh/id_${type} -a -f /root/.ssh/id_${type}.pub ] ; then
- cp /root/.ssh/id_${type}{,.pub} "${dest}/kdump/.ssh/"
- if [ -f /root/.ssh/id_${type}-cert.pub ] ; then
- cp /root/.ssh/id_${type}-cert.pub "${dest}/kdump/.ssh/"
- fi
- echo "IdentityFile /kdump/.ssh/id_${type}" >> "$ssh_conf"
- fi
- done
+ if [ -n "$KDUMP_SSH_IDENTITY" ] ; then
+ kdump_copy_ssh_ident "$dest" $KDUMP_SSH_IDENTITY
+ else
+ kdump_copy_ssh_ident "$dest" id_{rsa,dsa,ecdsa,ed25519}
+ fi
} # }}}
#
--- a/kdumptool/define_opt.h
+++ b/kdumptool/define_opt.h
@@ -41,3 +41,4 @@ DEFINE_OPT(KDUMP_SMTP_PASSWORD, String,
DEFINE_OPT(KDUMP_NOTIFICATION_TO, String, "", DUMP)
DEFINE_OPT(KDUMP_NOTIFICATION_CC, String, "", DUMP)
DEFINE_OPT(KDUMP_HOST_KEY, String, "", DUMP)
+DEFINE_OPT(KDUMP_SSH_IDENTITY, String, "", MKINITRD)

View File

@ -1,53 +0,0 @@
From 4fc281692f5bef9a23c603a37e7a1bc30ee0a855 Mon Sep 17 00:00:00 2001
From: Ankit Kumar <ankit@linux.vnet.ibm.com>
Date: Thu, 10 Aug 2017 09:43:47 +0530
Subject: [PATCH] Limit kdump cpus to number provided by config
References: bsc#1036223, bsc#1068234
Patch-mainline: v0.8.17
Git-commit: 4fc281692f5bef9a23c603a37e7a1bc30ee0a855
Current piece of code doesn't verify number of kdump cpus provided in
config with number of online cpus and uses all online cpus as kdump cpus
even if KDUMP_CPUS are provided in the config.
Current code:
If online cpus = 5 and KDUMP_CPUS = 2 , then current piece of code
considers all online cpus as kdump cpus which is 5 but as KDUMP_CPUS
is provided as 2, we should restrict makedumpfile to use KDUMP_CPUS
which is 2 in this case.
In case of kdump, as we use maxcpus=1 and hence online cpus remains 1
but in case of fadump all cpus are online and even after providing
KDUMP_CPUS=1 in config, it consider all online cpus as kdump cpus.
This patch fixes above issue by verifying KDUMP_CPUS with online cpus.
If KDUMP_CPUS > online cpus then only use online cpus as kdump
cpus else use KDUMP_CPUS as dump cpus.
Signed-off-by: Ankit Kumar <ankit@linux.vnet.ibm.com>
---
kdumptool/savedump.cc | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/kdumptool/savedump.cc b/kdumptool/savedump.cc
index a2fb1589d9db..ec66e63bd29b 100644
--- a/kdumptool/savedump.cc
+++ b/kdumptool/savedump.cc
@@ -286,9 +286,13 @@ void SaveDump::saveDump(const RootDirURLVector &urlv)
return; // nothing to be done
unsigned long cpus = config->KDUMP_CPUS.value();
+ unsigned long online_cpus = 0;
if (cpus) {
SystemCPU syscpu;
- cpus = syscpu.numOnline();
+ online_cpus = syscpu.numOnline();
+ /* Limit kdump cpus to online cpus if (KDUMP_CPUS > online cpus) */
+ if (cpus > online_cpus)
+ cpus = online_cpus;
}
if (!config->kdumptoolContainsFlag("NOSPLIT") &&
!config->kdumptoolContainsFlag("SINGLE") &&
--
2.13.6

View File

@ -1,159 +0,0 @@
Date: Fri Jun 9 16:46:10 2017 +0200
From: Petr Tesarik <ptesarik@suse.com>
Subject: Routable: parse and store preferred source address
References: FATE#321844
Upstream: v0.8.17
Git-commit: 3748faebf9834eae0a0676800984ebccd7d3cab9
This is the preferred source address, used by the kernel for outgoing
connections when no other address is explicitly set.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
diff --git a/kdumptool/routable.cc b/kdumptool/routable.cc
index d9833f6..6137f89 100644
--- a/kdumptool/routable.cc
+++ b/kdumptool/routable.cc
@@ -58,6 +58,10 @@ class NetLink {
int waitRouteChange(void);
+ const char *prefSrc(void) const
+ throw ()
+ { return m_prefsrc; }
+
protected:
class RecvCheck {
public:
@@ -89,6 +93,8 @@ class NetLink {
throw ()
{ return m_message; }
+ int parseAttrs(const struct rtattr *rta, size_t len);
+
private:
int m_timeout;
@@ -99,13 +105,16 @@ class NetLink {
size_t m_buflen;
unsigned char *m_buffer;
struct nlmsghdr *m_message;
+
+ int m_family;
+ char m_prefsrc[INET6_ADDRSTRLEN];
};
unsigned NetLink::m_seq;
// -----------------------------------------------------------------------------
NetLink::NetLink(unsigned subscribe, size_t recv_max)
- : m_timeout(-1), m_buflen(recv_max)
+ : m_timeout(-1), m_buflen(recv_max), m_family(AF_UNSPEC)
{
struct sockaddr_nl sa;
socklen_t salen;
@@ -126,6 +135,8 @@ NetLink::NetLink(unsigned subscribe, size_t recv_max)
throw KSystemError("Cannot get local netlink address", errno);
if (salen != sizeof m_local || m_local.nl_family != AF_NETLINK)
throw KError("Invalid local netlink address");
+
+ m_prefsrc[0] = '\0';
}
// -----------------------------------------------------------------------------
@@ -354,7 +365,8 @@ int NetLink::checkRoute(const struct addrinfo *ai)
case RTN_BROADCAST:
case RTN_ANYCAST:
case RTN_MULTICAST:
- return 0;
+ m_family = rt->rtm_family;
+ return parseAttrs(RTM_RTA(rt), RTM_PAYLOAD(nh));
case RTN_UNREACHABLE:
return -EHOSTUNREACH;
case RTN_BLACKHOLE:
@@ -368,6 +380,49 @@ int NetLink::checkRoute(const struct addrinfo *ai)
}
}
+// -----------------------------------------------------------------------------
+int NetLink::parseAttrs(const struct rtattr *rta, size_t len)
+{
+ while (RTA_OK(rta, len)) {
+ void *data = RTA_DATA(rta);
+ size_t dlen = RTA_PAYLOAD(rta);
+ int res;
+
+ switch (rta->rta_type) {
+ case RTA_PREFSRC:
+ if (m_family == AF_INET &&
+ dlen == sizeof(struct in_addr)) {
+ struct sockaddr_in saddr;
+ memset(&saddr, 0, sizeof saddr);
+ saddr.sin_family = AF_INET;
+ saddr.sin_addr = *(struct in_addr *)data;
+ res = getnameinfo((struct sockaddr*)&saddr, sizeof saddr,
+ m_prefsrc, sizeof m_prefsrc,
+ NULL, 0, NI_NUMERICHOST);
+ } else if (m_family == AF_INET6 &&
+ dlen == sizeof(struct in6_addr)) {
+ struct sockaddr_in6 saddr;
+ memset(&saddr, 0, sizeof saddr);
+ saddr.sin6_family = AF_INET6;
+ saddr.sin6_addr = *(struct in6_addr *)data;
+ res = getnameinfo((struct sockaddr*)&saddr, sizeof saddr,
+ m_prefsrc, sizeof m_prefsrc,
+ NULL, 0, NI_NUMERICHOST);
+ } else
+ res = EAI_FAMILY;
+ if (res)
+ throw KGaiError("Cannot parse preferred source address", res);
+
+ break;
+ }
+ rta = RTA_NEXT(rta, len);
+ }
+ if (len)
+ throw KError("Netlink rtattr truncated");
+
+ return 0;
+}
+
//}}}
//{{{ Routable -----------------------------------------------------------------
@@ -388,8 +443,11 @@ bool Routable::hasRoute(void)
Debug::debug()->trace("hasRoute(%s)", m_host.c_str());
for (p = m_ai; p; p = p->ai_next) {
- if (nl.checkRoute(p) == 0)
+ if (nl.checkRoute(p) == 0) {
+ Debug::debug()->dbg("m_prefsrc='%s'", nl.prefSrc());
+ m_prefsrc.assign(nl.prefSrc());
return true;
+ }
}
return false;
diff --git a/kdumptool/routable.h b/kdumptool/routable.h
index cdfffaf..0763131 100644
--- a/kdumptool/routable.h
+++ b/kdumptool/routable.h
@@ -42,6 +42,10 @@ class Routable {
bool check(int timeout);
+ const std::string& prefsrc(void) const
+ throw ()
+ { return m_prefsrc; }
+
protected:
bool resolve(void)
throw (KError);
@@ -51,6 +55,7 @@ class Routable {
private:
int m_nlfd;
std::string m_host;
+ std::string m_prefsrc;
struct addrinfo *m_ai;
};

View File

@ -1,617 +0,0 @@
Date: Wed Jun 14 10:48:33 2017 +0200
From: Petr Tesarik <ptesarik@suse.com>
Subject: Use the complete target URL for URLTransfer
References: FATE#321844
Upstream: v0.8.17
Git-commit: 4540de762995219c19f8feac2f594868595741ea
Append the subdirectory name in the caller and pass around a standard
vector or RootDirURL objects.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
diff --git a/kdumptool/configuration.cc b/kdumptool/configuration.cc
index 167195d..192dcfd 100644
--- a/kdumptool/configuration.cc
+++ b/kdumptool/configuration.cc
@@ -180,11 +180,13 @@ bool Configuration::needsNetwork()
if (netconfig != "auto")
return true;
- RootDirURLVector urlv(KDUMP_SAVEDIR.value(), "");
- RootDirURLVector::iterator it;
- for (it = urlv.begin(); it != urlv.end(); ++it)
- if (it->getProtocol() != URLParser::PROT_FILE)
+ std::istringstream iss(KDUMP_SAVEDIR.value());
+ string elem;
+ while (iss >> elem) {
+ URLParser url(elem);
+ if (url.getProtocol() != URLParser::PROT_FILE)
return true;
+ }
return !KDUMP_SMTP_SERVER.value().empty() &&
!KDUMP_NOTIFICATION_TO.value().empty();
diff --git a/kdumptool/deletedumps.cc b/kdumptool/deletedumps.cc
index 500299e..f19a421 100644
--- a/kdumptool/deletedumps.cc
+++ b/kdumptool/deletedumps.cc
@@ -87,10 +87,12 @@ void DeleteDumps::execute()
return;
}
- RootDirURLVector urls(config->KDUMP_SAVEDIR.value(), m_rootdir);
- RootDirURLVector::const_iterator it;
- for (it = urls.begin(); it != urls.end(); ++it)
- delete_one(*it, oldDumps);
+ std::istringstream iss(config->KDUMP_SAVEDIR.value());
+ string elem;
+ while (iss >> elem) {
+ RootDirURL url(elem, m_rootdir);
+ delete_one(url, oldDumps);
+ }
}
// -----------------------------------------------------------------------------
diff --git a/kdumptool/print_target.cc b/kdumptool/print_target.cc
index 06dbc41..8d3e50d 100644
--- a/kdumptool/print_target.cc
+++ b/kdumptool/print_target.cc
@@ -60,12 +60,16 @@ void PrintTarget::execute()
Configuration *config = Configuration::config();
- RootDirURLVector urlv(config->KDUMP_SAVEDIR.value(), m_rootdir);
- RootDirURLVector::iterator it;
- for (it = urlv.begin(); it != urlv.end(); ++it) {
- if (it != urlv.begin())
+ std::istringstream iss(config->KDUMP_SAVEDIR.value());
+ string elem;
+ bool first = true;
+ while (iss >> elem) {
+ RootDirURL url(elem, m_rootdir);
+ if (first)
+ first = false;
+ else
cout << endl;
- print_one(*it);
+ print_one(url);
}
}
diff --git a/kdumptool/rootdirurl.cc b/kdumptool/rootdirurl.cc
index 38e613c..41352e9 100644
--- a/kdumptool/rootdirurl.cc
+++ b/kdumptool/rootdirurl.cc
@@ -44,19 +44,4 @@ RootDirURL::RootDirURL(const std::string &url, const std::string &rootdir)
//}}}
-//{{{ RootDirURLVector ---------------------------------------------------------
-
-// -----------------------------------------------------------------------------
-RootDirURLVector::RootDirURLVector(const std::string &urls,
- const std::string &rootdir)
- throw (KError)
-{
- std::istringstream iss(urls);
- std::string url;
- while (iss >> url)
- push_back(RootDirURL(url, rootdir));
-}
-
-//}}}
-
// vim: set sw=4 ts=4 fdm=marker et: :collapseFolds=1:
diff --git a/kdumptool/rootdirurl.h b/kdumptool/rootdirurl.h
index c93c825..724d4ab 100644
--- a/kdumptool/rootdirurl.h
+++ b/kdumptool/rootdirurl.h
@@ -59,28 +59,7 @@ class RootDirURL : public URLParser {
std::string m_realpath;
};
-//}}}
-
-//{{{ RootDirURLVector ---------------------------------------------------------
-
-/**
- * Parse a list of URLs.
- */
-class RootDirURLVector: public std::vector<RootDirURL> {
-
- public:
-
- /**
- * Creates a new RootDirURLVector.
- *
- * @param[in] urls space-separated list of URLs to parse
- * @param[in] rootdir root directory for local files
- * @exception KError if any URL from the list cannot be parsed
- */
- RootDirURLVector(const std::string &urls, const std::string &rootdir)
- throw (KError);
-
-};
+typedef std::vector<RootDirURL> RootDirURLVector;
//}}}
diff --git a/kdumptool/savedump.cc b/kdumptool/savedump.cc
index eeec24e..9938b6f 100644
--- a/kdumptool/savedump.cc
+++ b/kdumptool/savedump.cc
@@ -110,9 +110,15 @@ void SaveDump::execute()
// build the transfer object
// prepend a time stamp to the save dir
string subdir = Stringutil::formatCurrentTime(ISO_DATETIME);
- RootDirURLVector urlv(config->KDUMP_SAVEDIR.value(), m_rootdir);
+ RootDirURLVector urlv;
+ std::istringstream iss(config->KDUMP_SAVEDIR.value());
+ FilePath elem;
+ while (iss >> elem) {
+ RootDirURL url(elem.appendPath(subdir), m_rootdir);
+ urlv.push_back(url);
+ }
- m_transfer = getTransfer(urlv, subdir);
+ m_transfer = getTransfer(urlv);
// save the dump
try {
@@ -120,11 +126,11 @@ void SaveDump::execute()
} catch (const KError &error) {
setErrorCode(1);
- sendNotification(true, urlv, subdir);
+ sendNotification(true, urlv);
// run checkAndDelete() in any case
try {
- checkAndDelete(urlv, subdir);
+ checkAndDelete(urlv);
} catch (const KError &error) {
cout << error.what() << endl;
}
@@ -136,13 +142,13 @@ void SaveDump::execute()
}
// send the email afterwards
- sendNotification(false, urlv, subdir);
+ sendNotification(false, urlv);
// because we don't know the file size in advance, check
// afterwards if the disk space is not sufficient and delete
// the dump again
try {
- checkAndDelete(urlv, subdir);
+ checkAndDelete(urlv);
} catch (const KError &error) {
setErrorCode(1);
if (config->KDUMP_CONTINUE_ON_ERROR.value())
@@ -594,22 +600,20 @@ string SaveDump::findMapfile()
}
// -----------------------------------------------------------------------------
-void SaveDump::checkAndDelete(const RootDirURLVector &urlv,
- const string &subdir)
+void SaveDump::checkAndDelete(const RootDirURLVector &urlv)
throw (KError)
{
RootDirURLVector::const_iterator it;
for (it = urlv.begin(); it != urlv.end(); ++it)
- check_one(*it, subdir);
+ check_one(*it);
}
// -----------------------------------------------------------------------------
-void SaveDump::check_one(const RootDirURL &parser,
- const string &subdir)
+void SaveDump::check_one(const RootDirURL &parser)
throw (KError)
{
- Debug::debug()->trace("SaveDump::check_one(\"%s\", \"%s\")",
- parser.getURL().c_str(), subdir.c_str());
+ Debug::debug()->trace("SaveDump::check_one(\"%s\")",
+ parser.getURL().c_str());
// only do that check for local files
if (parser.getProtocol() != URLParser::PROT_FILE) {
@@ -618,7 +622,6 @@ void SaveDump::check_one(const RootDirURL &parser,
}
FilePath path = parser.getRealPath();
- path.appendPath(subdir);
Configuration *config = Configuration::config();
unsigned long long freeSize = path.freeDiskSize();
@@ -634,8 +637,7 @@ void SaveDump::check_one(const RootDirURL &parser,
}
// -----------------------------------------------------------------------------
-void SaveDump::sendNotification(bool failure, const RootDirURLVector &urlv,
- const string &subdir)
+void SaveDump::sendNotification(bool failure, const RootDirURLVector &urlv)
throw ()
{
Debug::debug()->trace("SaveDump::sendNotification");
@@ -694,10 +696,8 @@ void SaveDump::sendNotification(bool failure, const RootDirURLVector &urlv,
else {
ss << "Dump has been copied to" << endl;
RootDirURLVector::const_iterator it;
- for (it = urlv.begin(); it != urlv.end(); ++it) {
- FilePath fp = it->getURL();
- ss << fp.appendPath(subdir) << endl;
- }
+ for (it = urlv.begin(); it != urlv.end(); ++it)
+ ss << it->getURL() << endl;
}
email.setBody(ss.str());
@@ -738,12 +738,11 @@ string SaveDump::getKernelReleaseCommandline()
}
// -----------------------------------------------------------------------------
-Transfer *SaveDump::getTransfer(const RootDirURLVector &urlv,
- const string &subdir)
+Transfer *SaveDump::getTransfer(const RootDirURLVector &urlv)
throw (KError)
{
- Debug::debug()->trace("SaveDump::getTransfer(%p, \"%s\")",
- &urlv, subdir.c_str());
+ Debug::debug()->trace("SaveDump::getTransfer(%p)",
+ &urlv);
if (urlv.size() == 0)
throw KError("No target specified!");
@@ -751,27 +750,27 @@ Transfer *SaveDump::getTransfer(const RootDirURLVector &urlv,
switch (urlv.begin()->getProtocol()) {
case URLParser::PROT_FILE:
Debug::debug()->dbg("Returning FileTransfer");
- return new FileTransfer(urlv, subdir);
+ return new FileTransfer(urlv);
case URLParser::PROT_FTP:
Debug::debug()->dbg("Returning FTPTransfer");
- return new FTPTransfer(urlv, subdir);
+ return new FTPTransfer(urlv);
case URLParser::PROT_SFTP:
Debug::debug()->dbg("Returning SFTPTransfer");
- return new SFTPTransfer(urlv, subdir);
+ return new SFTPTransfer(urlv);
case URLParser::PROT_SSH:
Debug::debug()->dbg("Returning SSHTransfer");
- return new SSHTransfer(urlv, subdir);
+ return new SSHTransfer(urlv);
case URLParser::PROT_NFS:
Debug::debug()->dbg("Returning NFSTransfer");
- return new NFSTransfer(urlv, subdir);
+ return new NFSTransfer(urlv);
case URLParser::PROT_CIFS:
Debug::debug()->dbg("Returning CIFSTransfer");
- return new CIFSTransfer(urlv, subdir);
+ return new CIFSTransfer(urlv);
default:
throw KError("Unknown protocol.");
diff --git a/kdumptool/savedump.h b/kdumptool/savedump.h
index cd3f70d..cd11177 100644
--- a/kdumptool/savedump.h
+++ b/kdumptool/savedump.h
@@ -86,12 +86,10 @@ class SaveDump : public Subcommand {
std::string findMapfile()
throw (KError);
- void checkAndDelete(const RootDirURLVector &urlv,
- const std::string &subdir)
+ void checkAndDelete(const RootDirURLVector &urlv)
throw (KError);
- void sendNotification(bool failure, const RootDirURLVector &urlv,
- const std::string &subdir)
+ void sendNotification(bool failure, const RootDirURLVector &urlv)
throw ();
std::string getKernelReleaseCommandline()
@@ -106,8 +104,7 @@ class SaveDump : public Subcommand {
* @exception KError if parsing the URL failed or there's no
* implementation for that class.
*/
- Transfer *getTransfer(const RootDirURLVector &urlv,
- const std::string &subdir)
+ Transfer *getTransfer(const RootDirURLVector &urlv)
throw (KError);
private:
@@ -122,8 +119,7 @@ class SaveDump : public Subcommand {
std::string m_hostname;
bool m_nomail;
- void check_one(const RootDirURL &parser,
- const std::string &subdir)
+ void check_one(const RootDirURL &parser)
throw (KError);
};
diff --git a/kdumptool/sshtransfer.cc b/kdumptool/sshtransfer.cc
index 5a036db..12f315d 100644
--- a/kdumptool/sshtransfer.cc
+++ b/kdumptool/sshtransfer.cc
@@ -40,10 +40,9 @@ using std::endl;
//{{{ SSHTransfer -------------------------------------------------------------
/* -------------------------------------------------------------------------- */
-SSHTransfer::SSHTransfer(const RootDirURLVector &urlv,
- const std::string &subdir)
+SSHTransfer::SSHTransfer(const RootDirURLVector &urlv)
throw (KError)
- : URLTransfer(urlv, subdir)
+ : URLTransfer(urlv)
{
if (urlv.size() > 1)
cerr << "WARNING: First dump target used; rest ignored." << endl;
@@ -59,9 +58,7 @@ SSHTransfer::SSHTransfer(const RootDirURLVector &urlv,
cerr << "WARNING: Dump target not reachable" << endl;
string remote;
- FilePath fp = target.getPath();
- fp.appendPath(getSubDir());
- remote.assign("mkdir -p ").append(fp);
+ remote.assign("mkdir -p ").append(target.getPath());
SubProcess p;
p.spawn("ssh", makeArgs(remote));
@@ -96,7 +93,7 @@ void SSHTransfer::perform(DataProvider *dataprovider,
const RootDirURL &target = urlv.front();
FilePath fp = target.getPath();
- fp.appendPath(getSubDir()).appendPath(target_files.front());
+ fp.appendPath(target_files.front());
string remote;
remote.assign("dd of=").append(fp).append("-incomplete");
@@ -357,10 +354,9 @@ ByteVector const &SFTPPacket::update(void)
//{{{ SFTPTransfer -------------------------------------------------------------
/* -------------------------------------------------------------------------- */
-SFTPTransfer::SFTPTransfer(const RootDirURLVector &urlv,
- const std::string &subdir)
+SFTPTransfer::SFTPTransfer(const RootDirURLVector &urlv)
throw (KError)
- : URLTransfer(urlv, subdir)
+ : URLTransfer(urlv)
{
if (urlv.size() > 1)
cerr << "WARNING: First dump target used; rest ignored." << endl;
@@ -394,9 +390,7 @@ SFTPTransfer::SFTPTransfer(const RootDirURLVector &urlv,
m_proto_ver = initpkt.getInt32();
Debug::debug()->dbg("Remote SFTP version %lu", m_proto_ver);
- FilePath fp = parser.getPath();
- fp.appendPath(getSubDir());
- mkpath(fp);
+ mkpath(parser.getPath());
}
/* -------------------------------------------------------------------------- */
@@ -433,7 +427,7 @@ void SFTPTransfer::perform(DataProvider *dataprovider,
const RootDirURL &target = urlv.front();
FilePath fp = target.getPath();
- fp.appendPath(getSubDir()).appendPath(target_files.front());
+ fp.appendPath(target_files.front());
string handle = createfile(fp);
try {
diff --git a/kdumptool/sshtransfer.h b/kdumptool/sshtransfer.h
index e90d0c3..8a9081a 100644
--- a/kdumptool/sshtransfer.h
+++ b/kdumptool/sshtransfer.h
@@ -41,7 +41,7 @@ class SSHTransfer : public URLTransfer {
*
* @exception KError when initialising the underlying library fails
*/
- SSHTransfer(const RootDirURLVector &urlv, const std::string &subdir)
+ SSHTransfer(const RootDirURLVector &urlv)
throw (KError);
/**
@@ -205,7 +205,7 @@ class SFTPTransfer : public URLTransfer {
*
* @exception KError when initialising the underlying library fails
*/
- SFTPTransfer(const RootDirURLVector &urlv, const std::string &subdir)
+ SFTPTransfer(const RootDirURLVector &urlv)
throw (KError);
/**
diff --git a/kdumptool/transfer.cc b/kdumptool/transfer.cc
index 365055e..4e419ff 100644
--- a/kdumptool/transfer.cc
+++ b/kdumptool/transfer.cc
@@ -64,9 +64,9 @@ void Transfer::perform(DataProvider *dataprovider,
//{{{ URLTransfer --------------------------------------------------------------
// -----------------------------------------------------------------------------
-URLTransfer::URLTransfer(const RootDirURLVector &urlv, const string &subdir)
+URLTransfer::URLTransfer(const RootDirURLVector &urlv)
throw (KError)
- : m_urlVector(urlv), m_subDir(subdir)
+ : m_urlVector(urlv)
{
}
@@ -74,10 +74,9 @@ URLTransfer::URLTransfer(const RootDirURLVector &urlv, const string &subdir)
//{{{ FileTransfer -------------------------------------------------------------
// -----------------------------------------------------------------------------
-FileTransfer::FileTransfer(const RootDirURLVector &urlv,
- const std::string &subdir)
+FileTransfer::FileTransfer(const RootDirURLVector &urlv)
throw (KError)
- : URLTransfer(urlv, subdir), m_bufferSize(0), m_buffer(NULL)
+ : URLTransfer(urlv), m_bufferSize(0), m_buffer(NULL)
{
RootDirURLVector::const_iterator it;
for (it = urlv.begin(); it != urlv.end(); ++it)
@@ -87,7 +86,6 @@ FileTransfer::FileTransfer(const RootDirURLVector &urlv,
// create directories
for (it = urlv.begin(); it != urlv.end(); ++it) {
FilePath dir = it->getRealPath();
- dir.appendPath(subdir);
dir.mkdir(true);
}
@@ -130,7 +128,7 @@ void FileTransfer::perform(DataProvider *dataprovider,
RootDirURLVector::const_iterator itv = urlv.begin();
for (it = target_files.begin(); it != target_files.end(); ++it) {
FilePath fp = itv->getRealPath();
- full_targets.push_back(fp.appendPath(getSubDir()).appendPath(*it));
+ full_targets.push_back(fp.appendPath(*it));
if (++itv == urlv.end())
itv = urlv.begin();
}
@@ -308,10 +306,9 @@ static int curl_debug(CURL *curl, curl_infotype info, char *buffer,
}
// -----------------------------------------------------------------------------
-FTPTransfer::FTPTransfer(const RootDirURLVector &urlv,
- const std::string &subdir)
+FTPTransfer::FTPTransfer(const RootDirURLVector &urlv)
throw (KError)
- : URLTransfer(urlv, subdir), m_curl(NULL)
+ : URLTransfer(urlv), m_curl(NULL)
{
if (urlv.size() > 1)
cerr << "WARNING: First dump target used; rest ignored." << endl;
@@ -425,7 +422,7 @@ void FTPTransfer::open(DataProvider *dataprovider,
// set the URL
FilePath full_url = parser.getURL();
- full_url.appendPath(getSubDir()).appendPath(target_file);
+ full_url.appendPath(target_file);
err = curl_easy_setopt(m_curl, CURLOPT_URL, full_url.c_str());
if (err != CURLE_OK)
throw KError(string("CURL error: ") + m_curlError);
@@ -440,16 +437,15 @@ void FTPTransfer::open(DataProvider *dataprovider,
//{{{ NFSTransfer --------------------------------------------------------------
// -----------------------------------------------------------------------------
-NFSTransfer::NFSTransfer(const RootDirURLVector &urlv,
- const std::string &subdir)
+NFSTransfer::NFSTransfer(const RootDirURLVector &urlv)
throw (KError)
- : URLTransfer(urlv, subdir), m_mountpoint(""), m_fileTransfer(NULL)
+ : URLTransfer(urlv), m_mountpoint(""), m_fileTransfer(NULL)
{
- RootDirURLVector file_urlv("", "");
+ RootDirURLVector file_urlv;
RootDirURLVector::const_iterator it;
for (it = urlv.begin(); it != urlv.end(); ++it)
file_urlv.push_back(translate(*it));
- m_fileTransfer = new FileTransfer(file_urlv, subdir);
+ m_fileTransfer = new FileTransfer(file_urlv);
}
// -----------------------------------------------------------------------------
@@ -521,16 +517,15 @@ void NFSTransfer::close()
//{{{ CIFSTransfer -------------------------------------------------------------
// -----------------------------------------------------------------------------
-CIFSTransfer::CIFSTransfer(const RootDirURLVector &urlv,
- const std::string &subdir)
+CIFSTransfer::CIFSTransfer(const RootDirURLVector &urlv)
throw (KError)
- : URLTransfer(urlv, subdir), m_mountpoint(""), m_fileTransfer(NULL)
+ : URLTransfer(urlv), m_mountpoint(""), m_fileTransfer(NULL)
{
- RootDirURLVector file_urlv("", "");
+ RootDirURLVector file_urlv;
RootDirURLVector::const_iterator it;
for (it = urlv.begin(); it != urlv.end(); ++it)
file_urlv.push_back(translate(*it));
- m_fileTransfer = new FileTransfer(file_urlv, subdir);
+ m_fileTransfer = new FileTransfer(file_urlv);
}
// -----------------------------------------------------------------------------
diff --git a/kdumptool/transfer.h b/kdumptool/transfer.h
index d81f2d4..a1ecf4f 100644
--- a/kdumptool/transfer.h
+++ b/kdumptool/transfer.h
@@ -102,10 +102,10 @@ class URLTransfer : public Transfer {
/**
* Creates a new URLTransfer object.
*
- * @param[in] url the URL
+ * @param[in] urlv target URLs
* @throw KError if parsing the URL failed
*/
- URLTransfer(const RootDirURLVector &urlv, const std::string &subdir)
+ URLTransfer(const RootDirURLVector &urlv)
throw (KError);
/**
@@ -117,18 +117,8 @@ class URLTransfer : public Transfer {
throw ()
{ return m_urlVector; }
- /**
- * Returns the subdirectory part.
- *
- * @return reference to the subdirectory.
- */
- const std::string &getSubDir()
- throw ()
- { return m_subDir; }
-
private:
RootDirURLVector m_urlVector;
- std::string m_subDir;
};
//}}}
@@ -144,10 +134,10 @@ class FileTransfer : public URLTransfer {
/**
* Creates a new FileTransfer object.
*
- * @param[in] target_url the directory
+ * @param[in] urlv target directories
* @throw KError if parsing the URL or creating the directory failed
*/
- FileTransfer(const RootDirURLVector &urlv, const std::string &subdir)
+ FileTransfer(const RootDirURLVector &urlv)
throw (KError);
/**
@@ -202,7 +192,7 @@ class FTPTransfer : public URLTransfer {
*
* @exception KError when initialising the underlying library fails
*/
- FTPTransfer(const RootDirURLVector &urlv, const std::string &subdir)
+ FTPTransfer(const RootDirURLVector &urlv)
throw (KError);
/**
@@ -248,7 +238,7 @@ class NFSTransfer : public URLTransfer {
*
* @exception KError when mounting the share failes
*/
- NFSTransfer(const RootDirURLVector &urlv, const std::string &subdir)
+ NFSTransfer(const RootDirURLVector &urlv)
throw (KError);
/**
@@ -302,7 +292,7 @@ class CIFSTransfer : public URLTransfer {
*
* @exception KError when mounting the share failes
*/
- CIFSTransfer(const RootDirURLVector &urlv, const std::string &subdir)
+ CIFSTransfer(const RootDirURLVector &urlv)
throw (KError);
/**

View File

@ -1,199 +0,0 @@
From: Matthias Brugger <mbrugger@suse.com>
Date: Mon May 8 13:58:38 2017 +0200
Subject: kdumptool: add aarch64
References: bsc#1033464
Upstream: v0.8.17
Git-commit: 914c79f493c858e7ab2c07248c17f23f9195daa3
Git-commit: f43e30a71f294020817f0c4f35ea96931ea9ab93
Git-commit: e6afa41112b5ab4a961a595841f3d6b6751f99b4
Git-commit: a885ddf80fb2c6c2490f2550338042581bca6150
Add support for Aarch64.
Signed-off-by: Matthias Brugger <mbrugger@suse.com>
Acked-by: Petr Tesarik <ptesarik@suse.com>
---
kdumptool/identifykernel.cc | 3 ++
kdumptool/kerneltool.cc | 47 +++++++++++++++++++++++++++++++++++++++++++-
kdumptool/kerneltool.h | 9 ++++++++
kdumptool/savedump.cc | 7 ++++++
tests/identify_kernel.sh | 5 +++-
5 files changed, 69 insertions(+), 2 deletions(-)
--- a/kdumptool/kerneltool.cc
+++ b/kdumptool/kerneltool.cc
@@ -130,6 +130,8 @@ list<string> KernelTool::imageNames(cons
ret.push_back("vmlinuz");
} else if (arch == "s390x") {
ret.push_back("image");
+ } else if (arch == "aarch64") {
+ ret.push_back("Image");
} else {
ret.push_back("vmlinux");
}
@@ -181,6 +183,11 @@ KernelTool::KernelType KernelTool::getKe
return KT_S390;
else
return KT_NONE;
+ } else if (Util::getArch() == "aarch64") {
+ if (isAarch64Kernel())
+ return KT_AARCH64;
+ else
+ return KT_NONE;
} else
return KT_NONE;
}
@@ -201,6 +208,9 @@ bool KernelTool::isRelocatable() const
case KernelTool::KT_S390:
return true;
+ case KernelTool::KT_AARCH64:
+ return true;
+
default:
throw KError("Invalid kernel type.");
break;
@@ -257,6 +267,39 @@ bool KernelTool::isS390Kernel() const
}
// -----------------------------------------------------------------------------
+bool KernelTool::isAarch64Kernel() const
+ throw (KError)
+{
+ struct {
+ uint32_t code0; /* Executable code */
+ uint32_t code1; /* Executable code */
+ uint64_t text_offset; /* Image load offset, little endian */
+ uint64_t image_size; /* Effective Image size, little endian */
+ uint64_t flags; /* kernel flags, little endian */
+ uint64_t res2; /* reserved */
+ uint64_t res3; /* reserved */
+ uint64_t res4; /* reserved */
+ uint32_t magic; /* Magic number, little endian, "ARM\x64" */
+ uint32_t res5; /* reserved (used for PE COFF offset) */
+ } buffer;
+
+ /* check the magic number */
+ if (lseek(m_fd, 0, SEEK_SET) == (off_t)-1) {
+ throw KSystemError("IdentifyKernel::isAarch64Kernel: lseek to "
+ "file start failed", errno);
+ }
+
+ int ret = read(m_fd, &buffer, sizeof(buffer));
+ if (ret < 0) {
+ throw KSystemError("IdentifyKernel::isAarch64Kernel: read of magic "
+ "start failed", errno);
+ } else if (ret < (int)sizeof(buffer))
+ return false;
+
+ return buffer.magic == 0x644d5241; /* little endian "ARM\x64" */
+}
+
+// -----------------------------------------------------------------------------
bool KernelTool::x86isRelocatable() const
throw (KError)
{
@@ -390,7 +433,7 @@ bool KernelTool::elfIsRelocatable() cons
bool KernelTool::isArchAlwaysRelocatable(const string &machine) const
throw ()
{
- return machine == "ia64";
+ return machine == "ia64" || machine == "aarch64";
}
// -----------------------------------------------------------------------------
@@ -426,6 +469,7 @@ string KernelTool::archFromElfMachine(un
case EM_S390: return "s390";
case EM_IA_64: return "ia64";
case EM_X86_64: return "x86_64";
+ case EM_AARCH64: return "aarch64";
default: return "unknown";
}
}
@@ -681,6 +725,7 @@ string KernelTool::extractKernelConfig()
case KernelTool::KT_ELF:
case KernelTool::KT_ELF_GZ:
case KernelTool::KT_S390:
+ case KernelTool::KT_AARCH64:
return extractKernelConfigELF();
case KernelTool::KT_X86:
--- a/tests/identify_kernel.sh
+++ b/tests/identify_kernel.sh
@@ -28,18 +28,21 @@ KERNEL_IMAGES=("kernel-bzImage-x86_64"
"kernel-ELFgz-ia64"
"kernel-ELF-ia64"
"kernel-ELF-ppc64"
+ "kernel-ELF-aarch64"
)
RELOCATABLE=( 1
0
0
1
1
- 0 )
+ 0
+ 1 )
TYPE=( "x86"
"ELF gzip"
"ELF"
"ELF gzip"
"ELF"
+ "ELF"
"ELF" )
# }}}
--- a/kdumptool/savedump.cc
+++ b/kdumptool/savedump.cc
@@ -563,6 +563,13 @@ string SaveDump::findKernel()
if (binaryroot.exists())
return binary;
+ // 5: Image
+ (binary = "/boot").appendPath("Image-" + m_crashrelease);
+ (binaryroot = m_rootdir).appendPath(binary);
+ Debug::debug()->dbg("Trying %s", binaryroot.c_str());
+ if (binaryroot.exists())
+ return binary;
+
FilePath fp = m_rootdir;
fp.appendPath("/boot");
throw KError("No kernel image found in " + fp);
--- a/kdumptool/identifykernel.cc
+++ b/kdumptool/identifykernel.cc
@@ -91,6 +91,9 @@ void IdentifyKernel::execute()
case KernelTool::KT_S390:
cout << "S390" << endl;
break;
+ case KernelTool::KT_AARCH64:
+ cout << "Aarch64" << endl;
+ break;
default:
throw KError("The specified file is not a kernel image.");
}
--- a/kdumptool/kerneltool.h
+++ b/kdumptool/kerneltool.h
@@ -42,6 +42,7 @@ class KernelTool {
KT_ELF_GZ,
KT_X86,
KT_S390,
+ KT_AARCH64,
KT_NONE
};
@@ -207,6 +208,14 @@ class KernelTool {
throw (KError);
/**
+ * Checks if the kernel is an Aarch64 kernel image.
+ *
+ * @return @c true if it's an Aarch64 kernel image, @c false otherwise.
+ */
+ bool isAarch64Kernel() const
+ throw (KError);
+
+ /**
* Returns the architecture as string from the ELF machine type.
*
* @param[in] et_machine the ELF machine type such as EM_386

View File

@ -1,124 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Thu Jun 29 18:11:52 2017 +0200
Subject: Activate QETH network devices
References: bsc#1038669
Upstream: v0.8.17
Git-commit: 2288f2b56fec0298fdf21ff7a5dd03157d12242e
Take care of activating QETH devices in the kdump environment, because
dracut does not do it automatically.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/setup-kdump.functions | 72 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 72 insertions(+)
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -457,6 +457,7 @@ function kdump_vlan_config() # {
# kdump_netif corresponding ifname= initrd parameter added
# kdump_iface device name in initrd
# kdump_kmods additional kernel modules updated
+# kdump_hwif hardware interfaces updated
function kdump_ifname_config() # {{{
{
kdump_iface="$1"
@@ -464,6 +465,8 @@ function kdump_ifname_config() #
if [ -z "$ifkind" ]
then
+ kdump_hwif="$kdump_hwif $kdump_iface"
+
local hwaddr
local addrtype=$(<"/sys/class/net/$kdump_iface/addr_assign_type")
if [ "$addrtype" -eq 0 ]
@@ -1038,6 +1041,69 @@ function kdump_filter_sysctl() #
} # }}}
#
+# Set up a QETH network interface
+# Parameters:
+# 1) _root: initrd temporary root
+# 2) _iface: interface name
+# Input variables:
+# kdump_hwif hardware network interfaces
+function kdump_setup_qeth() # {{{
+{
+ local _root="$1"
+ local _iface="$2"
+ local _dev=$( readlink "/sys/class/net/$_iface/device" )
+ _dev="${_dev##*/}"
+ local _cdev0=$( readlink "/sys/class/net/$_iface/device/cdev0" )
+ _cdev0="${_cdev0##*/}"
+ local _cdev1=$( readlink "/sys/class/net/$_iface/device/cdev1" )
+ _cdev1="${_cdev1##*/}"
+ local _cdev2=$( readlink "/sys/class/net/$_iface/device/cdev2" )
+ _cdev2="${_cdev2##*/}"
+ local _layer2=$(</sys/class/net/$_iface/device/layer2)
+ local _portno=$(</sys/class/net/$_iface/device/portno)
+
+ cat >"${_root}/etc/udev/rules.d/51-qeth-${_dev}.rules" <<EOF
+ACTION=="add", SUBSYSTEM=="drivers", KERNEL=="qeth", IMPORT{program}="collect $_dev %k $_cdev0 $_cdev1 $_cdev2 qeth"
+ACTION=="add", SUBSYSTEM=="ccw", KERNEL=="$_cdev0", IMPORT{program}="collect $_dev %k $_cdev0 $_cdev1 $_cdev2 qeth"
+ACTION=="add", SUBSYSTEM=="ccw", KERNEL=="$_cdev1", IMPORT{program}="collect $_dev %k $_cdev0 $_cdev1 $_cdev2 qeth"
+ACTION=="add", SUBSYSTEM=="ccw", KERNEL=="$_cdev2", IMPORT{program}="collect $_dev %k $_cdev0 $_cdev1 $_cdev2 qeth"
+ACTION=="remove", SUBSYSTEM=="drivers", KERNEL=="qeth", IMPORT{program}="collect --remove $_dev %k $_cdev0 $_cdev1 $_cdev2 qeth"
+ACTION=="remove", SUBSYSTEM=="ccw", KERNEL=="$_cdev0", IMPORT{program}="collect --remove $_dev %k $_cdev0 $_cdev1 $_cdev2 qeth"
+ACTION=="remove", SUBSYSTEM=="ccw", KERNEL=="$_cdev1", IMPORT{program}="collect --remove $_dev %k $_cdev0 $_cdev1 $_cdev2 qeth"
+ACTION=="remove", SUBSYSTEM=="ccw", KERNEL=="$_cdev2", IMPORT{program}="collect --remove $_dev %k $_cdev0 $_cdev1 $_cdev2 qeth"
+TEST=="[ccwgroup/$_dev]", GOTO="qeth-${_dev}-end"
+ACTION=="add", SUBSYSTEM=="ccw", ENV{COLLECT_$_dev}=="0", ATTR{[drivers/ccwgroup:qeth]group}="$_cdev0,$_cdev1,$_cdev2"
+ACTION=="add", SUBSYSTEM=="drivers", KERNEL=="qeth", ENV{COLLECT_$_dev}=="0", ATTR{[drivers/ccwgroup:qeth]group}="$_cdev0,$_cdev1,$_cdev2"
+LABEL="qeth-$_dev-end"
+ACTION=="add", SUBSYSTEM=="ccwgroup", KERNEL=="$_dev", ATTR{portno}="$_portno"
+ACTION=="add", SUBSYSTEM=="ccwgroup", KERNEL=="$_dev", ATTR{layer2}="$_layer2"
+ACTION=="add", SUBSYSTEM=="ccwgroup", KERNEL=="$_dev", ATTR{online}="1"
+EOF
+} # }}}
+
+#
+# Set up hardware network interfaces
+# Parameters:
+# 1) _root: initrd temporary root
+# Input variables:
+# kdump_hwif hardware network interfaces
+function kdump_setup_hwif() # {{{
+{
+ local _root="$1"
+ local _iface _drv
+
+ for _iface in $kdump_hwif
+ do
+ _drv=$( readlink "/sys/class/net/$_iface/device/driver" )
+ case "$_drv" in
+ */qeth)
+ kdump_setup_qeth "$_root" "$_iface"
+ ;;
+ esac
+ done
+} # }}}
+
+#
# Set up or create all necessary files
# Parameters:
# 1) outdir: initrd temporary root
@@ -1046,6 +1112,7 @@ function kdump_filter_sysctl() #
# Input variables:
# KDUMP_* see kdump_get_config
# kdump_mnt[] mountpoints in kdump environment
+# kdump_hwif hardware network interfaces
# Output variables:
# KDUMP_REQUIRED_PROGRAMS updated as necessary
function kdump_setup_files() # {{{
@@ -1087,5 +1154,10 @@ function kdump_setup_files() # {
#
kdump_filter_sysctl "$outdir"
+ #
+ # set up hardware interfaces
+ #
+ kdump_setup_hwif "$outdir"
+
return 0
} # }}}

View File

@ -1,206 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Fri, 20 Apr 2018 17:26:22 +0200
Subject: Handle additional mounts in the kdump dracut module
References: bsc#1089917
Upstream: merged
Git-commit: bd3cc31f3b91e81e6acc00f314142bbda9ace495
This change is needed to fix FADUMP, because in that case the kdump
initrd is also used during normal boot, so it can get overwritten
with an invocation of "mkinitrd".
Currently, dracut does not provide an API to add more mounts from a
module, so part of the logic which sets up host devices and
filesystem mappings must be copied to the kdump module.
The approach is not clean, but probably still better than passing
some variables from mkdumprd to the kdump dracut module through
environment variables, which was done before. Yes, this means that
the ugly export/import functions can be removed and forgotten.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/mkdumprd | 14 --------
init/module-setup.sh | 75 +++++++++++++++++++++++++++++++++++++--------
init/setup-kdump.functions | 53 -------------------------------
3 files changed, 62 insertions(+), 80 deletions(-)
--- a/init/mkdumprd
+++ b/init/mkdumprd
@@ -128,20 +128,6 @@ function run_dracut()
KERNELVERSION=$(get_kernel_version "$KERNEL")
fi
- # add mount points
- kdump_get_mountpoints || return 1
- i=0
- while [ $i -lt ${#kdump_mnt[@]} ]
- do
- if [ -n "${kdump_mnt[i]}" ] ; then
- DRACUT_ARGS="$DRACUT_ARGS --mount '${kdump_dev[i]} ${kdump_mnt[i]} ${kdump_fstype[i]} ${kdump_opts[i]}'"
- fi
- i=$((i+1))
- done
-
- # Make resolved variables visible to the dracut module
- kdump_export_targets
-
DRACUT_ARGS="$DRACUT_ARGS --add 'kdump' $INITRD $KERNELVERSION"
echo "Regenerating kdump initrd ..." >&2
eval "bash -$- $DRACUT $DRACUT_ARGS"
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -45,10 +45,71 @@ kdump_check_net() {
kdump_ifname_config "$kdump_host_if"
}
+kdump_get_fs_type() {
+ local _dev="/dev/block/$1"
+ local _fstype
+ if [ -b "$_dev" ] && _fstype=$(get_fs_env "$_dev") ; then
+ host_fs_types["$(readlink -f "$_dev")"]="$_fstype"
+ elif _fstype=$(find_dev_fstype "$_dev"); then
+ host_fs_types["$_dev"]="$_fstype"
+ fi
+ return 1
+}
+
+kdump_add_host_dev() {
+ local _dev=$1
+ [[ " ${host_devs[@]} " == *" $_dev "* ]] && return
+ host_devs+=( "$_dev" )
+ check_block_and_slaves_all kdump_get_fs_type "$(get_maj_min "$_dev")"
+}
+
+kdump_add_mnt() {
+ local _idx=$1
+ local _dev="${kdump_dev[_idx]}"
+ local _mp="${kdump_mnt[_idx]}"
+
+ # Convert system root mounts to bind mounts
+ if [ "$KDUMP_FADUMP" = "yes" -a "${_mp%/*}" = "/kdump" ] ; then
+ mkdir -p "$initdir/etc"
+ echo "/sysroot $_mp none bind 0 0" >> "$initdir/etc/fstab"
+ return
+ fi
+
+ case "$_dev" in
+ UUID=*|LABEL=*|PARTUUID=*|PARTLABLE=*)
+ _dev=$(blkid -l -t "$_dev" -o device)
+ ;;
+ esac
+ kdump_add_host_dev "$_dev"
+ host_fs_types["$_dev"]="${kdump_fstype[_idx]}"
+ if [ "${kdump_fstype[_idx]}" = btrfs ] ; then
+ for _dev in $() ; do
+ kdump_add_host_dev "$_dev"
+ done
+ fi
+
+ mkdir -p "$initdir/etc"
+ local _passno=2
+ [ "${kdump_fstype[_idx]}" = nfs ] && _passno=0
+ echo "${kdump_dev[_idx]} ${kdump_mnt[_idx]} ${kdump_fstype[_idx]} ${kdump_opts[_idx]} 0 $_passno" >> "$initdir/etc/fstab"
+}
+
check() {
# Get configuration
- kdump_import_targets || return 1
kdump_get_config || return 1
+
+ # add mount points
+ if ! [[ $mount_needs ]] ; then
+ kdump_get_mountpoints || return 1
+
+ local _i=0
+ while [ $_i -lt ${#kdump_mnt[@]} ]
+ do
+ [ -n "${kdump_mnt[_i]}" ] && kdump_add_mnt $_i
+ _i=$((_i+1))
+ done
+ fi
+
kdump_check_net
return 255
@@ -188,18 +249,6 @@ install() {
kdump_map_mpath_wwid
for_each_host_dev_and_slaves_all kdump_add_mpath_dev
- # Convert system root mounts to bind mounts
- if [ "$KDUMP_FADUMP" = "yes" ] ; then
- local i line
- for i in "${!fstab_lines[@]}"
- do
- line=( ${fstab_lines[i]} )
- if [ "${line[1]%/*}" = "/kdump" ] ; then
- fstab_lines[i]="/sysroot ${line[1]} none bind 0 0"
- fi
- done
- fi
-
kdump_setup_files "$initdir" "$kdump_mpath_wwids"
inst_hook cmdline 50 "$moddir/kdump-root.sh"
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -666,59 +666,6 @@ function kdump_get_targets() # {
} # }}}
#
-# Print array content so that it can be used as bash input
-#
-# Parameters:
-# 1) name array variable to be printed
-# Output:
-# shell code that can be passed to eval to restore the array
-function kdump_print_array()
-{
- local name="$1"
- local i
- echo -n "( "
- for i in $(eval printf \"%q \" \"\${!$name[@]}\")
- do
- printf "[%s]=%q " "$i" "$(eval echo \"\${$name[i]}\")"
- done
- echo ")"
-}
-
-#
-# Export kdump_*[] arrays, returned by kdump_get_targets.
-#
-# Input variables:
-# kdump_URL[], kdump_Protocol[], kdump_Host[], kdump_Realpath,
-# kdump_mnt[]
-# Output variables (exported):
-# KDUMP_x_URL, KDUMP_x_Protocol, KDUMP_x_Host, KDUMP_x_Realpath,
-# KDUMP_x_mnt
-function kdump_export_targets() # {{{
-{
- export KDUMP_x_URL=$( kdump_print_array kdump_URL )
- export KDUMP_x_Protocol=$( kdump_print_array kdump_Protocol )
- export KDUMP_x_Host=$( kdump_print_array kdump_Host )
- export KDUMP_x_Realpath=$( kdump_print_array kdump_Realpath )
- export KDUMP_x_mnt=$( kdump_print_array kdump_mnt )
- export kdump_max
-} # }}}
-
-#
-# Import kdump_*[] arrays from environment.
-#
-# Input/Output Variables:
-# reverse of kdump_export_arrays
-function kdump_import_targets() # {{{
-{
- eval "kdump_URL=$KDUMP_x_URL"
- eval "kdump_Protocol=$KDUMP_x_Protocol"
- eval "kdump_Host=$KDUMP_x_Host"
- eval "kdump_Realpath=$KDUMP_x_Realpath"
- eval "kdump_mnt=$KDUMP_x_mnt"
- test ${#kdump_URL[@]} -gt 0
-} # }}}
-
-#
# Read and normalize /etc/fstab and /proc/mounts (if exists).
# The following transformations are done:
# - initial TABs and SPACEs are removed

View File

@ -1,27 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Tue, 13 Mar 2018 16:40:13 +0100
Subject: Always copy timezone data into kdumprd
References: bsc#1081646
Upstream: merged
Git-commit: 58d5fa45ed8e7c12866765cadb520e92600c1d39
Timezone data is not always copied automatically by dracut. In fact,
the code which does that is SUSE-specific, see bsc#830060, or SUSE
patch 0020-00warpclock-Set-correct-timezone.patch.
Even with the above patch, localtime is not copied on s390(x).
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/module-setup.sh | 2 ++
1 file changed, 2 insertions(+)
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -227,4 +227,6 @@ install() {
inst_multiple makedumpfile makedumpfile-R.pl kdumptool \
$KDUMP_REQUIRED_PROGRAMS
inst_simple /etc/resolv.conf
+ inst_simple /usr/share/zoneinfo/UTC
+ inst_simple /etc/localtime
}

View File

@ -1,54 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Fri, 23 Feb 2018 08:59:00 +0100
Subject: Try kexec_load(2) if kexec_file_load(2) fails for any reason
References: bsc#1080916
Upstream: merged
Git-commit: c9f231320fe6544b4e8aedd24a571105c4ff458a
Currently, kexec_load(2) is attempted only if kexec_file_load(2) is
unavailable. However, kexec_file_load(2) may also fail for other
reasons (e.g. missing kernel signature). It makes sense to try the
older syscall in that case.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/load.sh | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
--- a/init/load.sh
+++ b/init/load.sh
@@ -164,30 +164,24 @@ function load_kdump_kexec()
output=$(eval "$KEXEC_CALL -s" 2>&1)
result=$?
- if [ $result -eq 255 ] ; then
- echo $output | grep -q 'syscall kexec_file_load not available' && result=7
- fi
# print stderr in any case to show warnings that normally
# would be supressed (bnc#374185)
- echo -n "$output"; echo
+ echo "$output"
if [ $result -eq 0 ] ; then
kdump_logger "Loaded kdump kernel: $KEXEC_CALL -s, Result: $output"
return 0
- elif [ $result -ne 7 ]; then
- kdump_logger "FAILED to load kdump kernel: $KEXEC_CALL -s, Result: $output"
- return $result
fi
- # kexec_file_load(2) not available
- kdump_echo "kexec_file_load(2) not available"
+ # kexec_file_load(2) failed
+ kdump_echo "kexec_file_load(2) failed"
kdump_echo "Starting load kdump kernel with kexec_load(2)"
kdump_echo "kexec cmdline: $KEXEC_CALL"
output=$(eval "$KEXEC_CALL" 2>&1)
result=$?
- echo -n "$output";echo
+ echo "$output"
if [ $result -eq 0 ] ; then
kdump_logger "Loaded kdump kernel: $KEXEC_CALL, Result: $output"

View File

@ -1,30 +0,0 @@
From: Petr Tesarik <ptesarik@suse.cz>
Subject: Always pass kernel version to dracut
References: bsc#900418
Upstream: v0.8.17
Git-commit: 950e82a515a2e5ea9386e54b51eb60edc09a758e
Dracut does not take a kernel image as its argument, but rather the kernel
version, but the KERNELVERSION variable is set only if the kernel version
is explicitly given on the mkdumprd command line.
Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
---
init/mkdumprd | 5 +++++
1 file changed, 5 insertions(+)
--- a/init/mkdumprd
+++ b/init/mkdumprd
@@ -123,6 +123,11 @@ function run_dracut()
DRACUT_ARGS="--force --hostonly --omit 'plymouth resume usrmount'"
DRACUT_ARGS="$DRACUT_ARGS --compress='xz -0 --check=crc32'"
+ if [ -z "$KERNELVERSION" ]
+ then
+ KERNELVERSION=$(get_kernel_version "$KERNEL")
+ fi
+
# add mount points
kdump_get_mountpoints || return 1
i=0

View File

@ -1,33 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Fri, 9 Feb 2018 16:55:55 +0100
Subject: Bail out of kdump_check_net if no default interface is found
References: bsc#1058202
Upstream: merged
Git-commit: 0f07085aac4f506752e2cd41a43b34b85f3f09aa
If network is required but no default interface is found, dracut
spits spurious errors, such as:
/lib/kdump/setup-kdump.functions: line 471: /sys/class/net//addr_assign_type: No such file or directory
/lib/kdump/setup-kdump.functions: line 472: [: : integer expression expected
/lib/kdump/setup-kdump.functions: line 476: ethtool: command not found
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/module-setup.sh | 5 +++++
1 file changed, 5 insertions(+)
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -33,6 +33,11 @@ kdump_check_net() {
if [ "$kdump_host_if" = "default" ] ; then
kdump_host_if=$(kdump_default_netdev)
fi
+ if [ -z "$kdump_host_if" ] ; then
+ kdump_neednet=
+ return 1
+ fi
+
if [ "$kdump_net_mode" = "auto" ] ; then
kdump_net_mode=$(kdump_netdev_mode "$kdump_host_if")
fi

View File

@ -1,43 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Subject: Convert sysroot to a bind mount in kdump initrd
References: bsc#976864
Upstream: v0.8.17
Git-commit: a532a27d0bb7f69fbf89527fb02e8434fdafa147
In SLES 12 SP2, systemd-fstab-generator no longer ignores non-device
root mounts, so it tries to run an actual mount command for root=kdump.
This fails, of course, because "kdump" is not mountable.
To solve this, pass "rootflags=bind" to the panic kernel, so systemd
can create a (bogus) bind mount and be happy.
See also kdump-root-parameter.patch.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/load.sh | 2 +-
init/module-setup.sh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
--- a/init/load.sh
+++ b/init/load.sh
@@ -71,7 +71,7 @@ function build_kdump_commandline()
# Use deadline for saving the memory footprint
commandline="$commandline elevator=deadline sysrq=yes reset_devices acpi_no_memhotplug cgroup_disable=memory"
commandline="$commandline irqpoll ${nr_cpus}=${KDUMP_CPUS:-1}"
- commandline="$commandline root=kdump rd.udev.children-max=8"
+ commandline="$commandline root=kdump rootflags=bind rd.udev.children-max=8"
case $(uname -i) in
i?86|x86_64)
local boot_apicid=$(
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -123,7 +123,7 @@ kdump_gen_mount_units() {
echo "${line[@]}" >> "$fstab"
done
- echo "root=kdump" > "$initdir/proc/cmdline"
+ echo > "$initdir/proc/cmdline"
inst_binary -l \
"$systemdutildir/system-generators/systemd-fstab-generator" \
"/tmp/systemd-fstab-generator"

View File

@ -1,28 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Thu, 22 Feb 2018 14:03:26 +0100
Subject: bootloader: Filter out KDUMPTOOL_FLAGS
References: bsc#1072584
Upstream: merged
Git-commit: df216d1815eae7e8c4b139e0676696de4dc447d2
The bootloader update filters out all parameters starting with
KDUMP_, MAKEDUMPFILE_ or fadump. KDUMPTOOL_FLAGS does not match, so
it is not removed and consequently multiple instances may appear on
the command line.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/kdump-bootloader.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/init/kdump-bootloader.pl
+++ b/init/kdump-bootloader.pl
@@ -26,7 +26,7 @@ if ($ARGV[0] eq "--get") {
my $param = $rawparam;
$param =~ s/"//g;
$param =~ s/=(.*)//;
- if (! ($param =~ /^(KDUMP|MAKEDUMPFILE)_|^fadump$/)) {
+ if (! ($param =~ /^KDUMP(TOOL)?_|^MAKEDUMPFILE_|^fadump$/)) {
$result .= " " if length($result);
$result .= $rawparam;
}

View File

@ -1,87 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Thu, 8 Feb 2018 17:47:21 +0100
Subject: calibrate: Adjust sizeof(struct page)
Upstream: merged
Git-commit: f3aed9afcece4a6d25f9ee5ed0d4a2e82204cfa1
After adding a memcg pointer, struct page has grown by one pointer.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
kdumptool/calibrate.cc | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
--- a/kdumptool/calibrate.cc
+++ b/kdumptool/calibrate.cc
@@ -63,7 +63,7 @@
# define KERNEL_INIT_KB MB(5)
# define INIT_KB MB(34)
# define INIT_NET_KB MB(3)
-# define SIZE_STRUCT_PAGE 56
+# define SIZE_STRUCT_PAGE 64
# define KDUMP_PHYS_LOAD 0
# define CAN_REDUCE_CPUS 1
# define PERCPU_KB 108
@@ -74,7 +74,7 @@
# define KERNEL_INIT_KB MB(4)
# define INIT_KB MB(29)
# define INIT_NET_KB MB(2)
-# define SIZE_STRUCT_PAGE 32
+# define SIZE_STRUCT_PAGE 36
# define KDUMP_PHYS_LOAD 0
# define CAN_REDUCE_CPUS 1
# define PERCPU_KB 56
@@ -96,7 +96,7 @@
# define KERNEL_INIT_KB MB(5)
# define INIT_KB MB(34)
# define INIT_NET_KB MB(2)
-# define SIZE_STRUCT_PAGE 32
+# define SIZE_STRUCT_PAGE 36
# define KDUMP_PHYS_LOAD MB(128)
# define CAN_REDUCE_CPUS 0
# define PERCPU_KB 0 // TODO !!!
@@ -107,7 +107,7 @@
# define KERNEL_INIT_KB 512
# define INIT_KB MB(34)
# define INIT_NET_KB MB(2)
-# define SIZE_STRUCT_PAGE 56
+# define SIZE_STRUCT_PAGE 64
# define KDUMP_PHYS_LOAD 0
# define CAN_REDUCE_CPUS 1
# define PERCPU_KB 48
@@ -120,7 +120,7 @@
# define KERNEL_INIT_KB 512
# define INIT_KB MB(29)
# define INIT_NET_KB MB(2)
-# define SIZE_STRUCT_PAGE 32
+# define SIZE_STRUCT_PAGE 36
# define KDUMP_PHYS_LOAD 0
# define CAN_REDUCE_CPUS 1
# define PERCPU_KB 0 // TODO !!!
@@ -133,7 +133,7 @@
# define KERNEL_INIT_KB MB(3)
# define INIT_KB MB(44)
# define INIT_NET_KB MB(4)
-# define SIZE_STRUCT_PAGE 56
+# define SIZE_STRUCT_PAGE 64
# define KDUMP_PHYS_LOAD 0
# define CAN_REDUCE_CPUS 1
# define PERCPU_KB 0 // TODO !!!
@@ -144,7 +144,7 @@
# define KERNEL_INIT_KB MB(1)
# define INIT_KB MB(29)
# define INIT_NET_KB MB(2)
-# define SIZE_STRUCT_PAGE 56
+# define SIZE_STRUCT_PAGE 64
# define KDUMP_PHYS_LOAD 0
# define CAN_REDUCE_CPUS 1
# define PERCPU_KB 0 // TODO !!!
@@ -155,7 +155,7 @@
# define KERNEL_INIT_KB MB(1)
# define INIT_KB MB(29)
# define INIT_NET_KB MB(2)
-# define SIZE_STRUCT_PAGE 32
+# define SIZE_STRUCT_PAGE 36
# define KDUMP_PHYS_LOAD 0
# define CAN_REDUCE_CPUS 1
# define PERCPU_KB 0 // TODO !!!

View File

@ -1,28 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Tue, 20 Feb 2018 20:44:40 +0100
Subject: calibrate: Do not add KDUMP_PHYS_LOAD to required RAM
Upstream: merged
Git-commit: b70cbda10aa73f72f2324b8f9bf58918b59c9a86
The memory between 0 and KDUMP_PHYS_LOAD is not really allocated to
the panic kernel. It is added to the requirement merely to calculate
the memmap size for pages in this range.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
kdumptool/calibrate.cc | 4 ++++
1 file changed, 4 insertions(+)
--- a/kdumptool/calibrate.cc
+++ b/kdumptool/calibrate.cc
@@ -968,6 +968,10 @@ void Calibrate::execute()
required = prev + align_memmap(maxpfn) * SIZE_STRUCT_PAGE;
Debug::debug()->dbg("Maximum memmap size: %lu KiB", required - prev);
+ // Memory between 0 and KDUMP_PHYS_LOAD is not really allocated,
+ // so subtract it again after memmap has been sized.
+ required -= KDUMP_PHYS_LOAD;
+
// Make sure there is enough space at boot
Debug::debug()->dbg("Total run-time size: %lu KiB", required);
if (required < bootsize)

View File

@ -1,97 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Thu, 8 Feb 2018 18:29:20 +0100
Subject: calibrate: Update kernel text+data size
Upstream: merged
Git-commit: b7905e9aa93712e4fa25aec1213fa412318f0c7a
Kernel size has (more than) doubled. This constant should be
configurable in fact...
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
kdumptool/calibrate.cc | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
--- a/kdumptool/calibrate.cc
+++ b/kdumptool/calibrate.cc
@@ -59,7 +59,7 @@
#if defined(__x86_64__)
# define DEF_RESERVE_KB MB(128)
-# define KERNEL_KB MB(16)
+# define KERNEL_KB MB(32)
# define KERNEL_INIT_KB MB(5)
# define INIT_KB MB(34)
# define INIT_NET_KB MB(3)
@@ -70,7 +70,7 @@
#elif defined(__i386__)
# define DEF_RESERVE_KB MB(128)
-# define KERNEL_KB MB(14)
+# define KERNEL_KB MB(28)
# define KERNEL_INIT_KB MB(4)
# define INIT_KB MB(29)
# define INIT_NET_KB MB(2)
@@ -81,7 +81,7 @@
#elif defined(__powerpc64__)
# define DEF_RESERVE_KB MB(256)
-# define KERNEL_KB MB(16)
+# define KERNEL_KB MB(32)
# define KERNEL_INIT_KB MB(5)
# define INIT_KB MB(58)
# define INIT_NET_KB MB(4)
@@ -92,7 +92,7 @@
#elif defined(__powerpc__)
# define DEF_RESERVE_KB MB(128)
-# define KERNEL_KB MB(12)
+# define KERNEL_KB MB(24)
# define KERNEL_INIT_KB MB(5)
# define INIT_KB MB(34)
# define INIT_NET_KB MB(2)
@@ -103,7 +103,7 @@
#elif defined(__s390x__)
# define DEF_RESERVE_KB MB(128)
-# define KERNEL_KB MB(13)
+# define KERNEL_KB MB(26)
# define KERNEL_INIT_KB 512
# define INIT_KB MB(34)
# define INIT_NET_KB MB(2)
@@ -116,7 +116,7 @@
#elif defined(__s390__)
# define DEF_RESERVE_KB MB(128)
-# define KERNEL_KB MB(12)
+# define KERNEL_KB MB(24)
# define KERNEL_INIT_KB 512
# define INIT_KB MB(29)
# define INIT_NET_KB MB(2)
@@ -129,7 +129,7 @@
#elif defined(__ia64__)
# define DEF_RESERVE_KB MB(512)
-# define KERNEL_KB MB(32)
+# define KERNEL_KB MB(64)
# define KERNEL_INIT_KB MB(3)
# define INIT_KB MB(44)
# define INIT_NET_KB MB(4)
@@ -140,7 +140,7 @@
#elif defined(__aarch64__)
# define DEF_RESERVE_KB MB(128)
-# define KERNEL_KB MB(10)
+# define KERNEL_KB MB(26)
# define KERNEL_INIT_KB MB(1)
# define INIT_KB MB(29)
# define INIT_NET_KB MB(2)
@@ -151,7 +151,7 @@
#elif defined(__arm__)
# define DEF_RESERVE_KB MB(128)
-# define KERNEL_KB MB(12)
+# define KERNEL_KB MB(24)
# define KERNEL_INIT_KB MB(1)
# define INIT_KB MB(29)
# define INIT_NET_KB MB(2)

View File

@ -1,44 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Thu, 8 Feb 2018 18:59:55 +0100
Subject: calibrate: Update user-space requirements
Upstream: merged
Git-commit: 9703485b83c13c3382ede24d92bef47ae3efe7af
Userspace memory consumption has also increased.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
kdumptool/calibrate.cc | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
--- a/kdumptool/calibrate.cc
+++ b/kdumptool/calibrate.cc
@@ -213,20 +213,20 @@ static inline unsigned long s390x_align_
#define DIRTY_RATIO 20
// Userspace base requirements:
-// systemd (PID 1) 3 M
-// haveged 4 M
-// journald 2 M
+// systemd (PID 1) 8 M
+// haveged 6 M
+// journald 5 M
// the journal itself 4 M
-// 10 * udevd 12 M
+// 10 * udevd 28 M
// kdumptool 4 M
// makedumpfile 1 M
// -------------------------
-// TOTAL: 30 M
-#define USER_BASE_KB MB(30)
+// TOTAL: 56 M
+#define USER_BASE_KB MB(56)
// Additional requirements when network is configured
-// dhclient 7 M
-#define USER_NET_KB MB(7)
+// dhclient 10 M
+#define USER_NET_KB MB(10)
// Maximum size of the page bitmap
// 32 MiB is 32*1024*1024*8 = 268435456 bits

View File

@ -1,28 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Wed Oct 5 08:48:38 2016 +0200
Subject: Avoid using TARGET_* cmake directives
Upstream: never; compatibility with older SUSE distros
The TARGET_INCLUDE_DIRECTORIES directive was added in cmake 3.0.2.
It is not recognized by older versions.
This patch can be removed when we stop caring about SLES11...
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/CMakeLists.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/init/CMakeLists.txt
+++ b/init/CMakeLists.txt
@@ -20,8 +20,8 @@
ADD_EXECUTABLE(device-timeout-generator
device-timeout-generator.c
)
-TARGET_INCLUDE_DIRECTORIES(device-timeout-generator
- PUBLIC ${BLKID_INCLUDE_DIRS})
+INCLUDE_DIRECTORIES(
+ ${BLKID_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(device-timeout-generator
${BLKID_LIBRARIES})

View File

@ -1,25 +0,0 @@
From: Michal Suchanek <msuchanek@suse.de>
Date: Wed Jun 21 15:31:21 2017 +0200
Subject: Do not request filesystem check on bind mounts
References: bsc#1034169
Upstream: v0.8.17
Git-commit: 395a14377816a19678da481cafdf2332e0b0c932
When creating fstab for kdump bind mounts the dump and fsck fields are not
specified. These should be 0 because the directory which is bind-mounted cannot
be checked nor dumped.
Reported-by: Neil Brown <nfbrown@suse.com>
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
--- kdump-0.8.16/init/module-setup.sh~ 2017-06-01 16:56:11.765609113 +0200
+++ kdump-0.8.16/init/module-setup.sh 2017-06-01 16:58:31.295723256 +0200
@@ -168,7 +168,7 @@
do
line=( ${fstab_lines[i]} )
if [ "${line[1]%/*}" = "/kdump" ] ; then
- fstab_lines[i]="/sysroot ${line[1]} none bind"
+ fstab_lines[i]="/sysroot ${line[1]} none bind 0 0"
fi
done
fi

View File

@ -1,31 +0,0 @@
From: Michal Suchanek <msuchanek@suse.de>
Date: Wed Jun 21 15:25:49 2017 +0200
Subject: Do not free fadump memory when reboot is requested
References: bsc#1040610
Upstream: v0.8.17
Git-commit: 653f8c0931c638cbb0bd5c22fc0e1dfd7969b29a
Freeing fadump memory can take a long time and doing it when we are going to
reboot anyway is pointless.
In bsc#1034169 a kernel oops is triggered by freeing fadump memory killing
save_dump.sh and preventing the reboot requested by the user from happening
entirely.
Avoid the issue and speed up reboot by not freeing fadump memory when reboot is
requested.
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
--- kdump-0.8.16/init/save_dump.sh~ 2017-06-16 13:59:02.017110055 +0200
+++ kdump-0.8.16/init/save_dump.sh 2017-06-16 13:59:35.629621303 +0200
@@ -49,7 +49,8 @@
if fadump_enabled; then
# release memory if possible
- test -f $FADUMP_RELEASE_MEM && echo 1 > $FADUMP_RELEASE_MEM
+ [ -f $FADUMP_RELEASE_MEM -a $KDUMP_IMMEDIATE_REBOOT != "yes" \
+ -a "$KDUMP_IMMEDIATE_REBOOT" != "YES" ] && echo 1 > $FADUMP_RELEASE_MEM
if [ "$KDUMP_FADUMP_SHELL" = "yes" \
-o "$KDUMP_FADUMP_SHELL" = "YES" ] ; then
echo

View File

@ -1,64 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Wed, 2 May 2018 13:25:27 +0200
Subject: Do not touch dracut variables when generating a non-kdump initrd
References: bsc#1091304
Upstream: merged
Git-commit: a61577cfd7e92486b9fe708056e4c13e202fc21f
The kdump module's check() function is called for all dracut
invocations, i.e. even if the kdump module is not included.
Unfortunately, the check() routine modifies enough of dracut's
internal state to request bogus kdump mount points. This is
desirable for a kdump initrd but may render the system unbootable
otherwise.
Check explicitly that we're building a kdump-enabled initrd before
doing anything else.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/module-setup.sh | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -3,6 +3,21 @@
. /lib/kdump/setup-kdump.functions
+kdump_needed() {
+ # Building a kdump initrd?
+ if [[ " $dracutmodules $add_dracutmodules $force_add_dracutmodules" == *\ $_mod\ * ]]; then
+ return 0
+ fi
+
+ # Is FADUMP active?
+ if [ "$KDUMP_FADUMP" = "yes" ]; then
+ return 0
+ fi
+
+ # Do not include kdump by default
+ return 1
+}
+
kdump_check_net() {
kdump_neednet=
for protocol in "${kdump_Protocol[@]}" ; do
@@ -98,6 +113,8 @@ check() {
# Get configuration
kdump_get_config || return 1
+ kdump_needed || return 1
+
# add mount points
if ! [[ $mount_needs ]] ; then
kdump_get_mountpoints || return 1
@@ -112,7 +129,7 @@ check() {
kdump_check_net
- return 255
+ return 0
}
depends() {

View File

@ -1,58 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Fri Jun 23 14:53:50 2017 +0200
Subject: Explicitly request zFCP devices in kdump initrd
References: bsc#1008352
Upstream: v0.8.17
Git-commit: 81899709e4a12bea4819d4ccc10f960cb535b447
When using NPIV with LUN autoscan, dracut does not save the port and
LUN information. However, LUN autoscan is always disabled in kdump
environment, so the LUNs will never appear.
To fix this case, the full information must be saved explicitly in a
kdump initrd.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/module-setup.sh | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -81,6 +81,25 @@ kdump_add_mpath_dev() {
fi
}
+kdump_cmdline_zfcp() {
+ is_zfcp() {
+ local _dev=$1
+ local _devpath=$(cd -P /sys/dev/block/$_dev ; echo $PWD)
+ local _sdev _lun _wwpn _ccw
+
+ [ "${_devpath#*/sd}" == "$_devpath" ] && return 1
+ _sdev="${_devpath%%/block/*}"
+ [ -e ${_sdev}/fcp_lun ] || return 1
+ _ccw=$(cat ${_sdev}/hba_id)
+ _lun=$(cat ${_sdev}/fcp_lun)
+ _wwpn=$(cat ${_sdev}/wwpn)
+ echo "rd.zfcp=${_ccw},${_wwpn},${_lun}"
+ }
+ [[ $hostonly ]] || [[ $mount_needs ]] && {
+ for_each_host_dev_and_slaves_all is_zfcp
+ } | sort -u
+}
+
kdump_cmdline_ip() {
[ "$kdump_neednet" = y ] || return 0
@@ -142,6 +161,9 @@ kdump_gen_mount_units() {
}
cmdline() {
+ local _arch=$(uname -m)
+ [ "$_arch" = "s390" -o "$_arch" = "s390x" ] && kdump_cmdline_zfcp
+
kdump_cmdline_ip
}

View File

@ -1,40 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Mon Jun 26 13:22:10 2017 +0200
Subject: Fail at startup if fadump cannot be registered
References: bsc#1040567
Upstream: v0.8.17
Git-commit: 99a38e490012da75d83efb83385d42edbea100e9
If writing "1" into /sys/kernel/fadump_registered fails for whatever
reason, do not return success.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
diff --git a/init/load.sh b/init/load.sh
index 1894551..4fc7a82 100755
--- a/init/load.sh
+++ b/init/load.sh
@@ -241,17 +241,19 @@ function load_kdump_fadump()
fi
local msg
+ local result=0
# The kernel fails with EINVAL if registered already
# (see bnc#814780)
- if [ $(cat "$FADUMP_REGISTERED") != "1" ] ; then
- local output=$( (echo 1 > "$FADUMP_REGISTERED") 2>&1)
- local result=$?
+ if [ "$(cat $FADUMP_REGISTERED)" != "1" ] ; then
+ local output
- if [ $result -eq 0 ] ; then
+ output=$( (echo 1 > "$FADUMP_REGISTERED") 2>&1)
+ if [ $? -eq 0 ] ; then
msg="Registered fadump"
else
msg="FAILED to register fadump: $output"
+ result=1
fi
else
msg="fadump is already registered"

View File

@ -1,28 +0,0 @@
From: Lance Wang <lzwang@suse.com>
Date: Fri, 19 Jan 2018 16:05:42 +0800
Subject: Fix m_threads missing initialization
References: bsc#1047609
Upstream: merged
Git-commit: 0905910da2eaa856a0e8bf26bbe6b5e4e9dc0788
kdumptool randomly outputs value for --num-threads.
So an error like following happened:
makedumpfile --num-threads 5223023572093018873 -d 31 -l /proc/vmcore.
Signed-off-by: Lance Wang <lzwang@suse.com>
---
kdumptool/savedump.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/kdumptool/savedump.cc
+++ b/kdumptool/savedump.cc
@@ -61,7 +61,7 @@ using std::ifstream;
SaveDump::SaveDump()
throw ()
: m_dump(DEFAULT_DUMP), m_transfer(NULL), m_usedDirectSave(false),
- m_useMakedumpfile(false), m_split(0), m_nomail(false)
+ m_useMakedumpfile(false), m_split(0), m_threads(0), m_nomail(false)
{
Debug::debug()->trace("SaveDump::SaveDump()");

View File

@ -1,29 +0,0 @@
From: Lance Wang <lzwang@suse.com>
Date: Mon, 4 Dec 2017 16:05:23 +0800
Subject: Fix missing index of kdump_Host
References: bsc#1002617
Upstream: merged
Git-commit: 3d0ba82b678f996dd78a8de7da043340efec7dcb
Fix missing index of kdump_Host
---
init/setup-kdump.functions | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -868,11 +868,11 @@ function kdump_modify_config() #
kdump_over_ssh=yes
if [ -z "$KDUMP_HOST_KEY" ] ; then
KDUMP_HOST_KEY=$(
- ssh-keygen -F "$kdump_Host" 2>/dev/null | \
+ ssh-keygen -F "${kdump_Host[i]}" 2>/dev/null | \
awk '/^[^#]/ { if (NF==3) { print $3; exit } }'
)
fi
- ssh-keygen -F "$kdump_Host" 2> /dev/null \
+ ssh-keygen -F "${kdump_Host[i]}" 2> /dev/null \
>>"${dest}/kdump/.ssh/known_hosts"
fi

View File

@ -1,80 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Thu Jun 22 14:23:02 2017 +0200
Subject: Fix save_dump to NFS targets
References: bsc#1045541
Upstream: v0.8.17
Git-commit: 11d36a645ab99c9805f9fa3ca9eabce3aa2a9418
For NFS, the parent directory of the target must be mounted, because
the target directory itself does not exist yet.
For this to work, split the target path to directory (i.e. parent
directory) and basename. Then construct a unique mount point from the
host name and the parent directory, and finally append the base name
again to form a subdirectory in the target (to be created by the file
transfer method).
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
kdumptool/transfer.cc | 24 +++++++++++-------------
kdumptool/transfer.h | 4 +---
2 files changed, 12 insertions(+), 16 deletions(-)
--- a/kdumptool/transfer.cc
+++ b/kdumptool/transfer.cc
@@ -462,22 +462,20 @@ RootDirURL NFSTransfer::translate(const
if (!rt.check(config->KDUMP_NET_TIMEOUT.value()))
cerr << "WARNING: Dump target not reachable" << endl;
- string mountedDir = parser.getPath();
- FileUtil::nfsmount(parser.getHostname(), mountedDir,
- DEFAULT_MOUNTPOINT, options);
-
+ FilePath path = parser.getPath();
+ string mountedDir = path.dirName();
+ string rest = path.baseName();
m_mountpoint = DEFAULT_MOUNTPOINT;
- m_rest = parser.getPath();
- m_rest.replace(m_rest.begin(), m_rest.begin() + mountedDir.size(), "");
- m_rest.ltrim("/");
+ m_mountpoint.appendPath(parser.getHostname()).appendPath(mountedDir);
+ m_mountpoint.mkdir(true);
+ Debug::debug()->dbg("Path: %s, Mountpoint: %s, Rest: %s",
+ path.c_str(), m_mountpoint.c_str(), rest.c_str());
- (m_prefix = m_mountpoint).appendPath(m_rest);
-
- Debug::debug()->dbg("Mountpoint: %s, Rest: %s, Prefix: $s",
- m_mountpoint.c_str(), m_rest.c_str(), m_prefix.c_str());
+ FileUtil::nfsmount(parser.getHostname(), mountedDir,
+ m_mountpoint, options);
- return RootDirURL("file://" + m_prefix, "");
+ return RootDirURL("file://" + m_mountpoint + PATH_SEPARATOR + rest, "");
}
// -----------------------------------------------------------------------------
@@ -507,7 +505,7 @@ void NFSTransfer::close()
throw (KError)
{
Debug::debug()->trace("NFSTransfer::close()");
- if (m_mountpoint.size() > 0) {
+ if (!m_mountpoint.empty()) {
FileUtil::umount(m_mountpoint);
m_mountpoint.clear();
}
--- a/kdumptool/transfer.h
+++ b/kdumptool/transfer.h
@@ -271,9 +271,7 @@ class NFSTransfer : public URLTransfer {
private:
- std::string m_mountpoint;
- KString m_rest;
- FilePath m_prefix;
+ FilePath m_mountpoint;
FileTransfer *m_fileTransfer;
};

View File

@ -1,92 +0,0 @@
From: Michal Koutny <mkoutny@suse.com>
Date: Wed Jun 7 15:16:05 2017 +0200
Subject: Fix kdump-related services
References: bsc#1021484
Upstreams: v0.8.17
Git-commit: 168b7bfeb992594df08c7e4020ac34f1d9a825bb
kdump.service should be the "big switch" to turn kdump on and off. We
can achieve this by adding an Also= directive.
kdump-early.service is merely a way to load a kdump kernel a early
during the boot process if and only if the kdumprd already exists (e.g.
from a previous boot). There may be some use cases for enabling only
the early service without kdump.service.
OTOH, it is not an error if the initrd is not found during the early
stages. This is indicated by exit code 6 (originally conforming to LSB
"program not configured" exit code).
Signed-off-by: Michal Koutny <mkoutny@suse.com>
Acked-by: Petr Tesarik <ptesarik@suse.com>
---
init/CMakeLists.txt | 2 +-
init/kdump-early.service | 14 ++++++++++++++
init/kdump-rebuild-initrd.service | 12 ------------
init/kdump.service | 8 ++++----
4 files changed, 19 insertions(+), 17 deletions(-)
--- a/init/kdump.service
+++ b/init/kdump.service
@@ -1,13 +1,13 @@
[Unit]
-Description=Load kdump kernel on startup
-After=local-fs.target
-Wants=kdump-rebuild-initrd.service
+Description=Load kdump kernel and initrd
+After=local-fs.target network.service YaST2-Second-Stage.service YaST2-Firstboot.service
[Service]
Type=oneshot
-ExecStart=/lib/kdump/load.sh
+ExecStart=/lib/kdump/load.sh --update
ExecStop=/lib/kdump/unload.sh
RemainAfterExit=true
[Install]
WantedBy=multi-user.target
+Also=kdump-early.service
--- /dev/null
+++ b/init/kdump-early.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Load kdump kernel early on startup
+After=local-fs.target
+
+[Service]
+Type=oneshot
+ExecStart=/lib/kdump/load.sh
+ExecStop=/lib/kdump/unload.sh
+RemainAfterExit=true
+# It is OK if the initrd is missing in this early attempt
+SuccessExitStatus=6
+
+[Install]
+WantedBy=multi-user.target
--- a/init/kdump-rebuild-initrd.service
+++ /dev/null
@@ -1,12 +0,0 @@
-[Unit]
-Description=Reload kdump kernel and updated initrd after the network is configured
-After=local-fs.target network.service YaST2-Second-Stage.service YaST2-Firstboot.service
-
-[Service]
-Type=oneshot
-ExecStart=/lib/kdump/load.sh --update
-ExecStop=/lib/kdump/unload.sh
-RemainAfterExit=true
-
-[Install]
-WantedBy=multi-user.target
--- a/init/CMakeLists.txt
+++ b/init/CMakeLists.txt
@@ -39,7 +39,7 @@ INSTALL(
INSTALL(
FILES
${CMAKE_CURRENT_SOURCE_DIR}/kdump.service
- ${CMAKE_CURRENT_SOURCE_DIR}/kdump-rebuild-initrd.service
+ ${CMAKE_CURRENT_SOURCE_DIR}/kdump-early.service
DESTINATION
/usr/lib/systemd/system
PERMISSIONS

View File

@ -1,27 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Thu Jun 22 14:31:26 2017 +0200
Subject: Invoke subcommand destructors on exit
References: bsc#1045541
Upstream: v0.8.17
Git-commit: ff813cdc274caf7c006d438dbf30d83413bb896e
To execute the destructor for a subcommand, the object must be
explicitly freed in KdumpTool destructor. This fixes a bug that
NFS shares are not unmounted on exit.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
kdumptool/kdumptool.cc | 1 +
1 file changed, 1 insertion(+)
--- a/kdumptool/kdumptool.cc
+++ b/kdumptool/kdumptool.cc
@@ -67,6 +67,7 @@ KdumpTool::~KdumpTool()
throw ()
{
Debug::debug()->trace("KdumpTool::~KdumpTool()");
+ delete m_subcommand;
}
// -----------------------------------------------------------------------------

View File

@ -1,72 +0,0 @@
From: Lance Wang <lzwang@suse.com>
Date: Tue, 16 Jan 2018 13:37:37 +0100
Subject: load.sh: introduce kdump_echo and kdump_logger helpers
References: bsc#951144
Upstream: merged
Git-commit: b76b8fccbac6a7d2340d0452a6ba86530f588bfa
Instead of checking the verbosity flags every time, check them once
and provide an appropriate function definition.
Signed-off-by: Lance Wang <lzwang@suse.com>
---
init/load.sh | 34 +++++++++++++++++++++++-----------
1 file changed, 23 insertions(+), 11 deletions(-)
--- a/init/load.sh
+++ b/init/load.sh
@@ -163,9 +163,7 @@ function load_kdump_kexec()
KEXEC_CALL="$KEXEC -p $kdump_kernel --append=\"$kdump_commandline\""
KEXEC_CALL="$KEXEC_CALL --initrd=$kdump_initrd $kexec_options"
- if [ $((${KDUMP_VERBOSE:-0} & 4)) -gt 0 ] ; then
- echo "Loading kdump kernel: $KEXEC_CALL"
- fi
+ kdump_echo "Loading kdump kernel: $KEXEC_CALL"
local output
output=$(eval "$KEXEC_CALL" 2>&1)
@@ -179,14 +177,10 @@ function load_kdump_kexec()
# would be supressed (bnc#374185)
echo -n "$output"
- if [ $((${KDUMP_VERBOSE:-0} & 1)) -gt 0 ] ; then
- if [ $result -eq 0 ] ; then
- logger -i -t kdump \
- "Loaded kdump kernel: $KEXEC_CALL, Result: $output"
- else
- logger -i -t kdump \
- "FAILED to load kdump kernel: $KEXEC_CALL, Result: $output"
- fi
+ if [ $result -eq 0 ] ; then
+ kdump_logger "Loaded kdump kernel: $KEXEC_CALL, Result: $output"
+ else
+ kdump_logger "FAILED to load kdump kernel: $KEXEC_CALL, Result: $output"
fi
return $result
@@ -299,6 +293,24 @@ function rebuild_kdumprd()
eval $($KDUMPTOOL dump_config)
+if [ $((${KDUMP_VERBOSE:-0} & 4)) -gt 0 ] ; then
+ function kdump_echo()
+ {
+ echo "$@"
+ }
+else
+ function kdump_echo(){ :; }
+fi
+
+if [ $((${KDUMP_VERBOSE:-0} & 1)) -gt 0 ] ; then
+ function kdump_logger()
+ {
+ logger -i -t kdump "$@"
+ }
+else
+ function kdump_logger(){ :; }
+fi
+
if [ $((${KDUMP_VERBOSE:-0} & 16)) -gt 0 ] ; then
KDUMPTOOL="$KDUMPTOOL -D"
fi

View File

@ -1,139 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Fri Jun 23 13:19:41 2017 +0200
Subject: Move class SystemCPU to a header file
References: bsc#1036223
Upstream: v0.8.17
Git-commit: ded0d2117cce72fc98a7ca9ee577090889ef9b16
This allows to reuse the class outside of calibrate.cc.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
kdumptool/calibrate.cc | 47 ---------------------------------------------
kdumptool/calibrate.h | 51 +++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 51 insertions(+), 47 deletions(-)
--- a/kdumptool/calibrate.cc
+++ b/kdumptool/calibrate.cc
@@ -251,53 +251,6 @@ using std::ifstream;
//{{{ SystemCPU ----------------------------------------------------------------
-class SystemCPU {
-
- public:
- /**
- * Initialize a new SystemCPU object.
- *
- * @param[in] sysdir Mount point for sysfs
- */
- SystemCPU(const char *sysdir = "/sys")
- throw ()
- : m_cpudir(FilePath(sysdir).appendPath("devices/system/cpu"))
- {}
-
- protected:
- /**
- * Path to the cpu system devices base directory
- */
- const FilePath m_cpudir;
-
- /**
- * Count the number of CPUs in a cpuset
- *
- * @param[in] name Name of the cpuset ("possible", "present", "online")
- *
- * @exception KError if the file cannot be opened or parsed
- */
- unsigned long count(const char *name);
-
- public:
- /**
- * Count the number of online CPUs
- *
- * @exception KError see @c count()
- */
- unsigned long numOnline(void)
- { return count("online"); }
-
- /**
- * Count the number of offline CPUs
- *
- * @exception KError see @c count()
- */
- unsigned long numOffline(void)
- { return count("offline"); }
-
-};
-
// -----------------------------------------------------------------------------
unsigned long SystemCPU::count(const char *name)
{
--- a/kdumptool/calibrate.h
+++ b/kdumptool/calibrate.h
@@ -20,6 +20,7 @@
#define CALIBRATE_H
#include "subcommand.h"
+#include "fileutil.h"
//{{{ Calibrate ----------------------------------------------------------------
@@ -54,6 +55,56 @@ class Calibrate : public Subcommand {
};
//}}}
+//{{{ SystemCPU ----------------------------------------------------------------
+
+class SystemCPU {
+
+ public:
+ /**
+ * Initialize a new SystemCPU object.
+ *
+ * @param[in] sysdir Mount point for sysfs
+ */
+ SystemCPU(const char *sysdir = "/sys")
+ throw ()
+ : m_cpudir(FilePath(sysdir).appendPath("devices/system/cpu"))
+ {}
+
+ protected:
+ /**
+ * Path to the cpu system devices base directory
+ */
+ const FilePath m_cpudir;
+
+ /**
+ * Count the number of CPUs in a cpuset
+ *
+ * @param[in] name Name of the cpuset ("possible", "present", "online")
+ *
+ * @exception KError if the file cannot be opened or parsed
+ */
+ unsigned long count(const char *name);
+
+ public:
+ /**
+ * Count the number of online CPUs
+ *
+ * @exception KError see @c count()
+ */
+ unsigned long numOnline(void)
+ { return count("online"); }
+
+ /**
+ * Count the number of offline CPUs
+ *
+ * @exception KError see @c count()
+ */
+ unsigned long numOffline(void)
+ { return count("offline"); }
+
+};
+
+//}}}
#endif /* CALIBRATE_H */

View File

@ -1,116 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Fri Jun 23 13:47:28 2017 +0200
Subject: Multithreading by default
References: bsc#1036223
Upstream: v0.8.17
Git-commit: 07534f44546e37c65a08fe7fb093255fbca6cd30
The "--num-threads" and "--split" makedumpfile options are mutually
exclusive. Before multithreading was implemented, "--split" was the
only way to use any additional CPUs. It makes more sense to use
multithreading by default.
To use "--split", the SPLIT flag can be specified.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
doc/man/kdump.5.txt.in | 16 +++++++++++-----
kdumptool/savedump.cc | 17 +++++++++++++++++
kdumptool/savedump.h | 1 +
sysconfig.kdump.in | 5 +++--
4 files changed, 32 insertions(+), 7 deletions(-)
--- a/doc/man/kdump.5.txt.in
+++ b/doc/man/kdump.5.txt.in
@@ -513,11 +513,17 @@ This is a space-separated list of flags
Because SFTP and FTP are not mounted, that option has no meaning when saving
the dump to SFTP and FTP.
-*NOSPLIT*::
- Disable the _--split_ option of *makedumpfile*(8). This option is normally
- added when KDUMP_CPUS>1, because otherwise the additional CPUs are idle.
- You can specify this flag to force the use of only one dumping process,
- regardless of the value of KDUMP_CPUS.
+*SPLIT*::
+ If KDUMP_CPUS>1, use the _--split_ option of *makedumpfile*(8) instead of
+ the default _--num-threads_.
+
+*SINGLE*::
+ Specify this flag to force the use of only one CPU for dumping, regardless
+ of the value of KDUMP_CPUS.
+ It disables the _--split_ and _--num-threads_ options of *makedumpfile*(8).
+
+ For compatibility with older versions, *NOSPLIT* is an alias for *SINGLE*.
+ Its use is deprecated.
*XENALLDOMAINS*::
When dumping a Xen virtualization host, *makedumpfile*(8) is normally
--- a/kdumptool/savedump.cc
+++ b/kdumptool/savedump.cc
@@ -291,11 +291,24 @@ void SaveDump::saveDump(const RootDirURL
cpus = syscpu.numOnline();
}
if (!config->kdumptoolContainsFlag("NOSPLIT") &&
+ !config->kdumptoolContainsFlag("SINGLE") &&
cpus > 1) {
if (!useElf)
m_split = cpus;
else
cerr << "Splitting ELF dumps is not supported." << endl;
+
+ if (config->kdumptoolContainsFlag("SPLIT")) {
+ if (!useElf)
+ m_split = cpus;
+ else
+ cerr << "Splitting ELF dumps is not supported." << endl;
+ } else {
+ if (!useElf)
+ m_threads = cpus - 1;
+ else
+ cerr << "Multithreading is unavailable for ELF dumps" << endl;
+ }
}
bool excludeDomU = false;
@@ -313,6 +326,10 @@ void SaveDump::saveDump(const RootDirURL
cmdline << "makedumpfile ";
if (m_split)
cmdline << "--split ";
+ if (m_threads) {
+ SystemCPU syscpu;
+ cmdline << "--num-threads " << m_threads << " ";
+ }
cmdline << config->MAKEDUMPFILE_OPTIONS.value() << " ";
cmdline << "-d " << config->KDUMP_DUMPLEVEL.value() << " ";
if (excludeDomU)
--- a/kdumptool/savedump.h
+++ b/kdumptool/savedump.h
@@ -113,6 +113,7 @@ class SaveDump : public Subcommand {
bool m_usedDirectSave;
bool m_useMakedumpfile;
unsigned long m_split;
+ unsigned long m_threads;
std::string m_crashtime;
std::string m_crashrelease;
std::string m_rootdir;
--- a/sysconfig.kdump.in
+++ b/sysconfig.kdump.in
@@ -271,14 +271,15 @@ KDUMP_POSTSCRIPT=""
#
KDUMP_COPY_KERNEL="yes"
-## Type: string(NOSPARSE,NOSPLIT,XENALLDOMAINS)
+## Type: string(NOSPARSE,SPLIT,SINGLE,XENALLDOMAINS)
## Default: ""
## ServiceRestart: kdump
#
# Space-separated list of flags to tweak the run-time behaviour of kdumptool:
#
# NOSPARSE disable creation of sparse files.
-# NOSPLIT do not pass "--split" to makedumpfile even if KDUMP_CPUS > 1
+# SPLIT split the dump file with "makedumpfile --split"
+# SINGLE use single CPU to save the dump
# XENALLDOMAINS do not filter out Xen DomU pages
#
# See also: kdump(5).

View File

@ -1,144 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Tue, 27 Feb 2018 11:21:31 +0100
Subject: Do not reserve crashkernel on Xen PV DomU
References: bsc#989792
Upstream: merged
Git-commit: 17b818de6320cb908f26612303d8981bf1467605
When a Xen PV DomU crashes, it canot kexec a panic kernel, because
the kexec code is not paravirtualized. Do not try to reserve any
crashkernel memory on such systems.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
kdumptool/calibrate.cc | 112 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 112 insertions(+)
--- a/kdumptool/calibrate.cc
+++ b/kdumptool/calibrate.cc
@@ -290,6 +290,102 @@ unsigned long SystemCPU::count(const cha
}
//}}}
+//{{{ HyperInfo ----------------------------------------------------------------
+
+class HyperInfo {
+
+ public:
+ /**
+ * Initialize a new HyperInfo object.
+ *
+ * @param[in] procdir Mount point for procfs
+ * @param[in] sysdir Mount point for sysfs
+ */
+ HyperInfo(const char *procdir = "/proc", const char *sysdir = "/sys");
+
+ protected:
+ std::string m_type, m_guest_type, m_guest_variant;
+
+ private:
+ /**
+ * Read a file under a base directory into a string.
+ */
+ void read_str(std::string &str, const FilePath &basedir,
+ const char *attr);
+
+ public:
+ /**
+ * Get hypervisor type.
+ */
+ const std::string& type(void) const
+ { return m_type; }
+
+ /**
+ * Get hypervisor guest type.
+ */
+ const std::string& guest_type(void) const
+ { return m_guest_type; }
+
+ /**
+ * Get hypervisor guest variant (Dom0 or DomU).
+ */
+ const std::string& guest_variant(void) const
+ { return m_guest_variant; }
+};
+
+// -----------------------------------------------------------------------------
+HyperInfo::HyperInfo(const char *procdir, const char *sysdir)
+{
+ FilePath basedir(sysdir);
+ basedir.appendPath("hypervisor");
+
+ read_str(m_type, basedir, "type");
+ read_str(m_guest_type, basedir, "guest_type");
+
+ if (m_type == "xen") {
+ std::string caps;
+ std::string::size_type pos, next, len;
+
+ basedir = procdir;
+ basedir.appendPath("xen");
+ read_str(caps, basedir, "capabilities");
+
+ m_guest_variant = "DomU";
+ pos = 0;
+ while (pos != std::string::npos) {
+ len = next = caps.find(',', pos);
+ if (next != std::string::npos) {
+ ++next;
+ len -= pos;
+ }
+ if (caps.compare(pos, len, "control_d") == 0) {
+ m_guest_variant = "Dom0";
+ break;
+ }
+ pos = next;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+void HyperInfo::read_str(std::string &str, const FilePath &basedir,
+ const char *attr)
+{
+ FilePath fp(basedir);
+ std::ifstream f;
+
+ fp.appendPath(attr);
+ f.open(fp.c_str());
+ if (!f)
+ return;
+
+ getline(f, str);
+ f.close();
+ if (f.bad())
+ throw KError(fp + ": Read failed");
+}
+
+//}}}
//{{{ Framebuffer --------------------------------------------------------------
class Framebuffer {
@@ -852,6 +948,22 @@ void Calibrate::execute()
{
Debug::debug()->trace("Calibrate::execute()");
+ HyperInfo hyper;
+ Debug::debug()->dbg("Hypervisor type: %s", hyper.type().c_str());
+ Debug::debug()->dbg("Guest type: %s", hyper.guest_type().c_str());
+ Debug::debug()->dbg("Guest variant: %s", hyper.guest_variant().c_str());
+ if (hyper.type() == "xen" && hyper.guest_type() == "PV" &&
+ hyper.guest_variant() == "DomU") {
+ cout << "Total: 0" << endl;
+ cout << "Low: 0" << endl;
+ cout << "High: 0" << endl;
+ cout << "MinLow: 0" << endl;
+ cout << "MaxLow: 0" << endl;
+ cout << "MinHigh: 0 " << endl;
+ cout << "MaxHigh: 0 " << endl;
+ return;
+ }
+
MemMap mm;
unsigned long required, prev;
unsigned long pagesize = sysconf(_SC_PAGESIZE);

View File

@ -1,74 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Subject: Avoid Xen kernels as kdump kernel
References: bsc#900418, bsc#974270
Upstream: v0.8.17
Git-commit: 5b3a612f79f8a4935cee162e3bc2f72e996f628e
Since Xen kernels cannot run on bare metal, they must be avoided
as a secondary kernel.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
kdumptool/findkernel.cc | 29 ++++++++++++++++++++++++-----
1 file changed, 24 insertions(+), 5 deletions(-)
--- a/kdumptool/findkernel.cc
+++ b/kdumptool/findkernel.cc
@@ -130,14 +130,33 @@ bool FindKernel::suitableForKdump(const
}
}
+ Kconfig *kconfig = kt.retrieveKernelConfig();
+ KconfigValue kv;
+ bool isxen;
+
+ // Avoid Xenlinux kernels, because they do not run on bare metal
+ kv = kconfig->get("CONFIG_X86_64_XEN");
+ isxen = (kv.getType() == KconfigValue::T_TRISTATE &&
+ kv.getTristateValue() == KconfigValue::ON);
+ if (!isxen) {
+ kv = kconfig->get("CONFIG_X86_XEN");
+ isxen = (kv.getType() == KconfigValue::T_TRISTATE &&
+ kv.getTristateValue() == KconfigValue::ON);
+ }
+ if (isxen) {
+ Debug::debug()->dbg("%s is a Xen kernel. Avoid.",
+ kernelImage.c_str());
+ delete kconfig;
+ return false;
+ }
+
if (strict) {
string arch = Util::getArch();
- Kconfig *kconfig = kt.retrieveKernelConfig();
// avoid large number of CPUs on x86 since that increases
// memory size constraints of the capture kernel
if (arch == "i386" || arch == "x86_64") {
- KconfigValue kv = kconfig->get("CONFIG_NR_CPUS");
+ kv = kconfig->get("CONFIG_NR_CPUS");
if (kv.getType() == KconfigValue::T_INTEGER &&
kv.getIntValue() > MAXCPUS_KDUMP) {
Debug::debug()->dbg("NR_CPUS of %s is %d >= %d. Avoid.",
@@ -148,17 +167,17 @@ bool FindKernel::suitableForKdump(const
}
// avoid realtime kernels
- KconfigValue kv = kconfig->get("CONFIG_PREEMPT_RT");
+ kv = kconfig->get("CONFIG_PREEMPT_RT");
if (kv.getType() != KconfigValue::T_INVALID) {
Debug::debug()->dbg("%s is realtime kernel. Avoid.",
kernelImage.c_str());
delete kconfig;
return false;
}
-
- delete kconfig;
}
+ delete kconfig;
+
return true;
}

View File

@ -1,31 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Tue, 27 Feb 2018 09:57:04 +0100
Subject: Add 'nokaslr' to the kdump kernel command line
References: bsc#1075937
Upstream: merged
Git-commit: 0724bcc8220bf2bd4a3598185dcd5ec7e9e5fe47
The kASLR algorithm may decide to place the kernel into low memory,
which does not leave enough space for SWIOTLB, and dumping fails
later on. Since the kdump environment does not run any exploitable
services, kASLR can be safely disabled.
Note that kexec already avoids the low memory reservation when
finding a suitable location for the kernel, initrd and other data.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/load.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/init/load.sh
+++ b/init/load.sh
@@ -72,7 +72,7 @@ function build_kdump_commandline()
nr_cpus=$(cpus_param "$kdump_kernel")=${KDUMP_CPUS:-1}
fi
# Use deadline for saving the memory footprint
- commandline="$commandline elevator=deadline sysrq=yes reset_devices acpi_no_memhotplug cgroup_disable=memory"
+ commandline="$commandline elevator=deadline sysrq=yes reset_devices acpi_no_memhotplug cgroup_disable=memory nokaslr"
commandline="$commandline irqpoll ${nr_cpus}"
commandline="$commandline root=kdump rootflags=bind rd.udev.children-max=8"
case $(uname -i) in

View File

@ -1,38 +0,0 @@
From: Lance Wang <lzwang@suse.com>
Date: Mon, 4 Dec 2017 16:14:06 +0800
Subject: Copy /etc/hosts and /etc/nsswitch.conf in setup-kdump.functions
References: bsc#1048178,bsc#1002617
Upstream: merged
Git-commit: c5b2ce7c303d19f3615607d9867a06ce0f0d7ae2
Only filter field hosts from /etc/nsswitch.conf to avoid ssh login failure.
It is better to copy files in kdump dracut module than via the cmdline
to dracut.
---
init/mkdumprd | 3 ---
init/setup-kdump.functions | 2 ++
2 files changed, 2 insertions(+), 3 deletions(-)
--- a/init/mkdumprd
+++ b/init/mkdumprd
@@ -142,9 +142,6 @@ function run_dracut()
# Make resolved variables visible to the dracut module
kdump_export_targets
- # Include additional files in the kdump initial ram disk
- DRACUT_ARGS="$DRACUT_ARGS --install '/etc/hosts /etc/nsswitch.conf'"
-
DRACUT_ARGS="$DRACUT_ARGS --add 'kdump' $INITRD $KERNELVERSION"
echo "Regenerating kdump initrd ..." >&2
eval "bash -$- $DRACUT $DRACUT_ARGS"
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -859,6 +859,8 @@ function kdump_modify_config() #
KDUMP_SAVEDIR="${KDUMP_SAVEDIR}file://${kdump_Realpath[i]}"
elif [ "$protocol" != "srcfile" ] ; then
KDUMP_SAVEDIR="${KDUMP_SAVEDIR}${kdump_URL[i]}"
+ cp /etc/hosts "${dest}/etc"
+ grep '^hosts:' /etc/nsswitch.conf > "${dest}/etc/nsswitch.conf"
fi
#

View File

@ -1,49 +0,0 @@
From: Michal Koutny <mkoutny@suse.com>
Date: Mon, 26 Mar 2018 20:34:19 +0200
Subject: IPv6 setup: pass address prefix in separate dracut arg
References: bsc#1062026
Upstream: merged
Git-commit: c6fb83e6ebc310c615c145962f71b3f6f4819e88
Dracut distinguishes IPv6 addresses by bracket enclosing [1] so pass an
IPv6 address as such. The address prefix is passed separately through
netmask dracut argument (that is a slight misnomer as dracut just
propagates that value to iproute2 tools [2] which interpret it as
decimal number of prefix bits).
[1] https://github.com/dracutdevs/dracut/blob/031e2f7bb8aea447cd87e455b184106acb4aa435/modules.d/40network/net-lib.sh#L441
[2] https://github.com/dracutdevs/dracut/blob/031e2f7bb8aea447cd87e455b184106acb4aa435/modules.d/40network/ifup.sh#L130
---
init/setup-kdump.functions | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -586,7 +586,7 @@ function kdump_ip6_config() # {{
{
local iface="$1"
local bootif="$2"
- local ipaddr peeraddr gwaddr hostname
+ local ipaddr peeraddr gwaddr netmask hostname
local family cidr rest prefix
hostname=$(hostname)
@@ -598,7 +598,8 @@ function kdump_ip6_config() # {{
ipaddr="${cidr%/*}"
prefix="${cidr:${#ipaddr}}"
- ipaddr="[$ipaddr]$prefix"
+ netmask="${prefix:1}"
+ ipaddr="[$ipaddr]"
set -- $rest
if [ "$1" == "peer" ] ; then
@@ -609,7 +610,7 @@ function kdump_ip6_config() # {{
peeraddr=
fi
- echo "ip=$ipaddr:$peeraddr:$gwaddr::$hostname:$bootif:none"
+ echo "ip=$ipaddr:$peeraddr:$gwaddr:$netmask:$hostname:$bootif:none"
done < <(ip -6 address show dev "$iface" permanent scope global)
} # }}}

View File

@ -1,56 +0,0 @@
From: Michal Koutny <mkoutny@suse.com>
Date: Mon, 26 Mar 2018 20:40:40 +0200
Subject: IP setup: pass all routes to kdump environment
References: bsc#1062026
Upstream: merged
Git-commit: 7013c7f7e081b1691a6b30ba213c39a5ab38e5fe
In some network setups the kdump target may not be routable through the
default route. Thus pass all found routes.
---
init/setup-kdump.functions | 12 ++++++++++++
1 file changed, 12 insertions(+)
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -550,6 +550,7 @@ function kdump_ip_config() # {{{
local ipaddr peeraddr gwaddr netmask hostname
local family cidr rest
local prefix
+ local routes r
while read family cidr rest
do
[ "$family" = "inet" ] || continue
@@ -572,6 +573,11 @@ function kdump_ip_config() # {{{
hostname=$(hostname)
echo "ip=$ipaddr:$peeraddr:$gwaddr:$netmask:$hostname:$bootif:none"
+
+ routes=$(ip route show dev "$iface" | sed -n 's/\([0-9].*\) via \([^ ]*\).*/\1:\2/p')
+ for r in $routes ; do
+ echo "rd.route=$r:$bootif"
+ done
} # }}}
#
@@ -588,6 +594,7 @@ function kdump_ip6_config() # {{
local bootif="$2"
local ipaddr peeraddr gwaddr netmask hostname
local family cidr rest prefix
+ local routes r
hostname=$(hostname)
gwaddr=$(ip -6 route show ::/0 | sed -n 's/.* via \([^ ]*\).*/[\1]/p')
@@ -612,6 +619,11 @@ function kdump_ip6_config() # {{
echo "ip=$ipaddr:$peeraddr:$gwaddr:$netmask:$hostname:$bootif:none"
done < <(ip -6 address show dev "$iface" permanent scope global)
+
+ routes=$(ip -6 route show dev "$iface" | sed -n 's/\([0-9a-fA-F:].*\) via \([^ ]*\).*/[\1]:[\2]/p')
+ for r in $routes ; do
+ echo "rd.route=$r:$bootif"
+ done
} # }}}
#

View File

@ -1,74 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Subject: Pre-generate kdump mount units
References: bsc#942895
Upstream: v0.8.17
Git-commit: a7e47cdf9cb7db385bc30fce59abce1dc2b5cc11
SUSE version of dracut intentionally modifies the initrd to run
systemd-fstab-generator only after the root filesystem is mounted.
This breaks kdump-save.service, because mount units for /kdump/*
do not yet exist when kdump needs them.
Solve this by pre-generating the required mount units in the primary
system, so kdump no longer depends on running the fstab generator in
initrd context.
Note that I had to write a temporary /etc/fstab, because dracut
creates this file only after all modules have been processed.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/module-setup.sh | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -108,6 +108,39 @@ kdump_cmdline_ip() {
esac
}
+kdump_gen_mount_units() {
+ local line
+ local fstab="$initdir/etc/fstab"
+
+ [ -e "$fstab" ] && mv "$fstab" "$fstab.kdumpsave"
+ for line in "${fstab_lines[@]}"
+ do
+ line=($line)
+ [ "${line[1]#/kdump}" = "${line[1]}" ] && continue
+ [ -z "${line[3]}" ] && line[3]="defaults"
+ [ -z "${line[4]}" ] && line[4]="0"
+ [ -z "${line[5]}" ] && line[5]="2"
+ echo "${line[@]}" >> "$fstab"
+ done
+
+ echo "root=kdump" > "$initdir/proc/cmdline"
+ inst_binary -l \
+ "$systemdutildir/system-generators/systemd-fstab-generator" \
+ "/tmp/systemd-fstab-generator"
+ chroot "$initdir" "/tmp/systemd-fstab-generator" \
+ "$systemdsystemunitdir" \
+ "$systemdsystemunitdir" \
+ "$systemdsystemunitdir"
+ rm -f "$initdir/tmp/systemd-fstab-generator"
+ rm -f "$initdir/proc/cmdline"
+
+ if [ -e "$fstab.kdumpsave" ]; then
+ mv "$fstab.kdumpsave" "$fstab"
+ else
+ rm "$fstab"
+ fi
+}
+
cmdline() {
kdump_cmdline_ip
}
@@ -155,6 +188,8 @@ install() {
"$initdir/$systemdsystemunitdir"/kdump-save.service
ln_r "$systemdsystemunitdir"/kdump-save.service \
"$systemdsystemunitdir"/initrd.target.wants/kdump-save.service
+
+ kdump_gen_mount_units
else
[ "$KDUMP_FADUMP" != yes ] && \
inst_hook mount 30 "$moddir/mount-kdump.sh"

View File

@ -1,44 +0,0 @@
Date: Wed Jun 14 14:39:15 2017 +0200
From: Petr Tesarik <ptesarik@suse.com>
Subject: Prepend IP address to remote target subdirectory
References: FATE#321844
Upstream: v0.8.17
Git-commit: d8f0f0cb4450776b0765ddb0441a5d5669a78062
Check the target route directly from save_dump and take the preferred
source IP address into the subdirectory name.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
diff --git a/kdumptool/savedump.cc b/kdumptool/savedump.cc
index 9938b6f..14e66b3 100644
--- a/kdumptool/savedump.cc
+++ b/kdumptool/savedump.cc
@@ -40,6 +40,7 @@
#include "vmcoreinfo.h"
#include "identifykernel.h"
#include "email.h"
+#include "routable.h"
using std::string;
using std::list;
@@ -114,8 +115,17 @@ void SaveDump::execute()
std::istringstream iss(config->KDUMP_SAVEDIR.value());
FilePath elem;
while (iss >> elem) {
- RootDirURL url(elem.appendPath(subdir), m_rootdir);
- urlv.push_back(url);
+ RootDirURL url(elem, m_rootdir);
+ if (url.getProtocol() != URLParser::PROT_FILE) {
+ Routable rt(url.getHostname());
+ if (!rt.check(config->KDUMP_NET_TIMEOUT.value())) {
+ cerr << "WARNING: Dump target not reachable" << endl;
+ elem.appendPath(string("unknown-") + subdir);
+ } else
+ elem.appendPath(rt.prefsrc() + '-' + subdir);
+ } else
+ elem.appendPath(subdir);
+ urlv.push_back(RootDirURL(elem, m_rootdir));
}
m_transfer = getTransfer(urlv);

View File

@ -1,69 +0,0 @@
From: Michal Suchanek <msuchanek@suse.de>
Date: Wed Jun 21 15:23:30 2017 +0200
Subject: Remount /sysroot readwrite when used for kdump
References: bsc#1034169
Upstream: v0.8.17
Git-commit: b3e40e6cb5794e441ddabf1de88f3729ebd0cc6f
When kdump is saved to / (ie /var is not separate filesystem) /kdump/mnt0 is
bind mount of readonly /sysroot. Due to mount bug "mount /kdump/mnt0 -o
remount,rw" does nothing.
Remount the device by hand with "mount none /kdump/mnt0 -o remount,rw" which
avoids the bug.
Based on patch by Neil Brown <nfbrown@suse.com>
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
--- kdump-0.8.16/init/save_dump.sh~ 2017-06-15 14:47:33.059006747 +0200
+++ kdump-0.8.16/init/save_dump.sh 2017-06-15 14:47:42.827155243 +0200
@@ -127,13 +127,38 @@
check_for_device "$@"
}
+function rw_fixup()
+{
+ # handle remounting existing readonly mounts readwrite
+ # mount -a works only for not yet mounted filesystems
+ # remounting bind mounts needs special incantation
+ while read dev mpt fs opt dummy ; do
+ case "$opt" in
+ *bind*)
+ if [ "$fs" = "none" ] && ! [ -w "$mpt" ]; then
+ mount none "$mpt" -o remount,rw
+ fi
+ ;;
+ ro,* | *,ro,* | *,ro) ;;
+ *)
+ if ! [ -w "$mpt" ]; then
+ mount "$mpt" -o remount,rw
+ fi
+ ;;
+ esac
+ done < /etc/fstab
+}
+
#
# Mounts all partitions listed in /etc/fstab.kdump
function mount_all()
{
local ret=0
- test -f /etc/fstab.kdump || return 0
+ if ! [ -f /etc/fstab.kdump ] ; then
+ rw_fixup
+ return 0
+ fi
if [ -f /etc/fstab ] ; then
mv /etc/fstab /etc/fstab.orig
@@ -143,6 +167,8 @@
mount -a
ret=$?
+ rw_fixup
+
if [ -f /etc/fstab.orig ] ; then
mv /etc/fstab.orig /etc/fstab
else

View File

@ -1,51 +0,0 @@
From: Michal Koutny <mkoutny@suse.com>
Date: Mon, 26 Mar 2018 20:43:40 +0200
Subject: Routable: do not pass bracketed IPv6 to getaddrinfo
References: bsc#1062026
Upstream: merged
Git-commit: ba186e82f9ea9b724fd48a1f119afb73b0063c12
It would be nicer to strip the brackets in URLParser and work with a
plain IPv6 as hostname. However, since we pass that value to callees
that expect bracketed form (e.g. NFS mount) we invert the convention and
keep the bracketed version and use bare IPv6 to feed getaddrinfo only.
---
kdumptool/routable.cc | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
--- a/kdumptool/routable.cc
+++ b/kdumptool/routable.cc
@@ -33,6 +33,7 @@
#include "global.h"
#include "routable.h"
+#include "stringutil.h"
#include "debug.h"
//{{{ NetLink ------------------------------------------------------------------
@@ -459,8 +460,14 @@ bool Routable::resolve(void)
{
struct addrinfo hints;
int res;
+ KString raw_host(m_host);
- Debug::debug()->trace("resolve(%s)", m_host.c_str());
+ // remove IPv6 URL bracketing for getaddrinfo
+ if (raw_host.size() > 0 &&
+ raw_host[0] == '[' && raw_host[raw_host.size()-1] == ']')
+ raw_host = raw_host.substr(1, raw_host.size()-2);
+
+ Debug::debug()->trace("resolve(%s)", raw_host.c_str());
if (m_ai)
freeaddrinfo(m_ai);
@@ -469,7 +476,7 @@ bool Routable::resolve(void)
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_RAW;
do {
- res = getaddrinfo(m_host.c_str(), NULL, &hints, &m_ai);
+ res = getaddrinfo(raw_host.c_str(), NULL, &hints, &m_ai);
} while (res == EAI_AGAIN);
if (res == 0)

View File

@ -1,58 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Fri, 20 Apr 2018 17:54:19 +0200
Subject: Run mkinitrd if fadump is active
References: bsc#1089917
Upstream: merged
Git-commit: a25562cb0ff7d2b6d6df2dded8bd29c2e4d7e9ea
With fadump, the default initrd is used. It is better to call the
normal mkinitrd script to achieve consistent behaviour between
updates triggered by kdump and other changes that may require a
rebuild of the initrd.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/mkdumprd | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
--- a/init/mkdumprd
+++ b/init/mkdumprd
@@ -117,6 +117,25 @@ function run_mkinitrd()
} # }}}
#
+# Create a new fadump initrd using mkinitrd {{{
+function run_mkinitrd_fadump()
+{
+ # With fadump, we have no control over which kernel will be booted
+ # to save the dump, so do not add any versions here.
+ MKINITRD_ARGS=""
+
+ #
+ # if -q is specified, don't print mkinitrd output
+ if (( $QUIET )) ; then
+ MKINITRD_ARGS="$MKINITRD_ARGS &>/dev/null"
+ fi
+
+ status_message "Calling mkinitrd $MKINITRD_ARGS"
+ echo "Regenerating initrd ..." >&2
+ eval "bash -$- /sbin/mkinitrd $MKINITRD_ARGS"
+} # }}}
+
+#
# Create a new initrd using dracut {{{
function run_dracut()
{
@@ -219,7 +238,11 @@ if (( ! $FORCE )) ; then
fi
if [ -e $DRACUT ] ; then
- run_dracut
+ if [ "$KDUMP_FADUMP" = "yes" ] ; then
+ run_mkinitrd_fadump
+ else
+ run_dracut
+ fi
ret=$?
else
run_mkinitrd

View File

@ -1,42 +0,0 @@
From: Michal Koutny <mkoutny@suse.com>
Date: Mon, 26 Mar 2018 20:51:19 +0200
Subject: IP setup: don't bother with IPv4 if there are no addresses
References: bsc#1062026
Upstream: merged
Git-commit: 7adc9d04d1eedd4f86c3d9a895ec725f553e3599
When an interface which is IPv6 only is used to store dump, kdump will
attempt to create IPv4 configuration option which dracut cannot parse.
> [ 3.098548] dracut: FATAL: For argument 'ip=::10.100.33.254::germ184:eth1:none'\nValue 'none' without static configuration does not make sense
> [ 3.115833] dracut: Refusing to continue
Use the same approach as with IPv6, i.e. configure it only when any
IPv4 addresses are present.
---
init/setup-kdump.functions | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -572,12 +572,14 @@ function kdump_ip_config() # {{{
gwaddr=$(ip route show 0/0 | sed -n 's/.* via \([^ ]*\).*/\1/p')
hostname=$(hostname)
- echo "ip=$ipaddr:$peeraddr:$gwaddr:$netmask:$hostname:$bootif:none"
+ if [ -n "$ipaddr" ] ; then
+ echo "ip=$ipaddr:$peeraddr:$gwaddr:$netmask:$hostname:$bootif:none"
- routes=$(ip route show dev "$iface" | sed -n 's/\([0-9].*\) via \([^ ]*\).*/\1:\2/p')
- for r in $routes ; do
- echo "rd.route=$r:$bootif"
- done
+ routes=$(ip route show dev "$iface" | sed -n 's/\([0-9].*\) via \([^ ]*\).*/\1:\2/p')
+ for r in $routes ; do
+ echo "rd.route=$r:$bootif"
+ done
+ fi
} # }}}
#

View File

@ -1,25 +0,0 @@
From: Michal Suchanek <msuchanek@suse.de>
Date: Wed Jun 21 15:33:01 2017 +0200
Subject: Source save_dump.sh in systemd service.
References: bcs#1034169
Upstream: v0.8.17
Git-commit: b053165dd633978b1a78f6f7f993d34a62ee97c3
save_dump.sh is designed to be sourced and contains a number of toplevel return
statements. Bash will complain when these are executed unless the script is
sourced so source it to prevent useless noise.
Reported-by: Neil Brown <nfbrown@suse.com>
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
--- kdump-0.8.16/init/kdump-save.service.in~ 2016-10-05 09:37:12.000000000 +0200
+++ kdump-0.8.16/init/kdump-save.service.in 2017-06-01 17:04:00.428710624 +0200
@@ -17,7 +17,7 @@
[Service]
Type=oneshot
-ExecStart=/lib/kdump/save_dump.sh
+ExecStart=/bin/bash -c "source /lib/kdump/save_dump.sh"
StandardInput=tty
StandardOutput=tty
StandardError=tty

View File

@ -1,176 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Fri Jun 23 13:43:15 2017 +0200
Subject: Treat KDUMP_CPUS=0 as "all available CPUs"
References: bsc#1036223
Upstream: v0.8.17
Git-commit: 34192abe9a0f5ddbcd580fa52b7fa4400533b9a4
Since SMP after crash is now considered stable, remove the warnings and
make the feature more useful by not requiring a fixed number of CPUs.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
doc/man/kdump.5.txt.in | 7 +++----
init/load.sh | 7 +++++--
kdumptool/calibrate.cc | 6 +++---
kdumptool/savedump.cc | 23 ++++++++++++++---------
kdumptool/savedump.h | 2 +-
sysconfig.kdump.in | 7 +------
6 files changed, 27 insertions(+), 25 deletions(-)
--- a/doc/man/kdump.5.txt.in
+++ b/doc/man/kdump.5.txt.in
@@ -136,13 +136,12 @@ the number of CPUs in your system.
This parameter modifies the _maxcpus_ parameter of the kdump kernel and
the number of *makedumpfile*(8) processes created.
+If the value is zero, all available CPUs are used, i.e. the _maxcpus_
+parameter is not added to the kdump kernel command line.
+
*Note:* This parameter does not work properly for the _ELF_ format,
because *makedumpfile*(8) does not support split _ELF_ dump files.
-*WARNING:* SETTING THIS NUMBER TO A NUMBER HIGHER THAN 1 IS EXPERIMENTAL!
-SOME MACHINES ARE KNOWN TO HANG OR REBOOT RANDOMLY DURING INITIALISATION
-OF THE DUMP KERNEL IF KDUMP_CPUS > 1.
-
Default is 1.
--- a/init/load.sh
+++ b/init/load.sh
@@ -63,14 +63,17 @@ function build_kdump_commandline()
local commandline="$KDUMP_COMMANDLINE"
if [ -z "$commandline" ] ; then
- local nr_cpus=$(cpus_param "$kdump_kernel")
+ local nr_cpus
commandline=$(
remove_from_commandline \
'root|resume|crashkernel|splash|mem|BOOT_IMAGE|showopts|zfcp\.allow_lun_scan|hugepages|acpi_no_memhotplug|cgroup_disable|unknown_nmi_panic|rd\.udev\.children-max' \
< /proc/cmdline)
+ if [ ${KDUMP_CPUS:-1} -ne 0 ] ; then
+ nr_cpus=$(cpus_param "$kdump_kernel")=${KDUMP_CPUS:-1}
+ fi
# Use deadline for saving the memory footprint
commandline="$commandline elevator=deadline sysrq=yes reset_devices acpi_no_memhotplug cgroup_disable=memory"
- commandline="$commandline irqpoll ${nr_cpus}=${KDUMP_CPUS:-1}"
+ commandline="$commandline irqpoll ${nr_cpus}"
commandline="$commandline root=kdump rootflags=bind rd.udev.children-max=8"
case $(uname -i) in
i?86|x86_64)
--- a/kdumptool/calibrate.cc
+++ b/kdumptool/calibrate.cc
@@ -905,10 +905,10 @@ void Calibrate::execute()
}
// Add memory based on CPU count
- unsigned long cpus;
- if (CAN_REDUCE_CPUS) {
+ unsigned long cpus = 0;
+ if (CAN_REDUCE_CPUS)
cpus = config->KDUMP_CPUS.value();
- } else {
+ if (!cpus) {
SystemCPU syscpu;
unsigned long online = syscpu.numOnline();
unsigned long offline = syscpu.numOffline();
--- a/kdumptool/savedump.cc
+++ b/kdumptool/savedump.cc
@@ -41,6 +41,7 @@
#include "identifykernel.h"
#include "email.h"
#include "routable.h"
+#include "calibrate.h"
using std::string;
using std::list;
@@ -60,7 +61,7 @@ using std::ifstream;
SaveDump::SaveDump()
throw ()
: m_dump(DEFAULT_DUMP), m_transfer(NULL), m_usedDirectSave(false),
- m_useMakedumpfile(false), m_useSplit(false), m_nomail(false)
+ m_useMakedumpfile(false), m_split(0), m_nomail(false)
{
Debug::debug()->trace("SaveDump::SaveDump()");
@@ -284,10 +285,15 @@ void SaveDump::saveDump(const RootDirURL
if (noDump)
return; // nothing to be done
+ unsigned long cpus = config->KDUMP_CPUS.value();
+ if (cpus) {
+ SystemCPU syscpu;
+ cpus = syscpu.numOnline();
+ }
if (!config->kdumptoolContainsFlag("NOSPLIT") &&
- config->KDUMP_CPUS.value() > 1) {
+ cpus > 1) {
if (!useElf)
- m_useSplit = true;
+ m_split = cpus;
else
cerr << "Splitting ELF dumps is not supported." << endl;
}
@@ -305,7 +311,7 @@ void SaveDump::saveDump(const RootDirURL
// use makedumpfile
ostringstream cmdline;
cmdline << "makedumpfile ";
- if (m_useSplit)
+ if (m_split)
cmdline << "--split ";
cmdline << config->MAKEDUMPFILE_OPTIONS.value() << " ";
cmdline << "-d " << config->KDUMP_DUMPLEVEL.value() << " ";
@@ -340,10 +346,9 @@ void SaveDump::saveDump(const RootDirURL
provider->setProgress(&progress);
else
cout << "Saving dump ..." << endl;
- if (m_useSplit) {
+ if (m_split) {
StringVector targets;
- const int cpus = config->KDUMP_CPUS.value();
- for (int i = 1; i <= cpus; ++i) {
+ for (unsigned long i = 1; i <= m_split; ++i) {
ostringstream ss;
ss << "vmcore" << i;
targets.push_back(ss.str());
@@ -482,8 +487,8 @@ void SaveDump::generateInfo()
ss << "Dump level : "
<< Stringutil::number2string(config->KDUMP_DUMPLEVEL.value()) << endl;
ss << "Dump format : " << config->KDUMP_DUMPFORMAT.value() << endl;
- if (m_useSplit && m_usedDirectSave)
- ss << "Split parts : " << config->KDUMP_CPUS.value() << endl;
+ if (m_split && m_usedDirectSave)
+ ss << "Split parts : " << m_split << endl;
ss << endl;
--- a/kdumptool/savedump.h
+++ b/kdumptool/savedump.h
@@ -112,7 +112,7 @@ class SaveDump : public Subcommand {
Transfer *m_transfer;
bool m_usedDirectSave;
bool m_useMakedumpfile;
- bool m_useSplit;
+ unsigned long m_split;
std::string m_crashtime;
std::string m_crashrelease;
std::string m_rootdir;
--- a/sysconfig.kdump.in
+++ b/sysconfig.kdump.in
@@ -18,13 +18,8 @@ KDUMP_KERNELVER=""
#
# Number of CPUs to be used in the kdump environment. You may want to
# increase the number if computing power is the bottleneck in your setup.
-# This value is used as the maxcpus parameter of the secondary kernel, so
-# DON'T CHANGE IT unless your system can reliably re-initialize SMP after
-# a kernel crash.
#
-# WARNING: SETTING THIS NUMBER TO A NUMBER HIGHER THAN 1 IS EXPERIMENTAL!
-# SOME MACHINES ARE KNOWN TO HANG OR REBOOT RANDOMLY DURING INITIALISATION
-# OF THE DUMP KERNEL IF KDUMP_CPUS > 1.
+# If the value is zero, use all available CPUs.
#
# See also: kdump(5).
#

View File

@ -1,84 +0,0 @@
From: Lance Wang <lzwang@suse.com>
Date: Tue, 16 Jan 2018 13:53:40 +0100
Subject: Try both kexec_load(2) and kexec_file_load(2)
References: bsc#951144
Upstream: merged
Git-commit: ab9c22489ef7627e3f0ad67f46ea19e8d401d044
The logic in load.sh will use kexec_load first. If kexec_load fails
or is blocked by kernel, then it will try kexec_load_file on
x86_64.
Signed-off-by: Joey Lee <jlee@suse.com>
Signed-off-by: Lance Wang <lzwang@suse.com>
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/load.sh | 38 +++++++++++++++++++++++++-------------
1 file changed, 25 insertions(+), 13 deletions(-)
--- a/init/load.sh
+++ b/init/load.sh
@@ -138,11 +138,6 @@ function build_kexec_options()
options="$options --noio"
fi
- # add -s on x86_64 for signature verification of kernel
- if [ "$(uname -i)" = "x86_64" ] ; then
- options="$options -s"
- fi
-
echo "$options"
}
@@ -151,6 +146,7 @@ function build_kexec_options()
function load_kdump_kexec()
{
local result
+ local output
if [ ! -f "$kdump_initrd" ] ; then
echo "No kdump initial ramdisk found. Tried to locate $kdump_initrd."
@@ -163,19 +159,35 @@ function load_kdump_kexec()
KEXEC_CALL="$KEXEC -p $kdump_kernel --append=\"$kdump_commandline\""
KEXEC_CALL="$KEXEC_CALL --initrd=$kdump_initrd $kexec_options"
- kdump_echo "Loading kdump kernel: $KEXEC_CALL"
+ kdump_echo "Starting load kdump kernel with kexec_file_load(2)"
+ kdump_echo "kexec cmdline: $KEXEC_CALL -s"
- local output
- output=$(eval "$KEXEC_CALL" 2>&1)
- if [ $? -eq 0 ] ; then
- result=0
- else
- result=1
+ output=$(eval "$KEXEC_CALL -s" 2>&1)
+ result=$?
+ if [ $result -eq 255 ] ; then
+ echo $output | grep -q 'syscall kexec_file_load not available' && result=7
fi
# print stderr in any case to show warnings that normally
# would be supressed (bnc#374185)
- echo -n "$output"
+ echo -n "$output"; echo
+
+ if [ $result -eq 0 ] ; then
+ kdump_logger "Loaded kdump kernel: $KEXEC_CALL -s, Result: $output"
+ return 0
+ elif [ $result -ne 7 ]; then
+ kdump_logger "FAILED to load kdump kernel: $KEXEC_CALL -s, Result: $output"
+ return $result
+ fi
+
+ # kexec_file_load(2) not available
+ kdump_echo "kexec_file_load(2) not available"
+ kdump_echo "Starting load kdump kernel with kexec_load(2)"
+ kdump_echo "kexec cmdline: $KEXEC_CALL"
+
+ output=$(eval "$KEXEC_CALL" 2>&1)
+ result=$?
+ echo -n "$output";echo
if [ $result -eq 0 ] ; then
kdump_logger "Loaded kdump kernel: $KEXEC_CALL, Result: $output"

View File

@ -1,95 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Fri, 6 Apr 2018 14:43:06 +0200
Subject: Use bus id to identify qeth devices
References: bsc#1085617
Upstream: merged
Git-commit: 5c608e4d8adf57e66ce85ec62bf59887e6b860e7
QETH devices may not have a stable MAC address, so dracut's ifname=
parameter is not useful. The device's bus ID is stable, but there
is (currently) no support in dracut, so a custom udev rule must be
generated instead.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/setup-kdump.functions | 47 ++++++++++++++++++++++++++++++++++++---------
1 file changed, 38 insertions(+), 9 deletions(-)
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -453,6 +453,24 @@ function kdump_vlan_config() # {
#
# Parameters:
# 1) device device name
+# Output:
+# permanent hardware address
+function kdump_hwaddr() # {{{
+{
+ local _iface="$1"
+ local _type=$(<"/sys/class/net/$_iface/addr_assign_type")
+ if [ "$_type" -eq 0 ]
+ then
+ cat "/sys/class/net/$kdump_iface/address"
+ else
+ ethtool -P "$kdump_iface" | sed 's/^[^:]*: *//'
+ fi
+} # }}}
+
+# Get the ifname parameter for a given device
+#
+# Parameters:
+# 1) device device name
# Output variables:
# kdump_netif corresponding ifname= initrd parameter added
# kdump_iface device name in initrd
@@ -466,16 +484,16 @@ function kdump_ifname_config() #
if [ -z "$ifkind" ]
then
kdump_hwif="$kdump_hwif $kdump_iface"
+ local _drv=$( readlink "/sys/class/net/$kdump_iface/device/driver" )
- local hwaddr
- local addrtype=$(<"/sys/class/net/$kdump_iface/addr_assign_type")
- if [ "$addrtype" -eq 0 ]
- then
- hwaddr=$(<"/sys/class/net/$kdump_iface/address")
- else
- hwaddr=$(ethtool -P "$kdump_iface" | sed 's/^[^:]*: *//')
- fi
- [ -n "$hwaddr" ] && kdump_netif="$kdump_netif ifname=$kdump_iface:$hwaddr"
+ case "$_drv" in
+ */qeth)
+ ;;
+ *)
+ local hwaddr=$(kdump_hwaddr "$kdump_iface")
+ [ -n "$hwaddr" ] && kdump_netif="$kdump_netif ifname=$kdump_iface:$hwaddr"
+ ;;
+ esac
else
case "$ifkind" in
bridge)
@@ -1063,6 +1081,13 @@ function kdump_setup_qeth() # {{
_cdev2="${_cdev2##*/}"
local _layer2=$(</sys/class/net/$_iface/device/layer2)
local _portno=$(</sys/class/net/$_iface/device/portno)
+ local _type=$(</sys/class/net/$_iface/type)
+ local _dev_id _dev_id_match
+ if [ "$_layer2" -ne 0 ]
+ then
+ _dev_id=""$(</sys/class/net/$_iface/dev_id)
+ _dev_id_match=", ATTR{dev_id}==\"$_dev_id\""
+ fi
cat >"${_root}/etc/udev/rules.d/51-qeth-${_dev}.rules" <<EOF
ACTION=="add", SUBSYSTEM=="drivers", KERNEL=="qeth", IMPORT{program}="collect $_dev %k $_cdev0 $_cdev1 $_cdev2 qeth"
@@ -1081,6 +1106,10 @@ ACTION=="add", SUBSYSTEM=="ccwgroup", KE
ACTION=="add", SUBSYSTEM=="ccwgroup", KERNEL=="$_dev", ATTR{layer2}="$_layer2"
ACTION=="add", SUBSYSTEM=="ccwgroup", KERNEL=="$_dev", ATTR{online}="1"
EOF
+
+ cat >"${_root}/etc/udev/rules.d/70-persistent-net-${_iface}.rules" <<EOF
+SUBSYSTEM=="net", ACTION=="add", DRIVERS=="qeth"$_dev_id_match, KERNELS=="$_dev", ATTR{type}=="$_type", NAME="$_iface"
+EOF
} # }}}
#

View File

@ -1,29 +0,0 @@
From: Joey Lee <jlee@suse.com>
Subject: Use 'kexec -s' on x86_64
References: FATE#315018, bsc#884453
Upstream: v0.8.17
Git-commit: 48162b5fc73d733ce57a27e4f6df7e46cae66684
The kexec(2) system call is disabled if booted with Secure Boot. Tell
kexec (the utility) to use kexec_file(2) instead on x86_64.
Signed-off-by: Joey Lee <jlee@suse.com>
---
init/load.sh | 5 +++++
1 file changed, 5 insertions(+)
--- a/init/load.sh
+++ b/init/load.sh
@@ -135,6 +135,11 @@ function build_kexec_options()
options="$options --noio"
fi
+ # add -s on x86_64 for signature verification of kernel
+ if [ "$(uname -i)" = "x86_64" ] ; then
+ options="$options -s"
+ fi
+
echo "$options"
}

View File

@ -1,3 +1,63 @@
-------------------------------------------------------------------
Thu May 3 09:19:16 UTC 2018 - ptesarik@suse.com
- Update to 0.9.0
o Remove support for mkinitrd(8).
- Drop patches now in mainline:
o kdump-Don-t-split-by-default.patch
o kdump-Dont-exit-even-if-initrd-is-not-built.patch
o kdump-KDUMP_SSH_IDENTITY-cfg.patch
o kdump-KDUMP_SSH_IDENTITY.patch
o kdump-Limit-kdump-cpus-to-number-provided-by-config.patch
o kdump-Routable-preferred-source-address.patch
o kdump-URLTransfer-complete-target.patch
o kdump-aarch64.patch
o kdump-activate-QETH-devices.patch
o kdump-additional-mounts-in-dracut-module.patch
o kdump-always-copy-timezone.patch
o kdump-always-kexec_load-if-kexec_file_load-fails.patch
o kdump-always-pass-kernelver-to-dracut.patch
o kdump-bail-out-if-no-default-interface.patch
o kdump-bind-mount-sysroot.patch
o kdump-bootloader-filter-out-KDUMPTOOL_FLAGS.patch
o kdump-calibrate-adjust-sizeof-struct-page.patch
o kdump-calibrate-do-not-add-KDUMP_PHYS_LOAD-to-RAM.patch
o kdump-calibrate-update-kernel-text-data-size.patch
o kdump-calibrate-update-user-space-requirements.patch
o kdump-cmake-compat.patch
o kdump-do-not-check-bind-mount.patch
o kdump-do-not-free-fadump-memory-when-immediate-reboot-is-requested.patch
o kdump-do-not-touch-dracut-vars-if-not-kdumprd.patch
o kdump-explicitly-request-zFCP-devices.patch
o kdump-fail-if-fadump-cannot-be-registered.patch
o kdump-fix-m_threads-missing-initialization.patch
o kdump-fix-missing-index-of-kdump_Host.patch
o kdump-fix-save_dump-to-NFS.patch
o kdump-fix-service-files.patch
o kdump-invoke-subcommand-destructors-on-exit.patch
o kdump-kdump_echo-and-kdump_logger-helpers.patch
o kdump-move-class-SystemCPU-to-header-file.patch
o kdump-multithreading-by-default.patch
o kdump-no-crashkernel-in-Xen-PV-DomU.patch
o kdump-no-xen-secondary-kernel.patch
o kdump-nokaslr.patch
o kdump-nsswitch.conf-filtering.patch
o kdump-pass-IPv6-address-prefix-separately.patch
o kdump-pass-all-IP-routes-to-kdump-environment.patch
o kdump-pre-generate-mount-units.patch
o kdump-prepend-IP-address.patch
o kdump-remount-sysroot-readwrite.patch
o kdump-remove-IPv6-brackets-for-getaddrinfo.patch
o kdump-run-mkinitrd-if-fadump-is-active.patch
o kdump-skip-IPv4-if-no-address.patch
o kdump-source-save_dump.patch
o kdump-treat-KDUMP_CPUS-0-as-all-available-CPUs.patch
o kdump-try-both-kexec_load-and-kexec_file_load.patch
o kdump-use-bus-id-to-identify-qeth-devices.patch
o kdump-x86_64-kexec-file-syscall.patch
- Remove kdump-cmake-compat.patch: Since mkinitrd support has been
removed, compatibility with SLE11 is no longer needed.
-------------------------------------------------------------------
Wed May 2 11:33:01 UTC 2018 - ptesarik@suse.com

View File

@ -38,67 +38,15 @@
%define _udevrulesdir %{_udevdir}/rules.d
Name: kdump
Version: 0.8.16
Version: 0.9.0
Release: 0
Summary: Script for kdump
License: GPL-2.0+
Group: System/Kernel
Url: https://github.com/ptesarik/kdump
Source: %{name}-%{version}.tar.bz2
Source1: kernel-ELF-aarch64
Source2: %{name}-rpmlintrc
Patch1: %{name}-cmake-compat.patch
Patch2: %{name}-KDUMP_SSH_IDENTITY.patch
Patch3: %{name}-KDUMP_SSH_IDENTITY-cfg.patch
Patch4: %{name}-no-xen-secondary-kernel.patch
Patch5: %{name}-always-pass-kernelver-to-dracut.patch
Patch6: %{name}-pre-generate-mount-units.patch
Patch7: %{name}-bind-mount-sysroot.patch
Patch8: %{name}-x86_64-kexec-file-syscall.patch
Patch9: %{name}-aarch64.patch
Patch10: %{name}-fix-service-files.patch
Patch11: %{name}-Routable-preferred-source-address.patch
Patch12: %{name}-URLTransfer-complete-target.patch
Patch13: %{name}-prepend-IP-address.patch
Patch14: %{name}-do-not-free-fadump-memory-when-immediate-reboot-is-requested.patch
Patch15: %{name}-do-not-check-bind-mount.patch
Patch16: %{name}-source-save_dump.patch
Patch17: %{name}-remount-sysroot-readwrite.patch
Patch18: %{name}-fix-save_dump-to-NFS.patch
Patch19: %{name}-invoke-subcommand-destructors-on-exit.patch
Patch20: %{name}-move-class-SystemCPU-to-header-file.patch
Patch21: %{name}-treat-KDUMP_CPUS-0-as-all-available-CPUs.patch
Patch22: %{name}-multithreading-by-default.patch
Patch23: %{name}-explicitly-request-zFCP-devices.patch
Patch24: %{name}-fail-if-fadump-cannot-be-registered.patch
Patch25: %{name}-activate-QETH-devices.patch
Patch26: %{name}-Dont-exit-even-if-initrd-is-not-built.patch
Patch27: %{name}-Limit-kdump-cpus-to-number-provided-by-config.patch
Patch28: %{name}-Don-t-split-by-default.patch
Patch29: %{name}-fillupdir-fixes.patch
Patch30: %{name}-kdump_echo-and-kdump_logger-helpers.patch
Patch31: %{name}-try-both-kexec_load-and-kexec_file_load.patch
Patch32: %{name}-fix-m_threads-missing-initialization.patch
Patch33: %{name}-calibrate-adjust-sizeof-struct-page.patch
Patch34: %{name}-calibrate-update-kernel-text-data-size.patch
Patch35: %{name}-calibrate-update-user-space-requirements.patch
Patch36: %{name}-bail-out-if-no-default-interface.patch
Patch37: %{name}-fix-missing-index-of-kdump_Host.patch
Patch38: %{name}-nsswitch.conf-filtering.patch
Patch39: %{name}-calibrate-do-not-add-KDUMP_PHYS_LOAD-to-RAM.patch
Patch40: %{name}-bootloader-filter-out-KDUMPTOOL_FLAGS.patch
Patch41: %{name}-always-kexec_load-if-kexec_file_load-fails.patch
Patch42: %{name}-nokaslr.patch
Patch43: %{name}-no-crashkernel-in-Xen-PV-DomU.patch
Patch44: %{name}-always-copy-timezone.patch
Patch45: %{name}-use-bus-id-to-identify-qeth-devices.patch
Patch46: %{name}-pass-IPv6-address-prefix-separately.patch
Patch47: %{name}-pass-all-IP-routes-to-kdump-environment.patch
Patch48: %{name}-remove-IPv6-brackets-for-getaddrinfo.patch
Patch49: %{name}-skip-IPv4-if-no-address.patch
Patch50: %{name}-additional-mounts-in-dracut-module.patch
Patch51: %{name}-run-mkinitrd-if-fadump-is-active.patch
Patch52: %{name}-do-not-touch-dracut-vars-if-not-kdumprd.patch
Patch1: %{name}-fillupdir-fixes.patch
BuildRequires: asciidoc
BuildRequires: cmake
BuildRequires: gcc-c++
@ -130,11 +78,7 @@ BuildRequires: systemd
%else
PreReq: %insserv_prereq
%endif
%if 0%{?suse_version} > 1310
PreReq: dracut
%else
PreReq: mkinitrd
%endif
%if %{systemd_present}
%systemd_requires
%endif
@ -158,61 +102,9 @@ after a crash dump has occured.
%prep
%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
cp %{S:1} tests/data/
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch28 -p1
%if 0%{?suse_version} >= 1330
%patch29 -p1
%patch1 -p1
%endif
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
%patch34 -p1
%patch35 -p1
%patch36 -p1
%patch37 -p1
%patch38 -p1
%patch39 -p1
%patch40 -p1
%patch41 -p1
%patch42 -p1
%patch43 -p1
%patch44 -p1
%patch45 -p1
%patch46 -p1
%patch47 -p1
%patch48 -p1
%patch49 -p1
%patch50 -p1
%patch51 -p1
%patch52 -p1
%build
export CFLAGS="%{optflags}"
@ -238,9 +130,6 @@ mv %{buildroot}/%{_sysconfdir}/udev/rules.d/* %{buildroot}/%{_udevrulesdir}/
chmod -x %{buildroot}/lib/kdump/setup-kdump.functions
# empty directory
mkdir -p %{buildroot}/var/crash
%if 0%{?suse_version} > 1310
rm -r %{buildroot}/lib/mkinitrd
%endif
# symlink for init script
%if %{systemd_present}
@ -314,11 +203,6 @@ rm /var/log/dump >/dev/null 2>&1 || true
%{_mandir}/man8/kdumptool.8%{ext_man}
%{_mandir}/man8/mkdumprd.8%{ext_man}
%{_fillupdir}/sysconfig.kdump
%if 0%{?suse_version} <= 1310
/lib/mkinitrd/scripts/*-kdump.sh
/lib/mkinitrd/scripts/setup-kdumpfs.sh
/lib/mkinitrd/scripts/setup-mkdumprd.sh
%endif
%dir %{dracutlibdir}
%dir %{dracutlibdir}/modules.d
%{dracutlibdir}/modules.d/99kdump/