void module_enable_ro(const struct module *mod, bool after_init);
void module_enable_nx(const struct module *mod);
-void module_enable_x(const struct module *mod);
+void module_enable_rox(const struct module *mod);
int module_enforce_rwx_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
char *secstrings, struct module *mod);
module_enable_ro(mod, false);
module_enable_nx(mod);
- module_enable_x(mod);
+ module_enable_rox(mod);
/*
* Mark state as coming so strong_try_module_get() ignores us,
* CONFIG_STRICT_MODULE_RWX because they are needed regardless of whether we
* are strict.
*/
-void module_enable_x(const struct module *mod)
+void module_enable_rox(const struct module *mod)
{
- for_class_mod_mem_type(type, text)
- module_set_memory(mod, type, set_memory_x);
+ for_class_mod_mem_type(type, text) {
+ if (IS_ENABLED(CONFIG_STRICT_MODULE_RWX))
+ module_set_memory(mod, type, set_memory_rox);
+ else
+ module_set_memory(mod, type, set_memory_x);
+ }
}
void module_enable_ro(const struct module *mod, bool after_init)
return;
#endif
- module_set_memory(mod, MOD_TEXT, set_memory_ro);
- module_set_memory(mod, MOD_INIT_TEXT, set_memory_ro);
module_set_memory(mod, MOD_RODATA, set_memory_ro);
module_set_memory(mod, MOD_INIT_RODATA, set_memory_ro);