!65 create-diff-object: fix some hotpatch compilation problems

From: @hubin95 
Reviewed-by: @xiezhipeng1 
Signed-off-by: @xiezhipeng1
This commit is contained in:
openeuler-ci-bot 2022-05-23 11:44:52 +00:00 committed by Gitee
commit f7a943d75e
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 73 additions and 1 deletions

View File

@ -0,0 +1,37 @@
From ff93b567f3cff56e3f0c668258499acb1d511865 Mon Sep 17 00:00:00 2001
From: hubin <hubin73@huawei.com>
Date: Mon, 23 May 2022 17:00:37 +0800
Subject: [PATCH] create-diff-object: ignore change of certain special sections
Signed-off-by: hubin <hubin73@huawei.com>
---
kpatch-build/create-diff-object.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c
index 6b46e1f..7fabf4d 100644
--- a/kpatch-build/create-diff-object.c
+++ b/kpatch-build/create-diff-object.c
@@ -3076,6 +3076,19 @@ static void kpatch_process_special_sections(struct kpatch_elf *kelf,
}
}
+ list_for_each_entry(sec, &kelf->sections, list) {
+ if (strcmp(sec->name, "__patchable_function_entries") &&
+ strcmp(sec->name, ".note.gnu.property"))
+ continue;
+
+ sec->status = SAME;
+ sec->include = 0;
+ if (sec->rela) {
+ sec->rela->status = SAME;
+ sec->rela->include = 0;
+ }
+ }
+
kpatch_regenerate_orc_sections(kelf);
}
--
2.31.0.windows.1

View File

@ -0,0 +1,27 @@
From 556db3ad9deab83942621e56accc711427224ca5 Mon Sep 17 00:00:00 2001
From: hubin <hubin73@huawei.com>
Date: Mon, 23 May 2022 17:08:50 +0800
Subject: [PATCH] create-diff-object: allow __jump_table section change for
module hotpatch
Signed-off-by: hubin <hubin73@huawei.com>
---
kpatch-build/create-diff-object.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c
index 7fabf4d..d7a6789 100644
--- a/kpatch-build/create-diff-object.c
+++ b/kpatch-build/create-diff-object.c
@@ -3493,7 +3493,7 @@ static void kpatch_create_intermediate_sections(struct kpatch_elf *kelf,
* special section init code (e.g., apply_paravirt)
* runs due to late module patching.
*/
- if (!KLP_ARCH && !vmlinux && special)
+ if (!KLP_ARCH && !vmlinux && special && strcmp(sec->base->name, "__jump_table"))
ERROR("unsupported dynrela reference to symbol '%s' in module-specific special section '%s'",
rela->sym->name, sec->base->name);
--
2.31.0.windows.1

View File

@ -1,7 +1,7 @@
Name: kpatch Name: kpatch
Epoch: 1 Epoch: 1
Version: 0.9.5 Version: 0.9.5
Release: 8 Release: 9
Summary: A Linux dynamic kernel patching infrastructure Summary: A Linux dynamic kernel patching infrastructure
License: GPLv2 License: GPLv2
@ -51,6 +51,8 @@ Patch0035:0035-create-diff-object-fix-null-pointer-dereference-in-k.patch
Patch0036:0036-create-diff-object-ignore-.note.gnu.property-section.patch Patch0036:0036-create-diff-object-ignore-.note.gnu.property-section.patch
Patch0037:0037-create-diff-object-skip-creating-.kpatch.arch-sectio.patch Patch0037:0037-create-diff-object-skip-creating-.kpatch.arch-sectio.patch
Patch0038:0038-kpatch-build-do-not-copy-linux-scripts-when.patch Patch0038:0038-kpatch-build-do-not-copy-linux-scripts-when.patch
Patch0039:0039-create-diff-object-ignore-change-of-certain.patch
Patch0040:0040-create-diff-object-allow-__jump_table-section.patch
BuildRequires: gcc elfutils-libelf-devel kernel-devel git BuildRequires: gcc elfutils-libelf-devel kernel-devel git
Requires: bc make gcc patch bison flex openssl-devel Requires: bc make gcc patch bison flex openssl-devel
@ -111,6 +113,12 @@ popd
%{_mandir}/man1/*.1.gz %{_mandir}/man1/*.1.gz
%changelog %changelog
* Mon May 23 2022 Bin Hu <hubin73@huawei.com> -1:0.9.5-9
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:create-diff-object: fix some hotpatch compilation problems
* Thu May 12 2022 Bin Hu <hubin73@huawei.com> -1:0.9.5-8 * Thu May 12 2022 Bin Hu <hubin73@huawei.com> -1:0.9.5-8
- Type:bugfix - Type:bugfix
- ID:NA - ID:NA