[PATCH] Fix module module_init/init_size offsets for v4.5 kernel

Pratyush Anand panand at redhat.com
Thu Oct 27 23:18:10 PDT 2016



On Friday 28 October 2016 10:37 AM, Kamalesh Babulal wrote:
> Kernel commit 7523e4dc50 (module: use a structure to encapsulate layout.)
> encapsulates core_layout and init_layout into module_layout structure.
>
> commit fa6a75a93 (Fix module core base and size offset for kernel v4.5)
> fixes offset value calculation for core layout's base and size, whereas
> Kernel v4.5 module changes also needs fixing of module init_size and
> module_init for the makedumpfile to read the correct module address.
>
> This patch fixes calculation of offsets values for module init_size and
> module_init.
>
> Signed-off-by: Kamalesh Babulal <kamalesh at linux.vnet.ibm.com>
> Cc: Pratyush Anand <panand at redhat.com>

Reviewed-by: Pratyush Anand <panand at redhat.com>

> ---
>  makedumpfile.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
>
> diff --git a/makedumpfile.c b/makedumpfile.c
> index 853b999..f33a90d 100644
> --- a/makedumpfile.c
> +++ b/makedumpfile.c
> @@ -1689,7 +1689,25 @@ get_structure_info(void)
>  		OFFSET(module.core_size) += core_layout;
>  	}
>  	OFFSET_INIT(module.module_init, "module", "module_init");
> +	if (OFFSET(module.module_init) == NOT_FOUND_STRUCTURE) {
> +		/* for kernel version 4.5 and above */
> +		long init_layout;
> +
> +		OFFSET_INIT(module.module_init, "module", "init_layout");
> +		init_layout = OFFSET(module.module_init);
> +		OFFSET_INIT(module.module_init, "module_layout", "base");
> +		OFFSET(module.module_init) += init_layout;
> +	}
>  	OFFSET_INIT(module.init_size, "module", "init_size");
> +	if (OFFSET(module.init_size) == NOT_FOUND_STRUCTURE) {
> +		/* for kernel version 4.5 and above */
> +		long init_layout;
> +
> +		OFFSET_INIT(module.init_size, "module", "init_layout");
> +		init_layout = OFFSET(module.init_size);
> +		OFFSET_INIT(module.init_size, "module_layout", "size");
> +		OFFSET(module.init_size) += init_layout;
> +	}
>
>  	ENUM_NUMBER_INIT(NR_FREE_PAGES, "NR_FREE_PAGES");
>  	ENUM_NUMBER_INIT(N_ONLINE, "N_ONLINE");
>



More information about the kexec mailing list