From ceff86929026ee1939582a97864afcf77308c040 Mon Sep 17 00:00:00 2001 From: Cheng Jian Date: Wed, 22 Apr 2020 16:55:33 +0800 Subject: [PATCH] livepatch/core: fix kabi for klp_rel_state hulk inclusion category: feature bugzilla: 5391/28338/24634 CVE: NA ----------------------------------------------- The previous patch added a field klp_rel_state in the module structure, which caused KABI changes, so fix this problem Signed-off-by: Cheng Jian Reviewed-by: Xie XiuQi Signed-off-by: Yang Yingliang --- include/linux/module.h | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/include/linux/module.h b/include/linux/module.h index 49942432f010..e1f34183fe18 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -469,19 +469,6 @@ struct module { /* Elf information */ struct klp_modinfo *klp_info; - /* - * livepatch should relocate the key of jump_label by - * using klp_write_module_reloc. So it's necessary to - * do jump_label_apply_nops() and jump_label_add_module() - * later after livepatch relocation finised. - * - * for normal module : - * always MODULE_KLP_REL_DONE. - * for livepatch module : - * init as MODULE_KLP_REL_UNDO, - * set to MODULE_KLP_REL_DONE when relocate completed. - */ - enum MODULE_KLP_REL_STATE klp_rel_state; #endif #ifdef CONFIG_MODULE_UNLOAD @@ -507,7 +494,27 @@ struct module { unsigned int num_ei_funcs; #endif +#if defined(CONFIG_LIVEPATCH) && !defined(__GENKSYMS__) + union { + /* + * livepatch should relocate the key of jump_label by + * using klp_write_module_reloc. So it's necessary to + * do jump_label_apply_nops() and jump_label_add_module() + * later after livepatch relocation finised. + * + * for normal module : + * always MODULE_KLP_REL_DONE. + * for livepatch module : + * init as MODULE_KLP_REL_UNDO, + * set to MODULE_KLP_REL_DONE when relocate completed. + */ + enum MODULE_KLP_REL_STATE klp_rel_state; + long klp_rel_state_KABI; + }; +#else KABI_RESERVE(1) +#endif + KABI_RESERVE(2) KABI_RESERVE(3) KABI_RESERVE(4) -- GitLab