diff --git a/0100-support-ubsan-for-kpatch.patch b/0100-support-ubsan-for-kpatch.patch index 2a240cb..f1dbe3f 100644 --- a/0100-support-ubsan-for-kpatch.patch +++ b/0100-support-ubsan-for-kpatch.patch @@ -1,7 +1,7 @@ From 85344cf524cccc7b8e10bf04ed38a0f586bffd10 Mon Sep 17 00:00:00 2001 From: Sumanth Korikkar Date: Tue, 21 Feb 2023 15:28:21 +0100 -Subject: [PATCH] support ubsan for kpatch +Subject: [PATCH 100/112] support ubsan for kpatch ubsan generates .data..Lubsan_data* sections as follows: @@ -128,5 +128,5 @@ index f2596b1..2ccc181 100644 return false; -- -2.37.3 +2.45.1 diff --git a/0101-create-diff-object-handle-__initcall_stub-with-CONFI.patch b/0101-create-diff-object-handle-__initcall_stub-with-CONFI.patch index a90e6ed..2d17b0e 100644 --- a/0101-create-diff-object-handle-__initcall_stub-with-CONFI.patch +++ b/0101-create-diff-object-handle-__initcall_stub-with-CONFI.patch @@ -1,7 +1,7 @@ From 3672db9de548ed4ed5e87089a1263f6b5ddc4a11 Mon Sep 17 00:00:00 2001 From: Song Liu Date: Mon, 13 Feb 2023 15:14:32 -0800 -Subject: [PATCH 101/107] create-diff-object: handle __initcall_stub with +Subject: [PATCH 101/112] create-diff-object: handle __initcall_stub with CONFIG_LTO_CLANG The kernel use a special __initcall_stub() with CONFIG_LTO_CLANG to avoid @@ -62,5 +62,5 @@ index 2d7b072..fec57b8 100644 if (!*s1) return 0; -- -2.37.3 +2.45.1 diff --git a/0102-kpatch-build-support-CONFIG_LTO_CLANG_THIN.patch b/0102-kpatch-build-support-CONFIG_LTO_CLANG_THIN.patch index 9107b49..6ea4f21 100644 --- a/0102-kpatch-build-support-CONFIG_LTO_CLANG_THIN.patch +++ b/0102-kpatch-build-support-CONFIG_LTO_CLANG_THIN.patch @@ -1,7 +1,7 @@ From 3db1cfb91b9b2b7cf6c5564995c446567baa371a Mon Sep 17 00:00:00 2001 From: Song Liu Date: Fri, 3 Feb 2023 10:28:16 -0800 -Subject: [PATCH 102/107] kpatch-build: support CONFIG_LTO_CLANG_THIN +Subject: [PATCH 102/112] kpatch-build: support CONFIG_LTO_CLANG_THIN Support CONFIG_LTO_CLANG_THIN with ld.lld --lto-obj-path option. @@ -183,5 +183,5 @@ index 2a3d264..7e9e1be 100755 break ;; -- -2.37.3 +2.45.1 diff --git a/0103-create-diff-object-compare-section-name-with-kpatch_.patch b/0103-create-diff-object-compare-section-name-with-kpatch_.patch index eee4a01..4f5a28e 100644 --- a/0103-create-diff-object-compare-section-name-with-kpatch_.patch +++ b/0103-create-diff-object-compare-section-name-with-kpatch_.patch @@ -1,7 +1,7 @@ From 47d1b39ba7686e2368c1ad24af274dfd9f54ecf9 Mon Sep 17 00:00:00 2001 From: Song Liu Date: Wed, 13 Oct 2021 00:10:20 -0700 -Subject: [PATCH 103/107] create-diff-object: compare section name with +Subject: [PATCH 103/112] create-diff-object: compare section name with kpatch_section_function_name Profile-Guided Optimization (PGO) uses profiling data to help the compiler @@ -48,5 +48,5 @@ index fec57b8..e88cb3b 100644 if (is_ubsan_sec(sec_orig->name)) -- -2.37.3 +2.45.1 diff --git a/0104-kpatch-build-add-support-for-clang-pgo.patch b/0104-kpatch-build-add-support-for-clang-pgo.patch index 416b464..ae1ccae 100644 --- a/0104-kpatch-build-add-support-for-clang-pgo.patch +++ b/0104-kpatch-build-add-support-for-clang-pgo.patch @@ -1,7 +1,7 @@ From 19c4942a1415d0f99c910949ba55c95ddcc5a976 Mon Sep 17 00:00:00 2001 From: Song Liu Date: Wed, 13 Oct 2021 01:03:55 -0700 -Subject: [PATCH 104/107] kpatch-build: add support for clang pgo +Subject: [PATCH 104/112] kpatch-build: add support for clang pgo For clang with Profile-Guided Optimization (PGO), profile data is needed to compile the livepatch properly. Add option -p|--profile-data, which @@ -69,5 +69,5 @@ index f712578..fc9f92b 100755 MAKEVARS+=("CC=${KPATCH_CC_PREFIX}${GCC}") fi -- -2.37.3 +2.45.1 diff --git a/0105-create-diff-object-ignore-section-.rel.llvm.call-gra.patch b/0105-create-diff-object-ignore-section-.rel.llvm.call-gra.patch index 914e182..b81a1e3 100644 --- a/0105-create-diff-object-ignore-section-.rel.llvm.call-gra.patch +++ b/0105-create-diff-object-ignore-section-.rel.llvm.call-gra.patch @@ -1,7 +1,7 @@ From 88bf611ea0a16930a764509a59700cc2418641f0 Mon Sep 17 00:00:00 2001 From: Song Liu Date: Wed, 1 Mar 2023 15:25:19 -0800 -Subject: [PATCH 105/107] create-diff-object: ignore section +Subject: [PATCH 105/112] create-diff-object: ignore section .rel.llvm.call-graph-profile This section is used by llvm to store profile data. Ignore it in the @@ -25,5 +25,5 @@ index e88cb3b..4e3341e 100644 sec->ignore = 1; } -- -2.37.3 +2.45.1 diff --git a/0106-kpatch-build-Run-objtool-on-thinlto-files.patch b/0106-kpatch-build-Run-objtool-on-thinlto-files.patch index 5df0f7d..d3360ce 100644 --- a/0106-kpatch-build-Run-objtool-on-thinlto-files.patch +++ b/0106-kpatch-build-Run-objtool-on-thinlto-files.patch @@ -1,7 +1,7 @@ From 764a57b1756dffba9bf7c990f752dbd739ea149f Mon Sep 17 00:00:00 2001 From: Song Liu Date: Mon, 6 Mar 2023 22:43:43 -0800 -Subject: [PATCH 106/107] kpatch-build: Run objtool on thinlto files +Subject: [PATCH 106/112] kpatch-build: Run objtool on thinlto files In this way, CDO should generate patches with required sections, such as the .orc sections. @@ -40,5 +40,5 @@ index fc9f92b..938e88f 100755 # create-diff-object orig.o patched.o parent-name parent-symtab -- -2.37.3 +2.45.1 diff --git a/0107-kpatch-build-skip-more-symbols-in-locals_match.patch b/0107-kpatch-build-skip-more-symbols-in-locals_match.patch index 1e32e52..35697ff 100644 --- a/0107-kpatch-build-skip-more-symbols-in-locals_match.patch +++ b/0107-kpatch-build-skip-more-symbols-in-locals_match.patch @@ -1,7 +1,7 @@ From b479edd20f6083c65cda9c9277cc54cc56ce0939 Mon Sep 17 00:00:00 2001 From: Song Liu Date: Wed, 15 Mar 2023 11:21:31 -0700 -Subject: [PATCH 107/107] kpatch-build: skip more symbols in locals_match +Subject: [PATCH 107/112] kpatch-build: skip more symbols in locals_match Skip table_sym with maybe_discarded_sym() == true. This is probably only needed for LTO build. @@ -34,5 +34,5 @@ index 2ccc181..c8844f8 100644 !strcmp(sym->name, table_sym->name)) { found = 1; -- -2.37.3 +2.45.1 diff --git a/0108-kpatch-build-Fix-setlocalversion-issue-with-6.3-kern.patch b/0108-kpatch-build-Fix-setlocalversion-issue-with-6.3-kern.patch index 4337f1b..2b291bd 100644 --- a/0108-kpatch-build-Fix-setlocalversion-issue-with-6.3-kern.patch +++ b/0108-kpatch-build-Fix-setlocalversion-issue-with-6.3-kern.patch @@ -1,7 +1,8 @@ From f38c64b7e490c6de1208f277d767bd7b8029edcc Mon Sep 17 00:00:00 2001 From: Josh Poimboeuf Date: Mon, 13 Mar 2023 13:51:01 -0700 -Subject: [PATCH 1/3] kpatch-build: Fix setlocalversion issue with 6.3 kernel +Subject: [PATCH 108/112] kpatch-build: Fix setlocalversion issue with 6.3 + kernel The kernel has a VERMAGIC_STRING, e.g. "6.2.0". The module loader uses that string to ensure that all loaded modules' version strings match the @@ -109,5 +110,5 @@ index 938e88f..429f214 100755 KPATCH_CC_PREFIX="$TOOLSDIR/kpatch-cc " -- -2.41.0 +2.45.1 diff --git a/0109-kpatch-build-ignore-changes-in-.comment-section.patch b/0109-kpatch-build-ignore-changes-in-.comment-section.patch index c32ff9c..f758938 100644 --- a/0109-kpatch-build-ignore-changes-in-.comment-section.patch +++ b/0109-kpatch-build-ignore-changes-in-.comment-section.patch @@ -1,7 +1,7 @@ From 101bfb58f0111b3e4032645125b5b259454750d4 Mon Sep 17 00:00:00 2001 From: Song Liu Date: Fri, 20 Oct 2023 13:55:04 -0700 -Subject: [PATCH 2/3] kpatch-build: ignore changes in .comment section +Subject: [PATCH 109/112] kpatch-build: ignore changes in .comment section .comment section contains compiler version number of compiler(s) used to generate the object file. With LTO, it is possible that cross file inlining @@ -26,5 +26,5 @@ index 4e3341e..4ce0766 100644 sec->ignore = 1; } -- -2.41.0 +2.45.1 diff --git a/0110-kpatch-build-handle-init-version-timestamp.o.patch b/0110-kpatch-build-handle-init-version-timestamp.o.patch index bcf4d23..2acc728 100644 --- a/0110-kpatch-build-handle-init-version-timestamp.o.patch +++ b/0110-kpatch-build-handle-init-version-timestamp.o.patch @@ -1,7 +1,7 @@ From 1b77c087cbaf667d9ce140a7a5885bba7cca59d1 Mon Sep 17 00:00:00 2001 From: Yonghong Song Date: Fri, 20 Oct 2023 14:21:30 -0700 -Subject: [PATCH 3/3] kpatch-build: handle init/version-timestamp.o +Subject: [PATCH 110/112] kpatch-build: handle init/version-timestamp.o init/version-timestamp.c is introduced after 5.19. 2df8220cc511 kbuild: build init/built-in.a just once @@ -42,5 +42,5 @@ index 429f214..3af1918 100755 mkdir -p "output/$(dirname "$i")" cd "$BUILDDIR" || die -- -2.41.0 +2.45.1 diff --git a/0111-kpatch-build-Ignore-missing-PARA_STRUCT_SIZE-for-6.8.patch b/0111-kpatch-build-Ignore-missing-PARA_STRUCT_SIZE-for-6.8.patch new file mode 100644 index 0000000..363134d --- /dev/null +++ b/0111-kpatch-build-Ignore-missing-PARA_STRUCT_SIZE-for-6.8.patch @@ -0,0 +1,44 @@ +From c147ddf8a343c1de68ac306deb7ddc942d0f50bb Mon Sep 17 00:00:00 2001 +From: Song Liu +Date: Thu, 30 May 2024 11:48:03 -0700 +Subject: [PATCH 111/112] kpatch-build: Ignore missing PARA_STRUCT_SIZE for + 6.8.0+ kernels + +struct paravirt_patch_site was removed in 6.8.0+ kernels. We should not +fail kpatch-build for missing PARA_STRUCT_SIZE. + +Signed-off-by: Song Liu +--- + kpatch-build/kpatch-build | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build +index 3af1918..29624da 100755 +--- a/kpatch-build/kpatch-build ++++ b/kpatch-build/kpatch-build +@@ -236,6 +236,11 @@ support_klp_replace() + fi + } + ++check_paravirt_patch_site() ++{ ++ ! kernel_version_gte 6.8.0 ++} ++ + find_dirs() { + if [[ -e "$SCRIPTDIR/create-diff-object" ]]; then + # git repo +@@ -426,7 +431,9 @@ find_special_section_data() { + [[ ${check[i]} && -z "$PRINTK_INDEX_STRUCT_SIZE" ]] && die "can't find special struct pi_entry size" + [[ ${check[j]} && -z "$JUMP_STRUCT_SIZE" ]] && die "can't find special struct jump_entry size" + [[ ${check[o]} && -z "$ORC_STRUCT_SIZE" ]] && die "can't find special struct orc_entry size" +- [[ ${check[p]} && -z "$PARA_STRUCT_SIZE" ]] && die "can't find special struct paravirt_patch_site size" ++ if check_paravirt_patch_site; then ++ [[ ${check[p]} && -z "$PARA_STRUCT_SIZE" ]] && die "can't find special struct paravirt_patch_site size" ++ fi + [[ ${check[s]} && -z "$STATIC_CALL_STRUCT_SIZE" ]] && die "can't find special struct static_call_site size" + + save_env +-- +2.45.1 + diff --git a/0112-kpatch-build-Always-do-LLVM-1-with-CONFIG_CC_IS_CLAN.patch b/0112-kpatch-build-Always-do-LLVM-1-with-CONFIG_CC_IS_CLAN.patch new file mode 100644 index 0000000..9717747 --- /dev/null +++ b/0112-kpatch-build-Always-do-LLVM-1-with-CONFIG_CC_IS_CLAN.patch @@ -0,0 +1,31 @@ +From cdf423a52d78a0c2b92bd1714021fbd6d1e5c8a8 Mon Sep 17 00:00:00 2001 +From: Song Liu +Date: Thu, 30 May 2024 11:49:47 -0700 +Subject: [PATCH 112/112] kpatch-build: Always do LLVM=1 with + CONFIG_CC_IS_CLANG + +This will make sure NM, AR, etc. are set properly. + +Signed-off-by: Song Liu +--- + kpatch-build/kpatch-build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build +index 29624da..3dec7c9 100755 +--- a/kpatch-build/kpatch-build ++++ b/kpatch-build/kpatch-build +@@ -1164,9 +1164,9 @@ declare -a MAKEVARS + if [[ -n "$CONFIG_CC_IS_CLANG" ]]; then + MAKEVARS+=("CC=${KPATCH_CC_PREFIX}${CLANG}") + MAKEVARS+=("HOSTCC=clang") ++ MAKEVARS+=("LLVM=1") + if [[ -n "$CONFIG_PGO_CLANG" ]]; then + MAKEVARS+=("CFLAGS_PGO_CLANG=-fprofile-use=$PROFILE_DATA") +- MAKEVARS+=("LLVM=1") + fi + else + MAKEVARS+=("CC=${KPATCH_CC_PREFIX}${GCC}") +-- +2.45.1 + diff --git a/kpatch.spec b/kpatch.spec index 62037a7..1231fc4 100644 --- a/kpatch.spec +++ b/kpatch.spec @@ -2,7 +2,7 @@ Name: kpatch Version: 0.9.8 -Release: 1.2%{?dist} +Release: 1.3%{?dist} Summary: Dynamic kernel patch manager Group: System Environment/Kernel @@ -28,6 +28,8 @@ Patch107: 0107-kpatch-build-skip-more-symbols-in-locals_match.patch Patch108: 0108-kpatch-build-Fix-setlocalversion-issue-with-6.3-kern.patch Patch109: 0109-kpatch-build-ignore-changes-in-.comment-section.patch Patch110: 0110-kpatch-build-handle-init-version-timestamp.o.patch +Patch111: 0111-kpatch-build-Ignore-missing-PARA_STRUCT_SIZE-for-6.8.patch +Patch112: 0112-kpatch-build-Always-do-LLVM-1-with-CONFIG_CC_IS_CLAN.patch # kpatch-dnf backports (inactive -- for future reference) #Patch200: 0200-foo-bar-etcetera.patch @@ -88,6 +90,8 @@ kpatch-patch packages updates. %patch108 -p1 %patch109 -p1 %patch110 -p1 +%patch111 -p1 +%patch112 -p1 %setup -D -T -a 1 @@ -130,6 +134,9 @@ echo "To enable automatic kpatch-patch subscription, run:" echo -e "\t$ dnf kpatch auto" %changelog +* Fri May 31 2024 Davide Cavalca - 0.9.8-1.3 +- Backport two more fixes and refresh patches + * Fri Oct 27 2023 Davide Cavalca - 0.9.8-1.2 - Backport three upstream fixes