[Crash-utility] [PATCH] Fix the extension trace.so for RHEL7.6

Dave Anderson anderson at redhat.com
Mon Aug 20 14:44:36 UTC 2018



----- Original Message -----
> Fix the extension trace.so for RHEL7.6 ,which moved
> ftrace_event_call.data into an anonymous union,and the
> previous offset has changed, so the trace.so extension
> module fails to load ,indicating "no commands registered:
> shared object unloaded".

Thanks Xu -- queued for crash-7.2.4:

  https://github.com/crash-utility/crash/commit/f6d451d64fc91c8f0010d5b1fe96330e37845d31
  
Dave


> ---
>  extensions/trace.c | 20 ++++++++++++++++++--
>  1 file changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/extensions/trace.c b/extensions/trace.c
> index 7d76699..ad71951 100644
> --- a/extensions/trace.c
> +++ b/extensions/trace.c
> @@ -853,8 +853,18 @@ static int syscall_get_enter_fields(ulong call, ulong
> *fields)
>  	inited = 1;
>  	data_offset = MAX(MEMBER_OFFSET("ftrace_event_call", "data"),
>  		MEMBER_OFFSET("trace_event_call", "data"));
> -	if (data_offset < 0)
> -		return -1;
> +	if (data_offset < 0) {
> +		/*
> +		 *  rhel-7.6 moved the .data member into an anonymous union.
> +		 */
> +		if (MEMBER_EXISTS("ftrace_event_call", "rh_data") &&
> +		    MEMBER_EXISTS("ftrace_event_data", "data")) {
> +			data_offset = MEMBER_OFFSET("ftrace_event_call", "rh_data") +
> +				MEMBER_OFFSET("ftrace_event_data", "data");
> +			inited = 2;
> +		} else
> +			return -1;
> +	}
>  
>  	enter_fields_offset = MEMBER_OFFSET("syscall_metadata", "enter_fields");
>  	if (enter_fields_offset < 0)
> @@ -868,6 +878,12 @@ work:
>  			"read ftrace_event_call data", RETURN_ON_ERROR))
>  		return -1;
>  
> +	if (inited == 2) {
> +		if (!readmem(metadata, KVADDR, &metadata, sizeof(metadata),
> +		    "read ftrace_event_call data (indirect rh_data)", RETURN_ON_ERROR))
> +			return -1;
> +	}
> +
>  	*fields = metadata + enter_fields_offset;
>  	return 0;
>  }
> --
> 2.17.1
> 
> 
> 
> --
> Crash-utility mailing list
> Crash-utility at redhat.com
> https://www.redhat.com/mailman/listinfo/crash-utility
> 




More information about the Crash-utility mailing list