[POC 23/23] module: Remove obsolete module_disable_ro()

Petr Mladek
2020-01-17T15:04:13Z

The split livepatch modules are relocated immediately during the module
load. There is no longer needed to disable the RO protection. The function
can be finally remove because livepatching was the only user (sinner).

Signed-off-by: Petr Mladek <pmladek@suse.com>
---
include/linux/module.h | 2 --
kernel/module.c | 13 -------------
2 files changed, 15 deletions(-)

diff --git a/include/linux/module.h b/include/linux/module.h
index 8545f3087274..5c9e661ac3bc 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -854,12 +854,10 @@ extern int module_sysfs_initialized;
extern void set_all_modules_text_rw(void);
extern void set_all_modules_text_ro(void);
extern void module_enable_ro(const struct module *mod, bool after_init);
-extern void module_disable_ro(const struct module *mod);
#else
static inline void set_all_modules_text_rw(void) { }
static inline void set_all_modules_text_ro(void) { }
static inline void module_enable_ro(const struct module *mod, bool after_init) { }
-static inline void module_disable_ro(const struct module *mod) { }
#endif

#ifdef CONFIG_GENERIC_BUG
diff --git a/kernel/module.c b/kernel/module.c
index 442926fc5f34..d435bad80d7d 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2030,19 +2030,6 @@ static void frob_writable_data(const struct module_layout *layout,
(layout->size - layout->ro_after_init_size) >> PAGE_SHIFT);
}

-/* livepatching wants to disable read-only so it can frob module. */
-void module_disable_ro(const struct module *mod)
-{
- if (!rodata_enabled)
- return;
-
- frob_text(&mod->core_layout, set_memory_rw);
- frob_rodata(&mod->core_layout, set_memory_rw);
- frob_ro_after_init(&mod->core_layout, set_memory_rw);
- frob_text(&mod->init_layout, set_memory_rw);
- frob_rodata(&mod->init_layout, set_memory_rw);
-}
-
void module_enable_ro(const struct module *mod, bool after_init)
{
if (!rodata_enabled)
--
2.16.4