From nobody Mon Sep 16 19:04:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+105077+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=fail(p=none dis=none) header.from=arm.com Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1684508163862272.7877390444078; Fri, 19 May 2023 07:56:03 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id I7VWYY1788612xW3KZ9yhxWn; Fri, 19 May 2023 07:56:03 -0700 X-Received: from EUR04-HE1-obe.outbound.protection.outlook.com (EUR04-HE1-obe.outbound.protection.outlook.com [40.107.7.71]) by mx.groups.io with SMTP id smtpd.web10.28516.1684508161637454227 for ; Fri, 19 May 2023 07:56:02 -0700 X-Received: from AS9PR06CA0204.eurprd06.prod.outlook.com (2603:10a6:20b:45d::30) by DB9PR08MB9778.eurprd08.prod.outlook.com (2603:10a6:10:45d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.21; Fri, 19 May 2023 14:55:55 +0000 X-Received: from AM7EUR03FT022.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:45d:cafe::50) by AS9PR06CA0204.outlook.office365.com (2603:10a6:20b:45d::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.21 via Frontend Transport; Fri, 19 May 2023 14:55:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+105077+1787277+3901457@groups.io; helo=mail02.groups.io; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C X-Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM7EUR03FT022.mail.protection.outlook.com (100.127.140.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.19 via Frontend Transport; Fri, 19 May 2023 14:55:54 +0000 X-Received: ("Tessian outbound 945aec65ec65:v136"); Fri, 19 May 2023 14:55:54 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 042d1b1901a8a3c6 X-CR-MTA-TID: 64aa7808 X-Received: from 2e7a1254c0bb.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id F02006CA-A4CB-4A56-86F3-7410900AF464.1; Fri, 19 May 2023 14:55:46 +0000 X-Received: from EUR03-DBA-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 2e7a1254c0bb.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 19 May 2023 14:55:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NZ+vUBQvQZ9Ry537Ll3BqiZbWdvTqpCTTseE6FyO0ufA7hpff1ESwAJxHVbQtyRiffpAkpdQ1SJwCePNzyubFwt1B7lloPgf2UvFpgdfuwvOlKARkI6uYb1EDcUZ/LWqNRStYhnVFZ3SChQyOgTREteljK8QOfXDpBlRy77+thW3xebFAMdSoCyNWXie9y6Yu1F8nV5pokd7NuX6d8/V2vJ56ZI6TmqZLRDAIIH/iUe8NJEgeY4JZOPVfv+3VSq86VLwWtJiG7Bo2LEim3hC9lL05GNvf5rIp+dQhKngSPSZ49jFtMSlYOKNrGS7qFTCZiIRYyMaQxItwdvAIx6huw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=F9ccuwKbBV9NGPNWFJsDOfL86MDC5OW2PpxJJcJjRS4=; b=mdhsxpyO6T/Vm8l6ZKbDPBYZwC0itodiT7+qivgbWS+O6+Ja1LCN5zuX6Bv/Y3+SnUy0Odp2lQW9hJ4bj38VesNBHHTpjJigGS3iglYnw0VSectHkEy/aMKEtHXKRfWZ1N43BORAjbahoS2tHa+MTZXVwYfYEIaf69nHelFX60uX1F9q0RP+E8+UBkLke0uATrdmobMWSWPqsiGk2vavjIhSf2Dj6MmY7b2qsZiCCNSRx9gWZ170dwjbFIYM8/pGwuCI6S+kmo+2C+la3MmY38FjkOGS6NLFGpEYgOenH9SGNHENdSolgPLobRFG9eRELWrpxrutCBujJKDbjRo9jA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none X-Received: from DUZP191CA0037.EURP191.PROD.OUTLOOK.COM (2603:10a6:10:4f8::9) by AS8PR08MB6389.eurprd08.prod.outlook.com (2603:10a6:20b:33e::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.21; Fri, 19 May 2023 14:55:44 +0000 X-Received: from DBAEUR03FT019.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:4f8:cafe::1d) by DUZP191CA0037.outlook.office365.com (2603:10a6:10:4f8::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.21 via Frontend Transport; Fri, 19 May 2023 14:55:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C X-Received: from nebula.arm.com (40.67.248.234) by DBAEUR03FT019.mail.protection.outlook.com (100.127.142.129) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6411.21 via Frontend Transport; Fri, 19 May 2023 14:55:44 +0000 X-Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Fri, 19 May 2023 14:55:44 +0000 X-Received: from E114225.Arm.com (10.1.196.36) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Fri, 19 May 2023 14:55:43 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , , , , , , Subject: [edk2-devel] [PATCH v2 5/5] ArmVirtPkg/PrePi: Allocate separate stack for Dxe phase Date: Fri, 19 May 2023 15:55:40 +0100 Message-ID: <20230519145540.46700-6-sami.mujawar@arm.com> In-Reply-To: <20230519145540.46700-1-sami.mujawar@arm.com> References: <20230519145540.46700-1-sami.mujawar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DBAEUR03FT019:EE_|AS8PR08MB6389:EE_|AM7EUR03FT022:EE_|DB9PR08MB9778:EE_ X-MS-Office365-Filtering-Correlation-Id: 9c5a953d-3047-4c1f-69f1-08db587925a7 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: Kv+kCO/jfgf6z+cfR4/CBdW8uKIQ8xjCOpRN0KXbHmRlgPOEsflT/QPQd5H3YcRHFbrF0d3FFJyesmFArXlbpBVjJ3OaEg4oa7vGvgicsxN6P3zhhFh6POWOYnWaS3p+mHu2v3Gr0PHNHfh25nR+yK5ajWA62KegeKP+WiPbT0AflWFGf6m888AT1+QwOsGRPWszIQGOCJVZVCs01doWwnUrHM28A3AG3wUWXKFq93SMBaSy4CK5281eSlHjDZM4VGwPByz3UQFXGLpSOZNS/NcPr13P8Iod/Hl5nPuih9KOeaT07kFKxC+74GjvvDeXI+ZES3gOe3XuxCALJVqYo2wFH58cr+nVIE8I86PXEHQxVJakcxSrNLbO4InIgB5k7Ub8895kgt7N1PAej4ODr83ow0IWHYqybLPidkf0ZLcn/zbeg85dKR3EOXr9Aj4clzX+Uie9h9GAFtCzQkdwdS+SWvJxOwMWD/SDtTC5RcneU8MG77drA6titk7QcltSy+aYYGLohbcsl6NII41VBbamAt3Ru66nJ4kTbd3SzgLDXCoEp9LsvFAYYPniZWYbBNGouYpGaBpamc4K/xK17yLUVRePDQmT7WEjyCsUX9U28MH2R3FLy9+JoIENhNChq2QHlYZzO+uAzrF0gDmupQVGXkL0Np1Yz6S74b+veqndSRiDKtCFt/1jnQ41bAWJafXFrI8/h5ehKJgBJMf8srrEktFpFMIDzNbpFmI9w5GalUFRLJGGsMS4PAqZdEPcts2Hgg56R82xRO+7JPjCBQ== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(346002)(136003)(376002)(396003)(39860400002)(451199021)(40470700004)(46966006)(36840700001)(336012)(86362001)(36756003)(40480700001)(82310400005)(8936002)(26005)(8676002)(1076003)(2616005)(44832011)(426003)(5660300002)(186003)(316002)(54906003)(6916009)(70586007)(70206006)(41300700001)(4326008)(478600001)(7696005)(356005)(81166007)(82740400003)(83380400001)(47076005)(36860700001)(2906002)(40460700003)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6389 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT022.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 402be40a-5549-4c97-bb83-08db58791f9f X-Microsoft-Antispam-Message-Info: QoFjNWQJiwZU7ix7U4Z1r/kmPyiB5s4EA+0h7MVIuMy+qXMyuK+cdWcpD0S8XJzHMu0DMnE8ZOYbC1Y2+4mPjiLuaNeY8UMauSOFQe3DdPVO90guQ2Alig+Gi0U4O3XNS5z3YWeU4rbkCoDNlu2McHiOeCNlO0cOpWy9uNi+eAb0kcshGstbZ/8SkhRUw0lehlmzF4UrC90t/DgO+YxLMRRd22Igbf9TeyR5qpWiMwfgWJqGQHaDHvF3GzW5vVXflN1LSoMWfbPnhqZohjjYrgSjbGi8FlDoCdnPZiqiTaEZssFWMPg7Cc0wxQ268GRf+/KxZLGIuwZFpRT+n/+8/oUcLCcQsMtSL4q/Dp5N0bWLLh0uXhG6BGcdme/PVQzzsMJUsG06D9S3app84Rz0ncquYM2250MjW+EfCst3ACaCqwjGInjGAaykiMkt7a2qXboijTd7lWiMC4KqJphDTEVerd8WMT24K5DLn7R1P2cJ0Vo/9bYiypIpL+9Jqt9Zv7DjOZh2T9uMtrS5gf07b5zk1buZCQfj0rDJKcDyy1jkQiYNoFOeDdCyGZRBboTwqKzINpwB0HceqMuMWYEfecXdrgtYZakGGc1WR9m8yPPEMRcC3JypIZbsc1yxbz4rsfnEvM0syFGdjl++XndHLFYdnRPQsusw1zh4o+F/4yqZ9yrLQzlKfNdZeD9QPPGA6AQvK3BO9Vfd03O+abGqqGp0sWoT8TE4yiAqozwfMkJ1hAnbqkmT5YRadTJzfZwa X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2023 14:55:54.8604 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9c5a953d-3047-4c1f-69f1-08db587925a7 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM7EUR03FT022.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB9778 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,sami.mujawar@arm.com X-Gm-Message-State: YxZ3qn9YcA7pPALujSyP4heUx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1684508163; bh=sB3yNuqe0L0t9kAc8B1sstUj9YqKbRx39kS4wg6n6aY=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=bEP/qS6agKcOZN5beeALl903ZX1pISAyQiRTZm14Ym3DDrcXWQDvFAfg7oSJOoQIYC9 bn5nE5gBH6xpX27z5kUZvx3tWu+/UrzRAdYp+nwqABLjyzi09mIvNrgTqgnTPpJ8/VxiI sQAmxAOY/+nREjHaJ+qtQf/C99swO85RycQ= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1684508165107100009 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The patch "f07a9df9af60 ArmVirtPkg: Enable stack guard" enabled stack overflow detection for ArmVirtPkg. Following this patch, running UEFI shell command 'dmpstore' resulted in a crash indicating a stack overflow. Invoking 'dmpstore' results in recursive calls to CascadeProcessVariables () which apparently consumes the available stack space and overflows. Normally, SEC and PEI run off the initial stack, and the DxeIpl PEIM is in charge of launching the DxeCore with a full-sized stack and remapping it non-executable as well. PrePi platforms take some shortcuts and the DXE and BDS run off the initial stack which is relatively small. It is therefore desirable to allocate 128 KiB worth of boot services data memory as the stack for the Dxe phase. The PrePiMain () in ArmVirtPkg/PrePi/PrePi.c invokes the LoadDxeCoreFromFv () to load the Dxe core and transfers control. The second parameter to LoadDxeCoreFromFv () is the stack size, which is currently set to 0. LoadDxeCoreFromFv () is implemented in PrePiLib and if the stack size is 0, it continues to use the initial stack. However, if a stack size is specified in the call to LoadDxeCoreFromFv (), memory is allocated for a new stack and the stack is switched to use the newly allocated stack for the Dxe phase. Therefore, specify 128 KiB as the stack size in the call to LoadDxeCoreFromFv () so that a separate stack is allocated and used for the Dxe phase. Signed-off-by: Sami Mujawar --- ArmVirtPkg/PrePi/PrePi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ArmVirtPkg/PrePi/PrePi.c b/ArmVirtPkg/PrePi/PrePi.c index 3d943b2138d3fe8a03322262111d5f7df3e39d39..ff51a757a21a19347c78b093698= 7c9f8cc283c0f 100755 --- a/ArmVirtPkg/PrePi/PrePi.c +++ b/ArmVirtPkg/PrePi/PrePi.c @@ -1,6 +1,6 @@ /** @file * -* Copyright (c) 2011-2014, ARM Limited. All rights reserved. +* Copyright (c) 2011-2023, Arm Limited. All rights reserved. * * SPDX-License-Identifier: BSD-2-Clause-Patent * @@ -101,7 +101,7 @@ PrePiMain ( ASSERT_EFI_ERROR (Status); =20 // Load the DXE Core and transfer control to it - Status =3D LoadDxeCoreFromFv (NULL, 0); + Status =3D LoadDxeCoreFromFv (NULL, SIZE_128KB); ASSERT_EFI_ERROR (Status); } =20 --=20 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#105077): https://edk2.groups.io/g/devel/message/105077 Mute This Topic: https://groups.io/mt/99013767/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-