Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp2305189imc; Tue, 12 Mar 2019 11:01:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqzDqysWPArebYHMEWsKvZxV/zOiVSJCjEiX9f0OZb2/zvoviWtxwim7cUlEtJrLSrZs61Mp X-Received: by 2002:a17:902:a511:: with SMTP id s17mr16030402plq.262.1552413690064; Tue, 12 Mar 2019 11:01:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552413690; cv=none; d=google.com; s=arc-20160816; b=0WPgzkXkGYtYkAl1jEI/zJYMNjsgvAuLyzvsVXy+q1iprbtB0vIrY0mzA/rQuH5ANy HezFd7rBvsTMeZIjf67SlVGlPK+H3sncM7biGmyOgAdNRX7eNE8GTlCynI8rxeGJOHU2 2bJyZ8tOqqS9Rk1vEEMsQCwlLNwEvmInQLhzQ4hKYieCeB/EUE8/031JoGGI3fRtcAs4 1mthMoezohUGsZ7KC9VWKg1cH6aMtlp2CdYwKfRe58pQayMZ+nMRMijmcdrNSqDbVRf8 lMb1gIWIsxdWt+rIc2MgARMIVMtHiToK3UGF9YxoOmcKJdO23Bswzm78sUjxF4yS7WHC OuLw== 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=CLYcmiEl10ktDkfKoxZdTq7qHJ2eNrHWQDPcDKort2k=; b=yKgwIj6jEGP1NWeYiDy0d5su1SWrP65uo2scl0exXNR/2S6wKXQS5cqnEEpfIdpZsE HyA6VyEbL5K8u7aNi9W4QRGXtWYuOPW4Rb7dEctFNsROUBdXylHIegNHrzvzQYB3VaEu auZk0IJdCRSs8+9n3mrenXDNLFJtnXjEeRomvrYtS9KkPI1lS8EOSGVR2nRfF8aZtfWu t+kV3JdC1nGztwnaatwRv7q3rvD1xpUjIDV0NzuQbTYUd2GXFN4HZQYDAHVzsXJBt8TC efexkULpn0OO3ScSNHnlCCqVxxrG2H2pyTtqCSBVT3AnuUVFFOy4G9pph33pQFp1maqM nkFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LL8D6pfv; 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 b3si6592629pgt.254.2019.03.12.11.01.14; Tue, 12 Mar 2019 11:01:30 -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=LL8D6pfv; 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 S1728482AbfCLSAb (ORCPT + 99 others); Tue, 12 Mar 2019 14:00:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:49988 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727900AbfCLRNW (ORCPT ); Tue, 12 Mar 2019 13:13:22 -0400 Received: from localhost (unknown [104.133.8.98]) (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 D686B217F4; Tue, 12 Mar 2019 17:13:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552410802; bh=72kFG2IO4mX7Wg5JcbwqDM5oHwv3FyhjMeJ+WWnTEt4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LL8D6pfvYPUTzKiNSXDNWHT6m0hzd1rSH2LLhc39/8YNSW/iUhwW4P11/k6wS7iCD AQAKwmWMvmB4qhwCLzLQvcQ3HY2IHqtjjB6PhE2BRrHSl5HLsSOWcqNUgvM/U1Zfb2 llJF9GpA756DZwabebengOD7jSfMaa5cC8NYNaDg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiri Olsa , Alexander Shishkin , Masami Hiramatsu , Michael Petlan , Namhyung Kim , Nick Clifton , Peter Zijlstra , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 4.20 129/171] perf symbols: Filter out hidden symbols from labels Date: Tue, 12 Mar 2019 10:08:29 -0700 Message-Id: <20190312170358.853256599@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190312170347.868927101@linuxfoundation.org> References: <20190312170347.868927101@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.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 59a17706915fe5ea6f711e1f92d4fb706bce07fe ] When perf is built with the annobin plugin (RHEL8 build) extra symbols are added to its binary: # nm perf | grep annobin | head -10 0000000000241100 t .annobin_annotate.c 0000000000326490 t .annobin_annotate.c 0000000000249255 t .annobin_annotate.c_end 00000000003283a8 t .annobin_annotate.c_end 00000000001bce18 t .annobin_annotate.c_end.hot 00000000001bce18 t .annobin_annotate.c_end.hot 00000000001bc3e2 t .annobin_annotate.c_end.unlikely 00000000001bc400 t .annobin_annotate.c_end.unlikely 00000000001bce18 t .annobin_annotate.c.hot 00000000001bce18 t .annobin_annotate.c.hot ... Those symbols have no use for report or annotation and should be skipped. Moreover they interfere with the DWARF unwind test on the PPC arch, where they are mixed with checked symbols and then the test fails: # perf test dwarf -v 59: Test dwarf unwind : --- start --- test child forked, pid 8515 unwind: .annobin_dwarf_unwind.c:ip = 0x10dba40dc (0x2740dc) ... got: .annobin_dwarf_unwind.c 0x10dba40dc, expecting test__arch_unwind_sample unwind: failed with 'no error' The annobin symbols are defined as NOTYPE/LOCAL/HIDDEN: # readelf -s ./perf | grep annobin | head -1 40: 00000000001bce4f 0 NOTYPE LOCAL HIDDEN 13 .annobin_init.c They can still pass the check for the label symbol. Adding check for HIDDEN and INTERNAL (as suggested by Nick below) visibility and filter out such symbols. > Just to be awkward, if you are going to ignore STV_HIDDEN > symbols then you should probably also ignore STV_INTERNAL ones > as well... Annobin does not generate them, but you never know, > one day some other tool might create some. Signed-off-by: Jiri Olsa Cc: Alexander Shishkin Cc: Masami Hiramatsu Cc: Michael Petlan Cc: Namhyung Kim Cc: Nick Clifton Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20190128133526.GD15461@krava Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/util/symbol-elf.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index 66a84d5846c8..03cb8c6d620a 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c @@ -87,6 +87,11 @@ static inline uint8_t elf_sym__type(const GElf_Sym *sym) return GELF_ST_TYPE(sym->st_info); } +static inline uint8_t elf_sym__visibility(const GElf_Sym *sym) +{ + return GELF_ST_VISIBILITY(sym->st_other); +} + #ifndef STT_GNU_IFUNC #define STT_GNU_IFUNC 10 #endif @@ -111,7 +116,9 @@ static inline int elf_sym__is_label(const GElf_Sym *sym) return elf_sym__type(sym) == STT_NOTYPE && sym->st_name != 0 && sym->st_shndx != SHN_UNDEF && - sym->st_shndx != SHN_ABS; + sym->st_shndx != SHN_ABS && + elf_sym__visibility(sym) != STV_HIDDEN && + elf_sym__visibility(sym) != STV_INTERNAL; } static bool elf_sym__filter(GElf_Sym *sym) -- 2.19.1