From patchwork Wed Aug 28 05:09:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Clevenger X-Patchwork-Id: 13780569 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E8A69C5472D for ; Wed, 28 Aug 2024 05:13:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=46Lnfa419ba6MwoTBOGTytQvW5UJhrJmfl9dt3uEQ2w=; b=q5zKDxVefTQoD1Tyu/PgxOJTBC 914QGjCORN9UqGOB0pY5VGxdOfHiqTxPQV7zj5AP2ejCRQaJtZTPPwngk0Hgi+OvzDSmuGEUIufTo EKL8gacyOcefYHyqfnYbAvOxHyXEAnABFPlMcbbqSvm1wtU7AIVDeDxWZaGPW893TExyAmqsVOT/p R15BJaYF5V9w4uQqac1oOcqJUo6Ix7UqrSHbfN6LZvDMJs898/EECtNFO6Lmu4ZhL87YWlSMp2+ln 0wTEiZnjDAgVRDV9sKEbpQ8tBrBD9/FTQyp5mRBEdi+aAkNiadbrOPVlqxsfkoTD3C2mCGNt+XM0Z E7+VCxLQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjAzI-0000000DsdC-29Ya; Wed, 28 Aug 2024 05:12:56 +0000 Received: from mail-northcentralusazlp170100001.outbound.protection.outlook.com ([2a01:111:f403:c105::1] helo=CH1PR05CU001.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjAwX-0000000DrsB-1A5A for linux-arm-kernel@lists.infradead.org; Wed, 28 Aug 2024 05:10:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bZVixYgy4ni7jTu3f34pahQB+J41WNJ7ZyCFQcRZqBS6zkizn2oLuKEqKKbUpbv/zjPl2L7UCVpkquEJbQ90jPm8BYypLlC7G5DfI86z+er2uqSk36dlhej49OJUnocAGMioDEVvFPJ37JIH1D8efv2gaJIOLY6CII1dDCk51GODZoIpKxOEBHhtn4OCQqbFbcekFrEMG7VHX9eY1JnHMWw1uEWDU6g7/lqyH/KiwLz931y4JxC2skuaW07MWxwP8ukl8jfkCW4YrbCXMOF1gWCiAr5oi7/8/FBYvmcoOsGBsp5B70dZnlRwrsKid7lMa0ditJ+NNwNGZUyoqw+oYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=46Lnfa419ba6MwoTBOGTytQvW5UJhrJmfl9dt3uEQ2w=; b=rI7sIDfKew24dkgJcx/tirPrzuqTOm7Cts3km/RcmMsVr0LAYQIQLyPvX9OATiQuf0OSWpehuxgY7iFSwu1cT5GUSE9C2+X5NfZBTvuo/Op+y6Iw+Ivj3FeJ7zwNUtUPgMrYHO9orXtVPeUSkITQRNmRw+9R9HirQMg/3uEu6+y3il0uK1EPnRE9JTUXLmYA7zjDsGkEcZdC608Rpa2H+1SKeOf32fGZnfYXOhuqa14/rtQK+Rt38ndKQjW7mUmPlTrVsTGzyfw810ASoroDT5l3vEoQ6LHbCC84UMx0xbi/xIGLn5GNpFZfoXygsPpzkjmJxtX7VJuH44pcFTajQw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=46Lnfa419ba6MwoTBOGTytQvW5UJhrJmfl9dt3uEQ2w=; b=Z5tM5qheGDW4oxY/ya+kbDTNXDeUowhSjLzkTfyAlwtPins/va88bOCyTERdo3vfr4fC1xL+yObXdt/t9kQtlPXj3f2m7kVd0aGhmOrHMzB8a5dXXk0SVR9pZv+KWrQ9v4UyRhX93Myg4WPerqFlJHp95b+4ILUTkH0rpCZP7Co= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from PH7PR01MB8146.prod.exchangelabs.com (2603:10b6:510:2bd::18) by SA0PR01MB6506.prod.exchangelabs.com (2603:10b6:806:eb::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.25; Wed, 28 Aug 2024 05:09:59 +0000 Received: from PH7PR01MB8146.prod.exchangelabs.com ([fe80::2972:642:93d1:e9d4]) by PH7PR01MB8146.prod.exchangelabs.com ([fe80::2972:642:93d1:e9d4%4]) with mapi id 15.20.7897.027; Wed, 28 Aug 2024 05:09:59 +0000 From: Steve Clevenger To: james.clark@linaro.org, mike.leach@linaro.org Cc: suzuki.poulose@arm.com, leo.yan@arm.com, ilkka@os.amperecomputing.com, coresight@lists.linaro.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH V4 2/4] Force MAPPING_TYPE__IDENTIY for PIE Date: Tue, 27 Aug 2024 23:09:38 -0600 Message-Id: <05faf8cf48948cdadcf3757eb5fc0305497805c6.1724820993.git.scclevenger@os.amperecomputing.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: CH5PR04CA0011.namprd04.prod.outlook.com (2603:10b6:610:1f4::27) To PH7PR01MB8146.prod.exchangelabs.com (2603:10b6:510:2bd::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH7PR01MB8146:EE_|SA0PR01MB6506:EE_ X-MS-Office365-Filtering-Correlation-Id: 81d52a60-60f0-4f9b-ed7e-08dcc71faa39 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|52116014|376014|366016|38350700014; X-Microsoft-Antispam-Message-Info: 32cfeAvvELdRukimp22DSPBN7TsanSeZZvEIEFI1K5e7UgWsWJ62DYDszgUJdWAgu7FdtD2F1S3CGo3BoOHn0VKn4EIdvkyBRDrCLW3ZIczthFimPvw/y3ZvtQKOX0ciB+cX/bjl95ckzTLvhspMgYrLFGM+VgTfy3T+wvMni1mbEK+sDc5hLYOrj61DNV7s5VC2r5QPURp9cyZi8ZW1rrYsVEe4Js3pBKBWnTphNDDhVyUWIHFp05OVbBnRkGsLEq58jqBfO4s/GtdzYuuZdwpWVO2byUHnvimIH+l3GUYKQ7+ZVbDEuMZKs4Epz6xGJPXNwJ5R/zLrHrePiIkv2KiIXx/5xdRiZh0XMq1IPen2no/pqk25YyR8Q2TR3nLg7jmJHCSdemiq8jnd1MuDQdlzJumUL0J3pPF502OEjEPq7yZDDwpmyO7aKW2XsH1gxaPQN6s17GyGCG+ZyNZss5WJ0qbOjkAGQuyLuLdOTWNOhFpqhDlbI6nt1zj9u4qj7sZTwgMT4CZARycvFM8ZE0KgJs44E0hOC2ggZl09jkUbAkGi1JJLXU/szdRu73QSTZr+gda5RF49Etu22gm5ItVwf8tiuzfKCBkI9WsSmv4V/R5BRgd0HPbsipxBSDOhDJTA/qQUxi1aSb45KROKBmBoRT0fs1STYYKPKPz5x0ZDexfnymfJ7DARvMmsAtxXWR8qulm1YPm5n7UhidAMzrJMwRpFSiGaSvABbj/jOdpBDcvbq3o6575k+MFu2gremJ/mF/KkuA1WVQK/DltJNj0SsRVvrz8Amf36TQ8R7EP0IjcdLYlTnJ1InvKwmALbwzbaXFGy1J9tkcqEych1hGiA2CpjuxLIvjFS4R1RgNGJBF0rxWS6IJys1lt7TAaWBr8VB8NprhOVcnWn2VkoBI2cvpan4nwBw/A6GrIxCwSfrpwn66pGcVeCN8KSXQDN3ccKj2QZjLq35agG5wbetlbLmRe8mLAH12zR1D9s2pVjb5yszt938WaundJ6sNyCy35c0uPmnoI4Vvc52yVpll1Z8jY02RzM7ek8kPj3UoKEjoV2fsixPHL5501rrpXKzOnsIN+FbzXwWyhYS60v0fC18nKvTDiINOW+GJmmRbpZOhwkAMBFdkZqYnue2qQ4GHgf9o5ur9Am+5lncbLkXRWs2EpjeSmSae6j8Hg6PZboQgcCe5n5gAp43YV+Fjeoboj8PULVUMSkN5n/Cn1GUZmRw06DdaRKurkUrQrWRzMr1d1q4RRdEyxlFJ7Xunt6iNkIcz4TyXnIACSwL1wXpC9xmeg4GI8QBOV1ob5yEWylV5c5WTcRvtpuIMBTrrOKZaR5yZgpkQ3iZMNhDhbVZiTgFq9NLFFaHXXGSYhv1KS6D8bAB6tJUYa6A8FepXqVnLMnpyggiUM2v2oKpXTKpA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH7PR01MB8146.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(52116014)(376014)(366016)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Nv+oAd8PZlhx5dbNX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BqdNwNdwO4ZKFwa9+JRimqrf7LmbSG13o5Zc6qZOki6e3HPQZ/Eg1aCZ+5BUVwGCjMDNhRFNyBPLsOE6N84itG76XHVJ3mVjCDiwhpBYHnOytn6vyYP/IiN7QVaPrWEoOG81XVGQ1rCqUWUQHEfMeGLt/xZeOP9q7NC6QGT3fXTNlFRPopybao66UzCV1S87pgEC/UZPjhijeog2pP0QWfYyqup7cLXnbzarjO+AR1HQl7446NNFqAMwzvnOxdsk7/xPyXOBzjLKvmdMsQ0rESIyvNaHF88kDEGquKymLiM0dl17V4HU9WJRHqrn4tyM9FBdGPYfnjIqdNyYOuTJlp6Y12E7H+ZFwyuqAIFYFRovWpeeT/68/vsYD3d4cdjta2awyDb7Lt4jgKUvD9UN8YMIsEYQ7M3BiU5gu0mufK5FwbI6zl8cymzCYg4fMEIkQ4QclDJdJB55u5HnRYDK/ty6RwuwKk26YLygslwPjGEuaUsnIoUY0z4BQmG50Zt4ThxHhzETF5UslmTDMjzR9EKTkzg7F X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 81d52a60-60f0-4f9b-ed7e-08dcc71faa39 X-MS-Exchange-CrossTenant-AuthSource: PH7PR01MB8146.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2024 05:09:59.5331 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: i4CeqSmz06gc0NO0uHkOfiCyJYb3wmLzInJwQIBngtKb6ON/qdhn4/2hEq9sJ85EQDDR9eC/Y/Wf1QRrIw09/OWHrf5dZm4f7gy+VDzFmsdOUWatMxJbzW6RkVu486Zn X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR01MB6506 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240827_221005_340885_152DCA4A X-CRM114-Status: GOOD ( 10.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use dso__is_pie() to check whether the DSO file is a Position Independent Executable (PIE). If PIE, change the MAPPING_TYPE to MAPPING_TYPE__IDENTITY so a zero map pgoff (text offset) is passed into the script. Signed-off-by: Steve Clevenger Reviewed-by: Leo Yan --- tools/perf/util/map.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c index e781c8d56a9a..c846faec177b 100644 --- a/tools/perf/util/map.c +++ b/tools/perf/util/map.c @@ -173,8 +173,8 @@ struct map *map__new(struct machine *machine, u64 start, u64 len, assert(!dso__kernel(dso)); map__init(result, start, start + len, pgoff, dso, prot, flags); - if (anon || no_dso) { - map->mapping_type = MAPPING_TYPE__IDENTITY; + if (anon || no_dso || dso__is_pie(dso)) { + map__set_mapping_type(map, MAPPING_TYPE__IDENTITY); /* * Set memory without DSO as loaded. All map__find_*