From nobody Sun May 19 07:16:13 2024 Delivered-To: importer@patchew.org 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+98525+1787277+3901457@groups.io; helo=mail02.groups.io; 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+98525+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1673825277; cv=none; d=zohomail.com; s=zohoarc; b=exhLR8c7C0sELVMIpV7h4CBlNMSgOVzob0qSsMmLgMwla6r89FO4v/CmdmGasF/05+SI5IqOFwelQu3URN3eNmWWcXe/BAp1kPT1jJhGD1Amqehv2xGZBmBcT+RMoe69bby+NyLc6GEyvMifU49eaEhNVpjEmDqa4UoeeFb07f4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673825277; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=7Fr730xvBcUy3ICVXLcr5IwBybOhPDrhrCWJ+45mfdE=; b=W6Kp3sMgsEoXexnthGeYv2XZBqXsUqNc059LHO1C9J2zaCelTFIKQraozPUPGKT5m6iAjd/8ZU+zd6wAGyUCWmE9K6oDIKRK3Eozic0aYnpywIYRy5RXqkVQRIdHwICV0XlBwJpdUiQ7EGgw2FXWvgBOJkXeuz71qESOaoSZ5B0= ARC-Authentication-Results: i=1; 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+98525+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1673825277135478.0867004023668; Sun, 15 Jan 2023 15:27:57 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 6HFdYY1788612x1kXxjX1tJR; Sun, 15 Jan 2023 15:27:56 -0800 X-Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web10.153809.1673825274206247621 for ; Sun, 15 Jan 2023 15:27:56 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10591"; a="304050359" X-IronPort-AV: E=Sophos;i="5.97,219,1669104000"; d="scan'208";a="304050359" X-Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jan 2023 15:27:55 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10591"; a="652092343" X-IronPort-AV: E=Sophos;i="5.97,219,1669104000"; d="scan'208";a="652092343" X-Received: from mxu9-mobl1.ccr.corp.intel.com ([10.249.174.76]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jan 2023 15:27:53 -0800 From: "Min Xu" To: devel@edk2.groups.io Cc: Min M Xu , Erdem Aktas , James Bottomley , Jiewen Yao , Gerd Hoffmann , Tom Lendacky , Michael Roth Subject: [edk2-devel] [PATCH V1 1/3] OvmfPkg/CcExitLib: Initialize Status in IoExit Date: Mon, 16 Jan 2023 07:27:37 +0800 Message-Id: <20230115232739.415-2-min.m.xu@intel.com> In-Reply-To: <20230115232739.415-1-min.m.xu@intel.com> References: <20230115232739.415-1-min.m.xu@intel.com> MIME-Version: 1.0 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,min.m.xu@intel.com X-Gm-Message-State: A3ZwSvZmyakeeesWwUZ5OrWix1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1673825276; bh=T43dT7nRZIzhqNvliT7HIoDIr+oyqkICEyR0m8DGwTk=; h=Cc:Date:From:Reply-To:Subject:To; b=nBrwIgJVMa/Mqop5WqioJkOr0amSPbxN8DzGlegjqgu6NOSyQOXXiz2WqSFjZWP9dSR P1WLyypdxw21/AHvB8GCgtF5L/fSoALDDZSKTYNac/adAlsXGh+gAk4EyDG0ljVU4ecAw 1+7PCwDnaLru6N1xrx9D0UASOZjXI6NvGyU= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1673825278952100007 Content-Type: text/plain; charset="utf-8" From: Min M Xu Status should be initialized otherwise it may return unexpected value. Cc: Erdem Aktas Cc: James Bottomley Cc: Jiewen Yao Cc: Gerd Hoffmann Cc: Tom Lendacky Cc: Michael Roth Signed-off-by: Min Xu --- OvmfPkg/Library/CcExitLib/CcExitVeHandler.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/OvmfPkg/Library/CcExitLib/CcExitVeHandler.c b/OvmfPkg/Library/= CcExitLib/CcExitVeHandler.c index 30d547d5fe55..872f772a5ac8 100644 --- a/OvmfPkg/Library/CcExitLib/CcExitVeHandler.c +++ b/OvmfPkg/Library/CcExitLib/CcExitVeHandler.c @@ -105,10 +105,11 @@ IoExit ( UINT64 RepCnt; UINT64 Status; =20 - Val =3D 0; - Write =3D Veinfo->ExitQualification.Io.Direction ? FALSE : TRUE; - Size =3D Veinfo->ExitQualification.Io.Size + 1; - Port =3D Veinfo->ExitQualification.Io.Port; + Val =3D 0; + Status =3D 0; + Write =3D Veinfo->ExitQualification.Io.Direction ? FALSE : TRUE; + Size =3D Veinfo->ExitQualification.Io.Size + 1; + Port =3D Veinfo->ExitQualification.Io.Port; =20 if (Veinfo->ExitQualification.Io.String) { // --=20 2.29.2.windows.2 -=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 (#98525): https://edk2.groups.io/g/devel/message/98525 Mute This Topic: https://groups.io/mt/96296908/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- From nobody Sun May 19 07:16:13 2024 Delivered-To: importer@patchew.org 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+98526+1787277+3901457@groups.io; helo=mail02.groups.io; 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+98526+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1673825278; cv=none; d=zohomail.com; s=zohoarc; b=U8QLIj14ue/HStaXyRMsUWWYZYGzXgIjd0wNKj/FICuP7Brjt/qQvYd5ZDOl33aVzYfEpu402V0YwmjEuyMkMk4Ox6G0ITFe3xkQaHCvF9vNQdGOa0Yap32V3nSoYp568y3PN27S4U1OASCJxinH7d5VNGN6YOmFCF4YZ+lsASg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673825278; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=PwCnnllbSwkdjQIMB4Kxduu2pZJh9lCT0x6sDUFhv5U=; b=PEnqmuBf1F/UM70quT8FZDg0q8VN4tzQqAYRqhMDAV4dV0TYsI9LxHqQAfHrGkenlqpKBxkcUg6SJmpaXFSPCztLoGDTxoKzyv0ecE2f2Hi5Yx06CHkCsAu+ku/OHWgOA8rvUxbVS99kbTAi52liIqK3gCp/DibQfSnB/KWBTgk= ARC-Authentication-Results: i=1; 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+98526+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1673825278545306.993479180352; Sun, 15 Jan 2023 15:27:58 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 066kYY1788612x5TQZCsjTk6; Sun, 15 Jan 2023 15:27:58 -0800 X-Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web10.153809.1673825274206247621 for ; Sun, 15 Jan 2023 15:27:57 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10591"; a="304050378" X-IronPort-AV: E=Sophos;i="5.97,219,1669104000"; d="scan'208";a="304050378" X-Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jan 2023 15:27:57 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10591"; a="652092346" X-IronPort-AV: E=Sophos;i="5.97,219,1669104000"; d="scan'208";a="652092346" X-Received: from mxu9-mobl1.ccr.corp.intel.com ([10.249.174.76]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jan 2023 15:27:56 -0800 From: "Min Xu" To: devel@edk2.groups.io Cc: Min M Xu , Jiewen Yao , Jian J Wang Subject: [edk2-devel] [PATCH V1 2/3] SecurityPkg/TdTcg2Dxe: Extend EFI boot variable to PCR[1] Date: Mon, 16 Jan 2023 07:27:38 +0800 Message-Id: <20230115232739.415-3-min.m.xu@intel.com> In-Reply-To: <20230115232739.415-1-min.m.xu@intel.com> References: <20230115232739.415-1-min.m.xu@intel.com> MIME-Version: 1.0 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,min.m.xu@intel.com X-Gm-Message-State: F4tWImz13sKq43h89obdqBOIx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1673825278; bh=+xEmAmv99RWqcDrCJbd1UF9pDIsPrA1L1LV8wzNdCtM=; h=Cc:Date:From:Reply-To:Subject:To; b=kU59Q5wCF/srmmoDyYkoRsGplVKNyEgXaY1JmNcSU+zuiZ4S/L5qyKjSBPLVWi//FUt ReO7CL2prBZiCVTtEXYPJPC0Lr0ge/iJNuqfZtoU12w52cQwbDhMJiUTD89zpQhaZhlHM 0ruXh652g3vu0RMf9OWixLAu2Ml782iVHUE= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1673825278950100006 Content-Type: text/plain; charset="utf-8" From: Min M Xu According to TCG PC Client PFP spec 0021 Section 2.4.4.2 EFI boot variable should be measured and extended to PCR[1], not PCR[5]. This patch is proposed to fix this error. Cc: Jiewen Yao Cc: Jian J Wang Signed-off-by: Min Xu --- SecurityPkg/Tcg/TdTcg2Dxe/TdTcg2Dxe.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/SecurityPkg/Tcg/TdTcg2Dxe/TdTcg2Dxe.c b/SecurityPkg/Tcg/TdTcg2= Dxe/TdTcg2Dxe.c index d19923b0c682..59341a8c0250 100644 --- a/SecurityPkg/Tcg/TdTcg2Dxe/TdTcg2Dxe.c +++ b/SecurityPkg/Tcg/TdTcg2Dxe/TdTcg2Dxe.c @@ -1873,12 +1873,8 @@ ReadAndMeasureBootVariable ( OUT VOID **VarData ) { - // - // Boot variables are measured into (PCR[5]) RTMR[1], - // details in section 8.1 of TDVF design guide. - // return ReadAndMeasureVariable ( - MapPcrToMrIndex (5), + MapPcrToMrIndex (1), EV_EFI_VARIABLE_BOOT, VarName, VendorGuid, --=20 2.29.2.windows.2 -=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 (#98526): https://edk2.groups.io/g/devel/message/98526 Mute This Topic: https://groups.io/mt/96296909/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- From nobody Sun May 19 07:16:13 2024 Delivered-To: importer@patchew.org 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+98527+1787277+3901457@groups.io; helo=mail02.groups.io; 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+98527+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1673825281; cv=none; d=zohomail.com; s=zohoarc; b=BSSKRQ7zqVSXBpJO0tRzd1PRTNhA6L/imj9+jDRMY0nj4/YojPPjsqw4EwbNRTR4rPvrXXO+9n7KTwkJZzgPvkYRh4nFUCC+uzE0BtvddhiA0uIvWiTLJBcixFaXW0fFMvqLbjrcLUPz0BnzxpT0sI7QS+HoiucvUmahzt2/uWc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673825281; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=7oOnxwKbvwA1e2fWjHaddCidV8anwE+jKeWBX+gdjAU=; b=n5lUM3Mv/O5IKcdPoqEabvNOGZVIElA4aUvYSfzTMfTa9gn1857Yhw3/lYFrCd0yEsxUcWCmUc14SHWgCEqaqx195XyeFIEKkA++QZa7OpL72N18sG+klKcJPK2N86I8UGl8030yGJzKHXiLP+1FXRrksI8CCg8ymLO7I0q8Lhc= ARC-Authentication-Results: i=1; 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+98527+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1673825281528102.5971129314222; Sun, 15 Jan 2023 15:28:01 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id Bop7YY1788612xxX2yYPmLTA; Sun, 15 Jan 2023 15:28:00 -0800 X-Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web10.153809.1673825274206247621 for ; Sun, 15 Jan 2023 15:28:00 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10591"; a="304050401" X-IronPort-AV: E=Sophos;i="5.97,219,1669104000"; d="scan'208";a="304050401" X-Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jan 2023 15:28:00 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10591"; a="652092350" X-IronPort-AV: E=Sophos;i="5.97,219,1669104000"; d="scan'208";a="652092350" X-Received: from mxu9-mobl1.ccr.corp.intel.com ([10.249.174.76]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jan 2023 15:27:57 -0800 From: "Min Xu" To: devel@edk2.groups.io Cc: Min M Xu , Erdem Aktas , James Bottomley , Jiewen Yao , Gerd Hoffmann , Tom Lendacky , Michael Roth Subject: [edk2-devel] [PATCH V1 3/3] OvmfPkg/BaseMemEncryptTdxLib: Refactor error handle of SetOrClearSharedBit Date: Mon, 16 Jan 2023 07:27:39 +0800 Message-Id: <20230115232739.415-4-min.m.xu@intel.com> In-Reply-To: <20230115232739.415-1-min.m.xu@intel.com> References: <20230115232739.415-1-min.m.xu@intel.com> MIME-Version: 1.0 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,min.m.xu@intel.com X-Gm-Message-State: VAzQkK60hnaPIu8n3lUFQaGWx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1673825280; bh=98NxktxSiYBUCoysfwHyU6ilqyg02RnRtQD2xRZ4bYM=; h=Cc:Date:From:Reply-To:Subject:To; b=VKt0wRek+kxw39mgn53ZV8caUPqsRTlVtnjWIGiga+qtWeaj+QSdCb2K7A+m7WNBhj8 RhZcdqYorohnGR/UHP9WWaYARveTTFaOgzvZgLEDRfxuxstNOSCHVj2DoZnX8MLx6cPWe ahQ0GSZveaAa+zBKF6jQLe7Pm8GwX4nctRo= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1673825282981100014 Content-Type: text/plain; charset="utf-8" From: Min M Xu The previous implementation of SetOrClearSharedBit doesn't handle the error correctly. In this patch SetOrClearSharedBit is changed to return error code so that the caller can handle it. Cc: Erdem Aktas Cc: James Bottomley Cc: Jiewen Yao Cc: Gerd Hoffmann Cc: Tom Lendacky Cc: Michael Roth Signed-off-by: Min Xu --- .../BaseMemEncryptTdxLib/MemoryEncryption.c | 48 +++++++++++++++---- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/OvmfPkg/Library/BaseMemEncryptTdxLib/MemoryEncryption.c b/Ovmf= Pkg/Library/BaseMemEncryptTdxLib/MemoryEncryption.c index 503f626d75c6..5b13042512ad 100644 --- a/OvmfPkg/Library/BaseMemEncryptTdxLib/MemoryEncryption.c +++ b/OvmfPkg/Library/BaseMemEncryptTdxLib/MemoryEncryption.c @@ -510,8 +510,11 @@ Split1GPageTo2M ( @param[in] PagetablePoint Page table entry pointer (PTE). @param[in] Mode Set or Clear shared bit =20 + @retval EFI_SUCCESS Successfully set or clear the memo= ry shared bit + @retval Others Other error as indicated **/ -STATIC VOID +STATIC +EFI_STATUS SetOrClearSharedBit ( IN OUT UINT64 *PageTablePointer, IN TDX_PAGETABLE_MODE Mode, @@ -520,7 +523,8 @@ SetOrClearSharedBit ( ) { UINT64 AddressEncMask; - UINT64 Status; + UINT64 TdStatus; + EFI_STATUS Status; EDKII_MEMORY_ACCEPT_PROTOCOL *MemoryAcceptProtocol; =20 AddressEncMask =3D GetMemEncryptionAddressMask (); @@ -536,16 +540,30 @@ SetOrClearSharedBit ( PhysicalAddress &=3D ~AddressEncMask; } =20 - Status =3D TdVmCall (TDVMCALL_MAPGPA, PhysicalAddress, Length, 0, 0, NUL= L); + TdStatus =3D TdVmCall (TDVMCALL_MAPGPA, PhysicalAddress, Length, 0, 0, N= ULL); + if (TdStatus !=3D 0) { + DEBUG ((DEBUG_ERROR, "%a: TdVmcall(MAPGPA) failed with %llx\n", __FUNC= TION__, TdStatus)); + ASSERT (FALSE); + return EFI_DEVICE_ERROR; + } =20 // // If changing shared to private, must accept-page again // if (Mode =3D=3D ClearSharedBit) { Status =3D gBS->LocateProtocol (&gEdkiiMemoryAcceptProtocolGuid, NULL,= (VOID **)&MemoryAcceptProtocol); - ASSERT (!EFI_ERROR (Status)); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: Failed to locate MemoryAcceptProtocol with= %r\n", __FUNCTION__, Status)); + ASSERT (FALSE); + return Status; + } + Status =3D MemoryAcceptProtocol->AcceptMemory (MemoryAcceptProtocol, P= hysicalAddress, Length); - ASSERT (!EFI_ERROR (Status)); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: Failed to AcceptMemory with %r\n", __FUNCT= ION__, Status)); + ASSERT (FALSE); + return Status; + } } =20 DEBUG (( @@ -558,6 +576,8 @@ SetOrClearSharedBit ( Mode, Status )); + + return EFI_SUCCESS; } =20 /** @@ -747,7 +767,11 @@ SetMemorySharedOrPrivate ( // If we have at least 1GB to go, we can just update this entry // if (!(PhysicalAddress & (BIT30 - 1)) && (Length >=3D BIT30)) { - SetOrClearSharedBit (&PageDirectory1GEntry->Uint64, Mode, Physical= Address, BIT30); + Status =3D SetOrClearSharedBit (&PageDirectory1GEntry->Uint64, Mod= e, PhysicalAddress, BIT30); + if (EFI_ERROR (Status)) { + goto Done; + } + DEBUG (( DEBUG_VERBOSE, "%a:%a: updated 1GB entry for Physical=3D0x%Lx\n", @@ -809,7 +833,11 @@ SetMemorySharedOrPrivate ( // If we have at least 2MB left to go, we can just update this ent= ry // if (!(PhysicalAddress & (BIT21-1)) && (Length >=3D BIT21)) { - SetOrClearSharedBit (&PageDirectory2MEntry->Uint64, Mode, Physic= alAddress, BIT21); + Status =3D SetOrClearSharedBit (&PageDirectory2MEntry->Uint64, M= ode, PhysicalAddress, BIT21); + if (EFI_ERROR (Status)) { + goto Done; + } + PhysicalAddress +=3D BIT21; Length -=3D BIT21; } else { @@ -856,7 +884,11 @@ SetMemorySharedOrPrivate ( goto Done; } =20 - SetOrClearSharedBit (&PageTableEntry->Uint64, Mode, PhysicalAddres= s, EFI_PAGE_SIZE); + Status =3D SetOrClearSharedBit (&PageTableEntry->Uint64, Mode, Phy= sicalAddress, EFI_PAGE_SIZE); + if (EFI_ERROR (Status)) { + goto Done; + } + PhysicalAddress +=3D EFI_PAGE_SIZE; Length -=3D EFI_PAGE_SIZE; } --=20 2.29.2.windows.2 -=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 (#98527): https://edk2.groups.io/g/devel/message/98527 Mute This Topic: https://groups.io/mt/96296911/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-