From patchwork Thu Sep 5 00:11:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Clevenger X-Patchwork-Id: 13791560 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 F13B0CD4F22 for ; Thu, 5 Sep 2024 00:16:21 +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=y3Z68xW8nOXTyEOcTAZJeJM/P2J92dmdOL3G/97x0/g=; b=QoI+6VwUPZbAITKOFRSU33xXl7 BxGwcfBV2qYkg9CLH6JGpf5mz2w8WE7BEpG6R5+rpfTauuUTuI5bg+MIfGs5fOr4w91lpfTBwsgfn 73cClCkJASNHrT7d4dpZ92cLidlpW+BGWonA3Dbmogb0FAh8SkasUGE+NF8mZZpp8KAmn5YQxjspu BOKixB10mNw+Uy2NnVYUlVqHiU3Fe0I01sdCLMLOJifK15/WmGQaalZcvSH5QL+a97jmIOUnzrfqC S7j0zBtkqYUX4vM2MqRkDP4luViC2NX1exakMnTKvUfX89IXzojTElKCGpzMnU+IZNHkG8MXUjDSG V8wL9UWw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sm0AV-00000006Swo-35mm; Thu, 05 Sep 2024 00:16:11 +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 1sm06r-00000006SFz-1G6c for linux-arm-kernel@lists.infradead.org; Thu, 05 Sep 2024 00:12:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=C5dj34qvGecfwJJAmbmEyOVi86yMOZ4yQZx4XMpiNQksGgYI+W9rH0cNkd8xhBbMkAaFcv85trNDYR7L2q0u94BxgZpowhbhHiIjRdgWPtimddh+9tEyZ0Dl+ODbGSr6wHmZoXj8bPUK6+g615w/xQ9kaxDC0RNo4jwlS9CARQ8NTMwuAVoOpN3UcnMKk4v+o5ak+z7OFml+7Zb7tAzO/dHf6vs2xl1Zi/6+vEIPz/qwQd/DY1sgNbND32xtsMRQIqKDIPJ9OwvN1/97rTO5XxlNwAbFIBVWbKPwegvSbgUaHuq8waeqnlkxM8iCoLBu5cLalwfZxwaSmdO3OSf/og== 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=y3Z68xW8nOXTyEOcTAZJeJM/P2J92dmdOL3G/97x0/g=; b=IqLujuhuI1Zg8PLE9bHDjYF177N/UjqRsVME3kLgTJCnN64pYuNKKKdmXhvYVdAwb8QhDF9PAUnmBnivithjXIgD+yLyi9NhaCC1uQWLxKxWFPqNMIIeHd9u/jrm6oJ25w3LmkaEUKsg3r1WEs7X7K4o93oWlF67oef6wO2aXpWRB/it+RIRR36cHyM/EHZO00e8W5TWBDf3o9FcNsi/DI/24yyYaPBwr11YhuoojEVKysJgirYPSu8YPExzM5rhBvx51txuoRZoU8q9I6XjDFVphUk2EV6hEXE+b03LQ2xA9hvEroxljckEpbOu3Ky3a2xLpEfRFOjyI/S5Mb2IYg== 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=y3Z68xW8nOXTyEOcTAZJeJM/P2J92dmdOL3G/97x0/g=; b=Qr2k9yInUMe5eQydNrNRvtNEqRTrr29+sfvek5xQ8mKV9P0CkHwZ8OvvGuTG5h1B4fgtEHWJncRGB7qge4yyGXLeAzoRjib98bWCKVkyo6PvUMJf6QEOqostj8EJI8NExkETw/B2+FEIBZt5M4MVfeuAQB2j01HkHlrODp+gJS0= 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:14 +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 1/4] Add dso__is_pie call to identify ELF PIE Date: Wed, 4 Sep 2024 18:11:32 -0600 Message-Id: <85d8de9558414879d19bd0c530f94a8002836166.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: b00457f8-59ea-44e8-6259-08dccd3f6518 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: jb6j8aI1kb6zgQSrQg//pmOK7lyXLI2Ah0udNcudKlLa/zfdC+TOckxJzO3CaqBo4H9Pkmlkk4vsRXxomM52zZIWhvsQafd9oSOlkq9/QT4iJiebhyWgwvCkyJXsPaurHuCvOPzoxLput6U/Mjw2TldmPyBhbToS9Iw7oHE/S8ypUBJ7KD7mYtM0AsrTKI74IrL+IA7QyiFnpsDPw51TTkeLP6pxxtQJGLJOMGDgp5w1AQhPiyMgp7+nbnsqJXGchiF4GftbyeaNUW53ea8KguadodZigXUYfqm1m6dd5CC8JTOjDFRsml571cq7qMpV2I4o3kWP7esH5EinaGdc9yiIfqbTb1cXDHJxL17JT+C3Y0iLGro1E3rRBXsn7aJm/RzXf4SfU72wBZhQ8KhEwXwgonY1YMrB5sg9i3Z3qEfvQJbHgcC9VK/946WhW+1Q2gwlx/JT5yvUyghV82SOOiKNntCfyJ30ZFCyb1cM2FIWNHy3vcjOdDv27nRAg8w+F9hPISYlP12Epq+ez8Z7XpPI0Vx2oiqaYkC7Xv5wDqgDOXZDjBj5cp9/+LQdwty2RFVJfI0yeMXaBZtjYiXvcVAHEjPs0H3TA0zyCjulF8e20HIJKBUzzpYlLwA+Q7FMlfMeF1PXsTSTie4X2rPMWp4mOIFQ4XoMRxXRuhUPVTuTgfqf4c8qX5VRDpJH2uy4N1U+wLrqybuFXFFrU7mC2sgcdFrkQo+RVgIhx6KpHv4vwA0bcRIdamrsbuDo3pEi7q8amsudEWmzQGaUw+PCj8J7BQ+HW0KKndXRmTr86Mf59YmPVBPZwY79cAlQlAnyCc8w+03Klh9dWhRq6xceEA9STsnEw6omJisAwapOkWrSXWPyxYb8OiGchLBXU2Q+AhxH/nZfTrDVdUsjeFYfh9G4ud8UtuDFC7J1ClIHgMZibxTp5avWzKW9Oh5Xaxbrz8In6YJzuvUjBL2SbWtbdrDH/RKrVPUMEe1ojDtAOuKsmG8aXcsa7nh5igy1VEOI21HlgtUCMkaRc6rRr4rm80lOWtreFE8m0yWB+Pe8NfZM9FvFqgnCKUkiz2XLw6e1KxmvZkT/5txf/XgP1kAK08QUBn/xPp/hrE4vmDwu3ppYQdY98BCZmzJyKKmSxc+Z6SovvvLLI+inupwSMDVx++8ihvcStswfCtWkQyt8d2sHemSKV/+umcWue6D51exUz24YF2qY129hGNif8uPaM35SeZfvt9Obmw+DG40g4P0b8hQMwc0Y3w3NxKsTv8QjNPYEGg5mpRzWUFpnBwwvosy5UFU+k69pxjTVhw49eauwCxnuYn9ae24mwFFdgcLpOajPYK58tsnnOoUSSydsugToHlUaUCPaP8R67EX1xut2L5Uv9Q0blJd5mL4J1KUZXVrmeUuMfh9AazqOmbE9UA== 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: 7+C+qApnfjGLLFFwZug8LFB+Ef17AjPMbc37N2wCgjswLkhoG//VqC5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T2cggcueOxJDZrn1k+IpvCWsosIpkgmIdUERLEYLzd3nCIlGn1Nzt/fjJm2RoBuXiAhkJ3LsLAoGFBmXgTHo2DunjNt80uIq6uKkKar9+TpIPOcm7MtpGbQQDgDFPB5sEPVgarYtJHC6rpGBQUMW2VBE1jIr8CeE7o0aVpxVKCn007wKZ/738fZ1OE2niBrifJsi1e7palLWh38ZSiXWgN04cX5iH73QeiKAXSiY7kjULB0dYHfjmCblM6Rq8T6vXCjLM2UL0EKtFWhN33y0McH15OKfksFtkfcuPuXZKFfjTvcf2uEPjppAmq3fs1EoQJ7vueVDtQ/k7JxTldQWoh0heY5f6i4GKSl2Ks3Dn5o6wF0uqkZL64EiE1cxa+mNrwvTGAMknN+kXKTQVejHU42d1sY2H7WJ7oPSCEF1f3cD0CsPH21oF5cHZGWSUloh8E/aWHt/wDIS2Vk2pfkYQFClb6p6dNgi8TQPtxRXidtMYla5oiyh6aSSn2In4pWBGqZxTWc7D3 X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: b00457f8-59ea-44e8-6259-08dccd3f6518 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:14.3440 (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: NCvd+ugdMMIRPFPXeCUPDcdYdXk4B219vQeXxtpKf1A2rFmmbHa38sm2/GF0PzK80a50D80GT4Kiz3quFL9a2Pg1ueJFTh0fCuO0CEpn5WUXJgvVjCIVE0bQcPTbqpHH X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR01MB8365 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240904_171225_381727_3EC9F55B X-CRM114-Status: GOOD ( 13.94 ) 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 Add dso__is_pie global to read the .dynamic section DT_FLAGS_1 entry for the DF_1_PIE flag. This identifies position executable code. Signed-off-by: Steve Clevenger Reviewed-by: Leo Yan --- tools/perf/util/symbol-elf.c | 61 ++++++++++++++++++++++++++++++++++++ tools/perf/util/symbol.h | 1 + 2 files changed, 62 insertions(+) diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index e398abfd13a0..babe47976922 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c @@ -662,6 +662,67 @@ static int dso__synthesize_plt_got_symbols(struct dso *dso, Elf *elf, return err; } +/* + * Check dynamic section DT_FLAGS_1 for a Position Independent + * Executable (PIE). + */ +bool dso__is_pie(struct dso *dso) +{ + Elf *elf = NULL; + Elf_Scn *scn = NULL; + GElf_Ehdr ehdr; + GElf_Shdr shdr; + bool is_pie = false; + char dso_path[PATH_MAX]; + int fd = -1; + + if (!dso || (elf_version(EV_CURRENT) == EV_NONE)) + goto exit; // false + + dso__build_id_filename(dso, dso_path, sizeof(dso_path), false); + + fd = open(dso_path, O_RDONLY); + + if (fd < 0) { + pr_debug("%s: cannot read cached %s.\n", __func__, dso_path); + goto exit; // false + } + + elf = elf_begin(fd, ELF_C_READ, NULL); + gelf_getehdr(elf, &ehdr); + + if (ehdr.e_type == ET_DYN) { + Elf_Data *data; + GElf_Dyn *entry; + int n_entries = shdr.sh_size / sizeof(GElf_Dyn); + + scn = elf_section_by_name(elf, &ehdr, &shdr, ".dynamic", NULL); + if (!scn) + goto exit_close; // false + + data = (Elf_Data *) elf_getdata(scn, NULL); + if (!data || !data->d_buf) + goto exit_close; // false + + // check DT_FLAGS_1 + for (int i = 0; i < n_entries; i++) { + entry = ((GElf_Dyn *) data->d_buf) + i; + if (entry->d_tag == DT_FLAGS_1) { + if ((entry->d_un.d_val & DF_1_PIE) != 0) { + is_pie = true; + break; + } + } + } // end for + } + +exit_close: + elf_end(elf); + close(fd); +exit: + return is_pie; +} + /* * We need to check if we have a .dynsym, so that we can handle the * .plt, synthesizing its symbols, that aren't on the symtabs (be it diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h index 3fb5d146d9b1..33ea2596ce31 100644 --- a/tools/perf/util/symbol.h +++ b/tools/perf/util/symbol.h @@ -127,6 +127,7 @@ void dso__insert_symbol(struct dso *dso, struct symbol *sym); void dso__delete_symbol(struct dso *dso, struct symbol *sym); +bool dso__is_pie(struct dso *dso); struct symbol *dso__find_symbol(struct dso *dso, u64 addr); struct symbol *dso__find_symbol_nocache(struct dso *dso, u64 addr); 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+n3nkzHExyeT5V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ZHMr2uIuYmZc2vuT818StPAav+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: If2X3sOg4qbVagbCP4L6hITaEqCiKvecF/wpoljZON2FFxfb8oerYP40avQLkQPQMP7O2EajZkAVSVRtz4kT43/fRMKnBcv+phkNf3mu/Jw8KTcIirXj9QpSKoT48vqLWBbC7lFix1a8cTzvVZslkKcS9myA8NmRRmJHNTjOBLVZ1MIpUBXApg0K6/HnvAYmxmWhrqYfFgxzEgxTjsNAI3k2ctlo1pvuaSM2D6Zi9wuJZuKVKZlt3nz3eEjILtmuqSeCRVV9lg3Y8cWfVUesci2bb26hpSdIb0lX6doCrnCPlUja15KES92BnbMGEc06YaBFaIlAQUPJ7POPSYK5HTIuc9X4T0Q4qhAtGGD5d0hjixRpwGzdPsqMlzD75DU9n6suesptrjIbuXvf/dzVBfUuSiJ3WYMYJ3ca25iNSbaVV2fYsk0E1nSdALYwCojBboXPI1gwCueXgZqqaCosEVaVVZox+UVxvUJgxk4GHp9f4LEz7rwzxzWNr4aMUAQ898Y5VRV69+5wNErJl4Ia9wCzbTSgsOaBXkuBB5xUXrG4LNDeiaQSINNGLTUyNxCMN/i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vgtOEC585+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_* From patchwork Thu Sep 5 00:11:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Clevenger X-Patchwork-Id: 13791558 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 E6B51CD4F4A for ; Thu, 5 Sep 2024 00:14: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=/d8sKDDfqhX0VFAITI+x4NbusmqUD10ZNAfW0BKTdEY=; b=O/h2zOpGqgpfmMVy1UMcsQg6AZ FFp+HRRroZJSau7TJva293TPR3mZcBDydxXp1bsVUty/EwwB2NP3DctAbpiPEzHTPhcNB79O8QxhS uWwvr/KMm2thKGAaQNlJpm5zTcKwHi2rEV9q5oGANlrDbtydFT7tD8l2SNNBIlZ4ys+uDHHKV26QC ZADcYKc9t9d5N1GmWdaNMii+KRbjAidiFEORNPVlnUfe/57Po5t2W+i/T/ZyIwDBCyBCF+PJIR3z8 o9BEYfyKW/vjuc7JThJDMfW55qdT85FShYUjQ7sYTPBE1oEFUXtx9VIK04mTg7F6DE+/Yr/he2RGX JxQfIRVA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sm08d-00000006SRM-1zhs; Thu, 05 Sep 2024 00:14:15 +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 1sm06n-00000006SFz-2YUa for linux-arm-kernel@lists.infradead.org; Thu, 05 Sep 2024 00:12:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Fu2PoUM8fYN2CJehJkJNhG3d6rRlM/eC09DSL5p3kFZWZ+W+ehX2IJ9f4xEtpdNd0BDVZblmtfV64EcfxLRraYCWFuohVtnKe2WJ8vfnaNyGRXpYKobfSbJVnzQN4eONe88sPtC2vXNoM4QWYHKsTpeK9v8f8plWs4XmlTAbrJablkKi3E3Nw9HY4XLBm9q392KUG1hUy1aOXch31166jvLRNBq11CM/p0Xi2+NjYBOfY6JOf0E4+3t0Emtbm6ia9mD/2cejUE/0C1urfH7Vx1+TXqtsA3zul6bk7Pk0s/4PYOCQ3ZGhj5gHmpjfzrqi7ZbOT33Hsjlfmuw4tVBP5w== 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=/d8sKDDfqhX0VFAITI+x4NbusmqUD10ZNAfW0BKTdEY=; b=oc33JS0wVFxuhI8KrWmedbbIEBO1bDTIIb4xV/OFAQaOqv7Squ2JX49q7l8oCpq7xxY+56o6ybHh03RDGnUwUYDGJXeTUJsbiT3CXsxTYAiV6xppddyRoy97nQVa1bVXWqoSAr3YrAm2t8j13vjgU21ZaHmgw7y34GPhOtu80kCFhzbaScvHHNrjl4JdufNiFqLS2JC9r5asxs3bAdR38Sl2aSnCnFOdjymhNbdxDV5z+2n9UWTFXImamq/AYixJ9dcBimRmCsxQtpeuIj4UCp44F662XXsQBWYkCGQVS91Tmrbh5sGjfZo9qr6gDaoYnO+iHJcSOYWRSDzb/Jpyww== 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=/d8sKDDfqhX0VFAITI+x4NbusmqUD10ZNAfW0BKTdEY=; b=B9izC5+4jbTwyqpLY5r7aXRlKP943BxAgdmhQ8YSe5hUGJjQZx+JOQu1xCgrghMr5fwDKIGukGGWpWCGguQI3Z+W+7lB1tY7+XfdbNjLKhYLbrDJ3dwIgbILh6xytSiJfAC/NpgjYvEJpcmdy7P4/JSyaoCBZSc32XvQtzOadiM= 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:09 +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:09 +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 3/4] Add map pgoff to python dictionary based on MAPPING_TYPE Date: Wed, 4 Sep 2024 18:11:30 -0600 Message-Id: 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: 3bf00482-5278-49d8-3acf-08dccd3f624f 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: Z79qwMfny+dAkhd3dVEfhJpJrDYcujer2Uih/Yow1YodGOA4KUp2q/wwl02HCRuwhdaG8Q8Eeo8BFrm9UY6d5gWaHjhe8o6yWSqT2piI3HjREf08UMabXfxgKbFO2GFy2nAb0XgWMLyKtTF/SuGdeADkDqsad6r2lzQjYAQDRYsAzlTZ50s3n67ngc2R6806/ZfUXSFD9PaYbq2e28bsxJPBdr9r4wK+OKM+XbZ96P1v20riQj5keTapam8e/XrbyKSrByrx70UMa5xgKICIMnziP+J5IoS0gm66uSpZ5+zllnzhCu1z+4sXRJsFetZ/f0dUhOk1cHvqTbR5+tprRtIuEMZEjRGw6CPc2pXRPioKlaYAnnYXWcgi6rRojejE5WLROYYIxeANCZfOdjCoIyrdOZ4fjh3Mqdz5zySASS1+v5AF/vizY9eARztkHfdlZmPHlYduIXPUOFG2ianBqyFPlfaaU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016)(52116014)(376014)(1800799024)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: v9Qf2P+ik1a4OlqonBvBkYEe6r9wiuKr1oXXGR55fYh0mIjb/VHSjqEPfX/z7U45k65/xTqxz9Ljst7p5jvdmgUJUvtnCjptoB0HzVQ9skksYAusPkKL/9poN8J4+hVEQ4DOg0oGPyZRZlOokPcyElmvWuDKgWh2g9kZXyUyaMaVmoTKh7X6NyNOLcFNcmBDHqmsN4qNq71bPjrofHzjCbQtkbR8SqdAeWu7v6wX8Oa9kKya219HWLmWeb3cQhsYve+w2WVq/UDJ9qKPaa+DM5O9IOy8JPLOHbBbXHP9SaMLmZRzp+5xktbCrVzzESaYJXX3JuODooSK1yaVvIQeYdmkwB5Rb9W0xxoyN/ttyNXEGFC5r80fvtg94+NIJzKhZQjQh3SjyhODNr8OdnNWxldIlyMn0/x7C2uU/P8m0gpFZisv5/gIxII6F/EcQtDvQMu6VQsSacKavMBAuQr2gBU4+UOedHbzsK/FWrw8cnPYcwDTEblHxgsthh9lDc0u/uaAw4nwzMHu9lxaOHY1OCPAXegSKDp2WRxFbo1y4iM5Y7I/VSbodzVlnMv4uUbhY144WhA7Q91US1OAH2ooXLXay7vu4Y6w9+7284dfgD3iJpXYasj1e0SyVTXjWWBtTb8m3Mghm8/YVstE1Jc08+o6gDOjT7UB+M+FFhPj/JWzqOI3yZSoS1MMP4HTfipRbTzGbVLSQNCvIuuwQZkkl4e4D4CYeVgywx/7012JjZwduJ4e36kPnn37dOisdf4XQooxCi9E2plh1srynihN1rE9ZvamP0X3hDCJUF6lTtRv640UG8HhyHbTVz7KkWHwcSdOZ0nzARRddA2GiGUI8+g8Q0cVSpjA1FYbvp08slZm8nzJK+YQkYe3IHWAbg1/Y2d6Vb4bCu0NaOOVgYNzdjjIfkKBf/bu2bxeY3/y3Pdh/BcsHN/7yKI3PKT2g7wbw0eMWYoNXyDN4sE/cqFIU7OLae/48OhFfajf//4g5C5f7pKrpmn8LuZ+DOsDrNPzM5xIlv80Owux2aFIRKjZXpt3oFb4hnVbwlAA76Wxhtd6EquNHaJctjzjPUbFspoNTiwDHpTm6YY5WM29AlsdQqqOUhR01FqgqioDk3oaPveCgC9xs+/Jald4D4L3XKxehZhiV7z3qrEHbsjYzg456ga++bzTfrfIltpKtpWxuaAYkiuqpxzEXi8L41ich+RB9ODrgLKxTacwSQxvvSMuUL8zjKKM73spjvHLcW66I9MuEk/Raj89s3DyX87a9Tgeem5N7oH5peuZVc728Ir+MSIcmErQmnNEfj7difGDc0R99dkcTVifk0HwjN3jt9xoZxuoKXZYSniefyPpyVhXq80zG2tfWYmy4y0WJrSRFeDtLX5CXN7tKf26QXHX+IsefLgvrTR+nqV6f+YpARqa3J3bZDQnSrwMUAYMTNT4HOE4eUAfHfnxYlGRddpU7XxMF+XRCeSWKXueOSmWktt04akofLR0pyYIhBle81rOZBi0YdzoNADnkpQt/DTSWtvf1Nu9RaoRKQjZ+fn991+WjEJ4aF8bS5aLDB9+NvTzkqdIeK9gNL7fxr6AuZAKT0iLl0U4ltAPqS9sG00/GAdpE4jfYt7H/6TEzuTokbjoBX1zdFWn9gPw9/85Ark/t+ht X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3bf00482-5278-49d8-3acf-08dccd3f624f 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:09.6766 (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: DDv1WyuohRlNn8U1qf2Wfvp/dE4P2GnjeY1E4gdwGUNgAm/70PD9XMo+92fTgN+oll6MTxzY04xV7RFsEGVAHGBZue9JZnGdvtrw3oTJfuhnIpMa+EEYgT/f+IKBJSNE X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR01MB8365 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240904_171221_679848_CA18547E X-CRM114-Status: GOOD ( 10.61 ) 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 Add map_pgoff parameter to python dictionary so it can be seen by the python script, arm-cs-trace-disasm.py. map_pgoff is forced to zero in the dictionary if file type is MAPPING_TYPE__IDENTITY. Otherwise, the map_pgoff value is directly added to the dictionary. Signed-off-by: Steve Clevenger Reviewed-by: Leo Yan --- .../util/scripting-engines/trace-event-python.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c index 6971dd6c231f..7b96504d5406 100644 --- a/tools/perf/util/scripting-engines/trace-event-python.c +++ b/tools/perf/util/scripting-engines/trace-event-python.c @@ -798,7 +798,8 @@ static int set_regs_in_dict(PyObject *dict, static void set_sym_in_dict(PyObject *dict, struct addr_location *al, const char *dso_field, const char *dso_bid_field, const char *dso_map_start, const char *dso_map_end, - const char *sym_field, const char *symoff_field) + const char *sym_field, const char *symoff_field, + const char *map_pgoff) { char sbuild_id[SBUILD_ID_SIZE]; @@ -814,6 +815,12 @@ static void set_sym_in_dict(PyObject *dict, struct addr_location *al, PyLong_FromUnsignedLong(map__start(al->map))); pydict_set_item_string_decref(dict, dso_map_end, PyLong_FromUnsignedLong(map__end(al->map))); + if (al->map->mapping_type == MAPPING_TYPE__DSO) + pydict_set_item_string_decref(dict, map_pgoff, + PyLong_FromUnsignedLongLong(al->map->pgoff)); + else + pydict_set_item_string_decref(dict, map_pgoff, + PyLong_FromUnsignedLongLong(0)); } if (al->sym) { pydict_set_item_string_decref(dict, sym_field, @@ -900,7 +907,7 @@ static PyObject *get_perf_sample_dict(struct perf_sample *sample, pydict_set_item_string_decref(dict, "comm", _PyUnicode_FromString(thread__comm_str(al->thread))); set_sym_in_dict(dict, al, "dso", "dso_bid", "dso_map_start", "dso_map_end", - "symbol", "symoff"); + "symbol", "symoff", "map_pgoff"); pydict_set_item_string_decref(dict, "callchain", callchain); @@ -925,7 +932,7 @@ static PyObject *get_perf_sample_dict(struct perf_sample *sample, PyBool_FromLong(1)); set_sym_in_dict(dict_sample, addr_al, "addr_dso", "addr_dso_bid", "addr_dso_map_start", "addr_dso_map_end", - "addr_symbol", "addr_symoff"); + "addr_symbol", "addr_symoff", "addr_map_pgoff"); } if (sample->flags) From patchwork Thu Sep 5 00:11:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Steve Clevenger X-Patchwork-Id: 13791557 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 D2F68CD4F4A for ; Thu, 5 Sep 2024 00:13:33 +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-Transfer-Encoding:Content-Type: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=3Vde1RhZn4Nnk8Yd4s26pbPnI2jqVYJavvhAarBMb1k=; b=hMkuLwGByz3EwcpVQLoc/Fc4Gh Ugz7bvdIFWS7b32vVh0O5zmBOMimzJuKqsSTRVU5/Os6vlcZCQmJmyYoYZSJz+l/6DZdo2sALQqzw hNxOAUg3bKnYm9frvoPulAIH/3XiQH94tBCdG6opo/oX60KnR5mzBlgto86o0S5Q0csr7t/WKyoeD kC48gN7MuNxqtgMDjqy/axhEEyisxF2sVR2Gh3QPk1Q84V0bzcrSLml0rG+0dum/QVIU6V/SfAH5+ GwayQquI42KSoNqAbdcwZRineCRzYYF8xYcAFZqtsrUShvSo44qqPYMwIqoxOhkyJMydYuEs7CxCY oNjrPbFQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sm07j-00000006SMe-2GC6; Thu, 05 Sep 2024 00:13:19 +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 1sm06l-00000006SFz-3diI for linux-arm-kernel@lists.infradead.org; Thu, 05 Sep 2024 00:12:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=HofWpih6/Wb/90HwQUN5vl1IhBxqGZ8mDTRR/qteaKmOp3YBU+0BGcoVHPNHp1mwDKaUHD1ywlYScBNYROG8dxwx9t6ug68gf3UtzbKiZo5VyU9jOUHj5XumgNdWx9BxdLvVXVXGL6rMe7slA9EsG4n3QcezglikRmDy4LkYnutAD2JVmxG2ii286jkZypE2j+OFQzQqHkmflD8qFaRp5RV04YbA7urEJftBjnzvfPIYXu/7fQye4wGC1m66V+y3ZmCkLjZuBiUQzr6WiCyArhMkSiEVQcbmnUIFBF6oFXxAqwCL8Ik95xWdxb2q+teQx611KkH0xL51lxxQt0vQYw== 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=3Vde1RhZn4Nnk8Yd4s26pbPnI2jqVYJavvhAarBMb1k=; b=weKPsU9LUFKQGqCrsY5yUh1+dZ06wvCG9XyZxzAscT9TidfRYgA0bwjJ9TmORxtwjp4NP+TmGNgyF/yzgZTN+S8ZYUVsC77Fq2ZP/YEfnDi2oswpu+R1xXW57b6se93SPD/eHQdIEwIT+yTcN0Z/qVFmhgU4wLoY/GTMozZIk3V5unavVQVChpmEjsSNvordaj2cX7M+1L4uzVCh+83Suqh8HdeivI2nZKC8veOtvva7g1KGlNgQa+6PLaXGjHUfYYshvZjnvNVSTGdUx0yrMU/h67rkioP1WILnd2byyKDypPNnJ97ax6UZttaRjA6jSX+kgHYH7JSUzT2AgGMG3A== 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=3Vde1RhZn4Nnk8Yd4s26pbPnI2jqVYJavvhAarBMb1k=; b=RkrbwVyNKb2pJVSrRmIpPLvlcmYBBx3NxtEy1TCNv1gWT5ZAgtlsLvcBrN7klSiqt9WkhSmVt5LHh69Or2HaOw/6rVqySjf9Dlt/BtTULITw2gypATXu8HZBe5BlHhu5i+WiJ1aAKkVPD2eaE2OPaUF8iHhIae71Lj0eUKNnMpI= 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:07 +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:07 +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 4/4] Adjust objdump start/end range per map pgoff parameter Date: Wed, 4 Sep 2024 18:11:29 -0600 Message-Id: <110501d82b12ea7909eb7d02899ef60ea42c7e19.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: 51043bb3-635b-4dac-ff2c-08dccd3f60cd 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: =?utf-8?q?Q6z0VwZtaW6bb0q8uHtzqvsgR4AfUmY?= =?utf-8?q?tEdGjSaoP92YnB07hQkuJI3ZMLFym38IkD59NMGoSM4CZPes87wodkDYz19QG3va1?= =?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?k+IUELtZUUM4mPHm2nKJgKh/aeKeXmUspE/LR7IuO23aJCO+b2xCYIrFfhu5TUFo4?= =?utf-8?q?3VILqBWbhvm4Akd3IZgrCN3meSDfHOZtKJzYjrzc3iMIGFG0Xq0d8nUxKorYbvtPX?= =?utf-8?q?YqrtyTzn+X45tApMv+lBcjtJNkG143mUcP4xVa/1XYORIiTKyp0CgdUiCezjmNo5X?= =?utf-8?q?J9JTjVCAES2f556UXfyh28ZbXOzebskDF1ypWyO7NaLGgOASjYuHww39P7M0C2Zi1?= =?utf-8?q?9ZPI3umM0XrdirnoAS5BcFjCcU/R1W0H0gLliGB47lFUpPDlI38PuwU4GNz11A45W?= =?utf-8?q?RzxI/tUSXE5bDOecw7U0U6Xo5ch4dwGq2+Zm+swi/pjeZmdNVPQr8hvdy042E64Oi?= =?utf-8?q?da9h8jvyjE8f5P16L0uVZjrvGwRVI7r9DQ=3D=3D?= 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: =?utf-8?q?IBqMhG96G4oZV6WTSzHQUQv55XlW?= =?utf-8?q?JT13bJdqvTAzlXyQhxDzqZUqipzy5ifQc83O6gZ4uzy0t2R+QvyoYVt24L5TaK+BI?= =?utf-8?q?vRU2hUVmGoaSUaQN4m7f9JvUgQdkPj/C1NikYwwzzLfV3zPbplgA2Mi5SkH54IVs4?= =?utf-8?q?FGWieK8xp3JFpSapRe1h8ZE+TSRZoIMm6KPrL0WfG0g4DkOFxIjsejykVWfXTFPSg?= =?utf-8?q?9papNw4uvF3tKCH2FLMdg0YRAfrIr814S4JGy8jKV0UBabshO7mPQgOG4G3wylm+b?= =?utf-8?q?9O7lTKJ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vZEO5MmFAkvZ/RDBdureUsBTMphT9UJ+0kh0zBMoCFTRYN?= =?utf-8?q?PncrYI9b+79gS1OKkbv14jO37VIpWoSXd9gO3E091JR0LoI/HnXh4HuKe048h3JaB?= =?utf-8?q?KKb0gyaVRjhRyAxQqyRh9/zdyjF5CG1rA703cLDcszlVEbRs4Dep+8f7a0RElHCRl?= =?utf-8?q?+Jqn+6iqsbXBTzDOJ0UZpGMyhxYXLUsgwEz3qdf2O8aGb128VssrXwu3Rb2musEUY?= =?utf-8?q?VhhmGvNq+7hZ3gTL9E77NyDH0nZJiIlc+4+MBD0Jvy0YYxRKXQy5kr1jkYEuoNSqj?= =?utf-8?q?RqYiGbZX5plXHYApvOpCGj1DdrtpAA/py3KquLVQNT1OK9MDezQoDHoLixl9fclmu?= =?utf-8?q?XxGF7n/TqHGGvEtQkL/0lhEJavIK1068ydcbNcjKT4POtVrGxteGe7ExQserEV0+A?= =?utf-8?q?3cqB69sGsnU?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 51043bb3-635b-4dac-ff2c-08dccd3f60cd 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:07.2079 (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: ZpgTQDpSy+jrjlEA4B2WoaujFYv1AOg9iHBIp9rzxOFBONAhkwsB/bPKHzzqRWvFbKOc0vs+6El92oXyi6HYxYKo+s/gtg7M31zan1I0ukqGjZoTS0d1HlMaHeksGe9l X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR01MB8365 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240904_171219_944971_AA354A60 X-CRM114-Status: GOOD ( 11.10 ) 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 Extract map_pgoff parameter from the dictionary, and adjust start/end range passed to objdump based on the value. The start_addr/stop_addr address checks are changed to print a warning only if verbose == True. This script repeatedly sees a zero value passed in for       start_addr = cpu_data[str(cpu) + 'addr'] These zero values are not a new problem. The start_addr/stop_addr warning clutters the instruction trace output, hence this change. Signed-off-by: Steve Clevenger --- tools/perf/scripts/python/arm-cs-trace-disasm.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/perf/scripts/python/arm-cs-trace-disasm.py b/tools/perf/scripts/python/arm-cs-trace-disasm.py index 7aff02d84ffb..35a2ab60ca12 100755 --- a/tools/perf/scripts/python/arm-cs-trace-disasm.py +++ b/tools/perf/scripts/python/arm-cs-trace-disasm.py @@ -187,6 +187,7 @@ def process_event(param_dict): dso_start = get_optional(param_dict, "dso_map_start") dso_end = get_optional(param_dict, "dso_map_end") symbol = get_optional(param_dict, "symbol") + map_pgoff = get_optional(param_dict, "map_pgoff") cpu = sample["cpu"] ip = sample["ip"] @@ -249,11 +250,13 @@ def process_event(param_dict): return if (start_addr < int(dso_start) or start_addr > int(dso_end)): - print("Start address 0x%x is out of range [ 0x%x .. 0x%x ] for dso %s" % (start_addr, int(dso_start), int(dso_end), dso)) + if (options.verbose == True): + print("Start address 0x%x is out of range [ 0x%x .. 0x%x ] for dso %s" % (start_addr, int(dso_start), int(dso_end), dso)) return if (stop_addr < int(dso_start) or stop_addr > int(dso_end)): - print("Stop address 0x%x is out of range [ 0x%x .. 0x%x ] for dso %s" % (stop_addr, int(dso_start), int(dso_end), dso)) + if (options.verbose == True): + print("Stop address 0x%x is out of range [ 0x%x .. 0x%x ] for dso %s" % (stop_addr, int(dso_start), int(dso_end), dso)) return if (options.objdump_name != None): @@ -262,13 +265,14 @@ def process_event(param_dict): # vm_start to zero. if (dso == "[kernel.kallsyms]" or dso_start == 0x400000): dso_vm_start = 0 + map_pgoff = 0 else: dso_vm_start = int(dso_start) dso_fname = get_dso_file_path(dso, dso_bid) if path.exists(dso_fname): - print_disam(dso_fname, dso_vm_start, start_addr, stop_addr) + print_disam(dso_fname, dso_vm_start, start_addr + map_pgoff, stop_addr + map_pgoff) else: - print("Failed to find dso %s for address range [ 0x%x .. 0x%x ]" % (dso, start_addr, stop_addr)) + print("Failed to find dso %s for address range [ 0x%x .. 0x%x ]" % (dso, start_addr + map_pgoff, stop_addr + map_pgoff)) print_srccode(comm, param_dict, sample, symbol, dso)