import kexec-tools-2.0.23-9_1.el9_0

This commit is contained in:
CentOS Sources 2022-04-05 06:58:12 -04:00 committed by Stepan Oksanichenko
parent 9cb4deb9ee
commit adfa3e6375
3 changed files with 139 additions and 15 deletions

View File

@ -1425,25 +1425,59 @@ _get_all_kernels_from_grubby()
}
GRUB_ETC_DEFAULT="/etc/default/grub"
# modify the kernel command line parameter in default grub conf
# Update a kernel parameter in default grub conf
#
# If a value is specified, it will be inserted in the end. Otherwise it
# would remove given kernel parameter.
#
# Note this function doesn't address the following cases,
# 1. The kernel ignores everything on the command line after a '--'. So
# simply adding the new entry to the end will fail if the cmdline
# contains a --.
# 2. If the value for a parameter contains spaces it can be quoted using
# double quotes, for example param="value with spaces". This will
# break the [^[:space:]\"] regex for the value.
# 3. Dashes and underscores in the parameter name are equivalent. So
# some_parameter and some-parameter are identical.
# 4. Some parameters, e.g. efivar_ssdt, can be given multiple times.
# 5. Some kernel parameters, e.g. quiet, doesn't have value
#
# $1: the name of the kernel command line parameter
# $2: new value. If empty, the parameter would be removed
_update_kernel_cmdline_in_grub_etc_default()
# $2: new value. If empty, given parameter would be removed
_update_kernel_arg_in_grub_etc_default()
{
local _para=$1 _val=$2 _para_val _regex
local _para=$1 _val=$2 _para_val
if [[ -n $_val ]]; then
_para_val="$_para=$_val"
fi
_regex='^(GRUB_CMDLINE_LINUX=.*)([[:space:]"])'"$_para"'=[^[:space:]"]*(.*)$'
if grep -q -E "$_regex" "$GRUB_ETC_DEFAULT"; then
sed -i -E 's/'"$_regex"'/\1\2'"$_para_val"'\3/' "$GRUB_ETC_DEFAULT"
elif [[ -n $_para_val ]]; then
# If the kernel parameter doesn't exist, put it in the first
sed -i -E 's/^(GRUB_CMDLINE_LINUX=")/\1'"$_para_val"' /' "$GRUB_ETC_DEFAULT"
fi
# Update the command line /etc/default/grub, i.e.
# on the line that starts with 'GRUB_CMDLINE_LINUX=',
# 1) remove $para=$val if the it's the first arg
# 2) remove all occurences of $para=$val
# 3) insert $_para_val to end
# 4) remove duplicate spaces left over by 1) or 2) or 3)
# 5) remove space at the beginning of the string left over by 1) or 2) or 3)
# 6) remove space at the end of the string left over by 1) or 2) or 3)
sed -i -E "/^GRUB_CMDLINE_LINUX=/ {
s/\"${_para}=[^[:space:]\"]*/\"/g;
s/[[:space:]]+${_para}=[^[:space:]\"]*/ /g;
s/\"$/ ${_para_val}\"/
s/[[:space:]]+/ /g;
s/(\")[[:space:]]+/\1/g;
s/[[:space:]]+(\")/\1/g;
}" "$GRUB_ETC_DEFAULT"
}
# Read the kernel arg in default grub conf.
# Note reading a kernel parameter that doesn't have a value isn't supported.
#
# $1: the name of the kernel command line parameter
_read_kernel_arg_in_grub_etc_default()
{
sed -n -E "s/^GRUB_CMDLINE_LINUX=.*[[:space:]\"]${1}=([^[:space:]\"]*).*$/\1/p" "$GRUB_ETC_DEFAULT"
}
reset_crashkernel()
@ -1522,10 +1556,12 @@ reset_crashkernel()
# - set the dump mode as kdump for non-ppc64le cases
# - retrieved the default crashkernel value for given dump mode
if [[ $_grubby_kernel_path == ALL && -n $_dump_mode ]]; then
_update_kernel_cmdline_in_grub_etc_default crashkernel "$_crashkernel"
_update_kernel_arg_in_grub_etc_default crashkernel "$_crashkernel"
# remove the fadump if fadump is disabled
[[ $_fadump_val == off ]] && _fadump_val=""
_update_kernel_cmdline_in_grub_etc_default fadump "$_fadump_val"
if [[ $_fadump_val == off ]]; then
_fadump_val=""
fi
_update_kernel_arg_in_grub_etc_default fadump "$_fadump_val"
fi
# If kernel-path not specified, either
@ -1577,6 +1613,34 @@ reset_crashkernel()
fi
}
# update the crashkernel value in GRUB_ETC_DEFAULT if necessary
#
# called by reset_crashkernel_after_update and inherit its array variable
# _crashkernel_vals
update_crashkernel_in_grub_etc_default_after_update()
{
local _crashkernel _fadump_val
local _dump_mode _old_default_crashkernel _new_default_crashkernel
_crashkernel=$(_read_kernel_arg_in_grub_etc_default crashkernel)
if [[ -z $_crashkernel ]]; then
return
fi
_fadump_val=$(_read_kernel_arg_in_grub_etc_default fadump)
_dump_mode=$(get_dump_mode_by_fadump_val "$_fadump_val")
_old_default_crashkernel=${_crashkernel_vals[old_${_dump_mode}]}
_new_default_crashkernel=${_crashkernel_vals[new_${_dump_mode}]}
if [[ $_crashkernel == auto ]] ||
[[ $_crashkernel == "$_old_default_crashkernel" &&
$_new_default_crashkernel != "$_old_default_crashkernel" ]]; then
_update_kernel_arg_in_grub_etc_default crashkernel "$_new_default_crashkernel"
fi
}
# shellcheck disable=SC2154 # false positive when dereferencing an array
reset_crashkernel_after_update()
{
@ -1605,6 +1669,8 @@ reset_crashkernel_after_update()
fi
fi
done
update_crashkernel_in_grub_etc_default_after_update
}
# read the value of an environ variable from given environ file path

View File

@ -0,0 +1,49 @@
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

@ -5,7 +5,7 @@
Name: kexec-tools
Version: 2.0.23
Release: 8%{?dist}
Release: 9_1%{?dist}
License: GPLv2
Summary: The kexec/kdump userspace component
@ -112,6 +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
%description
kexec-tools provides /sbin/kexec binary that facilitates a new
@ -128,6 +129,7 @@ tar -z -x -v -f %{SOURCE9}
tar -z -x -v -f %{SOURCE19}
%patch601 -p1
%patch602 -p1
%ifarch ppc
%define archdef ARCH=ppc
@ -407,6 +409,13 @@ fi
%endif
%changelog
* Mon Mar 7 2022 Tao Liu <ltao@redhat.com> - 2.0.23-9_1
- 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
* Fri Feb 25 2022 Tao Liu <ltao@redhat.com> - 2.0.23-9
- makedumpfile: sadump, kaslr: fix failure of calculating kaslr_offset
* Mon Feb 21 2022 Tao Liu <ltao@redhat.com> - 2.0.23-8
- update kernel crashkernel in posttrans RPM scriptlet when updating kexec-tools