From 3a88b42a536a90e61f7b3f5a9f90a86d25421637 Mon Sep 17 00:00:00 2001 From: Wentao Fan Date: Sat, 29 May 2021 05:47:11 -0400 Subject: [PATCH] support for .cold functions with no id suffix Signed-off-by: Wentao Fan --- ...f-support-for-.cold-functions-with-n.patch | 42 +++++++++++++++++++ kpatch.spec | 9 +++- 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 0027-create-build-diff-support-for-.cold-functions-with-n.patch diff --git a/0027-create-build-diff-support-for-.cold-functions-with-n.patch b/0027-create-build-diff-support-for-.cold-functions-with-n.patch new file mode 100644 index 0000000..e1d8df0 --- /dev/null +++ b/0027-create-build-diff-support-for-.cold-functions-with-n.patch @@ -0,0 +1,42 @@ +From 55a2778284c088f4c383cf364bef18f1b5b88531 Mon Sep 17 00:00:00 2001 +From: Artem Savkov +Date: Thu, 4 Mar 2021 12:47:43 +0100 +Subject: [PATCH] create-build-diff: support for .cold functions with no id + suffix + +create-build-diff expects .cold functions to be suffixed by an id, which +is not always the case. Drop the trailing '.' when searching for cold +functions. + +Fixes: #1160 + +Signed-off-by: Artem Savkov +--- + kpatch-build/create-diff-object.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c +index 6b19e1e..d20f2f1 100644 +--- a/kpatch-build/create-diff-object.c ++++ b/kpatch-build/create-diff-object.c +@@ -124,7 +124,7 @@ static int is_bundleable(struct symbol *sym) + if (sym->type == STT_FUNC && + !strncmp(sym->sec->name, ".text.unlikely.",15) && + (!strcmp(sym->sec->name + 15, sym->name) || +- (strstr(sym->name, ".cold.") && ++ (strstr(sym->name, ".cold") && + !strncmp(sym->sec->name + 15, sym->name, strlen(sym->sec->name) - 15)))) + return 1; + +@@ -248,7 +248,7 @@ static void kpatch_detect_child_functions(struct kpatch_elf *kelf) + list_for_each_entry(sym, &kelf->symbols, list) { + char *coldstr; + +- coldstr = strstr(sym->name, ".cold."); ++ coldstr = strstr(sym->name, ".cold"); + if (coldstr != NULL) { + char *pname; + +-- +2.27.0 + diff --git a/kpatch.spec b/kpatch.spec index cf383c6..4cacac4 100644 --- a/kpatch.spec +++ b/kpatch.spec @@ -1,7 +1,7 @@ Name: kpatch Epoch: 1 Version: 0.9.1 -Release: 12 +Release: 13 Summary: A Linux dynamic kernel patching infrastructure License: GPLv2 @@ -38,6 +38,7 @@ Patch0023:0023-create-diff-object-fix-duplicate-symbols-for-vmlinux.patch Patch0024:0024-optimize-for-out-of-tree-module.patch Patch0025:0025-Fix-relocation-not-resolved-when-new-functions-expor.patch Patch0026:0026-support-remove-static-variables-using-KPATCH_IGNORE_.patch +Patch0027:0027-create-build-diff-support-for-.cold-functions-with-n.patch BuildRequires: gcc elfutils-libelf-devel uname-build-checks kernel-devel git Requires: bc make gcc patch bison flex openssl-devel @@ -97,6 +98,12 @@ popd %{_mandir}/man1/*.1.gz %changelog +* Sat May 29 2021 Wentao Fan -1:0.9.1-13 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:support for .cold functions with no id suffix + * Wed Feb 10 2021 Zhipeng Xie -1:0.9.1-12 - Type:enhancement - ID:NA -- Gitee