From patchwork Mon Sep 9 21:30:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Clevenger X-Patchwork-Id: 13797612 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 8364EECE57E for ; Mon, 9 Sep 2024 21:33:40 +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=voJboSyso1CsuOBxJ9PE7dAJAA 9NmV3rfdHnhBA6jbgpcgp2PMGDrJLnfZ/p/l/VxlEzswrB1hw7PPWiI2bTijbjyY6mXsF7pM4GjLg DQFZvYg/W5V9iYZCh6AXs/J6xcJfZndiQbCc4qC7n/byW8Z5qRBnlbj9BElaBsaaGyQzu4QJt78K6 /fckJZGauac2Jd5K5UqtOLVf7XM6BzjGUEogqQjaB/IX8UFNYo+8H8NtSZQByrSbS+R8ONIY+I/AG GsZY2Mn/lUDkdRY0vzoD3yV+rDRZaHDISk6zQh+8IxWOBx5ox9lg+3Wy4XVH9+gnDYlumsY9lge/6 ObRtfLIw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1snm0k-00000003NAO-0EEX; Mon, 09 Sep 2024 21:33:26 +0000 Received: from mail-dm6nam10on20719.outbound.protection.outlook.com ([2a01:111:f400:7e88::719] helo=NAM10-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1snlxo-00000003MpL-1wFR for linux-arm-kernel@lists.infradead.org; Mon, 09 Sep 2024 21:30:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GRKyZ50hb6mxYO723rQHuPRLrhz3GN1+pKHRdIse5X8/l6BzWU7rQ/YOQZqmGBUc4vVG5eOYoJ9EZYP08PDua/nN/ocwDdx7ZYYcNfkkkTk+WRQMn0pKnHBWk68wR1FVHLi172tBDR4Z+XLMYue4oo7OJZ1A7GruvXyken3yQt0XGCGXwwW7bj05+3KsH9RGonEDjTLScIaFhnZFYJVJlc+5TRUC29gCWn32QsrVDrPzLt768zHMjHF/6wqK315NA4z1XFwQNnwJqH4blvgvxYNcANcgR6srsZClXiWYYpOu9qNv2us6fpzw+ozyQgWYM7YOgfVG+uT6HKEUZLOtkA== 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=tbVDYeq09JNIVcX3xyqwtcSunFup/8VWTqgXrpNfOok+AB+1/lyhFsR/yaOewzJTFRY7yaxt8NG3t32Ggd4imr0FJIvx/HfPPvKAdMujw3lfiEbPkPueuUIUnuT/L02YtNfvpXiRq1n3ewbyxOmQx79t2yhlvuRIjr9K+h0akgOZKOMyS8fMzwYgWyVT04IbY3lGkJu08mNbLJNfvQF9TehYyDU1Vr6Db8zLpH3ORH5nf5Zte/cI5GV2gmaB59+GKKfgelywsSodOSko4eAbtqqkKcFDBIc8IE7bRQ6GMZQAgT6Z1OE3b/gw+KxY1P5hh+E6kqJWmGkVrrI0Y243tw== 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=mdX+IivlEbEQG2le6fTmg9gnKvPPXftduu7wyTo3yHrdqQ6t7b8DCfCTJAS+1K09Zjwc243h681FWHtTYv0Fp0q/oUuLf+/pWs7N+RFiq4d+4NsWpyUCCLL0gp39mpGo4o0zVpKVAv0TlfSMQO9W4XHOLN7BOaZraOlHJFCYKR0= 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 DM8PR01MB6919.prod.exchangelabs.com (2603:10b6:8:14::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.24; Mon, 9 Sep 2024 21:30:20 +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; Mon, 9 Sep 2024 21:30:20 +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 V8 2/4] Force MAPPING_TYPE__IDENTIY for PIE Date: Mon, 9 Sep 2024 15:30:00 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: CH3P220CA0010.NAMP220.PROD.OUTLOOK.COM (2603:10b6:610:1e8::20) To PH7PR01MB8146.prod.exchangelabs.com (2603:10b6:510:2bd::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH7PR01MB8146:EE_|DM8PR01MB6919:EE_ X-MS-Office365-Filtering-Correlation-Id: 9d484c30-cf86-429b-8982-08dcd1169ac5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: IUryjpbGXROCkyT4qFzAqJsl454NfAD9+NljWYUQrp8+/ylkhcrkX4RoUv0qAHWUhXyhQdjfRC15X1xe3v3xaXmi5A81m5hR2q2DaQzV9+xc/yeNEZxPcwKMFmkgKaRKQpkucgBmD/neuJ20qtfNvx/ME2nL8cKYyXfa/2PvcoyFnc4fTtFVuvjOoQKrfYsobVebB5wU+zHT92XcEggwgnAUnzimMp4DRLt4F31PBzbyU1bhiSXxf80xiB2AGOGaw1STAjX0zHz5B9NkakZKaPcGpHcYAxpIIW9XOZVHhiWRDL1gUfvqruf2x1dV+gxD9LAqejgWsAdKZjAZJuZEIrya6FxegZEHumPe1LxGPYBu4oNd0WJyLh+r4UrbGwpFpTVmtnH5AVAaalAW8u6U1pxYRw1v/ymOelOxi+N0bYIRdky1X4mXLc9ZeQLDdhMAurjtRd6J0IwFzD2cjFa69Y9AQJGedHampIlCCznLuohsBs+z6HlfFaCjD7Jtm5NpiAM9ZLgJhkdpDCtsFfoL/zS2EHhMBsYXkJEpujpbg9I913sB3be5r03ARS42Nr+fW5rmbvQJBBaIhOHK/I11D45q8koAU8cGwCuqC5e3jFhbQQ0awgLgM1MdKOxAycWjKLs/qtK5fj0/c5oBtwc0OTOVA/EMqHZaXE1dh1MGf+LvvtHazN+FEp0IuQcUSRjBayABtiL85CnsLuk3a0weyy9gNhlBGdj8XNFNxO7p4WNN4iWzy8lzzcN21PXI2xbPKMj6U3u3z4hrUq1d3fyM3ljnjKhEPeY4SsSp/kyEk/R/yAXxGmTazA+WK0nuAe0MR6M+W3aNPt+7prNpvy1UUcfN0CHJsbjHPljhd5SI0TXnCufOP0gu8qKFQRb+kgI0e5Yl11N+BjMlq2x8sL8hYR3Ex6+5ibB2Uci8VK5gRcobZDuXH8ag6SnIFrHo17oyjNpz1BNA23z3lVSB8XjFdI/IIEZnSIDidaQV8SfykSLxXRmTKW30N8CbDnRKyXsu1t9GgQYzARyTyd0J/oVApjPzq1+8xGyLChYbLpDGRZcXA7Cj9/009p80aB1Mn+LT3OT4odRMFD4zMM+mnL7BZznr4h6zyQXoals10JbzTFIAkh5+Qreu8T8JRqtDjrk77aXn3iP/9vVBqkecuIJBFa4o0JA4O3wHyd3h9updlXKuC8V0c3a9RkZaG/uvPSl41V+dqEbVA29QdbJ0rntkx202HmEe+zsmMM0ShdWOsblLQ9/set0AdkqofEnfBps0H1gTG0fFzohEnuxfbi+b0ae7eNhrbP3Y5NLNtkVErMExRKiJAFoHNWcuPv58LZasROmVjgE2eh4Yj3D+Cw1erlUPtmk+hUjw5OLRhcyroUlewSL660NE6X2nxTpqVbyibqJ2xJ2iSBfv6jHKaVvYGw== 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)(376014)(52116014)(1800799024)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mMeIgkfrXjqs74XmzcXg8RsSY71tGT1F7m+gHZRIj1hDIwv8pjR/Yd2WqGvqa4FGKduzMpUqgEst8knvdnbu9HOzaaC1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E5L4xE6fuhReQFrCR1pLxraMntg94f3I5sjGKlk179dZMNYaOsuofdaoQ7ovFOCbep3F9k+RXmn2eReVY1w6UEsN/nS2x3/j0VB0R14opb6HqdwYAEtIkObaxGVHJqZeVzRJdC5xBLTo0U89gLqkCCoKwi+flnNP/uEPCwCHGwlTwABk9BClkeSjNYV9MO2UqgCtUPPoIJOsD4cOsYxpdJ0G5TO9ogRLgqygLNJjUzar0TMTRdMlFI/FjWs3GxshtviJqlcRNOMk/ISu2KqQq0RRywPXFMI5DWYxoOBloj1VpocSh6Upez/Mycys/qDDbLHZ/h3/0+w+8iPO83x6Qgn4aONX2jFdtLL2eyOkA7+zrcXSPWrhGSiysopIY+oey1jasYxrku99xXGIMgthdNelaMS1fxi8Qaef8Ia3B1Vcuxej/rJt3ydjKlW1aU4mckX9BPGvVNKSFWx0Ar8bEhYUE7CcG+dQ5qZs7xB8H7hiDpItOMHSWkOljMLw4LauErAdixLC X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9d484c30-cf86-429b-8982-08dcd1169ac5 X-MS-Exchange-CrossTenant-AuthSource: PH7PR01MB8146.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Sep 2024 21:30:19.7697 (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: 46AZ1sPm7A70AzYTIXHh0eOY4WdXO6wDkgNzxipKc0j2zPF9EE/kA/NJgA3PkvqMiUFmYSdQGFIJIdYt+jhmIuWPXYQsYVIp6dT0d0bWvFfmlmFLXuWhj1wmTZKvif7M X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR01MB6919 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240909_143024_529839_A1728677 X-CRM114-Status: GOOD ( 10.96 ) 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_*