diff --git a/0040-kpatch-cc-fix-stripping-of-source-tree-prefix.patch b/0040-kpatch-cc-fix-stripping-of-source-tree-prefix.patch new file mode 100644 index 0000000000000000000000000000000000000000..0635e38d51a9d9088c0b706bcfe978ec1cbf78a5 --- /dev/null +++ b/0040-kpatch-cc-fix-stripping-of-source-tree-prefix.patch @@ -0,0 +1,34 @@ +From 07433e98c03075080ce4bd74e5aafc0efc070000 Mon Sep 17 00:00:00 2001 +From: Johannes Erdfelt +Date: Wed, 27 Jul 2022 10:29:36 -0700 +Subject: [PATCH] kpatch-cc: fix stripping of source tree prefix + +To support building out-of-tree kernel modules, the source tree prefix +is attempted to be stripped from change object file paths to make them +relative. However, if the path is already relative, the change can +strip a substring instead, resulting in build errors. + +Ensure just the prefix is stripped instead of any substring. + +Fixes: #1282 +Fixes: 51a8fad34ff3 ("Add support for building out-of-tree modules") +--- + kpatch-build/kpatch-cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/kpatch-build/kpatch-cc b/kpatch-build/kpatch-cc +index 5474a13..6f0063e 100755 +--- a/kpatch-build/kpatch-cc ++++ b/kpatch-build/kpatch-cc +@@ -23,7 +23,7 @@ if [[ "$TOOLCHAINCMD" =~ ^(.*-)?gcc$ || "$TOOLCHAINCMD" =~ ^(.*-)?clang$ ]] ; th + [[ "$obj" = */.tmp_mc_*.o ]] && break; + + [[ "$obj" = */.tmp_*.o ]] && obj="${obj/.tmp_/}" +- relobj=${obj//$KPATCH_GCC_SRCDIR\//} ++ relobj=${obj##$KPATCH_GCC_SRCDIR/} + case "$relobj" in + *.mod.o|\ + *built-in.o|\ +-- +2.20.1 + diff --git a/kpatch.spec b/kpatch.spec index fbc548a915e906db3da66e7e4ac9546cbc0973b3..83534e942765c098b8d5c085cc7cafe6d127176e 100644 --- a/kpatch.spec +++ b/kpatch.spec @@ -1,7 +1,7 @@ Name: kpatch Epoch: 1 Version: 0.9.9 -Release: 8 +Release: 9 Summary: A Linux dynamic kernel patching infrastructure License: GPLv2 @@ -52,6 +52,7 @@ Patch0036:0036-create-diff-object-ignore-entsize-change-of-.return_.patch Patch0037:0037-add-initial-riscv64-support.patch Patch0038:0038-Fix-undefined-behavior-problem-when-using-list_forea.patch Patch0039:0039-build-support-for-building-with-clang.patch +Patch0040:0040-kpatch-cc-fix-stripping-of-source-tree-prefix.patch Patch9001:huawei-fix-function-ptr-relocation.patch Patch9002:huawei-lookup.c-ignore-BTF-ID-when-matching-locals.patch @@ -122,6 +123,12 @@ popd %{_mandir}/man1/*.1.gz %changelog +* Mon Jun 24 2024 zhangxianting - 1:0.9.9-9 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC:sync commit: kpatch-cc: fix stripping of source tree prefix + * Wed Jun 12 2024 peng.zou - 1:0.9.9-8 - Type:enhancement - ID:NA