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>
52 lines
1.8 KiB
Diff
52 lines
1.8 KiB
Diff
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
|
|
|