From da59563f64c40d66722e95d1eebf676031db76ab Mon Sep 17 00:00:00 2001 From: Zhipeng Xie Date: Thu, 30 Nov 2023 21:13:23 +0800 Subject: [PATCH] backport upstream patches Signed-off-by: Zhipeng Xie --- ...uild-ignore-init-version-timestamp.o.patch | 32 +++++++++++++++++++ ...-update-OpenEuler-prereqs-formatting.patch | 30 +++++++++++++++++ ...havior-problem-when-using-list_forea.patch | 26 +++++++++++++++ kpatch.spec | 11 ++++++- 4 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 0056-kpatch-build-ignore-init-version-timestamp.o.patch create mode 100644 0066-INSTALL.md-update-OpenEuler-prereqs-formatting.patch create mode 100644 0070-Fix-undefined-behavior-problem-when-using-list_forea.patch diff --git a/0056-kpatch-build-ignore-init-version-timestamp.o.patch b/0056-kpatch-build-ignore-init-version-timestamp.o.patch new file mode 100644 index 0000000..3d0738d --- /dev/null +++ b/0056-kpatch-build-ignore-init-version-timestamp.o.patch @@ -0,0 +1,32 @@ +From 934b3b3c0c12be2435f8edbe484c2696dda93864 Mon Sep 17 00:00:00 2001 +From: Joe Lawrence +Date: Mon, 16 Jan 2023 09:33:55 -0500 +Subject: [PATCH] kpatch-build: ignore init/version-timestamp.o + +Kernel v6.1+ commit 2df8220cc511 ("kbuild: build init/built-in.a just +once") split init_uts_ns and linux_banner out to +init/version-timestamp.c from init/version.c + +Add init/version-timestamp.o to the list of object files that kpatch-cc +won't add to its changed_objs list. + +Signed-off-by: Joe Lawrence +--- + kpatch-build/kpatch-cc | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/kpatch-build/kpatch-cc b/kpatch-build/kpatch-cc +index 2a3d264..17aae25 100755 +--- a/kpatch-build/kpatch-cc ++++ b/kpatch-build/kpatch-cc +@@ -44,6 +44,7 @@ if [[ "$TOOLCHAINCMD" =~ ^(.*-)?gcc$ || "$TOOLCHAINCMD" =~ ^(.*-)?clang$ ]] ; th + arch/s390/kernel/vdso64/*|\ + drivers/firmware/efi/libstub/*|\ + init/version.o|\ ++ init/version-timestamp.o|\ + kernel/system_certificates.o|\ + lib/*|\ + tools/*|\ +-- +2.27.0 + diff --git a/0066-INSTALL.md-update-OpenEuler-prereqs-formatting.patch b/0066-INSTALL.md-update-OpenEuler-prereqs-formatting.patch new file mode 100644 index 0000000..fc7b248 --- /dev/null +++ b/0066-INSTALL.md-update-OpenEuler-prereqs-formatting.patch @@ -0,0 +1,30 @@ +From 27d0a22c8abbba12e6146f3f389dd28b0fa862dd Mon Sep 17 00:00:00 2001 +From: Ryan Sullivan +Date: Wed, 26 Apr 2023 10:44:04 -0400 +Subject: [PATCH] INSTALL.md: update OpenEuler prereqs formatting + +Shrink the size of the sub-section header below the OpenEuler section, +reducing confusion as to what section that is a part of, as it is only +necessary for OpenEuler machines. + +Signed-off-by: Ryan Sullivan +--- + doc/INSTALL.md | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/doc/INSTALL.md b/doc/INSTALL.md +index 3b2fdb7..b67a586 100644 +--- a/doc/INSTALL.md ++++ b/doc/INSTALL.md +@@ -203,7 +203,7 @@ Install the dependencies for compiling kpatch and running kpatch-build: + make dependencies + ``` + +-Before running kpatch-build, two more things need to be checked: ++#### Before running kpatch-build, two more things need to be checked: + ------- + 1. Ensure current kernel compiled with *CONFIG_LIVEPATCH_PER_TASK_CONSISTENCY* set + +-- +2.27.0 + diff --git a/0070-Fix-undefined-behavior-problem-when-using-list_forea.patch b/0070-Fix-undefined-behavior-problem-when-using-list_forea.patch new file mode 100644 index 0000000..9448c3a --- /dev/null +++ b/0070-Fix-undefined-behavior-problem-when-using-list_forea.patch @@ -0,0 +1,26 @@ +From fb22714ae934a6a9b8ab0cc635519fb3a24c2052 Mon Sep 17 00:00:00 2001 +From: Weinan Liu +Date: Wed, 9 Aug 2023 22:31:21 +0000 +Subject: [PATCH] Fix undefined behavior problem when using list_foreach_entry + +This upstream list.h offsetof implementation rely on undefined behavior implementation. Using __builtin_offsetof to fix this problem. +--- + kpatch-build/list.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/kpatch-build/list.h b/kpatch-build/list.h +index e95593c..ad4643c 100644 +--- a/kpatch-build/list.h ++++ b/kpatch-build/list.h +@@ -30,7 +30,7 @@ + /** + * Get offset of a member + */ +-#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) ++#define offsetof(TYPE, MEMBER) ((size_t) __builtin_offsetof(TYPE, MEMBER)) + + /** + * Casts a member of a structure out to the containing structure +-- +2.27.0 + diff --git a/kpatch.spec b/kpatch.spec index 6a4cf68..001f640 100644 --- a/kpatch.spec +++ b/kpatch.spec @@ -1,7 +1,7 @@ Name: kpatch Epoch: 1 Version: 0.9.7 -Release: 5 +Release: 6 Summary: A Linux dynamic kernel patching infrastructure License: GPLv2 @@ -61,6 +61,9 @@ Patch0045:0045-kpatch-build-Add-find_kobj-short-circuit-for-OOT-mod.patch Patch0046:0048-examples-add-proc-version-kpatch-sample.patch Patch0047:0050-kpatch-macros-add-KPATCH_STATIC_CALL.patch Patch0048:0052-patch-author-guide-update-jump-label-static-call-des.patch +Patch0049:0056-kpatch-build-ignore-init-version-timestamp.o.patch +Patch0050:0066-INSTALL.md-update-OpenEuler-prereqs-formatting.patch +Patch0051:0070-Fix-undefined-behavior-problem-when-using-list_forea.patch BuildRequires: gcc elfutils-libelf-devel kernel-devel git Requires: bc make gcc patch bison flex openssl-devel @@ -121,6 +124,12 @@ popd %{_mandir}/man1/*.1.gz %changelog +* Thu Nov 30 2023 Zhipeng Xie -1:0.9.7-6 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC:backport upsteam patches + * Thu Sep 28 2023 Zhipeng Xie -1:0.9.7-5 - Type:enhancement - ID:NA