Commit 3559ad39 authored by Christophe Leroy's avatar Christophe Leroy Committed by Luis Chamberlain

module: Change module_enable_{nx/x/ro}() to more explicit names

It's a bit puzzling to see a call to module_enable_nx() followed by a
call to module_enable_x(). This is because one applies on text while
the other applies on data.

Change name to make that more clear.
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
parent ac88ee7d
...@@ -322,9 +322,9 @@ static inline struct module *mod_find(unsigned long addr, struct mod_tree_root * ...@@ -322,9 +322,9 @@ static inline struct module *mod_find(unsigned long addr, struct mod_tree_root *
} }
#endif /* CONFIG_MODULES_TREE_LOOKUP */ #endif /* CONFIG_MODULES_TREE_LOOKUP */
void module_enable_ro(const struct module *mod, bool after_init); void module_enable_rodata_ro(const struct module *mod, bool after_init);
void module_enable_nx(const struct module *mod); void module_enable_data_nx(const struct module *mod);
void module_enable_rox(const struct module *mod); void module_enable_text_rox(const struct module *mod);
int module_enforce_rwx_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs, int module_enforce_rwx_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
char *secstrings, struct module *mod); char *secstrings, struct module *mod);
......
...@@ -2571,7 +2571,7 @@ static noinline int do_init_module(struct module *mod) ...@@ -2571,7 +2571,7 @@ static noinline int do_init_module(struct module *mod)
/* Switch to core kallsyms now init is done: kallsyms may be walking! */ /* Switch to core kallsyms now init is done: kallsyms may be walking! */
rcu_assign_pointer(mod->kallsyms, &mod->core_kallsyms); rcu_assign_pointer(mod->kallsyms, &mod->core_kallsyms);
#endif #endif
module_enable_ro(mod, true); module_enable_rodata_ro(mod, true);
mod_tree_remove_init(mod); mod_tree_remove_init(mod);
module_arch_freeing_init(mod); module_arch_freeing_init(mod);
for_class_mod_mem_type(type, init) { for_class_mod_mem_type(type, init) {
...@@ -2736,9 +2736,9 @@ static int complete_formation(struct module *mod, struct load_info *info) ...@@ -2736,9 +2736,9 @@ static int complete_formation(struct module *mod, struct load_info *info)
module_bug_finalize(info->hdr, info->sechdrs, mod); module_bug_finalize(info->hdr, info->sechdrs, mod);
module_cfi_finalize(info->hdr, info->sechdrs, mod); module_cfi_finalize(info->hdr, info->sechdrs, mod);
module_enable_ro(mod, false); module_enable_rodata_ro(mod, false);
module_enable_nx(mod); module_enable_data_nx(mod);
module_enable_rox(mod); module_enable_text_rox(mod);
/* /*
* Mark state as coming so strong_try_module_get() ignores us, * Mark state as coming so strong_try_module_get() ignores us,
......
...@@ -26,7 +26,7 @@ static void module_set_memory(const struct module *mod, enum mod_mem_type type, ...@@ -26,7 +26,7 @@ static void module_set_memory(const struct module *mod, enum mod_mem_type type,
* CONFIG_STRICT_MODULE_RWX because they are needed regardless of whether we * CONFIG_STRICT_MODULE_RWX because they are needed regardless of whether we
* are strict. * are strict.
*/ */
void module_enable_rox(const struct module *mod) void module_enable_text_rox(const struct module *mod)
{ {
for_class_mod_mem_type(type, text) { for_class_mod_mem_type(type, text) {
if (IS_ENABLED(CONFIG_STRICT_MODULE_RWX)) if (IS_ENABLED(CONFIG_STRICT_MODULE_RWX))
...@@ -36,7 +36,7 @@ void module_enable_rox(const struct module *mod) ...@@ -36,7 +36,7 @@ void module_enable_rox(const struct module *mod)
} }
} }
void module_enable_ro(const struct module *mod, bool after_init) void module_enable_rodata_ro(const struct module *mod, bool after_init)
{ {
if (!IS_ENABLED(CONFIG_STRICT_MODULE_RWX)) if (!IS_ENABLED(CONFIG_STRICT_MODULE_RWX))
return; return;
...@@ -52,7 +52,7 @@ void module_enable_ro(const struct module *mod, bool after_init) ...@@ -52,7 +52,7 @@ void module_enable_ro(const struct module *mod, bool after_init)
module_set_memory(mod, MOD_RO_AFTER_INIT, set_memory_ro); module_set_memory(mod, MOD_RO_AFTER_INIT, set_memory_ro);
} }
void module_enable_nx(const struct module *mod) void module_enable_data_nx(const struct module *mod)
{ {
if (!IS_ENABLED(CONFIG_STRICT_MODULE_RWX)) if (!IS_ENABLED(CONFIG_STRICT_MODULE_RWX))
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment