mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-26 14:17:26 -04:00
livepatch/module: remove livepatch module notifier
Remove the livepatch module notifier in favor of directly enabling and disabling patches to modules in the module loader. Hard-coding the function calls ensures that ftrace_module_enable() is run before klp_module_coming() during module load, and that klp_module_going() is run before ftrace_release_mod() during module unload. This way, ftrace and livepatch code is run in the correct order during the module load/unload sequence without dependence on the module notifier call chain. Signed-off-by: Jessica Yu <jeyu@redhat.com> Reviewed-by: Petr Mladek <pmladek@suse.cz> Acked-by: Josh Poimboeuf <jpoimboe@redhat.com> Acked-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:
parent
4c973d1620
commit
7e545d6eca
3 changed files with 104 additions and 86 deletions
|
@ -24,6 +24,8 @@
|
|||
#include <linux/module.h>
|
||||
#include <linux/ftrace.h>
|
||||
|
||||
#if IS_ENABLED(CONFIG_LIVEPATCH)
|
||||
|
||||
#include <asm/livepatch.h>
|
||||
|
||||
enum klp_state {
|
||||
|
@ -132,4 +134,15 @@ int klp_unregister_patch(struct klp_patch *);
|
|||
int klp_enable_patch(struct klp_patch *);
|
||||
int klp_disable_patch(struct klp_patch *);
|
||||
|
||||
/* Called from the module loader during module coming/going states */
|
||||
int klp_module_coming(struct module *mod);
|
||||
void klp_module_going(struct module *mod);
|
||||
|
||||
#else /* !CONFIG_LIVEPATCH */
|
||||
|
||||
static inline int klp_module_coming(struct module *mod) { return 0; }
|
||||
static inline void klp_module_going(struct module *mod) { }
|
||||
|
||||
#endif /* CONFIG_LIVEPATCH */
|
||||
|
||||
#endif /* _LINUX_LIVEPATCH_H_ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue