diff options
| author | Rusty Russell <rusty@rustcorp.com.au> | 2015-11-25 18:15:08 -0500 |
|---|---|---|
| committer | Jiri Kosina <jkosina@suse.cz> | 2015-12-04 16:46:26 -0500 |
| commit | 85c898db6327353d38f3dd428457384cf81f83f8 (patch) | |
| tree | 9a353d57bbf1702d75d2854305d10e4bc9b9fc22 /include/linux/module.h | |
| parent | 7523e4dc5057e157212b4741abd6256e03404cf1 (diff) | |
module: clean up RO/NX handling.
Modules have three sections: text, rodata and writable data. The code
handled the case where these overlapped, however they never can:
debug_align() ensures they are always page-aligned.
This is why we got away with manually traversing the pages in
set_all_modules_text_rw() without rounding.
We create three helper functions: frob_text(), frob_rodata() and
frob_writable_data(). We then call these explicitly at every point,
so it's clear what we're doing.
We also expose module_enable_ro() and module_disable_ro() for
livepatch to use.
Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'include/linux/module.h')
| -rw-r--r-- | include/linux/module.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/module.h b/include/linux/module.h index 6e68e8cf4d0d..4560d8f1545d 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
| @@ -762,9 +762,13 @@ extern int module_sysfs_initialized; | |||
| 762 | #ifdef CONFIG_DEBUG_SET_MODULE_RONX | 762 | #ifdef CONFIG_DEBUG_SET_MODULE_RONX |
| 763 | extern void set_all_modules_text_rw(void); | 763 | extern void set_all_modules_text_rw(void); |
| 764 | extern void set_all_modules_text_ro(void); | 764 | extern void set_all_modules_text_ro(void); |
| 765 | extern void module_enable_ro(const struct module *mod); | ||
| 766 | extern void module_disable_ro(const struct module *mod); | ||
| 765 | #else | 767 | #else |
| 766 | static inline void set_all_modules_text_rw(void) { } | 768 | static inline void set_all_modules_text_rw(void) { } |
| 767 | static inline void set_all_modules_text_ro(void) { } | 769 | static inline void set_all_modules_text_ro(void) { } |
| 770 | static inline void module_enable_ro(const struct module *mod) { } | ||
| 771 | static inline void module_disable_ro(const struct module *mod) { } | ||
| 768 | #endif | 772 | #endif |
| 769 | 773 | ||
| 770 | #ifdef CONFIG_GENERIC_BUG | 774 | #ifdef CONFIG_GENERIC_BUG |
