From d2bb38528cd4b947000e70d5abd7c19ee4d1e924 Mon Sep 17 00:00:00 2001 From: hubin Date: Mon, 23 May 2022 19:06:18 +0800 Subject: [PATCH] create-diff-object: fix some hotpatch compilation problems Signed-off-by: hubin --- ...diff-object-ignore-change-of-certain.patch | 37 +++++++++++++++++++ ...ff-object-allow-__jump_table-section.patch | 27 ++++++++++++++ kpatch.spec | 10 ++++- 3 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 0039-create-diff-object-ignore-change-of-certain.patch create mode 100644 0040-create-diff-object-allow-__jump_table-section.patch diff --git a/0039-create-diff-object-ignore-change-of-certain.patch b/0039-create-diff-object-ignore-change-of-certain.patch new file mode 100644 index 0000000..645917d --- /dev/null +++ b/0039-create-diff-object-ignore-change-of-certain.patch @@ -0,0 +1,37 @@ +From ff93b567f3cff56e3f0c668258499acb1d511865 Mon Sep 17 00:00:00 2001 +From: hubin +Date: Mon, 23 May 2022 17:00:37 +0800 +Subject: [PATCH] create-diff-object: ignore change of certain special sections + +Signed-off-by: hubin +--- + 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 + diff --git a/0040-create-diff-object-allow-__jump_table-section.patch b/0040-create-diff-object-allow-__jump_table-section.patch new file mode 100644 index 0000000..e713677 --- /dev/null +++ b/0040-create-diff-object-allow-__jump_table-section.patch @@ -0,0 +1,27 @@ +From 556db3ad9deab83942621e56accc711427224ca5 Mon Sep 17 00:00:00 2001 +From: hubin +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 +--- + 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 + diff --git a/kpatch.spec b/kpatch.spec index b3a9ed6..8c81359 100644 --- a/kpatch.spec +++ b/kpatch.spec @@ -1,7 +1,7 @@ Name: kpatch Epoch: 1 Version: 0.9.5 -Release: 8 +Release: 9 Summary: A Linux dynamic kernel patching infrastructure 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 Patch0037:0037-create-diff-object-skip-creating-.kpatch.arch-sectio.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 Requires: bc make gcc patch bison flex openssl-devel @@ -111,6 +113,12 @@ popd %{_mandir}/man1/*.1.gz %changelog +* Mon May 23 2022 Bin Hu -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 -1:0.9.5-8 - Type:bugfix - ID:NA -- Gitee