mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-19 05:04:20 +00: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
|
@ -53,6 +53,7 @@
|
|||
#include <asm/sections.h>
|
||||
#include <linux/tracepoint.h>
|
||||
#include <linux/ftrace.h>
|
||||
#include <linux/livepatch.h>
|
||||
#include <linux/async.h>
|
||||
#include <linux/percpu.h>
|
||||
#include <linux/kmemleak.h>
|
||||
|
@ -984,6 +985,7 @@ SYSCALL_DEFINE2(delete_module, const char __user *, name_user,
|
|||
mod->exit();
|
||||
blocking_notifier_call_chain(&module_notify_list,
|
||||
MODULE_STATE_GOING, mod);
|
||||
klp_module_going(mod);
|
||||
ftrace_release_mod(mod);
|
||||
|
||||
async_synchronize_full();
|
||||
|
@ -3315,6 +3317,7 @@ fail:
|
|||
module_put(mod);
|
||||
blocking_notifier_call_chain(&module_notify_list,
|
||||
MODULE_STATE_GOING, mod);
|
||||
klp_module_going(mod);
|
||||
ftrace_release_mod(mod);
|
||||
free_module(mod);
|
||||
wake_up_all(&module_wq);
|
||||
|
@ -3401,7 +3404,13 @@ out:
|
|||
|
||||
static int prepare_coming_module(struct module *mod)
|
||||
{
|
||||
int err;
|
||||
|
||||
ftrace_module_enable(mod);
|
||||
err = klp_module_coming(mod);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
blocking_notifier_call_chain(&module_notify_list,
|
||||
MODULE_STATE_COMING, mod);
|
||||
return 0;
|
||||
|
@ -3553,6 +3562,7 @@ static int load_module(struct load_info *info, const char __user *uargs,
|
|||
coming_cleanup:
|
||||
blocking_notifier_call_chain(&module_notify_list,
|
||||
MODULE_STATE_GOING, mod);
|
||||
klp_module_going(mod);
|
||||
|
||||
bug_cleanup:
|
||||
/* module_bug_cleanup needs module_mutex protection */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue