@@ -181,22 +181,16 @@ void frob_text(const struct module_layout *layout, int (*set_memory)(unsigned lo
#endif /* CONFIG_ARCH_HAS_STRICT_MODULE_RWX */
#ifdef CONFIG_STRICT_MODULE_RWX
-void frob_rodata(const struct module_layout *layout,
- int (*set_memory)(unsigned long start, int num_pages));
-void frob_ro_after_init(const struct module_layout *layout,
- int (*set_memory)(unsigned long start, int num_pages));
-void frob_writable_data(const struct module_layout *layout,
- int (*set_memory)(unsigned long start, int num_pages));
void module_enable_ro(const struct module *mod, bool after_init);
void module_enable_nx(const struct module *mod);
int module_enforce_rwx_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
char *secstrings, struct module *mod);
#else /* !CONFIG_STRICT_MODULE_RWX */
-static void module_enable_nx(const struct module *mod) { }
-static void module_enable_ro(const struct module *mod, bool after_init) {}
-static int module_enforce_rwx_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
- char *secstrings, struct module *mod)
+static inline void module_enable_nx(const struct module *mod) { }
+static inline void module_enable_ro(const struct module *mod, bool after_init) {}
+static inline int module_enforce_rwx_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
+ char *secstrings, struct module *mod)
{
return 0;
}
@@ -6,12 +6,13 @@
*/
#include <linux/module.h>
+#include <linux/mm.h>
#include <linux/vmalloc.h>
#include <linux/set_memory.h>
#include "internal.h"
-void frob_rodata(const struct module_layout *layout,
- int (*set_memory)(unsigned long start, int num_pages))
+static void frob_rodata(const struct module_layout *layout,
+ int (*set_memory)(unsigned long start, int num_pages))
{
BUG_ON(!PAGE_ALIGNED(layout->base));
BUG_ON(!PAGE_ALIGNED(layout->text_size));
@@ -20,8 +21,8 @@ void frob_rodata(const struct module_layout *layout,
(layout->ro_size - layout->text_size) >> PAGE_SHIFT);
}
-void frob_ro_after_init(const struct module_layout *layout,
- int (*set_memory)(unsigned long start, int num_pages))
+static void frob_ro_after_init(const struct module_layout *layout,
+ int (*set_memory)(unsigned long start, int num_pages))
{
BUG_ON(!PAGE_ALIGNED(layout->base));
BUG_ON(!PAGE_ALIGNED(layout->ro_size));
@@ -30,8 +31,8 @@ void frob_ro_after_init(const struct module_layout *layout,
(layout->ro_after_init_size - layout->ro_size) >> PAGE_SHIFT);
}
-void frob_writable_data(const struct module_layout *layout,
- int (*set_memory)(unsigned long start, int num_pages))
+static void frob_writable_data(const struct module_layout *layout,
+ int (*set_memory)(unsigned long start, int num_pages))
{
BUG_ON(!PAGE_ALIGNED(layout->base));
BUG_ON(!PAGE_ALIGNED(layout->ro_after_init_size));
Fixes: e5973a14d187 ("module: Move strict rwx support to a separate file") Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> --- kernel/module/internal.h | 14 ++++---------- kernel/module/strict_rwx.c | 13 +++++++------ 2 files changed, 11 insertions(+), 16 deletions(-)