From patchwork Thu Sep 5 22:28:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Clevenger X-Patchwork-Id: 13793046 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 7DB42CE7AA1 for ; Thu, 5 Sep 2024 22:32:59 +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=T0M5xsB5GHgn14az/wECWXeRLB eIymypBLNXR9aDlTANwX31z2PV4p8MNMTcX2yf3QJdn2LOdWOypHb4dwyWqHWl9L+vrPgwOpY/0Xh SvBHhS6lHSYtCNu39DsdGrh83NEsorccrOaASxzf1cDLqBJO9I+0J/1NOOlQRwGMkGNiZtmAv/OyX aYOTYBkeX8kCPW0avcYB3K9+WBgNAexIgbqCpsgNZLIEu+zdLng0v18KeNB611IR5HoWUhLEkljeB WK/TB+MML7TC+0RnXFqTpl5W3XQa8wxWIP7etPcbV9BMuKRYR7XdMxQNjIsJx+/Qn4YEHR2jWhbbn 9b70iFnw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smL21-0000000A1lr-1gnq; Thu, 05 Sep 2024 22:32:49 +0000 Received: from mail-eastusazlp170100000.outbound.protection.outlook.com ([2a01:111:f403:c101::] helo=BL2PR02CU003.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smKyK-0000000A1JA-34R5 for linux-arm-kernel@lists.infradead.org; Thu, 05 Sep 2024 22:29:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PNM666JZBWMXNxGu1g/mcthg/LTAIgxxPvINfgLFvo+XxFnKhw8ZqEPCIHHMYgmlhhacc063GTBlj31e7znnduyiry+TizfpoaoY+W6wNtL+ao/1XzHBQ//iYr5QhUXxxRNXxJbgcJoJDdlv66/w/TzrmoaatDqFPK7TpBGFfJ8bOKeCQa2RDOfLdalsQafz63QLLFQCghaKE5uTZofB8vwV0fGsVAruKjN5bYSVt7P4COz7WwKSzU2opFo08mho5t7apABY7SopawvV1rHZvnsPgrWVqraJoXiD3W0lZwx86LYVYiLltboh4hZkV0Bt0CAUVi8XcS2aUdxFfPxu1A== 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=q5WukhleqQvn+zrcS7RkUVLMT6gOWiaM+6ttM95p6g6lzGmVDZ4ZqeRe9bcie9xwxXYnNTRRWeDt/J1kjkQSZkpdxUbqUMZZKhqZlHu7whMpt0K6mR1IFIDdCXrqiouT35crT9I/84ipLcU0TxPRQaTPb6J7O55qhCuE/BEnTobYturWNhE+E6ZAUj1jTw266aL+PLUpJ+l6SVWt1tO7WhTJFKIaQ2xAawpo+R9noDf3s5v2PUyzNDxVSqakMuRu9uXGBeDg3S3QiVuCuP/RLUPFrNvZOyQGbc9HsTNN3QQfZpDNbrBvvAEJQeK9qw9gnh/9YwL91mm2U3a22AAdXA== 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=N8DCKt3tTI3HigsvUEOv9XApol3k9sIbgT3xQrrv+cRvVh+SZtXKu83LKrehrSgLYVB/KxXbFSWUcFcRcifgc37a2bfp+7k3wJ+3qy+bss0MaoBW44xJNnsiFXFsEmsKPW4DIHRcNNofa7GLVFDqxrtVSNqFNL8oga+oKe75y00= 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 PH0PR01MB6501.prod.exchangelabs.com (2603:10b6:510:15::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.27; Thu, 5 Sep 2024 22:28:47 +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 22:28:47 +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 V7 1/4] Add dso__is_pie call to identify ELF PIE Date: Thu, 5 Sep 2024 16:28:28 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: CH2PR18CA0056.namprd18.prod.outlook.com (2603:10b6:610:55::36) To PH7PR01MB8146.prod.exchangelabs.com (2603:10b6:510:2bd::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH7PR01MB8146:EE_|PH0PR01MB6501:EE_ X-MS-Office365-Filtering-Correlation-Id: 4d944949-a4bf-4a3b-ea38-08dccdfa1c11 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|52116014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: p8vkYlx7S1p4Ix4veCsmfHghqHXMACBloQSTFY4ro3e7PAAW+DEyPUif9SaWiprcxu2G6NF6cEI29NP2DyJV084bnsIArWSuoFvO0VMBqdCY3ijjKAWUFCJIikOAfDu8UzNI8tkzghjBRAjQeNvTVD+v7Kc1jGAejF0xHfwNGU3ocnFE/lZ/Qyc/cVs8dydZDmGZ57K5VQBm5dSHoQ89uw3s8+I4zp9z374zX0kH26LeA0Cesg9UbNKhH324Cs/7spFLUvTZukTplGOGAhvEpui5Expuvswk1l7jVHaYWe8IY0M/V8gnBat9Da3leVLWQncUBqPM7rBoRoDW91CMXXubtvTgKXVoFLcRmHnW4/mbdJoJpV4UIHhvONYK/H/ZfV7xeGmlLgFsXbAwCfvz95iTzEmy9gSgTOMJFVWFewSNDY/64fIw9Q8xfU/7IxouNXGToFcmpyKDGrs5l719h3gN0F6aSL3EHMK15ycGcQqs4l77y/rNLc1/42cADXwsacC76WLX5oGqCTLzFCN/jeFVMNsEaxGeDJICbnhEGZDWPVX3q0D1lzuTGlby6NZl8Y9hW1RDXO8ZUonwa5WmOh/gz7KKUEPCk5MWQLGUR/KA8wtJxUesFZM1jJ06Q97js/1F/uDByRolS+gBEuJ5igKHSq52/tJ37an/V6WdDpq7G9JhVKIE6Vwb8p0F0gPEt8DLRFSsWVEY6cnSDd6Dlt53GToaiFbjHR9M4NYTOQJq4A5QuyPcJM6RCZleDsk6Lc8489M7pOMOjn4wRbCrlW4IyHMfyh9oGc5N7h9sDUFNkqBQu1zavG+pia56VEbWJtibtmOIrbFlknx+drY/EstHNLZAROkJOInCenOKm8eMhliHxiM5zJNmWNTxhwX79GK+gxHocNLpZ9EYnz+dpJ3W5p/YntLJoOo2KmWH19MeBAsKQQNgKAMKSC2HckSP/6Tw/0k2vs3sw/iBq4tTuNICcSbjgl50zY76eBaK24BCDVW6UHsdUOOqMil5pFBDg51s26eGPtiuypNF0tiaKd1oFbkUULumOE9FCQO2QZE9lISKthvdme9F62CLYaVg0A6MBOVazeWNcoCDtOURMEg+yLjMscWTulTWu4k1TRmB1nQ2X7YssvZz5suBfE0P4FYEH302VxJ3Al7L9aYRzOSO060TNsf7KWLK4UWqzFZZijP3/Py7xEyd1cjOnZFiOeheR4CA2rAlIaMFOm9ozMrXwtyK40z/fj/j/B3u27YXK5xnA11/pZU7p4p3nBjB1nYlUZrsnCMaZpyO1mvJg++wktZ4GeX8wBGUJkIMYYiqEicLUFauscFzy6i5gqFoX7gpRCEgmzu5SVWrG3uJTeMslqX6HWafU2qfRvUL52BKAh0z1N0iX8ikSt3n5OqdivnvCNY/FpgrZaXvFlnCkw== 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)(376014)(52116014)(366016)(1800799024)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: CZrEQEC/7/IK8KS0ujj8yPoJ96uYTZfaHDIdhWbDqm2ulXOPvUz6XM/3wR9ejPD9Wr+VJRcfwW9VLt63xq6JrSQmD7lnaAlZsCwTuiBt4ryTOTvRSn/pDJMSBya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OWjqrpJop1KZtvMkvjEygmWwCbXcfGTCzrbSVHz0+bMUB8fFPOczOYU5gtzX1Vql3esvEe7VSNOJrJ7oONhFmbsAuWh7RxhIcmg6AOv/sYcK2SiZgPD1UEqnRhDO129V2ZFaaUbh0aylWDvde0Po/+grUoBRigH2gqyZ4RPlfeI0j2fgUQLEKurGuDKOvynolZrkb8GHlxHm0QSjFNJihxcp7WksyOxIBhf1rQOUS4wAjZM7AnZuz8vU2lsLj7WXsK8VbQVFNtAFumhjJkIXJu03YcF3kyoo0xM+t5BlfdWaG6z7ApCA2LxhOEQCeV3GpyjoR99usvBuRMlovfFSmRIsPazfDTNNpjrOvC3E99aHO34UuhDIi6pdu3xklceWcCNrSRC1QQ8Yml9kZXmFIl1Ou5EMGjCP6zRIo9dtmWYcB0/MR4kSjxxV6JdglqVdQIfFphXt29PgWcmhOX6TC5WuoAu84 X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4d944949-a4bf-4a3b-ea38-08dccdfa1c11 X-MS-Exchange-CrossTenant-AuthSource: PH7PR01MB8146.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2024 22:28:47.7185 (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: XRcAPmZM6dBmzyb4Mr0uNT49D0aJbbWAb366pfotY364bsBwG93O1jAgOZKczEHrEalybHRQnyy9xjTmIlz9/A/N+i8xF6NXpp68IDKg1cIsiionBYkF7siu1knfY1Pn X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB6501 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240905_152900_782010_B78BD086 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 22:28:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Clevenger X-Patchwork-Id: 13793045 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 80FB3CE7AA1 for ; Thu, 5 Sep 2024 22:32:02 +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=pO0NTPIHmsanV5EZ4FZRPSX9xU +Ew/GVE/sRIvitTU75Cr8nRHYfXVzrwjY/jf44m6OeOCVpjvBylNJzBl51E0PPG8cpARTIj4njqf3 6B7Th9FrwnGK6bE8gUipEbHG5SP8O/mXs1rmp7MSpf0H68PYmM4V0sgpQ5na7N7IzNrc71b3kXHaL U6uarYVtdJ+UPV+l6SeBNhTpViTpW4zg4ZWrS+gtXD+QkGV0y9zPCK9Uo43MpOffve8AgxPEoye1f EhA5kPphAxqT5LNps1GGRN37jgLKpNIMSmCLFCKfYm3N6dX6Jzm0p4hgHoSuwyRrN52SoDIn/sldH DpLIRuDA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smL15-0000000A1cf-09jI; Thu, 05 Sep 2024 22:31:51 +0000 Received: from mail-eastusazlp170100000.outbound.protection.outlook.com ([2a01:111:f403:c101::] helo=BL2PR02CU003.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smKyJ-0000000A1JA-13tj for linux-arm-kernel@lists.infradead.org; Thu, 05 Sep 2024 22:29:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kbP7iY2jxCBhM83E7PK0F1laItyNq9FtcEdGrILIAiPj8e25ZqfKvV7cXNBAxgk9QBwcqH/W2hGt/dH9wI5DklO91jxK98OSulmveAi8vNnrQNdBATSMnqeUpkj7IEeHGDnsXruMAcz3ngKO+Z0Wb6QMZWXWLpLdn9UfBo7J4phizTe8WreCnGy+9HvpZ6IZzUSouvYRoNG+RCFJ51EJEdbEAq0QF4KzNPbtBlXL2Bivg9P1nfaWmmzWyCj2nagn33Cx37L6BZvLVBy/KFCv5qtqm8seTzPJ9s5a+2FB0CVNwK7ETxYRO/yPLNRG10mqocXr64mmWbC5conLwQILaw== 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=HYfSV/viRV+kzYDOGUwfLEU5xYB+cUJhPrAhdnZztJ1Uw8vmJkyJJq/+a3rsujJOqieMdHL/IKTJw+/Da466EofaTABzRMgCIU3JvAJ8kbUmv5c92DW+LNHQpiWxI6GOToAI+0dJ1nBOC/4XnnS66U5zPkXCr4Qo4M6sjJkE4Gfjb1DkSh60KHu0TwIJFIR8AYvTRlchMWP16kYQC+Y4okA63boRuwmeanfLrjw2wMc/JNJAcKK3YiAdKCPQwNlhQE6iiJPXRPw/c/0DWcBzT15aZzhaAGf0iCSOeS9iNuBv6OA7QdVOHpt1JY0EYfsat6N2ZNEIvYIgQ9tl8D41GA== 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=PZ4+09JsXr9ncdkpY29H3aVPLmFL/n2x6AqVEUYWamf0KggGu2ukL5K0RkmvVCShydUl+ILRZtdNTA/iKtFFbm5n82MEjWXMJjao6XpyFV3vzqCuGK5twJCefFkCTB5SWUAWXFP8AO8Fvw1uLiZZIslHDeHvFYsuS+0LSIC1Xuc= 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 PH0PR01MB6501.prod.exchangelabs.com (2603:10b6:510:15::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.27; Thu, 5 Sep 2024 22:28:46 +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 22:28:46 +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 V7 2/4] Force MAPPING_TYPE__IDENTIY for PIE Date: Thu, 5 Sep 2024 16:28:27 -0600 Message-Id: <2a1fd852366c82249c59dbcb878b0517ca2aeed9.1725573309.git.scclevenger@os.amperecomputing.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: CH2PR18CA0056.namprd18.prod.outlook.com (2603:10b6:610:55::36) To PH7PR01MB8146.prod.exchangelabs.com (2603:10b6:510:2bd::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH7PR01MB8146:EE_|PH0PR01MB6501:EE_ X-MS-Office365-Filtering-Correlation-Id: a46516ab-68b1-46c9-c696-08dccdfa1afb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|52116014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: Io124GGfoLe3m0qNAWwSKaG+cnCipNu7QWsFZvQ77Gi8Xgjoej9RIYPWG6FdY1hyDfmc3mZJX9kT1y9hCjPpEOk+tZbarylYqroApaCjj+2HhJpW38KSuCej+yBGUE8zW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2biKys6lIf5WGLkBh8LdtnygLZYAIcmIo9oC7VSJp/K5ed+xA3cSjGXlJHgXGAeTR+F/96cdNObXfPEgsLYVEo2MJqHyxG6knJP+28j0mji5I5MOVsMHHoPHu9SGgUhzUOi7PxnPD4jnW2bfs7fPDeGVAyxjL4DBC/j8zRdvTjbGG6jK8BtMvPQcbd1LAoBjZOPsNvUc4PWUx/O9XXAkymy1URnWBsk+tfA9r33wVIkT2w== 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)(376014)(52116014)(366016)(1800799024)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ep9sRKIlCpXBtXByhIS9i4MPMRVLzpcDgpNrAzLu6Pj9z0IyZ04O50Km2Gh3ziXANft81vsPAO2qH9QbCZ2NJ/LctbPD7mDAxr0dodzjqkmlUtlRSK60X6IgVGjBuiclL9QxaqX5tEv6YkFa8JxVHfD+nNUYWfx05jn5miZJ27MVDk1vbhFqaoaX6B5tlz+HteDoQ3VWrMMCSPeJjQjfUpNx0k7Sk0zPh0XzUmc85OBFk9JbNauQRA4BQUqkONMPCaDs2m9Xzt4k4k+CBW3QcoqoFFbnyva58GBMIU+/no0MNk5o8T4Vj8sYO/Q6CDCommfyZpkdkyqkrXcUTXCGM9qlOwQLs9tFLbqSYZrKUsma3lpn61eLW9+2zJ9n2TU5BXSoVwZDiC+7PUMcGBcvzcvrZ6YNOtD+vzp8o3X5bOtbGYFCIKfowFyHFAb44OK7f0NIW+Yz1XGXV66JLz3JFWuk8L43CQ6QqVDSsX0XMruFdrl21sr6tqtlGkA4FqSzHyw1sBgzPfWdh2o6C3yiGb9/ZSuWFDchRbMwxNYXMJ1HUplLxCiMmQZqVWBacdF8ibK6ldIa+wuT/DQ/EZwbHp0Nc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OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: a46516ab-68b1-46c9-c696-08dccdfa1afb X-MS-Exchange-CrossTenant-AuthSource: PH7PR01MB8146.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2024 22:28:45.9734 (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: jtJTY7IHsOxF4fbtzX9owi3Av9g0U6gDxmH/0vxodtsdq2eDtBTwHLlw82nvNM9DOi6R5AEzGq3gIix4VSe+Dx6X9gBYnhvtXGAI8Y6IL1zCIAWa0eHbSXWGmr65B+fC X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB6501 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240905_152859_310435_E491AA2E X-CRM114-Status: GOOD ( 10.65 ) 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 22:28:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Clevenger X-Patchwork-Id: 13793043 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 E3591CE7AA0 for ; Thu, 5 Sep 2024 22:30:10 +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=E5uwjGdPczlO996Qlpnqox8ZwZ WajFwM9CXn+3wrKARwKllOm0oRVNiRrUJM7+e7O5vPWRyVestFXi68ZIfiGYjxQGvrPPkLvG7DAPh JeEn7f+EDGprsbAcTxFO/Rd35erlngduTevjRNjkWGeyMuK/PAwM2qQ0OYb4aFqX8adb1AOsa02Cp gDJEK7IzsoHDHATI9qhcrhrRDZFkAHQ0kARNeslnJeVWppwHfDO/0iPP2LEOxH1uP1SdSCoOF2xsW /C+jqq8kvSdhYxaZVgr/LySp6ui0Qpn81qTrXanndJz3P7MNTN2uFa2pHDE0u2xd+3bhnV6NmzPtg h1fnWPzQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smKzE-0000000A1O0-2PHE; Thu, 05 Sep 2024 22:29:56 +0000 Received: from mail-eastusazlp170100000.outbound.protection.outlook.com ([2a01:111:f403:c101::] helo=BL2PR02CU003.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smKyF-0000000A1JA-3nTK for linux-arm-kernel@lists.infradead.org; Thu, 05 Sep 2024 22:28:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=LG7sbvIzTIr1BOq3g3zXH65A7533A3hTEubbtjsFOSKINFWydW233W+A1N21CHmKpe30F6QG2sJUNAuXRkHRLlO6bHcgRwmMU10QA2ppPZWo2i49m5awiHd8i1mlcMZsFQtdiHVyFJM8TgtmDdvddJnpInNrqvj7ZvT5ayQuysEdIYe+Abyy4FBayF2/s7/O7OryUa0kcecrpmOTnN9Hkou4vyvflsrc036bgxH4l+jFSYp2Miemc31XEbUaGCfaj2YRrUN+utIbmvZlOHYxyEoK1VcMrOGZ5o8k841bN6vk9CzBkJzXvdCZcVdDn7zDxYs1gPKGOmVU947is5ntiw== 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=ayBk0mmQ4WP1fjtmYW86xi4yX320CzNN4tzAZYTJSbDa94si0AwryKnNjVwGeIeg/6QSexF4aKdoipYmfBKmtLbuBdy+2vINbx5XsQwoflu7eZs9fHkb9aN3RLNRJW1JGCg4ZrsUzrVKu4cxL+AmFxlZtM8DoU5jiQKVN3T+J1FK7/XbEwnEWsjsrjiwWlINCzFwqHYOBR1pcLPEFfDCkIKYIiYsjKNqBpACqEia5T/I/MDFLcu9UhxqtPSBqB5Xb5iKWe+ow812/a0X/H5LeLVwvcGP2g8QKA+qdsVWq/QXs8luII3WgF3gg/jPeMcWvvPr7s9UPRg1Efeqx0IpMg== 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=h/RE4pnGt6VSyeK7urkPfe7b2eUriA60LHtFCPAouWNom3fHRT0ysqqgwAUrLdNjiWgGKWy1cR54xNrDr39Zkl3QNbEb1XFL7TsORrxAZbKOMc7WwMZNN4PFRbj/wufo8sS162DpDVLTteiN10HFzDpZBeouia4Z7GWeDOHGlz8= 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 PH0PR01MB6501.prod.exchangelabs.com (2603:10b6:510:15::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.27; Thu, 5 Sep 2024 22:28:44 +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 22:28:44 +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 V7 3/4] Add map pgoff to python dictionary based on MAPPING_TYPE Date: Thu, 5 Sep 2024 16:28:26 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: CH2PR18CA0056.namprd18.prod.outlook.com (2603:10b6:610:55::36) To PH7PR01MB8146.prod.exchangelabs.com (2603:10b6:510:2bd::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH7PR01MB8146:EE_|PH0PR01MB6501:EE_ X-MS-Office365-Filtering-Correlation-Id: 85eb8080-3692-48df-c120-08dccdfa19e0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|52116014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: Cz3XV9IzWnfxxEstKqCwfgj+75MToBdLfYv/o1CzG4RGufxSHb5ZC9gaPIWkuYpzDPv6t0PiO1cSRR8Q5pRl9NOR1+uYNCQ8sa8X9JCsVF7c14gjppLjmUJZ0Qn32WJxdC1ouFHw0xyNJ9oPzrdsrtwPs6t2KL9LvYZg4QXPSrq+mNXM+OEuA2mKP1W4Pa7Ul/NM/ETpzBjN5+dlNBe+bhtOuEQhWqkw+wnZu8YgHTRI3VWcTj9SHeipgdR4LZ2/qDQNhYRUOEU6Y9si0oloyxmJrjtMTxUayopcFtvbjtY+tpC46jw2nKAi04jjf+htQ0+nqTGLmaNDblaY/HKCFKkufw6eyHxlN9IPltGEe/MaqI9L/NVcyha2XozttykEgKFnMITHgM4rDkEYqmJxBsW5SLZYRkzh3omv8K5tV5eKiQojsbCiH8prP2hTKTyv2q1l3tMw+4Bd0Use2ernPq6mnHeW/STHhG5F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116014)(366016)(1800799024)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 35C9syKdldV/DHjXPydZZenVK8mw8hRf7lXuUcL8BA9KRWhPokcvYgVEL1WHQXBDIfJinerZIfse8U+NDdgatoe6MQ0A///9J/hDwvtl7Bk525VukMM7tF0/fqQvzRLrXOktQnH1EjAY8Ref8jo4xJwsmzYFqhaaezyE0JJf4DCVxylQMpof6zFNSY75jdhDTk5jPqwsXq0hi481saRMqey8Ozd8CInxFJfdYLA0ZwjBBWU3OJa8CZF7h8y+suLQIotM+GpAs8XjK/IYJHbogdzbUiLzkOKrdN/sAEyVLFSGGmy2q+1moCIRSLu9/W/hmqfu30fRG8rlr0WmBZ8G2ehCnxmSeofsoc+FqTMYG+9bBWXFauCuGCYrel/t3QTEnM/Ocf4Gu3DBxkd0CbkpPdUud557YMklyaAPI1NuVqjxoQQtco2VKhrcAvBDrj9iO9z/FRAawccWyuVMT/NGg7lUuEj+cSwTOzBCyFUcTKW+WXaB0r9hAenuaO+2yexFO+htfhxXLj6gO4+SqoYuVBNWAZHl8Qnz/JvfxYNbVaKBi+8e89coOiSWGofLnk6yip528arb2fkayWIZNVqiDVwPHiybq4n4OpAE81MJ5sFTe0iUWQVBgdBPznzqFXWAmpup3hh2CVFwGq715jCcx3h57pSPaoCcgCnJYnaaz4J5MRN6XsHZ+r+hJvgn/O4PiL0cMq2r8kdziUv7ZxfwOf9+r83IRDMK/eijP/1hOBdW8fLxBD+FXetiIzMcu6Xalui3ejea8I1RhN4CaJK4vB6Avqe5WU0NvE1ZlCLC78wU4kCptHs+xSJyNsLck40U5ICfY1/qQ8Vie9NJRAS6O/tsoTVdTj4/5wPsnKJM4WHxB0ZJIWgtSJMOciUOp9zSar1X9epsKmTope5BNFR2EljJYuQOSfTTAgodHTtZ3S0v0Nb/vmeQoFcwhdge9bLCulbaEHeZ01ZuB+xnIxnwNrWwooTMMdMbughYpsp57ANTppKKyow96ASrxkIm8mUYfz/Kr+09bZkaa+FWWrvYabxOau65Gof03htvt3UZniwc/LuAGsI4RkjtnaS+uMTiBnIXBKxxGAp2TjvcylipQermEspsvwfRzGL3L0clOMgUuRiXSDxeTusU1ZuRnHwCsjBX8PaUPYAPANqBmDuvYuoS7B1yKzkzfiEvcd2LAh8bW+kINs5bCJ2RnSHqW9P9oH8ApsnEHB4cN9LdxS360HrrF/7AXOIS4KsvfTPiY2/Lv7j89lnNqTAFqop/QhrjPTZ2xn4wHKtBzsgYbKs74FcBUa+G3pV7jcOdyDQp4UlYc1AtpmHCj+0Ziek3eKVusywK6qu5TBz3q7aCL79EswS6OnH7tBE/U9ieYHfNn7rdgn5DJ3rexKUkWkpIWLtQ7nuXXzJABB8w+zonLIIML/T22OA+auxg3MmNWvLDHebhne2xastjDOpdLXekSAtBTodlR94ioFkrmTR4AOJg15btqNq/OK3NuCvauJE1ba6lI02Vg+wLqWbTWA+jlLg1+QXGAViEIjDe76CV2oSNvrZM9P7D/EIZtdtSJwUHuXCfMbOwoS+JdTE0N7oVjNaSSPwJ4BRClWk6TdOeXMIVL9px51zxYH9i8/9QYJ76SiDPofYgnm3fqHon5WIFQ1Xo X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 85eb8080-3692-48df-c120-08dccdfa19e0 X-MS-Exchange-CrossTenant-AuthSource: PH7PR01MB8146.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2024 22:28:44.0464 (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: qA3htBzPdjUBYGeed3mXYvp8lCoo6rYg4wBHbQQ3mICgIt1Yziuo+tlMvHbgbid0mUssQC6jwr7JQkJ04oivwYYisfuylxXrJYjykfKa7mnSsIGYTB9BdKxJl9vSDN/o X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB6501 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240905_152856_139083_B9C3C719 X-CRM114-Status: GOOD ( 10.76 ) 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 22:28:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Steve Clevenger X-Patchwork-Id: 13793044 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 3BDE4CE7AA1 for ; Thu, 5 Sep 2024 22:31:05 +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=Cff4uCMC8cc4jDYyIiCXot/dKLhp7rkFHt5dIeaRS7c=; b=i03oTevWzzFpQ3/y7RvHsfo1mB rB3Ornl7fB4r7UTmar+amR1kRYRhx23XkIDSo8yijetwSzdfpD9aC4sC2Zu32/vPYWixafIgAEIOn hnCVGwbY9Uv8L96qOoGUljUazkfqAcKZmNgcI+LOVDb/9ODgGk5oyyRyaVqRXeMQnvf9ZcblXqz6G gk3Edx+myyHUKK8EVl3rii0xogd1VzMKsuEiS7vtJOAsnhXUr/Y+HxrWr1CAAu99p1T/nVCm7Hb86 CBfZzuLjmCxjltUk3D7001jyuTP6nPUu3NZzvl0w4jAEtl7XRRxSrEJU90VEi0qlM80656cwX/y5y 27ttLJ+Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smL09-0000000A1Uj-2p3o; Thu, 05 Sep 2024 22:30:53 +0000 Received: from mail-eastusazlp170100000.outbound.protection.outlook.com ([2a01:111:f403:c101::] helo=BL2PR02CU003.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smKyH-0000000A1JA-2oKE for linux-arm-kernel@lists.infradead.org; Thu, 05 Sep 2024 22:28:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GXrsrBOXc5D499vmFNkQxzaltlUMAEwsCbBJks7om09KIVyKzG/YUyQEOqwItnvCqBfqdYxhOP420BV8PAj1UJUJPq6Mixl9MxXFJfRJvaHcdQVey+1IYfDsOYSbAI5T0rcwzGOBklmUtqoOnw1IzoZkeYwqv9OwKJKU0gR3xcRrozTbL4PxwbNZGgrLqvfN3cdOOwJjJH42A2ecHa0mVeQRQEv5YYoc/OI/CA0bscTetwC4pw7X14AF/V34kvOtJwC+sSYULt15UiZPGOauKOpa9ntOuhhXm8X3Zux/pXr/Dcp3iJqPdQ1kwqIm1wx04FLA+tosU+lgekKf4lyoLg== 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=Cff4uCMC8cc4jDYyIiCXot/dKLhp7rkFHt5dIeaRS7c=; b=PXVHcvB8GdBVtTus9EBBZ4QpwyxDE9Y0YksNv57fggP/tu16RpYmpCodBc5V9SFnDG4OYX6OfqJGVPrOwTE5nMvfUNoIVj6fK0cFhzrX3IJ0z/WcZ6LQes9/UKaUzZTXXwXbD6CgDcekCdY0CWQ/LoiVuC9VkN7r5eUairvemjzcridLfHzaEj7WSSNan6HndH0JK3nN2HDOLdQQ4jQ/ZFMyey6nxTa/jY01EzZlk5Fs4rVuvxQ6PgY+0ayhkZ6ena479iPaWkIhWTUCaBIsnpgxRs3bgTGaKJoLsBNsZAkPUEVhx8po3XxmucdvJg/dT2Y1HyoN+W2F8v160taxCg== 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=Cff4uCMC8cc4jDYyIiCXot/dKLhp7rkFHt5dIeaRS7c=; b=AIIX/5obUcmjskOYbLBXJ7sVqH6eUC0eZ1PZMfmNJpMF2jKbYDqlkwjdI/fnBtg+vCWjdDIeGdqd/ioMd0Um16xeY6JYwo3HDU/N9nJUclxgAkfQ7pDl91Ppup0krI1HLZeX21/Uq92yrGK1pKOzQ0Nk4jzpIxid3TaVrb93c0w= 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 PH0PR01MB6501.prod.exchangelabs.com (2603:10b6:510:15::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.27; Thu, 5 Sep 2024 22:28:42 +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 22:28:42 +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 V7 4/4] Adjust objdump start/end range per map pgoff parameter Date: Thu, 5 Sep 2024 16:28:25 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: CH2PR18CA0056.namprd18.prod.outlook.com (2603:10b6:610:55::36) To PH7PR01MB8146.prod.exchangelabs.com (2603:10b6:510:2bd::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH7PR01MB8146:EE_|PH0PR01MB6501:EE_ X-MS-Office365-Filtering-Correlation-Id: 01649d40-1d00-447b-367c-08dccdfa1899 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|52116014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?4dwTRzGD9d6zgT48o/0xE28z+TYEwOp?= =?utf-8?q?DCHbJB5GEtLkdIWdlt5xg2BCzK5fAzMApku9BMAxvAdNwgjn+pnuLojVkxn5hYAsU?= =?utf-8?q?89qqhhqDnKqw/UulGpW1Ob1x48L86bUaFdIojIlrZucsC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G9GFGZKDBvykNA15?= =?utf-8?q?QE8E5a04qWksci0JCNZI77uOrtIABcB8YiD2/5K5hpV5kOZajeDE6rkOKV2prTKm9?= =?utf-8?q?D3fkNwAfmQ9rp2Z7hmkJ010xSqAi7+UAWdLgxXuR38sDFyhzeNo1U5C/2hi0hPLZ9?= =?utf-8?q?zED5KrryIEOzW/qv3yi/DkzGbpOBGcM9hgTD5Y6zCAFwTB1jEdwe2B+xGcBqCMzro?= =?utf-8?q?KTb12E1oC3l3tTeVJ7tX245zfg97DaQFy6ktvm7RxtRQW5LP/4rD0Kdr0lXUPZXEo?= =?utf-8?q?csut/i6NqidUgVDnMnlZRxxBesAchMfm0mBTkskU7jF2qFalPakx7bhk6YU6V5928?= =?utf-8?q?jlTzd8yeOIlVPeB/6v3zte2Xn4t9Ms7FQg=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)(376014)(52116014)(366016)(1800799024)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?W7jfuyBk4H83zlykPclJ/DQ3c0zB?= =?utf-8?q?kNIE0J3Uzqie10snAlRZwTWC5kG4owfHVMavsOOtRZ8feScqVLqaqdQIAmWp9wxWW?= =?utf-8?q?uCZlBRPNA1mii2hsJkxwCt9KQ9NdoCfYx4ijmDsId5HprDsd2UxV7nj7ge59NTaaL?= =?utf-8?q?IYtpiQGJjET5fzPF8xTOBrKIPo+xuzZKY3NMJYqUNcE6ntu2q2axYQA45byeQQ9+/?= =?utf-8?q?oFUZB8X8hKKpqOrQg1YVL5+nEA3OGQyKNMTZO5UN0XizkvfRMWfwbZ/Enc90SrMvh?= =?utf-8?q?U0fillW4WYPBJHYhooz2b4n2n+TPbWXSTDbRVOcvBdOtH7B2TV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n8z7Qr?= =?utf-8?q?HKGrGUYRMr+6QfDgWDLpvuhWYHYrSEhEarBzNWLeiLldu37Lu+HxRsmTzeVLt8cU/?= =?utf-8?q?Mnf06XEfD0EZILZR81eNAIjlec0cc4vvfQIbsb1vk6X8xPE61K88h3JoqWEjlp62h?= =?utf-8?q?2V569BGZLF7rqpp/9JmWIU6xcomvDLQ1qqz28N9bCzm9b1K0kebtXpR7OF1GZhE3+?= =?utf-8?q?UDV//3J2OLt2S8u9uWAbs387E6ep1VnxtiJIbUx3xMalX7FdNKhH3v1Kwtwn/GP9S?= =?utf-8?q?Flz3emlQ0Ytdzwm9OABS2BCERXiFdxNTzZylppCj8fXiUNrKeGM7eQTyctZtiVVW3?= =?utf-8?q?4otaDgQQR20BdKxeK0GE8H9+Q7pl7fCmLb6RnBEHXbo5NSK8guucEkDIESvz6+l4n?= =?utf-8?q?/4W2m6uhFPQ?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 01649d40-1d00-447b-367c-08dccdfa1899 X-MS-Exchange-CrossTenant-AuthSource: PH7PR01MB8146.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2024 22:28:41.9187 (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: CcFXkS9kJjW0gOMdn9D2eTNGzAs3kf31rgQCoWbMycMUsVBfoMdInSeDZuuWR0Rhspx9oukNbAvucqb4uEFmujQb2kPBBKPybQhxTpdlhQ3Rqg387EHZ1l3x6DLT1ieh X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB6501 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240905_152857_789988_EC887177 X-CRM114-Status: GOOD ( 10.55 ) 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 --- tools/perf/scripts/python/arm-cs-trace-disasm.py | 14 +++++++++----- 1 file changed, 9 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..a867e0db02b8 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"] @@ -243,9 +244,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 +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 + int(map_pgoff), stop_addr + int(map_pgoff))) print_srccode(comm, param_dict, sample, symbol, dso)