From 276d072c150745f34a7f568493afe03703b049d4 Mon Sep 17 00:00:00 2001 From: jinsaihang Date: Tue, 3 Jun 2025 16:20:06 +0800 Subject: [PATCH] check whether the directory is a user source code directory Signed-off-by: jinsaihang (cherry picked from commit 7f48cfbf13c4f04fac1fac2179678d0969854192) --- ...e-directory-is-user-source-directory.patch | 25 +++++++++++++++++++ kpatch.spec | 9 ++++++- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 huawei-check-whether-the-directory-is-user-source-directory.patch diff --git a/huawei-check-whether-the-directory-is-user-source-directory.patch b/huawei-check-whether-the-directory-is-user-source-directory.patch new file mode 100644 index 0000000..fcd6d01 --- /dev/null +++ b/huawei-check-whether-the-directory-is-user-source-directory.patch @@ -0,0 +1,25 @@ +From b880b5b4fba522daf1b2ef7d6f465a7f33671794 Mon Sep 17 00:00:00 2001 +From: jinsaihang +Date: Tue, 3 Jun 2025 21:13:04 +0800 +Subject: [PATCH] check whether the directory is user source code directory + +--- + 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 b927555..3914101 100755 +--- a/kpatch-build/kpatch-build ++++ b/kpatch-build/kpatch-build +@@ -1125,7 +1125,7 @@ fi + # Prevent that by replacing the original setlocalversion with a friendlier one + # which just echo's the original version. This should be done before any + # changes to the source. +-if [[ -n "$USERSRCDIR" && -e "$KERNEL_SRCDIR/.git" ]]; then ++if [[ -n "$USERSRCDIR" && -e "$KERNEL_SRCDIR/.git" && -z "$USERMODBUILDDIR" ]]; then + cd "$KERNEL_SRCDIR" || die + cp -f scripts/setlocalversion "$TEMPDIR" || die + LOCALVERSION="$(make kernelversion)" +-- +2.27.0 + diff --git a/kpatch.spec b/kpatch.spec index 5b87e5d..e3db1f9 100644 --- a/kpatch.spec +++ b/kpatch.spec @@ -1,7 +1,7 @@ Name: kpatch Epoch: 1 Version: 0.9.9 -Release: 12 +Release: 13 Summary: A Linux dynamic kernel patching infrastructure License: GPLv2 @@ -63,6 +63,7 @@ Patch9005:huawei-adapt-arm64-dynamic-ftrace-call-with-2-nops.patch 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 BuildRequires: gcc elfutils-libelf-devel kernel-devel git %ifarch ppc64le @@ -126,6 +127,12 @@ popd %{_mandir}/man1/*.1.gz %changelog +* Tue Jun 03 2025 jinsaihang - 1:0.9.9-13 +- Type:bugfix +- CVE:NA +- SUG:NA +- DESC:check whether the directory is a user source code directory + * Thu Apr 17 2025 jinsaihang - 1:0.9.9-12 - Type:bugfix - CVE:NA -- Gitee