module: expose load_info to arch module loader code
PATCH 1/1 module: expose load_info to arch module loader code
The x86 module loader wants to check the value of a modinfo flag (sld_safe), before proceeding to scan the module text for VMX instructions. Unfortunately the arch module code currently does not have access to load_info, but we can easily expose that via moduleloader.h, which every arch module code must already include.
---
Does this help? You may also need to implement a new arch-specific hook in check_modinfo() to check for sld_safe, and I guess we might need to expose get_modinfo() too. I realize that the detect-VMX-modules patchset
[1] is still very much in-flight, so if you do end up needing this, feel free to just add this patch to the patchset.
[1] http://lore.kernel.org/r/[email protected]
include/linux/moduleloader.h | 20 ++++++++++++++++++++ kernel/module-internal.h | 23 ----------------------- kernel/module_signing.c | 2 +- 3 files changed, 21 insertions(+), 24 deletions(-)
include/linux/moduleloader.h +20 -0
@@ -6,6 +6,26 @@#include <linux/module.h> #include <linux/elf.h> +struct load_info { +const char *name; +/* pointer to module in temporary copy, freed at end of load_module() */ +struct module *mod; +Elf_Ehdr *hdr; +unsigned long len; +Elf_Shdr *sechdrs; +char *secstrings, *strtab; +unsigned long symoffs, stroffs, init_typeoffs, core_typeoffs; +struct _ddebug *debug; +unsigned int num_debug; +bool sig_ok; +#ifdef CONFIG_KALLSYMS +unsigned long mod_kallsyms_init_off; +#endif +struct { +unsigned int sym, str, mod, vers, info, pcpu; + } index; +}; +/* These may be implemented by architectures that need to hook into the * module loader code. Architectures that don't need to do anything special * can just rely on the 'weak' default hooks defined in kernel/module.c.
kernel/module-internal.h +0 -23
@@ -5,27 +5,4 @@* Written by David Howells ([email protected]) */ -#include <linux/elf.h> -#include <asm/module.h> - -struct load_info { -const char *name; -/* pointer to module in temporary copy, freed at end of load_module() */ -struct module *mod; -Elf_Ehdr *hdr; -unsigned long len; -Elf_Shdr *sechdrs; -char *secstrings, *strtab; -unsigned long symoffs, stroffs, init_typeoffs, core_typeoffs; -struct _ddebug *debug; -unsigned int num_debug; -bool sig_ok; -#ifdef CONFIG_KALLSYMS -unsigned long mod_kallsyms_init_off; -#endif -struct { -unsigned int sym, str, mod, vers, info, pcpu; - } index; -}; -extern int mod_verify_sig (const void *mod,struct load_info *info);
kernel/module_signing.c +1 -1
@@ -8,11 +8,11 @@#include <linux/kernel.h> #include <linux/errno.h> #include <linux/module.h> +#include <linux/moduleloader.h> #include <linux/module_signature.h> #include <linux/string.h> #include <linux/verification.h> #include <crypto/public_key.h> -#include "module-internal.h" /* * Verify the signature on a module.
Signature · 1 line
2.16.4