diff --git a/.gitignore b/.gitignore index de588d4..16c7d0e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ SOURCES/kpatch-dnf-v0.2.tar.gz -SOURCES/v0.9.2.tar.gz +SOURCES/v0.9.3.tar.gz diff --git a/.kpatch.metadata b/.kpatch.metadata index 141152c..0544f1f 100644 --- a/.kpatch.metadata +++ b/.kpatch.metadata @@ -1,2 +1,2 @@ 74e3123e0edc694676a36994b23094be354f87b5 SOURCES/kpatch-dnf-v0.2.tar.gz -c0878679129add77d6fff57093640892ad941155 SOURCES/v0.9.2.tar.gz +2b781cf5acd4869510950696e610b747ed508913 SOURCES/v0.9.3.tar.gz diff --git a/SOURCES/0003-kpatch-cleanup-install-directory.patch b/SOURCES/0003-kpatch-cleanup-install-directory.patch deleted file mode 100644 index 7c05150..0000000 --- a/SOURCES/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/SOURCES/0100-kpatch-wait-for-module-ref-counts-on-unload.patch b/SOURCES/0100-kpatch-wait-for-module-ref-counts-on-unload.patch deleted file mode 100644 index 2b10e15..0000000 --- a/SOURCES/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/SOURCES/ignore-printk_index.patch b/SOURCES/ignore-printk_index.patch new file mode 100644 index 0000000..394262b --- /dev/null +++ b/SOURCES/ignore-printk_index.patch @@ -0,0 +1,27 @@ +From 400ded23da6d998982c0ffa384e0f2a790d78069 Mon Sep 17 00:00:00 2001 +From: Song Liu +Date: Fri, 30 Apr 2021 17:16:46 -0700 +Subject: [PATCH] create-diff-object: ignore section .printk_index + +Signed-off-by: Song Liu +--- + kpatch-build/create-diff-object.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c +index 82e486f..502922c 100644 +--- a/kpatch-build/create-diff-object.c ++++ b/kpatch-build/create-diff-object.c +@@ -2591,7 +2591,8 @@ static void kpatch_mark_ignored_sections(struct kpatch_elf *kelf) + /* Ignore any discarded sections */ + list_for_each_entry(sec, &kelf->sections, list) { + if (!strncmp(sec->name, ".discard", 8) || +- !strncmp(sec->name, ".rela.discard", 13)) ++ !strncmp(sec->name, ".rela.discard", 13) || ++ !strncmp(sec->name, ".printk_index", 13)) + sec->ignore = 1; + } + +-- +2.30.2 + diff --git a/SPECS/kpatch.spec b/SPECS/kpatch.spec index 970b38e..2063068 100644 --- a/SPECS/kpatch.spec +++ b/SPECS/kpatch.spec @@ -1,8 +1,8 @@ %define kpatch_dnf_ver 0.2 Name: kpatch -Version: 0.9.2 -Release: 5.1%{?dist} +Version: 0.9.3 +Release: 1.1%{?dist} Summary: Dynamic kernel patch manager Group: System Environment/Kernel @@ -14,10 +14,9 @@ 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 +# Hyperscale only +Patch100: ignore-printk_index.patch # kpatch-dnf backports Patch200: 0200-Makefile-set-install-permission-modes.patch @@ -30,7 +29,7 @@ patch the kernel without rebooting. %package -n kpatch-runtime Summary: Dynamic kernel patch manager Requires: bash kmod binutils -Recommends: kpatch-dnf +Suggests: kpatch-dnf Provides: kpatch BuildArch: noarch @@ -62,7 +61,6 @@ kpatch-build is a tool to build patches for kpatch. %setup -q %patch0 -p1 %patch1 -p1 -%patch2 -p1 %patch100 -p1 %setup -D -T -a 1 @@ -104,6 +102,11 @@ echo -e "\t$ dnf kpatch auto" %{_mandir}/man1/kpatch-build.1* %changelog +* Wed May 5 2021 Davide Cavalca - 0.9.3-1.1 +- Update to 0.9.3 and drop upstreamed patches +- Downgrade kpatch-dnf dependency to a Suggests +- Add patch to ignore .printk_index sections + * Wed May 5 2021 Davide Cavalca - 0.9.2-5.1 - Add kpatch-build arched subpackage - Add kpatch-runtime noarch subpackage to provide kpatch