diff --git a/0029-create-diff-object-error-on-detect-new-changed-ALTIN.patch b/0029-create-diff-object-error-on-detect-new-changed-ALTIN.patch new file mode 100644 index 0000000000000000000000000000000000000000..70433c185a409cb26395d91c4ec578f680df9891 --- /dev/null +++ b/0029-create-diff-object-error-on-detect-new-changed-ALTIN.patch @@ -0,0 +1,51 @@ +From 6acafe200135f0299f4834ba7dcea5d582d75a0a Mon Sep 17 00:00:00 2001 +From: Zhipeng Xie +Date: Sat, 21 Aug 2021 04:07:33 -0400 +Subject: [PATCH] create-diff-object: error on detect new/changed + ALTINSTR_ENTRY_CB + +ALTINSTR_ENTRY_CB have callback which reference to other function +in .altinstructions, currently kpatch don't support new/changed +ALTINSTR_ENTRY_CB, so error on detect this case. + +Signed-off-by: Zhipeng Xie +--- + kpatch-build/create-diff-object.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c +index d20f2f1..07a1815 100644 +--- a/kpatch-build/create-diff-object.c ++++ b/kpatch-build/create-diff-object.c +@@ -2227,6 +2227,8 @@ static void kpatch_regenerate_special_section(struct kpatch_elf *kelf, + * aren't sorted (e.g. .rela.fixup), so go through the entire + * rela list each time. + */ ++ int i = 0; ++ struct rela *lastrela = NULL; + list_for_each_entry_safe(rela, safe, &sec->relas, list) { + if (rela->offset >= src_offset && + rela->offset < src_offset + group_size) { +@@ -2239,12 +2241,19 @@ static void kpatch_regenerate_special_section(struct kpatch_elf *kelf, + + rela->sym->include = 1; + ++ if (!strcmp(special->name, ".altinstructions")) { ++ if (i % 2 == 1 && strcmp(rela->sym->name , ".altinstr_replacement")) { ++ DIFF_FATAL("%s have entry in .altinstructions which have callback %s instead of new instruction", lastrela->sym->name, rela->sym->name); ++ } ++ } + + if (!strcmp(special->name, ".fixup")) + kpatch_update_ex_table_addend(kelf, special, + src_offset, + dest_offset, + group_size); ++ lastrela = rela; ++ i++; + } + } + +-- +2.27.0 + diff --git a/kpatch.spec b/kpatch.spec index 19542e30cb5515839e793949999b8f23c9fed6c1..1300aee02d33c1860be06f02d67a57208b7b965e 100644 --- a/kpatch.spec +++ b/kpatch.spec @@ -1,7 +1,7 @@ Name: kpatch Epoch: 1 Version: 0.9.1 -Release: 15 +Release: 16 Summary: A Linux dynamic kernel patching infrastructure License: GPLv2 @@ -40,6 +40,7 @@ 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 Patch0028:0028-lookup-Add-__UNIQUE_ID_-to-maybe_discarded_sym-list.patch +Patch0029:0029-create-diff-object-error-on-detect-new-changed-ALTIN.patch BuildRequires: gcc elfutils-libelf-devel uname-build-checks kernel-devel git Requires: bc make gcc patch bison flex openssl-devel @@ -100,7 +101,13 @@ popd %{_mandir}/man1/*.1.gz %changelog -* Fri Jul 23 2021 Xinpeng Liu -1:0.9.1-15 +* Sat Aug 21 2021 Zhipeng Xie -1:0.9.1-16 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC:create-diff-object: error on detect new/changed ALTINSTR_ENTRY_CB + +* Fri Jul 23 2021 Zhipeng Xie -1:0.9.1-15 - Type:enhancement - ID:NA - SUG:NA