From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932382AbbCFIhf (ORCPT ); Fri, 6 Mar 2015 03:37:35 -0500 Received: from terminus.zytor.com ([198.137.202.10]:59192 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752198AbbCFIhc (ORCPT ); Fri, 6 Mar 2015 03:37:32 -0500 Date: Fri, 6 Mar 2015 00:36:57 -0800 From: tip-bot for Arnaldo Carvalho de Melo Message-ID: Cc: namhyung@kernel.org, acme@redhat.com, jolsa@redhat.com, dsahern@gmail.com, tglx@linutronix.de, rabin@rab.in, a.p.zijlstra@chello.nl, mingo@kernel.org, hpa@zytor.com, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, paulus@samba.org Reply-To: acme@redhat.com, namhyung@kernel.org, jolsa@redhat.com, dsahern@gmail.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, paulus@samba.org, a.p.zijlstra@chello.nl, rabin@rab.in, mingo@kernel.org, hpa@zytor.com, torvalds@linux-foundation.org To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf annotate: Fix fallback to unparsed disassembler line Git-Commit-ID: 3995614d9b0320e10ce202836c8477e1bcf1a2d4 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 3995614d9b0320e10ce202836c8477e1bcf1a2d4 Gitweb: http://git.kernel.org/tip/3995614d9b0320e10ce202836c8477e1bcf1a2d4 Author: Arnaldo Carvalho de Melo AuthorDate: Thu, 5 Mar 2015 15:27:28 -0300 Committer: Arnaldo Carvalho de Melo CommitDate: Thu, 5 Mar 2015 15:27:28 -0300 perf annotate: Fix fallback to unparsed disassembler line When annotating source/disasm lines the perf tools parse the output of objdump, trying to provide augmented output that allows navigating jumps, calls, etc. But when a line output by objdump can't be parsed the annotation code falls back to just presenting the unparsed line. When fixing a leak in the 0fb9f2aab738 commit ("perf annotate: Fix memory leaks in LOCK handling") we failed to take that into account and instead tried to free one of the data structures that should be freed only when successfully allocated, oops, segfault. There was a change in the way the objdump output for lock prefixed instructions is formatted that lead the relevant parser to fail to grok it. At least RHEL7 works ok, but Fedora 20 segfaults. Fix it by making the ins__delete() destructor work like the most basic destructor: free(). Namely make it accept a NULL pointer and when handling it just do nothing. Further investigation is needed to figure out the nature of the objdump output change so as to make the parser grok it. Reported-by: Linus Torvalds Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Rabin Vincent Link: http://lkml.kernel.org/n/tip-7wsy0zo292pif0yjoqpfryrz@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/annotate.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 61bf912..9d9db3b 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c @@ -30,6 +30,8 @@ static int disasm_line__parse(char *line, char **namep, char **rawp); static void ins__delete(struct ins_operands *ops) { + if (ops == NULL) + return; zfree(&ops->source.raw); zfree(&ops->source.name); zfree(&ops->target.raw);