import kexec-tools-2.0.24-5.el9

This commit is contained in:
CentOS Sources 2022-09-27 09:49:40 -04:00 committed by Stepan Oksanichenko
parent adfa3e6375
commit 0e9574d79c
18 changed files with 280 additions and 263 deletions

4
.gitignore vendored
View File

@ -1,3 +1,3 @@
SOURCES/eppic-e8844d3.tar.gz
SOURCES/kexec-tools-2.0.23.tar.xz
SOURCES/makedumpfile-1.7.0.tar.gz
SOURCES/kexec-tools-2.0.24.tar.xz
SOURCES/makedumpfile-1.7.1.tar.gz

View File

@ -1,3 +1,3 @@
80ac3f5e77d3c79883edadf14428734db4720009 SOURCES/eppic-e8844d3.tar.gz
c9213672bbc9d08d25f6b1ea0cd9056d2e1c5e73 SOURCES/kexec-tools-2.0.23.tar.xz
a931a40b80df204be1b02bfb502921cc618810fd SOURCES/makedumpfile-1.7.0.tar.gz
62b7a99779d66ffd07a1684f7b640d32c9697f0c SOURCES/kexec-tools-2.0.24.tar.xz
8f8485c2a1edbc730f4fa1b96ae3ec8d8f1f9761 SOURCES/makedumpfile-1.7.1.tar.gz

View File

@ -17,7 +17,7 @@ Latest kexec-tools provides "kdumpctl get-default-crashkernel" to retrieve
the default crashkernel value,
$ echo $(kdumpctl get-default-crashkernel)
1G-4G:192M,4G-64G:256M,64G-102400T:512M
1G-4G:192M,4G-64G:256M,64G-:512M
It will be taken as the default value of 'crashkernel=', you can use
this value as a reference for setting crashkernel value manually.
@ -37,10 +37,10 @@ Users can override the value during Anaconda installation manually.
Auto update of crashkernel boot parameter
=========================================
A new release of kexec-tools could update the default crashkernel value.
By default, kexec-tools would reset crashkernel to the new default value if it
detects old default crashkernel value is used by installed kernels. If you don't
want kexec-tools to update the old default crashkernel to the new default
A new release of kexec-tools could update the default crashkernel value. By
default, kexec-tools would reset crashkernel to the new default value if it
detects the old default crashkernel value is used by installed kernels. If you
don't want kexec-tools to update the old default crashkernel to the new default
crashkernel, you can change auto_reset_crashkernel to no in kdump.conf.
Supported Bootloaders
@ -67,19 +67,18 @@ value properly, `kdumpctl` also provides a sub-command:
`kdumpctl reset-crashkernel [--kernel=path_to_kernel] [--reboot]`
This command will read from the `crashkernel.default` file and reset
bootloader's kernel cmdline to the default value. It will also update bootloader
config if the bootloader has a standalone config file. User will have to reboot
the machine after this command to make it take effect if --reboot is not specified.
For ppc64le, an optional "[--fadump=[on|off|nocma]]" can also be specified to toggle
FADump on/off.
This command will reset the bootloader's kernel cmdline to the default value.
It will also update bootloader config if the bootloader has a standalone config
file. User will have to reboot the machine after this command to make it take
effect if --reboot is not specified. For more details, please refer to the
reset-crashkernel command in `man kdumpctl`.
Reset manually
--------------
To reset the crashkernel value manually, it's recommended to use utils like
`grubby`. A one liner script for resetting `crashkernel=` value of all installed
kernels to current boot kernel's crashkernel.default` is:
kernels to the default value is:
grubby --update-kernel ALL --args "crashkernel=$(kdumpctl get-default-crashkernel)"
@ -98,7 +97,7 @@ triggering kdump:
The output will be like this:
```
Encrypted kdump target requires extra memory, assuming using the keyslot with minimun memory requirement
Encrypted kdump target requires extra memory, assuming using the keyslot with minimum memory requirement
Reserved crashkernel: 256M
Recommended crashkernel: 655M

View File

@ -39,7 +39,7 @@ kernel are one and the same on ppc64.
If you're reading this document, you should already have kexec-tools
installed. If not, you install it via the following command:
# yum install kexec-tools
# dnf install kexec-tools
Fadump Operational Flow:
@ -82,7 +82,7 @@ How to configure fadump:
Again, we assume if you're reading this document, you should already have
kexec-tools installed. If not, you install it via the following command:
# yum install kexec-tools
# dnf install kexec-tools
Make the kernel to be configured with FADump as the default boot entry, if
it isn't already:
@ -94,20 +94,24 @@ anything interesting in the way of debug analysis, you'll also need to install
the kernel-debuginfo package, of the same arch as your running kernel, and the
crash utility:
# yum --enablerepo=\*debuginfo install kernel-debuginfo.$(uname -m) crash
# dnf --enablerepo=\*debuginfo install kernel-debuginfo.$(uname -m) crash
Next up, we need to modify some boot parameters to enable firmware assisted
dump. With the help of grubby, it's very easy to append "fadump=on" to the end
of your kernel boot parameters. To reserve the appropriate amount of memory
for boot memory preservation, pass 'crashkernel=X' kernel cmdline parameter.
For the recommended value of X, see 'FADump Memory Requirements' section.
Next up, we can enable firmware assisted dump and reserve the memory for boot
memory preservation as specified in in the table of 'FADump Memory Requirements'
section:
# kdumpctl reset-crashkernel --fadump=on
Alternatively, you can use grubby to reserve custom amount of memory:
# grubby --args="fadump=on crashkernel=6G" --update-kernel=/boot/vmlinuz-`uname -r`
By default, FADump reserved memory will be initialized as CMA area to make the
memory available through CMA allocator on the production kernel. We can opt out
of this, making reserved memory unavailable to production kernel, by booting the
linux kernel with 'fadump=nocma' instead of 'fadump=on'.
linux kernel with 'fadump=nocma' instead of 'fadump=on':
# kdumpctl reset-crashkernel --fadump=nocma
The term 'boot memory' means size of the low memory chunk that is required for
a kernel to boot successfully when booted with restricted memory. By default,
@ -350,6 +354,6 @@ Remove "crashkernel=" from kernel cmdline parameters:
If KDump is to be used as the dump capturing mechanism, reset the crashkernel parameter:
# kdumpctl reset-crashkernel `uname -r`
# kdumpctl reset-crashkernel --fadump=off
Reboot the system for the settings to take effect.

View File

@ -630,8 +630,36 @@ 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"
# Use BOOT_IMAGE as reference if possible, strip the GRUB root device prefix in (hd0,gpt1) format
boot_img="$(sed "s/^BOOT_IMAGE=\((\S*)\)\?\(\S*\) .*/\2/" /proc/cmdline)"
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:
# Detect initrd and kernel location, results are stored in global environmental variables:
# KDUMP_BOOTDIR, KDUMP_KERNELVER, KDUMP_KERNEL, DEFAULT_INITRD, and KDUMP_INITRD
#
# Expectes KDUMP_BOOTDIR, KDUMP_IMG, KDUMP_IMG_EXT, KDUMP_KERNELVER to be loaded from config already
@ -639,37 +667,40 @@ prepare_kexec_args()
#
prepare_kdump_bootinfo()
{
local boot_img boot_imglist boot_dirlist boot_initrdlist
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)"
KDUMP_KERNELVER=$(uname -r)
nondebug_kernelver=$(sed -n -e 's/\(.*\)+debug$/\1/p' <<< "$KDUMP_KERNELVER")
fi
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"
# Use BOOT_IMAGE as reference if possible, strip the GRUB root device prefix in (hd0,gpt1) format
boot_img="$(sed "s/^BOOT_IMAGE=\((\S*)\)\?\(\S*\) .*/\2/" /proc/cmdline)"
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 [[ -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")
@ -677,8 +708,8 @@ prepare_kdump_bootinfo()
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"
default_initrd_base="$initrd"
DEFAULT_INITRD="$KDUMP_BOOTDIR/$default_initrd_base"
break
fi
done
@ -686,12 +717,12 @@ 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
@ -785,46 +816,48 @@ prepare_cmdline()
echo "$cmdline"
}
#get system memory size in the unit of GB
PROC_IOMEM=/proc/iomem
#get system memory size i.e. memblock.memory.total_size in the unit of GB
get_system_size()
{
result=$(grep "System RAM" /proc/iomem | awk -F ":" '{ print $1 }' | tr "[:lower:]" "[:upper:]" | paste -sd+)
result="+$result"
# replace '-' with '+0x' and '+' with '-0x'
sum=$(echo "$result" | sed -e 's/-/K0x/g' -e 's/+/-0x/g' -e 's/K/+/g')
size=$(printf "%d\n" $((sum)))
size=$((size / 1024 / 1024 / 1024))
echo "$size"
sum=$(sed -n "s/\s*\([0-9a-fA-F]\+\)-\([0-9a-fA-F]\+\) : System RAM$/+ 0x\2 - 0x\1 + 1/p" $PROC_IOMEM)
echo $(( (sum) / 1024 / 1024 / 1024))
}
# Return the recommended size for the reserved crashkernel memory
# depending on the system memory size.
#
# This functions is expected to be consistent with the parse_crashkernel_mem()
# in kernel i.e. how kernel allocates the kdump memory given the crashkernel
# parameter crashkernel=range1:size1[,range2:size2,…] and the system memory
# size.
get_recommend_size()
{
local mem_size=$1
local _ck_cmdline=$2
local OLDIFS="$IFS"
local range start start_unit end end_unit size
start=${_ck_cmdline::1}
if [[ $mem_size -lt $start ]]; then
echo "0M"
return
fi
IFS=','
for i in $_ck_cmdline; do
end=$(echo "$i" | awk -F "-" '{ print $2 }' | awk -F ":" '{ print $1 }')
recommend=$(echo "$i" | awk -F "-" '{ print $2 }' | awk -F ":" '{ print $2 }')
size=${end::-1}
unit=${end: -1}
if [[ $unit == 'T' ]]; then
size=$((size * 1024))
fi
if [[ $mem_size -lt $size ]]; then
echo "$recommend"
IFS="$OLDIFS"
while read -r -d , range; do
# need to use non-default IFS as double spaces are used as a
# single delimiter while commas aren't...
IFS=, read start start_unit end end_unit size <<< \
"$(echo "$range" | sed -n "s/\([0-9]\+\)\([GT]\?\)-\([0-9]*\)\([GT]\?\):\([0-9]\+[MG]\)/\1,\2,\3,\4,\5/p")"
# aka. 102400T
end=${end:-104857600}
[[ "$end_unit" == T ]] && end=$((end * 1024))
[[ "$start_unit" == T ]] && start=$((start * 1024))
if [[ $mem_size -ge $start ]] && [[ $mem_size -lt $end ]]; then
echo "$size"
return
fi
done
IFS="$OLDIFS"
# append a ',' as read expects the 'file' to end with a delimiter
done <<< "$_ck_cmdline,"
# no matching range found
echo "0M"
}
# get default crashkernel
@ -848,7 +881,8 @@ kdump_get_arch_recommend_crashkernel()
if [[ $_arch == "x86_64" ]] || [[ $_arch == "s390x" ]]; then
_ck_cmdline="1G-4G:192M,4G-64G:256M,64G-:512M"
elif [[ $_arch == "aarch64" ]]; then
_ck_cmdline="2G-:448M"
# For 4KB page size, the formula is based on x86 plus extra = 64M
_ck_cmdline="1G-4G:256M,4G-64G:320M,64G-:576M"
elif [[ $_arch == "ppc64le" ]]; then
if [[ $_dump_mode == "fadump" ]]; then
_ck_cmdline="4G-16G:768M,16G-64G:1G,64G-128G:2G,128G-1T:4G,1T-2T:6G,2T-4T:12G,4T-8T:20G,8T-16T:36G,16T-32T:64G,32T-64T:128G,64T-:180G"
@ -885,7 +919,8 @@ get_luks_crypt_dev()
[[ -b /dev/block/$1 ]] || return 1
_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

View File

@ -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 cma hugetlb_cma"
KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb cma hugetlb_cma ignition.firstboot"
# This variable lets us append arguments to the current kdump commandline
# after processed by KDUMP_COMMANDLINE_REMOVE

View File

@ -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 cma hugetlb_cma"
KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb cma hugetlb_cma ignition.firstboot"
# This variable lets us append arguments to the current kdump commandline
# after processed by KDUMP_COMMANDLINE_REMOVE

View File

@ -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 cma hugetlb_cma"
KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb cma hugetlb_cma ignition.firstboot"
# This variable lets us append arguments to the current kdump commandline
# after processed by KDUMP_COMMANDLINE_REMOVE

View File

@ -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 hugetlb_cma"
KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb hugetlb_cma ignition.firstboot"
# This variable lets us append arguments to the current kdump commandline
# after processed by KDUMP_COMMANDLINE_REMOVE

View File

@ -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 hugetlb_cma"
KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb hugetlb_cma ignition.firstboot"
# This variable lets us append arguments to the current kdump commandline
# after processed by KDUMP_COMMANDLINE_REMOVE

View File

@ -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 vmcp_cma cma hugetlb_cma prot_virt"
KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb vmcp_cma cma hugetlb_cma prot_virt ignition.firstboot"
# This variable lets us append arguments to the current kdump commandline
# after processed by KDUMP_COMMANDLINE_REMOVE

View File

@ -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 cma hugetlb_cma"
KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb cma hugetlb_cma ignition.firstboot"
# This variable lets us append arguments to the current kdump commandline
# after processed by KDUMP_COMMANDLINE_REMOVE

View File

@ -14,7 +14,7 @@ In most cases, you should use
.B systemctl
to start / stop / enable kdump service instead. However,
.B kdumpctl
provides more details for debug and a helper to setup ssh key authentication.
provides more details for debugging and a helper to set up ssh key authentication.
.SH COMMANDS
.TP
@ -26,14 +26,14 @@ Stop the service.
.TP
.I status
Prints the current status of kdump service.
It returns non-zero value if kdump is not operational.
It returns a non-zero value if kdump is not operational.
.TP
.I restart
Is equal to
.I start; stop
.TP
.I reload
reload crash kernel image and initramfs without triggering a rebuild.
reload the crash kernel image and initramfs without triggering a rebuild.
.TP
.I rebuild
rebuild the crash kernel initramfs.
@ -43,20 +43,23 @@ Helps to setup key authentication for ssh storage since it's
impossible to use password authentication during kdump.
.TP
.I showmem
Prints the size of reserved memory for crash kernel in megabytes.
Prints the size of reserved memory for the crash kernel in megabytes.
.TP
.I estimate
Estimate a suitable crashkernel value for current machine. This is a
best-effort estimate. It will print a recommanded crashkernel value
based on current kdump setup, and list some details of memory usage.
Estimate a suitable crashkernel value for the current machine. This is a
best-effort estimate. It will print a recommended crashkernel value
based on the current kdump setup, and list some details of memory usage.
.TP
.I get-default-crashkernel
Return the default crashkernel value provided by kexec-tools.
.TP
.I reset-crashkernel [--kernel=path_to_kernel] [--reboot]
Reset crashkernel to default value recommended by kexec-tools. If no kernel
is specified, will reset KDUMP_KERNELVER if it's defined in /etc/sysconfig/kdump
or current running kernel's crashkernel value if KDUMP_KERNELVER is empty. You can
or the current running kernel's crashkernel value if KDUMP_KERNELVER is empty. You can
also specify --kernel=ALL and --kernel=DEFAULT which have the same meaning as
grubby's kernel-path=ALL and kernel-path=DEFAULT. ppc64le supports FADump and
supports an additonal [--fadump=[on|off|nocma]] parameter to toggle FADump
supports an additional [--fadump=[on|off|nocma]] parameter to toggle FADump
on/off.
Note: The memory requirements for kdump varies heavily depending on the

View File

@ -44,7 +44,7 @@ ia64 and ppc64.
If you're reading this document, you should already have kexec-tools
installed. If not, you install it via the following command:
# yum install kexec-tools
# dnf install kexec-tools
Now load a kernel with kexec:
@ -66,23 +66,31 @@ How to configure kdump
Again, we assume if you're reading this document, you should already have
kexec-tools installed. If not, you install it via the following command:
# yum install kexec-tools
# dnf install kexec-tools
To be able to do much of anything interesting in the way of debug analysis,
you'll also need to install the kernel-debuginfo package, of the same arch
as your running kernel, and the crash utility:
# yum --enablerepo=\*debuginfo install kernel-debuginfo.$(uname -m) crash
# dnf --enablerepo=\*debuginfo install kernel-debuginfo.$(uname -m) crash
Next up, we need to modify some boot parameters to reserve a chunk of memory for
the capture kernel. With the help of grubby, it's very easy to append
"crashkernel=128M" to the end of your kernel boot parameters. Note that the X
values are such that X = the amount of memory to reserve for the capture kernel.
And based on arch and system configuration, one might require more than 128M to
be reserved for kdump. One need to experiment and test kdump, if 128M is not
sufficient, try reserving more memory.
Next up, we need to reserve a chunk of memory for the capture kernel. To use
the default crashkernel value, you can kdumpctl:
# grubby --args="crashkernel=128M" --update-kernel=/boot/vmlinuz-`uname -r`
# kdumpctl reset-crashkernel --kernel=/boot/vmlinuz-`uname -r`
If the default value does not work for your setup you can use
# grubby --args="crashkernel=256M" --update-kernel=/boot/vmlinuz-`uname -r`
to specify a larger value, in this case 256M. You need to experiment to
find the best value that works for your setup. To begin with
# kdumpctl estimate
gives you an estimation for the crashkernel value based on the currently
running kernel. For more details, please refer to the "Estimate crashkernel"
section in /usr/share/doc/kexec-tools/crashkernel-howto.txt.
Note that there is an alternative form in which to specify a crashkernel
memory reservation, in the event that more control is needed over the size and
@ -135,7 +143,7 @@ in /var/crash/<YYYY-MM-DD-HH:MM>/vmcore), then the system rebooted back into
your normal kernel.
Once back to your normal kernel, you can use the previously installed crash
kernel in conjunction with the previously installed kernel-debuginfo to
utility in conjunction with the previously installed kernel-debuginfo to
perform postmortem analysis:
# crash /usr/lib/debug/lib/modules/2.6.17-1.2621.el5/vmlinux

View File

@ -1,95 +0,0 @@
commit 186e7b0752d8fce1618fa37519671c834c46340e
Author: Alexander Egorenkov <egorenar@linux.ibm.com>
Date: Wed Dec 15 18:48:53 2021 +0100
s390: handle R_390_PLT32DBL reloc entries in machine_apply_elf_rel()
Starting with gcc 11.3, the C compiler will generate PLT-relative function
calls even if they are local and do not require it. Later on during linking,
the linker will replace all PLT-relative calls to local functions with
PC-relative ones. Unfortunately, the purgatory code of kexec/kdump is
not being linked as a regular executable or shared library would have been,
and therefore, all PLT-relative addresses remain in the generated purgatory
object code unresolved. This in turn lets kexec-tools fail with
"Unknown rela relocation: 0x14 0x73c0901c" for such relocation types.
Furthermore, the clang C compiler has always behaved like described above
and this commit should fix the purgatory code built with the latter.
Because the purgatory code is no regular executable or shared library,
contains only calls to local functions and has no PLT, all R_390_PLT32DBL
relocation entries can be resolved just like a R_390_PC32DBL one.
* https://refspecs.linuxfoundation.org/ELF/zSeries/lzsabi0_zSeries/x1633.html#AEN1699
Relocation entries of purgatory code generated with gcc 11.3
------------------------------------------------------------
$ readelf -r purgatory/purgatory.o
Relocation section '.rela.text' at offset 0x6e8 contains 27 entries:
Offset Info Type Sym. Value Sym. Name + Addend
00000000000c 000300000013 R_390_PC32DBL 0000000000000000 .data + 2
00000000001a 001000000014 R_390_PLT32DBL 0000000000000000 sha256_starts + 2
000000000030 001100000014 R_390_PLT32DBL 0000000000000000 sha256_update + 2
000000000046 001200000014 R_390_PLT32DBL 0000000000000000 sha256_finish + 2
000000000050 000300000013 R_390_PC32DBL 0000000000000000 .data + 102
00000000005a 001300000014 R_390_PLT32DBL 0000000000000000 memcmp + 2
...
000000000118 001600000014 R_390_PLT32DBL 0000000000000000 setup_arch + 2
00000000011e 000300000013 R_390_PC32DBL 0000000000000000 .data + 2
00000000012c 000f00000014 R_390_PLT32DBL 0000000000000000 verify_sha256_digest + 2
000000000142 001700000014 R_390_PLT32DBL 0000000000000000
post_verification[...] + 2
Relocation entries of purgatory code generated with gcc 11.2
------------------------------------------------------------
$ readelf -r purgatory/purgatory.o
Relocation section '.rela.text' at offset 0x6e8 contains 27 entries:
Offset Info Type Sym. Value Sym. Name + Addend
00000000000e 000300000013 R_390_PC32DBL 0000000000000000 .data + 2
00000000001c 001000000013 R_390_PC32DBL 0000000000000000 sha256_starts + 2
000000000036 001100000013 R_390_PC32DBL 0000000000000000 sha256_update + 2
000000000048 001200000013 R_390_PC32DBL 0000000000000000 sha256_finish + 2
000000000052 000300000013 R_390_PC32DBL 0000000000000000 .data + 102
00000000005c 001300000013 R_390_PC32DBL 0000000000000000 memcmp + 2
...
00000000011a 001600000013 R_390_PC32DBL 0000000000000000 setup_arch + 2
000000000120 000300000013 R_390_PC32DBL 0000000000000000 .data + 122
000000000130 000f00000013 R_390_PC32DBL 0000000000000000 verify_sha256_digest + 2
000000000146 001700000013 R_390_PC32DBL 0000000000000000 post_verification[...] + 2
Corresponding s390 kernel discussion:
* https://lore.kernel.org/linux-s390/20211208105801.188140-1-egorenar@linux.ibm.com/T/#u
Signed-off-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Reported-by: Tao Liu <ltao@redhat.com>
Suggested-by: Philipp Rudo <prudo@redhat.com>
Reviewed-by: Philipp Rudo <prudo@redhat.com>
[hca@linux.ibm.com: changed commit message as requested by Philipp Rudo]
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
diff --git a/kexec/arch/s390/kexec-elf-rel-s390.c b/kexec/arch/s390/kexec-elf-rel-s390.c
index a5e1b73455785ae3bc3aa72b3beee13ae202e82f..91ba86a9991dad4271b834fc3b24861c40309e52 100644
--- a/kexec/arch/s390/kexec-elf-rel-s390.c
+++ b/kexec/arch/s390/kexec-elf-rel-s390.c
@@ -56,6 +56,7 @@ void machine_apply_elf_rel(struct mem_ehdr *UNUSED(ehdr),
case R_390_PC16: /* PC relative 16 bit. */
case R_390_PC16DBL: /* PC relative 16 bit shifted by 1. */
case R_390_PC32DBL: /* PC relative 32 bit shifted by 1. */
+ case R_390_PLT32DBL: /* 32 bit PC rel. PLT shifted by 1. */
case R_390_PC32: /* PC relative 32 bit. */
case R_390_PC64: /* PC relative 64 bit. */
val -= address;
@@ -63,7 +64,7 @@ void machine_apply_elf_rel(struct mem_ehdr *UNUSED(ehdr),
*(unsigned short *) loc = val;
else if (r_type == R_390_PC16DBL)
*(unsigned short *) loc = val >> 1;
- else if (r_type == R_390_PC32DBL)
+ else if (r_type == R_390_PC32DBL || r_type == R_390_PLT32DBL)
*(unsigned int *) loc = val >> 1;
else if (r_type == R_390_PC32)
*(unsigned int *) loc = val;

View File

@ -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;

View File

@ -1,49 +0,0 @@
From 59b1726fbcc251155140c8a1972384498fee4daf Mon Sep 17 00:00:00 2001
From: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
Date: Tue, 25 Jan 2022 12:55:15 +0000
Subject: [PATCH] [PATCH] sadump, kaslr: fix failure of calculating
kaslr_offset
On kernels v5.8 or later, makedumpfile fails for memory dumps in the
sadump-related formats as follows:
# makedumpfile -f -l -d 31 -x ./vmlinux /dev/sdd4 /root/vmcore-ld31
__vtop4_x86_64: Can't get a valid pud_pte.
...110 lines of the same message...
__vtop4_x86_64: Can't get a valid pud_pte.
calc_kaslr_offset: failed to calculate kaslr_offset and phys_base; default to 0
readmem: type_addr: 1, addr:ffffffff85411858, size:8
__vtop4_x86_64: Can't get pgd (page_dir:ffffffff85411858).
readmem: Can't convert a virtual address(ffffffff059be980) to physical address.
readmem: type_addr: 0, addr:ffffffff059be980, size:1024
cpu_online_mask_init: Can't read cpu_online_mask memory.
makedumpfile Failed.
This is caused by the kernel commit 9d06c4027f21 ("x86/entry: Convert
Divide Error to IDTENTRY") that renamed divide_error to
asm_exc_divide_error, breaking logic for calculating kaslr offset.
Fix this by adding initialization of asm_exc_divide_error.
Signed-off-by: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
---
makedumpfile.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/makedumpfile-1.7.0/makedumpfile.c b/makedumpfile-1.7.0/makedumpfile.c
index a51bdaf..7ed9756 100644
--- a/makedumpfile-1.7.0/makedumpfile.c
+++ b/makedumpfile-1.7.0/makedumpfile.c
@@ -1667,6 +1667,8 @@ get_symbol_info(void)
SYMBOL_INIT(cur_cpu_spec, "cur_cpu_spec");
SYMBOL_INIT(divide_error, "divide_error");
+ if (SYMBOL(divide_error) == NOT_FOUND_SYMBOL)
+ SYMBOL_INIT(divide_error, "asm_exc_divide_error");
SYMBOL_INIT(idt_table, "idt_table");
SYMBOL_INIT(saved_command_line, "saved_command_line");
SYMBOL_INIT(pti_init, "pti_init");
--
2.33.1

View File

@ -1,11 +1,11 @@
%global eppic_ver e8844d3793471163ae4a56d8f95897be9e5bd554
%global eppic_shortver %(c=%{eppic_ver}; echo ${c:0:7})
%global mkdf_ver 1.7.0
%global mkdf_ver 1.7.1
%global mkdf_shortver %(c=%{mkdf_ver}; echo ${c:0:7})
Name: kexec-tools
Version: 2.0.23
Release: 9_1%{?dist}
Version: 2.0.24
Release: 5%{?dist}
License: GPLv2
Summary: The kexec/kdump userspace component
@ -104,6 +104,7 @@ Requires: systemd-udev%{?_isa}
#
# Patches 401 through 500 are meant for s390 kexec-tools enablement
#
#
# Patches 501 through 600 are meant for ARM kexec-tools enablement
#
@ -111,8 +112,7 @@ Requires: systemd-udev%{?_isa}
#
# Patches 601 onward are generic patches
#
Patch601: ./kexec-tools-2.0.22-01-s390_handle_R_390_PLT32DBL_reloc_entries_in_machine_apply_elf_rel_.patch
Patch602: ./kexec-tools-2.0.23-makedumpfile-sadump-kaslr-fix-failure-of-calculating-kaslr_.patch
Patch601: ./kexec-tools-2.0.23-makedumpfile-Avoid_false_positive_mem_section_validation_with_vmlinux.patch
%description
kexec-tools provides /sbin/kexec binary that facilitates a new
@ -129,7 +129,6 @@ tar -z -x -v -f %{SOURCE9}
tar -z -x -v -f %{SOURCE19}
%patch601 -p1
%patch602 -p1
%ifarch ppc
%define archdef ARCH=ppc
@ -225,7 +224,9 @@ install -m 755 -D %{SOURCE33} $RPM_BUILD_ROOT%{_prefix}/lib/kernel/install.d/92-
%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64
install -m 755 makedumpfile-%{mkdf_ver}/makedumpfile $RPM_BUILD_ROOT/usr/sbin/makedumpfile
gzip -c makedumpfile-%{mkdf_ver}/makedumpfile.8 > makedumpfile-%{mkdf_ver}/makedumpfile.8.gz
install -m 644 makedumpfile-%{mkdf_ver}/makedumpfile.8.gz $RPM_BUILD_ROOT/%{_mandir}/man8/makedumpfile.8.gz
gzip -c makedumpfile-%{mkdf_ver}/makedumpfile.conf.5 > makedumpfile-%{mkdf_ver}/makedumpfile.conf.5.gz
install -m 644 makedumpfile-%{mkdf_ver}/makedumpfile.conf.5.gz $RPM_BUILD_ROOT/%{_mandir}/man5/makedumpfile.conf.5.gz
install -m 644 makedumpfile-%{mkdf_ver}/makedumpfile.conf $RPM_BUILD_ROOT/%{_sysconfdir}/makedumpfile.conf.sample
install -m 755 makedumpfile-%{mkdf_ver}/eppic_makedumpfile.so $RPM_BUILD_ROOT/%{_libdir}/eppic_makedumpfile.so
@ -409,9 +410,44 @@ fi
%endif
%changelog
* Mon Mar 7 2022 Tao Liu <ltao@redhat.com> - 2.0.23-9_1
* Tue Jul 12 2022 Tao Liu <ltao@redhat.com> - 2.0.24-5
- kdump-lib: use non-debug kernels first
- kdump-lib: fix typo in variable name
* Tue Wed 15 2022 Tao Liu <ltao@redhat.com> - 2.0.24-4
- crashkernel: optimize arm64 reserved size if PAGE_SIZE=4k
- kdump-lib.sh: Check the output of blkid with sed instead of eval
* Tue Jun 7 2022 Tao Liu <ltao@redhat.com> - 2.0.24-3
- kdump.sysconfig*: add ignition.firstboot to KDUMP_COMMANDLINE_REMOVE
* Thu May 23 2022 Tao Liu <ltao@redhat.com> - 2.0.24-2
- remove the upper bound of default crashkernel value example
- update fadump-howto
- update kexec-kdump-howto
- update crashkernel-howto
- add man documentation for kdumpctl get-default-crashkernel
- improve get_recommend_size
- fix a calculation error in get_system_size
* Thu May 5 2022 Tao Liu <ltao@redhat.com> - 2.0.24-1
- Rebase kexec-tools to v2.0.24
- Rebase makedumpfile to 1.7.1
- Avoid false-positive mem_section validation with vmlinux
* Fri Apr 8 2022 Tao Liu <ltao@redhat.com> - 2.0.23-10
- try to update the crashkernel in GRUB_ETC_DEFAULT after kexec-tools updates the default crashkernel value
- address the case where there are multiple values for the same kernel arg
- 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
* Fri Feb 25 2022 Tao Liu <ltao@redhat.com> - 2.0.23-9
- makedumpfile: sadump, kaslr: fix failure of calculating kaslr_offset