mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
To: acme@kernel.org, ak@linux.intel.com
Cc: alexander.shishkin@linux.intel.com, peterz@infradead.org,
	mingo@redhat.com, jolsa@kernel.org, linux-kernel@vger.kernel.org,
	Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Subject: [PATCH] perf record: Fix tool crash with xyarray
Date: Wed, 18 Oct 2017 17:20:46 +0530	[thread overview]
Message-ID: <1508327446-15302-1-git-send-email-ravi.bangoria@linux.vnet.ibm.com> (raw)

I see 'perf record -p <pid>' crashes with following log:

   *** 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@linux.vnet.ibm.com>
---
 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

         reply	other threads:[~2017-10-18 11:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-18 15:11 [PATCH] perf util: Fix wrong processing when closing evsel fd Jin Yao
2017-10-18  8:12 ` Jiri Olsa
2017-10-18 12:07   ` Arnaldo Carvalho de Melo
2017-10-18 11:50 ` Ravi Bangoria [this message]
2017-10-18 12:07   ` [PATCH] perf record: Fix tool crash with xyarray Arnaldo Carvalho de Melo
2017-10-20  7:21   ` [tip:perf/urgent] perf xyarray: Fix wrong processing when closing evsel fd tip-bot for Jin Yao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1508327446-15302-1-git-send-email-ravi.bangoria@linux.vnet.ibm.com \
    --to=ravi.bangoria@linux.vnet.ibm.com \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®