Re: [PATCH] perf record: Fix tool crash with xyarray
From: Arnaldo Carvalho de Melo
Date: Wed Oct 18 2017 - 08:08:07 EST
Em Wed, Oct 18, 2017 at 05:20:46PM +0530, Ravi Bangoria escreveu:
> I see 'perf record -p <pid>' crashes with following log:
I just applied the same patch, coming from Jin Yao, thanks! I'll add a
reported-by you there,
- Arnaldo
> *** Error in `./perf': free(): invalid next size (normal): 0x000000000298b340 ***
> ======= Backtrace: =========
> /lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7f7fd85c87e5]
> /lib/x86_64-linux-gnu/libc.so.6(+0x8037a)[0x7f7fd85d137a]
> /lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f7fd85d553c]
> ./perf(perf_evsel__close+0xb4)[0x4b7614]
> ./perf(perf_evlist__delete+0x100)[0x4ab180]
> ./perf(cmd_record+0x1d9)[0x43a5a9]
> ./perf[0x49aa2f]
> ./perf(main+0x631)[0x427841]
> /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7f7fd8571830]
> ./perf(_start+0x29)[0x427a59]
>
> This is because functions xyarray__max_x() and xyarray__max_y()
> are returning incorrect values, causing crash while accessing
> xyarray.
>
> Fixes: d74be4767367 ("perf xyarray: Save max_x, max_y")
> Signed-off-by: Ravi Bangoria <ravi.bangoria@xxxxxxxxxxxxxxxxxx>
> ---
> tools/perf/util/xyarray.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/xyarray.h b/tools/perf/util/xyarray.h
> index 4ba726c..d6858ed 100644
> --- a/tools/perf/util/xyarray.h
> +++ b/tools/perf/util/xyarray.h
> @@ -21,12 +21,12 @@ static inline void *xyarray__entry(struct xyarray *xy, int x, int y)
> return &xy->contents[x * xy->row_size + y * xy->entry_size];
> }
>
> -static inline int xyarray__max_y(struct xyarray *xy)
> +static inline int xyarray__max_x(struct xyarray *xy)
> {
> return xy->max_x;
> }
>
> -static inline int xyarray__max_x(struct xyarray *xy)
> +static inline int xyarray__max_y(struct xyarray *xy)
> {
> return xy->max_y;
> }
> --
> 2.7.4