Compare commits
9 Commits
imports/c8
...
c8
Author | SHA1 | Date | |
---|---|---|---|
8e7df7898c | |||
afd6c69c89 | |||
32ae4b9ca1 | |||
|
b0cb23d8bd | ||
|
7f841f0070 | ||
|
f572fac7ad | ||
|
6b51ad8c27 | ||
|
2793b39ac3 | ||
|
0d79822752 |
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,3 +1,3 @@
|
||||
SOURCES/1.6.8.tar.gz
|
||||
SOURCES/1.7.2.tar.gz
|
||||
SOURCES/eppic_050615.tar.gz
|
||||
SOURCES/kexec-tools-2.0.20.tar.xz
|
||||
SOURCES/kexec-tools-2.0.26.tar.xz
|
||||
|
@ -1,3 +1,3 @@
|
||||
7af5b92c69df9f63b9f02ad07a76a2a2581d4660 SOURCES/1.6.8.tar.gz
|
||||
24bce02cd42cdbb960ada4d9e733355582e35784 SOURCES/1.7.2.tar.gz
|
||||
a096c8e0892b559f40b01916aae240652f75b68a SOURCES/eppic_050615.tar.gz
|
||||
5d9acd2e741d356d4a48fe4f2d63f66ba431051d SOURCES/kexec-tools-2.0.20.tar.xz
|
||||
27cea5d032ec1e93506b8110222420abf754df2d SOURCES/kexec-tools-2.0.26.tar.xz
|
||||
|
@ -2,17 +2,23 @@
|
||||
|
||||
COMMAND="$1"
|
||||
KERNEL_VERSION="$2"
|
||||
BOOT_DIR_ABS="$3"
|
||||
KDUMP_INITRD_DIR_ABS="$3"
|
||||
KERNEL_IMAGE="$4"
|
||||
|
||||
if ! [[ ${KERNEL_INSTALL_MACHINE_ID-x} ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ -d "$BOOT_DIR_ABS" ]]; then
|
||||
if [[ -d "$KDUMP_INITRD_DIR_ABS" ]]; then
|
||||
KDUMP_INITRD="initrdkdump"
|
||||
else
|
||||
BOOT_DIR_ABS="/boot"
|
||||
# If `KDUMP_BOOTDIR` is not writable, then the kdump
|
||||
# initrd must have been placed at `/var/lib/kdump`
|
||||
if [[ ! -w "/boot" ]]; then
|
||||
KDUMP_INITRD_DIR_ABS="/var/lib/kdump"
|
||||
else
|
||||
KDUMP_INITRD_DIR_ABS="/boot"
|
||||
fi
|
||||
KDUMP_INITRD="initramfs-${KERNEL_VERSION}kdump.img"
|
||||
fi
|
||||
|
||||
@ -23,7 +29,7 @@ case "$COMMAND" in
|
||||
# and managed by kdump service
|
||||
;;
|
||||
remove)
|
||||
rm -f -- "$BOOT_DIR_ABS/$KDUMP_INITRD"
|
||||
rm -f -- "$KDUMP_INITRD_DIR_ABS/$KDUMP_INITRD"
|
||||
ret=$?
|
||||
;;
|
||||
esac
|
||||
|
@ -1,15 +1,22 @@
|
||||
SUBSYSTEM=="cpu", ACTION=="online", GOTO="kdump_reload"
|
||||
SUBSYSTEM=="memory", ACTION=="online", GOTO="kdump_reload"
|
||||
SUBSYSTEM=="memory", ACTION=="offline", GOTO="kdump_reload"
|
||||
SUBSYSTEM=="cpu", ACTION=="online", GOTO="kdump_reload_cpu"
|
||||
SUBSYSTEM=="memory", ACTION=="online", GOTO="kdump_reload_mem"
|
||||
SUBSYSTEM=="memory", ACTION=="offline", GOTO="kdump_reload_mem"
|
||||
|
||||
GOTO="kdump_reload_end"
|
||||
|
||||
LABEL="kdump_reload"
|
||||
|
||||
# If kdump is not loaded, calling kdump-udev-throttle will end up
|
||||
# doing nothing, but systemd-run will always generate extra logs for
|
||||
# each call, so trigger the kdump-udev-throttler only if kdump
|
||||
# service is active to avoid unnecessary logs
|
||||
|
||||
LABEL="kdump_reload_mem"
|
||||
|
||||
RUN+="/bin/sh -c '/usr/bin/systemctl is-active kdump.service || exit 0; /usr/bin/systemd-run --quiet --no-block /usr/lib/udev/kdump-udev-throttler'"
|
||||
|
||||
GOTO="kdump_reload_end"
|
||||
|
||||
LABEL="kdump_reload_cpu"
|
||||
|
||||
RUN+="/bin/sh -c '/usr/bin/systemctl is-active kdump.service || exit 0; ! test -f /sys/kernel/fadump_enabled || cat /sys/kernel/fadump_enabled | grep 0 || exit 0; /usr/bin/systemd-run --quiet --no-block /usr/lib/udev/kdump-udev-throttler'"
|
||||
|
||||
LABEL="kdump_reload_end"
|
||||
|
@ -49,11 +49,6 @@ early_kdump_load()
|
||||
|
||||
EARLY_KEXEC_ARGS=$(prepare_kexec_args "${KEXEC_ARGS}")
|
||||
|
||||
if is_secure_boot_enforced; then
|
||||
dinfo "Secure Boot is enabled. Using kexec file based syscall."
|
||||
EARLY_KEXEC_ARGS="$EARLY_KEXEC_ARGS -s"
|
||||
fi
|
||||
|
||||
# Here, only output the messages, but do not save these messages
|
||||
# to a file because the target disk may not be mounted yet, the
|
||||
# earlykdump is too early.
|
||||
|
48
SOURCES/dracut-fadump-init-fadump.sh
Executable file
48
SOURCES/dracut-fadump-init-fadump.sh
Executable file
@ -0,0 +1,48 @@
|
||||
#!/bin/sh
|
||||
export PATH=/usr/bin:/usr/sbin
|
||||
export SYSTEMD_IN_INITRD=lenient
|
||||
|
||||
[ -e /proc/mounts ] ||
|
||||
(mkdir -p /proc && mount -t proc -o nosuid,noexec,nodev proc /proc)
|
||||
|
||||
grep -q '^sysfs /sys sysfs' /proc/mounts ||
|
||||
(mkdir -p /sys && mount -t sysfs -o nosuid,noexec,nodev sysfs /sys)
|
||||
|
||||
grep -q '^none / ' /proc/mounts || grep -q '^rootfs / ' /proc/mounts && ROOTFS_IS_RAMFS=1
|
||||
|
||||
if [ -f /proc/device-tree/rtas/ibm,kernel-dump ] || [ -f /proc/device-tree/ibm,opal/dump/mpipl-boot ]; then
|
||||
mkdir /newroot
|
||||
mount -t ramfs ramfs /newroot
|
||||
|
||||
if [ $ROOTFS_IS_RAMFS ]; then
|
||||
for FILE in $(ls -A /fadumproot/); do
|
||||
mv /fadumproot/$FILE /newroot/
|
||||
done
|
||||
exec switch_root /newroot /init
|
||||
else
|
||||
mkdir /newroot/sys /newroot/proc /newroot/dev /newroot/run /newroot/oldroot
|
||||
|
||||
grep -q '^devtmpfs /dev devtmpfs' /proc/mounts && mount --move /dev /newroot/dev
|
||||
grep -q '^tmpfs /run tmpfs' /proc/mounts && mount --move /run /newroot/run
|
||||
mount --move /sys /newroot/sys
|
||||
mount --move /proc /newroot/proc
|
||||
|
||||
cp --reflink=auto --sparse=auto --preserve=mode,timestamps,links -dfr /fadumproot/. /newroot/
|
||||
cd /newroot && pivot_root . oldroot
|
||||
|
||||
loop=1
|
||||
while [ $loop ]; do
|
||||
unset loop
|
||||
while read -r _ mp _; do
|
||||
case $mp in
|
||||
/oldroot/*) umount -d "$mp" && loop=1 ;;
|
||||
esac
|
||||
done </proc/mounts
|
||||
done
|
||||
umount -d -l oldroot
|
||||
|
||||
exec /init
|
||||
fi
|
||||
else
|
||||
exec /init.dracut
|
||||
fi
|
23
SOURCES/dracut-fadump-module-setup.sh
Normal file
23
SOURCES/dracut-fadump-module-setup.sh
Normal file
@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
check() {
|
||||
return 255
|
||||
}
|
||||
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
install() {
|
||||
mv -f "$initdir/init" "$initdir/init.dracut"
|
||||
inst_script "$moddir/init-fadump.sh" /init
|
||||
chmod a+x "$initdir/init"
|
||||
|
||||
# Install required binaries for the init script (init-fadump.sh)
|
||||
inst_multiple sh modprobe grep mkdir mount
|
||||
if dracut_module_included "squash"; then
|
||||
inst_multiple cp pivot_root umount
|
||||
else
|
||||
inst_multiple ls mv switch_root
|
||||
fi
|
||||
}
|
@ -136,7 +136,7 @@ dump_ssh()
|
||||
fi
|
||||
_exitcode=$?
|
||||
else
|
||||
$CORE_COLLECTOR /proc/vmcore | ssh $_opt $_host "dd bs=512 of=$_dir/vmcore-incomplete"
|
||||
$CORE_COLLECTOR /proc/vmcore | ssh $_opt $_host "umask 0077 && dd bs=512 of=$_dir/vmcore-incomplete"
|
||||
_exitcode=$?
|
||||
_vmcore="vmcore.flat"
|
||||
fi
|
||||
@ -218,7 +218,7 @@ save_vmcore_dmesg_ssh() {
|
||||
local _location=$4
|
||||
|
||||
dinfo "saving vmcore-dmesg.txt to $_location:$_path"
|
||||
$_dmesg_collector /proc/vmcore | ssh $_opts $_location "dd of=$_path/vmcore-dmesg-incomplete.txt"
|
||||
$_dmesg_collector /proc/vmcore | ssh $_opts $_location "umask 0077 && dd of=$_path/vmcore-dmesg-incomplete.txt"
|
||||
_exitcode=$?
|
||||
|
||||
if [ $_exitcode -eq 0 ]; then
|
||||
|
@ -1,5 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
_save_kdump_netifs() {
|
||||
local _name
|
||||
|
||||
if [[ -n $2 ]]; then
|
||||
_name=$2
|
||||
else
|
||||
_name=$1
|
||||
fi
|
||||
unique_netifs[$1]=$_name
|
||||
}
|
||||
|
||||
_get_kdump_netifs() {
|
||||
echo -n "${!unique_netifs[@]}"
|
||||
}
|
||||
|
||||
kdump_module_init() {
|
||||
if ! [[ -d "${initdir}/tmp" ]]; then
|
||||
mkdir -p "${initdir}/tmp"
|
||||
@ -27,17 +42,7 @@ depends() {
|
||||
[[ " $omit_dracutmodules " != *\ $1\ * ]] && _dep="$_dep $1"
|
||||
}
|
||||
|
||||
is_squash_available() {
|
||||
for kmodule in squashfs overlay loop; do
|
||||
if [ -z "$KDUMP_KERNELVER" ]; then
|
||||
modprobe --dry-run $kmodule &>/dev/null || return 1
|
||||
else
|
||||
modprobe -S $KDUMP_KERNELVER --dry-run $kmodule &>/dev/null || return 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
if is_squash_available && ! is_fadump_capable; then
|
||||
if is_squash_available; then
|
||||
add_opt_module squash
|
||||
else
|
||||
dwarning "Required modules to build a squashed kdump image is missing!"
|
||||
@ -52,6 +57,14 @@ depends() {
|
||||
_dep="$_dep ssh-client"
|
||||
fi
|
||||
|
||||
if is_lvm2_thinp_dump_target; then
|
||||
if grep -q lvmthinpool-monitor <<< $(dracut --list-modules); then
|
||||
add_opt_module lvmthinpool-monitor
|
||||
else
|
||||
dwarning "Required lvmthinpool-monitor modules is missing! Please upgrade dracut >= 057."
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$(uname -m)" = "s390x" ]; then
|
||||
_dep="$_dep znet"
|
||||
fi
|
||||
@ -95,6 +108,17 @@ source_ifcfg_file() {
|
||||
fi
|
||||
}
|
||||
|
||||
add_dns_netdev() {
|
||||
local _server _route
|
||||
|
||||
_server=$1
|
||||
_route=`/sbin/ip -o route get to $_server 2>&1`
|
||||
[ $? != 0 ] && echo "DNS server $_server unreachable"
|
||||
|
||||
_netdev=$(get_ip_route_field "$_route" "dev")
|
||||
_save_kdump_netifs "$_netdev" "$(kdump_setup_ifname $_netdev)"
|
||||
}
|
||||
|
||||
# $1: netdev name
|
||||
kdump_setup_dns() {
|
||||
local _nameserver _dns
|
||||
@ -102,8 +126,8 @@ kdump_setup_dns() {
|
||||
|
||||
source_ifcfg_file $1
|
||||
|
||||
[ -n "$DNS1" ] && echo "nameserver=$DNS1" > "$_dnsfile"
|
||||
[ -n "$DNS2" ] && echo "nameserver=$DNS2" >> "$_dnsfile"
|
||||
[ -n "$DNS1" ] && echo "nameserver=$DNS1" > "$_dnsfile" && add_dns_netdev "$DNS1"
|
||||
[ -n "$DNS2" ] && echo "nameserver=$DNS2" >> "$_dnsfile" && add_dns_netdev "$DNS2"
|
||||
|
||||
while read content;
|
||||
do
|
||||
@ -115,6 +139,7 @@ kdump_setup_dns() {
|
||||
|
||||
if [ ! -f $_dnsfile ] || [ ! $(cat $_dnsfile | grep -q $_dns) ]; then
|
||||
echo "nameserver=$_dns" >> "$_dnsfile"
|
||||
add_dns_netdev "$_dns"
|
||||
fi
|
||||
done < "/etc/resolv.conf"
|
||||
}
|
||||
@ -233,7 +258,7 @@ cal_netmask_by_prefix() {
|
||||
#$2: srcaddr
|
||||
#if it use static ip echo it, or echo null
|
||||
kdump_static_ip() {
|
||||
local _netdev="$1" _srcaddr="$2" _ipv6_flag
|
||||
local _netdev="$1" _srcaddr="$2" kdumpnic="$3" _ipv6_flag
|
||||
local _netmask _gateway _ipaddr _target _nexthop _prefix
|
||||
|
||||
_ipaddr=$(ip addr show dev $_netdev permanent | awk "/ $_srcaddr\/.* /{print \$2}")
|
||||
@ -270,7 +295,7 @@ kdump_static_ip() {
|
||||
_target="[$_target]"
|
||||
_nexthop="[$_nexthop]"
|
||||
fi
|
||||
echo "rd.route=$_target:$_nexthop:$_netdev"
|
||||
echo "rd.route=$_target:$_nexthop:$kdumpnic"
|
||||
done >> ${initdir}/etc/cmdline.d/45route-static.conf
|
||||
}
|
||||
|
||||
@ -301,7 +326,7 @@ kdump_setup_ifname() {
|
||||
# fadump to kdump. Skip prefixing 'kdump-' in this case as adding
|
||||
# another prefix may truncate the ifname. Since an ifname with
|
||||
# 'kdump-' is already persistent, this should be fine.
|
||||
if [[ $1 =~ eth* ]] && [[ ! $1 =~ ^kdump-* ]]; then
|
||||
if [[ $1 =~ ^eth.* ]] && [[ ! $1 =~ ^kdump-* ]]; then
|
||||
_ifname="kdump-$1"
|
||||
else
|
||||
_ifname="$1"
|
||||
@ -310,11 +335,80 @@ kdump_setup_ifname() {
|
||||
echo "$_ifname"
|
||||
}
|
||||
|
||||
kdump_install_nm_netif_allowlist() {
|
||||
local _netif _except_netif _netif_allowlist _netif_allowlist_nm_conf
|
||||
|
||||
for _netif in $1; do
|
||||
_per_mac=$(kdump_get_perm_addr "$_netif")
|
||||
if [[ "$_per_mac" != 'not set' ]]; then
|
||||
_except_netif="mac:$_per_mac"
|
||||
else
|
||||
_except_netif="interface-name:${unique_netifs[${_netif}]}"
|
||||
fi
|
||||
_netif_allowlist="${_netif_allowlist}except:${_except_netif};"
|
||||
done
|
||||
|
||||
_netif_allowlist_nm_conf=${initdir}/tmp/netif_allowlist_nm_conf
|
||||
cat << EOF > "$_netif_allowlist_nm_conf"
|
||||
[device-others]
|
||||
match-device=${_netif_allowlist}
|
||||
managed=false
|
||||
EOF
|
||||
|
||||
inst "$_netif_allowlist_nm_conf" "/etc/NetworkManager/conf.d/10-kdump-netif_allowlist.conf"
|
||||
rm -f "$_netif_allowlist_nm_conf"
|
||||
}
|
||||
|
||||
_get_nic_driver() {
|
||||
ethtool -i "$1" | sed -n -E "s/driver: (.*)/\1/p"
|
||||
}
|
||||
|
||||
_get_hpyerv_physical_driver() {
|
||||
local _physical_nic
|
||||
|
||||
_physical_nic=$(find /sys/class/net/"$1"/ -name 'lower_*' | sed -En "s/\/.*lower_(.*)/\1/p")
|
||||
[[ -n $_physical_nic ]] || return
|
||||
_get_nic_driver "$_physical_nic"
|
||||
}
|
||||
|
||||
kdump_install_nic_driver() {
|
||||
local _netif _driver _drivers
|
||||
|
||||
_drivers=()
|
||||
|
||||
for _netif in $1; do
|
||||
[[ $_netif == lo ]] && continue
|
||||
_driver=$(_get_nic_driver "$_netif")
|
||||
if [[ -z $_driver ]]; then
|
||||
derror "Failed to get the driver of $_netif"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $_driver == "802.1Q VLAN Support" ]]; then
|
||||
# ethtool somehow doesn't return the driver name for a VLAN NIC
|
||||
_driver=8021q
|
||||
elif [[ $_driver == "team" ]]; then
|
||||
# install the team mode drivers like team_mode_roundrobin.ko as well
|
||||
_driver='=drivers/net/team'
|
||||
elif [[ $_driver == "hv_netvsc" ]]; then
|
||||
# A Hyper-V VM may have accelerated networking
|
||||
# https://learn.microsoft.com/en-us/azure/virtual-network/accelerated-networking-overview
|
||||
# Install the driver of physical NIC as well
|
||||
_drivers+=("$(_get_hpyerv_physical_driver "$_netif")")
|
||||
fi
|
||||
|
||||
_drivers+=("$_driver")
|
||||
done
|
||||
|
||||
[[ -n ${_drivers[*]} ]] || return
|
||||
instmods "${_drivers[@]}"
|
||||
}
|
||||
|
||||
kdump_setup_bridge() {
|
||||
local _netdev=$1
|
||||
local _brif _dev _mac _kdumpdev
|
||||
for _dev in `ls /sys/class/net/$_netdev/brif/`; do
|
||||
_kdumpdev=$_dev
|
||||
_kdumpdev=""
|
||||
if kdump_is_bond "$_dev"; then
|
||||
kdump_setup_bond "$_dev"
|
||||
elif kdump_is_team "$_dev"; then
|
||||
@ -326,6 +420,8 @@ kdump_setup_bridge() {
|
||||
_kdumpdev=$(kdump_setup_ifname $_dev)
|
||||
echo -n " ifname=$_kdumpdev:$_mac" >> ${initdir}/etc/cmdline.d/41bridge.conf
|
||||
fi
|
||||
_save_kdump_netifs "$_dev" "$_kdumpdev"
|
||||
[[ -z $_kdumpdev ]] && _kdumpdev=$_dev
|
||||
_brif+="$_kdumpdev,"
|
||||
done
|
||||
echo " bridge=$_netdev:$(echo $_brif | sed -e 's/,$//')" >> ${initdir}/etc/cmdline.d/41bridge.conf
|
||||
@ -337,6 +433,7 @@ kdump_setup_bond() {
|
||||
for _dev in `cat /sys/class/net/$_netdev/bonding/slaves`; do
|
||||
_mac=$(kdump_get_perm_addr $_dev)
|
||||
_kdumpdev=$(kdump_setup_ifname $_dev)
|
||||
_save_kdump_netifs "$_dev" "$_kdumpdev"
|
||||
echo -n " ifname=$_kdumpdev:$_mac" >> ${initdir}/etc/cmdline.d/42bond.conf
|
||||
_slaves+="$_kdumpdev,"
|
||||
done
|
||||
@ -355,6 +452,7 @@ kdump_setup_team() {
|
||||
for _dev in `teamnl $_netdev ports | awk -F':' '{print $2}'`; do
|
||||
_mac=$(kdump_get_perm_addr $_dev)
|
||||
_kdumpdev=$(kdump_setup_ifname $_dev)
|
||||
_save_kdump_netifs "$_dev" "$_kdumpdev"
|
||||
echo -n " ifname=$_kdumpdev:$_mac" >> ${initdir}/etc/cmdline.d/44team.conf
|
||||
_slaves+="$_kdumpdev,"
|
||||
done
|
||||
@ -389,6 +487,38 @@ kdump_setup_vlan() {
|
||||
_kdumpdev="$(kdump_setup_ifname $_phydev)"
|
||||
echo " vlan=$(kdump_setup_ifname $_netdev):$_kdumpdev ifname=$_kdumpdev:$_netmac" > ${initdir}/etc/cmdline.d/43vlan.conf
|
||||
fi
|
||||
_save_kdump_netifs "$_phydev" "$_kdumpdev"
|
||||
}
|
||||
|
||||
# find online znet device
|
||||
# return ifname (_netdev)
|
||||
# code reaped from the list_configured function of
|
||||
# https://github.com/hreinecke/s390-tools/blob/master/zconf/znetconf
|
||||
find_online_znet_device() {
|
||||
local CCWGROUPBUS_DEVICEDIR="/sys/bus/ccwgroup/devices"
|
||||
local NETWORK_DEVICES d ifname ONLINE
|
||||
|
||||
[ ! -d "$CCWGROUPBUS_DEVICEDIR" ] && return
|
||||
NETWORK_DEVICES=$(find $CCWGROUPBUS_DEVICEDIR)
|
||||
for d in $NETWORK_DEVICES
|
||||
do
|
||||
[ ! -f "$d/online" ] && continue
|
||||
read ONLINE < $d/online
|
||||
if [ $ONLINE -ne 1 ]; then
|
||||
continue
|
||||
fi
|
||||
# determine interface name, if there (only for qeth and if
|
||||
# device is online)
|
||||
if [ -f $d/if_name ]
|
||||
then
|
||||
read ifname < $d/if_name
|
||||
elif [ -d $d/net ]
|
||||
then
|
||||
ifname=$(ls $d/net/)
|
||||
fi
|
||||
[ -n "$ifname" ] && break
|
||||
done
|
||||
echo -n "$ifname"
|
||||
}
|
||||
|
||||
# setup s390 znet cmdline
|
||||
@ -399,23 +529,46 @@ kdump_setup_znet() {
|
||||
|
||||
source_ifcfg_file $_netdev
|
||||
|
||||
[[ -z "$NETTYPE" ]] && return
|
||||
[[ -z "$SUBCHANNELS" ]] && return
|
||||
|
||||
for i in $OPTIONS; do
|
||||
_options=${_options},$i
|
||||
done
|
||||
echo rd.znet=${NETTYPE},${SUBCHANNELS}${_options} rd.znet_ifname=$_netdev:${SUBCHANNELS} > ${initdir}/etc/cmdline.d/30znet.conf
|
||||
echo rd.znet=${NETTYPE},${SUBCHANNELS}${_options} rd.znet_ifname=$(kdump_setup_ifname $_netdev):${SUBCHANNELS} > ${initdir}/etc/cmdline.d/30znet.conf
|
||||
}
|
||||
|
||||
_get_nic_driver() {
|
||||
ethtool -i "$1" | sed -n -E "s/driver: (.*)/\1/p"
|
||||
}
|
||||
|
||||
_rename_hypver_netdev() {
|
||||
local _udev_rule_dir
|
||||
|
||||
_udev_rule_dir=${initdir}/etc/udev/rules.d
|
||||
mkdir -p "$_udev_rule_dir"
|
||||
printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="hv_netvsc", ATTR{address}=="%s", ATTR{type}=="1", NAME="%s"\n' "$2" "$1" > "${_udev_rule_dir}/80-hv_netvsc-ifname.rules"
|
||||
}
|
||||
|
||||
# Setup dracut to bringup a given network interface
|
||||
kdump_setup_netdev() {
|
||||
local _netdev=$1 _srcaddr=$2
|
||||
local _static _proto _ip_conf _ip_opts _ifname_opts
|
||||
local _static _proto _ip_conf _ip_opts _ifname_opts kdumpnic
|
||||
local _netmac=$(kdump_get_mac_addr $_netdev)
|
||||
local _znet_netdev
|
||||
|
||||
if [ "$(uname -m)" = "s390x" ]; then
|
||||
kdump_setup_znet $_netdev
|
||||
kdumpnic=$(kdump_setup_ifname $_netdev)
|
||||
|
||||
_znet_netdev=$(find_online_znet_device)
|
||||
if [[ -n "$_znet_netdev" ]]; then
|
||||
$(kdump_setup_znet "$_znet_netdev")
|
||||
if [[ $? != 0 ]]; then
|
||||
derror "Failed to set up znet"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
_static=$(kdump_static_ip $_netdev $_srcaddr)
|
||||
_static=$(kdump_static_ip $_netdev $_srcaddr $kdumpnic)
|
||||
if [ -n "$_static" ]; then
|
||||
_proto=none
|
||||
elif is_ipv6_address $_srcaddr; then
|
||||
@ -425,7 +578,7 @@ kdump_setup_netdev() {
|
||||
fi
|
||||
|
||||
_ip_conf="${initdir}/etc/cmdline.d/40ip.conf"
|
||||
_ip_opts=" ip=${_static}$(kdump_setup_ifname $_netdev):${_proto}"
|
||||
_ip_opts=" ip=${_static}$kdumpnic:${_proto}"
|
||||
|
||||
# dracut doesn't allow duplicated configuration for same NIC, even they're exactly the same.
|
||||
# so we have to avoid adding duplicates
|
||||
@ -445,9 +598,14 @@ kdump_setup_netdev() {
|
||||
elif kdump_is_vlan "$_netdev"; then
|
||||
kdump_setup_vlan "$_netdev"
|
||||
else
|
||||
_ifname_opts=" ifname=$(kdump_setup_ifname $_netdev):$_netmac"
|
||||
echo "$_ifname_opts" >> $_ip_conf
|
||||
if [[ $(_get_nic_driver "$1") != hv_netvsc ]]; then
|
||||
_ifname_opts=" ifname=$kdumpnic:$_netmac"
|
||||
echo "$_ifname_opts" >> $_ip_conf
|
||||
else
|
||||
_rename_hypver_netdev "$kdumpnic" "$_netmac"
|
||||
fi
|
||||
fi
|
||||
_save_kdump_netifs "$_netdev" "$_kdumpdev"
|
||||
|
||||
kdump_setup_dns "$_netdev"
|
||||
|
||||
@ -736,7 +894,7 @@ kdump_check_iscsi_targets () {
|
||||
# If our prerequisites are not met, fail anyways.
|
||||
type -P iscsistart >/dev/null || return 1
|
||||
|
||||
kdump_check_setup_iscsi() (
|
||||
kdump_check_setup_iscsi() {
|
||||
local _dev
|
||||
_dev=$1
|
||||
|
||||
@ -746,7 +904,7 @@ kdump_check_iscsi_targets () {
|
||||
cd ..
|
||||
done
|
||||
[[ -d iscsi_session ]] && kdump_setup_iscsi_device "$PWD"
|
||||
)
|
||||
}
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for_each_host_dev_and_slaves_all kdump_check_setup_iscsi
|
||||
@ -912,7 +1070,8 @@ kdump_install_systemd_conf() {
|
||||
}
|
||||
|
||||
install() {
|
||||
local arch
|
||||
declare -A unique_netifs
|
||||
local arch _netifs
|
||||
|
||||
kdump_module_init
|
||||
kdump_install_conf
|
||||
@ -944,6 +1103,7 @@ install() {
|
||||
inst "/sbin/vmcore-dmesg" "/sbin/vmcore-dmesg"
|
||||
inst "/usr/bin/printf" "/sbin/printf"
|
||||
inst "/usr/bin/logger" "/sbin/logger"
|
||||
inst "/usr/bin/chmod" "/sbin/chmod"
|
||||
inst "/lib/kdump/kdump-lib.sh" "/lib/kdump-lib.sh"
|
||||
inst "/lib/kdump/kdump-lib-initramfs.sh" "/lib/kdump-lib-initramfs.sh"
|
||||
inst "/lib/kdump/kdump-logger.sh" "/lib/kdump-logger.sh"
|
||||
@ -963,6 +1123,12 @@ install() {
|
||||
# at some point of time.
|
||||
kdump_check_iscsi_targets
|
||||
|
||||
_netifs=$(_get_kdump_netifs)
|
||||
if [[ -n "$_netifs" ]]; then
|
||||
kdump_install_nm_netif_allowlist "$_netifs"
|
||||
kdump_install_nic_driver "$_netifs"
|
||||
fi
|
||||
|
||||
kdump_install_systemd_conf
|
||||
|
||||
# For the lvm type target under kdump, in /etc/lvm/lvm.conf we can
|
||||
@ -974,8 +1140,15 @@ install() {
|
||||
's/\(^[[:space:]]*reserved_memory[[:space:]]*=\)[[:space:]]*[[:digit:]]*/\1 1024/' \
|
||||
${initdir}/etc/lvm/lvm.conf &>/dev/null
|
||||
|
||||
# Skip initrd-cleanup.service and initrd-parse-etc.service becasue we don't
|
||||
# need to switch root. Instead of removing them, we use ConditionPathExists
|
||||
# to check if /proc/vmcore exists to determine if we are in kdump.
|
||||
sed -i '/\[Unit\]/a ConditionPathExists=!\/proc\/vmcore' \
|
||||
"${initdir}/${systemdsystemunitdir}/initrd-cleanup.service" &> /dev/null
|
||||
|
||||
sed -i '/\[Unit\]/a ConditionPathExists=!\/proc\/vmcore' \
|
||||
"${initdir}/${systemdsystemunitdir}/initrd-parse-etc.service" &> /dev/null
|
||||
|
||||
# Save more memory by dropping switch root capability
|
||||
if ! is_fadump_capable; then
|
||||
dracut_no_switch_root
|
||||
fi
|
||||
dracut_no_switch_root
|
||||
}
|
||||
|
@ -224,12 +224,16 @@ Things to remember:
|
||||
dracut_args --add "network"
|
||||
|
||||
4) If FADump is configured to capture vmcore to a remote dump target using SSH
|
||||
or NFS protocol, the network interface is renamed to kdump-<interface-name>
|
||||
if <interface-name> is generic, for example, *eth#, or net#. This problem
|
||||
occurs because the vmcore capture scripts in the initial RAM disk (initrd)
|
||||
add the kdump- prefix to the network interface name to secure persistent
|
||||
naming. As the same initrd is used for production kernel boot, the interface
|
||||
name is changed for the production kernel too.
|
||||
or NFS protocol, the corresponding network interface '<interface-name>' is
|
||||
renamed to 'kdump-<interface-name>', if it is generic (like *eth# or net#).
|
||||
It happens because vmcore capture scripts in the initial RAM disk (initrd)
|
||||
add the 'kdump-' prefix to the network interface name to secure persistent
|
||||
naming. And as capture kernel and production kernel use the same initrd in
|
||||
case of FADump, the interface name is changed for the production kernel too.
|
||||
This is likely to impact network configuration setup for production kernel.
|
||||
So, it is recommended to use a non-generic name for a network interface,
|
||||
before setting up FADump to capture vmcore to a remote dump target based on
|
||||
that network interface, to avoid running into network configuration issues.
|
||||
|
||||
Dump Triggering methods:
|
||||
|
||||
|
38
SOURCES/kdump.conf → SOURCES/gen-kdump-conf.sh
Normal file → Executable file
38
SOURCES/kdump.conf → SOURCES/gen-kdump-conf.sh
Normal file → Executable file
@ -1,3 +1,12 @@
|
||||
#!/bin/bash
|
||||
# $1: target arch
|
||||
|
||||
|
||||
SED_EXP=""
|
||||
|
||||
generate()
|
||||
{
|
||||
sed "$SED_EXP" << EOF
|
||||
# This file contains a series of commands to perform (in order) in the kdump
|
||||
# kernel after a kernel crash in the crash kernel(1st kernel) has happened.
|
||||
#
|
||||
@ -183,3 +192,32 @@ core_collector makedumpfile -l --message-level 7 -d 31
|
||||
#dracut_args --omit-drivers "cfg80211 snd" --add-drivers "ext2 ext3"
|
||||
#fence_kdump_args -p 7410 -f auto -c 0 -i 10
|
||||
#fence_kdump_nodes node1 node2
|
||||
EOF
|
||||
}
|
||||
|
||||
update_param()
|
||||
{
|
||||
SED_EXP="${SED_EXP}s/^$1.*$/$1 $2/;"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
aarch64)
|
||||
;;
|
||||
i386)
|
||||
;;
|
||||
ppc64)
|
||||
;;
|
||||
ppc64le)
|
||||
;;
|
||||
s390x)
|
||||
update_param core_collector \
|
||||
"makedumpfile -c --message-level 7 -d 31"
|
||||
;;
|
||||
x86_64)
|
||||
;;
|
||||
*)
|
||||
echo "Warning: Unknown architecture '$1', using default kdump.conf template."
|
||||
;;
|
||||
esac
|
||||
|
||||
generate
|
@ -111,6 +111,7 @@ save_log()
|
||||
if command -v journalctl > /dev/null; then
|
||||
journalctl -ab >> $KDUMP_LOG_FILE
|
||||
fi
|
||||
chmod 600 $KDUMP_LOG_FILE
|
||||
}
|
||||
|
||||
# dump_fs <mount point>
|
||||
@ -144,9 +145,15 @@ dump_fs()
|
||||
$CORE_COLLECTOR /proc/vmcore $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/vmcore-incomplete
|
||||
_exitcode=$?
|
||||
if [ $_exitcode -eq 0 ]; then
|
||||
mv $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/vmcore-incomplete $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/vmcore
|
||||
sync
|
||||
dinfo "saving vmcore complete"
|
||||
sync -f "$_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/vmcore-incomplete"
|
||||
_sync_exitcode=$?
|
||||
if [ $_sync_exitcode -eq 0 ]; then
|
||||
mv "$_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/vmcore-incomplete" "$_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/vmcore"
|
||||
dinfo "saving vmcore complete"
|
||||
else
|
||||
derror "sync vmcore failed, _exitcode:$_sync_exitcode"
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
derror "saving vmcore failed, _exitcode:$_exitcode"
|
||||
fi
|
||||
@ -171,6 +178,7 @@ save_vmcore_dmesg_fs() {
|
||||
_exitcode=$?
|
||||
if [ $_exitcode -eq 0 ]; then
|
||||
mv ${_path}/vmcore-dmesg-incomplete.txt ${_path}/vmcore-dmesg.txt
|
||||
chmod 600 ${_path}/vmcore-dmesg.txt
|
||||
|
||||
# Make sure file is on disk. There have been instances where later
|
||||
# saving vmcore failed and system rebooted without sync and there
|
||||
|
@ -7,6 +7,7 @@ DEFAULT_PATH="/var/crash/"
|
||||
FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump"
|
||||
FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send"
|
||||
FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled"
|
||||
LVM_CONF="/etc/lvm/lvm.conf"
|
||||
|
||||
is_fadump_capable()
|
||||
{
|
||||
@ -19,6 +20,16 @@ is_fadump_capable()
|
||||
return 1
|
||||
}
|
||||
|
||||
is_squash_available() {
|
||||
for kmodule in squashfs overlay loop; do
|
||||
if [ -z "$KDUMP_KERNELVER" ]; then
|
||||
modprobe --dry-run $kmodule &>/dev/null || return 1
|
||||
else
|
||||
modprobe -S $KDUMP_KERNELVER --dry-run $kmodule &>/dev/null || return 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
perror_exit() {
|
||||
derror "$@"
|
||||
exit 1
|
||||
@ -52,6 +63,15 @@ is_fs_dump_target()
|
||||
egrep -q "^ext[234]|^xfs|^btrfs|^minix" /etc/kdump.conf
|
||||
}
|
||||
|
||||
is_lvm2_thinp_device()
|
||||
{
|
||||
_device_path=$1
|
||||
_lvm2_thin_device=$(lvm lvs -S 'lv_layout=sparse && lv_layout=thin' \
|
||||
--nosuffix --noheadings -o vg_name,lv_name "$_device_path" 2> /dev/null)
|
||||
|
||||
[ -n "$_lvm2_thin_device" ]
|
||||
}
|
||||
|
||||
strip_comments()
|
||||
{
|
||||
echo $@ | sed -e 's/\(.*\)#.*/\1/'
|
||||
@ -151,6 +171,12 @@ is_dump_to_rootfs()
|
||||
grep -E "^(failure_action|default)[[:space:]]dump_to_rootfs" /etc/kdump.conf >/dev/null
|
||||
}
|
||||
|
||||
is_lvm2_thinp_dump_target()
|
||||
{
|
||||
_target=$(get_block_dump_target)
|
||||
[ -n "$_target" ] && is_lvm2_thinp_device "$_target"
|
||||
}
|
||||
|
||||
get_failure_action_target()
|
||||
{
|
||||
local _target
|
||||
@ -305,9 +331,9 @@ kdump_get_persistent_dev() {
|
||||
echo $(get_persistent_dev "$dev")
|
||||
}
|
||||
|
||||
is_atomic()
|
||||
is_ostree()
|
||||
{
|
||||
grep -q "ostree" /proc/cmdline
|
||||
test -f /run/ostree-booted
|
||||
}
|
||||
|
||||
# fixme, try the best to decide whether the ipv6 addr is allocated by slaac or dhcp6
|
||||
@ -322,11 +348,6 @@ is_ipv6_auto()
|
||||
fi
|
||||
}
|
||||
|
||||
is_atomic()
|
||||
{
|
||||
grep -q "ostree" /proc/cmdline
|
||||
}
|
||||
|
||||
is_ipv6_address()
|
||||
{
|
||||
echo $1 | grep -q ":"
|
||||
@ -508,11 +529,24 @@ get_dracut_args_target()
|
||||
echo $1 | grep "\-\-mount" | sed "s/.*--mount .\(.*\)/\1/" | cut -d' ' -f1
|
||||
}
|
||||
|
||||
get_reserved_mem_size()
|
||||
{
|
||||
local reserved_mem_size=0
|
||||
|
||||
if is_fadump_capable; then
|
||||
reserved_mem_size=$(< /sys/kernel/fadump/mem_reserved)
|
||||
else
|
||||
reserved_mem_size=$(< /sys/kernel/kexec_crash_size)
|
||||
fi
|
||||
|
||||
echo "$reserved_mem_size"
|
||||
}
|
||||
|
||||
check_crash_mem_reserved()
|
||||
{
|
||||
local mem_reserved
|
||||
|
||||
mem_reserved=$(cat /sys/kernel/kexec_crash_size)
|
||||
mem_reserved=$(get_reserved_mem_size)
|
||||
if [ $mem_reserved -eq 0 ]; then
|
||||
derror "No memory reserved for crash kernel"
|
||||
return 1
|
||||
@ -679,9 +713,51 @@ prepare_kexec_args()
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# For secureboot enabled machines, use new kexec file based syscall.
|
||||
# Old syscall will always fail as it does not have capability to do
|
||||
# kernel signature verification.
|
||||
if is_secure_boot_enforced; then
|
||||
dinfo "Secure Boot is enabled. Using kexec file based syscall."
|
||||
kexec_args="$kexec_args -s"
|
||||
fi
|
||||
|
||||
echo $kexec_args
|
||||
}
|
||||
|
||||
# prepare_kdump_kernel <kdump_kernelver>
|
||||
# This function return kdump_kernel given a kernel version.
|
||||
prepare_kdump_kernel()
|
||||
{
|
||||
local kdump_kernelver=$1
|
||||
local dir img boot_dirlist boot_imglist kdump_kernel machine_id
|
||||
read -r machine_id < /etc/machine-id
|
||||
|
||||
boot_dirlist=${KDUMP_BOOTDIR:-"/boot /boot/efi /efi /"}
|
||||
boot_imglist="$KDUMP_IMG-$kdump_kernelver$KDUMP_IMG_EXT $machine_id/$kdump_kernelver/$KDUMP_IMG"
|
||||
|
||||
# The kernel of OSTree based systems is not in the standard locations.
|
||||
if is_ostree; then
|
||||
boot_dirlist="$(echo /boot/ostree/*) $boot_dirlist"
|
||||
fi
|
||||
|
||||
# Use BOOT_IMAGE as reference if possible, strip the GRUB root device prefix in (hd0,gpt1) format
|
||||
boot_img="$(grep -P -o '^BOOT_IMAGE=(\S+)' /proc/cmdline | sed "s/^BOOT_IMAGE=\((\S*)\)\?\(\S*\)/\2/")"
|
||||
if [[ "$boot_img" == *"$kdump_kernelver" ]]; then
|
||||
boot_imglist="$boot_img $boot_imglist"
|
||||
fi
|
||||
|
||||
for dir in $boot_dirlist; do
|
||||
for img in $boot_imglist; do
|
||||
if [[ -f "$dir/$img" ]]; then
|
||||
kdump_kernel=$(echo "$dir/$img" | tr -s '/')
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
echo "$kdump_kernel"
|
||||
}
|
||||
|
||||
#
|
||||
# Detect initrd and kernel location, results are stored in global enviromental variables:
|
||||
# KDUMP_BOOTDIR, KDUMP_KERNELVER, KDUMP_KERNEL, DEFAULT_INITRD, and KDUMP_INITRD
|
||||
@ -691,58 +767,77 @@ prepare_kexec_args()
|
||||
#
|
||||
prepare_kdump_bootinfo()
|
||||
{
|
||||
local boot_imglist boot_dirlist boot_initrdlist curr_kver="$(uname -r)"
|
||||
local machine_id
|
||||
local boot_initrdlist nondebug_kernelver debug_kernelver
|
||||
local default_initrd_base var_target_initrd_dir
|
||||
|
||||
if [ -z "$KDUMP_KERNELVER"]; then
|
||||
KDUMP_KERNELVER="$(uname -r)"
|
||||
if [[ -z $KDUMP_KERNELVER ]]; then
|
||||
KDUMP_KERNELVER=$(uname -r)
|
||||
|
||||
# Fadump uses the regular bootloader, unlike kdump. So, use the same version
|
||||
# for default kernel and capture kernel unless specified explicitly with
|
||||
# KDUMP_KERNELVER option.
|
||||
if ! is_fadump_capable; then
|
||||
nondebug_kernelver=$(sed -n -e 's/\(.*\)+debug$/\1/p' <<< "$KDUMP_KERNELVER")
|
||||
fi
|
||||
fi
|
||||
|
||||
read machine_id < /etc/machine-id
|
||||
boot_dirlist=${KDUMP_BOOTDIR:-"/boot /boot/efi /efi /"}
|
||||
boot_imglist="$KDUMP_IMG-$KDUMP_KERNELVER$KDUMP_IMG_EXT $machine_id/$KDUMP_KERNELVER/$KDUMP_IMG"
|
||||
|
||||
# Use BOOT_IMAGE as reference if possible, strip the GRUB root device prefix in (hd0,gpt1) format
|
||||
local boot_img="$(cat /proc/cmdline | sed "s/^BOOT_IMAGE=\((\S*)\)\?\(\S*\) .*/\2/")"
|
||||
if [ -n "$boot_img" ]; then
|
||||
boot_imglist="$boot_img $boot_imglist"
|
||||
# Use nondebug kernel if possible, because debug kernel will consume more memory and may oom.
|
||||
if [[ -n $nondebug_kernelver ]]; then
|
||||
dinfo "Trying to use $nondebug_kernelver."
|
||||
debug_kernelver=$KDUMP_KERNELVER
|
||||
KDUMP_KERNELVER=$nondebug_kernelver
|
||||
fi
|
||||
|
||||
for dir in $boot_dirlist; do
|
||||
for img in $boot_imglist; do
|
||||
if [ -f "$dir/$img" ]; then
|
||||
KDUMP_KERNEL=$(echo $dir/$img | tr -s '/')
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
KDUMP_KERNEL=$(prepare_kdump_kernel "$KDUMP_KERNELVER")
|
||||
|
||||
if ! [ -e "$KDUMP_KERNEL" ]; then
|
||||
if ! [[ -e $KDUMP_KERNEL ]]; then
|
||||
if [[ -n $debug_kernelver ]]; then
|
||||
dinfo "Fallback to using debug kernel"
|
||||
KDUMP_KERNELVER=$debug_kernelver
|
||||
KDUMP_KERNEL=$(prepare_kdump_kernel "$KDUMP_KERNELVER")
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! [[ -e $KDUMP_KERNEL ]]; then
|
||||
derror "Failed to detect kdump kernel location"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ "$KDUMP_KERNEL" == *"+debug" ]]; then
|
||||
dwarn "Using debug kernel, you may need to set a larger crashkernel than the default value."
|
||||
fi
|
||||
|
||||
# Set KDUMP_BOOTDIR to where kernel image is stored
|
||||
KDUMP_BOOTDIR=$(dirname $KDUMP_KERNEL)
|
||||
KDUMP_BOOTDIR=$(dirname "$KDUMP_KERNEL")
|
||||
|
||||
# Default initrd should just stay aside of kernel image, try to find it in KDUMP_BOOTDIR
|
||||
boot_initrdlist="initramfs-$KDUMP_KERNELVER.img initrd"
|
||||
for initrd in $boot_initrdlist; do
|
||||
if [ -f "$KDUMP_BOOTDIR/$initrd" ]; then
|
||||
DEFAULT_INITRD="$KDUMP_BOOTDIR/$initrd"
|
||||
if [[ -f "$KDUMP_BOOTDIR/$initrd" ]]; then
|
||||
default_initrd_base="$initrd"
|
||||
DEFAULT_INITRD="$KDUMP_BOOTDIR/$default_initrd_base"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# Get kdump initrd from default initrd filename
|
||||
# Create kdump initrd basename from default initrd basename
|
||||
# initramfs-5.7.9-200.fc32.x86_64.img => initramfs-5.7.9-200.fc32.x86_64kdump.img
|
||||
# initrd => initrdkdump
|
||||
if [[ -z "$DEFAULT_INITRD" ]]; then
|
||||
KDUMP_INITRD=${KDUMP_BOOTDIR}/initramfs-${KDUMP_KERNELVER}kdump.img
|
||||
elif [[ $(basename $DEFAULT_INITRD) == *.* ]]; then
|
||||
KDUMP_INITRD=${DEFAULT_INITRD%.*}kdump.${DEFAULT_INITRD##*.}
|
||||
if [[ -z $default_initrd_base ]]; then
|
||||
kdump_initrd_base=initramfs-${KDUMP_KERNELVER}kdump.img
|
||||
elif [[ $default_initrd_base == *.* ]]; then
|
||||
kdump_initrd_base=${default_initrd_base%.*}kdump.${DEFAULT_INITRD##*.}
|
||||
else
|
||||
KDUMP_INITRD=${DEFAULT_INITRD}kdump
|
||||
kdump_initrd_base=${default_initrd_base}kdump
|
||||
fi
|
||||
|
||||
# Place kdump initrd in $(/var/lib/kdump) if $(KDUMP_BOOTDIR) not writable
|
||||
if [[ ! -w $KDUMP_BOOTDIR ]]; then
|
||||
var_target_initrd_dir="/var/lib/kdump"
|
||||
mkdir -p "$var_target_initrd_dir"
|
||||
KDUMP_INITRD="$var_target_initrd_dir/$kdump_initrd_base"
|
||||
else
|
||||
KDUMP_INITRD="$KDUMP_BOOTDIR/$kdump_initrd_base"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -824,3 +919,195 @@ prepare_cmdline()
|
||||
|
||||
echo ${cmdline}
|
||||
}
|
||||
|
||||
#get system memory size in the unit of GB
|
||||
get_system_size()
|
||||
{
|
||||
result=$(cat /proc/iomem | grep "System RAM" | awk -F ":" '{ print $1 }' | tr [:lower:] [:upper:] | paste -sd+)
|
||||
result="+$result"
|
||||
# replace '-' with '+0x' and '+' with '-0x'
|
||||
sum=$( echo $result | sed -e 's/-/K0x/g' | sed -e 's/+/-0x/g' | sed -e 's/K/+/g' )
|
||||
size=$(printf "%d\n" $(($sum)))
|
||||
|
||||
# in MB unit
|
||||
let size=$size/1024/1024
|
||||
# since RHEL-8.5 kernel round up total memory to 128M, so should user space
|
||||
let size=($size+127)/128
|
||||
let size=$size*128
|
||||
# in GB unit
|
||||
let size=$size/1024
|
||||
|
||||
echo $size
|
||||
}
|
||||
|
||||
get_recommend_size()
|
||||
{
|
||||
local mem_size=$1
|
||||
local _ck_cmdline=$2
|
||||
local OLDIFS="$IFS"
|
||||
|
||||
last_sz=""
|
||||
last_unit=""
|
||||
|
||||
start=${_ck_cmdline: :1}
|
||||
if [ $mem_size -lt $start ]; then
|
||||
echo "0M"
|
||||
return
|
||||
fi
|
||||
IFS=','
|
||||
for i in $_ck_cmdline; do
|
||||
end=$(echo $i | awk -F "-" '{ print $2 }' | awk -F ":" '{ print $1 }')
|
||||
recommend=$(echo $i | awk -F "-" '{ print $2 }' | awk -F ":" '{ print $2 }')
|
||||
size=${end: : -1}
|
||||
unit=${end: -1}
|
||||
if [ $unit == 'T' ]; then
|
||||
let size=$size*1024
|
||||
fi
|
||||
if [ $mem_size -lt $size ]; then
|
||||
echo $recommend
|
||||
IFS="$OLDIFS"
|
||||
return
|
||||
fi
|
||||
done
|
||||
IFS="$OLDIFS"
|
||||
}
|
||||
|
||||
# return recommended size based on current system RAM size
|
||||
kdump_get_arch_recommend_size()
|
||||
{
|
||||
if ! [[ -r "/proc/iomem" ]] ; then
|
||||
echo "Error, can not access /proc/iomem."
|
||||
return 1
|
||||
fi
|
||||
arch=$(lscpu | grep Architecture | awk -F ":" '{ print $2 }' | tr [:lower:] [:upper:])
|
||||
|
||||
if [ $arch == "X86_64" ] || [ $arch == "S390X" ]; then
|
||||
ck_cmdline="1G-4G:160M,4G-64G:192M,64G-1T:256M,1T-:512M"
|
||||
elif [ $arch == "AARCH64" ]; then
|
||||
ck_cmdline="2G-:448M"
|
||||
elif [ $arch == "PPC64LE" ]; then
|
||||
if is_fadump_capable; then
|
||||
ck_cmdline="4G-16G:768M,16G-64G:1G,64G-128G:2G,128G-1T:4G,1T-2T:6G,2T-4T:12G,4T-8T:20G,8T-16T:36G,16T-32T:64G,32T-64T:128G,64T-:180G"
|
||||
else
|
||||
ck_cmdline="2G-4G:384M,4G-16G:512M,16G-64G:1G,64G-128G:2G,128G-:4G"
|
||||
fi
|
||||
fi
|
||||
|
||||
ck_cmdline=$(echo $ck_cmdline | sed -e 's/-:/-102400T:/g')
|
||||
sys_mem=$(get_system_size)
|
||||
result=$(get_recommend_size $sys_mem "$ck_cmdline")
|
||||
echo $result
|
||||
return 0
|
||||
}
|
||||
|
||||
# Print all underlying crypt devices of a block device
|
||||
# print nothing if device is not on top of a crypt device
|
||||
# $1: the block device to be checked in maj:min format
|
||||
get_luks_crypt_dev()
|
||||
{
|
||||
local _type
|
||||
|
||||
[[ -b /dev/block/$1 ]] || return 1
|
||||
|
||||
_type=$(blkid -u filesystem,crypto -o export -- "/dev/block/$1" | \
|
||||
sed -n -E "s/^TYPE=(.*)$/\1/p")
|
||||
[[ $_type == "crypto_LUKS" ]] && echo $1
|
||||
|
||||
for _x in /sys/dev/block/$1/slaves/*; do
|
||||
[[ -f $_x/dev ]] || continue
|
||||
[[ $_x/subsystem -ef /sys/class/block ]] || continue
|
||||
get_luks_crypt_dev "$(< "$_x/dev")"
|
||||
done
|
||||
}
|
||||
|
||||
# kdump_get_maj_min <device>
|
||||
# Prints the major and minor of a device node.
|
||||
# Example:
|
||||
# $ get_maj_min /dev/sda2
|
||||
# 8:2
|
||||
kdump_get_maj_min() {
|
||||
local _majmin
|
||||
_majmin="$(stat -L -c '%t:%T' "$1" 2> /dev/null)"
|
||||
printf "%s" "$((0x${_majmin%:*})):$((0x${_majmin#*:}))"
|
||||
}
|
||||
|
||||
get_all_kdump_crypt_dev()
|
||||
{
|
||||
local _dev _crypt
|
||||
|
||||
for _dev in $(get_block_dump_target); do
|
||||
_crypt=$(get_luks_crypt_dev $(kdump_get_maj_min "$_dev"))
|
||||
[[ -n "$_crypt" ]] && echo $_crypt
|
||||
done
|
||||
}
|
||||
|
||||
check_vmlinux()
|
||||
{
|
||||
# Use readelf to check if it's a valid ELF
|
||||
readelf -h $1 &>/dev/null || return 1
|
||||
}
|
||||
|
||||
get_vmlinux_size()
|
||||
{
|
||||
local size=0
|
||||
|
||||
while read _type _offset _virtaddr _physaddr _fsize _msize _flg _aln; do
|
||||
size=$(( $size + $_msize ))
|
||||
done <<< $(readelf -l -W $1 | grep "^ LOAD" 2>/dev/stderr)
|
||||
|
||||
echo $size
|
||||
}
|
||||
|
||||
try_decompress()
|
||||
{
|
||||
# The obscure use of the "tr" filter is to work around older versions of
|
||||
# "grep" that report the byte offset of the line instead of the pattern.
|
||||
|
||||
# Try to find the header ($1) and decompress from here
|
||||
for pos in `tr "$1\n$2" "\n$2=" < "$4" | grep -abo "^$2"`
|
||||
do
|
||||
if ! type -P $3 > /dev/null; then
|
||||
ddebug "Signiature detected but '$3' is missing, skip this decompressor"
|
||||
break
|
||||
fi
|
||||
|
||||
pos=${pos%%:*}
|
||||
tail -c+$pos "$img" | $3 > $5 2> /dev/null
|
||||
if check_vmlinux $5; then
|
||||
ddebug "Kernel is extracted with '$3'"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
# Borrowed from linux/scripts/extract-vmlinux
|
||||
get_kernel_size()
|
||||
{
|
||||
# Prepare temp files:
|
||||
local img=$1 tmp=$(mktemp /tmp/vmlinux-XXX)
|
||||
trap "rm -f $tmp" 0
|
||||
|
||||
# Try to check if it's a vmlinux already
|
||||
check_vmlinux $img && get_vmlinux_size $img && return 0
|
||||
|
||||
# That didn't work, so retry after decompression.
|
||||
try_decompress '\037\213\010' xy gunzip $img $tmp || \
|
||||
try_decompress '\3757zXZ\000' abcde unxz $img $tmp || \
|
||||
try_decompress 'BZh' xy bunzip2 $img $tmp || \
|
||||
try_decompress '\135\0\0\0' xxx unlzma $img $tmp || \
|
||||
try_decompress '\211\114\132' xy 'lzop -d' $img $tmp || \
|
||||
try_decompress '\002!L\030' xxx 'lz4 -d' $img $tmp || \
|
||||
try_decompress '(\265/\375' xxx unzstd $img $tmp
|
||||
|
||||
# Finally check for uncompressed images or objects:
|
||||
[[ $? -eq 0 ]] && get_vmlinux_size $tmp && return 0
|
||||
|
||||
# Fallback to use iomem
|
||||
local _size=0
|
||||
for _seg in $(cat /proc/iomem | grep -E "Kernel (code|rodata|data|bss)" | cut -d ":" -f 1); do
|
||||
_size=$(( $_size + 0x${_seg#*-} - 0x${_seg%-*} ))
|
||||
done
|
||||
echo $_size
|
||||
}
|
||||
|
8
SOURCES/kdump-migrate-action.sh
Executable file
8
SOURCES/kdump-migrate-action.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
systemctl is-active kdump
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
/usr/lib/kdump/kdump-restart.sh
|
8
SOURCES/kdump-restart.sh
Normal file
8
SOURCES/kdump-restart.sh
Normal file
@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
export PATH="$PATH:/usr/bin:/usr/sbin"
|
||||
|
||||
exec >>/var/log/kdump-migration.log 2>&1
|
||||
|
||||
echo "kdump: Partition Migration detected. Rebuilding initramfs image to reload."
|
||||
/usr/bin/kdumpctl rebuild
|
||||
/usr/bin/kdumpctl reload
|
@ -118,8 +118,11 @@ All files under /etc/kdump/post.d are collectively sorted
|
||||
and executed in lexical order, before binary or script
|
||||
specified kdump_post parameter is executed.
|
||||
.PP
|
||||
Note that scripts written for use with this directive must use
|
||||
the /bin/bash interpreter.
|
||||
Note that scripts written for use with this directive must use the /bin/bash
|
||||
interpreter. And since these scripts run in kdump enviroment, the reference to
|
||||
the storage or network device in the scripts should adhere to the section
|
||||
\'Supported dump target types and requirements\' in kexec-kdump-howto.txt.
|
||||
|
||||
.RE
|
||||
|
||||
.B kdump_pre <binary | script>
|
||||
@ -139,8 +142,11 @@ kdump_pre parameter is executed.
|
||||
Even if the binary or script in /etc/kdump/pre.d directory
|
||||
returns non 0 exit status, the processing is continued.
|
||||
.PP
|
||||
Note that scripts written for this directive must use
|
||||
the /bin/bash interpreter.
|
||||
Note that scripts written for use with this directive must use the /bin/bash
|
||||
interpreter. And since these scripts run in kdump enviroment, the reference to
|
||||
the storage or network device in the scripts should adhere to the section
|
||||
\'Supported dump target types and requirements\' in kexec-kdump-howto.txt.
|
||||
|
||||
.RE
|
||||
|
||||
.B extra_bins <binaries | shell scripts>
|
||||
|
@ -17,7 +17,7 @@ KDUMP_COMMANDLINE=""
|
||||
# This variable lets us remove arguments from the current kdump commandline
|
||||
# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
|
||||
# NOTE: some arguments such as crashkernel will always be removed
|
||||
KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len"
|
||||
KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len ignition.firstboot"
|
||||
|
||||
# This variable lets us append arguments to the current kdump commandline
|
||||
# after processed by KDUMP_COMMANDLINE_REMOVE
|
||||
|
@ -17,7 +17,7 @@ KDUMP_COMMANDLINE=""
|
||||
# This variable lets us remove arguments from the current kdump commandline
|
||||
# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
|
||||
# NOTE: some arguments such as crashkernel will always be removed
|
||||
KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb"
|
||||
KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb ignition.firstboot"
|
||||
|
||||
# This variable lets us append arguments to the current kdump commandline
|
||||
# after processed by KDUMP_COMMANDLINE_REMOVE
|
||||
|
@ -17,7 +17,7 @@ KDUMP_COMMANDLINE=""
|
||||
# This variable lets us remove arguments from the current kdump commandline
|
||||
# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
|
||||
# NOTE: some arguments such as crashkernel will always be removed
|
||||
KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb"
|
||||
KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb ignition.firstboot"
|
||||
|
||||
# This variable lets us append arguments to the current kdump commandline
|
||||
# after processed by KDUMP_COMMANDLINE_REMOVE
|
||||
|
@ -17,7 +17,7 @@ KDUMP_COMMANDLINE=""
|
||||
# This variable lets us remove arguments from the current kdump commandline
|
||||
# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
|
||||
# NOTE: some arguments such as crashkernel will always be removed
|
||||
KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb"
|
||||
KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb ignition.firstboot"
|
||||
|
||||
# This variable lets us append arguments to the current kdump commandline
|
||||
# after processed by KDUMP_COMMANDLINE_REMOVE
|
||||
|
@ -17,7 +17,7 @@ KDUMP_COMMANDLINE=""
|
||||
# This variable lets us remove arguments from the current kdump commandline
|
||||
# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
|
||||
# NOTE: some arguments such as crashkernel will always be removed
|
||||
KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb"
|
||||
KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb ignition.firstboot"
|
||||
|
||||
# This variable lets us append arguments to the current kdump commandline
|
||||
# after processed by KDUMP_COMMANDLINE_REMOVE
|
||||
|
@ -17,7 +17,7 @@ KDUMP_COMMANDLINE=""
|
||||
# This variable lets us remove arguments from the current kdump commandline
|
||||
# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
|
||||
# NOTE: some arguments such as crashkernel will always be removed
|
||||
KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb"
|
||||
KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb prot_virt ignition.firstboot zfcp.allow_lun_scan"
|
||||
|
||||
# This variable lets us append arguments to the current kdump commandline
|
||||
# after processed by KDUMP_COMMANDLINE_REMOVE
|
||||
|
@ -17,7 +17,7 @@ KDUMP_COMMANDLINE=""
|
||||
# This variable lets us remove arguments from the current kdump commandline
|
||||
# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
|
||||
# NOTE: some arguments such as crashkernel will always be removed
|
||||
KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb"
|
||||
KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb ignition.firstboot"
|
||||
|
||||
# This variable lets us append arguments to the current kdump commandline
|
||||
# after processed by KDUMP_COMMANDLINE_REMOVE
|
||||
|
230
SOURCES/kdumpctl
230
SOURCES/kdumpctl
@ -8,6 +8,7 @@ KEXEC_ARGS=""
|
||||
KDUMP_CONFIG_FILE="/etc/kdump.conf"
|
||||
KDUMP_LOG_PATH="/var/log"
|
||||
MKDUMPRD="/sbin/mkdumprd -f"
|
||||
MKFADUMPRD="/sbin/mkfadumprd"
|
||||
DRACUT_MODULES_FILE="/usr/lib/dracut/modules.txt"
|
||||
SAVE_PATH=/var/crash
|
||||
SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa"
|
||||
@ -104,26 +105,12 @@ save_core()
|
||||
|
||||
rebuild_fadump_initrd()
|
||||
{
|
||||
local target_initrd_tmp
|
||||
|
||||
# this file tells the initrd is fadump enabled
|
||||
touch /tmp/fadump.initramfs
|
||||
target_initrd_tmp="$TARGET_INITRD.tmp"
|
||||
ddebug "rebuild fadump initrd: $target_initrd_tmp $DEFAULT_INITRD_BAK $KDUMP_KERNELVER"
|
||||
$MKDUMPRD $target_initrd_tmp --rebuild $DEFAULT_INITRD_BAK --kver $KDUMP_KERNELVER \
|
||||
-i /tmp/fadump.initramfs /etc/fadump.initramfs
|
||||
if [ $? != 0 ]; then
|
||||
derror "mkdumprd: failed to rebuild initrd with fadump support"
|
||||
rm -f /tmp/fadump.initramfs
|
||||
if ! $MKFADUMPRD "$DEFAULT_INITRD_BAK" "$TARGET_INITRD" --kver "$KDUMP_KERNELVER"; then
|
||||
derror "mkfadumprd: failed to make fadump initrd"
|
||||
return 1
|
||||
fi
|
||||
rm -f /tmp/fadump.initramfs
|
||||
|
||||
# updating fadump initrd
|
||||
ddebug "updating fadump initrd: $target_initrd_tmp $TARGET_INITRD"
|
||||
mv $target_initrd_tmp $TARGET_INITRD
|
||||
sync
|
||||
|
||||
sync -f "$TARGET_INITRD"
|
||||
return 0
|
||||
}
|
||||
|
||||
@ -146,13 +133,14 @@ rebuild_kdump_initrd()
|
||||
dwarn "Tips: If early kdump is enabled, also require rebuilding the system initramfs to make the changes take effect for early kdump."
|
||||
fi
|
||||
|
||||
sync -f "$TARGET_INITRD"
|
||||
return 0
|
||||
}
|
||||
|
||||
rebuild_initrd()
|
||||
{
|
||||
if [[ ! -w "$KDUMP_BOOTDIR" ]];then
|
||||
derror "$KDUMP_BOOTDIR does not have write permission. Can not rebuild $TARGET_INITRD"
|
||||
if [[ ! -w $(dirname $TARGET_INITRD) ]];then
|
||||
derror "$(dirname $TARGET_INITRD) does not have write permission. Cannot rebuild $TARGET_INITRD"
|
||||
return 1
|
||||
fi
|
||||
|
||||
@ -228,7 +216,7 @@ restore_default_initrd()
|
||||
mv $DEFAULT_INITRD_BAK $DEFAULT_INITRD
|
||||
if [[ $? -eq 0 ]]; then
|
||||
derror "Restoring original initrd as fadump mode is disabled."
|
||||
sync
|
||||
sync -f "$DEFAULT_INITRD"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@ -237,12 +225,7 @@ restore_default_initrd()
|
||||
check_config()
|
||||
{
|
||||
local -A _opt_rec
|
||||
while read config_opt config_val; do
|
||||
if [ -z "$config_val" ]; then
|
||||
derror "Invalid kdump config value for option $config_opt"
|
||||
return 1
|
||||
fi
|
||||
|
||||
while read -r config_opt config_val; do
|
||||
case "$config_opt" in
|
||||
dracut_args)
|
||||
if [[ $config_val == *--mount* ]]; then
|
||||
@ -269,12 +252,20 @@ check_config()
|
||||
derror "Deprecated kdump config option: $config_opt. Refer to kdump.conf manpage for alternatives."
|
||||
return 1
|
||||
;;
|
||||
'')
|
||||
continue
|
||||
;;
|
||||
*)
|
||||
derror "Invalid kdump config option $config_opt"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ -z "$config_val" ]]; then
|
||||
derror "Invalid kdump config value for option '$config_opt'"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ -n "${_opt_rec[$config_opt]}" ]; then
|
||||
if [ $config_opt == _target ]; then
|
||||
derror "More than one dump targets specified"
|
||||
@ -407,6 +398,7 @@ check_files_modified()
|
||||
|
||||
# HOOKS is mandatory and need to check the modification time
|
||||
files="$files $HOOKS"
|
||||
is_lvm2_thinp_dump_target && files="$files $LVM_CONF"
|
||||
check_exist "$files" && check_executable "$EXTRA_BINS"
|
||||
[ $? -ne 0 ] && return 2
|
||||
|
||||
@ -461,7 +453,11 @@ check_drivers_modified()
|
||||
is_dracut_mod_omitted watchdog || is_dracut_mod_omitted watchdog-modules || _new_drivers+=" $(get_watchdog_drvs)"
|
||||
|
||||
[ -z "$_new_drivers" ] && return 0
|
||||
_old_drivers="$(lsinitrd $TARGET_INITRD -f /usr/lib/dracut/loaded-kernel-modules.txt | tr '\n' ' ')"
|
||||
if is_fadump_capable; then
|
||||
_old_drivers="$(lsinitrd "$TARGET_INITRD" -f /usr/lib/dracut/fadump-kernel-modules.txt | tr '\n' ' ')"
|
||||
else
|
||||
_old_drivers="$(lsinitrd "$TARGET_INITRD" -f /usr/lib/dracut/loaded-kernel-modules.txt | tr '\n' ' ')"
|
||||
fi
|
||||
|
||||
ddebug "Modules required for kdump: '$_new_drivers'"
|
||||
ddebug "Modules included in old initramfs: '$_old_drivers'"
|
||||
@ -491,8 +487,9 @@ check_fs_modified()
|
||||
fi
|
||||
|
||||
# No need to check in case of raw target.
|
||||
# Currently we do not check also if ssh/nfs target is specified
|
||||
if is_ssh_dump_target || is_nfs_dump_target || is_raw_dump_target; then
|
||||
# Currently we do not check also if ssh/nfs/thinp target is specified
|
||||
if is_ssh_dump_target || is_nfs_dump_target || is_raw_dump_target ||
|
||||
is_lvm2_thinp_dump_target; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
@ -541,28 +538,22 @@ check_fs_modified()
|
||||
check_system_modified()
|
||||
{
|
||||
local ret
|
||||
local CONF_ERROR=2
|
||||
local CONF_MODIFY=1
|
||||
local CONF_NO_MODIFY=0
|
||||
local conf_status=$CONF_NO_MODIFY
|
||||
|
||||
[[ -f $TARGET_INITRD ]] || return 1
|
||||
|
||||
check_files_modified
|
||||
ret=$?
|
||||
if [ $ret -ne 0 ]; then
|
||||
return $ret
|
||||
fi
|
||||
for _func in check_files_modified check_fs_modified check_drivers_modified; do
|
||||
$_func
|
||||
ret=$?
|
||||
# return immediately if an error occurred.
|
||||
[[ $ret -eq "$CONF_ERROR" ]] && return "$ret"
|
||||
[[ $ret -eq "$CONF_MODIFY" ]] && { conf_status="$CONF_MODIFY"; }
|
||||
done
|
||||
|
||||
check_fs_modified
|
||||
ret=$?
|
||||
if [ $ret -ne 0 ]; then
|
||||
return $ret
|
||||
fi
|
||||
|
||||
check_drivers_modified
|
||||
ret=$?
|
||||
if [ $ret -ne 0 ]; then
|
||||
return $ret
|
||||
fi
|
||||
|
||||
return 0
|
||||
return $conf_status
|
||||
}
|
||||
|
||||
check_rebuild()
|
||||
@ -614,7 +605,7 @@ check_rebuild()
|
||||
#in case of fadump mode, check whether the default/target
|
||||
#initrd is already built with dump capture capability
|
||||
if [ "$DEFAULT_DUMP_MODE" == "fadump" ]; then
|
||||
capture_capable_initrd=$(lsinitrd -f $DRACUT_MODULES_FILE $TARGET_INITRD | grep ^kdumpbase$ | wc -l)
|
||||
capture_capable_initrd=$(lsinitrd -f $DRACUT_MODULES_FILE $TARGET_INITRD | grep -e ^kdumpbase$ -e ^zz-fadumpinit$ | wc -l)
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -656,20 +647,7 @@ function load_kdump_kernel_key()
|
||||
return
|
||||
fi
|
||||
|
||||
KDUMP_KEY_ID=$(cat /usr/share/doc/kernel-keys/$KDUMP_KERNELVER/kernel-signing-ppc.cer |
|
||||
keyctl padd asymmetric kernelkey-$RANDOM %:.ima)
|
||||
}
|
||||
|
||||
# remove a previously loaded key. There's no real security implication
|
||||
# to leaving it around, we choose to do this because it makes it easier
|
||||
# to be idempotent and so as to reduce the potential for confusion.
|
||||
function remove_kdump_kernel_key()
|
||||
{
|
||||
if [ -z "$KDUMP_KEY_ID" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
keyctl unlink $KDUMP_KEY_ID %:.ima
|
||||
keyctl padd asymmetric "" %:.ima < "/usr/share/doc/kernel-keys/$KDUMP_KERNELVER/kernel-signing-ppc.cer"
|
||||
}
|
||||
|
||||
# Load the kdump kernel specified in /etc/sysconfig/kdump
|
||||
@ -682,15 +660,6 @@ load_kdump()
|
||||
KEXEC_ARGS=$(prepare_kexec_args "${KEXEC_ARGS}")
|
||||
KDUMP_COMMANDLINE=$(prepare_cmdline "${KDUMP_COMMANDLINE}" "${KDUMP_COMMANDLINE_REMOVE}" "${KDUMP_COMMANDLINE_APPEND}")
|
||||
|
||||
# For secureboot enabled machines, use new kexec file based syscall.
|
||||
# Old syscall will always fail as it does not have capability to
|
||||
# to kernel signature verification.
|
||||
if is_secure_boot_enforced; then
|
||||
dinfo "Secure Boot is enabled. Using kexec file based syscall."
|
||||
KEXEC_ARGS="$KEXEC_ARGS -s"
|
||||
load_kdump_kernel_key
|
||||
fi
|
||||
|
||||
ddebug "$KEXEC $KEXEC_ARGS $standard_kexec_args --command-line=$KDUMP_COMMANDLINE --initrd=$TARGET_INITRD $KDUMP_KERNEL"
|
||||
|
||||
# The '12' represents an intermediate temporary file descriptor
|
||||
@ -699,6 +668,7 @@ load_kdump()
|
||||
# and release it.
|
||||
exec 12>&2
|
||||
exec 2>> $KDUMP_LOG_PATH/kdump.log
|
||||
chmod 600 $KDUMP_LOG_PATH/kdump.log
|
||||
PS4='+ $(date "+%Y-%m-%d %H:%M:%S") ${BASH_SOURCE}@${LINENO}: '
|
||||
set -x
|
||||
|
||||
@ -710,9 +680,7 @@ load_kdump()
|
||||
set +x
|
||||
exec 2>&12 12>&-
|
||||
|
||||
remove_kdump_kernel_key
|
||||
|
||||
if [ $ret == 0 ]; then
|
||||
if [[ $ret == 0 ]]; then
|
||||
dinfo "kexec: loaded kdump kernel"
|
||||
return 0
|
||||
else
|
||||
@ -850,7 +818,7 @@ propagate_ssh_key()
|
||||
|
||||
show_reserved_mem()
|
||||
{
|
||||
local mem=$(cat /sys/kernel/kexec_crash_size)
|
||||
local mem=$(get_reserved_mem_size)
|
||||
local mem_mb=$(expr $mem / 1024 / 1024)
|
||||
|
||||
dinfo "Reserved "$mem_mb"MB memory for crash kernel"
|
||||
@ -957,12 +925,12 @@ selinux_relabel()
|
||||
return
|
||||
fi
|
||||
|
||||
for _i in $(find $_path); do
|
||||
_attr=$(getfattr -m "security.selinux" $_i 2>/dev/null)
|
||||
while IFS= read -r -d '' _i; do
|
||||
_attr=$(getfattr -m "security.selinux" "$_i" 2>/dev/null)
|
||||
if [ -z "$_attr" ]; then
|
||||
restorecon $_i;
|
||||
restorecon "$_i";
|
||||
fi
|
||||
done
|
||||
done < <(find "$_path" -print0)
|
||||
}
|
||||
|
||||
check_fence_kdump_config()
|
||||
@ -1011,7 +979,13 @@ start_fadump()
|
||||
|
||||
start_dump()
|
||||
{
|
||||
if [ $DEFAULT_DUMP_MODE == "fadump" ]; then
|
||||
# On secure boot enabled Power systems, load kernel signing key on .ima for signature
|
||||
# verification using kexec file based syscall.
|
||||
if [[ "$(uname -m)" == ppc64le ]] && is_secure_boot_enforced; then
|
||||
load_kdump_kernel_key
|
||||
fi
|
||||
|
||||
if [[ $DEFAULT_DUMP_MODE == "fadump" ]]; then
|
||||
start_fadump
|
||||
else
|
||||
load_kdump
|
||||
@ -1246,6 +1220,97 @@ rebuild() {
|
||||
return $?
|
||||
}
|
||||
|
||||
do_estimate() {
|
||||
local kdump_mods
|
||||
local -A large_mods
|
||||
local baseline
|
||||
local kernel_size mod_size initrd_size baseline_size runtime_size reserved_size estimated_size recommended_size
|
||||
local size_mb=$(( 1024 * 1024 ))
|
||||
|
||||
setup_initrd
|
||||
if [ ! -f "$TARGET_INITRD" ]; then
|
||||
derror "kdumpctl estimate: kdump initramfs is not built yet."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
kdump_mods="$(lsinitrd "$TARGET_INITRD" -f /usr/lib/dracut/loaded-kernel-modules.txt | tr '\n' ' ')"
|
||||
baseline=$(kdump_get_arch_recommend_size)
|
||||
if [[ "${baseline: -1}" == "M" ]]; then
|
||||
baseline=${baseline%M}
|
||||
elif [[ "${baseline: -1}" == "G" ]]; then
|
||||
baseline=$(( ${baseline%G} * 1024 ))
|
||||
elif [[ "${baseline: -1}" == "T" ]]; then
|
||||
baseline=$(( ${baseline%Y} * 1048576 ))
|
||||
fi
|
||||
|
||||
# The default value when using crashkernel=auto
|
||||
baseline_size=$((baseline * size_mb))
|
||||
# Current reserved crashkernel size
|
||||
reserved_size=$(get_reserved_mem_size)
|
||||
# A pre-estimated value for userspace usage and kernel
|
||||
# runtime allocation, 64M should good for most cases
|
||||
runtime_size=$((64 * size_mb))
|
||||
# Kernel image size
|
||||
kernel_size=$(get_kernel_size "$KDUMP_KERNEL")
|
||||
# Kdump initramfs size
|
||||
initrd_size=$(du -b "$TARGET_INITRD" | awk '{print $1}')
|
||||
# Kernel modules static size after loaded
|
||||
mod_size=0
|
||||
while read -r _name _size _; do
|
||||
if [[ ! " $kdump_mods " == *" $_name "* ]]; then
|
||||
continue
|
||||
fi
|
||||
mod_size=$((mod_size + _size))
|
||||
|
||||
# Mark module with static size larger than 2M as large module
|
||||
if [[ $((_size / size_mb)) -ge 1 ]]; then
|
||||
large_mods[$_name]=$_size
|
||||
fi
|
||||
done <<< "$(< /proc/modules)"
|
||||
|
||||
# Extra memory usage required for LUKS2 decryption
|
||||
crypt_size=0
|
||||
for _dev in $(get_all_kdump_crypt_dev); do
|
||||
_crypt_info=$(cryptsetup luksDump "/dev/block/$_dev")
|
||||
[[ $(echo "$_crypt_info" | sed -n "s/^Version:\s*\(.*\)/\1/p" ) == "2" ]] || continue
|
||||
for _mem in $(echo "$_crypt_info" | sed -n "s/\sMemory:\s*\(.*\)/\1/p" | sort -n ); do
|
||||
crypt_size=$((crypt_size + _mem * 1024))
|
||||
break
|
||||
done
|
||||
done
|
||||
[[ $crypt_size -ne 0 ]] && echo -e "Encrypted kdump target requires extra memory, assuming using the keyslot with minimun memory requirement\n"
|
||||
|
||||
estimated_size=$((kernel_size + mod_size + initrd_size + runtime_size + crypt_size))
|
||||
if [[ $baseline_size -gt $estimated_size ]]; then
|
||||
recommended_size=$baseline_size
|
||||
else
|
||||
recommended_size=$estimated_size
|
||||
fi
|
||||
|
||||
echo "Reserved crashkernel: $((reserved_size / size_mb))M"
|
||||
echo "Recommended crashkernel: $((recommended_size / size_mb))M"
|
||||
echo
|
||||
echo "Kernel image size: $((kernel_size / size_mb))M"
|
||||
echo "Kernel modules size: $((mod_size / size_mb))M"
|
||||
echo "Initramfs size: $((initrd_size / size_mb))M"
|
||||
echo "Runtime reservation: $((runtime_size / size_mb))M"
|
||||
[[ $crypt_size -ne 0 ]] && \
|
||||
echo "LUKS required size: $((crypt_size / size_mb))M"
|
||||
echo -n "Large modules:"
|
||||
if [[ "${#large_mods[@]}" -eq 0 ]]; then
|
||||
echo " <none>"
|
||||
else
|
||||
echo ""
|
||||
for _mod in "${!large_mods[@]}"; do
|
||||
echo " $_mod: ${large_mods[$_mod]}"
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ $reserved_size -lt $recommended_size ]]; then
|
||||
echo "WARNING: Current crashkernel size is lower than recommended size $((recommended_size / size_mb))M."
|
||||
fi
|
||||
}
|
||||
|
||||
if [ ! -f "$KDUMP_CONFIG_FILE" ]; then
|
||||
derror "Error: No kdump config file found!"
|
||||
exit 1
|
||||
@ -1301,8 +1366,11 @@ main ()
|
||||
showmem)
|
||||
show_reserved_mem
|
||||
;;
|
||||
estimate)
|
||||
do_estimate
|
||||
;;
|
||||
*)
|
||||
dinfo $"Usage: $0 {start|stop|status|restart|reload|rebuild|propagate|showmem}"
|
||||
dinfo $"Usage: $0 {estimate|start|stop|status|restart|reload|rebuild|propagate|showmem}"
|
||||
exit 1
|
||||
esac
|
||||
}
|
||||
|
@ -44,6 +44,11 @@ impossible to use password authentication during kdump.
|
||||
.TP
|
||||
.I showmem
|
||||
Prints the size of reserved memory for crash kernel in megabytes.
|
||||
.TP
|
||||
.I estimate
|
||||
Estimate a suitable crashkernel value for current machine. This is a
|
||||
best-effort estimate. It will print a recommanded crashkernel value
|
||||
based on current kdump setup, and list some details of memory usage.
|
||||
|
||||
.SH "SEE ALSO"
|
||||
.BR kdump.conf (5),
|
||||
|
@ -621,6 +621,9 @@ If /etc/kdump/post.d directory exist, All files in the directory are
|
||||
collectively sorted and executed in lexical order, before binary or script
|
||||
specified kdump_post parameter is executed.
|
||||
|
||||
In these scripts, the reference to the storage or network device should adhere
|
||||
to the section 'Supported dump target types and requirements'
|
||||
|
||||
Kdump Pre-Capture Executable
|
||||
----------------------------
|
||||
|
||||
@ -634,6 +637,9 @@ kdump_pre parameter is executed.
|
||||
Even if the binary or script in /etc/kdump/pre.d directory returns non 0
|
||||
exit status, the processing is continued.
|
||||
|
||||
In these scripts, the reference to the storage or network device should adhere
|
||||
to the section 'Supported dump target types and requirements'
|
||||
|
||||
Extra Binaries
|
||||
--------------
|
||||
|
||||
|
@ -1,181 +0,0 @@
|
||||
From a7c4cb8e998571cb3dd62e907935a1e052b15d6c Mon Sep 17 00:00:00 2001
|
||||
From: Lianbo Jiang <lijiang@redhat.com>
|
||||
Date: Fri, 23 Aug 2019 20:05:38 +0800
|
||||
Subject: [PATCH 3/5] Cleanup: move it back from util_lib/elf_info.c
|
||||
|
||||
Some code related to vmcore-dmesg.c is put into the util_lib, which
|
||||
is not very reasonable, so lets move it back and tidy up those code.
|
||||
|
||||
In addition, that will also help to limit the size of vmcore-dmesg.txt
|
||||
in vmcore-dmesg.c instead of elf_info.c.
|
||||
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||
---
|
||||
util_lib/elf_info.c | 48 +++++++++----------------------------
|
||||
util_lib/include/elf_info.h | 2 +-
|
||||
vmcore-dmesg/vmcore-dmesg.c | 30 ++++++++++++++++++++++-
|
||||
3 files changed, 41 insertions(+), 39 deletions(-)
|
||||
|
||||
diff --git a/util_lib/elf_info.c b/util_lib/elf_info.c
|
||||
index 5d0efaafab53..2bce5cb1713c 100644
|
||||
--- a/util_lib/elf_info.c
|
||||
+++ b/util_lib/elf_info.c
|
||||
@@ -531,19 +531,7 @@ static int32_t read_file_s32(int fd, uint64_t addr)
|
||||
return read_file_u32(fd, addr);
|
||||
}
|
||||
|
||||
-static void write_to_stdout(char *buf, unsigned int nr)
|
||||
-{
|
||||
- ssize_t ret;
|
||||
-
|
||||
- ret = write(STDOUT_FILENO, buf, nr);
|
||||
- if (ret != nr) {
|
||||
- fprintf(stderr, "Failed to write out the dmesg log buffer!:"
|
||||
- " %s\n", strerror(errno));
|
||||
- exit(54);
|
||||
- }
|
||||
-}
|
||||
-
|
||||
-static void dump_dmesg_legacy(int fd)
|
||||
+static void dump_dmesg_legacy(int fd, void (*handler)(char*, unsigned int))
|
||||
{
|
||||
uint64_t log_buf, log_buf_offset;
|
||||
unsigned log_end, logged_chars, log_end_wrapped;
|
||||
@@ -604,7 +592,8 @@ static void dump_dmesg_legacy(int fd)
|
||||
*/
|
||||
logged_chars = log_end < log_buf_len ? log_end : log_buf_len;
|
||||
|
||||
- write_to_stdout(buf + (log_buf_len - logged_chars), logged_chars);
|
||||
+ if (handler)
|
||||
+ handler(buf + (log_buf_len - logged_chars), logged_chars);
|
||||
}
|
||||
|
||||
static inline uint16_t struct_val_u16(char *ptr, unsigned int offset)
|
||||
@@ -623,7 +612,7 @@ static inline uint64_t struct_val_u64(char *ptr, unsigned int offset)
|
||||
}
|
||||
|
||||
/* Read headers of log records and dump accordingly */
|
||||
-static void dump_dmesg_structured(int fd)
|
||||
+static void dump_dmesg_structured(int fd, void (*handler)(char*, unsigned int))
|
||||
{
|
||||
#define OUT_BUF_SIZE 4096
|
||||
uint64_t log_buf, log_buf_offset, ts_nsec;
|
||||
@@ -733,7 +722,8 @@ static void dump_dmesg_structured(int fd)
|
||||
out_buf[len++] = c;
|
||||
|
||||
if (len >= OUT_BUF_SIZE - 64) {
|
||||
- write_to_stdout(out_buf, len);
|
||||
+ if (handler)
|
||||
+ handler(out_buf, len);
|
||||
len = 0;
|
||||
}
|
||||
}
|
||||
@@ -752,16 +742,16 @@ static void dump_dmesg_structured(int fd)
|
||||
current_idx += loglen;
|
||||
}
|
||||
free(buf);
|
||||
- if (len)
|
||||
- write_to_stdout(out_buf, len);
|
||||
+ if (len && handler)
|
||||
+ handler(out_buf, len);
|
||||
}
|
||||
|
||||
-static void dump_dmesg(int fd)
|
||||
+void dump_dmesg(int fd, void (*handler)(char*, unsigned int))
|
||||
{
|
||||
if (log_first_idx_vaddr)
|
||||
- dump_dmesg_structured(fd);
|
||||
+ dump_dmesg_structured(fd, handler);
|
||||
else
|
||||
- dump_dmesg_legacy(fd);
|
||||
+ dump_dmesg_legacy(fd, handler);
|
||||
}
|
||||
|
||||
int read_elf(int fd)
|
||||
@@ -808,22 +798,6 @@ int read_elf(int fd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-int read_elf_vmcore(int fd)
|
||||
-{
|
||||
- int ret;
|
||||
-
|
||||
- ret = read_elf(fd);
|
||||
- if (ret > 0) {
|
||||
- fprintf(stderr, "Unable to read ELF information"
|
||||
- " from vmcore\n");
|
||||
- return ret;
|
||||
- }
|
||||
-
|
||||
- dump_dmesg(fd);
|
||||
-
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
int read_phys_offset_elf_kcore(int fd, unsigned long *phys_off)
|
||||
{
|
||||
int ret;
|
||||
diff --git a/util_lib/include/elf_info.h b/util_lib/include/elf_info.h
|
||||
index c328a1b0ecf2..4bc9279ba603 100644
|
||||
--- a/util_lib/include/elf_info.h
|
||||
+++ b/util_lib/include/elf_info.h
|
||||
@@ -30,6 +30,6 @@ int get_pt_load(int idx,
|
||||
unsigned long long *virt_end);
|
||||
int read_phys_offset_elf_kcore(int fd, unsigned long *phys_off);
|
||||
int read_elf(int fd);
|
||||
-int read_elf_vmcore(int fd);
|
||||
+void dump_dmesg(int fd, void (*handler)(char*, unsigned int));
|
||||
|
||||
#endif /* ELF_INFO_H */
|
||||
diff --git a/vmcore-dmesg/vmcore-dmesg.c b/vmcore-dmesg/vmcore-dmesg.c
|
||||
index bebc348a657e..fe7df8ec372c 100644
|
||||
--- a/vmcore-dmesg/vmcore-dmesg.c
|
||||
+++ b/vmcore-dmesg/vmcore-dmesg.c
|
||||
@@ -5,6 +5,34 @@ typedef Elf32_Nhdr Elf_Nhdr;
|
||||
|
||||
extern const char *fname;
|
||||
|
||||
+static void write_to_stdout(char *buf, unsigned int nr)
|
||||
+{
|
||||
+ ssize_t ret;
|
||||
+
|
||||
+ ret = write(STDOUT_FILENO, buf, nr);
|
||||
+ if (ret != nr) {
|
||||
+ fprintf(stderr, "Failed to write out the dmesg log buffer!:"
|
||||
+ " %s\n", strerror(errno));
|
||||
+ exit(54);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static int read_vmcore_dmesg(int fd, void (*handler)(char*, unsigned int))
|
||||
+{
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = read_elf(fd);
|
||||
+ if (ret > 0) {
|
||||
+ fprintf(stderr, "Unable to read ELF information"
|
||||
+ " from vmcore\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ dump_dmesg(fd, handler);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
ssize_t ret;
|
||||
@@ -23,7 +51,7 @@ int main(int argc, char **argv)
|
||||
return 2;
|
||||
}
|
||||
|
||||
- ret = read_elf_vmcore(fd);
|
||||
+ ret = read_vmcore_dmesg(fd, write_to_stdout);
|
||||
|
||||
close(fd);
|
||||
|
||||
--
|
||||
2.17.1
|
||||
|
@ -1,84 +0,0 @@
|
||||
From 545c811050a375f79e0fa0e107cb35b9ae3a1599 Mon Sep 17 00:00:00 2001
|
||||
From: Lianbo Jiang <lijiang@redhat.com>
|
||||
Date: Fri, 23 Aug 2019 20:05:36 +0800
|
||||
Subject: [PATCH 1/5] Cleanup: remove the read_elf_kcore()
|
||||
|
||||
Here, no need to wrap the read_elf() again, lets invoke it directly.
|
||||
So remove the read_elf_kcore() and clean up redundant code.
|
||||
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||
---
|
||||
kexec/arch/arm64/kexec-arm64.c | 2 +-
|
||||
util_lib/elf_info.c | 15 ++-------------
|
||||
util_lib/include/elf_info.h | 2 +-
|
||||
3 files changed, 4 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c
|
||||
index eb3a3a37307c..6ad3b0a134b3 100644
|
||||
--- a/kexec/arch/arm64/kexec-arm64.c
|
||||
+++ b/kexec/arch/arm64/kexec-arm64.c
|
||||
@@ -889,7 +889,7 @@ int get_phys_base_from_pt_load(unsigned long *phys_offset)
|
||||
return EFAILED;
|
||||
}
|
||||
|
||||
- read_elf_kcore(fd);
|
||||
+ read_elf(fd);
|
||||
|
||||
for (i = 0; get_pt_load(i,
|
||||
&phys_start, NULL, &virt_start, NULL);
|
||||
diff --git a/util_lib/elf_info.c b/util_lib/elf_info.c
|
||||
index 90a3b21662e7..d9397ecd8626 100644
|
||||
--- a/util_lib/elf_info.c
|
||||
+++ b/util_lib/elf_info.c
|
||||
@@ -764,7 +764,7 @@ static void dump_dmesg(int fd)
|
||||
dump_dmesg_legacy(fd);
|
||||
}
|
||||
|
||||
-static int read_elf(int fd)
|
||||
+int read_elf(int fd)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@@ -824,24 +824,13 @@ int read_elf_vmcore(int fd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-int read_elf_kcore(int fd)
|
||||
-{
|
||||
- int ret;
|
||||
-
|
||||
- ret = read_elf(fd);
|
||||
- if (ret != 0)
|
||||
- return ret;
|
||||
-
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
int read_phys_offset_elf_kcore(int fd, unsigned long *phys_off)
|
||||
{
|
||||
int ret;
|
||||
|
||||
*phys_off = UINT64_MAX;
|
||||
|
||||
- ret = read_elf_kcore(fd);
|
||||
+ ret = read_elf(fd);
|
||||
if (!ret) {
|
||||
/* If we have a valid 'PHYS_OFFSET' by now,
|
||||
* return it to the caller now.
|
||||
diff --git a/util_lib/include/elf_info.h b/util_lib/include/elf_info.h
|
||||
index 1a4debd2d4ba..c328a1b0ecf2 100644
|
||||
--- a/util_lib/include/elf_info.h
|
||||
+++ b/util_lib/include/elf_info.h
|
||||
@@ -29,7 +29,7 @@ int get_pt_load(int idx,
|
||||
unsigned long long *virt_start,
|
||||
unsigned long long *virt_end);
|
||||
int read_phys_offset_elf_kcore(int fd, unsigned long *phys_off);
|
||||
-int read_elf_kcore(int fd);
|
||||
+int read_elf(int fd);
|
||||
int read_elf_vmcore(int fd);
|
||||
|
||||
#endif /* ELF_INFO_H */
|
||||
--
|
||||
2.17.1
|
||||
|
@ -1,47 +0,0 @@
|
||||
From 14ad054e7baa788a6629385ffe5e0f1996b7de02 Mon Sep 17 00:00:00 2001
|
||||
From: Lianbo Jiang <lijiang@redhat.com>
|
||||
Date: Fri, 23 Aug 2019 20:05:37 +0800
|
||||
Subject: [PATCH 2/5] Fix an error definition about the variable 'fname'
|
||||
|
||||
The variable 'fname' is mistakenly defined two twice, the first definition
|
||||
is in the vmcore-dmesg.c, and the second definition is in the elf_info.c.
|
||||
That is confused and incorrect although it's a static type, because the
|
||||
value of variable 'fname' is not assigned(set) in elf_info.c. Anyway, its
|
||||
value will be always 'null' when printing an error information.
|
||||
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||
---
|
||||
util_lib/elf_info.c | 2 +-
|
||||
vmcore-dmesg/vmcore-dmesg.c | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/util_lib/elf_info.c b/util_lib/elf_info.c
|
||||
index d9397ecd8626..5d0efaafab53 100644
|
||||
--- a/util_lib/elf_info.c
|
||||
+++ b/util_lib/elf_info.c
|
||||
@@ -20,7 +20,7 @@
|
||||
/* The 32bit and 64bit note headers make it clear we don't care */
|
||||
typedef Elf32_Nhdr Elf_Nhdr;
|
||||
|
||||
-static const char *fname;
|
||||
+const char *fname;
|
||||
static Elf64_Ehdr ehdr;
|
||||
static Elf64_Phdr *phdr;
|
||||
static int num_pt_loads;
|
||||
diff --git a/vmcore-dmesg/vmcore-dmesg.c b/vmcore-dmesg/vmcore-dmesg.c
|
||||
index 7a386b380291..bebc348a657e 100644
|
||||
--- a/vmcore-dmesg/vmcore-dmesg.c
|
||||
+++ b/vmcore-dmesg/vmcore-dmesg.c
|
||||
@@ -3,7 +3,7 @@
|
||||
/* The 32bit and 64bit note headers make it clear we don't care */
|
||||
typedef Elf32_Nhdr Elf_Nhdr;
|
||||
|
||||
-static const char *fname;
|
||||
+extern const char *fname;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
--
|
||||
2.17.1
|
||||
|
@ -1,55 +0,0 @@
|
||||
From fa3f0ed47f3e6dbee485722d13713ad495571b7e Mon Sep 17 00:00:00 2001
|
||||
From: Lianbo Jiang <lijiang@redhat.com>
|
||||
Date: Fri, 23 Aug 2019 20:05:39 +0800
|
||||
Subject: [PATCH 4/5] Limit the size of vmcore-dmesg.txt to 2G
|
||||
|
||||
With some corrupted vmcore files, the vmcore-dmesg.txt file may grow
|
||||
forever till the kdump disk becomes full, and also probably causes
|
||||
the disk error messages as follow:
|
||||
...
|
||||
sd 0:0:0:0: [sda] tag#6 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
|
||||
sd 0:0:0:0: [sda] tag#6 CDB: Read(10) 28 00 08 06 4c 98 00 00 08 00
|
||||
blk_update_request: I/O error, dev sda, sector 134630552
|
||||
sd 0:0:0:0: [sda] tag#7 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
|
||||
sd 0:0:0:0: [sda] tag#7 CDB: Read(10) 28 00 08 06 4c 98 00 00 08 00
|
||||
blk_update_request: I/O error, dev sda, sector 134630552
|
||||
...
|
||||
|
||||
If vmcore-dmesg.txt occupies the whole disk, the vmcore can not be
|
||||
saved, this is also a problem.
|
||||
|
||||
Lets limit the size of vmcore-dmesg.txt to avoid such problems.
|
||||
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||
---
|
||||
vmcore-dmesg/vmcore-dmesg.c | 10 ++++++++++
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
diff --git a/vmcore-dmesg/vmcore-dmesg.c b/vmcore-dmesg/vmcore-dmesg.c
|
||||
index fe7df8ec372c..81c2a58c9d86 100644
|
||||
--- a/vmcore-dmesg/vmcore-dmesg.c
|
||||
+++ b/vmcore-dmesg/vmcore-dmesg.c
|
||||
@@ -5,9 +5,19 @@ typedef Elf32_Nhdr Elf_Nhdr;
|
||||
|
||||
extern const char *fname;
|
||||
|
||||
+/* stole this macro from kernel printk.c */
|
||||
+#define LOG_BUF_LEN_MAX (uint32_t)(1 << 31)
|
||||
+
|
||||
static void write_to_stdout(char *buf, unsigned int nr)
|
||||
{
|
||||
ssize_t ret;
|
||||
+ static uint32_t n_bytes = 0;
|
||||
+
|
||||
+ n_bytes += nr;
|
||||
+ if (n_bytes > LOG_BUF_LEN_MAX) {
|
||||
+ fprintf(stderr, "The vmcore-dmesg.txt over 2G in size is not supported.\n");
|
||||
+ exit(53);
|
||||
+ }
|
||||
|
||||
ret = write(STDOUT_FILENO, buf, nr);
|
||||
if (ret != nr) {
|
||||
--
|
||||
2.17.1
|
||||
|
@ -1,99 +0,0 @@
|
||||
From cc087b11462af9f971a2c090d07e8d780a867b50 Mon Sep 17 00:00:00 2001
|
||||
From: Kairui Song <kasong@redhat.com>
|
||||
Date: Wed, 29 Jan 2020 13:38:19 +0800
|
||||
Subject: [PATCH] kexec-tools: Remove duplicated variable declarations
|
||||
|
||||
When building kexec-tools for Fedora 32, following error is observed:
|
||||
|
||||
/usr/bin/ld: kexec/arch/x86_64/kexec-bzImage64.o:(.bss+0x0): multiple definition of `bzImage_support_efi_boot';
|
||||
kexec/arch/i386/kexec-bzImage.o:(.bss+0x0): first defined here
|
||||
|
||||
/builddir/build/BUILD/kexec-tools-2.0.20/kexec/arch/arm/../../fs2dt.h:33: multiple definition of `my_debug';
|
||||
kexec/fs2dt.o:/builddir/build/BUILD/kexec-tools-2.0.20/kexec/fs2dt.h:33: first defined here
|
||||
|
||||
/builddir/build/BUILD/kexec-tools-2.0.20/kexec/arch/arm64/kexec-arm64.h:68: multiple definition of `arm64_mem';
|
||||
kexec/fs2dt.o:/builddir/build/BUILD/kexec-tools-2.0.20/././kexec/arch/arm64/kexec-arm64.h:68: first defined here
|
||||
|
||||
/builddir/build/BUILD/kexec-tools-2.0.20/kexec/arch/arm64/kexec-arm64.h:54: multiple definition of `initrd_size';
|
||||
kexec/fs2dt.o:/builddir/build/BUILD/kexec-tools-2.0.20/././kexec/arch/arm64/kexec-arm64.h:54: first defined here
|
||||
|
||||
/builddir/build/BUILD/kexec-tools-2.0.20/kexec/arch/arm64/kexec-arm64.h:53: multiple definition of `initrd_base';
|
||||
kexec/fs2dt.o:/builddir/build/BUILD/kexec-tools-2.0.20/././kexec/arch/arm64/kexec-arm64.h:53: first defined here
|
||||
|
||||
And apparently, these variables are wrongly declared multiple times. So
|
||||
remove duplicated declaration.
|
||||
|
||||
Signed-off-by: Kairui Song <kasong@redhat.com>
|
||||
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||
---
|
||||
kexec/arch/arm64/kexec-arm64.h | 6 +++---
|
||||
kexec/arch/ppc64/kexec-elf-ppc64.c | 2 --
|
||||
kexec/arch/x86_64/kexec-bzImage64.c | 1 -
|
||||
kexec/fs2dt.h | 2 +-
|
||||
4 files changed, 4 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/kexec/arch/arm64/kexec-arm64.h b/kexec/arch/arm64/kexec-arm64.h
|
||||
index 628de79..ed447ac 100644
|
||||
--- a/kexec/arch/arm64/kexec-arm64.h
|
||||
+++ b/kexec/arch/arm64/kexec-arm64.h
|
||||
@@ -50,8 +50,8 @@ int zImage_arm64_load(int argc, char **argv, const char *kernel_buf,
|
||||
void zImage_arm64_usage(void);
|
||||
|
||||
|
||||
-off_t initrd_base;
|
||||
-off_t initrd_size;
|
||||
+extern off_t initrd_base;
|
||||
+extern off_t initrd_size;
|
||||
|
||||
/**
|
||||
* struct arm64_mem - Memory layout info.
|
||||
@@ -65,7 +65,7 @@ struct arm64_mem {
|
||||
};
|
||||
|
||||
#define arm64_mem_ngv UINT64_MAX
|
||||
-struct arm64_mem arm64_mem;
|
||||
+extern struct arm64_mem arm64_mem;
|
||||
|
||||
uint64_t get_phys_offset(void);
|
||||
uint64_t get_vp_offset(void);
|
||||
diff --git a/kexec/arch/ppc64/kexec-elf-ppc64.c b/kexec/arch/ppc64/kexec-elf-ppc64.c
|
||||
index 3510b70..695b8b0 100644
|
||||
--- a/kexec/arch/ppc64/kexec-elf-ppc64.c
|
||||
+++ b/kexec/arch/ppc64/kexec-elf-ppc64.c
|
||||
@@ -44,8 +44,6 @@
|
||||
uint64_t initrd_base, initrd_size;
|
||||
unsigned char reuse_initrd = 0;
|
||||
const char *ramdisk;
|
||||
-/* Used for enabling printing message from purgatory code */
|
||||
-int my_debug = 0;
|
||||
|
||||
int elf_ppc64_probe(const char *buf, off_t len)
|
||||
{
|
||||
diff --git a/kexec/arch/x86_64/kexec-bzImage64.c b/kexec/arch/x86_64/kexec-bzImage64.c
|
||||
index 8edb3e4..ba8dc48 100644
|
||||
--- a/kexec/arch/x86_64/kexec-bzImage64.c
|
||||
+++ b/kexec/arch/x86_64/kexec-bzImage64.c
|
||||
@@ -42,7 +42,6 @@
|
||||
#include <arch/options.h>
|
||||
|
||||
static const int probe_debug = 0;
|
||||
-int bzImage_support_efi_boot;
|
||||
|
||||
int bzImage64_probe(const char *buf, off_t len)
|
||||
{
|
||||
diff --git a/kexec/fs2dt.h b/kexec/fs2dt.h
|
||||
index 7633273..fe24931 100644
|
||||
--- a/kexec/fs2dt.h
|
||||
+++ b/kexec/fs2dt.h
|
||||
@@ -30,7 +30,7 @@ extern struct bootblock bb[1];
|
||||
|
||||
/* Used for enabling printing message from purgatory code
|
||||
* Only has implemented for PPC64 */
|
||||
-int my_debug;
|
||||
+extern int my_debug;
|
||||
extern int dt_no_old_root;
|
||||
|
||||
void reserve(unsigned long long where, unsigned long long length);
|
||||
--
|
||||
2.7.5
|
||||
|
@ -1,82 +0,0 @@
|
||||
From 2572b8d702e452624bdb8d7b7c39f458e7dcf2ce Mon Sep 17 00:00:00 2001
|
||||
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
|
||||
Date: Wed, 18 Dec 2019 11:42:32 -0500
|
||||
Subject: [PATCH 3/3] arm64: kdump: deal with a lot of resource entries in
|
||||
/proc/iomem
|
||||
|
||||
As described in the commit ("arm64: kexec: allocate memory space avoiding
|
||||
reserved regions"), /proc/iomem now has a lot of "reserved" entries, and
|
||||
it's not just enough to have a fixed size of memory range array.
|
||||
|
||||
With this patch, kdump is allowed to handle arbitrary number of memory
|
||||
ranges, using mem_regions_alloc_and_xxx() functions.
|
||||
|
||||
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
|
||||
Tested-by: Bhupesh Sharma <bhsharma@redhat.com>
|
||||
Tested-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
|
||||
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||
---
|
||||
kexec/arch/arm64/crashdump-arm64.c | 25 ++++++++++---------------
|
||||
1 file changed, 10 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/kexec/arch/arm64/crashdump-arm64.c b/kexec/arch/arm64/crashdump-arm64.c
|
||||
index 4fd7aa8fd43c..38d1a0f3000d 100644
|
||||
--- a/kexec/arch/arm64/crashdump-arm64.c
|
||||
+++ b/kexec/arch/arm64/crashdump-arm64.c
|
||||
@@ -23,13 +23,8 @@
|
||||
#include "kexec-elf.h"
|
||||
#include "mem_regions.h"
|
||||
|
||||
-/* memory ranges on crashed kernel */
|
||||
-static struct memory_range system_memory_ranges[CRASH_MAX_MEMORY_RANGES];
|
||||
-static struct memory_ranges system_memory_rgns = {
|
||||
- .size = 0,
|
||||
- .max_size = CRASH_MAX_MEMORY_RANGES,
|
||||
- .ranges = system_memory_ranges,
|
||||
-};
|
||||
+/* memory ranges of crashed kernel */
|
||||
+static struct memory_ranges system_memory_rgns;
|
||||
|
||||
/* memory range reserved for crashkernel */
|
||||
struct memory_range crash_reserved_mem;
|
||||
@@ -82,7 +77,7 @@ static uint64_t get_kernel_page_offset(void)
|
||||
*
|
||||
* This function is called once for each memory region found in /proc/iomem.
|
||||
* It locates system RAM and crashkernel reserved memory and places these to
|
||||
- * variables, respectively, system_memory_ranges and crash_reserved_mem.
|
||||
+ * variables, respectively, system_memory_rgns and usablemem_rgns.
|
||||
*/
|
||||
|
||||
static int iomem_range_callback(void *UNUSED(data), int UNUSED(nr),
|
||||
@@ -90,11 +85,11 @@ static int iomem_range_callback(void *UNUSED(data), int UNUSED(nr),
|
||||
unsigned long long length)
|
||||
{
|
||||
if (strncmp(str, CRASH_KERNEL, strlen(CRASH_KERNEL)) == 0)
|
||||
- return mem_regions_add(&usablemem_rgns,
|
||||
- base, length, RANGE_RAM);
|
||||
+ return mem_regions_alloc_and_add(&usablemem_rgns,
|
||||
+ base, length, RANGE_RAM);
|
||||
else if (strncmp(str, SYSTEM_RAM, strlen(SYSTEM_RAM)) == 0)
|
||||
- return mem_regions_add(&system_memory_rgns,
|
||||
- base, length, RANGE_RAM);
|
||||
+ return mem_regions_alloc_and_add(&system_memory_rgns,
|
||||
+ base, length, RANGE_RAM);
|
||||
else if (strncmp(str, KERNEL_CODE, strlen(KERNEL_CODE)) == 0)
|
||||
elf_info.kern_paddr_start = base;
|
||||
else if (strncmp(str, KERNEL_DATA, strlen(KERNEL_DATA)) == 0)
|
||||
@@ -135,9 +130,9 @@ static int crash_get_memory_ranges(void)
|
||||
|
||||
dbgprint_mem_range("Reserved memory range", &crash_reserved_mem, 1);
|
||||
|
||||
- if (mem_regions_exclude(&system_memory_rgns, &crash_reserved_mem)) {
|
||||
- fprintf(stderr,
|
||||
- "Error: Number of crash memory ranges excedeed the max limit\n");
|
||||
+ if (mem_regions_alloc_and_exclude(&system_memory_rgns,
|
||||
+ &crash_reserved_mem)) {
|
||||
+ fprintf(stderr, "Cannot allocate memory for ranges\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
--
|
||||
2.7.4
|
||||
|
@ -1,248 +0,0 @@
|
||||
From f736104f533290b4ce6fbfbca74abde9ffd3888c Mon Sep 17 00:00:00 2001
|
||||
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
|
||||
Date: Wed, 18 Dec 2019 11:42:31 -0500
|
||||
Subject: [PATCH 2/3] arm64: kexec: allocate memory space avoiding reserved
|
||||
regions
|
||||
|
||||
On UEFI/ACPI-only system, some memory regions, including but not limited
|
||||
to UEFI memory map and ACPI tables, must be preserved across kexec'ing.
|
||||
Otherwise, they can be corrupted and result in early failure in booting
|
||||
a new kernel.
|
||||
|
||||
In recent kernels, /proc/iomem now has an extended file format like:
|
||||
|
||||
40000000-5871ffff : System RAM
|
||||
41800000-426affff : Kernel code
|
||||
426b0000-42aaffff : reserved
|
||||
42ab0000-42c64fff : Kernel data
|
||||
54400000-583fffff : Crash kernel
|
||||
58590000-585effff : reserved
|
||||
58700000-5871ffff : reserved
|
||||
58720000-58b5ffff : reserved
|
||||
58b60000-5be3ffff : System RAM
|
||||
58b61000-58b61fff : reserved
|
||||
|
||||
where the "reserved" entries at the top level or under System RAM (and
|
||||
its descendant resources) are ones of such kind and should not be regarded
|
||||
as usable memory ranges where several free spaces for loading kexec data
|
||||
will be allocated.
|
||||
|
||||
With this patch, get_memory_ranges() will handle this format of file
|
||||
correctly. Note that, for safety, unknown regions, in addition to
|
||||
"reserved" ones, will also be excluded.
|
||||
|
||||
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
|
||||
Tested-by: Bhupesh Sharma <bhsharma@redhat.com>
|
||||
Tested-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
|
||||
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||
---
|
||||
kexec/arch/arm64/kexec-arm64.c | 153 +++++++++++++++++++++++++----------------
|
||||
1 file changed, 94 insertions(+), 59 deletions(-)
|
||||
|
||||
diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c
|
||||
index 6ad3b0a134b3..45ebc54a9b6f 100644
|
||||
--- a/kexec/arch/arm64/kexec-arm64.c
|
||||
+++ b/kexec/arch/arm64/kexec-arm64.c
|
||||
@@ -10,7 +10,9 @@
|
||||
#include <inttypes.h>
|
||||
#include <libfdt.h>
|
||||
#include <limits.h>
|
||||
+#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <linux/elf-em.h>
|
||||
#include <elf.h>
|
||||
@@ -29,6 +31,7 @@
|
||||
#include "fs2dt.h"
|
||||
#include "iomem.h"
|
||||
#include "kexec-syscall.h"
|
||||
+#include "mem_regions.h"
|
||||
#include "arch/options.h"
|
||||
|
||||
#define ROOT_NODE_ADDR_CELLS_DEFAULT 1
|
||||
@@ -905,19 +908,33 @@ int get_phys_base_from_pt_load(unsigned long *phys_offset)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static bool to_be_excluded(char *str)
|
||||
+{
|
||||
+ if (!strncmp(str, SYSTEM_RAM, strlen(SYSTEM_RAM)) ||
|
||||
+ !strncmp(str, KERNEL_CODE, strlen(KERNEL_CODE)) ||
|
||||
+ !strncmp(str, KERNEL_DATA, strlen(KERNEL_DATA)) ||
|
||||
+ !strncmp(str, CRASH_KERNEL, strlen(CRASH_KERNEL)))
|
||||
+ return false;
|
||||
+ else
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
/**
|
||||
- * get_memory_ranges_iomem_cb - Helper for get_memory_ranges_iomem.
|
||||
+ * get_memory_ranges - Try to get the memory ranges from
|
||||
+ * /proc/iomem.
|
||||
*/
|
||||
-
|
||||
-static int get_memory_ranges_iomem_cb(void *data, int nr, char *str,
|
||||
- unsigned long long base, unsigned long long length)
|
||||
+int get_memory_ranges(struct memory_range **range, int *ranges,
|
||||
+ unsigned long kexec_flags)
|
||||
{
|
||||
- int ret;
|
||||
unsigned long phys_offset = UINT64_MAX;
|
||||
- struct memory_range *r;
|
||||
-
|
||||
- if (nr >= KEXEC_SEGMENT_MAX)
|
||||
- return -1;
|
||||
+ FILE *fp;
|
||||
+ const char *iomem = proc_iomem();
|
||||
+ char line[MAX_LINE], *str;
|
||||
+ unsigned long long start, end;
|
||||
+ int n, consumed;
|
||||
+ struct memory_ranges memranges;
|
||||
+ struct memory_range *last, excl_range;
|
||||
+ int ret;
|
||||
|
||||
if (!try_read_phys_offset_from_kcore) {
|
||||
/* Since kernel version 4.19, 'kcore' contains
|
||||
@@ -951,17 +968,72 @@ static int get_memory_ranges_iomem_cb(void *data, int nr, char *str,
|
||||
try_read_phys_offset_from_kcore = true;
|
||||
}
|
||||
|
||||
- r = (struct memory_range *)data + nr;
|
||||
+ fp = fopen(iomem, "r");
|
||||
+ if (!fp)
|
||||
+ die("Cannot open %s\n", iomem);
|
||||
+
|
||||
+ memranges.ranges = NULL;
|
||||
+ memranges.size = memranges.max_size = 0;
|
||||
+
|
||||
+ while (fgets(line, sizeof(line), fp) != 0) {
|
||||
+ n = sscanf(line, "%llx-%llx : %n", &start, &end, &consumed);
|
||||
+ if (n != 2)
|
||||
+ continue;
|
||||
+ str = line + consumed;
|
||||
+
|
||||
+ if (!strncmp(str, SYSTEM_RAM, strlen(SYSTEM_RAM))) {
|
||||
+ ret = mem_regions_alloc_and_add(&memranges,
|
||||
+ start, end - start + 1, RANGE_RAM);
|
||||
+ if (ret) {
|
||||
+ fprintf(stderr,
|
||||
+ "Cannot allocate memory for ranges\n");
|
||||
+ fclose(fp);
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
|
||||
- if (!strncmp(str, SYSTEM_RAM, strlen(SYSTEM_RAM)))
|
||||
- r->type = RANGE_RAM;
|
||||
- else if (!strncmp(str, IOMEM_RESERVED, strlen(IOMEM_RESERVED)))
|
||||
- r->type = RANGE_RESERVED;
|
||||
- else
|
||||
- return 1;
|
||||
+ dbgprintf("%s:+[%d] %016llx - %016llx\n", __func__,
|
||||
+ memranges.size - 1,
|
||||
+ memranges.ranges[memranges.size - 1].start,
|
||||
+ memranges.ranges[memranges.size - 1].end);
|
||||
+ } else if (to_be_excluded(str)) {
|
||||
+ if (!memranges.size)
|
||||
+ continue;
|
||||
+
|
||||
+ /*
|
||||
+ * Note: mem_regions_exclude() doesn't guarantee
|
||||
+ * that the ranges are sorted out, but as long as
|
||||
+ * we cope with /proc/iomem, we only operate on
|
||||
+ * the last entry and so it is safe.
|
||||
+ */
|
||||
|
||||
- r->start = base;
|
||||
- r->end = base + length - 1;
|
||||
+ /* The last System RAM range */
|
||||
+ last = &memranges.ranges[memranges.size - 1];
|
||||
+
|
||||
+ if (last->end < start)
|
||||
+ /* New resource outside of System RAM */
|
||||
+ continue;
|
||||
+ if (end < last->start)
|
||||
+ /* Already excluded by parent resource */
|
||||
+ continue;
|
||||
+
|
||||
+ excl_range.start = start;
|
||||
+ excl_range.end = end;
|
||||
+ ret = mem_regions_alloc_and_exclude(&memranges, &excl_range);
|
||||
+ if (ret) {
|
||||
+ fprintf(stderr,
|
||||
+ "Cannot allocate memory for ranges (exclude)\n");
|
||||
+ fclose(fp);
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+ dbgprintf("%s:- %016llx - %016llx\n",
|
||||
+ __func__, start, end);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ fclose(fp);
|
||||
+
|
||||
+ *range = memranges.ranges;
|
||||
+ *ranges = memranges.size;
|
||||
|
||||
/* As a fallback option, we can try determining the PHYS_OFFSET
|
||||
* value from the '/proc/iomem' entries as well.
|
||||
@@ -982,52 +1054,15 @@ static int get_memory_ranges_iomem_cb(void *data, int nr, char *str,
|
||||
* between the user-space and kernel space 'PHYS_OFFSET'
|
||||
* value.
|
||||
*/
|
||||
- set_phys_offset(r->start, "iomem");
|
||||
-
|
||||
- dbgprintf("%s: %016llx - %016llx : %s", __func__, r->start,
|
||||
- r->end, str);
|
||||
-
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-/**
|
||||
- * get_memory_ranges_iomem - Try to get the memory ranges from
|
||||
- * /proc/iomem.
|
||||
- */
|
||||
+ if (memranges.size)
|
||||
+ set_phys_offset(memranges.ranges[0].start, "iomem");
|
||||
|
||||
-static int get_memory_ranges_iomem(struct memory_range *array,
|
||||
- unsigned int *count)
|
||||
-{
|
||||
- *count = kexec_iomem_for_each_line(NULL,
|
||||
- get_memory_ranges_iomem_cb, array);
|
||||
-
|
||||
- if (!*count) {
|
||||
- dbgprintf("%s: failed: No RAM found.\n", __func__);
|
||||
- return EFAILED;
|
||||
- }
|
||||
+ dbgprint_mem_range("System RAM ranges;",
|
||||
+ memranges.ranges, memranges.size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
-/**
|
||||
- * get_memory_ranges - Try to get the memory ranges some how.
|
||||
- */
|
||||
-
|
||||
-int get_memory_ranges(struct memory_range **range, int *ranges,
|
||||
- unsigned long kexec_flags)
|
||||
-{
|
||||
- static struct memory_range array[KEXEC_SEGMENT_MAX];
|
||||
- unsigned int count;
|
||||
- int result;
|
||||
-
|
||||
- result = get_memory_ranges_iomem(array, &count);
|
||||
-
|
||||
- *range = result ? NULL : array;
|
||||
- *ranges = result ? 0 : count;
|
||||
-
|
||||
- return result;
|
||||
-}
|
||||
-
|
||||
int arch_compat_trampoline(struct kexec_info *info)
|
||||
{
|
||||
return 0;
|
||||
--
|
||||
2.7.4
|
||||
|
@ -1,25 +0,0 @@
|
||||
From f54ad866c428ecd64a01cfdf7fc6b0a64f5e0fe5 Mon Sep 17 00:00:00 2001
|
||||
From: Pingfan Liu <piliu@redhat.com>
|
||||
Date: Tue, 15 Dec 2020 14:13:13 +0800
|
||||
Subject: [PATCH] fix
|
||||
|
||||
---
|
||||
eppic/libeppic/eppic.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/eppic/libeppic/eppic.h b/eppic/libeppic/eppic.h
|
||||
index 06320f2..74a3c1c 100644
|
||||
--- a/eppic/libeppic/eppic.h
|
||||
+++ b/eppic/libeppic/eppic.h
|
||||
@@ -467,7 +467,7 @@ type_t *eppic_addstorage(type_t *t1, type_t *t2);
|
||||
type_t *eppic_getvoidstruct(int ctype);
|
||||
|
||||
extern int lineno, needvar, instruct, nomacs, eppic_legacy;
|
||||
-node_t *lastv;
|
||||
+extern node_t *lastv;
|
||||
|
||||
#define NULLNODE ((node_t*)0)
|
||||
|
||||
--
|
||||
2.29.2
|
||||
|
@ -1,89 +0,0 @@
|
||||
From cf977b1af9ec67fabcc6a625589c49c52d07b11d Mon Sep 17 00:00:00 2001
|
||||
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
|
||||
Date: Wed, 18 Dec 2019 11:42:30 -0500
|
||||
Subject: [PATCH 1/3] kexec: add variant helper functions for handling memory
|
||||
regions
|
||||
|
||||
mem_regions_alloc_and_add() and mem_regions_alloc_and_exclude() are
|
||||
functionally equivalent to, respectively, mem_regions_add() and
|
||||
mem_regions_exclude() except the formers will re-allocate memory
|
||||
dynamically when no more entries are available in 'ranges' array.
|
||||
|
||||
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
|
||||
Tested-by: Bhupesh Sharma <bhsharma@redhat.com>
|
||||
Tested-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
|
||||
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||
---
|
||||
kexec/mem_regions.c | 42 ++++++++++++++++++++++++++++++++++++++++++
|
||||
kexec/mem_regions.h | 7 +++++++
|
||||
2 files changed, 49 insertions(+)
|
||||
|
||||
diff --git a/kexec/mem_regions.c b/kexec/mem_regions.c
|
||||
index 50c8abccb93a..ad7d3f13fd84 100644
|
||||
--- a/kexec/mem_regions.c
|
||||
+++ b/kexec/mem_regions.c
|
||||
@@ -125,3 +125,45 @@ int mem_regions_exclude(struct memory_ranges *ranges,
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+#define KEXEC_MEMORY_RANGES 16
|
||||
+
|
||||
+int mem_regions_alloc_and_add(struct memory_ranges *ranges,
|
||||
+ unsigned long long base,
|
||||
+ unsigned long long length, int type)
|
||||
+{
|
||||
+ void *new_ranges;
|
||||
+
|
||||
+ if (ranges->size >= ranges->max_size) {
|
||||
+ new_ranges = realloc(ranges->ranges,
|
||||
+ sizeof(struct memory_range) *
|
||||
+ (ranges->max_size + KEXEC_MEMORY_RANGES));
|
||||
+ if (!new_ranges)
|
||||
+ return -1;
|
||||
+
|
||||
+ ranges->ranges = new_ranges;
|
||||
+ ranges->max_size += KEXEC_MEMORY_RANGES;
|
||||
+ }
|
||||
+
|
||||
+ return mem_regions_add(ranges, base, length, type);
|
||||
+}
|
||||
+
|
||||
+int mem_regions_alloc_and_exclude(struct memory_ranges *ranges,
|
||||
+ const struct memory_range *range)
|
||||
+{
|
||||
+ void *new_ranges;
|
||||
+
|
||||
+ /* for safety, we should have at least one free entry in ranges */
|
||||
+ if (ranges->size >= ranges->max_size) {
|
||||
+ new_ranges = realloc(ranges->ranges,
|
||||
+ sizeof(struct memory_range) *
|
||||
+ (ranges->max_size + KEXEC_MEMORY_RANGES));
|
||||
+ if (!new_ranges)
|
||||
+ return -1;
|
||||
+
|
||||
+ ranges->ranges = new_ranges;
|
||||
+ ranges->max_size += KEXEC_MEMORY_RANGES;
|
||||
+ }
|
||||
+
|
||||
+ return mem_regions_exclude(ranges, range);
|
||||
+}
|
||||
diff --git a/kexec/mem_regions.h b/kexec/mem_regions.h
|
||||
index ae9e972b0206..e306d67e3261 100644
|
||||
--- a/kexec/mem_regions.h
|
||||
+++ b/kexec/mem_regions.h
|
||||
@@ -12,4 +12,11 @@ int mem_regions_exclude(struct memory_ranges *ranges,
|
||||
int mem_regions_add(struct memory_ranges *ranges, unsigned long long base,
|
||||
unsigned long long length, int type);
|
||||
|
||||
+int mem_regions_alloc_and_exclude(struct memory_ranges *ranges,
|
||||
+ const struct memory_range *range);
|
||||
+
|
||||
+int mem_regions_alloc_and_add(struct memory_ranges *ranges,
|
||||
+ unsigned long long base,
|
||||
+ unsigned long long length, int type);
|
||||
+
|
||||
#endif
|
||||
--
|
||||
2.7.4
|
||||
|
@ -1,38 +0,0 @@
|
||||
From a46c686f615a86933134c0924c3391ba598a02b8 Mon Sep 17 00:00:00 2001
|
||||
From: Bhupesh Sharma <bhsharma@redhat.com>
|
||||
Date: Tue, 10 Sep 2019 15:51:49 +0530
|
||||
Subject: [PATCH 5/5] vmcore-dmesg/vmcore-dmesg.c: Fix shifting error reported
|
||||
by cppcheck
|
||||
|
||||
Running 'cppcheck' static code analyzer (see cppcheck(1))
|
||||
on 'vmcore-dmesg/vmcore-dmesg.c' shows the following
|
||||
shifting error:
|
||||
|
||||
$ cppcheck --enable=all vmcore-dmesg/vmcore-dmesg.c
|
||||
Checking vmcore-dmesg/vmcore-dmesg.c ...
|
||||
[vmcore-dmesg/vmcore-dmesg.c:17]: (error) Shifting signed 32-bit value by 31 bits is undefined behaviour
|
||||
|
||||
Fix the same via this patch.
|
||||
|
||||
Signed-off-by: Bhupesh Sharma <bhsharma@redhat.com>
|
||||
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||
---
|
||||
vmcore-dmesg/vmcore-dmesg.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/vmcore-dmesg/vmcore-dmesg.c b/vmcore-dmesg/vmcore-dmesg.c
|
||||
index 81c2a58c9d86..122e53672e01 100644
|
||||
--- a/vmcore-dmesg/vmcore-dmesg.c
|
||||
+++ b/vmcore-dmesg/vmcore-dmesg.c
|
||||
@@ -6,7 +6,7 @@ typedef Elf32_Nhdr Elf_Nhdr;
|
||||
extern const char *fname;
|
||||
|
||||
/* stole this macro from kernel printk.c */
|
||||
-#define LOG_BUF_LEN_MAX (uint32_t)(1 << 31)
|
||||
+#define LOG_BUF_LEN_MAX (uint32_t)(1U << 31)
|
||||
|
||||
static void write_to_stdout(char *buf, unsigned int nr)
|
||||
{
|
||||
--
|
||||
2.17.1
|
||||
|
@ -0,0 +1,72 @@
|
||||
From 58553ad03187f0cf208d6c4a0dc026c6338e5edd Mon Sep 17 00:00:00 2001
|
||||
From: "Daisuke Hatayama (Fujitsu)" <d.hatayama@fujitsu.com>
|
||||
Date: Wed, 29 Mar 2023 12:44:10 +0000
|
||||
Subject: [PATCH] [PATCH] sadump: fix failure of reading memory when 5-level
|
||||
paging is enabled
|
||||
|
||||
makedumpfile fails as follows for memory dumps collected by sadump
|
||||
when 5-level paging is enabled on the corresponding systems:
|
||||
|
||||
# makedumpfile -l -d 31 -x ./vmlinux ./dump.sadump dump.sadump-ld31
|
||||
__vtop4_x86_64: Can't get a valid pgd.
|
||||
...snip...
|
||||
__vtop4_x86_64: Can't get a valid pgd.
|
||||
calc_kaslr_offset: failed to calculate kaslr_offset and phys_base; default to 0
|
||||
__vtop4_x86_64: Can't get a valid pgd.
|
||||
readmem: Can't convert a virtual address(ffffffff82fce960) to physical address.
|
||||
readmem: type_addr: 0, addr:ffffffff82fce960, size:1024
|
||||
cpu_online_mask_init: Can't read cpu_online_mask memory.
|
||||
|
||||
makedumpfile Failed.
|
||||
|
||||
This is because 5-level paging support has not been done yet for
|
||||
sadump; the work of the 5-level paging support was done by the commit
|
||||
30a3214a7193e94c551c0cebda5918a72a35c589 (PATCH 4/4 arch/x86_64: Add
|
||||
5-level paging support) but that was focused on the core part only.
|
||||
|
||||
Having said that, most of things has already been finished in the
|
||||
commit. What needs to be newly added for sadump is just how to check
|
||||
if 5-level paging is enabled for a given memory dump.
|
||||
|
||||
For that purpose, let's refer to CR4.LA57, bit 12 of CR4, representing
|
||||
whether 5-level paging is enabled or not. We can do this because
|
||||
memory dumps collected by sadump have SMRAM as note information and
|
||||
they include CR4 together with the other control registers.
|
||||
|
||||
Signed-off-by: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
|
||||
---
|
||||
sadump_info.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/makedumpfile-1.7.2/sadump_info.c b/makedumpfile-1.7.2/sadump_info.c
|
||||
index adfa8dc..2c44068 100644
|
||||
--- a/makedumpfile-1.7.2/sadump_info.c
|
||||
+++ b/makedumpfile-1.7.2/sadump_info.c
|
||||
@@ -1362,6 +1362,7 @@ static int linux_banner_sanity_check(ulong cr3)
|
||||
#define PTI_USER_PGTABLE_BIT (info->page_shift)
|
||||
#define PTI_USER_PGTABLE_MASK (1 << PTI_USER_PGTABLE_BIT)
|
||||
#define CR3_PCID_MASK 0xFFFull
|
||||
+#define CR4_LA57 (1 << 12)
|
||||
int
|
||||
calc_kaslr_offset(void)
|
||||
{
|
||||
@@ -1397,6 +1398,8 @@ calc_kaslr_offset(void)
|
||||
else
|
||||
cr3 = smram.Cr3 & ~CR3_PCID_MASK;
|
||||
|
||||
+ NUMBER(pgtable_l5_enabled) = !!(smram.Cr4 & CR4_LA57);
|
||||
+
|
||||
/* Convert virtual address of IDT table to physical address */
|
||||
idtr_paddr = vtop4_x86_64_pagetable(idtr, cr3);
|
||||
if (idtr_paddr == NOT_PADDR) {
|
||||
@@ -1417,6 +1420,7 @@ calc_kaslr_offset(void)
|
||||
|
||||
DEBUG_MSG("sadump: idtr=%" PRIx64 "\n", idtr);
|
||||
DEBUG_MSG("sadump: cr3=%" PRIx64 "\n", cr3);
|
||||
+ DEBUG_MSG("sadump: cr4=%" PRIx32 "\n", smram.Cr4);
|
||||
DEBUG_MSG("sadump: idtr(phys)=%" PRIx64 "\n", idtr_paddr);
|
||||
DEBUG_MSG("sadump: devide_error(vmlinux)=%lx\n",
|
||||
divide_error_vmlinux);
|
||||
--
|
||||
2.31.1
|
||||
|
@ -29,7 +29,7 @@ SAVE_PATH=$(get_save_path)
|
||||
OVERRIDE_RESETTABLE=0
|
||||
|
||||
extra_modules=""
|
||||
dracut_args="--add kdumpbase --quiet --hostonly --hostonly-cmdline --hostonly-i18n --hostonly-mode strict -o \"plymouth dash resume ifcfg earlykdump\""
|
||||
dracut_args="--add kdumpbase --quiet --hostonly --hostonly-cmdline --hostonly-i18n --hostonly-mode strict --hostonly-nics '' -o \"plymouth dash resume ifcfg earlykdump\" --compress=xz"
|
||||
|
||||
readonly MKDUMPRD_TMPDIR="$(mktemp -d -t mkdumprd.XXXXXX)"
|
||||
[ -d "$MKDUMPRD_TMPDIR" ] || perror_exit "dracut: mktemp -p -d -t dracut.XXXXXX failed."
|
||||
@ -68,8 +68,8 @@ to_mount() {
|
||||
|
||||
if [[ "$_fstype" == "nfs"* ]]; then
|
||||
_pdev=$_target
|
||||
_options=$(echo $_options | sed 's/,addr=[^,]*//')
|
||||
_options=$(echo $_options | sed 's/,proto=[^,]*//')
|
||||
_options=$(echo $_options | sed 's/,\(mount\)\?addr=[^,]*//g')
|
||||
_options=$(echo $_options | sed 's/,\(mount\)\?proto=[^,]*//g')
|
||||
_options=$(echo $_options | sed 's/,clientaddr=[^,]*//')
|
||||
else
|
||||
# for non-nfs _target converting to use udev persistent name
|
||||
@ -240,7 +240,7 @@ check_user_configured_target()
|
||||
# $1: core_collector config value
|
||||
verify_core_collector() {
|
||||
local _cmd="${1%% *}"
|
||||
local _params="${1#* }"
|
||||
local _params="${1#${_cmd}}"
|
||||
|
||||
if [ "$_cmd" != "makedumpfile" ]; then
|
||||
if is_raw_dump_target; then
|
||||
@ -305,7 +305,6 @@ get_override_resettable()
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# $1: function name
|
||||
for_each_block_target()
|
||||
{
|
||||
@ -320,8 +319,6 @@ for_each_block_target()
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
|
||||
#judge if a specific device with $1 is unresettable
|
||||
#return false if unresettable.
|
||||
is_unresettable()
|
||||
@ -358,32 +355,15 @@ check_resettable()
|
||||
return 1
|
||||
}
|
||||
|
||||
# $1: maj:min
|
||||
is_crypt()
|
||||
{
|
||||
local majmin=$1 dev line ID_FS_TYPE=""
|
||||
|
||||
line=$(udevadm info --query=property --path=/sys/dev/block/$majmin \
|
||||
| grep "^ID_FS_TYPE")
|
||||
eval "$line"
|
||||
[[ "$ID_FS_TYPE" = "crypto_LUKS" ]] && {
|
||||
dev=$(udevadm info --query=all --path=/sys/dev/block/$majmin | awk -F= '/DEVNAME/{print $2}')
|
||||
derror "Device $dev is encrypted."
|
||||
return 0
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
check_crypt()
|
||||
{
|
||||
local _ret _target
|
||||
local _dev
|
||||
|
||||
for_each_block_target is_crypt
|
||||
_ret=$?
|
||||
|
||||
[ $_ret -eq 0 ] && return
|
||||
|
||||
return 1
|
||||
for _dev in $(get_kdump_targets); do
|
||||
if [[ -n $(get_luks_crypt_dev "$(get_maj_min "$_dev")") ]]; then
|
||||
derror "Device $_dev is encrypted." && return 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
if ! check_resettable; then
|
||||
@ -452,16 +432,21 @@ then
|
||||
add_dracut_arg "--add-drivers" \"$extra_modules\"
|
||||
fi
|
||||
|
||||
# TODO: The below check is not needed anymore with the introduction of
|
||||
# 'zz-fadumpinit' module, that isolates fadump's capture kernel initrd,
|
||||
# but still sysroot.mount unit gets generated based on 'root=' kernel
|
||||
# parameter available in fadump case. So, find a way to fix that first
|
||||
# before removing this check.
|
||||
if ! is_fadump_capable; then
|
||||
# The 2nd rootfs mount stays behind the normal dump target mount,
|
||||
# so it doesn't affect the logic of check_dump_fs_modified().
|
||||
is_dump_to_rootfs && add_mount "$(to_dev_name $(get_root_fs_device))"
|
||||
|
||||
add_dracut_arg "--no-hostonly-default-device"
|
||||
add_dracut_arg "--no-hostonly-default-device"
|
||||
|
||||
if fips-mode-setup --is-enabled 2> /dev/null; then
|
||||
add_dracut_arg --add-device "$(findmnt -n -o SOURCE --target /boot)"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "$dracut_args $@" | xargs dracut
|
||||
|
||||
_rc=$?
|
||||
sync
|
||||
exit $_rc
|
||||
|
64
SOURCES/mkfadumprd
Normal file
64
SOURCES/mkfadumprd
Normal file
@ -0,0 +1,64 @@
|
||||
#!/bin/bash --norc
|
||||
# Generate an initramfs image that isolates dump capture capability within
|
||||
# the default initramfs using zz-fadumpinit dracut module.
|
||||
|
||||
if [ -f /etc/sysconfig/kdump ]; then
|
||||
. /etc/sysconfig/kdump
|
||||
fi
|
||||
|
||||
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
|
||||
. $dracutbasedir/dracut-functions.sh
|
||||
. /lib/kdump/kdump-lib.sh
|
||||
. /lib/kdump/kdump-logger.sh
|
||||
|
||||
#initiate the kdump logger
|
||||
if ! dlog_init; then
|
||||
echo "mkfadumprd: failed to initiate the kdump logger."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
readonly MKFADUMPRD_TMPDIR="$(mktemp -d -t mkfadumprd.XXXXXX)"
|
||||
[ -d "$MKFADUMPRD_TMPDIR" ] || perror_exit "mkfadumprd: mktemp -d -t mkfadumprd.XXXXXX failed."
|
||||
trap '
|
||||
ret=$?;
|
||||
[[ -d $MKFADUMPRD_TMPDIR ]] && rm --one-file-system -rf -- "$MKFADUMPRD_TMPDIR";
|
||||
exit $ret;
|
||||
' EXIT
|
||||
|
||||
# clean up after ourselves no matter how we die.
|
||||
trap 'exit 1;' SIGINT
|
||||
|
||||
MKDUMPRD="/sbin/mkdumprd -f"
|
||||
# Default boot initramfs to be rebuilt
|
||||
REBUILD_INITRD="$1" && shift
|
||||
TARGET_INITRD="$1" && shift
|
||||
FADUMP_INITRD="$MKFADUMPRD_TMPDIR/fadump.img"
|
||||
|
||||
### First build an initramfs with dump capture capability
|
||||
# this file tells the initrd is fadump enabled
|
||||
touch "$MKFADUMPRD_TMPDIR/fadump.initramfs"
|
||||
ddebug "rebuild fadump initrd: $FADUMP_INITRD $DEFAULT_INITRD $KDUMP_KERNELVER"
|
||||
if ! $MKDUMPRD "$FADUMP_INITRD" -i "$MKFADUMPRD_TMPDIR/fadump.initramfs" /etc/fadump.initramfs; then
|
||||
perror_exit "mkfadumprd: failed to build image with dump capture support"
|
||||
fi
|
||||
|
||||
### Unpack the initramfs having dump capture capability
|
||||
mkdir -p "$MKFADUMPRD_TMPDIR/fadumproot"
|
||||
if ! (pushd "$MKFADUMPRD_TMPDIR/fadumproot" > /dev/null && lsinitrd --unpack "$FADUMP_INITRD" && \
|
||||
popd > /dev/null); then
|
||||
derror "mkfadumprd: failed to unpack '$MKFADUMPRD_TMPDIR'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
### Pack it into the normal boot initramfs with zz-fadumpinit module
|
||||
_dracut_isolate_args="--rebuild $REBUILD_INITRD --add zz-fadumpinit \
|
||||
-i $MKFADUMPRD_TMPDIR/fadumproot /fadumproot \
|
||||
-i $MKFADUMPRD_TMPDIR/fadumproot/usr/lib/dracut/loaded-kernel-modules.txt
|
||||
/usr/lib/dracut/fadump-kernel-modules.txt"
|
||||
|
||||
if is_squash_available; then
|
||||
_dracut_isolate_args="$_dracut_isolate_args --add squash"
|
||||
fi
|
||||
if ! dracut --force --quiet $_dracut_isolate_args $@ "$TARGET_INITRD"; then
|
||||
perror_exit "mkfadumprd: failed to setup '$TARGET_INITRD' with dump capture capability"
|
||||
fi
|
@ -1,27 +1,30 @@
|
||||
From 16028a119c85ed73944bcf6ca310a7ee4d2e64fe Mon Sep 17 00:00:00 2001
|
||||
From 0f632fa180e5a44219ab6bbe0879c3583f8c65cf Mon Sep 17 00:00:00 2001
|
||||
From: Pingfan Liu <piliu@redhat.com>
|
||||
Date: Mon, 21 Dec 2020 13:35:38 +0800
|
||||
Date: Tue, 9 Nov 2021 11:24:22 +0800
|
||||
Subject: [PATCH] RHEL-only
|
||||
|
||||
Cope with RHEL8 kernel
|
||||
|
||||
Signed-off-by: Pingfan Liu <piliu@redhat.com>
|
||||
---
|
||||
arch/arm64.c | 14 +++++++++++++-
|
||||
makedumpfile.c | 2 ++
|
||||
makedumpfile.h | 1 +
|
||||
3 files changed, 16 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/makedumpfile-1.6.8/arch/arm64.c b/makedumpfile-1.6.8/arch/arm64.c
|
||||
index 3d7b416..c8e7f62 100644
|
||||
--- a/makedumpfile-1.6.8/arch/arm64.c
|
||||
+++ b/makedumpfile-1.6.8/arch/arm64.c
|
||||
@@ -48,6 +48,7 @@ static int lpa_52_bit_support_available;
|
||||
static int pgtable_level;
|
||||
static int va_bits;
|
||||
diff --git a/makedumpfile-1.7.2/arch/arm64.c b/makedumpfile-1.7.2/arch/arm64.c
|
||||
index 1072178..95beae6 100644
|
||||
--- a/makedumpfile-1.7.2/arch/arm64.c
|
||||
+++ b/makedumpfile-1.7.2/arch/arm64.c
|
||||
@@ -50,6 +50,7 @@ static int va_bits;
|
||||
static int vabits_actual;
|
||||
static int flipped_va;
|
||||
static unsigned long kimage_voffset;
|
||||
+static int max_user_va_bits;
|
||||
|
||||
#define SZ_4K 4096
|
||||
#define SZ_16K 16384
|
||||
@@ -107,7 +108,7 @@ typedef unsigned long pgdval_t;
|
||||
@@ -108,7 +109,7 @@ typedef unsigned long pgdval_t;
|
||||
#define PGDIR_SHIFT ARM64_HW_PGTABLE_LEVEL_SHIFT(4 - (pgtable_level))
|
||||
#define PGDIR_SIZE (_AC(1, UL) << PGDIR_SHIFT)
|
||||
#define PGDIR_MASK (~(PGDIR_SIZE-1))
|
||||
@ -30,7 +33,7 @@ index 3d7b416..c8e7f62 100644
|
||||
|
||||
/*
|
||||
* Section address mask and size definitions.
|
||||
@@ -366,6 +367,17 @@ get_machdep_info_arm64(void)
|
||||
@@ -449,6 +450,17 @@ get_machdep_info_arm64(void)
|
||||
ERRMSG("Can't determine platform config values\n");
|
||||
return FALSE;
|
||||
}
|
||||
@ -48,38 +51,38 @@ index 3d7b416..c8e7f62 100644
|
||||
|
||||
kimage_voffset = NUMBER(kimage_voffset);
|
||||
info->section_size_bits = SECTIONS_SIZE_BITS;
|
||||
diff --git a/makedumpfile-1.6.8/makedumpfile.c b/makedumpfile-1.6.8/makedumpfile.c
|
||||
index cdde040..9fd3ae9 100644
|
||||
--- a/makedumpfile-1.6.8/makedumpfile.c
|
||||
+++ b/makedumpfile-1.6.8/makedumpfile.c
|
||||
@@ -2322,6 +2322,7 @@ write_vmcoreinfo_data(void)
|
||||
diff --git a/makedumpfile-1.7.2/makedumpfile.c b/makedumpfile-1.7.2/makedumpfile.c
|
||||
index 3ad4443..018ea4c 100644
|
||||
--- a/makedumpfile-1.7.2/makedumpfile.c
|
||||
+++ b/makedumpfile-1.7.2/makedumpfile.c
|
||||
@@ -2417,6 +2417,7 @@ write_vmcoreinfo_data(void)
|
||||
|
||||
WRITE_NUMBER("HUGETLB_PAGE_DTOR", HUGETLB_PAGE_DTOR);
|
||||
#ifdef __aarch64__
|
||||
+ WRITE_NUMBER("MAX_USER_VA_BITS", MAX_USER_VA_BITS);
|
||||
WRITE_NUMBER("VA_BITS", VA_BITS);
|
||||
/* WRITE_NUMBER("TCR_EL1_T1SZ", TCR_EL1_T1SZ); should not exists */
|
||||
WRITE_NUMBER_UNSIGNED("PHYS_OFFSET", PHYS_OFFSET);
|
||||
WRITE_NUMBER_UNSIGNED("kimage_voffset", kimage_voffset);
|
||||
@@ -2728,6 +2729,7 @@ read_vmcoreinfo(void)
|
||||
@@ -2863,6 +2864,7 @@ read_vmcoreinfo(void)
|
||||
READ_NUMBER("phys_base", phys_base);
|
||||
READ_NUMBER("KERNEL_IMAGE_SIZE", KERNEL_IMAGE_SIZE);
|
||||
#ifdef __aarch64__
|
||||
+ READ_NUMBER("MAX_USER_VA_BITS", MAX_USER_VA_BITS);
|
||||
READ_NUMBER("VA_BITS", VA_BITS);
|
||||
READ_NUMBER("TCR_EL1_T1SZ", TCR_EL1_T1SZ);
|
||||
READ_NUMBER_UNSIGNED("PHYS_OFFSET", PHYS_OFFSET);
|
||||
READ_NUMBER_UNSIGNED("kimage_voffset", kimage_voffset);
|
||||
diff --git a/makedumpfile-1.6.8/makedumpfile.h b/makedumpfile-1.6.8/makedumpfile.h
|
||||
index 698c054..2763a47 100644
|
||||
--- a/makedumpfile-1.6.8/makedumpfile.h
|
||||
+++ b/makedumpfile-1.6.8/makedumpfile.h
|
||||
@@ -1937,6 +1937,7 @@ struct number_table {
|
||||
diff --git a/makedumpfile-1.7.2/makedumpfile.h b/makedumpfile-1.7.2/makedumpfile.h
|
||||
index e59239d..b6236dd 100644
|
||||
--- a/makedumpfile-1.7.2/makedumpfile.h
|
||||
+++ b/makedumpfile-1.7.2/makedumpfile.h
|
||||
@@ -2064,6 +2064,7 @@ struct number_table {
|
||||
long phys_base;
|
||||
long KERNEL_IMAGE_SIZE;
|
||||
#ifdef __aarch64__
|
||||
+ long MAX_USER_VA_BITS;
|
||||
long VA_BITS;
|
||||
long TCR_EL1_T1SZ;
|
||||
unsigned long PHYS_OFFSET;
|
||||
unsigned long kimage_voffset;
|
||||
--
|
||||
2.21.0
|
||||
2.31.1
|
||||
|
||||
|
@ -35,7 +35,8 @@ updating lists accordingly.
|
||||
Supported Dump targets
|
||||
----------------------
|
||||
storage:
|
||||
LVM volume (no thinp)
|
||||
LVM volume
|
||||
Thin provisioning volume
|
||||
FC disks (qla2xxx, lpfc, bnx2fc, bfa)
|
||||
software initiator based iSCSI
|
||||
software RAID (mdraid)
|
||||
@ -79,7 +80,6 @@ Unsupported Dump targets
|
||||
------------------------
|
||||
storage:
|
||||
BIOS RAID
|
||||
Thin provisioning volume
|
||||
Software iSCSI with iBFT (bnx2i, cxgb3i, cxgb4i)
|
||||
Software iSCSI with hybrid (be2iscsi)
|
||||
FCoE
|
||||
|
@ -1,6 +1,6 @@
|
||||
Name: kexec-tools
|
||||
Version: 2.0.20
|
||||
Release: 46%{?dist}.1
|
||||
Version: 2.0.26
|
||||
Release: 14%{?dist}.2
|
||||
License: GPLv2
|
||||
Group: Applications/System
|
||||
Summary: The kexec/kdump userspace component
|
||||
@ -12,8 +12,8 @@ Source3: kdump.sysconfig.x86_64
|
||||
Source4: kdump.sysconfig.i386
|
||||
Source5: kdump.sysconfig.ppc64
|
||||
Source7: mkdumprd
|
||||
Source8: kdump.conf
|
||||
Source9: https://github.com/makedumpfile/makedumpfile/archive/1.6.8.tar.gz
|
||||
Source8: gen-kdump-conf.sh
|
||||
Source9: https://github.com/makedumpfile/makedumpfile/archive/1.7.2.tar.gz
|
||||
Source10: kexec-kdump-howto.txt
|
||||
Source12: mkdumprd.8
|
||||
Source13: 98-kexec.rules
|
||||
@ -36,6 +36,9 @@ Source30: kdump.sysconfig.aarch64
|
||||
Source31: fadump-howto.txt
|
||||
Source32: 60-kdump.install
|
||||
Source33: kdump-logger.sh
|
||||
Source34: kdump-migrate-action.sh
|
||||
Source35: kdump-restart.sh
|
||||
Source36: mkfadumprd
|
||||
|
||||
#######################################
|
||||
# These are sources for mkdumpramfs
|
||||
@ -52,6 +55,14 @@ Source107: dracut-kdump-emergency.target
|
||||
Source108: dracut-early-kdump.sh
|
||||
Source109: dracut-early-kdump-module-setup.sh
|
||||
|
||||
Source200: dracut-fadump-init-fadump.sh
|
||||
Source201: dracut-fadump-module-setup.sh
|
||||
|
||||
%ifarch ppc64 ppc64le
|
||||
Requires(post): servicelog
|
||||
Recommends: keyutils
|
||||
%endif
|
||||
|
||||
Requires(post): systemd-units
|
||||
Requires(preun): systemd-units
|
||||
Requires(postun): systemd-units
|
||||
@ -60,7 +71,7 @@ Requires: dracut >= 049-129
|
||||
Requires: dracut-network >= 049
|
||||
Requires: dracut-squash >= 049
|
||||
Requires: ethtool
|
||||
BuildRequires: zlib-devel zlib zlib-static elfutils-devel glib2-devel bzip2-devel ncurses-devel bison flex lzo-devel snappy-devel
|
||||
BuildRequires: zlib-devel zlib zlib-static elfutils-devel glib2-devel bzip2-devel ncurses-devel bison flex lzo-devel snappy-devel libzstd-devel
|
||||
BuildRequires: pkgconfig intltool gettext
|
||||
BuildRequires: systemd-units
|
||||
BuildRequires: automake autoconf libtool
|
||||
@ -87,6 +98,7 @@ ExcludeArch: i686
|
||||
#
|
||||
# Patches 401 through 500 are meant for s390 kexec-tools enablement
|
||||
#
|
||||
|
||||
#
|
||||
# Patches 501 through 600 are meant for ARM kexec-tools enablement
|
||||
#
|
||||
@ -96,22 +108,10 @@ ExcludeArch: i686
|
||||
#
|
||||
Patch601: rhelonly-kexec-tools-2.0.16-koji-build-fail-workaround.patch
|
||||
Patch602: rhelonly-kexec-tools-2.0.18-eppic-fix-issues-with-hardening-flags.patch
|
||||
#Patch603: rhonly-kexec-tools-2.0.18-makedumpfile-arm64-Add-support-for-ARMv8.2-LVA-52-bi.patch
|
||||
Patch604: kexec-tools-2.0.20-Cleanup-remove-the-read_elf_kcore.patch
|
||||
Patch605: kexec-tools-2.0.20-Fix-an-error-definition-about-the-variable-fname.patch
|
||||
Patch606: kexec-tools-2.0.20-Cleanup-move-it-back-from-util_lib-elf_info.c.patch
|
||||
Patch607: kexec-tools-2.0.20-Limit-the-size-of-vmcore-dmesg.txt-to-2G.patch
|
||||
Patch608: kexec-tools-2.0.20-vmcore-dmesg-vmcore-dmesg.c-Fix-shifting-error-repor.patch
|
||||
Patch609: kexec-tools-2.0.20-kexec-add-variant-helper-functions-for-handling-memo.patch
|
||||
Patch610: kexec-tools-2.0.20-arm64-kexec-allocate-memory-space-avoiding-reserved-.patch
|
||||
Patch611: kexec-tools-2.0.20-arm64-kdump-deal-with-a-lot-of-resource-entries-in-p.patch
|
||||
Patch612: kexec-tools-2.0.20-Remove-duplicated-variable-declarations.patch
|
||||
Patch613: kexec-tools-2.0.20-eppic-Remove-duplicated-variable-declaration.patch
|
||||
|
||||
|
||||
# Patches 701 onward for makedumpfile
|
||||
Patch701: rhelonly-kexec-tools-2.0.20-makedumpfile-arm64-Add-support-for-ARMv8.2-LVA-52-bi.patch
|
||||
|
||||
Patch702: kexec-tools-2.0.26-makedumpfile-sadump-fix-failure-of-reading-memory-when-5-le.patch
|
||||
|
||||
%description
|
||||
kexec-tools provides /usr/sbin/kexec binary that facilitates a new
|
||||
@ -129,18 +129,9 @@ tar -z -x -v -f %{SOURCE19}
|
||||
|
||||
%patch601 -p1
|
||||
%patch602 -p1
|
||||
#%patch603 -p1
|
||||
%patch604 -p1
|
||||
%patch605 -p1
|
||||
%patch606 -p1
|
||||
%patch607 -p1
|
||||
%patch608 -p1
|
||||
%patch609 -p1
|
||||
%patch610 -p1
|
||||
%patch611 -p1
|
||||
%patch612 -p1
|
||||
%patch613 -p1
|
||||
|
||||
%patch701 -p1
|
||||
%patch702 -p1
|
||||
|
||||
%ifarch ppc
|
||||
%define archdef ARCH=ppc
|
||||
@ -167,11 +158,14 @@ cp %{SOURCE27} .
|
||||
cp %{SOURCE28} .
|
||||
cp %{SOURCE31} .
|
||||
|
||||
# Generate sysconfig file
|
||||
%{SOURCE8} %{_target_cpu} > kdump.conf
|
||||
|
||||
make
|
||||
%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64
|
||||
make -C eppic/libeppic
|
||||
make -C makedumpfile-1.6.8 LINKTYPE=dynamic USELZO=on USESNAPPY=on
|
||||
make -C makedumpfile-1.6.8 LDFLAGS="$LDFLAGS -I../eppic/libeppic -L../eppic/libeppic" eppic_makedumpfile.so
|
||||
make -C makedumpfile-1.7.2 LINKTYPE=dynamic USELZO=on USESNAPPY=on USEZSTD=on
|
||||
make -C makedumpfile-1.7.2 LDFLAGS="$LDFLAGS -I../eppic/libeppic -L../eppic/libeppic" eppic_makedumpfile.so
|
||||
%endif
|
||||
|
||||
%install
|
||||
@ -190,6 +184,7 @@ mkdir -p $RPM_BUILD_ROOT%{_unitdir}
|
||||
mkdir -p -m755 $RPM_BUILD_ROOT%{_bindir}
|
||||
mkdir -p -m755 $RPM_BUILD_ROOT%{_libdir}
|
||||
mkdir -p -m755 $RPM_BUILD_ROOT%{_prefix}/lib/kdump
|
||||
mkdir -p -m755 $RPM_BUILD_ROOT%{_sharedstatedir}/kdump
|
||||
install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_bindir}/kdumpctl
|
||||
|
||||
install -m 755 build/sbin/kexec $RPM_BUILD_ROOT/usr/sbin/kexec
|
||||
@ -203,7 +198,8 @@ SYSCONFIG=$RPM_SOURCE_DIR/kdump.sysconfig.%{_target_cpu}
|
||||
install -m 644 $SYSCONFIG $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/kdump
|
||||
|
||||
install -m 755 %{SOURCE7} $RPM_BUILD_ROOT/usr/sbin/mkdumprd
|
||||
install -m 644 %{SOURCE8} $RPM_BUILD_ROOT%{_sysconfdir}/kdump.conf
|
||||
install -m 755 %{SOURCE36} $RPM_BUILD_ROOT/usr/sbin/mkfadumprd
|
||||
install -m 644 kdump.conf $RPM_BUILD_ROOT%{_sysconfdir}/kdump.conf
|
||||
install -m 644 kexec/kexec.8 $RPM_BUILD_ROOT%{_mandir}/man8/kexec.8
|
||||
install -m 644 %{SOURCE12} $RPM_BUILD_ROOT%{_mandir}/man8/mkdumprd.8
|
||||
install -m 644 %{SOURCE25} $RPM_BUILD_ROOT%{_mandir}/man8/kdumpctl.8
|
||||
@ -217,6 +213,8 @@ install -m 644 %{SOURCE13} $RPM_BUILD_ROOT%{_udevrulesdir}/98-kexec.rules
|
||||
%endif
|
||||
%ifarch ppc64 ppc64le
|
||||
install -m 644 %{SOURCE14} $RPM_BUILD_ROOT%{_udevrulesdir}/98-kexec.rules
|
||||
install -m 755 %{SOURCE34} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-migrate-action.sh
|
||||
install -m 755 %{SOURCE35} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-restart.sh
|
||||
%endif
|
||||
%ifnarch s390x
|
||||
install -m 755 %{SOURCE29} $RPM_BUILD_ROOT%{_udevrulesdir}/../kdump-udev-throttler
|
||||
@ -228,17 +226,18 @@ install -m 755 -D %{SOURCE32} $RPM_BUILD_ROOT%{_prefix}/lib/kernel/install.d/60-
|
||||
|
||||
|
||||
%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64
|
||||
install -m 755 makedumpfile-1.6.8/makedumpfile $RPM_BUILD_ROOT/usr/sbin/makedumpfile
|
||||
install -m 644 makedumpfile-1.6.8/makedumpfile.8.gz $RPM_BUILD_ROOT/%{_mandir}/man8/makedumpfile.8.gz
|
||||
install -m 644 makedumpfile-1.6.8/makedumpfile.conf.5.gz $RPM_BUILD_ROOT/%{_mandir}/man5/makedumpfile.conf.5.gz
|
||||
install -m 644 makedumpfile-1.6.8/makedumpfile.conf $RPM_BUILD_ROOT/%{_sysconfdir}/makedumpfile.conf.sample
|
||||
install -m 755 makedumpfile-1.6.8/eppic_makedumpfile.so $RPM_BUILD_ROOT/%{_libdir}/eppic_makedumpfile.so
|
||||
install -m 755 makedumpfile-1.7.2/makedumpfile $RPM_BUILD_ROOT/usr/sbin/makedumpfile
|
||||
install -m 644 makedumpfile-1.7.2/makedumpfile.8 $RPM_BUILD_ROOT/%{_mandir}/man8/makedumpfile.8
|
||||
install -m 644 makedumpfile-1.7.2/makedumpfile.conf.5 $RPM_BUILD_ROOT/%{_mandir}/man5/makedumpfile.conf.5
|
||||
install -m 644 makedumpfile-1.7.2/makedumpfile.conf $RPM_BUILD_ROOT/%{_sysconfdir}/makedumpfile.conf.sample
|
||||
install -m 755 makedumpfile-1.7.2/eppic_makedumpfile.so $RPM_BUILD_ROOT/%{_libdir}/eppic_makedumpfile.so
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/share/makedumpfile/eppic_scripts/
|
||||
install -m 644 makedumpfile-1.6.8/eppic_scripts/* $RPM_BUILD_ROOT/usr/share/makedumpfile/eppic_scripts/
|
||||
install -m 644 makedumpfile-1.7.2/eppic_scripts/* $RPM_BUILD_ROOT/usr/share/makedumpfile/eppic_scripts/
|
||||
%endif
|
||||
|
||||
%define remove_dracut_prefix() %(echo -n %1|sed 's/.*dracut-//g')
|
||||
%define remove_dracut_early_kdump_prefix() %(echo -n %1|sed 's/.*dracut-early-kdump-//g')
|
||||
%define remove_dracut_fadump_prefix() %(echo -n %1|sed 's/.*dracut-fadump-//g')
|
||||
|
||||
# deal with dracut modules
|
||||
mkdir -p -m755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase
|
||||
@ -257,6 +256,13 @@ cp %{SOURCE108} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99earlyk
|
||||
cp %{SOURCE109} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99earlykdump/%{remove_dracut_early_kdump_prefix %{SOURCE109}}
|
||||
chmod 755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99earlykdump/%{remove_dracut_prefix %{SOURCE108}}
|
||||
chmod 755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99earlykdump/%{remove_dracut_early_kdump_prefix %{SOURCE109}}
|
||||
%ifarch ppc64 ppc64le
|
||||
mkdir -p -m755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99zz-fadumpinit
|
||||
cp %{SOURCE200} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99zz-fadumpinit/%{remove_dracut_fadump_prefix %{SOURCE200}}
|
||||
cp %{SOURCE201} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99zz-fadumpinit/%{remove_dracut_fadump_prefix %{SOURCE201}}
|
||||
chmod 755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99zz-fadumpinit/%{remove_dracut_fadump_prefix %{SOURCE200}}
|
||||
chmod 755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99zz-fadumpinit/%{remove_dracut_fadump_prefix %{SOURCE201}}
|
||||
%endif
|
||||
|
||||
|
||||
%define dracutlibdir %{_prefix}/lib/dracut
|
||||
@ -269,6 +275,13 @@ mv $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/* $RPM_BUILD_ROOT/%{d
|
||||
%systemd_post kdump.service
|
||||
|
||||
touch /etc/kdump.conf
|
||||
|
||||
%ifarch ppc64 ppc64le
|
||||
servicelog_notify --remove --command=/usr/lib/kdump/kdump-migrate-action.sh 2>/dev/null
|
||||
servicelog_notify --add --command=/usr/lib/kdump/kdump-migrate-action.sh --match='refcode="#MIGRATE" and serviceable=0' --type=EVENT --method=pairs_stdin
|
||||
%endif
|
||||
|
||||
|
||||
# This portion of the script is temporary. Its only here
|
||||
# to fix up broken boxes that require special settings
|
||||
# in /etc/sysconfig/kdump. It will be removed when
|
||||
@ -296,6 +309,9 @@ fi
|
||||
%systemd_postun_with_restart kdump.service
|
||||
|
||||
%preun
|
||||
%ifarch ppc64 ppc64le
|
||||
servicelog_notify --remove --command=/usr/lib/kdump/kdump-migrate-action.sh
|
||||
%endif
|
||||
# Package removal, not upgrade
|
||||
%systemd_preun kdump.service
|
||||
|
||||
@ -336,6 +352,7 @@ done
|
||||
/usr/sbin/kexec
|
||||
/usr/sbin/makedumpfile
|
||||
/usr/sbin/mkdumprd
|
||||
/usr/sbin/mkfadumprd
|
||||
/usr/sbin/vmcore-dmesg
|
||||
%{_bindir}/*
|
||||
%{_datadir}/kdump
|
||||
@ -354,6 +371,7 @@ done
|
||||
%dir %{_sysconfdir}/kdump
|
||||
%dir %{_sysconfdir}/kdump/pre.d
|
||||
%dir %{_sysconfdir}/kdump/post.d
|
||||
%dir %{_sharedstatedir}/kdump
|
||||
%{_mandir}/man8/kdumpctl.8.gz
|
||||
%{_mandir}/man8/kexec.8.gz
|
||||
%{_mandir}/man8/makedumpfile.8.gz
|
||||
@ -378,12 +396,214 @@ done
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Wed May 12 2021 Pingfan Liu <piliu@redhat.com> - 2.0.20-46.1
|
||||
- Implement IP netmask calculation to replace "ipcalc -m"
|
||||
* Tue Jul 30 2024 Pingfan Liu <piliu@redhat.com> - 2.0.26-14.2
|
||||
- Use the correct regex to match eth.*
|
||||
|
||||
* Thu Feb 25 2021 Pingfan Liu <piliu@redhat.com> - 2.0.20-46
|
||||
* Tue Jun 18 2024 Pingfan Liu <piliu@redhat.com> - 2.0.26-14.1
|
||||
- mkdumprd: Fix makedumpfile parameter check
|
||||
|
||||
* Wed Feb 21 2024 Pingfan Liu <piliu@redhat.com> - 2.0.26-14
|
||||
- dracut-module-setup: Skip initrd-cleanup and initrd-parse-etc in kdump
|
||||
|
||||
* Fri Feb 2 2024 Pingfan Liu <piliu@redhat.com> - 2.0.26-13
|
||||
- dracut-module-setup.sh: also install the driver of physical NIC for Hyper-V VM with accelerated networking
|
||||
|
||||
* Wed Nov 22 2023 Pingfan Liu <piliu@redhat.com> - 2.0.26-12
|
||||
- kdumpctl: Only returns immediately after an error occurs in check_*_modified
|
||||
|
||||
* Thu Nov 9 2023 Pingfan Liu <piliu@redhat.com> - 2.0.26-11
|
||||
- powerpc: update kdumpctl to load kernel signing key for fadump
|
||||
- powerpc: update kdumpctl to remove deletion of kernel signing key once loaded
|
||||
|
||||
* Tue Sep 26 2023 Pingfan Liu <piliu@redhat.com> - 2.0.26-10
|
||||
- Introduce a function to get reserved memory size
|
||||
|
||||
* Tue Sep 19 2023 Pingfan Liu <piliu@redhat.com> - 2.0.26-9
|
||||
- Add lvm thin provision to kdump supported-kdump-targets.txt
|
||||
|
||||
* Thu Aug 10 2023 Pingfan Liu <piliu@redhat.com> - 2.0.26-8
|
||||
- mkdumprd: Use the correct syntax to redirect the stderr to null
|
||||
- mkdumprd: call dracut with --add-device to install the drivers needed by /boot partition automatically for FIPS
|
||||
- Add NICs that handle DNS queries to the allowlist
|
||||
|
||||
* Wed Jul 12 2023 Pingfan Liu <piliu@redhat.com> - 2.0.26-7
|
||||
- Revert "Revert "Append both nofail and x-systemd.before to kdump mount target"
|
||||
|
||||
* Thu Jun 29 2023 Pingfan Liu <piliu@redhat.com> - 2.0.26-6
|
||||
- dracut-module-setup.sh: skip installing driver for the loopback interface
|
||||
- Reduce kdump memory consumption by only installing needed NIC drivers
|
||||
|
||||
* Tue Jun 13 2023 Pingfan Liu <piliu@redhat.com> - 2.0.26-5
|
||||
- Revert "Append both nofail and x-systemd.before to kdump mount target"
|
||||
|
||||
* Wed May 31 2023 Pingfan Liu <piliu@redhat.com> - 2.0.26-4
|
||||
- Only rename the virtual Azure Hyper-V network interface
|
||||
|
||||
* Tue May 16 2023 Pingfan Liu <piliu@redhat.com> - 2.0.26-3
|
||||
- Don't rename Azure Hyper-V network interface
|
||||
|
||||
* Thu Apr 20 2023 Pingfan Liu <piliu@redhat.com> - 2.0.26-2
|
||||
- sadump: fix failure of reading memory when 5-level paging is enabled
|
||||
|
||||
* Tue Apr 4 2023 Pingfan Liu <piliu@redhat.com> - 2.0.25-7
|
||||
- Rebase makedumpfile to 1.7.2
|
||||
|
||||
* Tue Mar 14 2023 Pingfan Liu <piliu@redhat.com> - 2.0.25-6
|
||||
- sysconfig: add zfcp.allow_lun_scan to KDUMP_COMMANDLINE_REMOVE on s390
|
||||
|
||||
* Wed Jan 18 2023 Pingfan Liu <piliu@redhat.com> - 2.0.25-5
|
||||
- dracut-module-setup: Fix invalid rd.znet command line entry
|
||||
- dracut-module-setup: Fix persistent nic name on s390
|
||||
|
||||
* Mon Jan 9 2023 Pingfan Liu <piliu@redhat.com> - 2.0.25-4
|
||||
- Don't check fs modified when dump target is lvm2 thinp
|
||||
- Add dependency of dracut lvmthinpool-monitor module
|
||||
- lvm.conf should be check modified if lvm2 thinp enabled
|
||||
- Add lvm2 thin provision dump target checker
|
||||
- Fix the sync issue for dump_fs
|
||||
|
||||
* Fri Dec 2 2022 Pingfan Liu <piliu@redhat.com> - 2.0.25-3
|
||||
- kdump.conf: use a simple generator script to maintain
|
||||
- Reduce kdump memory consumption by not letting NetworkManager manage unneeded network interfaces
|
||||
|
||||
* Mon Oct 17 2022 Pingfan Liu <piliu@redhat.com> - 2.0.25-2
|
||||
- mkdumprd: Improve error messages on non-existing NFS target directories
|
||||
- fadump: avoid non-debug kernel use for fadump case
|
||||
|
||||
* Sun Sep 18 2022 Pingfan Liu <piliu@redhat.com> - 2.0.24-7
|
||||
- kdumpctl: make the kdump.log root-readable-only
|
||||
|
||||
* Mon Jul 18 2022 Pingfan Liu <piliu@redhat.com> - 2.0.24-6
|
||||
- kdump-lib: Add the CoreOS kernel dir to the boot_dirlist
|
||||
- kdump-lib: attempt to fix BOOT_IMAGE detection
|
||||
- kdump-lib: change how ostree based systems are detected
|
||||
- kdump-lib: clear up references to Atomic/CoreOS
|
||||
|
||||
* Mon Jul 4 2022 Pingfan Liu <piliu@redhat.com> - 2.0.24-5
|
||||
- kdump-lib: use non-debug kernels first
|
||||
|
||||
* Tue Jun 21 2022 Pingfan Liu <piliu@redhat.com> - 2.0.24-4
|
||||
- kdump-lib.sh: Check the output of blkid with sed instead of eval
|
||||
|
||||
* Fri Jun 10 2022 Pingfan Liu <piliu@redhat.com> - 2.0.24-3
|
||||
- kdump.sysconfig*: add ignition.firstboot to KDUMP_COMMANDLINE_REMOVE
|
||||
|
||||
* Fri May 27 2022 Pingfan Liu <piliu@redhat.com> - 2.0.24-2
|
||||
- kdumpctl: fix missed dollar sign
|
||||
|
||||
* Thu May 5 2022 Pingfan Liu <piliu@redhat.com> - 2.0.24-1
|
||||
- kdumpctl: sync the $TARGET_INITRD after rebuild
|
||||
- Avoid false-positive mem_section validation with vmlinux
|
||||
- Rebase kexec-tools to 2.0.24
|
||||
- Rebase makedumpfile to 1.7.1
|
||||
|
||||
* Fri Apr 15 2022 Pingfan Liu <piliu@redhat.com> - 2.0.20-69
|
||||
- s390: add support for --reuse-cmdline
|
||||
- use slurp_proc_file() in get_command_line()
|
||||
- add slurp_proc_file()
|
||||
- s390: use KEXEC_ALL_OPTIONS
|
||||
- s390: add variable command line size
|
||||
- util_lib/elf_info: harden parsing of printk buffer
|
||||
- print error when reading with unsupported compression
|
||||
- use cycle detection when parsing the prink log_buf
|
||||
- use pointer arithmetics for dump_dmesg
|
||||
- add generic cycle detection
|
||||
|
||||
* Thu Jan 27 2022 Pingfan Liu <piliu@redhat.com> - 2.0.20-68
|
||||
- Revert "Remove trace_buf_size and trace_event from the kernel bootparameters of the kdump kernel"
|
||||
|
||||
* Fri Dec 24 2021 Pingfan Liu <piliu@redhat.com> - 2.0.20-67
|
||||
- Remove trace_buf_size and trace_event from the kernel bootparameters of the kdump kernel
|
||||
|
||||
* Fri Dec 10 2021 Pingfan Liu <piliu@redhat.com> - 2.0.20-66
|
||||
- kdump/ppc64: suppress the error message "Could not find a registered notification tool" from servicelog_notify
|
||||
- Enable zstd compression for makedumpfile in kexec-tools.spec
|
||||
|
||||
* Thu Dec 2 2021 Pingfan Liu <piliu@redhat.com> - 2.0.20-65
|
||||
- mkdumprd: drop mountaddr/mountproto nfs mount options
|
||||
|
||||
* Fri Nov 26 2021 Pingfan Liu <piliu@redhat.com> - 2.0.20-64
|
||||
- add keytuils as a weak dependency for POWER
|
||||
|
||||
* Fri Nov 19 2021 Pingfan Liu <piliu@redhat.com> - 2.0.20-63
|
||||
- Document/kexec-kdump-howto.txt: fix escape
|
||||
|
||||
* Wed Nov 17 2021 Pingfan Liu <piliu@redhat.com> - 2.0.20-62
|
||||
- Document/kexec-kdump-howto.txt: improve notes for kdump_pre and kdump_post scripts
|
||||
|
||||
* Tue Nov 9 2021 Pingfan Liu <piliu@redhat.com> - 2.0.20-61
|
||||
- rebase makedumpfile to 1.7.0
|
||||
|
||||
* Fri Oct 22 2021 Pingfan Liu <piliu@redhat.com> - 2.0.20-60
|
||||
- fadump-init: clean up mount points properly
|
||||
- fadump: kdumpctl should check the modules used by the fadump initramfs
|
||||
- fadump: isolate fadump initramfs image within the default one
|
||||
- mkdumprd: Use xz for squash image compression
|
||||
|
||||
* Mon Oct 18 2021 Pingfan Liu <piliu@redhat.com> - 2.0.20-59
|
||||
- makedumpfile: printk: use committed/finalized state values
|
||||
- makedumpfile: printk: add support for lockless ringbuffer
|
||||
- kexec-tools: printk: Use %zu to format size_t
|
||||
- kexec-tools: printk: Use ULL suffix for 64-bit constants
|
||||
- kexec-tools: printk: add support for lockless ringbuffer
|
||||
|
||||
* Sun Oct 17 2021 Pingfan Liu <piliu@redhat.com> - 2.0.20-58
|
||||
- kdumpctl: fix fragile loops over find output
|
||||
|
||||
* Fri Aug 27 2021 Pingfan Liu <piliu@redhat.com> - 2.0.20-57
|
||||
- kdumpctl: enable secure boot on ppc64le LPARs
|
||||
|
||||
* Fri Aug 6 2021 Pingfan Liu <piliu@redhat.com> - 2.0.20-56
|
||||
- kdumpctl: fix a typo
|
||||
|
||||
* Mon Aug 2 2021 Pingfan Liu <piliu@redhat.com> - 2.0.20-55
|
||||
- kdump/ppc64: migration action registration clean up
|
||||
|
||||
* Fri Jul 23 2021 Pingfan Liu <piliu@redhat.com> - 2.0.20-54
|
||||
- kdump/ppc64: rebuild initramfs image after migration
|
||||
- Check the existence of /sys/bus/ccwgroup/devices/*/online beforehand
|
||||
- kdump.sysconfig.s390: Remove "prot_virt" from kdump kernel cmdline
|
||||
|
||||
* Fri Jul 2 2021 Pingfan Liu <piliu@redhat.com> - 2.0.20-53
|
||||
- check for invalid physical address of /proc/kcore when making ELF dumpfile
|
||||
- check for invalid physical address of /proc/kcore when finding max_paddr
|
||||
- fix format issue in find_online_znet_device
|
||||
- check the existence of /sys/bus/ccwgroup/devices before trying to find online network device
|
||||
- kdump-lib.sh: fix a warning in prepare_kdump_bootinfo()
|
||||
|
||||
* Thu Jun 17 2021 Pingfan Liu <piliu@redhat.com> - 2.0.20-52
|
||||
- Write to `/var/lib/kdump` if $KDUMP_BOOTDIR not writable
|
||||
- Iterate /sys/bus/ccwgroup/devices to tell if we should set up rd.znet
|
||||
- mkdumprd: display the absolute path of dump location in the check_user_configured_target()
|
||||
|
||||
* Wed Jun 2 2021 Pingfan Liu <piliu@redhat.com> - 2.0.20-51
|
||||
- Stop reloading kdump service on CPU hotplug event for FADump
|
||||
- fadump: improve fadump-howto.txt about remote dump target setup
|
||||
|
||||
* Tue May 25 2021 Pingfan Liu <piliu@redhat.com> - 2.0.20-50
|
||||
- rd.route should use the name from kdump_setup_ifname
|
||||
- get kdump ifname once in kdump_install_netdev
|
||||
|
||||
* Tue May 25 2021 Pingfan Liu <piliu@redhat.com> - 2.0.20-49
|
||||
- kdump-lib.sh: fix the case if no enough total RAM for kdump in get_recommend_size()
|
||||
|
||||
* Thu May 20 2021 Pingfan Liu <piliu@redhat.com> - 2.0.20-48
|
||||
- kdumpctl: Add kdumpctl estimate
|
||||
- mkdumprd: make use of the new get_luks_crypt_dev helper
|
||||
- kdump-lib.sh: introduce a helper to get all crypt dev used by kdump
|
||||
- kdump-lib.sh: introduce a helper to get underlying crypt device
|
||||
- RHEL-only: keep total memory size coherent to RHEL-only kernel patch
|
||||
- Show write byte size in report messages
|
||||
- Add shorthand --show-stats option to show report stats
|
||||
- Add --dry-run option to prevent writing the dumpfile
|
||||
- kdump-lib.sh: introduce functions to return recommened mem size
|
||||
|
||||
* Mon May 10 2021 Pingfan Liu <piliu@redhat.com> - 2.0.20-47
|
||||
- Implement IP netmask calculation to replace "ipcalc -m"
|
||||
- kdumpctl: fix check_config error when kdump.conf is empty
|
||||
- Fix incorrect vmcore permissions when dumped through ssh
|
||||
- Fix incorrect permissions on kdump dmesg file
|
||||
|
||||
* Mon Jan 25 2021 Pingfan Liu <piliu@redhat.com> - 2.0.20-45
|
||||
- origin/rhel-8.4.0) Revert "Revert "Append both nofail and x-systemd.before to kdump mount target""
|
||||
- kdump.conf: add ipv6 example for nfs and ssh dump
|
||||
|
Loading…
Reference in New Issue
Block a user