diff --git a/huawei-add-judgment-for-symbol-global.patch b/huawei-add-judgment-for-symbol-global.patch new file mode 100644 index 0000000000000000000000000000000000000000..0ce3e59e95d070cb261b8f1f027ce83d76b4ac02 --- /dev/null +++ b/huawei-add-judgment-for-symbol-global.patch @@ -0,0 +1,29 @@ +From 42bebb740f708d2fc77e4770413b1d6c68574a00 Mon Sep 17 00:00:00 2001 +From: rpm-build +Date: Mon, 21 Jul 2025 21:25:06 +0800 +Subject: [PATCH] add judgment for symbol.global + +--- + kpatch-build/create-diff-object.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c +index 830b8f6..3688c53 100644 +--- a/kpatch-build/create-diff-object.c ++++ b/kpatch-build/create-diff-object.c +@@ -3376,7 +3376,11 @@ static void kpatch_create_patches_sections(struct kpatch_elf *kelf, + * won't link to this function and call it before its + * relocations have been applied. + */ +- sym->bind = STB_LOCAL; ++ if (symbol.global) { ++ sym->bind = STB_GLOBAL; ++ } else { ++ sym->bind = STB_LOCAL; ++ } + sym->sym.st_info = (unsigned char) + GELF_ST_INFO(sym->bind, sym->type); + +-- +2.43.0 + diff --git a/huawei-add-judgment-for-the-OOT-path.patch b/huawei-add-judgment-for-the-OOT-path.patch new file mode 100644 index 0000000000000000000000000000000000000000..f53385e6867feb84aa60f84cce6e2099de59fea7 --- /dev/null +++ b/huawei-add-judgment-for-the-OOT-path.patch @@ -0,0 +1,34 @@ +From 12648ce3d376196c33d454c8f5a41ac1a2444bb3 Mon Sep 17 00:00:00 2001 +From: jinsaihang +Date: Tue, 22 Jul 2025 11:43:29 +0800 +Subject: [PATCH] add judgment for the OOT path + +--- + kpatch-build/kpatch-build | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build +index ce6007b..ffff2b7 100755 +--- a/kpatch-build/kpatch-build ++++ b/kpatch-build/kpatch-build +@@ -584,11 +584,13 @@ find_parent_obj_in_dir() { + __find_parent_obj_in_dir "$(relpath "$file" "$dir")" "$dir" + [[ -n $PARENT ]] && return + +- __find_parent_obj_in_dir_for_oot "$file" "." +- [[ -n $PARENT ]] && return ++ if [[ -e "$USERMODBUILDDIR" ]]; then ++ __find_parent_obj_in_dir_for_oot "$file" "." ++ [[ -n $PARENT ]] && return + +- __find_parent_obj_in_dir_for_oot "$file" "${dir#`pwd`}" +- [[ -n $PARENT ]] && return ++ __find_parent_obj_in_dir_for_oot "$file" "${dir#`pwd`}" ++ [[ -n $PARENT ]] && return ++ fi + + # pre-5.19 (and 5.19+ single-object modules): + if [[ $file == $dir* ]]; then +-- +2.43.0 + diff --git a/huawei-delete-extra-spaces.patch b/huawei-delete-extra-spaces.patch new file mode 100644 index 0000000000000000000000000000000000000000..85db00e892cbe5fefd4183a20d4a725bcc3b4dc3 --- /dev/null +++ b/huawei-delete-extra-spaces.patch @@ -0,0 +1,25 @@ +From db9a6472ea7ef35e258e90bf51830fee5cbecc4e Mon Sep 17 00:00:00 2001 +From: jinsaihang +Date: Mon, 21 Jul 2025 20:45:53 +0800 +Subject: [PATCH] delete extra spaces + +--- + 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 3118b72..e0abf29 100755 +--- a/kpatch-build/kpatch-build ++++ b/kpatch-build/kpatch-build +@@ -560,7 +560,7 @@ __find_parent_obj_in_dir_for_oot() { + # if path startswith @, should read from file + while IFS='' read -r parent; do + parent="${parent#@}" +- parent= `cat "${parent}"`|| die ++ parent=`cat "${parent}"`|| die + parent="$(cmd_file_to_o_file "$parent")" + [[ $parent -ef $dir/$file ]] && continue + parents+=("$parent") +-- +2.43.0 + diff --git a/huawei-fix-kpatch-build-path.patch b/huawei-fix-kpatch-build-path.patch new file mode 100644 index 0000000000000000000000000000000000000000..b8025f535434b66cea13b0ce336d67d82486cb77 --- /dev/null +++ b/huawei-fix-kpatch-build-path.patch @@ -0,0 +1,31 @@ +From 1e688733e2ef5038b57e580ba6ab3336b368c778 Mon Sep 17 00:00:00 2001 +From: jinsaihang +Date: Mon, 21 Jul 2025 20:42:34 +0800 +Subject: [PATCH] fix kpatch-build path + +--- + kpatch-build/kpatch-build | 8 +------- + 1 file changed, 1 insertion(+), 7 deletions(-) + +diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build +index b2468e1..3118b72 100755 +--- a/kpatch-build/kpatch-build ++++ b/kpatch-build/kpatch-build +@@ -1531,13 +1531,7 @@ for ((idx=0; idx<${#MAKEVARS[@]}; idx++)); do + MAKEVARS[$idx]=${MAKEVARS[$idx]/${KPATCH_CC_PREFIX}/} + done + +-if [[ -z "$OOT_MODULE" ]]; then +- KPATCH_BUILD="$KERNEL_SRCDIR" +-else +- KPATCH_BUILD="/lib/modules/$ARCHVERSION/build" +-fi +- +-export KPATCH_BUILD="$KPATCH_BUILD" KPATCH_NAME="$MODNAME" \ ++export KPATCH_BUILD="/lib/modules/$ARCHVERSION/build" KPATCH_NAME="$MODNAME" \ + KBUILD_EXTRA_SYMBOLS="$KBUILD_EXTRA_SYMBOLS" \ + KPATCH_LDFLAGS="$KPATCH_LDFLAGS" \ + CROSS_COMPILE="$CROSS_COMPILE" +-- +2.43.0 + diff --git a/huawei-remove-BTF-section.patch b/huawei-remove-BTF-section.patch new file mode 100644 index 0000000000000000000000000000000000000000..23d252b1110d87ee1a08131e1fa1a228900b4da1 --- /dev/null +++ b/huawei-remove-BTF-section.patch @@ -0,0 +1,30 @@ +From fb560e5fe190d33d6180f5860832712353c53ca4 Mon Sep 17 00:00:00 2001 +From: jinsaihang +Date: Mon, 21 Jul 2025 21:04:29 +0800 +Subject: [PATCH] remove-BTF-section + +--- + kpatch-build/kpatch-build | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build +index e0abf29..ce6007b 100755 +--- a/kpatch-build/kpatch-build ++++ b/kpatch-build/kpatch-build +@@ -1194,11 +1194,11 @@ grep -q "CONFIG_DYNAMIC_FTRACE_WITH_CALL_OPS=y" "$CONFIGFILE" && export CONFI + # that anyway. + if [[ -n "$CONFIG_DEBUG_INFO_BTF" ]] && [[ -z "$OOT_MODULE" ]] ; then + cp -f "$KERNEL_SRCDIR/scripts/link-vmlinux.sh" "$TEMPDIR/link-vmlinux.sh" || die +- #sed -i 's/CONFIG_DEBUG_INFO_BTF/DISABLED_FOR_KPATCH_BUILD/g' "$KERNEL_SRCDIR"/scripts/link-vmlinux.sh || die ++ sed -i 's/CONFIG_DEBUG_INFO_BTF/DISABLED_FOR_KPATCH_BUILD/g' "$KERNEL_SRCDIR"/scripts/link-vmlinux.sh || die + + if [[ -e "$KERNEL_SRCDIR/scripts/Makefile.modfinal" ]]; then + cp -f "$KERNEL_SRCDIR/scripts/Makefile.modfinal" "$TEMPDIR/Makefile.modfinal" || die +- #sed -i 's/CONFIG_DEBUG_INFO_BTF_MODULES/DISABLED_FOR_KPATCH_BUILD/g' "$KERNEL_SRCDIR"/scripts/Makefile.modfinal || die ++ sed -i 's/CONFIG_DEBUG_INFO_BTF_MODULES/DISABLED_FOR_KPATCH_BUILD/g' "$KERNEL_SRCDIR"/scripts/Makefile.modfinal || die + fi + fi + +-- +2.43.0 + diff --git a/huawei-remove-duplicate-d-or-x.patch b/huawei-remove-duplicate-d-or-x.patch new file mode 100644 index 0000000000000000000000000000000000000000..b262f2687e325b22de9e810296e075f8030b9b02 --- /dev/null +++ b/huawei-remove-duplicate-d-or-x.patch @@ -0,0 +1,27 @@ +From 5d803601cf1e709341352f445827b5b463504dd6 Mon Sep 17 00:00:00 2001 +From: jinsaihang +Date: Mon, 21 Jul 2025 19:23:57 +0800 +Subject: [PATCH] remove duplicate "$d" or "$x" + +--- + kpatch-build/lookup.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/kpatch-build/lookup.c b/kpatch-build/lookup.c +index 7408167..b114e10 100644 +--- a/kpatch-build/lookup.c ++++ b/kpatch-build/lookup.c +@@ -594,6 +594,10 @@ static bool lookup_local_symbol(struct lookup_table *table, + + if (sym->bind == STB_LOCAL && !strcmp(sym->name, + lookup_sym->name)) { ++ if (result->objname && sym->type == STT_NOTYPE && (strcmp(sym->name, "$d") == 0 || strcmp(sym->name, "$x") == 0)) ++ { ++ continue; ++ } + if (result->objname) + ERROR("duplicate local symbol found for %s", + lookup_sym->name); +-- +2.43.0 + diff --git a/kpatch.spec b/kpatch.spec index bec154baa122d0a23431ddf1b8b64f081d24e0ae..83c34d0d90f41836ffcc19a37431cf39103a90fd 100644 --- a/kpatch.spec +++ b/kpatch.spec @@ -1,7 +1,7 @@ Name: kpatch Epoch: 1 Version: 0.9.9 -Release: 17 +Release: 18 Summary: A Linux dynamic kernel patching infrastructure License: GPLv2 @@ -70,6 +70,12 @@ Patch9006:huawei-ignore-initcall5-section-to-adapt-6.6-kernel.patch Patch9007:huawei-remove-.export_symbol-section-to-avoid-compile-error.patch Patch9008:huawei-ignore-the-change-of-the-hibifur-module.patch Patch9009:huawei-check-whether-the-directory-is-user-source-directory.patch +Patch9010:huawei-add-judgment-for-symbol-global.patch +Patch9011:huawei-remove-duplicate-d-or-x.patch +Patch9012:huawei-fix-kpatch-build-path.patch +Patch9013:huawei-delete-extra-spaces.patch +Patch9014:huawei-remove-BTF-section.patch +Patch9015:huawei-add-judgment-for-the-OOT-path.patch %endif BuildRequires: gcc elfutils-libelf-devel kernel-devel git @@ -134,6 +140,12 @@ popd %{_mandir}/man1/*.1.gz %changelog +* Fri Aug 29 2025 jinsaihang - 1:0.9.9-18 +- Type:bugfix +- CVE:NA +- SUG:NA +- DESC:add judgment for the OOT path + * Tue Aug 19 2025 Gu Zitao - 1:0.9.9-17 - Type:update - CVE:NA