Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5583510img; Wed, 27 Mar 2019 11:08:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqx50Tcmbky9nkPpQFHhWOXoBCyvV7CLMiBWDV1Dwh5djCa8m4mTgF7T0zMF9b1LzTSFqjvb X-Received: by 2002:aa7:818a:: with SMTP id g10mr36187931pfi.178.1553710104608; Wed, 27 Mar 2019 11:08:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553710104; cv=none; d=google.com; s=arc-20160816; b=tpUp0WXSaADArJ9oN/v4co8X7ozzkD6WidYYT8F2nYw+VZqJd2fUxDOrJmIb6QUPgm 1Wok6Nccp6l2R51aBnDBISo80Mcu6inuKjxSuXeOaAqrT8asftJK2Live/R44aQszMuk ObNLTnNf0bra8DZJ6jM5GoiULUFAtROO3NgwvsSLxSFJDwmR5EsF5Ci2nklVZbtkwcBN bs/tgUixMhdc5BzMpvmXLC5xqZt8xTNb69tyabVny9qydfVG+op5SFMzZet0gLRaVqbp tmDy3MLnDFZUkZjUNgkXN+I09uur3AJr/e+ijyIbdrZePGvKunr4Asd49dTktJY6fSZ1 pPUw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=eQlIjwfqylkRo2Od+j6HLq+GwOY2SyoUeWsOHfHa66A=; b=pg4Q2q3pnjVPjcNzJvZRBxQ6fo3dUf34rugk6xbOLE3DcTlFRfJVWW+DKwwmkYHxJX 13xPZs7Qv0LcKJZKqsS+sKV+ZGE/360OVQi6vwtgaKhukzcQGSk0xuaIS0h1agZq95/E Z6qmcYkfxHf1omTCMYITYph0EF+Vfu7ZsUzp87ulyEuqcqI2HR9hgaRvIE2vwNOeSCh9 +wDqqDgH51U6VZ5ENmlX0wUOwReHOk+InLXq5QVlIYjnODgFqUGFZv4BzsL8t/CwmT2i 74PX8W9s3ZUDlJwAQ2AajDBJ4GkzNk4nFSS0IRL6BRnmjMB8jracq6djC6hVa/0aNJYr 5Wnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=i1xlToVq; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m2si10977339pll.44.2019.03.27.11.08.09; Wed, 27 Mar 2019 11:08:24 -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=i1xlToVq; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387723AbfC0SFb (ORCPT + 99 others); Wed, 27 Mar 2019 14:05:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:46646 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732477AbfC0SFa (ORCPT ); Wed, 27 Mar 2019 14:05:30 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 168642063F; Wed, 27 Mar 2019 18:05:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553709929; bh=PnXmQiK8XqkAJPnF2yyNcsknUPosTDhHfOWVke53zfA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i1xlToVqNg+Ag6voA+8jzVK15f8lZ6wHSgieXMva2jwJlO87sVRONuLJtFC9qXjZR 7BfJ+3Wx+NscttlihCA1AF25pdHKXQca6gtN5CLWyr5dMjo34MevQJWfLAIYkwqd5I Oking9hP5Ot/8ovpuaarEGO4JhVQU8uwDSJLNH2g= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: He Kuang , Alexander Shishkin , Milian Wolff , Namhyung Kim , Peter Zijlstra , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH AUTOSEL 5.0 117/262] perf report: Don't shadow inlined symbol with different addr range Date: Wed, 27 Mar 2019 13:59:32 -0400 Message-Id: <20190327180158.10245-117-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190327180158.10245-1-sashal@kernel.org> References: <20190327180158.10245-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: He Kuang [ 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 6c1a83768eb0..d0334c33da54 100644 --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c @@ -230,8 +230,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 dc86597d0cc4..ccf42c4e83f0 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