From patchwork Wed Aug 28 01:50:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Clevenger X-Patchwork-Id: 13780458 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 9EE61C5474A for ; Wed, 28 Aug 2024 03:30:53 +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=EAiHOV4TUb2vdI6iyo+43VW/AI TUYkyfvg6NqeS4bKmX1G3KCAB0x6GsQjTiteZJWBfU/YgOUFnQCXnsi2c5ud797UpVvxP+kYWk7Bp jR8GRlquHlyIPp66rSLAb0TsaXvTMHACjXRGQCG5fpV+QP9jdqEP+y61rITjPanfFN+OjBFIMpd8r Mdk1rB/TiUd67TUBtgRZ1WL45pYPrhKy6AMsiBkYotmpxNDJzgnEcYHwysyNkA3cs+DPfNhaDNPyt mAqDpQi1wikmGdfy4e99C4IN08CwuxXWzjl8S/QaDm1raMBjGBrGJ7bqD6YFiuvxP+ARJUbhnhN29 NQEXtXPQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sj9OG-0000000DeZO-1IhM; Wed, 28 Aug 2024 03:30:36 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sj8KQ-0000000DTCn-3t5r for linux-arm-kernel@bombadil.infradead.org; Wed, 28 Aug 2024 02:22:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=46Lnfa419ba6MwoTBOGTytQvW5UJhrJmfl9dt3uEQ2w=; b=cMmJxmVBtpDvDrCsKjMdL14wJ4 G4mZb0B0Upeh4gmlC2EOfRJwjHFdocV1o099p53dFPgz27ZG1OpJW82njJ2tryg40PGITKo8gqb3n D9PBZSNID5XU0YarAOBfObavKKivnTQ3JLyPFlGmfEktlwXOPCCIcrIjSjLWz40Fhv9JOM+mwkf3+ VZjPs1TxPiA+AxYnGKWdpTlwdzAqmOz8mU8nxfuvFLKFzImazl32LWIBSJVikH+K+DyKIW70akJAR Vv56SRgDhNECQYEf4DmeeW0epM7tITNCzIELCbz4/vhCOCFvKn9OlNkNq7cnUuPY47fMwE+kJSW6U EY7wVPNQ==; Received: from mail-centralusazlp170110009.outbound.protection.outlook.com ([2a01:111:f403:c111::9] helo=DM5PR21CU001.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sj7ph-0000000Azbp-2VnT for linux-arm-kernel@lists.infradead.org; Wed, 28 Aug 2024 01:50:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ULbPfLdxhOHV40Fe5QzjmyNH8i6yr+Hu+UAezKOXCvZNdzgc2olY3nIgh79bvWN9d1Mcpfe1QSi5Yw8eF6WE+DLRnY8+himM+aXfd7uTvljsMYx78nQkS6w+RbM+J2hGkzihl/CXq4jBGqTui5EtolXR1+7VOMUx/Rx4f1mTGB4jv/saCVydXdo8MVZISWh5x4pylV68sGplxIJvLTNRp292fKAwV1zXS5Z0HNZlUGUHDOwn3x3Cb26FFX0NyJA5lkABNCiJgJQEwwIhRhyiM0P+JdsWOTaQ/IzoDqFg221tB7xnz1LNoPC5TJ7uV8H5m1V0DiDyZEdYGYvKzrg5gw== 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=ozEo3c8X0Z8FGJY8m0FAodF911MErVxwE8nSXv5Cj6mxw9UTis1uJaYd3Rly8apCt50LYP4/0VucQgcnNO+Fr+lviJDXByTGKfAXzyFMqlsDjpMJmd0EmJA4lhrvx6mxePn3lINBW8gDdiq9dygxMH/+kSDkcVv8X177rKVb+O6PwWm4bIqQns9AXyOJDh7o5ygrLvvxCU4DZKZ4jOGoMnky6KzMmQ9H5rdQnegWYSdm+Kv5AYbPETQGMle7HBV5N1ddUHjKiT6rioSW1OfRIzKbPbPG+g/AQl8NeNWNL6qalq+I7KhKypnpX12QD0hCv3MCFhrIsrh1cPwSZENSFg== 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=JNNJAMmJ7pPwAnavTcIGMUqDPWqLLSTIAA8POcg/WLS+Ei5+catygwTdyOtbyTmTE4ZxePV13PZNGvKgxAL57UgU6x0k3DP4jrRd6r1uUZo2lM30DLkTEwoBOYc5qyfFmDON+3oU0fy4c8RzQ4QGaM1k6vRVm+zrOND4SVAB2Vc= 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 LV2PR01MB7576.prod.exchangelabs.com (2603:10b6:408:17c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Wed, 28 Aug 2024 01:50:37 +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.021; Wed, 28 Aug 2024 01:50:36 +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 V3 2/4] Force MAPPING_TYPE__IDENTIY for PIE Date: Tue, 27 Aug 2024 19:50:15 -0600 Message-Id: <85c2c76685f9aa55ada3178af8cd109f3dc7b0b0.1724808513.git.scclevenger@os.amperecomputing.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: BY1P220CA0004.NAMP220.PROD.OUTLOOK.COM (2603:10b6:a03:59d::15) To PH7PR01MB8146.prod.exchangelabs.com (2603:10b6:510:2bd::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH7PR01MB8146:EE_|LV2PR01MB7576:EE_ X-MS-Office365-Filtering-Correlation-Id: aa0b6f64-e357-4555-39ca-08dcc703cff2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: blAmYqPBvFFi/7GFz3AF4epkCU8M8cb2G/kUzD7fvfSklY1vQelp05zm0qlVewmcPN09X40FKDbuWgIx/1L2XTgduANMwRnWZker/wPBQT0sYxH6jr1dtEREYlfXrFPphzS+FE/Cssvh+295YSvfRAFW8PwP9rHRq/i7FgQQDNCvaBzRf92U63xc9adIXu/GrBiKKaQR0cOtJyhMowX5Zt1CB0kWmEnZWfwVZE2FszbSdbqkXaAEb/OfoW1iQ/22tfopYEtN/TdKsSFWJS62qCUrp49h8lkt4qlI3gglzDErhUUC4QNu/kC/ySjSMKaAi+fJdnqCHeeRQRtnNXMZJL17PsN3boW6m4ZsRfmUm3QpixzZSnd3G3fKCj5HbvKQ5LvnGQRU2thkcTvV38W7FyQttba58Yc6DbNBvciVEPbopo6rGoYjk/fx97DRm+8DFUQh0DT22Q5TWKyblqJFyhdjaLoT18cTsSndvYIH4+tytyUSDpJIniO1vydy1ZTyUVfp2o5ylLd3/Yi2E5vZNHj4qIuMuKemALpzakbBeCJRMkZS/4qBWW1Sc7IXjMiGwAdSkHC+s9dxEOs8fwLyuIVLEvzI5SbLhF1+V0ZZsiWbN38pBhsq4GRz+E9T25F5fejR2YBMqlUMAR7HsMo8rU9TZAzw0d8Du2Jb0F+NqOVmMoHB0R31qnVHZ8ZhwlqaI5ED+WXTpHWVYaBBHg6CTYIvZxjbHtCXS+AYy1duDDaX79dd1jaPtpri4svB53Ypw1yIUeBqx3at9rS8Bx1W41G/QSE9TbESmYYrwN9fXWzLSHqtMQqv0AuawhBZzdbYTaum/pro9sZHwt7EhAsImwf9Xhy7VeRx179ShgpPsjbqBIbkAfadDnMIyoOSU68uyd/GO4ivOxflHTHr4vBYbE1AvxkCHIzGzbXaDrVtwUs5HDBnkKjD03/BqaXmQo/oDh6fMOWqYykdBN+S02VRFWVsWRNP+BiJKE6pBVSb87dn61e24SeTfNFbtKXXKOiVr6Ug8zXHv6bUUPze9RzJte0fvXDK8rF3JVU4ECX1hKtfGotPpC+wNxmAkGW2wUbJ/8fFHaOiDUvP8zyiLyGSeBUNF75woAOz8y4uFLtO4ENOWi/OJmVigMj1dMA74rTSAqG4nVJmelQbtf9z9v+lCOvFvPcmRso9miKqyfpaawTQRsqayvndfiRCaGt41z0QCibVoj+y+zuFPC8iQQR8oreNxNGBGWKn3I0e+czRczukMd4qxlBITRNYLM/u8CQstxfCy9L8ZACVQt9AJ71Ywn30w9NCWu9hRzMwimky1q0Q1gD7e9AT5dwcbG7/EnE6vk0vP9/IKZ5DlNFpkT+IEd3aMBaX3Q2bgE9miuQYU1m4i5FX5M8COxTXXfUIQHBnP0eeCorc3vbetwxwU4Gi2w== 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)(366016)(376014)(52116014)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: a+GZueBaoi8T4vcgkMrhOKmHqR0PAaZ6hCpENrXMWZtbGY+RCpTdLEJ3XoRI4WzwzM9y+1JbJfVMGuwibWNNPn2GV6BExyBfxuNOQ/g2iCoZ/ST28+kTDfDi5i5QqHHdDuuF71b5vakFN5y97sqo3gBiCEuHv5/S6Ermtd9tn5aNuqW4Us6o6qIsDezl9uwvRfpgJvv1KGA/qqBUNcTlLdiEua26FJSZbxf9oHm4sijyNv18JOK652sZ8jPO3FKfizhymPgaKddfO4PDDVoopK3DLGtzp6aI5R1ielexGK7+a58MdV3IJl2kLwLEzaT1GKDFuFyhUcaFd/JrHqxCe4SvvGp0wY2ZlghDiw7FvoJfvR1slBLU+vGs97ljnSZF9b3nzgQHEAzF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0jJWwjflhS3CK8PHDGQDRKrh9qVBq7TcCf3IeDLT2M2qk6JCoMS8o4bq2oLTnZAriVAV/taroGZ9xs1uwMyoqMGERSshrlitBUBsSGG10jS13oWNobcI9B/3md8nGJF6AeOdrqP0bF+hiELI1aVpzEJ9nD6uT40auXDVAV5UfCudsxx2EEVV0HB7 X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: aa0b6f64-e357-4555-39ca-08dcc703cff2 X-MS-Exchange-CrossTenant-AuthSource: PH7PR01MB8146.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2024 01:50:36.8652 (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: 7dryqFgmLIXynoZLVAdv/wC60E5QYef2ca6RQNGYEHyPvROwZxFhG6q6XiSHSTi20G2sRNgVfg0g36XwhBCmLKFdTi+UKGkGLNdgrn7oDeS3ZIC8RVthV/LGZZGKLXbz X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR01MB7576 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240828_025050_151092_121F4197 X-CRM114-Status: GOOD ( 10.80 ) 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 --- 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_*