[Crash-utility] crash: invalid structure member offset with current kernels

Dave Anderson anderson at redhat.com
Wed Jan 20 15:01:17 UTC 2016



----- Original Message -----
> Hi,
> 
> Crash fails to start with current (4.4+) kernels. The following patch
> fixes this.
> 
> Regards,
> Sebastian

Sebastian,

Appreciate the heads-up -- queued for crash-7.1.5:

  https://github.com/crash-utility/crash/commit/6f1f78e33474d00d5f261d7ed9d835c558b34d61

Thanks,
  Dave


> ----->8
> 
> From ddd809812705ba36796c6750d12a12838b4106ec Mon Sep 17 00:00:00 2001
> From: Sebastian Ott <sebott at linux.vnet.ibm.com>
> Date: Tue, 19 Jan 2016 14:14:13 +0100
> Subject: [PATCH] Fix invalid structure member offset.
> 
> Struct module was changed by kernel commit
> 7523e4dc50 "module: use a structure to encapsulate layout."
> 
> Fix the offsets to handle the following crash error:
> 
> crash: invalid structure member offset: module_init_text_size
>        FILE: symbols.c  LINE: 1668  FUNCTION: store_module_symbols_v2()
> 
> [../crash/crash] error trace: 10062e92 => 10109812 => 1014f16e => 101813ac
> 
>   101813ac: OFFSET_verify+124
>   1014f16e: store_module_symbols_v2+2182
>   10109812: module_init+4386
>   10062e92: main_loop+410
> 
> Signed-off-by: Sebastian Ott <sebott at linux.vnet.ibm.com>
> ---
>  kernel.c | 49 +++++++++++++++++++++++++++++++++++++++----------
>  1 file changed, 39 insertions(+), 10 deletions(-)
> 
> diff --git a/kernel.c b/kernel.c
> index 2d4188a..5ce2fb9 100644
> --- a/kernel.c
> +++ b/kernel.c
> @@ -3291,16 +3291,45 @@ module_init(void)
>          	MEMBER_OFFSET_INIT(module_gpl_syms, "module", "gpl_syms");
>          	MEMBER_OFFSET_INIT(module_num_gpl_syms, "module",
>  			"num_gpl_syms");
> -        	MEMBER_OFFSET_INIT(module_module_core, "module",
> -			"module_core");
> -        	MEMBER_OFFSET_INIT(module_core_size, "module",
> -			"core_size");
> -        	MEMBER_OFFSET_INIT(module_core_text_size, "module",
> -			"core_text_size");
> -		MEMBER_OFFSET_INIT(module_module_init, "module", "module_init");
> -		MEMBER_OFFSET_INIT(module_init_size, "module", "init_size");
> -		MEMBER_OFFSET_INIT(module_init_text_size, "module",
> -			"init_text_size");
> +
> +		if (MEMBER_EXISTS("module", "module_core")) {
> +			MEMBER_OFFSET_INIT(module_core_size, "module",
> +					   "core_size");
> +			MEMBER_OFFSET_INIT(module_init_size, "module",
> +					   "init_size");
> +
> +			MEMBER_OFFSET_INIT(module_core_text_size, "module",
> +					   "core_text_size");
> +			MEMBER_OFFSET_INIT(module_init_text_size, "module",
> +					   "init_text_size");
> +
> +			MEMBER_OFFSET_INIT(module_module_core, "module",
> +					   "module_core");
> +			MEMBER_OFFSET_INIT(module_module_init, "module",
> +					   "module_init");
> +		} else {
> +			ASSIGN_OFFSET(module_core_size) =
> +				MEMBER_OFFSET("module", "core_layout") +
> +				MEMBER_OFFSET("module_layout", "size");
> +			ASSIGN_OFFSET(module_init_size) =
> +				MEMBER_OFFSET("module", "init_layout") +
> +				MEMBER_OFFSET("module_layout", "size");
> +
> +			ASSIGN_OFFSET(module_core_text_size) =
> +				MEMBER_OFFSET("module", "core_layout") +
> +				MEMBER_OFFSET("module_layout", "text_size");
> +			ASSIGN_OFFSET(module_init_text_size) =
> +				MEMBER_OFFSET("module", "init_layout") +
> +				MEMBER_OFFSET("module_layout", "text_size");
> +
> +			ASSIGN_OFFSET(module_module_core) =
> +				MEMBER_OFFSET("module", "core_layout") +
> +				MEMBER_OFFSET("module_layout", "base");
> +			ASSIGN_OFFSET(module_module_init) =
> +				MEMBER_OFFSET("module", "init_layout") +
> +				MEMBER_OFFSET("module_layout", "base");
> +		}
> +
>  		MEMBER_OFFSET_INIT(module_percpu, "module", "percpu");
>  
>  		/*
> --
> 2.3.0
> 
> 




More information about the Crash-utility mailing list