create-diff-object: error on detect new/changed ALTINSTR_ENTRY_CB
ALTINSTR_ENTRY_CB have callback which referenct to other function in .altinstructions, currently kaptch don't support new/changed ALTINSTR_ENTRY_CB, so error on detect this case. Signed-off-by: Zhipeng Xie <xiezhipeng1@huawei.com>
This commit is contained in:
parent
d999bfe5d4
commit
bee047ee3f
@ -0,0 +1,51 @@
|
|||||||
|
From 6acafe200135f0299f4834ba7dcea5d582d75a0a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Zhipeng Xie <xiezhipeng1@huawei.com>
|
||||||
|
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 <xiezhipeng1@huawei.com>
|
||||||
|
---
|
||||||
|
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
|
||||||
|
|
||||||
11
kpatch.spec
11
kpatch.spec
@ -1,7 +1,7 @@
|
|||||||
Name: kpatch
|
Name: kpatch
|
||||||
Epoch: 1
|
Epoch: 1
|
||||||
Version: 0.9.1
|
Version: 0.9.1
|
||||||
Release: 15
|
Release: 16
|
||||||
Summary: A Linux dynamic kernel patching infrastructure
|
Summary: A Linux dynamic kernel patching infrastructure
|
||||||
|
|
||||||
License: GPLv2
|
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
|
Patch0026:0026-support-remove-static-variables-using-KPATCH_IGNORE_.patch
|
||||||
Patch0027:0027-create-build-diff-support-for-.cold-functions-with-n.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
|
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
|
BuildRequires: gcc elfutils-libelf-devel uname-build-checks kernel-devel git
|
||||||
Requires: bc make gcc patch bison flex openssl-devel
|
Requires: bc make gcc patch bison flex openssl-devel
|
||||||
@ -100,7 +101,13 @@ popd
|
|||||||
%{_mandir}/man1/*.1.gz
|
%{_mandir}/man1/*.1.gz
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Fri Jul 23 2021 Xinpeng Liu<liuxp11@chinatelecom.cn> -1:0.9.1-15
|
* Sat Aug 21 2021 Zhipeng Xie<xiezhipeng1@huawei.com> -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<xiezhipeng1@huawei.com> -1:0.9.1-15
|
||||||
- Type:enhancement
|
- Type:enhancement
|
||||||
- ID:NA
|
- ID:NA
|
||||||
- SUG:NA
|
- SUG:NA
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user