linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, Chris Phlipot <cphlipot0@gmail.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 02/19] perf tools: Fix perf script python database export crash
Date: Thu, 10 Mar 2016 18:04:23 -0300	[thread overview]
Message-ID: <1457643880-4908-3-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1457643880-4908-1-git-send-email-acme@kernel.org>

From: Chris Phlipot <cphlipot0@gmail.com>

Remove the union in evsel so that the database id and priv pointer can
be used simultainously without conflicting and crashing.

Detailed Description for the fixed bug follows:

perf script crashes with a segmentation fault on user space tool version
4.5.rc7.ge2857b when using the python database export API. It works
properly in 4.4 and prior versions.

the crash fist appeared in:

cfc8874a4859 ("perf script: Process cpu/threads maps")

How to reproduce the bug:

Remove any temporary files left over from a previous crash (if you have
already attemped to reproduce the bug):

  $ rm -r test_db-perf-data
  $ dropdb test_db

  $ perf record timeout 1 yes >/dev/null
  $ perf script -s scripts/python/export-to-postgresql.py test_db

  Stack Trace:
  Program received signal SIGSEGV, Segmentation fault.
  __GI___libc_free (mem=0x1) at malloc.c:2929
  2929	malloc.c: No such file or directory.
  (gdb) bt
    at util/stat.c:122
    argv=<optimized out>, prefix=<optimized out>) at builtin-script.c:2231
    argc=argc@entry=4, argv=argv@entry=0x7fffffffdf70) at perf.c:390
    at perf.c:451

Signed-off-by: Chris Phlipot <cphlipot0@gmail.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Fixes: cfc8874a4859 ("perf script: Process cpu/threads maps")
Link: http://lkml.kernel.org/r/1457500314-8912-1-git-send-email-cphlipot0@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/evsel.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index efad78f811ad..501ea6e565f1 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -93,10 +93,8 @@ struct perf_evsel {
 	const char		*unit;
 	struct event_format	*tp_format;
 	off_t			id_offset;
-	union {
-		void		*priv;
-		u64		db_id;
-	};
+	void			*priv;
+	u64			db_id;
 	struct cgroup_sel	*cgrp;
 	void			*handler;
 	struct cpu_map		*cpus;
-- 
2.5.0

  parent reply	other threads:[~2016-03-10 21:04 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-10 21:04 [GIT PULL 00/19] perf/core improvements and fixes Arnaldo Carvalho de Melo
2016-03-10 21:04 ` [PATCH 01/19] perf jitdump: DWARF is also needed Arnaldo Carvalho de Melo
2016-03-10 21:04 ` Arnaldo Carvalho de Melo [this message]
2016-03-10 21:04 ` [PATCH 03/19] perf tools: Pass perf_hpp_list all the way through setup_sort_list Arnaldo Carvalho de Melo
2016-03-10 21:04 ` [PATCH 04/19] perf tools: Omit unnecessary cast in perf_pmu__parse_scale Arnaldo Carvalho de Melo
2016-03-10 21:04 ` [PATCH 05/19] tools lib traceevent: Add '~' operation within arg_num_eval() Arnaldo Carvalho de Melo
2016-03-10 21:04 ` [PATCH 06/19] perf jitdump: Build only on supported archs Arnaldo Carvalho de Melo
2016-03-10 21:04 ` [PATCH 07/19] perf tools: Fix hist_entry__filter() for hierarchy Arnaldo Carvalho de Melo
2016-03-10 21:04 ` [PATCH 08/19] perf tools: Add more sort entry check functions Arnaldo Carvalho de Melo
2016-03-10 21:04 ` [PATCH 09/19] perf tools: Fix command line filters in hierarchy mode Arnaldo Carvalho de Melo
2016-03-10 21:04 ` [PATCH 10/19] perf tools: Remove hist_entry->fmt field Arnaldo Carvalho de Melo
2016-03-10 21:04 ` [PATCH 11/19] perf hists browser: Cleanup hist_browser__fprintf_hierarchy_entry() Arnaldo Carvalho de Melo
2016-03-10 21:04 ` [PATCH 12/19] perf tools: Remove nr_sort_keys field Arnaldo Carvalho de Melo
2016-03-10 21:04 ` [PATCH 13/19] perf tools: Recalc total periods using top-level entries in hierarchy Arnaldo Carvalho de Melo
2016-03-10 21:04 ` [PATCH 14/19] perf tools: Add sort__has_comm variable Arnaldo Carvalho de Melo
2016-03-10 21:04 ` [PATCH 15/19] perf hists browser: Allow thread filtering for comm sort key Arnaldo Carvalho de Melo
2016-03-10 21:04 ` [PATCH 16/19] perf hists browser: Check sort keys before hot key actions Arnaldo Carvalho de Melo
2016-03-10 21:04 ` [PATCH 17/19] perf stat: Document CSV format in manpage Arnaldo Carvalho de Melo
2016-03-10 21:04 ` [PATCH 18/19] perf stat: Implement --metric-only mode Arnaldo Carvalho de Melo
2016-03-10 21:04 ` [PATCH 19/19] perf stat: Add --metric-only support for -A Arnaldo Carvalho de Melo
2016-03-11  8:43 ` [GIT PULL 00/19] perf/core improvements and fixes Ingo Molnar

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=1457643880-4908-3-git-send-email-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=cphlipot0@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).