From: tip-bot for Adrian Hunter <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, adrian.hunter@intel.com, jolsa@redhat.com,
tglx@linutronix.de, hpa@zytor.com, mingo@kernel.org,
linux-kernel@vger.kernel.org
Subject: [tip:perf/core] perf script: Fix segfault using --show-mmap-events
Date: Fri, 21 Aug 2015 23:51:38 -0700 [thread overview]
Message-ID: <tip-05169df5561363ff04ac04d6aad0be3b45c26ac1@git.kernel.org> (raw)
In-Reply-To: <1440059205-1765-1-git-send-email-adrian.hunter@intel.com>
Commit-ID: 05169df5561363ff04ac04d6aad0be3b45c26ac1
Gitweb: http://git.kernel.org/tip/05169df5561363ff04ac04d6aad0be3b45c26ac1
Author: Adrian Hunter <adrian.hunter@intel.com>
AuthorDate: Thu, 20 Aug 2015 11:26:45 +0300
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 21 Aug 2015 10:29:22 -0300
perf script: Fix segfault using --show-mmap-events
Patch "perf script: Don't assume evsel position of tracking events"
changed 'perf script' to use 'perf_evlist__id2evsel()'. That results
in a segfault if there is more than 1 event and there are
synthesized mmap events e.g.
$ perf record -e cycles,instructions -p$$ sleep 1
$ perf script --show-mmap-events
Segmentation fault (core dumped)
That happens because these synthesized events have an 'id' of zero
which does not match any 'evsel'.
Currently, these synthesized events use the sample type of the first
evsel.
Change 'perf_evlist__id2evsel()' to reflect that which also makes
it consistent with 'perf_evlist__event2evsel()'.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Fixes: 06b234ec26fd ("perf script: Don't assume evsel position of tracking events")
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/1440059205-1765-1-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/evlist.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 373f65b..e9a5d43 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -573,7 +573,7 @@ struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id)
{
struct perf_sample_id *sid;
- if (evlist->nr_entries == 1)
+ if (evlist->nr_entries == 1 || !id)
return perf_evlist__first(evlist);
sid = perf_evlist__id2sid(evlist, id);
prev parent reply other threads:[~2015-08-22 6:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-20 8:26 [PATCH] " Adrian Hunter
2015-08-20 19:24 ` Arnaldo Carvalho de Melo
2015-08-22 6:51 ` tip-bot for Adrian Hunter [this message]
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=tip-05169df5561363ff04ac04d6aad0be3b45c26ac1@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=hpa@zytor.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
/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
Powered by JetHome