Fixes: e5973a14d187 ("module: Move strict rwx support to a separate file") Signed-off-by: Christophe Leroy <christophe.leroy@xxxxxxxxxx> --- kernel/module/internal.h | 14 ++++---------- kernel/module/strict_rwx.c | 13 +++++++------ 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/kernel/module/internal.h b/kernel/module/internal.h index 97d9faec3a9a..6a54a1e06f4f 100644 --- a/kernel/module/internal.h +++ b/kernel/module/internal.h @@ -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; } diff --git a/kernel/module/strict_rwx.c b/kernel/module/strict_rwx.c index c642889f8e77..bfee740f4bc1 100644 --- a/kernel/module/strict_rwx.c +++ b/kernel/module/strict_rwx.c @@ -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)); -- 2.34.1