Skip to content

Commit 958de66

Browse files
Peter ZijlstraIngo Molnar
authored andcommitted
module: Remove set_all_modules_text_*()
Now that there are no users of set_all_modules_text_*() left, remove it. While it appears nds32 uses it, it does not have STRICT_MODULE_RWX and therefore ends up with the NOP stubs. Tested-by: Alexei Starovoitov <[email protected]> Tested-by: Steven Rostedt (VMware) <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Acked-by: Alexei Starovoitov <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Brian Gerst <[email protected]> Cc: Denys Vlasenko <[email protected]> Cc: Greentime Hu <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Jessica Yu <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Vincent Chen <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 5a73558 commit 958de66

File tree

3 files changed

+0
-59
lines changed

3 files changed

+0
-59
lines changed

arch/nds32/kernel/ftrace.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,18 +89,6 @@ int __init ftrace_dyn_arch_init(void)
8989
return 0;
9090
}
9191

92-
int ftrace_arch_code_modify_prepare(void)
93-
{
94-
set_all_modules_text_rw();
95-
return 0;
96-
}
97-
98-
int ftrace_arch_code_modify_post_process(void)
99-
{
100-
set_all_modules_text_ro();
101-
return 0;
102-
}
103-
10492
static unsigned long gen_sethi_insn(unsigned long addr)
10593
{
10694
unsigned long opcode = 0x46000000;

include/linux/module.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -846,13 +846,9 @@ extern int module_sysfs_initialized;
846846
#define __MODULE_STRING(x) __stringify(x)
847847

848848
#ifdef CONFIG_STRICT_MODULE_RWX
849-
extern void set_all_modules_text_rw(void);
850-
extern void set_all_modules_text_ro(void);
851849
extern void module_enable_ro(const struct module *mod, bool after_init);
852850
extern void module_disable_ro(const struct module *mod);
853851
#else
854-
static inline void set_all_modules_text_rw(void) { }
855-
static inline void set_all_modules_text_ro(void) { }
856852
static inline void module_enable_ro(const struct module *mod, bool after_init) { }
857853
static inline void module_disable_ro(const struct module *mod) { }
858854
#endif

kernel/module.c

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2029,49 +2029,6 @@ static void module_enable_nx(const struct module *mod)
20292029
frob_writable_data(&mod->init_layout, set_memory_nx);
20302030
}
20312031

2032-
/* Iterate through all modules and set each module's text as RW */
2033-
void set_all_modules_text_rw(void)
2034-
{
2035-
struct module *mod;
2036-
2037-
if (!rodata_enabled)
2038-
return;
2039-
2040-
mutex_lock(&module_mutex);
2041-
list_for_each_entry_rcu(mod, &modules, list) {
2042-
if (mod->state == MODULE_STATE_UNFORMED)
2043-
continue;
2044-
2045-
frob_text(&mod->core_layout, set_memory_rw);
2046-
frob_text(&mod->init_layout, set_memory_rw);
2047-
}
2048-
mutex_unlock(&module_mutex);
2049-
}
2050-
2051-
/* Iterate through all modules and set each module's text as RO */
2052-
void set_all_modules_text_ro(void)
2053-
{
2054-
struct module *mod;
2055-
2056-
if (!rodata_enabled)
2057-
return;
2058-
2059-
mutex_lock(&module_mutex);
2060-
list_for_each_entry_rcu(mod, &modules, list) {
2061-
/*
2062-
* Ignore going modules since it's possible that ro
2063-
* protection has already been disabled, otherwise we'll
2064-
* run into protection faults at module deallocation.
2065-
*/
2066-
if (mod->state == MODULE_STATE_UNFORMED ||
2067-
mod->state == MODULE_STATE_GOING)
2068-
continue;
2069-
2070-
frob_text(&mod->core_layout, set_memory_ro);
2071-
frob_text(&mod->init_layout, set_memory_ro);
2072-
}
2073-
mutex_unlock(&module_mutex);
2074-
}
20752032
#else /* !CONFIG_STRICT_MODULE_RWX */
20762033
static void module_enable_nx(const struct module *mod) { }
20772034
#endif /* CONFIG_STRICT_MODULE_RWX */

0 commit comments

Comments
 (0)