From patchwork Thu Sep 5 22:28:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Clevenger X-Patchwork-Id: 13793045 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 80FB3CE7AA1 for ; Thu, 5 Sep 2024 22:32:02 +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=SiE8twlbfqyo2soIykexS6EUqxRW3kdCuY5H08Ox//w=; b=pO0NTPIHmsanV5EZ4FZRPSX9xU +Ew/GVE/sRIvitTU75Cr8nRHYfXVzrwjY/jf44m6OeOCVpjvBylNJzBl51E0PPG8cpARTIj4njqf3 6B7Th9FrwnGK6bE8gUipEbHG5SP8O/mXs1rmp7MSpf0H68PYmM4V0sgpQ5na7N7IzNrc71b3kXHaL U6uarYVtdJ+UPV+l6SeBNhTpViTpW4zg4ZWrS+gtXD+QkGV0y9zPCK9Uo43MpOffve8AgxPEoye1f EhA5kPphAxqT5LNps1GGRN37jgLKpNIMSmCLFCKfYm3N6dX6Jzm0p4hgHoSuwyRrN52SoDIn/sldH DpLIRuDA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smL15-0000000A1cf-09jI; Thu, 05 Sep 2024 22:31:51 +0000 Received: from mail-eastusazlp170100000.outbound.protection.outlook.com ([2a01:111:f403:c101::] helo=BL2PR02CU003.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smKyJ-0000000A1JA-13tj for linux-arm-kernel@lists.infradead.org; Thu, 05 Sep 2024 22:29:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kbP7iY2jxCBhM83E7PK0F1laItyNq9FtcEdGrILIAiPj8e25ZqfKvV7cXNBAxgk9QBwcqH/W2hGt/dH9wI5DklO91jxK98OSulmveAi8vNnrQNdBATSMnqeUpkj7IEeHGDnsXruMAcz3ngKO+Z0Wb6QMZWXWLpLdn9UfBo7J4phizTe8WreCnGy+9HvpZ6IZzUSouvYRoNG+RCFJ51EJEdbEAq0QF4KzNPbtBlXL2Bivg9P1nfaWmmzWyCj2nagn33Cx37L6BZvLVBy/KFCv5qtqm8seTzPJ9s5a+2FB0CVNwK7ETxYRO/yPLNRG10mqocXr64mmWbC5conLwQILaw== 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=SiE8twlbfqyo2soIykexS6EUqxRW3kdCuY5H08Ox//w=; b=HYfSV/viRV+kzYDOGUwfLEU5xYB+cUJhPrAhdnZztJ1Uw8vmJkyJJq/+a3rsujJOqieMdHL/IKTJw+/Da466EofaTABzRMgCIU3JvAJ8kbUmv5c92DW+LNHQpiWxI6GOToAI+0dJ1nBOC/4XnnS66U5zPkXCr4Qo4M6sjJkE4Gfjb1DkSh60KHu0TwIJFIR8AYvTRlchMWP16kYQC+Y4okA63boRuwmeanfLrjw2wMc/JNJAcKK3YiAdKCPQwNlhQE6iiJPXRPw/c/0DWcBzT15aZzhaAGf0iCSOeS9iNuBv6OA7QdVOHpt1JY0EYfsat6N2ZNEIvYIgQ9tl8D41GA== 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=SiE8twlbfqyo2soIykexS6EUqxRW3kdCuY5H08Ox//w=; b=PZ4+09JsXr9ncdkpY29H3aVPLmFL/n2x6AqVEUYWamf0KggGu2ukL5K0RkmvVCShydUl+ILRZtdNTA/iKtFFbm5n82MEjWXMJjao6XpyFV3vzqCuGK5twJCefFkCTB5SWUAWXFP8AO8Fvw1uLiZZIslHDeHvFYsuS+0LSIC1Xuc= 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 PH0PR01MB6501.prod.exchangelabs.com (2603:10b6:510:15::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.27; Thu, 5 Sep 2024 22:28:46 +0000 Received: from PH7PR01MB8146.prod.exchangelabs.com ([fe80::2972:642:93d1:e9d4]) by PH7PR01MB8146.prod.exchangelabs.com ([fe80::2972:642:93d1:e9d4%5]) with mapi id 15.20.7918.024; Thu, 5 Sep 2024 22:28:46 +0000 From: Steve Clevenger To: leo.yan@arm.com, james.clark@linaro.org, mike.leach@linaro.org Cc: suzuki.poulose@arm.com, ilkka@os.amperecomputing.com, coresight@lists.linaro.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH V7 2/4] Force MAPPING_TYPE__IDENTIY for PIE Date: Thu, 5 Sep 2024 16:28:27 -0600 Message-Id: <2a1fd852366c82249c59dbcb878b0517ca2aeed9.1725573309.git.scclevenger@os.amperecomputing.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: CH2PR18CA0056.namprd18.prod.outlook.com (2603:10b6:610:55::36) To PH7PR01MB8146.prod.exchangelabs.com (2603:10b6:510:2bd::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH7PR01MB8146:EE_|PH0PR01MB6501:EE_ X-MS-Office365-Filtering-Correlation-Id: a46516ab-68b1-46c9-c696-08dccdfa1afb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|52116014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: Io124GGfoLe3m0qNAWwSKaG+cnCipNu7QWsFZvQ77Gi8Xgjoej9RIYPWG6FdY1hyDfmc3mZJX9kT1y9hCjPpEOk+tZbarylYqroApaCjj+2HhJpW38KSuCej+yBGUE8zWdDLr+m6bFQmuozzINzqsHUExFHkpIZ3wRgRs2X91ssoFvuk4+R4vw95hMpY8MPGF+2sUy8BE9ZOxtm+x+V9L3ARQIMXHVR3qXGHNppq5HEWhojT51SJKsUrmubHoCyqRV7LQB5VrfP2CPhMhB4YKaSxiGVg+GnBS/DG3HDI2kMn2sZduDY1UtVyJtg0w+ygnCpvRy/vZLrrMcJhcsMRA1lRO5urXfmlw/lVUrmJay0ZfPHwgQzOWQl3vPvOlNZ2/W8juf2/xrITbt0xqdyd3S9ZgyXYTVJcX6Bd6wHaGqigh9Z1yHb9ZhZf9funKL+nhg2cy5Q7E0umBcWOS5AI5fxOZEtXcI2WFUP/l/5e7CHbDTgNgoIwzAu6HObzVtdTmLHvtuoPAAHZWGZhv/YLG3BC3vb2MFoGhcqpTmSIjX6yAJ1tLTNObMbdyv+jLZAM5HvBVq7RAZmKaAm+ot1XLuAv17n2iXU9ARKPIN1TH40GNvPVaHBkPi0NnU1rVXeaKNVYk83Vr9iJGcjA8Q2ykXLVgPYjGW6N0tcoNHW4m5quHHtqsvXH93tmi/TqAqysVunJwPLOoV/Y24YVLS3n7oreUrgEerqOVE8p4b1UOBoJXblTnqsndVxEZ00lOYZWGrCXrNYLMuUgLxjvS4+Wo/FKEWlt0TXHGavA/Ofk9hCMS55IjktLju2t3qhkVxqH2IfW3UM+m7iszq03dNw5URHWEkcjKQwKVumxFLMDEeX6n78TPiV8FjwR79RMr25BaFp9a+hCtPduIK3uj7hEHJsJ0XQJpYXOjF09fCfoSzwJr0qITdGKvfxPiop8WdeKmEmtHfHyoq+R8LZ6dA1oPQjKlX/cxAzqpKDfSYFAf1JiHgptGgaFiTGYZKlcen9ZnHA9LiGObyq3onHQaSSXuTagOxm4BXrGlk7h6BPq5Gd5xT+tXblbm6lvmTwbwdGbELj13p4gbPKTRf2cvV43F4MaLncrRhQc8VG+JdVkX8dVuB6ZmQv2CCVmbJhi1Y87J4GOUsLb5EdwUPa4LX7pzd24CIPGJD26EM6PlnKz2biKys6lIf5WGLkBh8LdtnygLZYAIcmIo9oC7VSJp/K5ed+xA3cSjGXlJHgXGAeTR+F/96cdNObXfPEgsLYVEo2MJqHyxG6knJP+28j0mji5I5MOVsMHHoPHu9SGgUhzUOi7PxnPD4jnW2bfs7fPDeGVAyxjL4DBC/j8zRdvTjbGG6jK8BtMvPQcbd1LAoBjZOPsNvUc4PWUx/O9XXAkymy1URnWBsk+tfA9r33wVIkT2w== 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)(376014)(52116014)(366016)(1800799024)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ep9sRKIlCpXBtXByhIS9i4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ct0dqATMC9L7bVOJaRHUkQvSnBurCwy2YC3ENKVkJH32/DcvWlajj7Ro/14jS/wbgRQqWfz6ulGBBnooM11FpAfC5BG9w1VEo4KCrTFZJDwgeYvc4oGS4B1LlvK+5LPIYef2BgL9pLx7qOHRrB+roAIfPEWI0Jk6x6rlvyv/mqN+G/n7Xu85nWZIUEZv2vFLZTjCq8ZYO2vzJgc7DufqwHhk+k6A9c+jt/5FYj1OC1Efk+9sjCqMpJNzS3x7HamyjlQ5SkVsUPmY1ugytq35ZpRRJGu1Xyo9xHU4+VVjGL6zfvT3c9uGwy3+UhjIAn8dHkXP2kmTnqSv726oeKgjLE7cljD+sHgGxktiHaR3KkrmTsHMX+De578S/m08mmJG2aN0QfhvPQql3NwWR3O9WwjbEdCKq5vSocsnho6IsgefGLTddyjH57FAy0JgJKitjKjcaXxV6HFnAbH5KBG9QGYq/N5LXkOrl6+XzmwYiPpa2lI7f3ltUJhWV7bucjfUKVRPu0uDeIIBk65xKlLQSOU89HtKg+3Q4S/CtIekb+tY/we3JdKL1o3Oy0nt1lkuRoUpPUgjhHY9m X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: a46516ab-68b1-46c9-c696-08dccdfa1afb X-MS-Exchange-CrossTenant-AuthSource: PH7PR01MB8146.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2024 22:28:45.9734 (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: jtJTY7IHsOxF4fbtzX9owi3Av9g0U6gDxmH/0vxodtsdq2eDtBTwHLlw82nvNM9DOi6R5AEzGq3gIix4VSe+Dx6X9gBYnhvtXGAI8Y6IL1zCIAWa0eHbSXWGmr65B+fC X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB6501 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240905_152859_310435_E491AA2E X-CRM114-Status: GOOD ( 10.65 ) 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_*