aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/module.h
diff options
context:
space:
mode:
authorJessica Yu <jeyu@redhat.com>2016-07-26 22:36:21 -0400
committerRusty Russell <rusty@rustcorp.com.au>2016-08-03 20:46:55 -0400
commit444d13ff10fb13bc3e64859c3cf9ce43dcfeb075 (patch)
treeab35e195fe3daeae0bd87f6f5bd7cc1cf07fd86a /include/linux/module.h
parentbdc9f373551dd3f1e6fae1618f2394ee9bc7db2e (diff)
modules: add ro_after_init support
Add ro_after_init support for modules by adding a new page-aligned section in the module layout (after rodata) for ro_after_init data and enabling RO protection for that section after module init runs. Signed-off-by: Jessica Yu <jeyu@redhat.com> Acked-by: Kees Cook <keescook@chromium.org> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'include/linux/module.h')
-rw-r--r--include/linux/module.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/linux/module.h b/include/linux/module.h
index f95ed243a4de..0c3207d26ac0 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -298,6 +298,8 @@ struct module_layout {
298 unsigned int text_size; 298 unsigned int text_size;
299 /* Size of RO section of the module (text+rodata) */ 299 /* Size of RO section of the module (text+rodata) */
300 unsigned int ro_size; 300 unsigned int ro_size;
301 /* Size of RO after init section */
302 unsigned int ro_after_init_size;
301 303
302#ifdef CONFIG_MODULES_TREE_LOOKUP 304#ifdef CONFIG_MODULES_TREE_LOOKUP
303 struct mod_tree_node mtn; 305 struct mod_tree_node mtn;
@@ -765,12 +767,12 @@ extern int module_sysfs_initialized;
765#ifdef CONFIG_DEBUG_SET_MODULE_RONX 767#ifdef CONFIG_DEBUG_SET_MODULE_RONX
766extern void set_all_modules_text_rw(void); 768extern void set_all_modules_text_rw(void);
767extern void set_all_modules_text_ro(void); 769extern void set_all_modules_text_ro(void);
768extern void module_enable_ro(const struct module *mod); 770extern void module_enable_ro(const struct module *mod, bool after_init);
769extern void module_disable_ro(const struct module *mod); 771extern void module_disable_ro(const struct module *mod);
770#else 772#else
771static inline void set_all_modules_text_rw(void) { } 773static inline void set_all_modules_text_rw(void) { }
772static inline void set_all_modules_text_ro(void) { } 774static inline void set_all_modules_text_ro(void) { }
773static inline void module_enable_ro(const struct module *mod) { } 775static inline void module_enable_ro(const struct module *mod, bool after_init) { }
774static inline void module_disable_ro(const struct module *mod) { } 776static inline void module_disable_ro(const struct module *mod) { }
775#endif 777#endif
776 778