diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7124599 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/v0.4.0.tar.gz diff --git a/.kpatch.metadata b/.kpatch.metadata new file mode 100644 index 0000000..ed18222 --- /dev/null +++ b/.kpatch.metadata @@ -0,0 +1 @@ +b5de4b89fc9b9bf1c7071c4512800338e98ed0e9 SOURCES/v0.4.0.tar.gz diff --git a/README.md b/README.md deleted file mode 100644 index 0e7897f..0000000 --- a/README.md +++ /dev/null @@ -1,5 +0,0 @@ -The master branch has no content - -Look at the c7 branch if you are working with CentOS-7, or the c4/c5/c6 branch for CentOS-4, 5 or 6 - -If you find this file in a distro specific branch, it means that no content has been checked in yet 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 new file mode 100644 index 0000000..6981180 --- /dev/null +++ b/SPECS/kpatch.spec @@ -0,0 +1,92 @@ +Name: kpatch +Version: 0.4.0 +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 + +BuildArch: noarch + + +%description +kpatch is a dynamic kernel patch module manager. It allows the user to manage +a collection of binary kernel patch modules which can be used to dynamically +patch the kernel without rebooting. + + +%prep +%setup -q +%patch0 -p1 + + +%build +make -C man + + +%install +make install PREFIX=/usr DESTDIR=%{buildroot} -C kpatch +make install PREFIX=/usr DESTDIR=%{buildroot} -C man +make install PREFIX=/usr DESTDIR=%{buildroot} -C contrib +rm -f %{buildroot}/usr/share/man/man1/kpatch-build.1.gz + + +%files +%{_sbindir}/kpatch +%{_usr}/lib/systemd/system/kpatch.service +%doc %{_mandir}/man1/kpatch.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) + +* Wed Jun 15 2016 Josh Poimboeuf 0.3.2-1 +- update to 0.3.2 (rhbz#1282508) + +* Wed Nov 18 2015 Josh Poimboeuf 0.3.1-1 +- update to 0.3.1 (rhbz#1282508) + +* Tue Sep 16 2014 Seth Jennings 0.1.10-4 +- fix dracut dependencies (rhbz#1170369) + +* Tue Sep 16 2014 Seth Jennings 0.1.10-3 +- support re-enabling forced modules (rhbz#1140268) + +* Thu Sep 11 2014 Seth Jennings 0.1.10-2 +- support modprobe format names (rhbz#1133045) + +* Thu Jul 31 2014 Josh Poimboeuf 0.1.10-1 +- update to kpatch 0.1.10 + +* Wed Jul 23 2014 Josh Poimboeuf 0.1.9-1 +- update to kpatch 0.1.9 + +* Tue Jul 15 2014 Josh Poimboeuf 0.1.8-1 +- update to kpatch 0.1.8 + +* Wed May 21 2014 Josh Poimboeuf 0.1.2-1 +- update to kpatch 0.1.2 + +* Mon May 19 2014 Josh Poimboeuf 0.1.1-2 +- fix initramfs core module path + +* Mon May 19 2014 Josh Poimboeuf 0.1.1-1 +- rebase to kpatch 0.1.1 + +* Fri May 9 2014 Josh Poimboeuf 0.1.0-2 +- modprobe core module + +* Tue May 6 2014 Josh Poimboeuf 0.1.0-1 +- Initial kpatch release 0.1.0 + +* Thu Jan 30 2014 Josh Poimboeuf 0.0-1 +- Initial build