module: Use the same logic for setting and unsetting RO/NX
authorJosh Poimboeuf <jpoimboe@redhat.com>
Wed, 25 Nov 2015 23:12:08 +0000 (09:42 +1030)
committerJiri Kosina <jkosina@suse.cz>
Fri, 4 Dec 2015 21:46:24 +0000 (22:46 +0100)
commit20ef10c1b3068f105004e247d8e7dd8120fa4b9a
tree08c6a0745a46101837dcd34425e9c5716a294b11
parent78c4a49a69e910a162b05e4e8727b9bdbf948f13
module: Use the same logic for setting and unsetting RO/NX

When setting a module's RO and NX permissions, set_section_ro_nx() is
used, but when clearing them, unset_module_{init,core}_ro_nx() are used.
The unset functions don't have the same checks the set function has for
partial page protections.  It's probably harmless, but it's still
confusingly asymmetrical.

Instead, use the same logic to do both.  Also add some new
set_module_{init,core}_ro_nx() helper functions for more symmetry with
the unset functions.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
kernel/module.c