lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 20 Jun 2018 10:49:05 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Ravi Bangoria <ravi.bangoria@...ux.ibm.com>
Cc:     jolsa@...hat.com, alexander.shishkin@...ux.intel.com,
        namhyung@...nel.org, dsahern@...il.com, davidcc@...gle.com,
        ak@...ux.intel.com, yao.jin@...ux.intel.com,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] perf script: Fix crash because of missing feat_op[]
 entry

Em Wed, Jun 20, 2018 at 07:00:30PM +0530, Ravi Bangoria escreveu:
> perf_event__process_feature() tries to access feat_ops[feat].process
> which is not defined for feat = HEADER_LAST_FEATURE and thus perf is
> crashing. Add dummy entry for HEADER_LAST_FEATURE in the feat_ops.

Humm, first impression is that we should check for HEADER_LAST_FEATURE
and not try to access that array slot, as it is just a marker, not an
actual feature.

- Arnaldo
 
> Before:
>   # ./perf record -o - ls | ./perf script
>   Segmentation fault (core dumped)
> 
> After:
>   # ./perf record -o - ls | ./perf script
>   ls 7031 4392.099856:  250000 cpu-clock:uhH:  7f5e0ce7cd60
>   ls 7031 4392.100355:  250000 cpu-clock:uhH:  7f5e0c706ef7
> 
> Signed-off-by: Ravi Bangoria <ravi.bangoria@...ux.ibm.com>
> Fixes: 57b5de463925 ("perf report: Support forced leader feature in pipe mode")
> ---
>  tools/perf/util/header.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
> index 540cd2dcd3e7..de8e3e29d870 100644
> --- a/tools/perf/util/header.c
> +++ b/tools/perf/util/header.c
> @@ -2555,14 +2555,18 @@ struct feature_ops {
>  	}
>  
>  /* feature_ops not implemented: */
> +#define write_last_feature	NULL
> +
>  #define print_tracing_data	NULL
>  #define print_build_id		NULL
> +#define print_last_feature	NULL
>  
>  #define process_branch_stack	NULL
>  #define process_stat		NULL
> +#define process_last_feature	NULL
>  
>  
> -static const struct feature_ops feat_ops[HEADER_LAST_FEATURE] = {
> +static const struct feature_ops feat_ops[HEADER_LAST_FEATURE + 1] = {
>  	FEAT_OPN(TRACING_DATA,	tracing_data,	false),
>  	FEAT_OPN(BUILD_ID,	build_id,	false),
>  	FEAT_OPR(HOSTNAME,	hostname,	false),
> @@ -2585,6 +2589,7 @@ static const struct feature_ops feat_ops[HEADER_LAST_FEATURE] = {
>  	FEAT_OPN(CACHE,		cache,		true),
>  	FEAT_OPR(SAMPLE_TIME,	sample_time,	false),
>  	FEAT_OPR(MEM_TOPOLOGY,	mem_topology,	true),
> +	FEAT_OPN(LAST_FEATURE,	last_feature,	false),
>  };
>  
>  struct header_print_data {
> -- 
> 2.14.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ