[PATCH v4] kdumpctl: Error out in case there are white spaces before an option name
by Bhupesh Sharma
Resolves: BZ1484945
https://bugzilla.redhat.com/show_bug.cgi?id=1484945
Currently the kdumpctl script doesn't handle
whitespaces (including TABs) which might be there before
an option name in the kdump.conf
This patch addresses this issue, by ensuring that the
kdumpctl errors out in case it finds any stray space(s)
or tab(s) before a option name.
Reported-by: Kenneth D'souza <kdsouza(a)redhat.com>
Signed-off-by: Bhupesh Sharma <bhsharma(a)redhat.com>
---
Changes since v3:
- Made the check simpler by using grep -E instead of awk
kdumpctl | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/kdumpctl b/kdumpctl
index b7a3105026eb..b56d824147b4 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -406,6 +406,13 @@ check_config()
return 1
}
+ # Check if we have any leading spaces (or tabs) before the
+ # variable name in the kdump conf file
+ if grep -E -q '^[[:blank:]]+[a-z]' $KDUMP_CONFIG_FILE; then
+ echo "No whitespaces are allowed before a kdump option name in $KDUMP_CONFIG_FILE"
+ return 1
+ fi
+
while read config_opt config_val; do
case "$config_opt" in
\#* | "")
--
2.7.4
6 years
[PATCH v3] kdumpctl: Error out in case there are white spaces before an option name
by Bhupesh Sharma
Resolves: BZ1484945
https://bugzilla.redhat.com/show_bug.cgi?id=1484945
Currently the kdumpctl script doesn't handle
whitespaces (including TABs) which might be there before
an option name in the kdump.conf
This patch addresses this issue, by ensuring that the
kdumpctl errors out in case it finds any stray space(s)
or tab(s) before a option name.
Reported-by: Kenneth D'souza <kdsouza(a)redhat.com>
Signed-off-by: Bhupesh Sharma <bhsharma(a)redhat.com>
---
kdumpctl | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/kdumpctl b/kdumpctl
index 7d06efe292aa..56975a3ba1dc 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -351,6 +351,8 @@ restore_default_initrd()
check_config()
{
local nr
+ TMP_FILE='/tmp/kdump.conf.tmp'
+ touch $TMP_FILE
nr=$(awk 'BEGIN{cnt=0} /^raw|^ssh[[:blank:]]|^nfs|^ext[234]|^xfs|^btrfs|^minix|^dracut_args .*\-\-mount/{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE)
[ $nr -gt 1 ] && {
@@ -364,6 +366,20 @@ check_config()
return 1
}
+ # Check if we have any leading spaces (or tabs) before the
+ # variable name in the kdump conf file. While doing so exclude any
+ # comments which appear to have leading spaces (or tabs)
+ awk 'BEGIN{cnt=0} {cnt=match($0, /^[[:blank:]]/); if(cnt!=0) print $0}' $KDUMP_CONFIG_FILE >> $TMP_FILE
+
+ nr=$(awk 'BEGIN{cnt_hash=0; cnt_blank=0} {cnt_hash=match($0, /#.*$/); if(cnt_hash!=0) next; else cnt_blank++} END{print cnt_blank}' $TMP_FILE)
+ [ $nr -gt 0 ] && {
+ echo "No whitespaces are allowed before a kdump option name. Please check $KDUMP_CONFIG_FILE"
+ rm -f $TMP_FILE
+ return 1
+ }
+
+ rm -f $TMP_FILE
+
while read config_opt config_val; do
case "$config_opt" in
\#* | "")
--
2.7.4
6 years
[PATCH v2] dracut-module-setup.sh: eliminate redundant kdump_get_mac_addr call
by Ziyue Yang
This commit eliminates a redundant kdump_get_mac_addr call in
kdump_setup_netdev.
Signed-off-by: Ziyue Yang <ziyang(a)redhat.com>
---
dracut-module-setup.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index ae13337..071c859 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -276,12 +276,12 @@ kdump_setup_znet() {
kdump_setup_netdev() {
local _netdev=$1 _srcaddr=$2
local _static _proto _ip_conf _ip_opts _ifname_opts
+ local _netmac=$(kdump_get_mac_addr $_netdev)
if [ "$(uname -m)" = "s390x" ]; then
kdump_setup_znet $_netdev
fi
- _netmac=$(kdump_get_mac_addr $_netdev)
_static=$(kdump_static_ip $_netdev $_srcaddr)
if [ -n "$_static" ]; then
_proto=none
@@ -310,7 +310,7 @@ kdump_setup_netdev() {
elif kdump_is_vlan "$_netdev"; then
kdump_setup_vlan "$_netdev"
else
- _ifname_opts=" ifname=$(kdump_setup_ifname $_netdev):$(kdump_get_mac_addr $_netdev)"
+ _ifname_opts=" ifname=$(kdump_setup_ifname $_netdev):$_netmac"
echo "$_ifname_opts" >> $_ip_conf
fi
--
2.9.3
6 years
[PATCH] dracut-module-setup.sh: eliminate redundant kdump_get_mac_addr call
by Ziyue Yang
This commit eliminates a redundant kdump_get_mac_addr call in
kdump_setup_netdev.
Signed-off-by: Ziyue Yang <ziyang(a)redhat.com>
---
dracut-module-setup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index ae13337..1830a91 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -310,7 +310,7 @@ kdump_setup_netdev() {
elif kdump_is_vlan "$_netdev"; then
kdump_setup_vlan "$_netdev"
else
- _ifname_opts=" ifname=$(kdump_setup_ifname $_netdev):$(kdump_get_mac_addr $_netdev)"
+ _ifname_opts=" ifname=$(kdump_setup_ifname $_netdev):$_netmac"
echo "$_ifname_opts" >> $_ip_conf
fi
--
2.9.3
6 years
[PATCH v9 0/3] support dump ssh via link local ipv6 address
by Ziyue Yang
When dumping to ssh via link local ipv6 address, the ssh
parameter in kdump.conf is supposed to have the form like:
ssh user@fe80::cc1:8bff:fe90:b95f%eth0
where "%eth0" is an existing network interface supporting ipv6.
However, there are 4 problems in enabling link local ipv6:
1) The get_remote_host function in kdump-lib.sh currently
doesn't remove the network interface in the ipv6 address,
causing the ip command in kdump_install_net function to fail,
leading to a "Bad kdump location" message.
2) The logic in kdump_install_net and kdump_setup_iscsi_device
will find the network interface to use by "ip route" command,
which might be different from what user specified in kdump.conf
in link local ipv6 cases.
3) The kdump_setup_ifname function in dracut-module-setup.sh
would add 'kdump-' prefix to network interfaces with name like
'eth*', causing ssh target specified in kdump.conf invalid
while dumping process.
4) ssh target with 'kdump-' prefixed interface name is not
in known_hosts while dumping, leading to ssh connection failure.
This patch series handles the problems above.
Ziyue Yang (3):
dracut-module-setup.sh: change route finding logic in link local ipv6
cases
dracut-module-setup.sh: add 'kdump-' prefix in kdump.conf for link
local ipv6
dracut-kdump.sh: cancel StrictHostKeyChecking for ssh in link local
ipv6
dracut-kdump.sh | 10 ++++++++-
dracut-module-setup.sh | 60 ++++++++++++++++++++++++++++++++++++++++++--------
kdump-lib.sh | 13 +++++++++++
3 files changed, 73 insertions(+), 10 deletions(-)
--
2.9.3
6 years
[PATCH v3 9/9] module-setup: remove software iscsi cmdline generated by dracut
by Xunlei Pang
After adding "--hostonly-cmdline", besides 99kdump, 95iscsi
also generates iscsi related cmdline. IOW, we have duplicate
software iscsi cmdlines.
95iscsi generated software iscsi cmdline doesn't work, so we
remove that of 95iscsi and use that of 99kdump which has been
well tested.
We can change to use 95iscsi when possible in the future.
Signed-off-by: Xunlei Pang <xlpang(a)redhat.com>
---
dracut-module-setup.sh | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index ae13337..b8a7038 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -555,6 +555,10 @@ kdump_setup_iscsi_device() {
return
fi
+ # Remove software iscsi cmdline generated by 99iscsi,
+ # and let kdump regenerate here.
+ rm -f ${initdir}/etc/cmdline.d/95iscsi.conf
+
tgt_name=$(kdump_iscsi_get_rec_val ${path} "node.name")
tgt_ipaddr=$(kdump_iscsi_get_rec_val ${path} "node.conn\[0\].address")
--
1.8.3.1
6 years
[PATCH v2 0/9] apply "--hostonly-cmdline" and "--no-hostonly-default-device"
by Xunlei Pang
Dracut has "--hostonly-cmdline" which can generate cmdlines(if any)
regarding the dump target, it's an existing way for us to use to
simplify the code. E.g. We can remove generate_lvm_cmdlines() if we
use "--hostonly-cmdline"(see PATCH 4).
But "--hostonly-cmdline" has other issues(e.g. BZ1451717), it adds
needless devices for kdump like root device. These issues can be
solved with the help of dracut "--no-hostonly-default-device", we
can have only one device being recognized (dump target) in most
cases under kdump.
This patch series applies dracut's "--hostonly-cmdline" together with
"--no-hostonly-default-device", and removes some old code accordingly.
Please "man dracut.cmdline" for "--hostonly-cmdline", "--no-hostonly-default-device"
details.
See "--no-hostonly-default-device" patches:
https://github.com/dracutdevs/dracut/pull/269
Also see the following former threads for some background:
https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.o...
Has passed tests about LUKS, iscsi, lvm, nfs, etc.
Xunlei Pang (9):
Revert "mkdumprd: omit dracut modules in case of network dumping"
Revert "mkdumprd: omit dracut modules in case of no dm target"
Revert "mkdumprd: omit crypt when there is no crypt kdump target"
Revert "kdumpctl: use generated rd.lvm.lv=X"
kdumpctl: move is_fadump_capable() to kdump-lib.sh
Change dump_to_rootfs to use "--mount" instead of "root=X"
mkdumprd: apply dracut "--hostonly-cmdline" and
"--no-hostonly-default-device"
kdumpctl: remove some cmdline inheritage from 1st kernel
module-setup: remove software iscsi cmdline generated by dracut
dracut-module-setup.sh | 5 +++++
kdump-lib.sh | 30 +++++++++----------------
kdumpctl | 61 ++++++++------------------------------------------
kexec-tools.spec | 2 +-
mkdumprd | 61 +++++++-------------------------------------------
5 files changed, 34 insertions(+), 125 deletions(-)
--
1.8.3.1
6 years
[PATCH v8 0/4] support dump ssh via link local ipv6 address
by Ziyue Yang
When dumping to ssh via link local ipv6 address, the ssh
parameter in kdump.conf is supposed to have the form like:
ssh user@fe80::cc1:8bff:fe90:b95f%eth0
where "%eth0" is an existing network interface supporting ipv6.
However, there are 4 problems in enabling link local ipv6:
1) The get_remote_host function in kdump-lib.sh currently
doesn't remove the network interface in the ipv6 address,
causing the ip command in kdump_install_net function to fail,
leading to a "Bad kdump location" message.
2) The logic in kdump_install_net will find the network
interface to use by "ip route" command, which might be
different from what user specified in kdump.conf in link
local ipv6 cases.
3) The kdump_setup_ifname function in dracut-module-setup.sh
would add 'kdump-' prefix to network interfaces with name like
'eth*', causing ssh target specified in kdump.conf invalid
while dumping process.
4) ssh target with 'kdump-' prefixed interface name is not
in known_hosts while dumping, leading to ssh connection failure.
This patch series handles the problems above.
Ziyue Yang (4):
dracut-module-setup.sh: change route finding logic in link local ipv6
cases
dracut-module-setup.sh: add 'kdump-' prefix in kdump.conf for link
local ipv6
dracut-kdump.sh: support 'kdump-' prefixed interfaces for link local
ipv6
kdump.conf: add documents for link local ipv6 in ssh
dracut-kdump.sh | 10 +++++++++-
dracut-module-setup.sh | 46 +++++++++++++++++++++++++++++++++++++++++-----
kdump-lib.sh | 13 +++++++++++++
kdump.conf | 5 ++++-
kdump.conf.5 | 7 ++++++-
5 files changed, 73 insertions(+), 8 deletions(-)
--
2.9.3
6 years
[PATCH V2] mkdumprd: fix patterns to modify mount options
by Dave Young
mkdumprd removes "noauto" mount option, but it also mistakenly removes
"noauto" within a string. For example ext4 has mount option noauto_da_alloc
mkdumprd will replace it with _da_alloc.
Use '\b' to match a whole word of "noauto" to fix it.
Also do same for s/ro/rw for same reason.
Signed-off-by: Dave Young <dyoung(a)redhat.com>
---
mkdumprd | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
--- kexec-tools.orig/mkdumprd
+++ kexec-tools/mkdumprd
@@ -101,8 +101,9 @@ to_mount() {
[ -z "$_options" ] && _options=$(findmnt -k -f -n -r -o OPTIONS $_dev)
# with 'noauto' in fstab nfs and non-root disk mount will fail in 2nd
# kernel, filter it out here.
- _options=$(echo $_options | sed 's/noauto//')
- _options=${_options/#ro/rw} #mount fs target as rw in 2nd kernel
+ _options=$(echo $_options | sed 's/\bnoauto\b//')
+ #mount fs target as rw in 2nd kernel
+ _options=$(echo $_options | sed 's/\bro\b/rw/')
_mntopts="$_target $_fstype $_options"
#for non-nfs _dev converting to use udev persistent name
6 years
[PATCH] mkdumprd: fix patterns to drop noauto mount option
by Dave Young
mkdumprd removes "noauto" mount option, but it also mistakenly removes
"noauto" within a string. For example ext4 has mount option noauto_da_alloc
mkdumprd will replace it with _da_alloc.
Use '\b' to match a whole word of "noauto" to fix it.
Signed-off-by: Dave Young <dyoung(a)redhat.com>
---
mkdumprd | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- kexec-tools.orig/mkdumprd
+++ kexec-tools/mkdumprd
@@ -101,7 +101,7 @@ to_mount() {
[ -z "$_options" ] && _options=$(findmnt -k -f -n -r -o OPTIONS $_dev)
# with 'noauto' in fstab nfs and non-root disk mount will fail in 2nd
# kernel, filter it out here.
- _options=$(echo $_options | sed 's/noauto//')
+ _options=$(echo $_options | sed 's/\bnoauto\b//')
_options=${_options/#ro/rw} #mount fs target as rw in 2nd kernel
_mntopts="$_target $_fstype $_options"
6 years