1 Star 0 Fork 44

沈仲伟/kpatch

forked from src-openEuler/kpatch 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0016-create-diff-object-add-jump-label-support.patch 2.35 KB
一键复制 编辑 原始数据 按行查看 历史
HuBin95 提交于 2024-03-02 00:18 . kpatch: upgrade to 0.9.9
From f2b8a790b653d2eab5d48cbb725ec94b1655b0f2 Mon Sep 17 00:00:00 2001
From: Zhipeng Xie <xiezhipeng1@huawei.com>
Date: Mon, 2 Mar 2020 04:35:07 -0500
Subject: [PATCH 16/38] create-diff-object: add jump label support
This patch processes the __jump_table special section, and
only the jump_lable used by the changed functions will be
included in __jump_table section and solve this limitation.
(The livepatch in kernel should also be modified that processing
the tracepoint again after the dynamic relocation by livepatch.)
Signed-off-by: Zhipeng Xie <xiezhipeng1@huawei.com>
---
kpatch-build/create-diff-object.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c
index 41a9c0f..e24482e 100644
--- a/kpatch-build/create-diff-object.c
+++ b/kpatch-build/create-diff-object.c
@@ -70,6 +70,7 @@ enum subsection {
enum loglevel loglevel = NORMAL;
bool KLP_ARCH;
+char *KEEP_JUMP_LABEL = NULL;
int jump_label_errors, static_call_errors;
@@ -2355,6 +2356,8 @@ static bool jump_table_group_filter(struct lookup_table *lookup,
if (tracepoint || dynamic_debug)
return false;
+ if (KEEP_JUMP_LABEL)
+ return true;
/*
* This will be upgraded to an error after all jump labels have
* been reported.
@@ -2385,6 +2388,8 @@ static bool jump_table_group_filter(struct lookup_table *lookup,
if (tracepoint || dynamic_debug)
return false;
+ if (KEEP_JUMP_LABEL)
+ return true;
/*
* This will be upgraded to an error after all jump label
* errors have been reported.
@@ -3171,8 +3176,7 @@ static void kpatch_process_special_sections(struct kpatch_elf *kelf,
* labels and enable tracepoints in a patched function.
*/
list_for_each_entry(sec, &kelf->sections, list) {
- if (strcmp(sec->name, "__jump_table") &&
- strcmp(sec->name, "__tracepoints") &&
+ if (strcmp(sec->name, "__tracepoints") &&
strcmp(sec->name, "__tracepoints_ptrs") &&
strcmp(sec->name, "__tracepoints_strings"))
continue;
@@ -4161,6 +4165,7 @@ int main(int argc, char *argv[])
char *parent_symtab, *mod_symvers, *patch_name, *output_obj;
char *no_profiling_calls = NULL;
+ KEEP_JUMP_LABEL = getenv("KEEP_JUMP_LABEL");
memset(&arguments, 0, sizeof(arguments));
argp_parse (&argp, argc, argv, 0, NULL, &arguments);
if (arguments.debug)
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhong-wei-shen/kpatch.git
git@gitee.com:zhong-wei-shen/kpatch.git
zhong-wei-shen
kpatch
kpatch
master

搜索帮助