Re: [PATCH 3/4] module: use a structure to encapsulate layout.

From: Josh Poimboeuf
Date: Mon Nov 09 2015 - 11:54:46 EST


On Mon, Nov 09, 2015 at 02:53:56PM +1030, Rusty Russell wrote:

> diff --git a/arch/ia64/kernel/module.c b/arch/ia64/kernel/module.c
> index b15933c31b2f..26e23a2a29e9 100644
> --- a/arch/ia64/kernel/module.c
> +++ b/arch/ia64/kernel/module.c
> @@ -486,13 +486,13 @@ module_frob_arch_sections (Elf_Ehdr *ehdr, Elf_Shdr *sechdrs, char *secstrings,
> static inline int
> in_init (const struct module *mod, uint64_t addr)
> {
> - return addr - (uint64_t) mod->module_init < mod->init_size;
> + return addr - (uint64_t) mod->init_layout.base < mod->init_layout.size;
> }
>
> static inline int
> in_core (const struct module *mod, uint64_t addr)
> {
> - return addr - (uint64_t) mod->module_core < mod->core_size;
> + return addr - (uint64_t) mod->corelayout.base < mod->core_layout.size;

s/corelayout/core_layout/

> diff --git a/arch/x86/kernel/livepatch.c b/arch/x86/kernel/livepatch.c
> index d1d35ccffed3..2e4383c49ee2 100644
> --- a/arch/x86/kernel/livepatch.c
> +++ b/arch/x86/kernel/livepatch.c
> @@ -41,8 +41,8 @@ int klp_write_module_reloc(struct module *mod, unsigned long type,
> int ret, numpages, size = 4;
> bool readonly;
> unsigned long val;
> - unsigned long core = (unsigned long)mod->module_core;
> - unsigned long core_size = mod->core_size;
> + unsigned long core = (unsigned long)mod->core_layout.base;
> + unsigned long core_size = mod->core_layout.size;
>
> switch (type) {
> case R_X86_64_NONE:
> @@ -65,7 +65,7 @@ int klp_write_module_reloc(struct module *mod, unsigned long type,
> return -EINVAL;
> }
>
> - if (loc < core || loc >= core + core_size)
> + if (loc < core || loc >= core + core_layout.size)

No need to change this line (and in fact it fails the build).


I'm also seeing another build failure in linux-next, thanks to a patch
we just merged on Friday:

/home/jpoimboe/git/linux/arch/x86/kernel/livepatch.c: In function âklp_write_module_relocâ:
/home/jpoimboe/git/linux/arch/x86/kernel/livepatch.c:75:22: error: âstruct moduleâ has no member named âcore_ro_sizeâ
if (loc < core + mod->core_ro_size)
^

Assuming the above build failures are fixed,

Reviewed-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>


--
Josh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/