From c6f9b222699e94f5166121d705d171bcae97ce22 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Nov 30 2017 13:43:42 +0000 Subject: import kpatch-0.4.0-2.el7_4 --- diff --git a/SOURCES/0001-kpatch-add-ABI-backwards-compatibility.patch b/SOURCES/0001-kpatch-add-ABI-backwards-compatibility.patch new file mode 100644 index 0000000..ecc21ce --- /dev/null +++ b/SOURCES/0001-kpatch-add-ABI-backwards-compatibility.patch @@ -0,0 +1,86 @@ +From 9eed5d4bac0b43372d98572d923ca84e091c8982 Mon Sep 17 00:00:00 2001 +Message-Id: <9eed5d4bac0b43372d98572d923ca84e091c8982.1508328327.git.jpoimboe@redhat.com> +From: Josh Poimboeuf +Date: Mon, 9 Oct 2017 09:04:46 -0500 +Subject: [PATCH] kpatch: add ABI backwards compatibility + +When running a kernel for a long period of time without rebooting, it's +possible that newer versions of the kpatch script may get installed. So +new versions of the kpatch script need to support old versions of +kpatch.ko. + +Signed-off-by: Josh Poimboeuf +--- + kpatch/kpatch | 35 +++++++++++++++++++++++++++-------- + 1 file changed, 27 insertions(+), 8 deletions(-) + +diff --git a/kpatch/kpatch b/kpatch/kpatch +index ef36087..5998fbc 100755 +--- a/kpatch/kpatch ++++ b/kpatch/kpatch +@@ -27,14 +27,6 @@ INSTALLDIR=/var/lib/kpatch + SCRIPTDIR="$(readlink -f $(dirname $(type -p $0)))" + VERSION="0.4.0" + +-# Livepatch is built into the kernel, if it's not present +-# we must use kpatch core module. +-if [[ -e /sys/kernel/livepatch ]] ; then +- SYSFS="/sys/kernel/livepatch" +-else +- SYSFS="/sys/kernel/kpatch" +-fi +- + usage_cmd() { + printf ' %-20s\n %s\n' "$1" "$2" >&2 + } +@@ -132,6 +124,23 @@ get_module_name () { + echo $(readelf -p .gnu.linkonce.this_module $1 | grep '\[.*\]' | awk '{print $3}') + } + ++init_sysfs_var() { ++ # If the kernel is configured with CONFIG_LIVEPATCH, use that. ++ # Otherwise, use the kpatch core module (kpatch.ko). ++ if [[ -e /sys/kernel/livepatch ]] ; then ++ # livepatch ABI ++ SYSFS="/sys/kernel/livepatch" ++ ++ elif [[ -e /sys/kernel/kpatch/patches ]] ; then ++ # kpatch pre-0.4 ABI ++ SYSFS="/sys/kernel/kpatch/patches" ++ ++ else ++ # kpatch 0.4 ABI ++ SYSFS="/sys/kernel/kpatch" ++ fi ++} ++ + verify_module_checksum () { + modname=$(get_module_name $1) + [[ -z $modname ]] && return 1 +@@ -158,6 +167,10 @@ load_module () { + echo "loading core module: $COREMOD" + insmod "$COREMOD" || die "failed to load core module" + fi ++ ++ # Now that the core module has been loaded, set $SYSFS to the ++ # correct value based on the loaded core module's ABI. ++ init_sysfs_var + fi + + local modname=$(get_module_name $module) +@@ -222,6 +235,12 @@ get_module_version() { + } + + unset MODULE ++ ++# Initialize the $SYSFS var. This only works if the core module has been ++# loaded. Otherwise, the value of $SYSFS doesn't matter at this point anyway, ++# and we'll have to call this function again after loading it. ++init_sysfs_var ++ + [[ "$#" -lt 1 ]] && usage + case "$1" in + "load") +-- +2.13.6 + diff --git a/SPECS/kpatch.spec b/SPECS/kpatch.spec index 5c0e35f..6981180 100644 --- a/SPECS/kpatch.spec +++ b/SPECS/kpatch.spec @@ -1,12 +1,13 @@ Name: kpatch Version: 0.4.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Dynamic kernel patch manager Group: System Environment/Kernel License: GPLv2 URL: https://github.com/dynup/kpatch Source0: https://github.com/dynup/kpatch/archive/v%{version}.tar.gz +Patch0: 0001-kpatch-add-ABI-backwards-compatibility.patch Requires: bash kmod binutils @@ -21,6 +22,7 @@ patch the kernel without rebooting. %prep %setup -q +%patch0 -p1 %build @@ -41,6 +43,9 @@ rm -f %{buildroot}/usr/share/man/man1/kpatch-build.1.gz %changelog +* Wed Oct 18 2017 Josh Poimboeuf 0.4.0-2 +- fix backwards compatibility with RHEL 7.3 patches (rhbz#1497735) + * Mon Mar 13 2017 Josh Poimboeuf 0.4.0-1 - update to 0.4.0 (rhbz#1427642)