module: clean up RO/NX handling.
authorRusty Russell <rusty@rustcorp.com.au>
Wed, 25 Nov 2015 23:15:08 +0000 (09:45 +1030)
committerJiri Kosina <jkosina@suse.cz>
Fri, 4 Dec 2015 21:46:26 +0000 (22:46 +0100)
commit85c898db6327353d38f3dd428457384cf81f83f8
tree9a353d57bbf1702d75d2854305d10e4bc9b9fc22
parent7523e4dc5057e157212b4741abd6256e03404cf1
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>
include/linux/module.h
kernel/module.c