Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1025158yba; Thu, 4 Apr 2019 02:41:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqzHdHJO7ehpa1jzl6/rmpXVfOJzZLrFHTcxB+paerfhNhHPtQGG7lm5/DNXAOyBrRKzHHnj X-Received: by 2002:a63:c10b:: with SMTP id w11mr4786529pgf.39.1554370918350; Thu, 04 Apr 2019 02:41:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554370918; cv=none; d=google.com; s=arc-20160816; b=c09iOXOurkxizbAf77SjHgzFDIvL1M4LKAbVr+j3SbZ8rm+GL4SKeIYGRall5VY1KN onJlVAzgHWk8lWypz3ZsLIDvr8Faset/6WvskYjEzM/HxIp+AKWaUgj1EJs/EkFTmOc5 2R+GIHv5nQniKZM9amGqbvv6vetpqonfiNNMpDzJS4B6K4MtkZqZYb6GyCmXdpQv+as/ Gk61ck3e+5nt/IjXZGGBadzNoO7YN003eK1NEM6Nz94URFhGBwyw1b6ddSq3Wi7aMP0S 8ql99FXxg14VM3ZHPKnrq7sv/A+ssAkUPhT/7BNmnpSaqoHlF2dzCbhVAfH4tJzuxPmm OfMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MXojSi6iwC4Zq7S1Yjc8yZqMIaGI3Br5N5u9/+SabpY=; b=lF4Kmuulw4EUX0ETstuOUNDzH6QfmRMdSz7U6oq7y9y4r9lcJEyokw0UipUhs+sZBJ S3a09Hfey4vrvLYuygR2kvNnd3zie3uPolZmfikD0UgH4g+qaeyrp06SVyEcD7DkCxyg SxSyUbtDtcT1CD13G0Fu7MvwI7h5tmMzeF8eif6P4MZ675Z9zdGrQ4loXiLS1IxGcVyN 7Q97N85XNM3tJT50wUDnLnP7QBFZjTkO+f+kIJjOQRz2M0T8pVGSpKKBvAWJrZLtGgFp k3tmoXontC2Pkmvux4Rv7ko0E3XihCozzODx8dJjSG9kFMQ8+TLGbjTq2sNmtmJvCo70 yCiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qbyx+kMC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z3si15739640pfa.239.2019.04.04.02.41.42; Thu, 04 Apr 2019 02:41:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qbyx+kMC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731765AbfDDJlI (ORCPT + 99 others); Thu, 4 Apr 2019 05:41:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:40000 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731200AbfDDJCg (ORCPT ); Thu, 4 Apr 2019 05:02:36 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 945F42183E; Thu, 4 Apr 2019 09:02:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554368555; bh=Q6jLdWe/2krEEj43oJu1KsqtDVyyaet9NzI74Z2Nrr8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qbyx+kMC+pm77z4ICArLg8Q4S7OwdJLcb4b4vjVv07LXy6mGSBvBZAOG382yoCsm7 zU59PxsOJfW/gqndJgi/SeXpUcr/pcVm0OifZU6XtIpE4llgnI/FBKtTcqUNsmZO7D bBuiw0laXJ81y6/8s5TsB5LlrHhii38tkJp6u5Vc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, He Kuang , Jiri Olsa , Alexander Shishkin , Milian Wolff , Namhyung Kim , Peter Zijlstra , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 4.19 082/187] perf report: Dont shadow inlined symbol with different addr range Date: Thu, 4 Apr 2019 10:46:59 +0200 Message-Id: <20190404084606.904780668@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190404084603.119654039@linuxfoundation.org> References: <20190404084603.119654039@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 7346195e8643482968f547483e0d823ec1982fab ] We can't assume inlined symbols with the same name are equal, because their address range may be different. This will cause the symbols with different addresses be shadowed when adding to the hist entry, and lead to ERANGE error when checking the symbol address during sample parse, the addr should be within the range of [sym.start, sym.end]. The error message is like: "0x36aea60 [0x8]: failed to process type: 68". The second parameter of symbol__new() is the length of the fake symbol for the inline frame, which is the subtraction of the end and start address of base_sym. Signed-off-by: He Kuang Acked-by: Jiri Olsa Cc: Alexander Shishkin Cc: Milian Wolff Cc: Namhyung Kim Cc: Peter Zijlstra Fixes: aa441895f7b4 ("perf report: Compare symbol name for inlined frames when sorting") Link: http://lkml.kernel.org/r/20190219130531.15692-1-hekuang@huawei.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/util/sort.c | 10 ++++++++-- tools/perf/util/srcline.c | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index b284276ec963..46daa22b86e3 100644 --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c @@ -229,8 +229,14 @@ static int64_t _sort__sym_cmp(struct symbol *sym_l, struct symbol *sym_r) if (sym_l == sym_r) return 0; - if (sym_l->inlined || sym_r->inlined) - return strcmp(sym_l->name, sym_r->name); + if (sym_l->inlined || sym_r->inlined) { + int ret = strcmp(sym_l->name, sym_r->name); + + if (ret) + return ret; + if ((sym_l->start <= sym_r->end) && (sym_l->end >= sym_r->start)) + return 0; + } if (sym_l->start != sym_r->start) return (int64_t)(sym_r->start - sym_l->start); diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c index e767c4a9d4d2..af3f9b9f1e8b 100644 --- a/tools/perf/util/srcline.c +++ b/tools/perf/util/srcline.c @@ -104,7 +104,7 @@ static struct symbol *new_inline_sym(struct dso *dso, } else { /* create a fake symbol for the inline frame */ inline_sym = symbol__new(base_sym ? base_sym->start : 0, - base_sym ? base_sym->end : 0, + base_sym ? (base_sym->end - base_sym->start) : 0, base_sym ? base_sym->binding : 0, base_sym ? base_sym->type : 0, funcname); -- 2.19.1