[PATCH v2 8/9] livepatch: Remove module_disable_ro() usage
From: Josh Poimboeuf
Date: Fri Apr 17 2020 - 10:05:00 EST
With arch_klp_init_object_loaded() gone, and apply_relocate_add() now
using text_poke(), livepatch no longer needs to use module_disable_ro().
The text_mutex usage can also be removed -- its purpose was to protect
against module permission change races.
Acked-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
---
kernel/livepatch/core.c | 8 --------
1 file changed, 8 deletions(-)
diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
index a090185e8689..3ff886b911ae 100644
--- a/kernel/livepatch/core.c
+++ b/kernel/livepatch/core.c
@@ -767,10 +767,6 @@ static int klp_init_object_loaded(struct klp_patch *patch,
struct klp_modinfo *info = patch->mod->klp_info;
if (klp_is_module(obj)) {
-
- mutex_lock(&text_mutex);
- module_disable_ro(patch->mod);
-
/*
* Only write module-specific relocations here
* (.klp.rela.{module}.*). vmlinux-specific relocations were
@@ -782,10 +778,6 @@ static int klp_init_object_loaded(struct klp_patch *patch,
patch->mod->core_kallsyms.strtab,
info->symndx, patch->mod,
obj->name);
-
- module_enable_ro(patch->mod, true);
- mutex_unlock(&text_mutex);
-
if (ret)
return ret;
}
--
2.21.1