diff options
| author | Jessica Yu <jeyu@redhat.com> | 2016-03-16 20:55:39 -0400 |
|---|---|---|
| committer | Jiri Kosina <jkosina@suse.cz> | 2016-03-17 04:45:10 -0400 |
| commit | 7e545d6eca20ce8ef7f66a63146cbff82b2ba760 (patch) | |
| tree | f8c4366009b357842b8b17b3bfddbfc3b634ff40 /include/linux | |
| parent | 4c973d1620ae08f5cbe27644c5f5b974c8f594ec (diff) | |
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>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/livepatch.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/livepatch.h b/include/linux/livepatch.h index c05679701e10..bd830d590465 100644 --- a/include/linux/livepatch.h +++ b/include/linux/livepatch.h | |||
| @@ -24,6 +24,8 @@ | |||
| 24 | #include <linux/module.h> | 24 | #include <linux/module.h> |
| 25 | #include <linux/ftrace.h> | 25 | #include <linux/ftrace.h> |
| 26 | 26 | ||
| 27 | #if IS_ENABLED(CONFIG_LIVEPATCH) | ||
| 28 | |||
| 27 | #include <asm/livepatch.h> | 29 | #include <asm/livepatch.h> |
| 28 | 30 | ||
| 29 | enum klp_state { | 31 | enum klp_state { |
| @@ -132,4 +134,15 @@ int klp_unregister_patch(struct klp_patch *); | |||
| 132 | int klp_enable_patch(struct klp_patch *); | 134 | int klp_enable_patch(struct klp_patch *); |
| 133 | int klp_disable_patch(struct klp_patch *); | 135 | int klp_disable_patch(struct klp_patch *); |
| 134 | 136 | ||
| 137 | /* Called from the module loader during module coming/going states */ | ||
| 138 | int klp_module_coming(struct module *mod); | ||
| 139 | void klp_module_going(struct module *mod); | ||
| 140 | |||
| 141 | #else /* !CONFIG_LIVEPATCH */ | ||
| 142 | |||
| 143 | static inline int klp_module_coming(struct module *mod) { return 0; } | ||
| 144 | static inline void klp_module_going(struct module *mod) { } | ||
| 145 | |||
| 146 | #endif /* CONFIG_LIVEPATCH */ | ||
| 147 | |||
| 135 | #endif /* _LINUX_LIVEPATCH_H_ */ | 148 | #endif /* _LINUX_LIVEPATCH_H_ */ |
