
From: Yang Jihong <yangjihong1@huawei.com> hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5CJ7X -------------------------------- For the ARM architecture, need to register the callback function for processing BRK exception in advance. Therefore, the architecture-related init interface needs to be provided. Signed-off-by: Yang Jihong <yangjihong1@huawei.com> Reviewed-by: Xu Kuohai <xukuohai@huawei.com> Signed-off-by: Zheng Zengkai <zhengzengkai@huawei.com> --- include/linux/livepatch.h | 2 ++ kernel/livepatch/core.c | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/include/linux/livepatch.h b/include/linux/livepatch.h index 602e944dfc9e..c9f3c1c12638 100644 --- a/include/linux/livepatch.h +++ b/include/linux/livepatch.h @@ -256,6 +256,8 @@ int klp_compare_address(unsigned long pc, unsigned long func_addr, return 0; } +void arch_klp_init(void); + #endif int klp_apply_section_relocs(struct module *pmod, Elf_Shdr *sechdrs, diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c index a682a8638e01..ae116aac9b48 100644 --- a/kernel/livepatch/core.c +++ b/kernel/livepatch/core.c @@ -1403,6 +1403,10 @@ long __weak arch_klp_save_old_code(struct arch_klp_data *arch_data, void *old_fu return -ENOSYS; } +void __weak arch_klp_init(void) +{ +} + int __weak arch_klp_check_breakpoint(struct arch_klp_data *arch_data, void *old_func) { return 0; @@ -2293,6 +2297,9 @@ static int __init klp_init(void) if (!klp_root_kobj) goto error_remove; +#ifdef CONFIG_LIVEPATCH_STOP_MACHINE_CONSISTENCY + arch_klp_init(); +#endif return 0; error_remove: -- 2.20.1