From patchwork Thu Sep 5 00:11:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Clevenger X-Patchwork-Id: 13791559 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 5C299CD4F22 for ; Thu, 5 Sep 2024 00:15:24 +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=CczYGV64tHkLsEMHai885XQdfQ sVKHqtmG/XrAts09wGcG7ZPJVdViB8HSAd6ofKlYuPjExQrF19MTWo5VBao+PcbJtfjQdZgDyAwCK LNgeZjfxRkt9xi3wNiSTI3QSqPqmDc9HON87Aor9MTUqIgVJJ1cRdF38Bi0IxTqkKtrfZiHVdifVo RtJPZvG3Q4jaF3IZFjHqw73nekP2O88HnlkwvLOfb9mA3LN+VZ8e/YTl1jWitfbK+5j3T03mLR7OV DKN5topFqiLXk/+mQi4EtXEzlr4T0OYwi7eW9SRLoueSmGdRt0sXFTq+za9CWwC+3zacVu7XP4lLm SRt5AQig==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sm09Y-00000006Sh4-382N; Thu, 05 Sep 2024 00:15:12 +0000 Received: from mail-centralusazlp170110009.outbound.protection.outlook.com ([2a01:111:f403:c111::9] helo=DM5PR21CU001.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sm06p-00000006SFz-29R3 for linux-arm-kernel@lists.infradead.org; Thu, 05 Sep 2024 00:12:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=X28sH2sNA69e3fHf6nEiz1cTlKqt6z+Qt36yUVOnSr1Dh+qnzLrhySCt02fJyG7rYNA+J1ipKTF6KwCBDKK64bwNQSV3TJL1o17q3tnqsxga+8ohcfFFsQ0iLZmdLpYjx78F05TjibJ+Y0bmi4qv+gotE1eSvBHlnPkamEDoipj2PAag6ipq1LVou0YKgk5QInZSTD8BGtwxjCEASKEBjQ8r2yE/KX5/qw6nFy+pLyn6jli2c91jE/P+PkpqnpPt0mbTYxgg/yMDr8ygWVJ8RblMhN5QvTjRTs35ffUv48+qyHwEPamGNqKTPm7ddj06r6pdRekDz8ZMYuYd3+Iecg== 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=xQmBNdtpc5oKR3Q/+AO9hnkDXG3YwnbfMprHBuwRPRJQi/12+Os0jazJBb9JFWMqdqrPoODmXulXuaM7Yn0TGShb6O6EHbdaDdxoPMu8ZDV8HHnGF9g3XKpab+NkOBYJoZbJGTnqvYEDr9drmTUaiKp7v+iy2OWGlZEYhrg9XTzA5Qdo5aX8kf8V2s+kzmWKrQZ99zW4d05U5LjXRj/Hv6kHHiliJFkPbpW7KFq8Q0HJjF0A6gq9YHAlpP9a6FxUY/wdV0atPAcDjHzJzN7erhOULN7bxiwd+xb+QWrBauDG0vWXfTKzi7KtPK/UdUK+07pyHiIoi6DbaazBt+1Zdg== 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=T7zrAxYp0K7cku5xsnUygSgAmo+9A0Drmewj47MgaccSb/M/ZNfLGV7xNV1dNMmUQCz2eF6FlQxIjHUjgFHdfVK+Pekw+YeWKiV1RmFvcRBc2FR2rOt0+pyT4WUqzk4ghsKtpGtGsNWIY2IxtvgDT9oggztz7Yk0Ar2Rpipt5co= 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 MW6PR01MB8365.prod.exchangelabs.com (2603:10b6:303:248::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.28; Thu, 5 Sep 2024 00:12:14 +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 00:12:12 +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 V6 2/4] Force MAPPING_TYPE__IDENTIY for PIE Date: Wed, 4 Sep 2024 18:11:31 -0600 Message-Id: <47f46f008dad63a8685345fabc2701d50c7b47c3.1725493961.git.scclevenger@os.amperecomputing.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: CH2PR07CA0050.namprd07.prod.outlook.com (2603:10b6:610:5b::24) To PH7PR01MB8146.prod.exchangelabs.com (2603:10b6:510:2bd::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH7PR01MB8146:EE_|MW6PR01MB8365:EE_ X-MS-Office365-Filtering-Correlation-Id: e149bed8-4879-4430-b586-08dccd3f63ad X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|52116014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: qbjio4qo6dTeqA968uKauh+t1RMwvX89zdK9UsuFy5zna6GZvT7NMfO9HsQF7/o07CyHM+n3nkzHExyeT5VBbz0ntEApJewZy3LkDb6D1QCLB4eGzmsToBQep8kMqRWJI04FD2eMEfMf2svTGkdVOYcMh2VDMe3g8ihv4IV4R2GmXGLTOQQi8dFeuviqRLEMp35pfVFCtp0IoKvlfHyWTVl9PCqqzaqt60/oftvCKbKlWlOVTvk5j30eHYsyxdw9eBYNSLri+9iX9hNsvjrP86o9/xdqH/Akvu5dboHc7vbkfKco5lciLqjhUjwF1/ExZ5D0mZmXl8Nr0jaxS+AcoI6WJJtS/qemewgk0qbZE1iiu9d3BUz/ZYLjx/Reni3c1uzEWFBQYAZ6PhjiWoP2qw0XiZY7WIS9029DbetX9s0MEOVbIMWRR7207Vq5vN0rIq1BYGQBwxb3cNJPa7eKeViXb/D2aLk9FYJRoxtU1UtoUVXkaKaztr4ZbequLFiyDVz5Q8eBCGBlW9KSNbC1vE6zvJ2qRoUfBb6qr+KOMnAcMNLsVXztEvuxbG0tz8Ndu7uGilLuZumC7voocsKpKpdYJ9e859S7WlSvaDa6UNmJjl5z4pA5O64NZaXu6bNdeHRDkNYc3pq90SBjMsQg9G0XYA4PDmc/zDuIHcBz61OUVQe5/gxaP/3H1UdYhvo/LDWLYIZGnopO1zsTPcOnWxZ8FGWI7ZHhJin00PTOV1IkMOCSrpYdJexRq82x5zdqxWs/G2Xmc16Vtna5ryGG17gGNqCVgdLl2UIgtG01W8ey1h0P7KXjpU0SnWd3GXZxGn5o5XTaYOuMGwEI6pu+/ETwSGnZlqlGdRilgDqeDaxee6aNGvvbE5MPmZimjG/uMSblpYL8KDOm8JRaGALUs/qNZKIRtnauAAraWMZ5cAi7rB95BGosRcXlUykq/eVYdmzhaqo8K4jplQbciOYEaK9rwSP5q+Yp5y8PrGHvcgdbpfbMPo4lZFI1bzPf7mDuZgAjmxxak82eK+mRwyKvyYyLpgCJJSPlVzYcaunB7TG4fKm5p/4WBT+jh9DM6k1Qp8Yg9mR6ybqqDVBz0j5W/Ayu7EqfodK+Nd0P5sMHSRDUOJJy6mCkxmPltgLAlsXZHMr2uIuYmZc2vuT818StPAav+fs+z7aPpORJsTeN1GRzLKmw9gdmJy6GTKdx4mV5Zj8aIoiyQuLLGQqt4OPAxDzRWbjcxaJyfAv3OHZg305KGksNm55eYCdHLqg8dAraPxU8BBUjPr1b6/V2rrB+/K+MZrsYZmrF0qtkGbuuTy4l0LOQOWvKfcFWHWPsNMfpe2JxwBd/XcSEWRkXAUvPDp/lWAXXNkUcv2pcVYpuvWlqjOGbiRtpByRv7AvcZNIjnKqBge14AQTM7WQzl3Wd4Q== 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)(366016)(52116014)(376014)(1800799024)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: If2X3sOg4qbVagbCP4L6hITaEqCiKv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dVqCMCVYrCAz92x5ieBKypGrFaNmQO8stuABJfog/eR1Kreu+ZNiWf93DTx5sIltZWpCfNmkCJY4j7Nr2RifEV83uBviYH30W01Qw2L84YJzsyct+P50Fws8aArKbAEx3QaHkg9eHY/F3Bjt81jvCnd+Kla7MUt1zZTr5pBqnBDuuEiWFoYFGw6FI809Mqrh2JGlkBWnigNb0tL5XDydHRvjQuVyZXu9khOJbqTzUN+W4ypB4PldhylwRJI1hvLbENq4kxeeyd19hgsjSCcR7zXIb2vgSuoENOa1F/pq5tZ7BW7HdUO/41KLgQedP5aAinhBXEOt5JBlDaSN+f7RauiJzpuD/nvbWGLU8fLMnVvbftBxxQb5UQNswZjxGA+GSSw4AmCbi6iXYqKULoEZ/2BnPU2OIUyIBQCQo0su4KXPb3M5NjpsDLyWe/V08k9VvCeq+awzODIOAwk7sKMsQqByyVWa5DEZMB8p845bZXzPZOYpNa2uFmLAwJId6mn1lpR07J9dcYh0vxZDuNQQ/LFqYzc+c9kZJjyEsROpRvgtOEC585+2 X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: e149bed8-4879-4430-b586-08dccd3f63ad X-MS-Exchange-CrossTenant-AuthSource: PH7PR01MB8146.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2024 00:12:12.0277 (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: DDLe5yquv8u5D4u0Z+Ir37Nznl2dU1nCwNAOqhMbFLgQn9b3EMu5MyRyQF1Ge3LbXgwwoYeY9KUPvcphgG2wgLlZOqsaeROE4aGnC+fi/fhqNvfwqMgkqYAqyRangCIB X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR01MB8365 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240904_171223_812263_AE213366 X-CRM114-Status: GOOD ( 10.58 ) 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_*