Skip to content

Commit 3559ad3

Browse files
chleroymcgrof
authored andcommitted
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: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
1 parent ac88ee7 commit 3559ad3

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

kernel/module/internal.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,9 +322,9 @@ static inline struct module *mod_find(unsigned long addr, struct mod_tree_root *
322322
}
323323
#endif /* CONFIG_MODULES_TREE_LOOKUP */
324324

325-
void module_enable_ro(const struct module *mod, bool after_init);
326-
void module_enable_nx(const struct module *mod);
327-
void module_enable_rox(const struct module *mod);
325+
void module_enable_rodata_ro(const struct module *mod, bool after_init);
326+
void module_enable_data_nx(const struct module *mod);
327+
void module_enable_text_rox(const struct module *mod);
328328
int module_enforce_rwx_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
329329
char *secstrings, struct module *mod);
330330

kernel/module/main.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2571,7 +2571,7 @@ static noinline int do_init_module(struct module *mod)
25712571
/* Switch to core kallsyms now init is done: kallsyms may be walking! */
25722572
rcu_assign_pointer(mod->kallsyms, &mod->core_kallsyms);
25732573
#endif
2574-
module_enable_ro(mod, true);
2574+
module_enable_rodata_ro(mod, true);
25752575
mod_tree_remove_init(mod);
25762576
module_arch_freeing_init(mod);
25772577
for_class_mod_mem_type(type, init) {
@@ -2736,9 +2736,9 @@ static int complete_formation(struct module *mod, struct load_info *info)
27362736
module_bug_finalize(info->hdr, info->sechdrs, mod);
27372737
module_cfi_finalize(info->hdr, info->sechdrs, mod);
27382738

2739-
module_enable_ro(mod, false);
2740-
module_enable_nx(mod);
2741-
module_enable_rox(mod);
2739+
module_enable_rodata_ro(mod, false);
2740+
module_enable_data_nx(mod);
2741+
module_enable_text_rox(mod);
27422742

27432743
/*
27442744
* Mark state as coming so strong_try_module_get() ignores us,

kernel/module/strict_rwx.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ static void module_set_memory(const struct module *mod, enum mod_mem_type type,
2626
* CONFIG_STRICT_MODULE_RWX because they are needed regardless of whether we
2727
* are strict.
2828
*/
29-
void module_enable_rox(const struct module *mod)
29+
void module_enable_text_rox(const struct module *mod)
3030
{
3131
for_class_mod_mem_type(type, text) {
3232
if (IS_ENABLED(CONFIG_STRICT_MODULE_RWX))
@@ -36,7 +36,7 @@ void module_enable_rox(const struct module *mod)
3636
}
3737
}
3838

39-
void module_enable_ro(const struct module *mod, bool after_init)
39+
void module_enable_rodata_ro(const struct module *mod, bool after_init)
4040
{
4141
if (!IS_ENABLED(CONFIG_STRICT_MODULE_RWX))
4242
return;
@@ -52,7 +52,7 @@ void module_enable_ro(const struct module *mod, bool after_init)
5252
module_set_memory(mod, MOD_RO_AFTER_INIT, set_memory_ro);
5353
}
5454

55-
void module_enable_nx(const struct module *mod)
55+
void module_enable_data_nx(const struct module *mod)
5656
{
5757
if (!IS_ENABLED(CONFIG_STRICT_MODULE_RWX))
5858
return;

0 commit comments

Comments
 (0)