Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp580057img; Fri, 22 Mar 2019 04:28:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqyt80scmljAOsYbI1l7AEME4LakmcbvPHfVdWUjcRIcQ4A9aZj0PVU9piWSbXk5D7PWpUo5 X-Received: by 2002:a63:7153:: with SMTP id b19mr2099930pgn.289.1553254084253; Fri, 22 Mar 2019 04:28:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553254084; cv=none; d=google.com; s=arc-20160816; b=CV+0IHqHEya1n6J7mP0CtfnSysbjOqGbcVTLCkG44kMPVjfcIE2zlC05IoTfn2vQCb Vu0zhv9AHtj9OQo9RjiBy5/ofxtgU9/Y8mG12h37e0jTI2q/Z7q8o8wMuGfL+gZa4NG9 LKDrpNsmuhGLZ2rnypyGh6ZIBrbgYIF43ow0QH989ZuNSnY9r/mh0aWYdTaDimjZS4sv EquLMSZ/mSiT1jmXHYHSI7wW6vWO/82Gg7BtsQamMj+wwspJwOAOw5aQ4pI7c8LqXLMS 1EbVAVMqvRhxTD4TyduslIoh1OuU6ER5B3q+Jp4WDnWSOsOjrLRe9ad/0s37t8oTtOX7 uP5w== 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=3tm1Zzw/kZmGtdhM/ZkDTN9MDhKMm65akqcnzOjhit4=; b=C0FRLZyULJrHSBZ1bHZ1279qeqEPiw9Yw7xtlrwrVahN7uq9SbwXGLQKllIHo2q5wl eNQ6f9b+Hhsy/GIoZ5Z08I16ssI9PCRaDrfExrRKKVdyYy3yes5mczjdL5Z/tGtqdpA4 ld73Qw/alzo2xENCwTJw3l3oZWSCAYTi0eaRzoqfxbGnuzsH8BNS29atf16ggx1pcFne uxSp65i+nhncu6kNwFl13izfwukZeNfvpCeN+g6TKjZrHL3nRDbapipl9Y0VnFad+Y8v jO/IJf7njof4S6ZNA5xLU/sJ46N62qJ/8/dXk43kH3lUJm2ngI8OzpfE6AZ/1538SehX PSxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hVfMy07N; 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 i8si6054253pgs.568.2019.03.22.04.27.46; Fri, 22 Mar 2019 04:28:04 -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=hVfMy07N; 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 S1729176AbfCVLYr (ORCPT + 99 others); Fri, 22 Mar 2019 07:24:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:51820 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728398AbfCVLYp (ORCPT ); Fri, 22 Mar 2019 07:24:45 -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 91CC6218B0; Fri, 22 Mar 2019 11:24:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553253884; bh=3xB2Z9AfFXgKOqhZvIimgcMAAW1qVIES+0TUX9U1exM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hVfMy07NlYJ95E2Mp7j/ITAcM1IN3ljauquDYK/62CfRCsx+ugIhwZhE54Pf1GV69 HTzVzb3iMlzs+HpPlSA4wXdN99NOFH8NwMgPxkmt2w/0Rwrl9+eP2qKwJ5JcLzrQ+z BqfGMaeHLeIbP7XB8jsLBdBFCW9kKsL0iu7RKXK0= 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 3.18 076/134] perf symbols: Filter out hidden symbols from labels Date: Fri, 22 Mar 2019 12:14:49 +0100 Message-Id: <20190322111215.588725264@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190322111210.465931067@linuxfoundation.org> References: <20190322111210.465931067@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 3.18-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 194300a08197..04100626ca51 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c @@ -48,6 +48,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 @@ -72,7 +77,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__is_a(GElf_Sym *sym, enum map_type type) -- 2.19.1