From patchwork Wed Aug 28 05:09:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Clevenger X-Patchwork-Id: 13780570 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 9D9DDC5472D for ; Wed, 28 Aug 2024 05:13:52 +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=EHWC+SfKQZU4x5+3U1K0Xq7drTMGvU/j7ZyAQp0cv5g=; b=uR9ij0s1UgAW3YWg38hQc+apIy 46nKy2a/AegvrEy0fBkI2E4wOZEAAXDmtZ5TemNKBVUVMDEs83EQOWHoCtqmIGrWqEbWzXyKOAskq MqDAOjwWV6GgsEUlo9ka2kps9uSLtdyQbUWpEtV7LIH4RFCaALHcaGEI2cQAxTG3tOQ66ESTMG6+e hov7050ULvtizV10pLeJSGa/2fl56C7P2HbI2DEmOG+Ekc5bm8XHtlxjGHXq2Nn9aejbKZgQb35S0 G7ZiNT2HMPMjo2BqhW3lLKIEbVQkoegRg8jCacfeY3O36XqjW5/mtv6eRmF0Ftct0jUpxZwpUIjQG naUaICbw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjB04-0000000Dsl4-0wav; Wed, 28 Aug 2024 05:13:44 +0000 Received: from mail-northcentralusazlp170100001.outbound.protection.outlook.com ([2a01:111:f403:c105::1] helo=CH1PR05CU001.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjAwY-0000000DrsB-3CUH for linux-arm-kernel@lists.infradead.org; Wed, 28 Aug 2024 05:10:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KnSpxULxQU04Lhdel1icBO3fnbwnkeDyJALl9kcYWaIq8d4ZXnUZo+ELN4tHlLyBQPa/+ZaGafbnajXLTCsJrwT3ht3FYC8SDSJsjunKc56V4IAV9wjvnjyXWKotf3TZJQ0/AJBFeePwXZYwP5eUMC5kBvTrSbNTh12XqewAKGPLMbs1vdBDduXepIRxm2NKOZ53Eivs0TqnOwHNNFS3c6reWg8u02QlhfV0v200l0bcu9LYqYBK9iVOhn0/79ZgH/9+59iBarjTfGATJ7tjkG4TQGFmjvuDJ3KqaTHstb6TZcoB6Z7FxXjCaBwb2qWs6XYScuWDXcmrNy6Jp2DWoQ== 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=EHWC+SfKQZU4x5+3U1K0Xq7drTMGvU/j7ZyAQp0cv5g=; b=v19gHaufx57UihNPjfk0U2zCVdXpU+YR+tgmJIwQBn0G2o1aT27mvCvwWVjg1k/ex/N0jXptidM5hv7l0dV0GtIg2vkhkqciIo6/v4cf52tVDpExdNBF5zcdDCjrLhFrOvAx1IQ2tO6t7YIUsClUXIlDUcELYvYV51fTiLL27gR/6SRwAOHUEQPwWzKd/yVnNWnBKX3wvw2Rr3orr2SRgbRDbV8IysQaLE1iVgOX2faDv7lilqFqbmIfIPrKqffP3HRnfF7grO69O1AbsbauFntfJBHhH6a2RmCNnQZaOmxpscg7McWWE0WN8i9qQaxesBQwWLfIkf4caOValROeng== 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=EHWC+SfKQZU4x5+3U1K0Xq7drTMGvU/j7ZyAQp0cv5g=; b=Fa8/ZLBRZbXBP1ljds9Ueq4ph+uSBWjvUEQrx8b7Pd7mPHP7GlcK6ImtJdYZwKGO8O6Jmk4gJKnb5GxosB6zaZK4Qoqp/qlIlPgxZ3Iggqrc0WwUR3w0KEKK7kvGIy9o/hQUS1OPL7TsYKfzD+1AmKT0uWNHGar+iMllNEuNb10= 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 SA0PR01MB6506.prod.exchangelabs.com (2603:10b6:806:eb::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.25; Wed, 28 Aug 2024 05:10:01 +0000 Received: from PH7PR01MB8146.prod.exchangelabs.com ([fe80::2972:642:93d1:e9d4]) by PH7PR01MB8146.prod.exchangelabs.com ([fe80::2972:642:93d1:e9d4%4]) with mapi id 15.20.7897.027; Wed, 28 Aug 2024 05:10:01 +0000 From: Steve Clevenger To: james.clark@linaro.org, mike.leach@linaro.org Cc: suzuki.poulose@arm.com, leo.yan@arm.com, ilkka@os.amperecomputing.com, coresight@lists.linaro.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH V4 1/4] Add dso__is_pie call to identify ELF PIE Date: Tue, 27 Aug 2024 23:09:39 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: CH5PR04CA0011.namprd04.prod.outlook.com (2603:10b6:610:1f4::27) To PH7PR01MB8146.prod.exchangelabs.com (2603:10b6:510:2bd::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH7PR01MB8146:EE_|SA0PR01MB6506:EE_ X-MS-Office365-Filtering-Correlation-Id: de0197e3-90ad-418a-50bc-08dcc71fab63 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|52116014|376014|366016|38350700014; X-Microsoft-Antispam-Message-Info: /Ywn61PDdEn9+TEnlWSwmvwKHCZFk7Yod81kWNQq4v5dJ0aNz/xTlugO/clKymUKNr8PYHVabQhA5H+06iSLiSgZlweiJI4VKAsnjJbs5JOcCQmjKjASVSf1JQTOyyHv1XaUWKJkgk7tj5aYQHY9dIDV3QT1cpdezw5DZ0tYx1MK7M5MHTGEXSBknilNNFQPDkFL01YlnqlMCl8EHANLKdM+zNYHW2G6tqIvGQF5GSP25q9WtZz3DtwynlBiptbcUOqZ+5D1B6rp4lZ5bMUgEItteWZFterVlYvzqX/IN/JS+xDRktnE15AsczVZxg6fOU01yWlTECDxPEpFPAvbUaz9/23yRRazJcbY8zkdvRAJoDHmKFKoXVmOfUN78GSf98AY1TbmwUjXhoBjUCdCIdq/5yi5RppJ1AwKAjxpOURYXk9SbkwuxfReSxVQ8o913C9zGfrK/f1jo0KVcXpNeCrCG23GaYujK1tgp8PXr0k1HwChHCgA3ydh0XXYBtx+xdDqRKX1X+iU4k47MtTeobk8hrHOjg+b4OdLeeuwmlRpv5Tx9UjIGeAOra3HrgxtX9Cujt819HIXIaJ1FXb9zgEtwSTHfP7JHiHblJAzFeN6FwyRPhdMuvFOjk42sgoIm9+I6cgG67UyT+hLzs3BgFiigFBvIxT54EVck+XdLp/r6rfH9qrNELVQ01M45mcrOghqYiqbiwrrmvcmCP44Nl1vpR3dL5uCP/vEI/GNWibTntTQOQCp1DaUS/AfTsQCCwdTIEYd5j4m+uQhYFZFvsierqL/Li5tap593O0CsO0KfIVfof8+OG/k6sxMfSx6m+K+hXiMYyrsJoWC715667qimYzHhnOfEjPMHkXzlmrHF9VgVnboejtjiIK5xDSZ4o5FDQlhziCyvhJL/8ebXL3QmS65vuigSvfEfykyeuS4AOE5OnpvLhuW3/jipkOrJ7xHeWcwIcabVQpwziRzyCGI+dXFr28FHNpkeM1GQxrcfbxg+y5t0phci/RnYaN7FFgjYc1WWEKxJ/LGFUYeLrJm6f//A71Jr5RLcBWNmad8DjosgyiIVC5RRwFi2v8qT+fWzXvxeYCGNRcU4I1eTM6PMyqVy95tmwYHuttQSmF/BlBkaOdLUKvz7D4tktaHnUlUa7p6+T7xnN13OOihPsHYOmuPInuwZgQYrux18jE7WOfhKOATdOaB9CYGYqVMzRPUttF7m6QANNv/p/m9XDj4vhwSAdqXuyDmjHvBBYqg8/G5LgSFmqduqgOdCvZGDO7YkSdBXnAOGSco04o84MytICNrlrIpYyqleFlSxznLL0U/GB2rBc94WalZFCb5W4ayatLgvsGsEjKksl/nINpF7R926ijskiQcZ8ykoCgeO6iinJSjDMF4QUL+qdVOwsvTBwPk9emeTtprSfZ0vQ== 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)(1800799024)(52116014)(376014)(366016)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: bDmVN00Kqk+JX7RK6z3VR+erYmQu6n27RaADqsNj51MAtjxycsws6XywB3ZKVvwN6ESded2ldkJStMcyVAZQB7asal52Z+SfTfDKEnI+l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ItMHBIT2mQelJbFHEr6fTOyqXzt10vR3DYQkfXDmDcrQIfeh9r9dPWdhe+BBt1CUe1yuL616x7WIFIeJFlvt+AByCISiyIAHpH5QKG2XhSPJdBTx0nZuczo12QgTVXD4ZiQy22BOP44PdMPq6DRjvt9WDblFPnGsKA2QiLxUcOujBI5jpKhS3TXmOAU/UIdj20EUhGZamXq8dpNQWz9+Kwt+OiKjXfekK9hM3U8ByItZrMhUg7YqdaqRgnG6gwJ9tvg+v3CtKhIKGQ7ZsSIfNGAcTL9BW4oYB10xvMUEkedOX9mIquukiorjaamgKonF15EKyzy1GXDdlxn4PcSlo01Bq3DCFf0TZet7o01pBjjw/fmEhI4TC42hfbc9SKSS4nsHQiki+7In7wFhJOBtcICPx0H6W2ZIpVl0BPIFQYhpLwl0EWEIEboSQ/2oiHu49NmwcwM93HQX8Pac9AKBSJzpH77jWad X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: de0197e3-90ad-418a-50bc-08dcc71fab63 X-MS-Exchange-CrossTenant-AuthSource: PH7PR01MB8146.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2024 05:10:01.4074 (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: z6SsIhp/2sg/izc5xVl8kmsxf6gSQpDskkBKo/vrR7XdJGERbyhXIVRTJqczGvE2NbmqIUCfIYDSDGZ9aFprdrSku9xk0mVg+pQ7tu3Et9GynDsgS3QuZAXhSeYQYSO7 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR01MB6506 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240827_221006_826506_063219C4 X-CRM114-Status: GOOD ( 14.32 ) 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 | 60 ++++++++++++++++++++++++++++++++++++ tools/perf/util/symbol.h | 1 + 2 files changed, 61 insertions(+) diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index e398abfd13a0..0e49c1345a67 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c @@ -662,6 +662,66 @@ 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; // false + + data = (Elf_Data *) elf_getdata(scn, NULL); + if (!data || !data->d_buf) + goto exit; // 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 + } + + 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 Wed Aug 28 05:09:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Clevenger X-Patchwork-Id: 13780569 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 E8A69C5472D for ; Wed, 28 Aug 2024 05:13:07 +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=46Lnfa419ba6MwoTBOGTytQvW5UJhrJmfl9dt3uEQ2w=; b=q5zKDxVefTQoD1Tyu/PgxOJTBC 914QGjCORN9UqGOB0pY5VGxdOfHiqTxPQV7zj5AP2ejCRQaJtZTPPwngk0Hgi+OvzDSmuGEUIufTo EKL8gacyOcefYHyqfnYbAvOxHyXEAnABFPlMcbbqSvm1wtU7AIVDeDxWZaGPW893TExyAmqsVOT/p R15BJaYF5V9w4uQqac1oOcqJUo6Ix7UqrSHbfN6LZvDMJs898/EECtNFO6Lmu4ZhL87YWlSMp2+ln 0wTEiZnjDAgVRDV9sKEbpQ8tBrBD9/FTQyp5mRBEdi+aAkNiadbrOPVlqxsfkoTD3C2mCGNt+XM0Z E7+VCxLQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjAzI-0000000DsdC-29Ya; Wed, 28 Aug 2024 05:12:56 +0000 Received: from mail-northcentralusazlp170100001.outbound.protection.outlook.com ([2a01:111:f403:c105::1] helo=CH1PR05CU001.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjAwX-0000000DrsB-1A5A for linux-arm-kernel@lists.infradead.org; Wed, 28 Aug 2024 05:10:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bZVixYgy4ni7jTu3f34pahQB+J41WNJ7ZyCFQcRZqBS6zkizn2oLuKEqKKbUpbv/zjPl2L7UCVpkquEJbQ90jPm8BYypLlC7G5DfI86z+er2uqSk36dlhej49OJUnocAGMioDEVvFPJ37JIH1D8efv2gaJIOLY6CII1dDCk51GODZoIpKxOEBHhtn4OCQqbFbcekFrEMG7VHX9eY1JnHMWw1uEWDU6g7/lqyH/KiwLz931y4JxC2skuaW07MWxwP8ukl8jfkCW4YrbCXMOF1gWCiAr5oi7/8/FBYvmcoOsGBsp5B70dZnlRwrsKid7lMa0ditJ+NNwNGZUyoqw+oYA== 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=46Lnfa419ba6MwoTBOGTytQvW5UJhrJmfl9dt3uEQ2w=; b=rI7sIDfKew24dkgJcx/tirPrzuqTOm7Cts3km/RcmMsVr0LAYQIQLyPvX9OATiQuf0OSWpehuxgY7iFSwu1cT5GUSE9C2+X5NfZBTvuo/Op+y6Iw+Ivj3FeJ7zwNUtUPgMrYHO9orXtVPeUSkITQRNmRw+9R9HirQMg/3uEu6+y3il0uK1EPnRE9JTUXLmYA7zjDsGkEcZdC608Rpa2H+1SKeOf32fGZnfYXOhuqa14/rtQK+Rt38ndKQjW7mUmPlTrVsTGzyfw810ASoroDT5l3vEoQ6LHbCC84UMx0xbi/xIGLn5GNpFZfoXygsPpzkjmJxtX7VJuH44pcFTajQw== 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=46Lnfa419ba6MwoTBOGTytQvW5UJhrJmfl9dt3uEQ2w=; b=Z5tM5qheGDW4oxY/ya+kbDTNXDeUowhSjLzkTfyAlwtPins/va88bOCyTERdo3vfr4fC1xL+yObXdt/t9kQtlPXj3f2m7kVd0aGhmOrHMzB8a5dXXk0SVR9pZv+KWrQ9v4UyRhX93Myg4WPerqFlJHp95b+4ILUTkH0rpCZP7Co= 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 SA0PR01MB6506.prod.exchangelabs.com (2603:10b6:806:eb::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.25; Wed, 28 Aug 2024 05:09:59 +0000 Received: from PH7PR01MB8146.prod.exchangelabs.com ([fe80::2972:642:93d1:e9d4]) by PH7PR01MB8146.prod.exchangelabs.com ([fe80::2972:642:93d1:e9d4%4]) with mapi id 15.20.7897.027; Wed, 28 Aug 2024 05:09:59 +0000 From: Steve Clevenger To: james.clark@linaro.org, mike.leach@linaro.org Cc: suzuki.poulose@arm.com, leo.yan@arm.com, ilkka@os.amperecomputing.com, coresight@lists.linaro.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH V4 2/4] Force MAPPING_TYPE__IDENTIY for PIE Date: Tue, 27 Aug 2024 23:09:38 -0600 Message-Id: <05faf8cf48948cdadcf3757eb5fc0305497805c6.1724820993.git.scclevenger@os.amperecomputing.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: CH5PR04CA0011.namprd04.prod.outlook.com (2603:10b6:610:1f4::27) To PH7PR01MB8146.prod.exchangelabs.com (2603:10b6:510:2bd::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH7PR01MB8146:EE_|SA0PR01MB6506:EE_ X-MS-Office365-Filtering-Correlation-Id: 81d52a60-60f0-4f9b-ed7e-08dcc71faa39 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|52116014|376014|366016|38350700014; X-Microsoft-Antispam-Message-Info: 32cfeAvvELdRukimp22DSPBN7TsanSeZZvEIEFI1K5e7UgWsWJ62DYDszgUJdWAgu7FdtD2F1S3CGo3BoOHn0VKn4EIdvkyBRDrCLW3ZIczthFimPvw/y3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e5n5gAp43YV+Fjeoboj8PULVUMSkN5n/Cn1GUZmRw06DdaRKurkUrQrWRzMr1d1q4RRdEyxlFJ7Xunt6iNkIcz4TyXnIACSwL1wXpC9xmeg4GI8QBOV1ob5yEWylV5c5WTcRvtpuIMBTrrOKZaR5yZgpkQ3iZMNhDhbVZiTgFq9NLFFaHXXGSYhv1KS6D8bAB6tJUYa6A8FepXqVnLMnpyggiUM2v2oKpXTKpA== 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)(1800799024)(52116014)(376014)(366016)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Nv+oAd8PZlhx5dbNX7fpz2CUd+kFu3pb5CWFh5HCrllwk+na0XycGeFl4kJvXtbE63XZL0vTaBBLcQZ3SbOY4hUwAUj9xzW6HpXkXro/+Y6FrYhoC28jYPea5tq1P3cy+990Lj47YrZAj2zfbJzui1j6AFi//ppB5vMxa2K8iV+0ZDkFM7rBztAzcAeDwmGmpY6TzTBCr1SxuqFv9i9U2qPABcZoq7HMaKzxuzTZdm2JHrCjM4zj1HokgqxbewBr35QFuLWRREMKfp8JCEZz7tUzQ78Y1tdi2Zz4s3DN71zcaHvBk6P6Db4V2CuMu8dkB//qbSRO6nPntLcp4WfENXFJbKdssaDrRv3czkchdYE3uLKdLsVirdc2zXE4LfVOslbW27tlBA8Abcz8ZB1cyvoZyJc5rmnQJk0wZst4+SZ68CgQsXnofb4gmjZcCw8TcLzYkwmiq9wVO62ox033gofb+7sEUitVTFnp7tW5fHGNJ494+K7h1bEp2/GH5AiQCtN3SjUw9Jk0G92KEGYMY2xovJ1dXmyRuZgay4yvhpWcRYnGIi5GV7T43dmiqkXi/049404zt90EWm1NdXC6z/nmvF/aEBn0fBhKzoZbn3hVkgs2sB3BeuoeBOuInO0aa3ahHDUAU1DcSQTU+fWYkU7JXzR1ixtrjYer+ohyO8i7/4OvMGxOwOQ6nOUtZwR/c4lADyv/vjXNJUs9KuJxhBgFw9qIlp8lRs4EschAHM+yms9bLK+BRtNWP3ukEO8Fk9geTAxZp47OId1ZbYrIIv64D7ssK9xJbPKadCEYbxroEnG0ghj5WURJfqVqpAADso9qr5dv3zB1rrJETS8tZdmP3aQZJOAht10TtT27TFu5xu8a9U3j2imL+splMwRjltP8jCc+71nstf55Usrn84Zik6sW1/LIUREGe78mjGB2ttAaZckzwNptGSSIvPBtWi07OqFoevXhbJjO5cx3F4NrERTerjJL4VoTCisD2KnQNljepeaMkRTIEsi366e2a74rHViRuVYCielOalvx2lzeGNaxAcw8czR+dkAZg3U1DqAebRoDXDoCR1paNe2Udbytfhkn4p9QqKMqADk+Zo4cnFKO4DsB7dvBqdNwNdwO4ZKFwa9+JRimqrf7LmbSG13o5Zc6qZOki6e3HPQZ/Eg1aCZ+5BUVwGCjMDNhRFNyBPLsOE6N84itG76XHVJ3mVjCDiwhpBYHnOytn6vyYP/IiN7QVaPrWEoOG81XVGQ1rCqUWUQHEfMeGLt/xZeOP9q7NC6QGT3fXTNlFRPopybao66UzCV1S87pgEC/UZPjhijeog2pP0QWfYyqup7cLXnbzarjO+AR1HQl7446NNFqAMwzvnOxdsk7/xPyXOBzjLKvmdMsQ0rESIyvNaHF88kDEGquKymLiM0dl17V4HU9WJRHqrn4tyM9FBdGPYfnjIqdNyYOuTJlp6Y12E7H+ZFwyuqAIFYFRovWpeeT/68/vsYD3d4cdjta2awyDb7Lt4jgKUvD9UN8YMIsEYQ7M3BiU5gu0mufK5FwbI6zl8cymzCYg4fMEIkQ4QclDJdJB55u5HnRYDK/ty6RwuwKk26YLygslwPjGEuaUsnIoUY0z4BQmG50Zt4ThxHhzETF5UslmTDMjzR9EKTkzg7F X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 81d52a60-60f0-4f9b-ed7e-08dcc71faa39 X-MS-Exchange-CrossTenant-AuthSource: PH7PR01MB8146.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2024 05:09:59.5331 (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: i4CeqSmz06gc0NO0uHkOfiCyJYb3wmLzInJwQIBngtKb6ON/qdhn4/2hEq9sJ85EQDDR9eC/Y/Wf1QRrIw09/OWHrf5dZm4f7gy+VDzFmsdOUWatMxJbzW6RkVu486Zn X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR01MB6506 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240827_221005_340885_152DCA4A X-CRM114-Status: GOOD ( 10.82 ) 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 Wed Aug 28 05:09:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Clevenger X-Patchwork-Id: 13780568 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 890C9C5474A for ; Wed, 28 Aug 2024 05:12:14 +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=YR+xHC831DHYMPvwVJxoQiDEooIEo7RZSXIjUnWt1ro=; b=LFKJhvI+6DYoGh6IesGGeyKr3I ETbQ6Pwu9s6NH3ztYr2jktif5kAiK0Im+GqZAr4O5PbZ5840mb6dZiZMwaYHvRyMFdgPk/JkNagVI 5cLcnINFBrXCvxqP7v0tcY8ZPBT2aC5CFrRfQMIec53E8njFxCVu4qqx8dISGEq2hJ+enZovQoo3h Ff8gLgHLMfx+Chc+0E5D/SQu2GHdbdjeLDsSdGbpMZ1iQVDJ/wOmHo0mJUm27xk1pBv6reWtn1Frq ErpNupJs5hPiyUr9d54KmKLbKd/7xmKWTz4uPPnTwcOiU7Kbiv9ILc27VzKEt8DRCPEvJVyaXzD2S AS0GA0GA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjAyR-0000000DsGf-1xsB; Wed, 28 Aug 2024 05:12:03 +0000 Received: from mail-northcentralusazlp170100001.outbound.protection.outlook.com ([2a01:111:f403:c105::1] helo=CH1PR05CU001.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjAwV-0000000DrsB-32vJ for linux-arm-kernel@lists.infradead.org; Wed, 28 Aug 2024 05:10:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xzG/cv4eBPhs78+BtDV8d+HCTLsEg78t3pblXK7esBVJ8BwYJrfqaF75UA56J7J1mjubYyyT08jR3U3BeW7Y6O7bup1gTodajqnXCiLp54Iyie74BUanv7Q7DUNCDvYEcNrjfA06DzJbyocv09a7nqu1Bg9mNJI6aPagaKn0kmBsGPEGRRnh9Ec4TZblXMFeMr0KB9stZVcUG850KQMs6dGdjmWCKzxnL1tbpn7dQbeqiuHnXTYfSn/CNb5AGHxCb5F1Bj+qe60jNroZgjyw5JMQC90pPmhtcsubErPfVouBI7OMhEasB1ekDJo2DDUsk14nSw3v7Wzex15WfTwRhA== 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=YR+xHC831DHYMPvwVJxoQiDEooIEo7RZSXIjUnWt1ro=; b=u+R3CO+x1EcMQlcDke6SZUdTw1TdohwNzxQSc8H6JIQocQjgntjGrLsv3fV2ekYB5tQExDh1qwaGDkCfXalkEKnSd/ra2Mn4/d4CZSkf93STOZPEU59mGOh54/OL5Hb4TD/cvb9f+DWGtef9zUmWws1RV0HIVrfduCQ2xRE+SE999uWitiUmcI4XKm1QzQHPZBO6qPyy5V3HBCF2yqBIfbiWNF8E+4DR7rXNDDQD2pmHttLXp/lZZZ7lIFfZ9HwuM4SkI3CKq+V/OWxMSwixLMmDH1Tnlq3EIM3c7u8Q2vGTlLBb56Bf5a84fZyZYePOOWMr2QSAGMrIwWzdknORUA== 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=YR+xHC831DHYMPvwVJxoQiDEooIEo7RZSXIjUnWt1ro=; b=e/Sfl0lq8f6wG4cZtLi9naVaZPfwh6XDXQ97qlUBrAI4ISLE7gztP2I3SQrAACR3iGB2Ba0eYRUd35/uowxTbf/1DG0qQJAoLalZ8Bpsan2alS1bAGTRykvj6r+d8VMaKgervN797Twve6tTuNzByURrCcjlRdaneYKP1N20nbY= 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 SA0PR01MB6506.prod.exchangelabs.com (2603:10b6:806:eb::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.25; Wed, 28 Aug 2024 05:09:57 +0000 Received: from PH7PR01MB8146.prod.exchangelabs.com ([fe80::2972:642:93d1:e9d4]) by PH7PR01MB8146.prod.exchangelabs.com ([fe80::2972:642:93d1:e9d4%4]) with mapi id 15.20.7897.027; Wed, 28 Aug 2024 05:09:57 +0000 From: Steve Clevenger To: james.clark@linaro.org, mike.leach@linaro.org Cc: suzuki.poulose@arm.com, leo.yan@arm.com, ilkka@os.amperecomputing.com, coresight@lists.linaro.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH V4 3/4] Add map pgoff to python dictionary based on MAPPING_TYPE Date: Tue, 27 Aug 2024 23:09:37 -0600 Message-Id: <04a8a735c1a3794c64f1687fc8963d5713807b95.1724820993.git.scclevenger@os.amperecomputing.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: CH5PR04CA0011.namprd04.prod.outlook.com (2603:10b6:610:1f4::27) To PH7PR01MB8146.prod.exchangelabs.com (2603:10b6:510:2bd::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH7PR01MB8146:EE_|SA0PR01MB6506:EE_ X-MS-Office365-Filtering-Correlation-Id: 020743a8-cd75-46cf-010d-08dcc71fa91f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|52116014|376014|366016|38350700014; X-Microsoft-Antispam-Message-Info: 5iEGnMilkiaPeNP2KcHs6pWEidx6W6y2XIf6CPe4sIYox8xz/PNIq0yw4HM0ZdawHzmDA6A3ngZEiZX0t6XaEvU8Up4H/pQwniHeOu7xGAxrZtTdz9fHXsf3ht2UhoaHep8F6DwKSyH3rHaNGZLhjgOiVjt+HoaLXutK/c4W+EbOQnd3u9rmHCpkECHsa2iglUcosMPzMt3DQqdvR7uZans2QpXWDECHVFtA+7T3MilhqN93PuqJTR6tgnoyvtdwjqiEYQ8Emq54OihrmtySmOvS6aa1Efe870b+UzP9eb6x2OdOnKyu62bdmD4B930hx6vu2SP+VdniBqtWhEj0rDarywCo3rRTFQJbXvYaKxopNTF9XZP+hTeqgtOJ+WSqy9EaPMzmA/V2CImyZZ3kZxapDjZUVPeJG0md79RYWprCMD0BC7FOCQO7/UOtUkQ65tt/D7P+Q/xAilY70/CxNkc1mXpMami+360tZhQMBAobI3oLJrUbPEgxtdSCOY5GCy3eAd17o9y1h1eQHwMwYeJIjIDF8SIdj/Xx6aZP6EuG0Da/mLUHMZuBOKCHeULbuVJo6M9P1YhpoFWB7bndCK7Sm1PvsptDrqkn+atBHg9v+5h17bABp+e0+cL7TTkgnRUkUiV2zmtf5nZ5hQNc6u4SXIH87bPgfWXEMV4wqj9+jnPKO2FdBlPZv7Wb78WKlKbzwi0qFzol/3D4G61ZxxNO/C+aISGyEtpknVhMgCG6OykOAh7idt1kHEoyzAazblhdGpD/2z0Ayv9CFqPmhMTbAPyZboHpJk+yspz5U6N+2jraiey4oxp7ISJzHGJpm6faglr0Oy/ICgYwJbILgUNuFxelod0Be8I67tFCdgd7J19kx+v7jq1o/H0qFREeUVfzWwPiz3cRajwoI0KMRXboLTsMnCA5E5r56BIRRoUqMVw4gQRuEfMrWPtRXNida64T2jMLqiXhjMMXUfwp2Wf6iYeFC7n5XTtMLtsdMkO7Hhove6JltIMNcYZ78vSKLPaVOAQcBICI9YU3+x3SrNMTLuxr+dHf0bnNyU7RIan631q8BdGpcCMinDQTKNGX4p0iESHhQtnrl1xcVnpiObTDgFYuJHkWcI3d3g1VLGpx8kn2SR+je6HuDJaEk9almDerPt3R+5EeS89WiMnAHywrE5VN79vTxaBkp8wKKjpEhNjCEHTboiSpUjrJp+4PqrrPBzLIUk538PlzsKyn9vO7vW7ZHRoKMkr4dmQ50ML9T/AHdmqiudBtiaA/WwP1lrKODuDMxKzfo0JrgYaPFuJmFAKXwgrHwBlGoK5AUT3BiSPlLwBcqdGUNZm2FY0Qm9TAp2unp25ID+Of58KPj7reOR77YkRyA7Ec241o+F8hW6LzV5svbN6GXz9zELj9B8uSwKsIYbHAHQqU23X2ww== 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)(1800799024)(52116014)(376014)(366016)(38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RW09bkaosYaddjVjALwvrs0CobuzxsGUIvJBhxg6IZduZIZqpzlQ+mWv2904rmp25c7Vh6r9VaB7MCu6nJxSsDPV4y5BE+0L04m+YiyI3PjG6+9xnoERN/ZReIZd8Nd5F1DkyeLAc2m3dqUIg6Olb8K7mJ3G7UD3dD7eXNDWrGeGQMWZz1YqkQsIYAXimr4bL4bP/BDyG7QDNK34kW1qD6AbFcQFq7H7aeEnv/jh3qqBy0LSWSKE4IvIJz1nD88lzAjPqiVnM95rvQZRIxwc9buPR2z3c0aGrIMki9v4g5PEnOA5zPJ43UwRndU/HCIk1lnp+gs3O+ijsiC6Gsqea7WCdOqU96/SXrUreT6onHQehpHEQ6PfuKgYjJSMTZD2L2jXG0QWUJ/iS7PIZ4H5V/yjFnLOOLTXR2E7XBxHwPqAT3iFJg9/MBNgmCOl5Larg0T7elMzbLOoNKIndKn8lhNU3Mf+7of7q3le1R3TGxKSWRa8QqDl9d14j/APGbj9lmMINOxqT3PSqUDLJ4lmeGgc8tjf/Ufvr7yOx/NaNKiKX7nejpfUBN10evDoYn6aTiOuBKN81l1JtJtEG1dCR+lbKEn/hbdXu0YAaJp5YZs5qrmt4aAByJOkQSporAOdoqNjo3Gg0l9xFpB55NdhV9DVzt/cbRTy0j7 X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 020743a8-cd75-46cf-010d-08dcc71fa91f X-MS-Exchange-CrossTenant-AuthSource: PH7PR01MB8146.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2024 05:09:57.6073 (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: CS4dwfWA1ErRhEeJuLIKfjkozYCVYlfmPEvKXJW/V/s4saSqkWKI2aCG6QB0stzveLY+CUhKSfVfZvT4h2JG9BrFpPLgsYsBzAQedL/u2nn5qYRXOeTA/oFMh6JsGoTM X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR01MB6506 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240827_221003_807886_87A2D08A X-CRM114-Status: GOOD ( 10.95 ) 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..b8da0ea5e55c 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", "map_pgoff"); } if (sample->flags) From patchwork Wed Aug 28 05:09:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Steve Clevenger X-Patchwork-Id: 13780567 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 45941C5474A for ; Wed, 28 Aug 2024 05:11:27 +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=YigPosKCyA+QVqyfOxzq74WG+dtaoYHC96nYTYgVgG8=; b=UsjQDh+OwwSyuEw9qo6BURtbUx EwEo2YBBSEioqWzBMUj8pywI4HHZitdDalbSdVcfVdtDWAaaZknUnFZCECCMVLloN6emYHddDqJo9 04z1yMhW0rVP7z6RodPmZ+e7hbGlzS4wsHRf1XXR1XAaOj5bRJs66oWYl1LxHNjtV5ghXsDw/o+u8 xHg0Sp/uc9+q0G5xnJP0JTPHepjXKYmHVzeaimeXx77nQFZ7AprceR8o/D25w+7wU/RAKQjJOKX8y gP915Oy94n+nRc3MLX9kfWY9UJMg+mysX/L6AJRt2Gz8Dr6Lnam80IsmDIb3H3JE7bnvoFfag4dNT 9AjcR1pw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjAxe-0000000Ds1H-1lOL; Wed, 28 Aug 2024 05:11:14 +0000 Received: from mail-northcentralusazlp170100001.outbound.protection.outlook.com ([2a01:111:f403:c105::1] helo=CH1PR05CU001.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjAwT-0000000DrsB-2HLw for linux-arm-kernel@lists.infradead.org; Wed, 28 Aug 2024 05:10:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=paanykcPn+0K3fiOIA3+g4hmVynyCu/oGNlUdRk+tU5v72Zf06AG2tGBW4Vc1KLaqellaKVGyj30ixUIR7dcGNsX0KQjS+hIC5RkoCyaGEexmWwjRxaodEkxm1uOgMESirW409HG6QXC63RfRfbp36ImmFuYZd/KwN3uoFRnHCBsxORYRjwkh1e6FwKSJkzlTOfIHHtj7koADOvCjuD25b9dC7lSl2TjL+knVx1Yyt1/xFQXA4PlHOXbOe6+2wY2CwJtDCikzmEqgKPj7qF6TL8j9GntsLWMRk71uF9dKozhOqW98SVK0eA3Tsc3v9l9PuaIYoyY1hxnaqtqvZy+XQ== 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=YigPosKCyA+QVqyfOxzq74WG+dtaoYHC96nYTYgVgG8=; b=CGPU7trQcp0sIfwDkEyvq0QdWcCvbHzAZxKBYDwLBgnzkJtne6VcwJezOO63tRfJDDn10W8xB1uaaKaQ9p9rJ9CTG1zu98w6cFo/tQhLukslixfKdS6WZav544Z7ZTegYvmfBjrv+tq2Q47LHoiUQ2RCGJQmvFTicqzjB4ibAPXxZeoSiprt1TMePBm4Lc2uYhwlF0/GAGEbHu8zdJD7HKBLw0DvSmqiPP+HhaluZq+jbBL2v3u/yHpBkm+25LfQX3wNClF14BCC/fOS34zrCsrhKVB9LIrstonm0UzQlbxccktIHEXifz/n13g4yWNYjYOlaYN8gA3KqMKnjBzxIg== 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=YigPosKCyA+QVqyfOxzq74WG+dtaoYHC96nYTYgVgG8=; b=rJHIszSQVRGSFcHwSvMEmSPA14UuALXeNi2Yxr6aRqLtjDC2KALlCftqNfrKf+VPCGhlVolS9gjC/IzDMPI6G0tfXfizhf53GxxsnjsEFlQHAGguE70ntEMK910dhgxFdz7W3o1oW2B7+6bKfGgImER59v84PDzKFsae+2NBoTU= 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 SA0PR01MB6506.prod.exchangelabs.com (2603:10b6:806:eb::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.25; Wed, 28 Aug 2024 05:09:55 +0000 Received: from PH7PR01MB8146.prod.exchangelabs.com ([fe80::2972:642:93d1:e9d4]) by PH7PR01MB8146.prod.exchangelabs.com ([fe80::2972:642:93d1:e9d4%4]) with mapi id 15.20.7897.027; Wed, 28 Aug 2024 05:09:55 +0000 From: Steve Clevenger To: james.clark@linaro.org, mike.leach@linaro.org Cc: suzuki.poulose@arm.com, leo.yan@arm.com, ilkka@os.amperecomputing.com, coresight@lists.linaro.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH V4 4/4] Adjust objdump start/end range per map pgoff parameter Date: Tue, 27 Aug 2024 23:09:36 -0600 Message-Id: <4db11c591f56f4746b17fbd3468007cc89048881.1724820993.git.scclevenger@os.amperecomputing.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: CH5PR04CA0011.namprd04.prod.outlook.com (2603:10b6:610:1f4::27) To PH7PR01MB8146.prod.exchangelabs.com (2603:10b6:510:2bd::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH7PR01MB8146:EE_|SA0PR01MB6506:EE_ X-MS-Office365-Filtering-Correlation-Id: 4e62a766-71a2-4848-fd65-08dcc71fa7c2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|52116014|376014|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?W2e0bqUqWkimoJG/NgIQ2LrIrraYRPw?= =?utf-8?q?1jFRUnjxjaGnus6JBgGbqnxENqJzgE8CBTKx14EbX91UTmkuoNgEVKzwcIYjJMxk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IkHjhj77i3Fn8?= =?utf-8?q?+xgOb8130cMF8tHOTNqbBpd62mcQqY1ojsEPYbfNrdRt4ax1lOmEXMDenjzWNAvUh?= =?utf-8?q?ay5AMlYomA4G2j3sUGry0j5QzGa3UHszpBtyQWbsq/G2ix54RpSuecTbpV6mOH53a?= =?utf-8?q?ZOAEdRQUXgYbsye2zqov9CpJ3oaiVWf0Y2kuZKvQnnkmkynDIGx/9nCN5HI9E9K/t?= =?utf-8?q?eve6VcVE6YuXemcr8CtWIhZeewOcWsudTR1XfdqsW1s0e5Eiq0tOpEpTmxmYw3dBE?= =?utf-8?q?l3SSWZ3dR0tbfE7aKSbyisApA+tPEMvNPnOdEbrRwo5gft6RGXK9N+jqlFynJ4kxA?= =?utf-8?q?Uu6QivM8hmvvGGyMPxAr9jwikJ5PZvWPdj/sc+Qf76pPP/YI6KORDzOWmykGYRorL?= =?utf-8?q?gJaA6AEe5DmmBk7I7RvKo6vVBl40ZKSj0w=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)(1800799024)(52116014)(376014)(366016)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?JSmCp/X6nq3GlNch7Jj/g+iFg3mm?= =?utf-8?q?2oqjh5lYkAAJOhhE44jgtlWiuheTa0eT2ncP5kl67aqgIyjqfNieKzFyJs02TGIqU?= =?utf-8?q?3S5vdaoSIetjVdoSqB4R48ct7wvfy1EmlHKDgDeVOzGsV6oU0kcoI1b3Nte943ib9?= =?utf-8?q?o8apMbUKCfEjEFu9EOWqx4qm/ifrJtGQcE9AOTd/db6doC+t8E0xGJ4eBm6tOVe1s?= =?utf-8?q?T3I+YigHvDmNJQ5Va4OHW14rc1vOaswQs6nDKypODdH2vJ94l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WicxbZC7FL1Lg3OH?= =?utf-8?q?piS1wk25FJGFVnMOuQz+RlW/D1jhV3HuqBwzijzUzRHBqWwtw2zJu/oLR5vVi65Wk?= =?utf-8?q?gX4wBC3Q8E0DWKk1Qn12X1ZE7KqOQLMgGeN+J8OPzMuxzRssEXLU1RjT++wDvmi5h?= =?utf-8?q?tLRRUVHRUw50+u4dxyvyY5TuiU23VcEbop/7M/Hmycyl89G3rkbstRn95sRHe5M/e?= =?utf-8?q?+BcWfTSK9LSt2iUMVbamR5ClBLHI9JRDYI8Ahpwk9+yWxDBLUXVGoa8bPydpk+ZN3?= =?utf-8?q?EOavarnkNqnXbbVz8SZfQ0GCXOr69TjCiKfz9h+cb6FTw0VgIiYZ7i/oEA4FxIRMZ?= =?utf-8?q?ZSkDrx3jloYEDx+r9uGXX9hotbArKMhmJvzoImhjFpYspOKli4zxjivt1GGEBVaG+?= =?utf-8?q?Lbq9NODnehKZmkf3hPYYbgUMTuhhpPfV/JFn60d4iHTZhDaHINLpyoq8BnCg1w/hS?= =?utf-8?q?BtxYdpeMxYT?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4e62a766-71a2-4848-fd65-08dcc71fa7c2 X-MS-Exchange-CrossTenant-AuthSource: PH7PR01MB8146.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2024 05:09:55.3272 (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: ezxBxmp8cWtJGbZ0jHAX2NV4li9u+cPJ0mYtFeQpVEHU7obgLJr5FMDiYUioRfIHLQzHq1TDfF9629Y+P598inuYKID3zlxz5A1GXH4JAxzaWki374+1argoFpqyHZuH X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR01MB6506 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240827_221001_612284_565B776E X-CRM114-Status: GOOD ( 11.17 ) 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 Reviewed-by: Leo Yan --- tools/perf/scripts/python/arm-cs-trace-disasm.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 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..e8cf5d80d850 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): @@ -267,7 +270,7 @@ def process_event(param_dict): 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))