From patchwork Mon Sep 9 21:30:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Clevenger X-Patchwork-Id: 13797613 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 6A283ECE57E for ; Mon, 9 Sep 2024 21:34:39 +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=m6EO/gCKOCPsAGmkIPg9ndbPNs PwktfNWcab+RSHFiKQUol6mn9J2fxo3CMPLKZCHJ6P2ygL/PxttwJc697+JPo9zP7UVHJI0yXci9Y TPhbCs6T11MO96l0e5Eueys5QN1UDuRAhcDm/Ywt6aMKyvks/fRxIf5kCjsRXZONkI16kACZ6rxAI nG0x1yPqYZmwGLHODK5oWQm9BJO5R9VpgFjMXKVNfbPVWHzGmG7NYFRr95z+pyAaIXAuBkzRL7byl Byx02mGQHNM88JQJk87YqQweLRCZVoh8HGK8foEFCK5uFssc4QijMlB5IVaEKXk8ReCAdE5eae4dY DpucamEA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1snm1i-00000003NGS-0uNt; Mon, 09 Sep 2024 21:34: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 1snlxp-00000003MpL-3HEF for linux-arm-kernel@lists.infradead.org; Mon, 09 Sep 2024 21:30:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bKPl3+cMTlKpwR011bmjeKjNFCBq1r7ZwXHFwZbFX8N2rM3Kgh16KH4yyNpMe6MgT5BA1KcudthyKSJQvnC9mR4wrDnbbRIR4iRDLRuKWohKRkVZV8UodtcBl6OQfuerxtmTXVtZrBvQLSdqbBe1wgO8dnLU5ZTPEjZXE/YTP3fffZuf3Wq0BmEBao5M3NfjXMTdtLdIJATqB0wlf45cWw2sWP2v+g928xaUIHV6aAZbfGVtI4Le1t68rDsqsW0B4ctNlm4qlvpiLF6YUI2UVkWOb3DNuIf1DvZMLWgUBKOHMROEVUddw4Gh9I70Wpptkd9ZUuxdGJznShAidSvgfA== 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=CLiQxJJE/UxQZ4a0Mxn3ilMjoOnR4STt9C9DyrHGQENa/rvBSV1SUnB1a3ZvoGonkdGLEQXjUlMYk7KN6XvdOfuB4onWwkwe36VKpvTjkzEsYhGYtB42LyzDHAVm3n+F/Whr34xuYlcpm4Y91pIjLM4rh4GlzXA5Cm7QbDMDGaffOupOYOLkytIjEYnlM3nu2G2HElkdnZjnnPwkYAUqKf2Mddiqx7oqxZAI1exP8MBvDPi8FVRbrnqdzxjpqKlZgHso4SxE0lxSqfufLDET2FwqT/N6ct0YkL34YRf1r8Mh3TNoUqHkZfMwCRwR2CxU+VIoleERu4ucTwIwNMww4g== 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=ZSpz2NKfZkZL/ccuVCvo7VsQ65UcHuBXpX+u3Tj3aT1Y6xaGXLc5EhVPx/xV8zle0akcYs8AQM0C6MSF/plNdKuInaf8wtV/gYJW/+ZMXi0+hWtGcLhYpO3M92lnh5BwXW0mDQ3IJf3NBZZaBEvV2eYPa44rxf9LSLbu1a+UKsQ= 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:22 +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:22 +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 1/4] Add dso__is_pie call to identify ELF PIE Date: Mon, 9 Sep 2024 15:30:01 -0600 Message-Id: <18bb5281c3648a67bff61ce44966d3dfd7c09b4f.1725667397.git.scclevenger@os.amperecomputing.com> 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: 9d3235e8-b248-44fa-8429-08dcd1169c43 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: vlSqk8Ac1APLiKJG/bomcLetSWIiGIZtPZJ58fvlw+wWx1SCl9ZQxbNHGCAIIEnpFcF1coU6jzLVfb3EdTq6A6EVpqqagC7J5Zjd98VvfGjJVz9r9/wxiWNPNVb5Z7l3wCl3DI2mguCZ5mI3byoIsnyW1d7zR9rvYap4B+lCSoUvrLjVIYg6M/+sbklYBSpNY66NdsnE63e3B90vCatr8R6gnuHXXNAIxON6U+PYHZa8ONbpSNeTzTnfhEM06jVYyxXutyWvG1KpI+AyYstixemT8ocS+UX7m62yP2syafMivW953nJlb3lODXAmo84Z+UqgywBQGRxR9867dG1IObnC9tem9SPh5naEU/EQswQlxp52HHJJFDPWRigcrmFQjzK3iMOGYzD0lDKhaVonT41FOOQRs/+n60x4QQnF/IX0lO3jSdsx2ub26PLEylOEaeB13/ugP8KceAIlMJp9JNO4k+qWf5uTEJ3VDT98tUol53SoWueD7wlbZVwHETjoVSazmTEBdP2ryg5fvhR+A1+lGCVRZuP5bK8YEX5qJ9KnvDV+yhwSgmIqyq3sC1w7N1qPsSxfjpTmpDw93NLWLoKvpNEBRND+Jq+PV383jOvw200fWTq0XGYK2k3ttKlk9aIPccEmC3nPT2O++GeK3eUoGmk57WkpYMBBAzrXsb1isKLGAAaCw/iAJVDFbmRwt7T58n6rjZBVdhHxrYevlY/zPX/NilSXiYy1hldj8PO4JbdqalizL82+mGmwPn5lXEIOuUcbC79BG+enWkxbwgmjycbf4kXEQHDNYnCPR/wbZofiHEA7xr4RBSRhn42DRl8nPCJMl+/rqf49gcBYR1dtZNrbuIKMktFs3md43Kl2ijIPMQlQTT95gLIKU84gzQAY9+d5zr/o4P+iLC75hOwlZ3fKGlB7pUFL3Oyo4gGYarRrbytFtjL0KCj3F1IcQrzkCbAIXxQT7v8TTLkzQGk1s8AJuoMp1ZZ6U//7P9rULcr2dTkfSo4skOhZ1OkwL7/e78blAA4xGGug1FG2g/16JwEBzbSVFGZH8/VUogFd0VpR5KXfXbyJyXGBU4W/teLG/GY0BAQDCQ8+owineOqeoDERzCjxx682gcHNz2ZBySqu3PysENmeKI3izkTcu2DvYBV9jnz+ikZ2eihfqR7N3rCCzULWjNnGNJKaC2hu03eacWhHBwk7bNknFypw3yNdrM/kqVqk014cth75gX7d6v63o7wqcgEzhTMidzapUynGR3njDYheHz3m0uAMie4aUvsP++ogtqJsM92k09H6T2ST73dmrt6GFSRVOkCC4ZW81oD2Nk42hHZTmYs2ojud0InfWPj7MMmDZb/eNn0n9Mx2PNNpPBdVEhSMAHyqMP09SRfnqFUnumyhVqPdjaM7hJKdecaee1BFWSXUFg== 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: ih3RTh1rp2ITDlbgHz13WQBC7Pao1YE94RNGG7wmyMufKZrynZOVUUY+x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u3lLGixXb9OZeQbFrEsDSPSfCDqXh1c4cEMxaz22tWPqwgnVtmn/GNssj9Rbl6hhYjLk8QbZP+BFrxruMB4BpEpraaXGKx5QUrg36zYUJvxmrvFR+k9VKbzasyJ6QSviCZscp+mh8bIpkVlBN9KhvvR3KgGtYoKVbsH7AP2Dfv+oMyDPwREybhILKEQZ+619/6iNGczuiOQMhyi69XEd5t9COf3W7PE66kJwmUUXsKLSIGSSK989aXuVSneqBAGh/VCRJfRdYo8/9MgRzW+xvfQd4kYuSaAt1p/W9pmu1AlVibtN4MnzmFe3ocKUOsZ7+Tq9ltPSwTqE3Zl4tmmryXy9cVutq401fP/I/cVmHAWwuE7ovULn4C5yFH04tvb2cn5veOMFO6lvdF4hW6NhH0m3+t6fBSrczMJFYBcXx0OA8W1ZkLaivjBVbRiqM+tOG44591krhq38S029OV0ULD0LKmIaQ3TSnngHr96ePGZ1gVrgs4otyQj/sJg8CYJpzUZ/3HxO1 X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9d3235e8-b248-44fa-8429-08dcd1169c43 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:22.2061 (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: vdHEIm0DJHoBaLkBkkayqXp8MZvnwyjanJGGSxWbPLDevC4G3dL/j214oJNY9zCDoRyPyDbzU4yi2959GAhODObFmVkTDET99VmkcY7M+KszXQ6FErmR656ve1ssi6Yo X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR01MB6919 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240909_143025_850743_DB4C554F X-CRM114-Status: GOOD ( 14.43 ) 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 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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qEbVA29QdbJ0rntkx202HmEe+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/Yd2WqGvqa4FGKduzMpUqgEst8knvdnbu9HOzaaC1VEQ6RwaqsqYaBUNshU3T1ZQZoAg/mXb8KLDr0KmUjsf0BiVSY5PZO+e8LEkw4bo/GFIVMM0xX7x8aAp7W66HFy4aGLklLpwGD6ALNfbGdDQ0gRxSJma5uKdAQwO/myyqh3PR/DBNlMoF4RTEtTtVKcoRBbfv81SEGKWFzhQIdxZYgE+mhh7X9XMIzDnRb6yKWCkPak++JsGew5Y/EyyB6r2MLj/1kghBWf/ZXI1bCEkeRO06CaZIAsNxBoOk/ZbV/csxe+RM0dUUv4UUrdIv8wyhn1tGabq55y2A+EGAdv4C2qQm6ooxIotebYFI0xAHNuOk9fXygxSrPEZLUV7VEe5yQbzEW4qQgoxyCLQQ0WPg1Uay7w3Q3YMxxxnwoFSUFzSC3ahGWyvhrAXCoakqm+KFQhRa4AQP2dmAVnhSjldLBVFL10Dt5jmoI0fP3dqKOxqRgrZFkiH4+DS4l1z3gzflyYYWWl2nBBOJnCyBbB6SBhQgdIqAbNns9/vSlVtcc0m5yq5dbJVKGIluygOhAHpt/hrLQ+0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-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_* From patchwork Mon Sep 9 21:29:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Clevenger X-Patchwork-Id: 13797611 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 5DA2EECE589 for ; Mon, 9 Sep 2024 21:32:36 +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=oNpF2r4iUF7M3JTkCcJ1+ovz6i fmAgh+dE1qCL4lpdgKeg8F5ZxOlRfzpRa5qk1l4tPfdn6v659qYP/1ypjcb2tpOKO2Yeb80ny1W5z OObyCNHUYxiiNCazg3YqVzdgWv4PdP1DsrcWe4Atplpi4EguVPc2u7cUZixEYRFZFhe1ULd2aMn7n lptr48c9oUvae9c8wA/vuViRNTuZ0FpmgIOlAbkhrp6Jb1e1o/3EOYHbZrdmfrMVerlDn3zAB5s92 GDlaTXCTAmAieG9Hzn1Ig69k7+u8bB10vqsYwk22qn4rKEPNGdT9pi0n+RDbLfbm/lH+IZ6NQTRN8 td3zsZgw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1snlzk-00000003N1n-3bPe; Mon, 09 Sep 2024 21:32:24 +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 1snlxn-00000003MpL-0Fvu for linux-arm-kernel@lists.infradead.org; Mon, 09 Sep 2024 21:30:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rljFgZTn0AkQwpx00rclzEsXwQEzB6GNfTnNEK6LSwGWF9DaFsRiWSmo9DTXnWUFcJaeCnL7qv0ZQ74zDGct+1e9pRpE3v/PY8NisfOLgB38jzGnk+d3XrHQ14NM1kw2RuMMjiEeyCjMNtYfU7tMIvClu8D56vLlwJ05mW2rNMgTURtc0QuTM3pc190YR2sBtjASUuT/6EITcH/UUdHjaKJ1GORO8wTv5Bk4trt1ovCeoNwnuqVhcLZopFPVGcdJHG2gZ5owiUXxBSdatZymtqYOu38xaOmqcb/V/33AmKc1qcN7nvZRiCLUrBe6sHjI2vdO5xUKDEGxZ8w3U8qb8w== 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=NCSaUwzIQPrB4mPPx20JWL6RrG4rkdZnklxJ8a7ZiIL7SJN8+S/BtQ3gn1SHozArbSL+YWml6x1JZg5T6rt9MhLUDUPZh8kKZE0RpelhyRNyN74t/7+xPMy6w5qQWV1NPiYIY1DG8pvcRf9Xk27jExQKtOKxthfm22FRMa8VYm7EcmtIWNPlxRjYBgnIEpOaQfIR/sFQxZ00Gdypvtj7tSuzYQw0M4Y/P7va/kqxFC1mVyTxs1JyJKi4xPPFlpNAMmvaejYkW9aGyQxwaeaVq0B3t8+HKKPZ0ivhBC5b56QKGuEx2OlnAePgJap9HQVtg1d2no+QyfDjJusasnDwSA== 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=nuT1CG25wJ3a8Yxys3GQV8RdY1OponRee1VO+f4pvB3wO85J/WyMBmh2RgcSqGo7UFqOUwi5EfmJmJH3s5JJhEHG+C86KKZKsnV+KpN5om42axYvONhfDdoclkDVbre9qNya5jbQiwX7jHH7pfOKOIXc97jjOQXZm9fnlTEjWLA= 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:17 +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:17 +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 3/4] Add map pgoff to python dictionary based on MAPPING_TYPE Date: Mon, 9 Sep 2024 15:29:59 -0600 Message-Id: <8ac2631b113ad83553981795bcc509d9c6f55495.1725667397.git.scclevenger@os.amperecomputing.com> 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: f941c3bf-cfde-4ae2-fcd4-08dcd11699a4 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: 2f73kLhrIMsU9H+QpUf/nqm0MPkLTg9JwX9vcApASZ+7viFNCX9g5sFzJLVfylVNMXfIxmUh8L2yjUWnSceMmW5hb2XdyMqQUqDyEQFeXlCvdAakIKwQzPI/9Kt/Kj4UohUoxa1SsUVWWIV7XXhMXHThnzoImp7IPj52ys4nXxqX9UGZs8zRLLcJ1ye+cqkj79bEWkBDAc3JzZfnJKhGgSgjlxZdCS0kRpdsbRnG1+JaDD9wP3NcvBJFKfJoHyPtMaIt5fqTn/x76vx7f/ypy1+unDeN2dOhnFF6i30w+tNUy2kEx2vflFaxsxDtIOO7FXIsvO6l0r5RLdP0yQWW1XCqnsguGjimJrWvd30YWVQRhI6r9xk6oZsAJr2ZLS5HYAdutgneGGxTo2bsf0h/PGPw/bhDxVaCuHYdxGPynlxGlJWTP/8NH7E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angelabs.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: J7gpSRd7KZP3KbuFTvEFtTZKkyUKq3adCE4ksGC4Paq48t7uAP7/utWfGM5JpUlRgI2VSnC5inOgHqB7YqGrQ5OoP9cnAgGjgs+bH6Kqm5NCjzR6zPHNtffBX/9f1WbAZeSUJYZ/EjaAavZwj11qzbt7ikBo192QifvwvvWaWQpA/ESROv+03ZjnNJJBCOQNB6K1t1Dhflo7vgX4yNJjGup9O0SHwpA91XOIJ7EzcTeEwQH77UUwhdeec4Rj3l5KXcztmbadxvUKp5J7nx+Z1liADXRqEan7D/Sk5JbOTH6OpIOyzv7QIHIaWu1DCz29iRTF20MQ5HBygHOwyWgCti2yxttvJtftMozZ+l7/BTORt2mYP5CJ4NRwOHXhFnRleo8tYJTTK0fdMuRgPJtQw7OiKQvFCLN62NMv6nsTA1pH41K0Ppf3YU6I6uq1FSPpjuoql4SU/0NJJJBt77PXo7L3tPRUkHCjtO/gUwWZSYwyIcF7EqIyftV6Ko4dvogShsf2ef7QUtg9VSdaeNpNX0k5n4aUk3c+3UxvpY85sb70MjxToRulWU0O3Ex+ttXxq+5pLVzexj7wRBDi9oyiyvTln0dIvcqiVcQvw4Bw/NaBFmI7/ZwoXupHVIX0kqTiuvpstWhF4NhcWMN9ZIj8YQ4LrbWEQa472vjcRI09rnDGt4EriFzDSFTbj7LYPbxShpmr9mW+ruNSTCDLMMF6Mq7hSMQIx/P+YEYd+uMPtPmZ8xqI5+hUgeoHgKx/nxV1cb6BSDtTTHz3wlKqeJ8+NZsZ0IZKq2B5fYtF+rJ0u8Y6x2EgnL5//IwGTg973TM5zmLCLei+yX1j5/IHiNeuCafTI/fUjW70oNj0t1aqbOyVZkv3GR9K+dfz/Ok8R82Rxm2dcza0P3o4UoGNw2tq1zxs6Fmzyh6VsisRw1sY3YaW9Ln/6AVDcS98hPkE9JmsCmUKpcGTP5cV518A3IGZAMZOEr1NiptWBt1RefiC34GPv0snwDPChkRDUIxav0EtaSkgx2Dh8w+jtWS9xBeNlk5dH9OCue8JS9JlZSc+aEgg7+TAD7BLGIhVo43F2KVeMbWc0bXVZ552RP4EVA3MKh5MVS07b7jZmP2UIWmRvAokfqv+dx66P+uLjdosqStABXiC6Pcde6IdXRhRnyChVIjD7WNSW1J1pFyIBT0pXUw4PTxjWb7MzmFNEIfw/6C84bwE9Eh8JwZZwx3TqVvMe03YoNWlhlnnN93873zA3oXGKS2/1lfJ8N9Sdu60vfW1WUE9fKzBW8HbSPYUIokMk7p0d3tZEGt7gczAGQbY2R0QQPz1lkGJPDn45tuDWEVarEMZpwCOHvads4TAm3tCi/k4Zkv4YdFrIlNv9sJtCbLrcf/QPLMJBaEOAzqlETWb67x4UojpKkejGvYB4ugxjMG/Ts6lCY98mR3djpsPHMBj05+uAudq/ww+UQmsJ33T4kbWtBoXCf87sPZ0YA1n99WQdsLAp71CDUqYhwWS76W9Kj73KBvgyHcD2a/f4vrNSmJLvX774iE5CuCDavykaqGaFazlvYDKJX7QgMiA5mDF7EmXyk3XrqlmFXV11fdeU3Npd7WByygRKUbAyn1j17ct15fF/gOw44xkUvVhub3YvmjJqsHMktOALDUJiNZI X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: f941c3bf-cfde-4ae2-fcd4-08dcd11699a4 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:17.8064 (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: THfXKaeC09GNBn1MffUJq6txHafAmKth0Ncr6mLJv3TrIJy/rGRl8xxkGJOTHAtv8lUmZUs1q7ez0ovunW3yjxJGQS7FaVk3QcX3olBTlDE4wOZ8ViJ433Pr/8FO1JzP X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR01MB6919 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240909_143023_120550_7DAF054F X-CRM114-Status: GOOD ( 11.13 ) 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 Mon Sep 9 21:29:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Steve Clevenger X-Patchwork-Id: 13797610 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 39A12ECE589 for ; Mon, 9 Sep 2024 21:31:42 +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=1DspkEFSv57JVf2Naez3yZOfaGnypSIhtJnIVYOHXKU=; b=slAvape5oFZ2f/dPup1MAQAWDq quLkoJinv7hOho87cxu2o1fJeWOma7ZAEhv2jTzXgb9p1DYLC01AKAUKt9djX1YY3F/Ma1NE3N1ld t4V6p6J4fBgS+jO4Cmy9prKnkjJSG/FfdWnbfEhtmyRLVqANEBeVsDP9qeGi7WrcIOfTgUf0peENZ De26OyH+PRxKUH6W+Kg/DsecOHgREZ8RjWDifdbR804nqYOct5+6mk4czCfFz4So8HHeJNw+aFvSU 92ilY0MrBowMQa9t/JZNBJXlneGVSolci7/51kfuELAzavgfZTxdobS5m8Hll/lWWS9Nskqh7Rg2f idgaBJgw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1snlym-00000003Mtx-242b; Mon, 09 Sep 2024 21:31:24 +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 1snlxl-00000003MpL-2TWZ for linux-arm-kernel@lists.infradead.org; Mon, 09 Sep 2024 21:30:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vmDW6ZPFf/L98xkr79ycWNYlNpycbP6Jzou0X7/19NnAkVMbKbTZlAI2mpR3vFwZyVfsZY8Y65voRCrkLJeK+hNUlxg4ZLqdqn/9yh2KxPpN7V8BMR20jZhKK7tgDT65MIsWoa1H2wXUlXYCSd4Pz27P8gL1f1H6cNaaO/CHbJik7/dY+646HUQMedjd0Irgg6vlJfa/23oz7MISSiqecr4iuZSRC5w780v4BDiF9oleLY3IyLR7JbCfYnUoRLpjnlJjBQDUH9Vd078HoYwDgGDAwzxLPpv19YttHandlgzNgG4Cbn6jkbc4E83pRH+FBCSWqmFVHzGFM9CMV02S3Q== 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=1DspkEFSv57JVf2Naez3yZOfaGnypSIhtJnIVYOHXKU=; b=l2OFXObYJYeuRB3C8AjPI5vVaEFJYwfP9FS4ISWeLByg2etOpKvkDNrisI4YSagR66lV7ItICMva6B1nEjYVRwhDOucAni3RchnbW/2uLJPfIggbyekEUwtoPXTt2ZTj3WyU4VVCn/F80nKFwtgxTvROunae9QT/Uv9ZSBejB3YSgvPAAZePhJ/xYCyHLfkG1QyTW/0yT3oPMnRtpoCzqtGf0kHPDl96BY3/eMVOIQuQeevLjyX07kQCEyGni/P2viXda4Kt1098WvKC8XFDaAb1ObN/vGO4lbcF1PK7R+rGxpN6RUcVZLQJ0gOAHiCZ5Sv2kIll33beld+1Uhq4MA== 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=1DspkEFSv57JVf2Naez3yZOfaGnypSIhtJnIVYOHXKU=; b=I9jBADTk2WrT2912iV+RFPZmATzP4rjIIrGjNZNSLrVlPHPih0VCEa6gE2qg8NG+C9Jx8h2Pf6325FOWfIh9J5wl3JvuLpd+VMD/YQKYj8rSC6TG7JJWt2j3CbVRS+XvT51z4cvRM25aQXtW/DB2iCjQZN4I1Y0iIxpKV1LiFP8= 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:15 +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:15 +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 4/4] Adjust objdump start/end range per map pgoff parameter Date: Mon, 9 Sep 2024 15:29:58 -0600 Message-Id: <6013572cde82955faf0d3a7ef7dcd415ce843c84.1725667397.git.scclevenger@os.amperecomputing.com> 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: 765df24b-9fc8-42a3-0960-08dcd1169839 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: =?utf-8?q?TTudJTRwz8OSKJmejsnDlTI+p/nhumo?= =?utf-8?q?qZfqyfvBvXsFp0UvjL+aV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7if9ciyBWJjqtXWvFQNNsR/zUpklRvgZEJy5jH?= =?utf-8?q?wws2b0YfeFnKCg+CexzxmIo/2sNQvVYmf2piKbkoUvQFl6JWm29LZMb1T76HgNypm?= =?utf-8?q?agkCbzasf0Zf+dKRzKEO39kCV9YGSChPTs5QaZjW2bWeSu2PHkuSi4uML2BCAXhe7?= =?utf-8?q?TJAcAES2j5Ymr12emZcti6txAyOtSGfMOmG9k1sRpiNOLkPypQR0QBYbkbs0aLgIi?= =?utf-8?q?v7nbR7zid1hTRlupgMac4uW6G3b/FeFEO3QBTqdCjCqJeTQjK+hR8pAXb6TOO1lCA?= =?utf-8?q?gQiwjp+aN+EfGR0pkMDpZYF6Gz+T7qoHTZy5OpC99kEAKHZrKtfoekhjB200xWK1W?= =?utf-8?q?gza8BzfjS+lHKe4LqtO0qVzadZhvTtLG74S0ehu4fRaVfWFulkmLKmOyyc/hkHsdj?= =?utf-8?q?DuyW6JHvUAoniFUC0Dx0Yp8u9P3HJ+S+zA=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)(376014)(52116014)(1800799024)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?IVWZh1R7evbi7ntbNG7NGDmr+UIb?= =?utf-8?q?e5nLJuJlDUsci88qc9thuQjFbrx7gmoHem85FPDCCviIn/yLhinDE8yZA/Ul5mdMX?= =?utf-8?q?t9krKZxw/5XBpIGRmwhsn4mYfGyyLBipH5+nbc0p2vZ0BCDVOBGfCVoZ+xOxcbnCy?= =?utf-8?q?Ju/3+PdsDuKG0Rm9/zYu5ssDIhQtKox11/Q1HifP8J6jGfYHwR3Q10ZnPhNsL2b9x?= =?utf-8?q?5UqGsPfOw9yLXC2+8DvPf+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QZ50pxix5jxRsQS42aO2N1R5CUkFrJ/IP?= =?utf-8?q?rln4zSZWlmrWIDHUtig3RBNJRWdfgbCreF7btTlHFUKbNQRSh3lTQo9ZUaa1ivuce?= =?utf-8?q?AgNqmkDQKiR0dmFWUGwRiB6tMXmkhRN0nx4DAG25y46CdyybYamHHlIomA+lWymAa?= =?utf-8?q?GgNArNRIwVGSwTLzEOlbmdUh5ouAmmaq0p/6N6yf4RGfsdlO22OnS+F6EOUMNdnJg?= =?utf-8?q?z70zl6VTS28prgkoqfX+nOUgcz3VxFTDOJNTXS+VL0vnp4h0NKxDXik1qG8Gbjha5?= =?utf-8?q?KKWoTVZ2TeYjhmwIZfsNtojLz3VVY8TZQB3Rt9/CcbW0Ky0zg5QSoyoct9K9v8reX?= =?utf-8?q?YU1BGbfrKZe7FsEztJHAQxoC+aFsAFIwrOoMtXVNjUv4xLakQ/jggutzMQbpq4es0?= =?utf-8?q?v+YQElwXrXIaYdl/86Hrq88DVE4tclWxdq+FMOtzxBHqlstv8cRHvTq09l+AEpwD/?= =?utf-8?q?B0zNGpLpJZu?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 765df24b-9fc8-42a3-0960-08dcd1169839 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:15.5205 (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: Htl05bYsXN3ElLS1pwNLcytADFavW5fw8AxQ4MUdNPzKLq/8WOTKePTG5Nhi0JBw5aYr0hpXkiT5XDmPSGl/gAqQY4cpJKbYkvBjQo6pKYuFiqjwPz0vk8pFw0CDLQTR X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR01MB6919 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240909_143021_662798_66B15539 X-CRM114-Status: GOOD ( 11.49 ) 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. A zero start_addr is filtered to prevent output of dso address range check failures. 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 Reviewed-by: Leo Yan --- .../perf/scripts/python/arm-cs-trace-disasm.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 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..0d97fcf51b91 100755 --- a/tools/perf/scripts/python/arm-cs-trace-disasm.py +++ b/tools/perf/scripts/python/arm-cs-trace-disasm.py @@ -187,6 +187,10 @@ 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") + # check for valid map offset + if (str(map_pgoff) == '[unknown]'): + map_pgoff = 0 cpu = sample["cpu"] ip = sample["ip"] @@ -243,9 +247,11 @@ def process_event(param_dict): # Record for previous sample packet cpu_data[str(cpu) + 'addr'] = addr - # Handle CS_ETM_TRACE_ON packet if start_addr=0 and stop_addr=4 - if (start_addr == 0 and stop_addr == 4): - print("CPU%d: CS_ETM_TRACE_ON packet is inserted" % cpu) + # Filter out zero start_address. Optionally identify CS_ETM_TRACE_ON packet + # if start_addr=0 and stop_addr=4. + if (start_addr == 0): + if ((stop_addr == 4) and (options.verbose == True)): + print("CPU%d: CS_ETM_TRACE_ON packet is inserted" % cpu) return if (start_addr < int(dso_start) or start_addr > int(dso_end)): @@ -262,13 +268,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)