From nobody Sun Nov 24 00:57:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1730119594; cv=pass; d=zohomail.com; s=zohoarc; b=kJSSvsjjhV/usOUo8ICoby1kHqPZiRZWgcuy9BMJWTqJ0ViupKvhE9i/EkNPukOUKwBrEhNeB1gHof7UcNJS6J8kTd+b83UxHFdAcJWHynt87AZIL9OCboC1Hre3R/vz0OBnuTZr+oFKFl8EMAtFPvrHaKJnmqim7UbyOS+kZPM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730119594; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ZFcBkE/m8lBfaY/RDGSA74usJ37yqes+AbUBa2xX70A=; b=PYBSkGI1TXeOkyxZBk+7F7U72BVthlA16S+qK6JZl7nBTjyEs0l5Pn+tD6hAolVuXE4Csb3bERyRdq3PTXp+a05yG1o2wnH2ODtz3f/9aGykrMPq/fgQ+0mzWsWmkPxnmK+YyEJSVw2QrDOt8J9CMK0RO2Ench6IugpoNgpp8tE= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1730119594550313.2196268254951; Mon, 28 Oct 2024 05:46:34 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.826443.1240695 (Exim 4.92) (envelope-from ) id 1t5P8O-0004fK-Em; Mon, 28 Oct 2024 12:46:12 +0000 Received: by outflank-mailman (output) from mailman id 826443.1240695; Mon, 28 Oct 2024 12:46:12 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t5P8O-0004fD-BN; Mon, 28 Oct 2024 12:46:12 +0000 Received: by outflank-mailman (input) for mailman id 826443; Mon, 28 Oct 2024 12:46:10 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t5P8M-0004Qp-UP for xen-devel@lists.xenproject.org; Mon, 28 Oct 2024 12:46:10 +0000 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on20625.outbound.protection.outlook.com [2a01:111:f403:2009::625]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 9a64753a-952a-11ef-99a3-01e77a169b0f; Mon, 28 Oct 2024 13:46:09 +0100 (CET) Received: from PH8PR05CA0014.namprd05.prod.outlook.com (2603:10b6:510:2cc::7) by BN5PR12MB9509.namprd12.prod.outlook.com (2603:10b6:408:2a8::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25; Mon, 28 Oct 2024 12:46:05 +0000 Received: from CY4PEPF0000E9D2.namprd03.prod.outlook.com (2603:10b6:510:2cc:cafe::80) by PH8PR05CA0014.outlook.office365.com (2603:10b6:510:2cc::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.11 via Frontend Transport; Mon, 28 Oct 2024 12:46:04 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000E9D2.mail.protection.outlook.com (10.167.241.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Mon, 28 Oct 2024 12:46:04 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 28 Oct 2024 07:46:03 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 28 Oct 2024 07:46:03 -0500 Received: from xcbayankuma40.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Mon, 28 Oct 2024 07:46:02 -0500 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 9a64753a-952a-11ef-99a3-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lwhqCnyLQKeD/i8x6y0clE+m+6lu3TAvl6ewlQyscDM6iDCyMhssZSmfWIfAkKD1cy8DZ2uRobAABiDD3bqyvRX2jNA5UzJpkpzsp/XPDgpBohoEYe4MEoxBZjCxLGEqz3MEKMNuaiIF3SHGDUbC5YOBzwEeSKpgOuW0JCy3WZqkJJ7718zP8FtJoavq9Ec6/gfDkJCg0fTQ8Jqh9QPvJxQzWV8RdVAmlWTVvT71pVVaoQzK6SaLKjRB2MyV9Cm9IFDsTowuBtTNuQZeS88T9oIL1LECIw+2e7LSszt6eyQCdHAwmAlXYhSQUTrgOgQvbscwrzdE7A97uu8VooZV8w== 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=ZFcBkE/m8lBfaY/RDGSA74usJ37yqes+AbUBa2xX70A=; b=cAW06+L9ec1sN1DBh5vst50QR2DrE3Uj+TLRxNOL3TqBztiG880z8FekhYNs/cNakTGQD2eBkBfKJL10OkmM7TVz5qB9kAxJtPpDBB1qhcelbWn1TbFYBEVpgMBAMd/khyU0EiKoBAErKnvG73cIwUiCDWFSwAqdMZyaZqPOD0XBbVzhY5Ex3Xruw5mhx8Ugmy1//Tq27ua7g4vgsJNdTkkBWygcKZay0uJx1VPGszpR1i/HK9mwcXqkldYVasseQKtNXXgJsDrSd1+8rQ7mXVLykTAUo6mGVxwuJC2nmagxV4wrpdczgKk8RXZ+5t4F9B0abhKyVTHXUSmz1xxqdA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZFcBkE/m8lBfaY/RDGSA74usJ37yqes+AbUBa2xX70A=; b=Ed/Vlc5FhM82IZXFH+IHF8mKTb08v+dmz6oXLUpjMWfW106MOT0dDu/q3amEOqB1rmv7yY4X3kuxdzqeL9Ih8/DcovUTj7vMCf5hFK+w+7i2y05A+ILyf9GyVPHEfcv/hsnLeOwJQigBOFiFpFrs6GVFcU+Rw+p1O/cH+VgvOvE= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C From: Ayan Kumar Halder To: CC: Ayan Kumar Halder , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , "Volodymyr Babchuk" Subject: [PATCH v4 1/6] xen/arm: Skip initializing the BSS section when it is empty Date: Mon, 28 Oct 2024 12:45:42 +0000 Message-ID: <20241028124547.1371867-2-ayan.kumar.halder@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241028124547.1371867-1-ayan.kumar.halder@amd.com> References: <20241028124547.1371867-1-ayan.kumar.halder@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: None (SATLEXMB05.amd.com: ayan.kumar.halder@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9D2:EE_|BN5PR12MB9509:EE_ X-MS-Office365-Filtering-Correlation-Id: 53cd0bc6-e4b2-4d50-0ff7-08dcf74e7c38 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|36860700013|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?cvxwfj4eHV0JoCE+Q169lAE4VlTbORZrvftkh/Nl2mzNlyzvXK18sAFJOXyx?= =?us-ascii?Q?nn/W+ntN9ySx6ILDjt7i4uMVmxH3ZcjeE6bGJuyeIoWB6psjqzehR/43gpw2?= =?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OVBDU552IhM2vGEbCPLXU4RCDLRca+0uZLnzpFo?= =?us-ascii?Q?YF6olaRTl8p+EfD3GuA7JEtAZpUvEKYOPj9k5WKz4B726OsQEJmwzVzu/tMg?= =?us-ascii?Q?Td4knFjYY5y/+4RLBB/NOKiERuJKwhyZW4DNyN9LqB5Z7/IyjXYyA38NZE/9?= =?us-ascii?Q?qLJULRNQCwWw7pYVrmjebRetASaXph+m2KUbfPT3WT2hm5ClPSTrQwho8Y0i?= =?us-ascii?Q?kAbNPYYM8/O4zpsN32ljY7DKcmqjBwLBh/WHXIfKkeshcsjsdU0UMEqgNayD?= =?us-ascii?Q?4e4QSmyq/iNOkEQ5kOvBEyZp5Ah2NqhxzdNJeQeGZHg6GvsXq3D5CB5ZLG3s?= =?us-ascii?Q?PiLvaBq/nmzi/Y1c2D3iR//DeWY1iEzfNHtsR1oOrfXEaw3vd9r+igfJkK3k?= =?us-ascii?Q?iq3zEe1WDBXidOMdKuKFbx/ZeLIsrGOJGrtV+nz2GdyGucnDuA=3D=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(82310400026)(36860700013)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 12:46:04.1607 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 53cd0bc6-e4b2-4d50-0ff7-08dcf74e7c38 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000E9D2.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN5PR12MB9509 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1730119596233116600 Content-Type: text/plain; charset="utf-8" If the BSS section is empty, then the function should return. If one does not check whether the BSS section is empty or not, then there i= s a risk of writing 0s outside of BSS section (which may contain critical data). Fixes: dac84b66cc9a ("xen: arm64: initial build + config changes, start of = day code") Signed-off-by: Ayan Kumar Halder Reviewed-by: Julien Grall Reviewed-by: Luca Fancellu --- Changes from :- v1..v2 - New patch introduced in v3. v3 - 1. Update the check in arm32 as well. 2. Drop the R-bs. xen/arch/arm/arm32/head.S | 3 +++ xen/arch/arm/arm64/head.S | 2 ++ 2 files changed, 5 insertions(+) diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S index a96d5d3503..4ff5c220bc 100644 --- a/xen/arch/arm/arm32/head.S +++ b/xen/arch/arm/arm32/head.S @@ -185,12 +185,15 @@ zero_bss: PRINT("- Zero BSS -\r\n") mov_w r0, __bss_start /* r0 :=3D vaddr(__bss_start) */ mov_w r1, __bss_end /* r1 :=3D vaddr(__bss_end) */ + cmp r1, r0 + beq skip_bss =20 mov r2, #0 1: str r2, [r0], #4 cmp r0, r1 blo 1b =20 +skip_bss: mov pc, lr ENDPROC(zero_bss) =20 diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S index 14c3720d80..72c7b24498 100644 --- a/xen/arch/arm/arm64/head.S +++ b/xen/arch/arm/arm64/head.S @@ -346,6 +346,8 @@ FUNC_LOCAL(zero_bss) PRINT("- Zero BSS -\r\n") ldr x0, =3D__bss_start /* x0 :=3D vaddr(__bss_start) */ ldr x1, =3D__bss_end /* x1 :=3D vaddr(__bss_end) */ + cmp x1, x0 + beq skip_bss =20 1: str xzr, [x0], #8 cmp x0, x1 --=20 2.25.1