@@ -1972,13 +1972,9 @@ void module_enable_ro(const struct module *mod, bool after_init)
19721972 set_vm_flush_reset_perms (mod -> core_layout .base );
19731973 set_vm_flush_reset_perms (mod -> init_layout .base );
19741974 frob_text (& mod -> core_layout , set_memory_ro );
1975- frob_text (& mod -> core_layout , set_memory_x );
19761975
19771976 frob_rodata (& mod -> core_layout , set_memory_ro );
1978-
19791977 frob_text (& mod -> init_layout , set_memory_ro );
1980- frob_text (& mod -> init_layout , set_memory_x );
1981-
19821978 frob_rodata (& mod -> init_layout , set_memory_ro );
19831979
19841980 if (after_init )
@@ -2041,6 +2037,12 @@ void set_all_modules_text_ro(void)
20412037static void module_enable_nx (const struct module * mod ) { }
20422038#endif
20432039
2040+ static void module_enable_x (const struct module * mod )
2041+ {
2042+ frob_text (& mod -> core_layout , set_memory_x );
2043+ frob_text (& mod -> init_layout , set_memory_x );
2044+ }
2045+
20442046#ifdef CONFIG_LIVEPATCH
20452047/*
20462048 * Persist Elf information about a module. Copy the Elf header,
@@ -3637,6 +3639,7 @@ static int complete_formation(struct module *mod, struct load_info *info)
36373639
36383640 module_enable_ro (mod , false);
36393641 module_enable_nx (mod );
3642+ module_enable_x (mod );
36403643
36413644 /* Mark state as coming so strong_try_module_get() ignores us,
36423645 * but kallsyms etc. can see us. */
0 commit comments