Compare commits
No commits in common. "imports/c8s/kexec-tools-2.0.20-54.el8" and "c8" have entirely different histories.
imports/c8
...
c8
|
@ -1,3 +1,3 @@
|
|||
SOURCES/1.6.8.tar.gz
|
||||
SOURCES/1.7.1.tar.gz
|
||||
SOURCES/eppic_050615.tar.gz
|
||||
SOURCES/kexec-tools-2.0.20.tar.xz
|
||||
SOURCES/kexec-tools-2.0.25.tar.xz
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
7af5b92c69df9f63b9f02ad07a76a2a2581d4660 SOURCES/1.6.8.tar.gz
|
||||
8f8485c2a1edbc730f4fa1b96ae3ec8d8f1f9761 SOURCES/1.7.1.tar.gz
|
||||
a096c8e0892b559f40b01916aae240652f75b68a SOURCES/eppic_050615.tar.gz
|
||||
5d9acd2e741d356d4a48fe4f2d63f66ba431051d SOURCES/kexec-tools-2.0.20.tar.xz
|
||||
78d5d4f7e9d358ca234db9c84a551d9d411eb0b5 SOURCES/kexec-tools-2.0.25.tar.xz
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
}
|
|
@ -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
|
||||
|
@ -310,11 +323,35 @@ 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"
|
||||
}
|
||||
|
||||
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 +363,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 +376,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 +395,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 +430,7 @@ 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
|
||||
|
@ -430,10 +472,13 @@ 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
|
||||
}
|
||||
|
||||
# Setup dracut to bringup a given network interface
|
||||
|
@ -487,6 +532,7 @@ kdump_setup_netdev() {
|
|||
_ifname_opts=" ifname=$kdumpnic:$_netmac"
|
||||
echo "$_ifname_opts" >> $_ip_conf
|
||||
fi
|
||||
_save_kdump_netifs "$_netdev" "$_kdumpdev"
|
||||
|
||||
kdump_setup_dns "$_netdev"
|
||||
|
||||
|
@ -775,7 +821,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
|
||||
|
||||
|
@ -785,7 +831,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
|
||||
|
@ -951,7 +997,8 @@ kdump_install_systemd_conf() {
|
|||
}
|
||||
|
||||
install() {
|
||||
local arch
|
||||
declare -A unique_netifs
|
||||
local arch _netifs
|
||||
|
||||
kdump_module_init
|
||||
kdump_install_conf
|
||||
|
@ -1003,6 +1050,11 @@ install() {
|
|||
# at some point of time.
|
||||
kdump_check_iscsi_targets
|
||||
|
||||
_netifs=$(_get_kdump_netifs)
|
||||
if [[ -n "$_netifs" ]]; then
|
||||
kdump_install_nm_netif_allowlist "$_netifs"
|
||||
fi
|
||||
|
||||
kdump_install_systemd_conf
|
||||
|
||||
# For the lvm type target under kdump, in /etc/lvm/lvm.conf we can
|
||||
|
@ -1015,7 +1067,5 @@ install() {
|
|||
${initdir}/etc/lvm/lvm.conf &>/dev/null
|
||||
|
||||
# Save more memory by dropping switch root capability
|
||||
if ! is_fadump_capable; then
|
||||
dracut_no_switch_root
|
||||
fi
|
||||
dracut_no_switch_root
|
||||
}
|
||||
|
|
|
@ -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
|
|
@ -145,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
|
||||
|
|
|
@ -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 ":"
|
||||
|
@ -617,11 +638,16 @@ is_secure_boot_enforced()
|
|||
local secure_boot_file setup_mode_file
|
||||
local secure_boot_byte setup_mode_byte
|
||||
|
||||
# On powerpc, os-secureboot-enforcing DT property indicates whether secureboot
|
||||
# is enforced. Return success, if it is found.
|
||||
# On powerpc, secure boot is enforced if:
|
||||
# host secure boot: /ibm,secure-boot/os-secureboot-enforcing DT property exists
|
||||
# guest secure boot: /ibm,secure-boot >= 2
|
||||
if [ -f /proc/device-tree/ibm,secureboot/os-secureboot-enforcing ]; then
|
||||
return 0
|
||||
fi
|
||||
if [ -f /proc/device-tree/ibm,secure-boot ] && \
|
||||
[ $(lsprop /proc/device-tree/ibm,secure-boot | tail -1) -ge 2 ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Detect secure boot on x86 and arm64
|
||||
secure_boot_file=$(find /sys/firmware/efi/efivars -name SecureBoot-* 2>/dev/null)
|
||||
|
@ -677,6 +703,39 @@ prepare_kexec_args()
|
|||
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
|
||||
|
@ -686,46 +745,55 @@ 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
|
||||
defaut_initrd_base="$initrd"
|
||||
DEFAULT_INITRD="$KDUMP_BOOTDIR/$defaut_initrd_base"
|
||||
if [[ -f "$KDUMP_BOOTDIR/$initrd" ]]; then
|
||||
default_initrd_base="$initrd"
|
||||
DEFAULT_INITRD="$KDUMP_BOOTDIR/$default_initrd_base"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
@ -733,16 +801,16 @@ prepare_kdump_bootinfo()
|
|||
# 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 "$defaut_initrd_base" ]]; then
|
||||
if [[ -z $default_initrd_base ]]; then
|
||||
kdump_initrd_base=initramfs-${KDUMP_KERNELVER}kdump.img
|
||||
elif [[ $defaut_initrd_base == *.* ]]; then
|
||||
kdump_initrd_base=${defaut_initrd_base%.*}kdump.${DEFAULT_INITRD##*.}
|
||||
elif [[ $default_initrd_base == *.* ]]; then
|
||||
kdump_initrd_base=${default_initrd_base%.*}kdump.${DEFAULT_INITRD##*.}
|
||||
else
|
||||
kdump_initrd_base=${defaut_initrd_base}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
|
||||
# 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"
|
||||
|
@ -915,9 +983,12 @@ kdump_get_arch_recommend_size()
|
|||
# $1: the block device to be checked in maj:min format
|
||||
get_luks_crypt_dev()
|
||||
{
|
||||
local _type
|
||||
|
||||
[[ -b /dev/block/$1 ]] || return 1
|
||||
|
||||
local _type=$(eval "$(blkid -u filesystem,crypto -o export -- /dev/block/$1); echo \$TYPE")
|
||||
_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
|
||||
|
|
|
@ -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 prot_virt"
|
||||
KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb prot_virt 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
|
||||
|
|
|
@ -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,6 +133,7 @@ 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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -410,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
|
||||
|
||||
|
@ -464,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'"
|
||||
|
@ -494,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
|
||||
|
||||
|
@ -617,7 +611,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
|
||||
|
||||
|
@ -646,6 +640,35 @@ check_rebuild()
|
|||
return $?
|
||||
}
|
||||
|
||||
# On ppc64le LPARs, the keys trusted by firmware do not end up in
|
||||
# .builtin_trusted_keys. So instead, add the key to the .ima keyring
|
||||
function load_kdump_kernel_key()
|
||||
{
|
||||
# this is only called inside is_secure_boot_enforced,
|
||||
# no need to retest
|
||||
|
||||
# this is only required if DT /ibm,secure-boot is a file.
|
||||
# if it is a dir, we are on OpenPower and don't need this.
|
||||
if ! [ -f /proc/device-tree/ibm,secure-boot ]; then
|
||||
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
|
||||
}
|
||||
|
||||
# Load the kdump kernel specified in /etc/sysconfig/kdump
|
||||
# If none is specified, try to load a kdump kernel with the same version
|
||||
# as the currently running kernel.
|
||||
|
@ -662,6 +685,7 @@ load_kdump()
|
|||
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"
|
||||
|
@ -672,6 +696,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
|
||||
|
||||
|
@ -683,6 +708,8 @@ load_kdump()
|
|||
set +x
|
||||
exec 2>&12 12>&-
|
||||
|
||||
remove_kdump_kernel_key
|
||||
|
||||
if [ $ret == 0 ]; then
|
||||
dinfo "kexec: loaded kdump kernel"
|
||||
return 0
|
||||
|
@ -928,12 +955,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()
|
||||
|
@ -1221,7 +1248,7 @@ 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 recommanded_size
|
||||
local kernel_size mod_size initrd_size baseline_size runtime_size reserved_size estimated_size recommended_size
|
||||
local size_mb=$(( 1024 * 1024 ))
|
||||
|
||||
setup_initrd
|
||||
|
@ -1279,13 +1306,13 @@ do_estimate() {
|
|||
|
||||
estimated_size=$((kernel_size + mod_size + initrd_size + runtime_size + crypt_size))
|
||||
if [[ $baseline_size -gt $estimated_size ]]; then
|
||||
recommanded_size=$baseline_size
|
||||
recommended_size=$baseline_size
|
||||
else
|
||||
recommanded_size=$estimated_size
|
||||
recommended_size=$estimated_size
|
||||
fi
|
||||
|
||||
echo "Reserved crashkernel: $((reserved_size / size_mb))M"
|
||||
echo "Recommanded crashkernel: $((recommanded_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"
|
||||
|
@ -1303,8 +1330,8 @@ do_estimate() {
|
|||
done
|
||||
fi
|
||||
|
||||
if [[ $reserved_size -lt $recommanded_size ]]; then
|
||||
echo "WARNING: Current crashkernel size is lower than recommanded size $((recommanded_size / size_mb))M."
|
||||
if [[ $reserved_size -lt $recommended_size ]]; then
|
||||
echo "WARNING: Current crashkernel size is lower than recommended size $((recommended_size / size_mb))M."
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
@ -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,177 +0,0 @@
|
|||
From 3422e1d6bc3511c5af9cb05ba74ad97dd93ffd7f Mon Sep 17 00:00:00 2001
|
||||
From: Julien Thierry <jthierry@redhat.com>
|
||||
Date: Tue, 24 Nov 2020 10:45:24 +0000
|
||||
Subject: [PATCH] [PATCH 1/2] Add --dry-run option to prevent writing the
|
||||
dumpfile
|
||||
|
||||
Add a --dry-run option to run all operations without writing the
|
||||
dump to the output file.
|
||||
|
||||
Signed-off-by: Julien Thierry <jthierry@redhat.com>
|
||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
---
|
||||
makedumpfile.8 | 6 ++++++
|
||||
makedumpfile.c | 37 ++++++++++++++++++++++++++++++-------
|
||||
makedumpfile.h | 2 ++
|
||||
print_info.c | 3 +++
|
||||
4 files changed, 41 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/makedumpfile-1.6.8/makedumpfile.8 b/makedumpfile-1.6.8/makedumpfile.8
|
||||
index b68a7e3..5e902cd 100644
|
||||
--- a/makedumpfile-1.6.8/makedumpfile.8
|
||||
+++ b/makedumpfile-1.6.8/makedumpfile.8
|
||||
@@ -637,6 +637,12 @@ Show the version of makedumpfile.
|
||||
Only check whether the command-line parameters are valid or not, and exit.
|
||||
Preferable to be given as the first parameter.
|
||||
|
||||
+.TP
|
||||
+\fB\-\-dry-run\fR
|
||||
+Do not write the output dump file while still performing operations specified
|
||||
+by other options.
|
||||
+This option cannot be used with the --dump-dmesg, --reassemble and -g options.
|
||||
+
|
||||
.SH ENVIRONMENT VARIABLES
|
||||
|
||||
.TP 8
|
||||
diff --git a/makedumpfile-1.6.8/makedumpfile.c b/makedumpfile-1.6.8/makedumpfile.c
|
||||
index ecd63fa..8c80c49 100644
|
||||
--- a/makedumpfile-1.6.8/makedumpfile.c
|
||||
+++ b/makedumpfile-1.6.8/makedumpfile.c
|
||||
@@ -1372,6 +1372,8 @@ open_dump_file(void)
|
||||
if (info->flag_flatten) {
|
||||
fd = STDOUT_FILENO;
|
||||
info->name_dumpfile = filename_stdout;
|
||||
+ } else if (info->flag_dry_run) {
|
||||
+ fd = -1;
|
||||
} else if ((fd = open(info->name_dumpfile, open_flags,
|
||||
S_IRUSR|S_IWUSR)) < 0) {
|
||||
ERRMSG("Can't open the dump file(%s). %s\n",
|
||||
@@ -4711,6 +4713,9 @@ write_and_check_space(int fd, void *buf, size_t buf_size, char *file_name)
|
||||
{
|
||||
int status, written_size = 0;
|
||||
|
||||
+ if (info->flag_dry_run)
|
||||
+ return TRUE;
|
||||
+
|
||||
while (written_size < buf_size) {
|
||||
status = write(fd, buf + written_size,
|
||||
buf_size - written_size);
|
||||
@@ -4748,13 +4753,12 @@ write_buffer(int fd, off_t offset, void *buf, size_t buf_size, char *file_name)
|
||||
}
|
||||
if (!write_and_check_space(fd, &fdh, sizeof(fdh), file_name))
|
||||
return FALSE;
|
||||
- } else {
|
||||
- if (lseek(fd, offset, SEEK_SET) == failed) {
|
||||
- ERRMSG("Can't seek the dump file(%s). %s\n",
|
||||
- file_name, strerror(errno));
|
||||
- return FALSE;
|
||||
- }
|
||||
+ } else if (!info->flag_dry_run &&
|
||||
+ lseek(fd, offset, SEEK_SET) == failed) {
|
||||
+ ERRMSG("Can't seek the dump file(%s). %s\n", file_name, strerror(errno));
|
||||
+ return FALSE;
|
||||
}
|
||||
+
|
||||
if (!write_and_check_space(fd, buf, buf_size, file_name))
|
||||
return FALSE;
|
||||
|
||||
@@ -9112,7 +9116,7 @@ close_dump_memory(void)
|
||||
void
|
||||
close_dump_file(void)
|
||||
{
|
||||
- if (info->flag_flatten)
|
||||
+ if (info->flag_flatten || info->flag_dry_run)
|
||||
return;
|
||||
|
||||
if (close(info->fd_dumpfile) < 0)
|
||||
@@ -10985,6 +10989,11 @@ check_param_for_generating_vmcoreinfo(int argc, char *argv[])
|
||||
|
||||
return FALSE;
|
||||
|
||||
+ if (info->flag_dry_run) {
|
||||
+ MSG("--dry-run cannot be used with -g.\n");
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -11029,6 +11038,11 @@ check_param_for_reassembling_dumpfile(int argc, char *argv[])
|
||||
|| info->flag_exclude_xen_dom || info->flag_split)
|
||||
return FALSE;
|
||||
|
||||
+ if (info->flag_dry_run) {
|
||||
+ MSG("--dry-run cannot be used with --reassemble.\n");
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+
|
||||
if ((info->splitting_info
|
||||
= malloc(sizeof(struct splitting_info) * info->num_dumpfile))
|
||||
== NULL) {
|
||||
@@ -11057,6 +11071,11 @@ check_param_for_creating_dumpfile(int argc, char *argv[])
|
||||
|| (info->flag_read_vmcoreinfo && info->name_xen_syms))
|
||||
return FALSE;
|
||||
|
||||
+ if (info->flag_dry_run && info->flag_dmesg) {
|
||||
+ MSG("--dry-run cannot be used with --dump-dmesg.\n");
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+
|
||||
if (info->flag_flatten && info->flag_split)
|
||||
return FALSE;
|
||||
|
||||
@@ -11520,6 +11539,7 @@ static struct option longopts[] = {
|
||||
{"work-dir", required_argument, NULL, OPT_WORKING_DIR},
|
||||
{"num-threads", required_argument, NULL, OPT_NUM_THREADS},
|
||||
{"check-params", no_argument, NULL, OPT_CHECK_PARAMS},
|
||||
+ {"dry-run", no_argument, NULL, OPT_DRY_RUN},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
@@ -11686,6 +11706,9 @@ main(int argc, char *argv[])
|
||||
info->flag_check_params = TRUE;
|
||||
message_level = DEFAULT_MSG_LEVEL;
|
||||
break;
|
||||
+ case OPT_DRY_RUN:
|
||||
+ info->flag_dry_run = TRUE;
|
||||
+ break;
|
||||
case '?':
|
||||
MSG("Commandline parameter is invalid.\n");
|
||||
MSG("Try `makedumpfile --help' for more information.\n");
|
||||
diff --git a/makedumpfile-1.6.8/makedumpfile.h b/makedumpfile-1.6.8/makedumpfile.h
|
||||
index 5f50080..4c4222c 100644
|
||||
--- a/makedumpfile-1.6.8/makedumpfile.h
|
||||
+++ b/makedumpfile-1.6.8/makedumpfile.h
|
||||
@@ -1322,6 +1322,7 @@ struct DumpInfo {
|
||||
int flag_vmemmap; /* kernel supports vmemmap address space */
|
||||
int flag_excludevm; /* -e - excluding unused vmemmap pages */
|
||||
int flag_use_count; /* _refcount is named _count in struct page */
|
||||
+ int flag_dry_run; /* do not create a vmcore file */
|
||||
unsigned long vaddr_for_vtop; /* virtual address for debugging */
|
||||
long page_size; /* size of page */
|
||||
long page_shift;
|
||||
@@ -2425,6 +2426,7 @@ struct elf_prstatus {
|
||||
#define OPT_NUM_THREADS OPT_START+16
|
||||
#define OPT_PARTIAL_DMESG OPT_START+17
|
||||
#define OPT_CHECK_PARAMS OPT_START+18
|
||||
+#define OPT_DRY_RUN OPT_START+19
|
||||
|
||||
/*
|
||||
* Function Prototype.
|
||||
diff --git a/makedumpfile-1.6.8/print_info.c b/makedumpfile-1.6.8/print_info.c
|
||||
index e0c38b4..d2b0cb7 100644
|
||||
--- a/makedumpfile-1.6.8/print_info.c
|
||||
+++ b/makedumpfile-1.6.8/print_info.c
|
||||
@@ -308,6 +308,9 @@ print_usage(void)
|
||||
MSG(" the crashkernel range, then calculates the page number of different kind per\n");
|
||||
MSG(" vmcoreinfo. So currently /proc/kcore need be specified explicitly.\n");
|
||||
MSG("\n");
|
||||
+ MSG(" [--dry-run]:\n");
|
||||
+ MSG(" This option runs makedumpfile without writting output dump file.\n");
|
||||
+ MSG("\n");
|
||||
MSG(" [-D]:\n");
|
||||
MSG(" Print debugging message.\n");
|
||||
MSG("\n");
|
||||
--
|
||||
2.29.2
|
||||
|
|
@ -1,107 +0,0 @@
|
|||
From 6f3e75a558ed50d6ff0b42e3f61c099b2005b7bb Mon Sep 17 00:00:00 2001
|
||||
From: Julien Thierry <jthierry@redhat.com>
|
||||
Date: Tue, 24 Nov 2020 10:45:25 +0000
|
||||
Subject: [PATCH] [PATCH 2/2] Add shorthand --show-stats option to show report
|
||||
stats
|
||||
|
||||
Provide shorthand --show-stats option to enable report messages
|
||||
without needing to set a particular value for message-level.
|
||||
|
||||
Signed-off-by: Julien Thierry <jthierry@redhat.com>
|
||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
---
|
||||
makedumpfile.8 | 5 +++++
|
||||
makedumpfile.c | 9 ++++++++-
|
||||
makedumpfile.h | 1 +
|
||||
print_info.c | 7 ++++++-
|
||||
4 files changed, 20 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/makedumpfile-1.6.8/makedumpfile.8 b/makedumpfile-1.6.8/makedumpfile.8
|
||||
index 5e902cd..dcca2dd 100644
|
||||
--- a/makedumpfile-1.6.8/makedumpfile.8
|
||||
+++ b/makedumpfile-1.6.8/makedumpfile.8
|
||||
@@ -643,6 +643,11 @@ Do not write the output dump file while still performing operations specified
|
||||
by other options.
|
||||
This option cannot be used with the --dump-dmesg, --reassemble and -g options.
|
||||
|
||||
+.TP
|
||||
+\fB\-\-show-stats\fR
|
||||
+Display report messages. This is an alternative to enabling bit 4 in the level
|
||||
+provided to --message-level.
|
||||
+
|
||||
.SH ENVIRONMENT VARIABLES
|
||||
|
||||
.TP 8
|
||||
diff --git a/makedumpfile-1.6.8/makedumpfile.c b/makedumpfile-1.6.8/makedumpfile.c
|
||||
index 8c80c49..ba0003a 100644
|
||||
--- a/makedumpfile-1.6.8/makedumpfile.c
|
||||
+++ b/makedumpfile-1.6.8/makedumpfile.c
|
||||
@@ -11540,13 +11540,14 @@ static struct option longopts[] = {
|
||||
{"num-threads", required_argument, NULL, OPT_NUM_THREADS},
|
||||
{"check-params", no_argument, NULL, OPT_CHECK_PARAMS},
|
||||
{"dry-run", no_argument, NULL, OPT_DRY_RUN},
|
||||
+ {"show-stats", no_argument, NULL, OPT_SHOW_STATS},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
- int i, opt, flag_debug = FALSE;
|
||||
+ int i, opt, flag_debug = FALSE, flag_show_stats = FALSE;
|
||||
|
||||
if ((info = calloc(1, sizeof(struct DumpInfo))) == NULL) {
|
||||
ERRMSG("Can't allocate memory for the pagedesc cache. %s.\n",
|
||||
@@ -11709,6 +11710,9 @@ main(int argc, char *argv[])
|
||||
case OPT_DRY_RUN:
|
||||
info->flag_dry_run = TRUE;
|
||||
break;
|
||||
+ case OPT_SHOW_STATS:
|
||||
+ flag_show_stats = TRUE;
|
||||
+ break;
|
||||
case '?':
|
||||
MSG("Commandline parameter is invalid.\n");
|
||||
MSG("Try `makedumpfile --help' for more information.\n");
|
||||
@@ -11718,6 +11722,9 @@ main(int argc, char *argv[])
|
||||
if (flag_debug)
|
||||
message_level |= ML_PRINT_DEBUG_MSG;
|
||||
|
||||
+ if (flag_show_stats)
|
||||
+ message_level |= ML_PRINT_REPORT_MSG;
|
||||
+
|
||||
if (info->flag_check_params)
|
||||
/* suppress debugging messages */
|
||||
message_level = DEFAULT_MSG_LEVEL;
|
||||
diff --git a/makedumpfile-1.6.8/makedumpfile.h b/makedumpfile-1.6.8/makedumpfile.h
|
||||
index 4c4222c..2fcb62e 100644
|
||||
--- a/makedumpfile-1.6.8/makedumpfile.h
|
||||
+++ b/makedumpfile-1.6.8/makedumpfile.h
|
||||
@@ -2427,6 +2427,7 @@ struct elf_prstatus {
|
||||
#define OPT_PARTIAL_DMESG OPT_START+17
|
||||
#define OPT_CHECK_PARAMS OPT_START+18
|
||||
#define OPT_DRY_RUN OPT_START+19
|
||||
+#define OPT_SHOW_STATS OPT_START+20
|
||||
|
||||
/*
|
||||
* Function Prototype.
|
||||
diff --git a/makedumpfile-1.6.8/print_info.c b/makedumpfile-1.6.8/print_info.c
|
||||
index d2b0cb7..ad4184e 100644
|
||||
--- a/makedumpfile-1.6.8/print_info.c
|
||||
+++ b/makedumpfile-1.6.8/print_info.c
|
||||
@@ -309,7 +309,12 @@ print_usage(void)
|
||||
MSG(" vmcoreinfo. So currently /proc/kcore need be specified explicitly.\n");
|
||||
MSG("\n");
|
||||
MSG(" [--dry-run]:\n");
|
||||
- MSG(" This option runs makedumpfile without writting output dump file.\n");
|
||||
+ MSG(" Do not write the output dump file while still performing operations specified\n");
|
||||
+ MSG(" by other options. This option cannot be used with --dump-dmesg, --reassemble\n");
|
||||
+ MSG(" and -g options.\n");
|
||||
+ MSG("\n");
|
||||
+ MSG(" [--show-stats]:\n");
|
||||
+ MSG(" Set message-level to print report messages\n");
|
||||
MSG("\n");
|
||||
MSG(" [-D]:\n");
|
||||
MSG(" Print debugging message.\n");
|
||||
--
|
||||
2.29.2
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
From 0ef2ca6c9fa2f61f217a4bf5d7fd70f24e12b2eb Mon Sep 17 00:00:00 2001
|
||||
From: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Date: Thu, 4 Feb 2021 16:29:06 +0900
|
||||
Subject: [PATCH] [PATCH] Show write byte size in report messages
|
||||
|
||||
Show write byte size in report messages. This value can be different
|
||||
from the size of the actual file because of some holes on dumpfile
|
||||
data structure.
|
||||
|
||||
$ makedumpfile --show-stats -l -d 1 vmcore dump.ld1
|
||||
...
|
||||
Total pages : 0x0000000000080000
|
||||
Write bytes : 377686445
|
||||
...
|
||||
# ls -l dump.ld1
|
||||
-rw------- 1 root root 377691573 Feb 4 16:28 dump.ld1
|
||||
|
||||
Note that this value should not be used with /proc/kcore to determine
|
||||
how much disk space is needed for crash dump, because the real memory
|
||||
usage when a crash occurs can vary widely.
|
||||
|
||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
---
|
||||
makedumpfile.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/makedumpfile-1.6.8/makedumpfile.c b/makedumpfile-1.6.8/makedumpfile.c
|
||||
index fcd766b..894c88e 100644
|
||||
--- a/makedumpfile-1.6.8/makedumpfile.c
|
||||
+++ b/makedumpfile-1.6.8/makedumpfile.c
|
||||
@@ -48,6 +48,8 @@ char filename_stdout[] = FILENAME_STDOUT;
|
||||
static unsigned long long cache_hit;
|
||||
static unsigned long long cache_miss;
|
||||
|
||||
+static unsigned long long write_bytes;
|
||||
+
|
||||
static void first_cycle(mdf_pfn_t start, mdf_pfn_t max, struct cycle *cycle)
|
||||
{
|
||||
cycle->start_pfn = round(start, info->pfn_cyclic);
|
||||
@@ -4715,6 +4717,8 @@ write_and_check_space(int fd, void *buf, size_t buf_size, char *file_name)
|
||||
{
|
||||
int status, written_size = 0;
|
||||
|
||||
+ write_bytes += buf_size;
|
||||
+
|
||||
if (info->flag_dry_run)
|
||||
return TRUE;
|
||||
|
||||
@@ -10002,6 +10006,7 @@ print_report(void)
|
||||
REPORT_MSG("Memory Hole : 0x%016llx\n", pfn_memhole);
|
||||
REPORT_MSG("--------------------------------------------------\n");
|
||||
REPORT_MSG("Total pages : 0x%016llx\n", info->max_mapnr);
|
||||
+ REPORT_MSG("Write bytes : %llu\n", write_bytes);
|
||||
REPORT_MSG("\n");
|
||||
REPORT_MSG("Cache hit: %lld, miss: %lld", cache_hit, cache_miss);
|
||||
if (cache_hit + cache_miss)
|
||||
--
|
||||
2.29.2
|
||||
|
|
@ -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
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
From 38d921a2ef50ebd36258097553626443ffe27496 Mon Sep 17 00:00:00 2001
|
||||
From: Coiby Xu <coxu@redhat.com>
|
||||
Date: Tue, 15 Jun 2021 18:26:31 +0800
|
||||
Subject: [PATCH] check for invalid physical address of /proc/kcore
|
||||
when finding max_paddr
|
||||
|
||||
Kernel commit 464920104bf7adac12722035bfefb3d772eb04d8 ("/proc/kcore:
|
||||
update physical address for kcore ram and text") sets an invalid paddr
|
||||
(0xffffffffffffffff = -1) for PT_LOAD segments of not direct mapped
|
||||
regions:
|
||||
|
||||
$ readelf -l /proc/kcore
|
||||
...
|
||||
Program Headers:
|
||||
Type Offset VirtAddr PhysAddr
|
||||
FileSiz MemSiz Flags Align
|
||||
NOTE 0x0000000000000120 0x0000000000000000 0x0000000000000000
|
||||
0x0000000000002320 0x0000000000000000 0x0
|
||||
LOAD 0x1000000000010000 0xd000000000000000 0xffffffffffffffff
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
0x0001f80000000000 0x0001f80000000000 RWE 0x10000
|
||||
|
||||
makedumpfile uses max_paddr to calculate the number of sections for
|
||||
sparse memory model thus wrong number is obtained based on max_paddr
|
||||
(-1). This error could lead to the failure of copying /proc/kcore
|
||||
for RHEL-8.5 on ppc64le machine [1]:
|
||||
|
||||
$ makedumpfile /proc/kcore vmcore1
|
||||
get_mem_section: Could not validate mem_section.
|
||||
get_mm_sparsemem: Can't get the address of mem_section.
|
||||
|
||||
makedumpfile Failed.
|
||||
|
||||
Let's check if the phys_start of the segment is a valid physical
|
||||
address to fix this problem.
|
||||
|
||||
[1] https://bugzilla.redhat.com/show_bug.cgi?id=1965267
|
||||
|
||||
Reported-by: Xiaoying Yan <yiyan@redhat.com>
|
||||
Signed-off-by: Coiby Xu <coxu@redhat.com>
|
||||
---
|
||||
elf_info.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/makedumpfile-1.6.8/elf_info.c b/makedumpfile-1.6.8/elf_info.c
|
||||
index e8affb7..bc24083 100644
|
||||
--- a/makedumpfile-1.6.8/elf_info.c
|
||||
+++ b/makedumpfile-1.6.8/elf_info.c
|
||||
@@ -628,7 +628,7 @@ get_max_paddr(void)
|
||||
|
||||
for (i = 0; i < num_pt_loads; i++) {
|
||||
pls = &pt_loads[i];
|
||||
- if (max_paddr < pls->phys_end)
|
||||
+ if (pls->phys_start != NOT_PADDR && max_paddr < pls->phys_end)
|
||||
max_paddr = pls->phys_end;
|
||||
}
|
||||
return max_paddr;
|
||||
--
|
||||
2.29.2
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
From 9a6f589d99dcef114c89fde992157f5467028c8f Mon Sep 17 00:00:00 2001
|
||||
From: Tao Liu <ltao@redhat.com>
|
||||
Date: Fri, 18 Jun 2021 18:28:04 +0800
|
||||
Subject: [PATCH] check for invalid physical address of /proc/kcore
|
||||
when making ELF dumpfile
|
||||
|
||||
Previously when executing makedumpfile with -E option against
|
||||
/proc/kcore, makedumpfile will fail:
|
||||
|
||||
# makedumpfile -E -d 31 /proc/kcore kcore.dump
|
||||
...
|
||||
write_elf_load_segment: Can't convert physaddr(ffffffffffffffff) to an offset.
|
||||
|
||||
makedumpfile Failed.
|
||||
|
||||
It's because /proc/kcore contains PT_LOAD program headers which have
|
||||
physaddr (0xffffffffffffffff). With -E option, makedumpfile will
|
||||
try to convert the physaddr to an offset and fails.
|
||||
|
||||
Skip the PT_LOAD program headers which have such physaddr.
|
||||
|
||||
Signed-off-by: Tao Liu <ltao@redhat.com>
|
||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
---
|
||||
makedumpfile.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/makedumpfile-1.6.8/makedumpfile.c b/makedumpfile-1.6.8/makedumpfile.c
|
||||
index 894c88e..fcb571f 100644
|
||||
--- a/makedumpfile-1.6.8/makedumpfile.c
|
||||
+++ b/makedumpfile-1.6.8/makedumpfile.c
|
||||
@@ -7764,7 +7764,7 @@ write_elf_pages_cyclic(struct cache_data *cd_header, struct cache_data *cd_page)
|
||||
if (!get_phdr_memory(i, &load))
|
||||
return FALSE;
|
||||
|
||||
- if (load.p_type != PT_LOAD)
|
||||
+ if (load.p_type != PT_LOAD || load.p_paddr == NOT_PADDR)
|
||||
continue;
|
||||
|
||||
off_memory= load.p_offset;
|
||||
--
|
||||
2.29.2
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
commit 6d0d95ecc04a70f8448d562ff0fbbae237f5c929
|
||||
Author: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Date: Thu Apr 21 08:58:29 2022 +0900
|
||||
|
||||
[PATCH] Avoid false-positive mem_section validation with vmlinux
|
||||
|
||||
Currently get_mem_section() validates if SYMBOL(mem_section) is the address
|
||||
of the mem_section array first. But there was a report that the first
|
||||
validation wrongly returned TRUE with -x vmlinux and SPARSEMEM_EXTREME
|
||||
(4.15+) on s390x. This leads to crash failing statup with the following
|
||||
seek error:
|
||||
|
||||
crash: seek error: kernel virtual address: 67fffc2800 type: "memory section root table"
|
||||
|
||||
Skip the first validation when satisfying the conditions.
|
||||
|
||||
Reported-by: Dave Wysochanski <dwysocha@redhat.com>
|
||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Reviewed-and-Tested-by: Philipp Rudo <prudo@redhat.com>
|
||||
Reviewed-by: Pingfan Liu <piliu@redhat.com>
|
||||
|
||||
diff --git a/makedumpfile-1.7.1/makedumpfile.c b/makedumpfile-1.7.1/makedumpfile.c
|
||||
index a2f45c84cee3ba57ce3d3cf3f1905e6a03f4fd09..65d1c7c2f02c9ae8ead9de0f0217235fe72b3ca7 100644
|
||||
--- a/makedumpfile-1.7.1/makedumpfile.c
|
||||
+++ b/makedumpfile-1.7.1/makedumpfile.c
|
||||
@@ -3698,6 +3698,22 @@ validate_mem_section(unsigned long *mem_sec,
|
||||
return ret;
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * SYMBOL(mem_section) varies with the combination of memory model and
|
||||
+ * its source:
|
||||
+ *
|
||||
+ * SPARSEMEM
|
||||
+ * vmcoreinfo: address of mem_section root array
|
||||
+ * -x vmlinux: address of mem_section root array
|
||||
+ *
|
||||
+ * SPARSEMEM_EXTREME v1
|
||||
+ * vmcoreinfo: address of mem_section root array
|
||||
+ * -x vmlinux: address of mem_section root array
|
||||
+ *
|
||||
+ * SPARSEMEM_EXTREME v2 (with 83e3c48729d9 and a0b1280368d1) 4.15+
|
||||
+ * vmcoreinfo: address of mem_section root array
|
||||
+ * -x vmlinux: address of pointer to mem_section root array
|
||||
+ */
|
||||
static int
|
||||
get_mem_section(unsigned int mem_section_size, unsigned long *mem_maps,
|
||||
unsigned int num_section)
|
||||
@@ -3710,12 +3726,27 @@ get_mem_section(unsigned int mem_section_size, unsigned long *mem_maps,
|
||||
strerror(errno));
|
||||
return FALSE;
|
||||
}
|
||||
+
|
||||
+ /*
|
||||
+ * There was a report that the first validation wrongly returned TRUE
|
||||
+ * with -x vmlinux and SPARSEMEM_EXTREME v2 on s390x, so skip it.
|
||||
+ * Howerver, leave the fallback validation as it is for the -i option.
|
||||
+ */
|
||||
+ if (is_sparsemem_extreme() && info->name_vmlinux) {
|
||||
+ unsigned long flag = 0;
|
||||
+ if (get_symbol_type_name("mem_section", DWARF_INFO_GET_SYMBOL_TYPE,
|
||||
+ NULL, &flag)
|
||||
+ && !(flag & TYPE_ARRAY))
|
||||
+ goto skip_1st_validation;
|
||||
+ }
|
||||
+
|
||||
ret = validate_mem_section(mem_sec, SYMBOL(mem_section),
|
||||
mem_section_size, mem_maps, num_section);
|
||||
|
||||
if (!ret && is_sparsemem_extreme()) {
|
||||
unsigned long mem_section_ptr;
|
||||
|
||||
+skip_1st_validation:
|
||||
if (!readmem(VADDR, SYMBOL(mem_section), &mem_section_ptr,
|
||||
sizeof(mem_section_ptr)))
|
||||
goto out;
|
|
@ -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 -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
|
||||
|
@ -226,7 +226,7 @@ check_user_configured_target()
|
|||
|
||||
# For user configured target, use $SAVE_PATH as the dump path within the target
|
||||
if [ ! -d "$_mnt/$SAVE_PATH" ]; then
|
||||
perror_exit "Dump path \"$_mnt/$SAVE_PATH\" does not exist in dump target \"$_target\""
|
||||
perror_exit "Dump path \"$SAVE_PATH\" does not exist in dump target \"$_target\""
|
||||
fi
|
||||
|
||||
check_size fs "$_target"
|
||||
|
@ -432,6 +432,11 @@ 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().
|
||||
|
@ -441,7 +446,3 @@ if ! is_fadump_capable; then
|
|||
fi
|
||||
|
||||
echo "$dracut_args $@" | xargs dracut
|
||||
|
||||
_rc=$?
|
||||
sync
|
||||
exit $_rc
|
||||
|
|
|
@ -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.1/arch/arm64.c b/makedumpfile-1.7.1/arch/arm64.c
|
||||
index 1072178..95beae6 100644
|
||||
--- a/makedumpfile-1.7.1/arch/arm64.c
|
||||
+++ b/makedumpfile-1.7.1/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.1/makedumpfile.c b/makedumpfile-1.7.1/makedumpfile.c
|
||||
index 3ad4443..018ea4c 100644
|
||||
--- a/makedumpfile-1.7.1/makedumpfile.c
|
||||
+++ b/makedumpfile-1.7.1/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.1/makedumpfile.h b/makedumpfile-1.7.1/makedumpfile.h
|
||||
index e59239d..b6236dd 100644
|
||||
--- a/makedumpfile-1.7.1/makedumpfile.h
|
||||
+++ b/makedumpfile-1.7.1/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
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Name: kexec-tools
|
||||
Version: 2.0.20
|
||||
Release: 54%{?dist}
|
||||
Version: 2.0.25
|
||||
Release: 5%{?dist}
|
||||
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.1.tar.gz
|
||||
Source10: kexec-kdump-howto.txt
|
||||
Source12: mkdumprd.8
|
||||
Source13: 98-kexec.rules
|
||||
|
@ -38,6 +38,7 @@ Source32: 60-kdump.install
|
|||
Source33: kdump-logger.sh
|
||||
Source34: kdump-migrate-action.sh
|
||||
Source35: kdump-restart.sh
|
||||
Source36: mkfadumprd
|
||||
|
||||
#######################################
|
||||
# These are sources for mkdumpramfs
|
||||
|
@ -54,9 +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
|
||||
|
@ -65,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
|
||||
|
@ -92,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
|
||||
#
|
||||
|
@ -101,26 +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.20-makedumpfile-Add-dry-run-option-to-prevent-writing.patch
|
||||
Patch703: kexec-tools-2.0.20-makedumpfile-Add-shorthand-show-stats-option-to-show.patch
|
||||
Patch704: kexec-tools-2.0.20-makedumpfile-Show-write-byte-size-in-report-messages.patch
|
||||
Patch705: kexec-tools-2.0.22-makedumpfile-check-for-invalid-physical-address-proc-kcore-when-finding-max_paddr.patch
|
||||
Patch706: kexec-tools-2.0.22-makedumpfile-check-for-invalid-physical-address-proc-kcore-when-making-ELF-dumpfile.patch
|
||||
Patch702: kexec-tools-2.0.24-makedumpfile-Avoid_false_positive_mem_section_validation_with_vmlinux.patch
|
||||
|
||||
%description
|
||||
kexec-tools provides /usr/sbin/kexec binary that facilitates a new
|
||||
|
@ -138,23 +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
|
||||
%patch703 -p1
|
||||
%patch704 -p1
|
||||
%patch705 -p1
|
||||
%patch706 -p1
|
||||
|
||||
%ifarch ppc
|
||||
%define archdef ARCH=ppc
|
||||
|
@ -181,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.1 LINKTYPE=dynamic USELZO=on USESNAPPY=on USEZSTD=on
|
||||
make -C makedumpfile-1.7.1 LDFLAGS="$LDFLAGS -I../eppic/libeppic -L../eppic/libeppic" eppic_makedumpfile.so
|
||||
%endif
|
||||
|
||||
%install
|
||||
|
@ -218,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
|
||||
|
@ -245,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.1/makedumpfile $RPM_BUILD_ROOT/usr/sbin/makedumpfile
|
||||
install -m 644 makedumpfile-1.7.1/makedumpfile.8 $RPM_BUILD_ROOT/%{_mandir}/man8/makedumpfile.8
|
||||
install -m 644 makedumpfile-1.7.1/makedumpfile.conf.5 $RPM_BUILD_ROOT/%{_mandir}/man5/makedumpfile.conf.5
|
||||
install -m 644 makedumpfile-1.7.1/makedumpfile.conf $RPM_BUILD_ROOT/%{_sysconfdir}/makedumpfile.conf.sample
|
||||
install -m 755 makedumpfile-1.7.1/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.1/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
|
||||
|
@ -274,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
|
||||
|
@ -287,11 +276,11 @@ mv $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/* $RPM_BUILD_ROOT/%{d
|
|||
|
||||
touch /etc/kdump.conf
|
||||
|
||||
ARCH=`uname -m`
|
||||
if [ "$ARCH" == "ppc64" ] || [ "$ARCH" == "ppc64le" ]
|
||||
then
|
||||
servicelog_notify --add --command=/usr/lib/kdump/kdump-migrate-action.sh --match='refcode="#MIGRATE" and serviceable=0' --type=EVENT --method=pairs_stdin
|
||||
fi
|
||||
%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
|
||||
|
@ -320,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
|
||||
|
||||
|
@ -360,6 +352,7 @@ done
|
|||
/usr/sbin/kexec
|
||||
/usr/sbin/makedumpfile
|
||||
/usr/sbin/mkdumprd
|
||||
/usr/sbin/mkfadumprd
|
||||
/usr/sbin/vmcore-dmesg
|
||||
%{_bindir}/*
|
||||
%{_datadir}/kdump
|
||||
|
@ -403,6 +396,114 @@ done
|
|||
%endif
|
||||
|
||||
%changelog
|
||||
* 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
|
||||
|
|
Loading…
Reference in New Issue