hulk inclusion category: cleanup bugzilla: https://gitee.com/openeuler/kernel/issues/I9R2TB
--------------------------------
We need an interface to check calltrace of a certain task to find if the task is running in the old function that ready to be patched.
Since klp_check_calltrace() do the similar thing except that it checks all tasks, We can do little refactor on it to extract a function like klp_check_task_calltrace().
Signed-off-by: Zheng Yejian zhengyejian1@huawei.com --- arch/arm/kernel/livepatch.c | 8 -------- arch/arm64/kernel/livepatch.c | 8 -------- arch/powerpc/kernel/livepatch_32.c | 8 -------- arch/powerpc/kernel/livepatch_64.c | 8 -------- arch/x86/kernel/livepatch.c | 8 -------- include/linux/livepatch.h | 7 +++++++ 6 files changed, 7 insertions(+), 40 deletions(-)
diff --git a/arch/arm/kernel/livepatch.c b/arch/arm/kernel/livepatch.c index b1711d947dfe..1c27b7b15e3b 100644 --- a/arch/arm/kernel/livepatch.c +++ b/arch/arm/kernel/livepatch.c @@ -64,14 +64,6 @@ static bool is_jump_insn(u32 insn) return false; }
-struct klp_func_list { - struct klp_func_list *next; - unsigned long func_addr; - unsigned long func_size; - const char *func_name; - int force; -}; - struct walk_stackframe_args { int enable; struct klp_func_list *check_funcs; diff --git a/arch/arm64/kernel/livepatch.c b/arch/arm64/kernel/livepatch.c index 5b0171254820..237680e4ac5b 100644 --- a/arch/arm64/kernel/livepatch.c +++ b/arch/arm64/kernel/livepatch.c @@ -57,14 +57,6 @@ static inline bool offset_in_range(unsigned long pc, unsigned long addr, ((le32_to_cpu(insn) & 0xfc000000) == 0x94000000) || \ ((le32_to_cpu(insn) & 0xfefff800) == 0xd63f0800))
-struct klp_func_list { - struct klp_func_list *next; - unsigned long func_addr; - unsigned long func_size; - const char *func_name; - int force; -}; - struct walk_stackframe_args { int enable; struct klp_func_list *check_funcs; diff --git a/arch/powerpc/kernel/livepatch_32.c b/arch/powerpc/kernel/livepatch_32.c index 134b08e12e74..9ad9d92a4422 100644 --- a/arch/powerpc/kernel/livepatch_32.c +++ b/arch/powerpc/kernel/livepatch_32.c @@ -54,14 +54,6 @@ static bool is_jump_insn(u32 insn) return false; }
-struct klp_func_list { - struct klp_func_list *next; - unsigned long func_addr; - unsigned long func_size; - const char *func_name; - int force; -}; - struct walk_stackframe_args { int enable; struct klp_func_list *check_funcs; diff --git a/arch/powerpc/kernel/livepatch_64.c b/arch/powerpc/kernel/livepatch_64.c index b33839b5916a..bc9de72f71c3 100644 --- a/arch/powerpc/kernel/livepatch_64.c +++ b/arch/powerpc/kernel/livepatch_64.c @@ -59,14 +59,6 @@ static bool is_jump_insn(u32 insn) return false; }
-struct klp_func_list { - struct klp_func_list *next; - unsigned long func_addr; - unsigned long func_size; - const char *func_name; - int force; -}; - struct walk_stackframe_args { int enable; struct klp_func_list *check_funcs; diff --git a/arch/x86/kernel/livepatch.c b/arch/x86/kernel/livepatch.c index 43404fc1fdbb..fa5880d3cc22 100644 --- a/arch/x86/kernel/livepatch.c +++ b/arch/x86/kernel/livepatch.c @@ -52,14 +52,6 @@ static bool is_jump_insn(u8 *insn) return false; }
-struct klp_func_list { - struct klp_func_list *next; - unsigned long func_addr; - unsigned long func_size; - const char *func_name; - int force; -}; - static inline unsigned long klp_size_to_check(unsigned long func_size, int force) { diff --git a/include/linux/livepatch.h b/include/linux/livepatch.h index 56ad1c1dd83e..23fb19d74311 100644 --- a/include/linux/livepatch.h +++ b/include/linux/livepatch.h @@ -259,6 +259,13 @@ int klp_compare_address(unsigned long pc, unsigned long func_addr, void arch_klp_init(void); int klp_module_delete_safety_check(struct module *mod);
+struct klp_func_list { + struct klp_func_list *next; + unsigned long func_addr; + unsigned long func_size; + const char *func_name; + int force; +}; #endif
int klp_apply_section_relocs(struct module *pmod, Elf_Shdr *sechdrs,