From: Anton Blanchard <anton@samba.org>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>,
Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
Namhyung Kim <namhyung@kernel.org>, Jiri Olsa <jolsa@redhat.com>,
David Ahern <dsahern@gmail.com>,
Pekka Enberg <penberg@kernel.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] perf annotate: Fix SEGV with assembly labels
Date: Thu, 11 Jul 2013 14:33:01 +1000 [thread overview]
Message-ID: <20130711143301.1f014c7b@kryten> (raw)
I'm getting a SEGV when running perf annotate on a ppc64 box. The
objdump -S output causing the SEGV looks like:
b .ret_from_except_lite
c00000000000a508: b c00000000000a4d4 <.ret_from_except_lite>
1: bl .save_nvgprs
c00000000000a50c: bl c00000000000a110 <.save_nvgprs>
symbol__parse_objdump_line makes an effort to distinguish between
instruction addresses and assembly labels but the check is
insufficent.
In the above case we get line_ip = 1, and (line_ip - start) is
positive so our offset < 0 check does not catch it.
Fix this by adding an unsigned comparison against start.
Signed-off-by: Anton Blanchard <anton@samba.org>
Cc: <stable@kernel.org>
---
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index d102716..a791d23 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -809,7 +809,7 @@ static int symbol__parse_objdump_line(struct symbol *sym, struct map *map,
end = map__rip_2objdump(map, sym->end);
offset = line_ip - start;
- if (offset < 0 || (u64)line_ip > end)
+ if (offset < 0 || (u64)line_ip < start || (u64)line_ip > end)
offset = -1;
else
parsed_line = tmp2 + 1;
reply other threads:[~2013-07-11 4:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20130711143301.1f014c7b@kryten \
--to=anton@samba.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@ghostprotocols.net \
--cc=dsahern@gmail.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=paulus@samba.org \
--cc=penberg@kernel.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