mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	Stephane Eranian <eranian@google.com>,
	David Ahern <dsahern@gmail.com>, Ingo Molnar <mingo@elte.hu>,
	Peter Zijlstra <peterz@infradead.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 2/9] perf tools: Fix bug in raw sample parsing
Date: Fri, 30 Mar 2012 13:09:17 -0300	[thread overview]
Message-ID: <1333123764-15662-3-git-send-email-acme@infradead.org> (raw)
In-Reply-To: <1333123764-15662-1-git-send-email-acme@infradead.org>

From: Stephane Eranian <eranian@google.com>

In perf_event__parse_sample(), the array variable was not incremented
by the amount of data used by the raw_data.

That was okay until we added PERF_SAMPLE_BRANCH_STACK which depends on
the array variable pointing to the beginning of the branch stack data.

But that was not the case if branch stack was combined with raw mode
sampling. That led to bogus branch stack addresses and count.

The bug would show up with:
$ perf record -R -b foo

This patch fixes the problem by correctly moving the array pointer
forward for RAW samples.

Signed-off-by: Stephane Eranian <eranian@google.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20120317222317.GA8803@quad
[ committer note: Fix also later submitted by Jiri Olsa ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/evsel.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index d9da62a..8c13dbc 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -580,6 +580,8 @@ int perf_event__parse_sample(const union perf_event *event, u64 type,
 			return -EFAULT;
 
 		data->raw_data = (void *) pdata;
+
+		array = (void *)array + data->raw_size + sizeof(u32);
 	}
 
 	if (type & PERF_SAMPLE_BRANCH_STACK) {
-- 
1.7.9.2.358.g22243


  parent reply	other threads:[~2012-03-30 16:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-30 16:09 [GIT PULL 0/9] perf/urgent fixes Arnaldo Carvalho de Melo
2012-03-30 16:09 ` [PATCH 1/9] perf tools: Fix display of first level of callchains Arnaldo Carvalho de Melo
2012-03-30 16:09 ` Arnaldo Carvalho de Melo [this message]
2012-03-30 16:09 ` [PATCH 3/9] perf symbols: Do not include libgen.h Arnaldo Carvalho de Melo
2012-03-30 16:09 ` [PATCH 4/9] perf symbols: Handle NULL dso in dso__name_len Arnaldo Carvalho de Melo
2012-03-30 16:09 ` [PATCH 5/9] perf probe: Finder fails to resolve function name to address Arnaldo Carvalho de Melo
2012-03-30 16:09 ` [PATCH 6/9] perf annotate: addr2line wants addresses in same format as objdump Arnaldo Carvalho de Melo
2012-03-30 16:09 ` [PATCH 7/9] perf tools: Add missing ref-cycles event back to event parser Arnaldo Carvalho de Melo
2012-03-30 16:09 ` [PATCH 8/9] perf annotate: Fix off by one symbol hist size allocation and hit accounting Arnaldo Carvalho de Melo
2012-03-30 16:09 ` [PATCH 9/9] perf tools: Remove auto-generated bison/flex files Arnaldo Carvalho de Melo
2012-03-30 16:43   ` Namhyung Kim
2012-03-30 17:09     ` David Daney
2012-03-30 22:01     ` Arnaldo Carvalho de Melo
2012-03-31  7:31 ` [GIT PULL 0/9] perf/urgent 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=1333123764-15662-3-git-send-email-acme@infradead.org \
    --to=acme@infradead.org \
    --cc=acme@redhat.com \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --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

all inboxes | Powered by JetHome®