diff --git a/0003-kpatch-cleanup-install-directory.patch b/0003-kpatch-cleanup-install-directory.patch deleted file mode 100755 index 7c0515020a02f2d8b21f6383724620a84c66b1b2..0000000000000000000000000000000000000000 --- a/0003-kpatch-cleanup-install-directory.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 47c1bd435a498e736a6fd3f41655c05279560bb1 Mon Sep 17 00:00:00 2001 -From: Artem Savkov -Date: Thu, 25 Feb 2021 13:24:30 +0100 -Subject: [PATCH] kpatch: cleanup install directory - -On module installation kpatch utility creates a directory with kernel -version as a name in /var/lib/kpatch which is never removed. To address -this check if any files are left in this directory after each -'uninstall' call and if not - remove it. - -Signed-off-by: Artem Savkov ---- - kpatch/kpatch | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/kpatch/kpatch b/kpatch/kpatch -index ccb6914..8c34ed4 100755 ---- a/kpatch/kpatch -+++ b/kpatch/kpatch -@@ -575,10 +575,12 @@ case "$1" in - fi - - [[ ! -e "$MODULE" ]] && die "$PATCH is not installed for kernel $KVER" -- - - echo "uninstalling $PATCH ($KVER)" - rm -f "$MODULE" || die "failed to uninstall module $PATCH" -+ rmdir --ignore-fail-on-non-empty "$INSTALLDIR/$KVER" || die "failed to remove directory $INSTALLDIR/$KVER" -+ rmdir --ignore-fail-on-non-empty "$INSTALLDIR" || die "failed to remove directory $INSTALLDIR" -+ - ;; - - "list") --- -2.26.2 - diff --git a/0100-kpatch-wait-for-module-ref-counts-on-unload.patch b/0100-kpatch-wait-for-module-ref-counts-on-unload.patch deleted file mode 100755 index 2b10e15eac0d03684562d3db3ae347490d01c5fa..0000000000000000000000000000000000000000 --- a/0100-kpatch-wait-for-module-ref-counts-on-unload.patch +++ /dev/null @@ -1,100 +0,0 @@ -From cdee6bd650a35075515d4fe2bb67657811c9640c Mon Sep 17 00:00:00 2001 -From: Joe Lawrence -Date: Mon, 16 Nov 2020 15:21:59 -0500 -Subject: [PATCH] kpatch: wait for module ref counts on unload - -There exists a very small timing window in which "kpatch unload" gets to -its "rmmod" step before the kpatch-patch module's reference count has -cleared and the "rmmod" fails. - -This is only a transient problem, but we can adopt code from upstream -livepatch kselftests which wait for the module refcounts to settle -before moving onto "rmmod". - -A small wrinkle is that this is not supported by the older kpatch.ko -core. The price for circumventing the activeness safety check via -KPATCH_FORCE_UNSAFE is that it must leave the kpatch patch modules in -place (see e1890e627a9b ("prevent rmmod of forced modules")). - -Signed-off-by: Joe Lawrence ---- - kpatch/kpatch | 40 ++++++++++++++++++++++++++++++++++++++-- - 1 file changed, 38 insertions(+), 2 deletions(-) - -diff --git a/kpatch/kpatch b/kpatch/kpatch -index bca8f41..b35b742 100755 ---- a/kpatch/kpatch -+++ b/kpatch/kpatch -@@ -28,6 +28,7 @@ SCRIPTDIR="$(readlink -f "$(dirname "$(type -p "$0")")")" - VERSION="0.9.2" - POST_ENABLE_WAIT=15 # seconds - POST_SIGNAL_WAIT=60 # seconds -+MODULE_REF_WAIT=15 # seconds - - # How many times to try loading the patch if activeness safety check fails. - MAX_LOAD_ATTEMPTS=5 -@@ -125,6 +126,10 @@ find_core_module() { - return 1 - } - -+kpatch_core_loaded() { -+ grep -q -e "T kpatch_register" /proc/kallsyms -+} -+ - core_loaded () { - grep -q -e "T klp_enable_patch" -e "T kpatch_register" /proc/kallsyms - } -@@ -265,6 +270,31 @@ wait_for_patch_transition() { - return 1 - } - -+module_ref_count() { -+ local modname="$1" -+ [[ $(cat "/sys/module/$modname/refcnt" 2>/dev/null) != "0" ]] -+} -+ -+wait_for_zero_module_ref_count() { -+ local modname="$1" -+ local i=0 -+ -+ # We can't rely on a zero refcount with kpatch.ko as it -+ # implements KPATCH_FORCE_UNSAFE with an additional reference on -+ # kpatch-patch modules to avoid potential crashes. -+ kpatch_core_loaded && return 0 -+ -+ module_ref_count "$modname" || return 0 -+ -+ echo "waiting (up to $MODULE_REF_WAIT seconds) for module refcount..." -+ for (( i=0; i /dev/null || return 0 -+ rmmod "$modname" 2> /dev/null || return 0 - } - - unload_module () { --- -2.25.4 - diff --git a/kpatch.spec b/kpatch.spec index 07f962dcfd287e152c8b274d67f4d3bec4a789ca..11316a88107a63cad506d8e6c00ffa90219cb348 100755 --- a/kpatch.spec +++ b/kpatch.spec @@ -1,8 +1,8 @@ %define kpatch_dnf_ver 0.2 Name: kpatch -Version: 0.9.2 -Release: 5%{?dist} +Version: 0.9.5 +Release: 1%{?dist} Summary: Dynamic kernel patch manager Group: System Environment/Kernel @@ -14,10 +14,6 @@ Source1: kpatch-dnf-v%{kpatch_dnf_ver}.tar.gz # RHEL-only Patch0: 0001-contrib-disable-upstart-kpatch.conf-install.patch Patch1: 0002-kpatch-clarify-unload-unsupport.patch -Patch2: 0003-kpatch-cleanup-install-directory.patch - -# Upstream backports -Patch100: 0100-kpatch-wait-for-module-ref-counts-on-unload.patch # kpatch-dnf backports Patch200: 0200-Makefile-set-install-permission-modes.patch @@ -50,8 +46,6 @@ kpatch-patch packages updates. %setup -q %patch0 -p1 %patch1 -p1 -%patch2 -p1 -%patch100 -p1 %setup -D -T -a 1 cd kpatch-dnf-%{kpatch_dnf_ver} @@ -87,6 +81,9 @@ echo "To enable automatic kpatch-patch subscription, run:" echo -e "\t$ dnf kpatch auto" %changelog +* Wed Feb 16 2022 Weitao Zhou 0.9.5-1 +- update to 0.9.5 + * Mon Mar 15 2021 Artem Savkov 0.9.2-5 - Cleanup /var/lib/kpatch directory on uninstall (rhbz#1930108) diff --git a/v0.9.2.tar.gz b/v0.9.2.tar.gz deleted file mode 100755 index 829312264db9b81ec0e0005d7d0d48f2a46d7b24..0000000000000000000000000000000000000000 Binary files a/v0.9.2.tar.gz and /dev/null differ diff --git a/v0.9.5.tar.gz b/v0.9.5.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..866cbbbded222463ce497f56cc14691de85130f6 Binary files /dev/null and b/v0.9.5.tar.gz differ