Received: by 10.213.65.68 with SMTP id h4csp2113146imn; Sun, 8 Apr 2018 20:03:05 -0700 (PDT) X-Google-Smtp-Source: AIpwx493o9DkSQx2kBrolG6PKsXy/SsZ9wi1WiteDMe7tfz1BgwJDNhFEe31ieqBiDnZAxGd/npI X-Received: by 10.99.123.23 with SMTP id w23mr23661964pgc.10.1523242985182; Sun, 08 Apr 2018 20:03:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523242985; cv=none; d=google.com; s=arc-20160816; b=O7fymSWipxPImYA+op816wQN07/1W0b6Za3XGdE45os4wza5yF5NGgXAvLOnM+Apt3 tEj+1KOK2KRxShjQJJtdJmKpC8B//4fGIahmIlTyMr0nFfVy5VhnCoslrPEhnFNfEZzn AkqHmKRR6vs/HGbwF2dREn2FDhC0yIUpGSIr95kwVbyEfEZ2QYRvg5fpNQUrdFg7eTK9 LvBaM4SvgAuNolUs6nwSia8pVoDyISkke6WEF2hZdw1cLHzJk9RToAFyioH8FiH3J1AE 3CEPRY0z0/zecN6DlKYzmM/q6DkzLzijMgzGpa/gruXGe8RqoPABQiPd/TWv/Oc5AnNF x8Sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=6t624br08x8uU0nOLrPQmOWuWdRdlRC9ZlMjT1ZEev0=; b=f41OGr2XAcvyXFaiE2yeCuv5Gan/x8titAXm3UyHGVcN6L2+UdOnUaxp5eVUUB3DEt fbjp0tckMJAdc2TfloBwHQb0dYrj/ydulAXv9SPGJdMNTq9xuQfWwOCeC1+E02RsXoZn NpaWlCXDl419XEOpUnaGUJvjw9o/3/y0bVp1if7b6qEyZX7uWRRXXP0nVm55b3qjsIfa CLWjKKIB6kT+aTX4CCNkokFLsQNaYb1Vn8748s6xk11PCnUM8jQdko4G+eTjsfFaVsXZ /9WmsUT0/4zRdmk3vBY5XSZSay4Fg8gfAE0l8wSOpfYRc0aRhCK++3JIj05qd7V4jLHP jAPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=OvmaEtwU; 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f4-v6si2267116plt.487.2018.04.08.20.02.28; Sun, 08 Apr 2018 20:03:05 -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=@microsoft.com header.s=selector1 header.b=OvmaEtwU; 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755471AbeDIA0y (ORCPT + 99 others); Sun, 8 Apr 2018 20:26:54 -0400 Received: from mail-by2nam01on0099.outbound.protection.outlook.com ([104.47.34.99]:2811 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755428AbeDIA0p (ORCPT ); Sun, 8 Apr 2018 20:26:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=6t624br08x8uU0nOLrPQmOWuWdRdlRC9ZlMjT1ZEev0=; b=OvmaEtwUwrrEduXawyzBhHlfmqI4JzcaioUpOZtquUccgz5wwaFO3utOSsCGK2OmTz0eedxJtPofqUuYQTIjOPVJ9NbO7BxMs8dOHuDm3M7GoEqbvaVmf3zD/nWLe2mwVSMnxIBnv20ftriWa8MMXcUy/CatzsPnOjHhtgkU/Pk= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1015.namprd21.prod.outlook.com (52.132.133.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:26:37 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:26:37 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Namhyung Kim , Adrian Hunter , David Ahern , Peter Zijlstra , Taeung Song , Wang Nan , "kernel-team@lge.com" , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 014/293] perf annotate: Fix symbolic link of build-id cache Thread-Topic: [PATCH AUTOSEL for 4.9 014/293] perf annotate: Fix symbolic link of build-id cache Thread-Index: AQHTz5jpbdO9KJvFPUCRHGIbjiRcfA== Date: Mon, 9 Apr 2018 00:22:59 +0000 Message-ID: <20180409002239.163177-14-alexander.levin@microsoft.com> References: <20180409002239.163177-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002239.163177-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1015;7:YAbpZnq6e9DkntyTSNlrJ9fUhG0byOaRBykdGVc3ubm+OIoCn+wOZuxI7BKGoy1yptbDdFw8sBe+fEHh3m0XAVVxIFd3/Zy+GxjJTo/+q/Bfai39LnZ8J27QZimo+ruz8/B4srrJv5OKiglPGjR1DrmoTVmndGz/kpyuCmyU2rvUTNhX+asYH1fdiAdakStHVDB9zG/YCDupZke1D8Axqvypo3jtStZaiNhgsyYa6u6WkZPM8FD9AahOSDiVYDVi;20:jYgmgNQ2ntm/j4zlO8r3JcQqJVDPUem6DNr8V4+y4N4ACVExAtj8vI8utFpvK8uClwR4j1Dmhpgpc1pUBDSC6MzDKHvnPaWG6WvL87oLFX7InnAy+lLzURefX6tpL/VuEsV+p5/sOSiNRp9i14kmh6myJFXhr873me8H9A23CGg= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 169bdf46-cc57-416f-3989-08d59db08ece x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1015; x-ms-traffictypediagnostic: DM5PR2101MB1015: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(50582790962513)(85827821059158)(42068640409301)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(3231221)(944501327)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:DM5PR2101MB1015;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1015; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(39860400002)(39380400002)(376002)(346002)(366004)(189003)(199004)(53936002)(4326008)(478600001)(72206003)(3280700002)(2616005)(14454004)(305945005)(5250100002)(3660700001)(2501003)(2900100001)(54906003)(110136005)(86362001)(1076002)(966005)(107886003)(6506007)(36756003)(446003)(68736007)(6512007)(7736002)(486006)(2906002)(6306002)(5660300001)(6436002)(3846002)(86612001)(6486002)(66066001)(11346002)(7416002)(476003)(6666003)(59450400001)(26005)(10090500001)(316002)(22452003)(8676002)(81156014)(81166006)(6116002)(105586002)(99286004)(186003)(106356001)(76176011)(39060400002)(25786009)(97736004)(10290500003)(102836004)(8936002)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1015;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: J/EIebK8r9zrkkGdi2QqLYr1j5RBz2qA0XOpT56lnD+oa5h/H1WINFIkCrHvYsUyn0OfbuCSHqVC210nEFAtoUow4Wpe97CAJbFQZ8fOPk9ybP9vtDoEn08s4x8aLqpPidTthE/JNfxyUHjDmYObv29ckzgECEcNiNFBtv4mlQq127IRWyuQHh3iWQa45zUWKu5uylJYM+e5xL8CgNH5JIqrHDUFroASHZf8LK45yIKiR63Tyo/uKQ8XLtx8k/XByti+zorTSUyRJpjd+bl+6fWPsfLj8MQ8XazF64h8kra/QAmrmOIvKXBqe1r1HplFqFDwAwvGx8qww8LRVn9Jm6lH19di/VTcEzVvCqPWfA6uMrdtUm3rEUYgejFLIGw52wwYu+qmvyMmsrzKswc6jmVYHK11tdp7AesEe5VBn5Y= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 169bdf46-cc57-416f-3989-08d59db08ece X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:22:59.2373 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1015 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Namhyung Kim [ Upstream commit 3619ef76b37d4803bc9daee9d03d82c8526db378 ] The commit 6ebd2547dd24 ("perf annotate: Fix a bug following symbolic link of a build-id file") changed to use dirname to follow the symlink. But it only considers new-style build-id cache names so old names fail on readlink() and force to use system path which might not available. Signed-off-by: Namhyung Kim Acked-by: Jiri Olsa Cc: Adrian Hunter Cc: David Ahern Cc: Peter Zijlstra Cc: Taeung Song Cc: Wang Nan Cc: kernel-team@lge.com Fixes: 6ebd2547dd24 ("perf annotate: Fix a bug following symbolic link of a= build-id file") Link: http://lkml.kernel.org/r/20170608073109.30699-2-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/util/annotate.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index a38227eb5450..ffe9153480a8 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c @@ -1251,6 +1251,7 @@ static int dso__disassemble_filename(struct dso *dso,= char *filename, size_t fil char linkname[PATH_MAX]; char *build_id_filename; char *build_id_path =3D NULL; + char *pos; =20 if (dso->symtab_type =3D=3D DSO_BINARY_TYPE__KALLSYMS && !dso__is_kcore(dso)) @@ -1270,7 +1271,14 @@ static int dso__disassemble_filename(struct dso *dso= , char *filename, size_t fil if (!build_id_path) return -1; =20 - dirname(build_id_path); + /* + * old style build-id cache has name of XX/XXXXXXX.. while + * new style has XX/XXXXXXX../{elf,kallsyms,vdso}. + * extract the build-id part of dirname in the new style only. + */ + pos =3D strrchr(build_id_path, '/'); + if (pos && strlen(pos) < SBUILD_ID_SIZE - 2) + dirname(build_id_path); =20 if (dso__is_kcore(dso) || readlink(build_id_path, linkname, sizeof(linkname)) < 0 || --=20 2.15.1