From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (EUR04-DB3-obe.outbound.protection.outlook.com [40.107.6.45]) by mx.groups.io with SMTP id smtpd.web09.16907.1638985591322322276 for ; Wed, 08 Dec 2021 09:46:32 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=6Fv1at7J; spf=pass (domain: arm.com, ip: 40.107.6.45, mailfrom: omkar.kulkarni@arm.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ftk7DchP9IIHRICL2AfpCv5Ff7Mrt4qDGeDK6TFMO+Q=; b=6Fv1at7JV3VTdYkv1GuWJAnl699GoZv3NAU3EUEpjJGVt+n/XbHOvgMalUg0zgHVHakLX242ydkq4ugRxuj5HIM8f1fPJNvxhdQ1a1bwjHzS+XjltQ18O1747ocZBhlKz09AAQkejFkjtsd2fQ/3e1h5kj6V6gNX5iKAXc5m2eU= Received: from DB3PR08CA0010.eurprd08.prod.outlook.com (2603:10a6:8::23) by PAXPR08MB6495.eurprd08.prod.outlook.com (2603:10a6:102:dd::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.16; Wed, 8 Dec 2021 17:46:27 +0000 Received: from DB5EUR03FT003.eop-EUR03.prod.protection.outlook.com (2603:10a6:8:0:cafe::a7) by DB3PR08CA0010.outlook.office365.com (2603:10a6:8::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.17 via Frontend Transport; Wed, 8 Dec 2021 17:46:27 +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 (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; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT003.mail.protection.outlook.com (10.152.20.157) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.13 via Frontend Transport; Wed, 8 Dec 2021 17:46:27 +0000 Received: ("Tessian outbound f493ab4f1fb8:v110"); Wed, 08 Dec 2021 17:46:27 +0000 X-CR-MTA-TID: 64aa7808 Received: from b7a8f0e2156d.3 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 6A4A5196-5FFB-42E7-81C2-11902E138C93.1; Wed, 08 Dec 2021 17:46:17 +0000 Received: from EUR01-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id b7a8f0e2156d.3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 08 Dec 2021 17:46:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=flc1wd8LNTsZr4Xb7bAvR6GYxqI+smoI6ugrj8OqsOidJxqCvVd48xYNTMrQISil/p5WytYqdd8fS59DTmCLExSOFbhZ/qaCzFK7QjypHxws3KfUfzg4d3tOCbiLO90ZXW/i6Vxf2LC+M3rdfWwqmksGqp8qmjP3VYFs1nb48AhC7SVXhHdv8d1xwblXpHKyDergRM/bNouWra5un1eqhYkG8iFtCiIPjIawZY7G+aED6uLBuyB8RLcYLn+HJxJ7fe1gTP1PHtdjbowpm7f5suxJbkIlpeMul+wF9rrcgVraJm3E9TTRmV2WtI8zyJUGP7E5kODlpDUDvv6pcYgCwQ== 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=ftk7DchP9IIHRICL2AfpCv5Ff7Mrt4qDGeDK6TFMO+Q=; b=atVCSy8jG4F3dLF++dr29JvxX9KsaUBi//3EEM9O40LtvNFY8IL98hYBKrSJxLyBnSjFRxtsvRUx/O2vx4TJvjN0Rv2BaDc9mE2AoHtFuuAe0jrAUYRV0srxUlqCClLopauvJAXCgbtEvv5Sv0D86dUnv8j/IeLnuizITKouwMg1FjbgPduEc2BO33hpyOP4d0CtBmYQV22R2n/Cl2oinG6C2XOCS1pSJcKYvNrtWUS71AXoHwjxU9pFCdm3es7bafrNCzfC2gt/KqBvOVtifw7pJBBRxVLKD4P+uVoPewOfUApzGiiwgSJwRGbQBed/H8ybG7VcZft0SOcSlQvbrQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ftk7DchP9IIHRICL2AfpCv5Ff7Mrt4qDGeDK6TFMO+Q=; b=6Fv1at7JV3VTdYkv1GuWJAnl699GoZv3NAU3EUEpjJGVt+n/XbHOvgMalUg0zgHVHakLX242ydkq4ugRxuj5HIM8f1fPJNvxhdQ1a1bwjHzS+XjltQ18O1747ocZBhlKz09AAQkejFkjtsd2fQ/3e1h5kj6V6gNX5iKAXc5m2eU= Received: from DBAPR08MB5781.eurprd08.prod.outlook.com (2603:10a6:10:1ad::23) by DB9PR08MB6747.eurprd08.prod.outlook.com (2603:10a6:10:26e::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.23; Wed, 8 Dec 2021 17:46:13 +0000 Received: from DBAPR08MB5781.eurprd08.prod.outlook.com ([fe80::7437:473b:28e:8045]) by DBAPR08MB5781.eurprd08.prod.outlook.com ([fe80::7437:473b:28e:8045%3]) with mapi id 15.20.4755.022; Wed, 8 Dec 2021 17:46:13 +0000 From: "Omkar Anand Kulkarni" To: "devel@edk2.groups.io" , "huangming@linux.alibaba.com" , Sami Mujawar , "ardb+tianocore@kernel.org" , "jiewen.yao@intel.com" , Supreeth Venkatesh CC: "ming.huang-@outlook.com" Subject: Re: [edk2-devel] [PATCH edk2 v1 3/3] StandaloneMmPkg: Fix check buffer address failed issue from TF-A Thread-Topic: [edk2-devel] [PATCH edk2 v1 3/3] StandaloneMmPkg: Fix check buffer address failed issue from TF-A Thread-Index: AQHXwaRN8Ffxjam6r0KejzrY0BmZ1qwpFCTQ Date: Wed, 8 Dec 2021 17:46:13 +0000 Message-ID: References: <20211015090623.52511-1-huangming@linux.alibaba.com> <20211015090623.52511-4-huangming@linux.alibaba.com> In-Reply-To: <20211015090623.52511-4-huangming@linux.alibaba.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: A256FA3A1F6FF8468AC883E69416DAC8.0 x-checkrecipientchecked: true Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-MS-Office365-Filtering-Correlation-Id: 0c8fa4ab-6913-47eb-8832-08d9ba72a92a x-ms-traffictypediagnostic: DB9PR08MB6747:EE_|DB5EUR03FT003:EE_|PAXPR08MB6495:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:10000;OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 2FmzKMTYX4KkPfwWX1Drpl5Y29Jj6t/afvDfepRuHWGSpCHnsMaB3WkFvC1Fg0uM16lb9IKZf2xnwURiuGmBcchaf7aX04bBafrV3PeZwEkkgCOXiKhoa/cEcoXRYPW6QJiOv9XsE5FaFFJ3s7UOsHZKLWl7WD7WpVKK+frdKr4J1TO2tz2UtRGOa4ZArkSpZAyRsdbBHphwjtzBQK3gZJoxRGLvXccoB1ie1LPY/PRPrMycaJPo1eBUMpogwvDHdg9eCrSFyfmfC+wcL6kNI7SCyNCf9HXGpOUQD1X3ruU0UB7e/wehBw0HwQivdkSOrC1/+h8aAMkDS/FsTN0BfdEimuKjAvn+rRq912NZzEaqhlRnSbVIinTc6Gt6KTk6YJ/iXg9GBzEgxHxdgxhmUgecWpKdF3Wz/VFLU4Gc2B5sGDRq1xrB9y0fLVa1iq6FZFSBSujYlE2upa2lcKNXrr1oN3lCfarvWrOz46fAyW/eK5nd8F5YCfQs/BWPTjQrR4q0HeKRYf7TasW3EEClH2NwwEPV6Je43QRR9WuyJ09dOvVurgqv0frRcQT9cdDJqwMeG1IpguydYqKLjUlV4HH2kTlkvwH9zuRNMco3Ooi42tXg0pZYOOCzFOeumsDJQszJ2n2yGfd2QRCg9SZzt2FOAId4WCJnMOrlXehQzfrAZCmCoZkRpqwL/brHmSp7qMYiRIPGlsP9XjsMroF8sOk+fE3IdxXBLVp2i4VykoJO7o4mQDss59m6gu4wRT+IZ+OCcGvC0ImzZVIs4pB0TexqMSXCyD6hIwfHF8/mvWc5+0YowBcwwcWz+7Tw82KHoSbWRw5qTHXae5UrD0knKQ== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DBAPR08MB5781.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(6029001)(4636009)(366004)(26005)(66476007)(8936002)(66446008)(2906002)(53546011)(8676002)(186003)(6506007)(110136005)(71200400001)(66946007)(76116006)(52536014)(4326008)(316002)(38100700002)(38070700005)(6636002)(83380400001)(508600001)(9686003)(86362001)(122000001)(966005)(33656002)(64756008)(66556008)(55016003)(5660300002)(7696005);DIR:OUT;SFP:1101; MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6747 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Return-Path: Omkar.Kulkarni@arm.com X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT003.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 4276b504-ad19-48cc-5885-08d9ba72a0cd X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TiewQrLK2LF3umgxuuCR68y3r+RmRCHuUIzUmbb3OUZZEPIL2+8vXH/NPZU0zqEJ4MFuZDGI4lzQs1p0OdBn6aec7H09nw4ceXNOxMnWOqfvurYa5eaSBKKiPZBHqT8cCCOxDd9bXPI97QcWYx9yYUoiISA8MZVv3/CPV/uq/Ynll30mgtPlsQGvCuAc73SL8TvILlt6WSAOtWb8+ZJFIVg2G0T/f1skVrHjWMSpAGOH/cZfnPOEC54cKkjjJF5X/fgeY0Sd9K7fFv68GKumtbLl0GS6IjZNu7hSxSdUefcS00BdbuzrNFzy9ffgttQzOlwtGyU3ZKOrdsyDA+QyzSegrvQqF73a2sT0KSZtAUwFMbFdWMB4167yqMw6IltcIagpCWF2njoR5m7/pNrKTdd1rIl2XmFSrBw2Ow+QqviXm8YZZpCaM7OgNxAVIfNVyZ0K/GPiI4x+I577KLIka9CkG1OLyqycRmqVimkb7KRyuq6RMfpf8z0/HSt6VGMvGs4GmdwqJ2JnNFR/AEBl3tmwT4xewll0xrgyUCp19jIKhSUEz1MbKUrkBF4ouSjanpZgsRBu6+ixv1s11oo3HM04W91T4Kj04ZvoluqFHbgwM9xdRfli5fchw9ICdvaehNgyffht7sYuTyjK8KfpvEk5H5hqo05+a4Bth5LlCccZKzygRMKnovcC+o/8rru2V6+CMlI7SqS2xOr1k5uKatUFu3OKF/y0fVPAK0OWEdkWmz7oB7PcaW2Ar2MogD951lKn2eNkfzf93VzsDnRLUuiPqGFfvHeqrvS8fcrLoZNt1DrGQZPQZeJbYrlXwmIIiD/0qW+Wv1VugOrtno2EUe1DbgVh/QbcAoYKF+5bF635ToEHsbUw1679eFzGTKz0iuwkuU1J8iOzdKkLC37oyQ== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(6029001)(4636009)(36840700001)(46966006)(40470700001)(70586007)(2906002)(8676002)(107886003)(4326008)(47076005)(52536014)(36860700001)(70206006)(316002)(40460700001)(356005)(26005)(86362001)(110136005)(508600001)(336012)(6506007)(53546011)(966005)(6636002)(7696005)(83380400001)(33656002)(82310400004)(81166007)(9686003)(55016003)(5660300002)(8936002)(186003);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Dec 2021 17:46:27.6730 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0c8fa4ab-6913-47eb-8832-08d9ba72a92a 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: DB5EUR03FT003.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB6495 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Ming, Thanks for this patch. This patch helps to resolve Standalone MM issue whil= e exercising RAS use case. Few comments mentioned inline. - Omkar On 10/15/21 2:39 PM, Ming Huang via groups.io wrote: > There are two scene communicate with StandaloneMm(MM): > 1 edk2 -> TF-A -> MM, communicate MM use non-secure buffer which > specify by EFI_SECURE_PARTITION_BOOT_INFO.SpNsCommBufBase; > 2 RAS scene: fiq -> TF-A -> MM, use secure buffer which > specify by EFI_SECURE_PARTITION_BOOT_INFO.SpShareBufBase; > > For now, the second scene will failed because check buffer address. > This patch add CheckBufferAddr() to support check address for secure buff= er. > > Signed-off-by: Ming Huang > --- > StandaloneMmPkg/Drivers/StandaloneMmCpu/EventHandle.c | 70 > ++++++++++++++++---- > StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.c | 21 > ++++++ > StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.h | 1 + > 3 files changed, 79 insertions(+), 13 deletions(-) > > diff --git a/StandaloneMmPkg/Drivers/StandaloneMmCpu/EventHandle.c > b/StandaloneMmPkg/Drivers/StandaloneMmCpu/EventHandle.c > index 5dfaf9d751..63fab1bd78 100644 > --- a/StandaloneMmPkg/Drivers/StandaloneMmCpu/EventHandle.c > +++ b/StandaloneMmPkg/Drivers/StandaloneMmCpu/EventHandle.c > @@ -50,6 +50,7 @@ EFI_MM_COMMUNICATE_HEADER > **PerCpuGuidedEventContext =3D NULL; > > // Descriptor with whereabouts of memory used for communication with > the normal world EFI_MMRAM_DESCRIPTOR mNsCommBuffer; > +EFI_MMRAM_DESCRIPTOR mSCommBuffer; > > MP_INFORMATION_HOB_DATA *mMpInformationHobData; > > @@ -60,6 +61,58 @@ EFI_MM_CONFIGURATION_PROTOCOL mMmConfig =3D > { > > STATIC EFI_MM_ENTRY_POINT mMmEntryPoint =3D NULL; > > +STATIC > +EFI_STATUS > +CheckBufferAddr ( > + IN UINTN CommBufferAddr > + ) > +{ > + UINTN CommBufferSize; > + EFI_STATUS Status; > + > + Status =3D EFI_SUCCESS; > + if (CommBufferAddr < mNsCommBuffer.PhysicalStart) { > + Status =3D EFI_ACCESS_DENIED; > + } > + > + if ((CommBufferAddr + sizeof (EFI_MM_COMMUNICATE_HEADER)) >=3D > + (mNsCommBuffer.PhysicalStart + mNsCommBuffer.PhysicalSize)) { > + Status =3D EFI_INVALID_PARAMETER; Single space after "Status =3D " - Omkar > + } > + > + // Find out the size of the buffer passed CommBufferSize =3D > + ((EFI_MM_COMMUNICATE_HEADER *) CommBufferAddr)->MessageLength > + > + sizeof (EFI_MM_COMMUNICATE_HEADER); > + > + // perform bounds check. > + if (CommBufferAddr + CommBufferSize >=3D > + mNsCommBuffer.PhysicalStart + mNsCommBuffer.PhysicalSize) { > + Status =3D EFI_ACCESS_DENIED; Single space after "Status =3D " - Omkar > + } > + > + if (!EFI_ERROR (Status)) { In case of error this function call will not return from here. It will exec= ute the code below comparing the MM Communicate buffer address with the Sec= ure buffer address, which may cause wrong return type being returned. Can y= ou check this, please? - Omkar > + return EFI_SUCCESS; > + } > + > + Status =3D EFI_SUCCESS; > + if (CommBufferAddr < mSCommBuffer.PhysicalStart) { > + Status =3D EFI_ACCESS_DENIED; > + } > + > + if ((CommBufferAddr + sizeof (EFI_MM_COMMUNICATE_HEADER)) >=3D > + (mSCommBuffer.PhysicalStart + mSCommBuffer.PhysicalSize)) { > + Status =3D EFI_INVALID_PARAMETER; > + } > + > + // perform bounds check. > + if (CommBufferAddr + CommBufferSize >=3D > + mSCommBuffer.PhysicalStart + mSCommBuffer.PhysicalSize) { > + Status =3D EFI_ACCESS_DENIED; > + } > + > + return Status; > +} > + CheckBufferAddr() function performs validity and overflow checks on the Com= munication buffers. These checks are same for both the non-secure MM communicate buffer and secure buffer shared between EL3 and S-EL0. Can t= his code be combined ( example below)? This will help mitigate the above me= ntioned return type issue as well. STATIC EFI_STATUS CheckBufferAddr ( IN UINTN CommBufferAddr ) { UINTN CommBufferSize; EFI_STATUS Status; EFI_MMRAM_DESCRIPTOR CommBuffer; if (CommBufferAddr < mNsCommBuffer.PhysicalStart || CommBufferAddr > (mNsCommBuffer.PhysicalStart + mNsCommBuffer.Physica= lSize)) { CommBuffer =3D mSCommBuffer; } else { CommBuffer =3D mNsCommBuffer; } if (CommBufferAddr < CommBuffer.PhysicalStart) { Status =3D EFI_ACCESS_DENIED; } if ((CommBufferAddr + sizeof (EFI_MM_COMMUNICATE_HEADER)) >=3D (CommBuffer.PhysicalStart + CommBuffer.PhysicalSize)) { Status =3D EFI_INVALID_PARAMETER; } // Find out the size of the buffer passed CommBufferSize =3D ((EFI_MM_COMMUNICATE_HEADER *) CommBufferAddr)->Messag= eLength + sizeof (EFI_MM_COMMUNICATE_HEADER); // perform bounds check. if (CommBufferAddr + CommBufferSize >=3D CommBuffer.PhysicalStart + CommBuffer.PhysicalSize) { Status =3D EFI_ACCESS_DENIED; } return Status; } - Omkar > /** > The PI Standalone MM entry point for the TF-A CPU driver. > > @@ -104,25 +157,16 @@ PiMmStandaloneArmTfCpuDriverEntry ( > return EFI_INVALID_PARAMETER; > } > > - if (NsCommBufferAddr < mNsCommBuffer.PhysicalStart) { > - return EFI_ACCESS_DENIED; > - } > - > - if ((NsCommBufferAddr + sizeof (EFI_MM_COMMUNICATE_HEADER)) >=3D > - (mNsCommBuffer.PhysicalStart + mNsCommBuffer.PhysicalSize)) { > - return EFI_INVALID_PARAMETER; > + Status =3D CheckBufferAddr (NsCommBufferAddr); if (EFI_ERROR (Status)= ) > + { > + DEBUG ((DEBUG_ERROR, "Check Buffer failed: %r\n", Status)); > + return Status; > } > > // Find out the size of the buffer passed > NsCommBufferSize =3D ((EFI_MM_COMMUNICATE_HEADER *) > NsCommBufferAddr)->MessageLength + > sizeof (EFI_MM_COMMUNICATE_HEADER); > > - // perform bounds check. > - if (NsCommBufferAddr + NsCommBufferSize >=3D > - mNsCommBuffer.PhysicalStart + mNsCommBuffer.PhysicalSize) { > - return EFI_ACCESS_DENIED; > - } > - > GuidedEventContext =3D NULL; > // Now that the secure world can see the normal world buffer, allocate > // memory to copy the communication buffer to the secure world. > diff --git > a/StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.c > b/StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.c > index fd9c59b4da..96dad20dd1 100644 > --- a/StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.c > +++ b/StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.c > @@ -107,6 +107,7 @@ StandaloneMmCpuInitialize ( > UINTN Index; > UINTN ArraySize; > VOID *HobStart; > + EFI_MMRAM_HOB_DESCRIPTOR_BLOCK *MmramRangesHob; > > ASSERT (SystemTable !=3D NULL); > mMmst =3D SystemTable; > @@ -186,6 +187,26 @@ StandaloneMmCpuInitialize ( > CopyMem (&mNsCommBuffer, NsCommBufMmramRange, > sizeof(EFI_MMRAM_DESCRIPTOR)); > DEBUG ((DEBUG_INFO, "mNsCommBuffer: 0x%016lx - 0x%lx\n", > mNsCommBuffer.CpuStart, mNsCommBuffer.PhysicalSize)); > > + Status =3D GetGuidedHobData ( > + HobStart, > + &gEfiMmPeiMmramMemoryReserveGuid, > + (VOID **) &MmramRangesHob > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "MmramRangesHob data extraction failed - > 0x%x\n", Status)); > + return Status; > + } > + > + // > + // As CreateHobListFromBootInfo(), the base and size of buffer shared > + with // privileged Secure world software is in second one. > + // > + CopyMem ( > + &mSCommBuffer, > + &MmramRangesHob->Descriptor[0] + 1, Can this be changed to &MmramRangesHob->Descriptor[1], - Omkar > + sizeof(EFI_MMRAM_DESCRIPTOR) > + ); > + > // > // Extract the MP information from the Hoblist > // > diff --git > a/StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.h > b/StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.h > index 2c96439c15..2e03b20d85 100644 > --- a/StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.h > +++ b/StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.h > @@ -30,6 +30,7 @@ extern EFI_MM_CPU_PROTOCOL mMmCpuState; // > extern EFI_MM_COMMUNICATE_HEADER **PerCpuGuidedEventContext; > extern EFI_MMRAM_DESCRIPTOR mNsCommBuffer; > +extern EFI_MMRAM_DESCRIPTOR mSCommBuffer; > extern MP_INFORMATION_HOB_DATA *mMpInformationHobData; > extern EFI_MM_CONFIGURATION_PROTOCOL mMmConfig; > > -- > 2.17.1 > > > >=20 > IMPORTANT NOTICE: The contents of this email and any attachments are confid= ential and may also be privileged. If you are not the intended recipient, p= lease notify the sender immediately and do not disclose the contents to any= other person, use it for any purpose, or store or copy the information in = any medium. Thank you.