From nobody Tue Feb 10 23:53:03 2026 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+105989+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+105989+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1686342397; cv=none; d=zohomail.com; s=zohoarc; b=YzSP6nMcqCAspmGM5XB/vxAdJ+zlaXLl4RFgv16bbADnnNdCvW4gSnjlr12NMPCPMU+LDgeBcWb/kUF1JlLincweOcgFxemgfFBdgU++stryt4xRb1dzXIN0gEkq+cfZbfevXTT2hPdL4oPK6VxKTWFGZ9EhXv2PcrUyobkgX5w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686342397; 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=0bwczruYjxB3YHbQhTIhFSXvLjN441TkQae3E+BTiS4=; b=iGkL+0+coPXxHa2/yWmeYKZ8FOCInb/XVzXW/EpIyt7c6u8feAPlsNXV9jWOiZLeWrARh1iE6XSDJr1g92LaJy4Dnd5ijZ2w/HG2bByWhPzhFqYu2XN1VW6Y/QPXpZycpsuoZsz0sj+rb8YOKf+Z4LeKW1FYXNrodzLKz4Sgr4k= 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+105989+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1686342397862245.41637739648058; Fri, 9 Jun 2023 13:26:37 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id qhCkYY1788612xAjepQXwRpl; Fri, 09 Jun 2023 13:26:37 -0700 X-Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by mx.groups.io with SMTP id smtpd.web11.4785.1686342396563230431 for ; Fri, 09 Jun 2023 13:26:36 -0700 X-Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1b038064d97so9687395ad.0 for ; Fri, 09 Jun 2023 13:26:36 -0700 (PDT) X-Gm-Message-State: B63MggP9aisStCwzZJ8BJ3Z3x1787277AA= X-Google-Smtp-Source: ACHHUZ5p9DDWC77GhXFQy2PPm+zHxjo/XBA0j8HdqdhTyEOMgApGwAwAT7VvnSpKPwqcrWTw++G/fw== X-Received: by 2002:a17:902:ce87:b0:1b2:4fc1:da47 with SMTP id f7-20020a170902ce8700b001b24fc1da47mr7296447plg.21.1686342395825; Fri, 09 Jun 2023 13:26:35 -0700 (PDT) X-Received: from localhost.localdomain ([50.46.230.135]) by smtp.gmail.com with ESMTPSA id a7-20020a170902ecc700b001a69c1c78e7sm3689500plh.71.2023.06.09.13.26.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jun 2023 13:26:35 -0700 (PDT) From: "Taylor Beebe" To: devel@edk2.groups.io Cc: Taylor Beebe , Jian J Wang , Liming Gao , Dandan Bi Subject: [edk2-devel] [PATCH v1 3/3] MdeModulePkg: Add Phase-Specific MemoryProtectionHobLib Implementations Date: Fri, 9 Jun 2023 13:26:01 -0700 Message-Id: <20230609202601.1153-4-t@taylorbeebe.com> In-Reply-To: <20230609202601.1153-1-t@taylorbeebe.com> References: <20230609202601.1153-1-t@taylorbeebe.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,t@taylorbeebe.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1686342397; bh=I9udinHGtjguZi7lJvBSkrUx9a8WPUsAVSUkJ5nhb/Q=; h=Cc:Date:From:Reply-To:Subject:To; b=gEeFhaQrZ7FQVneh+KEf/ZJg1XOSdFXKynrE2XywXOHT6yyNBhDqmbmwW8r3gCCA1uR x5Hd/DDfJ6vpBK1sA23W0mqeUB/JaSGuc05TIHbp9citke5wv9e3HoHDRx4fMqbQGne9v Kni0zPIZs1/B6SImoGiTBjgANN6l+K1b6WE= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1686342400067100007 Content-Type: text/plain; charset="utf-8" Add DXE, SMM, and STANDALONE MM implementations of the MemoryProtectionHobLib. Signed-off-by: Taylor Beebe Cc: Jian J Wang Cc: Liming Gao Cc: Dandan Bi --- MdeModulePkg/Library/MemoryProtectionHobLib/DxeMemoryProtectionHobLib.c = | 182 ++++++++++++++++++++ MdeModulePkg/Library/MemoryProtectionHobLib/MmCommonMemoryProtectionHobLib= .c | 139 +++++++++++++++ MdeModulePkg/Library/MemoryProtectionHobLib/SmmMemoryProtectionHobLib.c = | 37 ++++ MdeModulePkg/Library/MemoryProtectionHobLib/StandaloneMmMemoryProtectionHo= bLib.c | 37 ++++ MdeModulePkg/Library/MemoryProtectionHobLib/DxeMemoryProtectionHobLib.inf = | 34 ++++ MdeModulePkg/Library/MemoryProtectionHobLib/SmmMemoryProtectionHobLib.inf = | 35 ++++ MdeModulePkg/Library/MemoryProtectionHobLib/StandaloneMmMemoryProtectionHo= bLib.inf | 36 ++++ MdeModulePkg/MdeModulePkg.dsc = | 3 + 8 files changed, 503 insertions(+) diff --git a/MdeModulePkg/Library/MemoryProtectionHobLib/DxeMemoryProtectio= nHobLib.c b/MdeModulePkg/Library/MemoryProtectionHobLib/DxeMemoryProtection= HobLib.c new file mode 100644 index 000000000000..fa6137f90eba --- /dev/null +++ b/MdeModulePkg/Library/MemoryProtectionHobLib/DxeMemoryProtectionHobLib= .c @@ -0,0 +1,182 @@ +/** @file +Library fills out gDxeMps global + +Copyright (c) Microsoft Corporation. +SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include +#include +#include + +#include +#include +#include +#include + +DXE_MEMORY_PROTECTION_SETTINGS gDxeMps; + +/** + Gets the input EFI_MEMORY_TYPE from the input DXE_HEAP_GUARD_MEMORY_TYPE= S bitfield + + @param[in] MemoryType Memory type to check. + @param[in] HeapGuardMemoryType DXE_HEAP_GUARD_MEMORY_TYPES bitfield + + @return TRUE The given EFI_MEMORY_TYPE is TRUE in the given DXE_HEAP_GU= ARD_MEMORY_TYPES + @return FALSE The given EFI_MEMORY_TYPE is FALSE in the given DXE_HEAP_G= UARD_MEMORY_TYPES +**/ +BOOLEAN +EFIAPI +GetDxeMemoryTypeSettingFromBitfield ( + IN EFI_MEMORY_TYPE MemoryType, + IN DXE_HEAP_GUARD_MEMORY_TYPES HeapGuardMemoryType + ) +{ + switch (MemoryType) { + case EfiReservedMemoryType: + return HeapGuardMemoryType.Fields.EfiReservedMemoryType; + case EfiLoaderCode: + return HeapGuardMemoryType.Fields.EfiLoaderCode; + case EfiLoaderData: + return HeapGuardMemoryType.Fields.EfiLoaderData; + case EfiBootServicesCode: + return HeapGuardMemoryType.Fields.EfiBootServicesCode; + case EfiBootServicesData: + return HeapGuardMemoryType.Fields.EfiBootServicesData; + case EfiRuntimeServicesCode: + return HeapGuardMemoryType.Fields.EfiRuntimeServicesCode; + case EfiRuntimeServicesData: + return HeapGuardMemoryType.Fields.EfiRuntimeServicesData; + case EfiConventionalMemory: + return HeapGuardMemoryType.Fields.EfiConventionalMemory; + case EfiUnusableMemory: + return HeapGuardMemoryType.Fields.EfiUnusableMemory; + case EfiACPIReclaimMemory: + return HeapGuardMemoryType.Fields.EfiACPIReclaimMemory; + case EfiACPIMemoryNVS: + return HeapGuardMemoryType.Fields.EfiACPIMemoryNVS; + case EfiMemoryMappedIO: + return HeapGuardMemoryType.Fields.EfiMemoryMappedIO; + case EfiMemoryMappedIOPortSpace: + return HeapGuardMemoryType.Fields.EfiMemoryMappedIOPortSpace; + case EfiPalCode: + return HeapGuardMemoryType.Fields.EfiPalCode; + case EfiPersistentMemory: + return HeapGuardMemoryType.Fields.EfiPersistentMemory; + default: + return FALSE; + } +} + +/** + This function checks the memory protection settings and provides warning= s of conflicts and/or + potentially unforseen consequences from the settings. This logic will on= ly ever turn off + protections to create consistency, never turn others on. +**/ +VOID +DxeMemoryProtectionSettingsConsistencyCheck ( + VOID + ) +{ + if ((gDxeMps.HeapGuardPolicy.Fields.PoolGuardEnabled || gDxeMps.HeapGuar= dPolicy.Fields.PageGuardEnabled) && + gDxeMps.HeapGuardPolicy.Fields.FreedMemoryGuardEnabled) + { + DEBUG (( + DEBUG_WARN, + "%a: - HeapGuardPolicy.FreedMemoryGuardEnabled and " + "UEFI HeapGuardPolicy.PoolGuardEnabled/HeapGuardPolicy.PageGuardEnab= led " + "cannot be active at the same time. Setting all three to ZERO in " + "the memory protection settings global.\n", + __func__ + )); + ASSERT ( + !(gDxeMps.HeapGuardPolicy.Fields.FreedMemoryGuardEnabled && + (gDxeMps.HeapGuardPolicy.Fields.PoolGuardEnabled || gDxeMps.HeapGu= ardPolicy.Fields.PageGuardEnabled)) + ); + gDxeMps.HeapGuardPolicy.Fields.PoolGuardEnabled =3D 0; + gDxeMps.HeapGuardPolicy.Fields.PageGuardEnabled =3D 0; + gDxeMps.HeapGuardPolicy.Fields.FreedMemoryGuardEnabled =3D 0; + } + + if (gDxeMps.HeapGuardPoolType.Data && + (!(gDxeMps.HeapGuardPolicy.Fields.PoolGuardEnabled))) + { + DEBUG (( + DEBUG_WARN, + "%a: - Heap Guard Pool protections are active, " + "but neither HeapGuardPolicy.PoolGuardEnabled nor " + "HeapGuardPolicy.PoolGuardEnabled are active.\n", + __func__ + )); + } + + if (gDxeMps.HeapGuardPageType.Data && + (!(gDxeMps.HeapGuardPolicy.Fields.PageGuardEnabled))) + { + DEBUG (( + DEBUG_WARN, + "%a: - Heap Guard Page protections are active, " + "but neither HeapGuardPolicy.PageGuardEnabled nor " + "HeapGuardPolicy.PageGuardEnabled are active.\n", + __func__ + )); + } + + if (gDxeMps.NxProtectionPolicy.Fields.EfiBootServicesData !=3D gDxeMps.N= xProtectionPolicy.Fields.EfiConventionalMemory) { + DEBUG (( + DEBUG_WARN, + "%a: - NxProtectionPolicy.EfiBootServicesData " + "and NxProtectionPolicy.EfiConventionalMemory must have the same val= ue. " + "Setting both to ZERO in the memory protection settings global.\n", + __func__ + )); + ASSERT ( + gDxeMps.NxProtectionPolicy.Fields.EfiBootServicesData =3D=3D + gDxeMps.NxProtectionPolicy.Fields.EfiConventionalMemory + ); + gDxeMps.NxProtectionPolicy.Fields.EfiBootServicesData =3D 0; + gDxeMps.NxProtectionPolicy.Fields.EfiConventionalMemory =3D 0; + } +} + +/** + Populates gDxeMps global with the data present in the HOB. If the HOB en= try does not exist, + this constructor will zero the memory protection settings. + + @param[in] ImageHandle The firmware allocated handle for the EFI imag= e. + @param[in] SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. +**/ +EFI_STATUS +EFIAPI +DxeMemoryProtectionHobLibConstructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + VOID *Ptr; + + Ptr =3D GetFirstGuidHob (&gDxeMemoryProtectionSettingsGuid); + + // + // Cache the Memory Protection Settings HOB entry + // + if (Ptr !=3D NULL) { + if (*((UINT8 *)GET_GUID_HOB_DATA (Ptr)) !=3D (UINT8)DXE_MEMORY_PROTECT= ION_SETTINGS_CURRENT_VERSION) { + DEBUG (( + DEBUG_ERROR, + "%a: - Version number of the Memory Protection Settings HOB is inv= alid!\n", + __func__ + )); + ASSERT (*((UINT8 *)GET_GUID_HOB_DATA (Ptr)) =3D=3D (UINT8)DXE_MEMORY= _PROTECTION_SETTINGS_CURRENT_VERSION); + ZeroMem (&gDxeMps, sizeof (gDxeMps)); + return EFI_SUCCESS; + } + + CopyMem (&gDxeMps, GET_GUID_HOB_DATA (Ptr), sizeof (DXE_MEMORY_PROTECT= ION_SETTINGS)); + DxeMemoryProtectionSettingsConsistencyCheck (); + } + + return EFI_SUCCESS; +} diff --git a/MdeModulePkg/Library/MemoryProtectionHobLib/MmCommonMemoryProt= ectionHobLib.c b/MdeModulePkg/Library/MemoryProtectionHobLib/MmCommonMemory= ProtectionHobLib.c new file mode 100644 index 000000000000..c546a943a515 --- /dev/null +++ b/MdeModulePkg/Library/MemoryProtectionHobLib/MmCommonMemoryProtectionH= obLib.c @@ -0,0 +1,139 @@ +/** @file +Library fills out gMmMps global + +Copyright (c) Microsoft Corporation. +SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include +#include +#include + +#include +#include +#include +#include + +MM_MEMORY_PROTECTION_SETTINGS gMmMps; + +/** + Gets the input EFI_MEMORY_TYPE from the input MM_HEAP_GUARD_MEMORY_TYPES= bitfield + + @param[in] MemoryType Memory type to check. + @param[in] HeapGuardMemoryType MM_HEAP_GUARD_MEMORY_TYPES bitfield + + @return TRUE The given EFI_MEMORY_TYPE is TRUE in the given MM_HEAP_GUA= RD_MEMORY_TYPES + @return FALSE The given EFI_MEMORY_TYPE is FALSE in the given MM_HEAP_GU= ARD_MEMORY_TYPES +**/ +BOOLEAN +EFIAPI +GetMmMemoryTypeSettingFromBitfield ( + IN EFI_MEMORY_TYPE MemoryType, + IN MM_HEAP_GUARD_MEMORY_TYPES HeapGuardMemoryType + ) +{ + switch (MemoryType) { + case EfiReservedMemoryType: + return HeapGuardMemoryType.Fields.EfiReservedMemoryType; + case EfiLoaderCode: + return HeapGuardMemoryType.Fields.EfiLoaderCode; + case EfiLoaderData: + return HeapGuardMemoryType.Fields.EfiLoaderData; + case EfiBootServicesCode: + return HeapGuardMemoryType.Fields.EfiBootServicesCode; + case EfiBootServicesData: + return HeapGuardMemoryType.Fields.EfiBootServicesData; + case EfiRuntimeServicesCode: + return HeapGuardMemoryType.Fields.EfiRuntimeServicesCode; + case EfiRuntimeServicesData: + return HeapGuardMemoryType.Fields.EfiRuntimeServicesData; + case EfiConventionalMemory: + return HeapGuardMemoryType.Fields.EfiConventionalMemory; + case EfiUnusableMemory: + return HeapGuardMemoryType.Fields.EfiUnusableMemory; + case EfiACPIReclaimMemory: + return HeapGuardMemoryType.Fields.EfiACPIReclaimMemory; + case EfiACPIMemoryNVS: + return HeapGuardMemoryType.Fields.EfiACPIMemoryNVS; + case EfiMemoryMappedIO: + return HeapGuardMemoryType.Fields.EfiMemoryMappedIO; + case EfiMemoryMappedIOPortSpace: + return HeapGuardMemoryType.Fields.EfiMemoryMappedIOPortSpace; + case EfiPalCode: + return HeapGuardMemoryType.Fields.EfiPalCode; + case EfiPersistentMemory: + return HeapGuardMemoryType.Fields.EfiPersistentMemory; + default: + return FALSE; + } +} + +/** + This function checks the memory protection settings and provides warning= s of conflicts and/or + potentially unforseen consequences from the settings. This logic will on= ly ever turn off + protections to create consistency, never turn others on. +**/ +VOID +MmMemoryProtectionSettingsConsistencyCheck ( + VOID + ) +{ + if (gMmMps.HeapGuardPoolType.Data && + (!(gMmMps.HeapGuardPolicy.Fields.PoolGuardEnabled))) + { + DEBUG (( + DEBUG_WARN, + "%a: - Bits set in gMmMps.HeapGuardPoolType, but gMmMps.HeapGuardPol= icy.Fields.PoolGuardEnabled is inactive. " + "No pool guards will be set.\n", + __func__ + )); + } + + if (gMmMps.HeapGuardPageType.Data && + (!(gMmMps.HeapGuardPolicy.Fields.PageGuardEnabled))) + { + DEBUG (( + DEBUG_WARN, + "%a: - Bits are set in gMmMps.HeapGuardPageType, but gMmMps.HeapGuar= dPolicy.Fields.PageGuardEnabled is inactive. " + "No page guards will be set.\n", + __func__ + )); + } +} + +/** + Abstraction layer for library constructor of Standalone MM and SMM insta= nces. + + @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. +**/ +EFI_STATUS +EFIAPI +MmMemoryProtectionHobLibConstructorCommon ( + VOID + ) +{ + VOID *Ptr; + + Ptr =3D GetFirstGuidHob (&gMmMemoryProtectionSettingsGuid); + + // + // Cache the Memory Protection Settings HOB entry + // + if (Ptr !=3D NULL) { + if (*((UINT8 *)GET_GUID_HOB_DATA (Ptr)) !=3D (UINT8)MM_MEMORY_PROTECTI= ON_SETTINGS_CURRENT_VERSION) { + DEBUG (( + DEBUG_ERROR, + "%a: - Version number of the Memory Protection Settings HOB is inv= alid!\n", + __func__ + )); + ASSERT (*((UINT8 *)GET_GUID_HOB_DATA (Ptr)) =3D=3D (UINT8)MM_MEMORY_= PROTECTION_SETTINGS_CURRENT_VERSION); + ZeroMem (&gMmMps, sizeof (gMmMps)); + return EFI_SUCCESS; + } + + CopyMem (&gMmMps, GET_GUID_HOB_DATA (Ptr), sizeof (MM_MEMORY_PROTECTIO= N_SETTINGS)); + MmMemoryProtectionSettingsConsistencyCheck (); + } + + return EFI_SUCCESS; +} diff --git a/MdeModulePkg/Library/MemoryProtectionHobLib/SmmMemoryProtectio= nHobLib.c b/MdeModulePkg/Library/MemoryProtectionHobLib/SmmMemoryProtection= HobLib.c new file mode 100644 index 000000000000..fffc90a7215c --- /dev/null +++ b/MdeModulePkg/Library/MemoryProtectionHobLib/SmmMemoryProtectionHobLib= .c @@ -0,0 +1,37 @@ +/** @file +Library fills out gMmMps global + +Copyright (c) Microsoft Corporation. +SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include + +/** + Abstraction layer for library constructor of Standalone MM and SMM insta= nces. + + @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. +**/ +EFI_STATUS +EFIAPI +MmMemoryProtectionHobLibConstructorCommon ( + VOID + ); + +/** + Library constructor of SMM instance. + + @param[in] ImageHandle The firmware allocated handle for the EFI imag= e. + @param[in] SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. +**/ +EFI_STATUS +EFIAPI +SmmMemoryProtectionHobLibConstructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + return MmMemoryProtectionHobLibConstructorCommon (); +} diff --git a/MdeModulePkg/Library/MemoryProtectionHobLib/StandaloneMmMemory= ProtectionHobLib.c b/MdeModulePkg/Library/MemoryProtectionHobLib/Standalone= MmMemoryProtectionHobLib.c new file mode 100644 index 000000000000..3fd8b9f2593d --- /dev/null +++ b/MdeModulePkg/Library/MemoryProtectionHobLib/StandaloneMmMemoryProtect= ionHobLib.c @@ -0,0 +1,37 @@ +/** @file +Library fills out gMmMps global + +Copyright (c) Microsoft Corporation. +SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include + +/** + Abstraction layer for library constructor of Standalone MM and SMM insta= nces. + + @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. +**/ +EFI_STATUS +EFIAPI +MmMemoryProtectionHobLibConstructorCommon ( + VOID + ); + +/** + Library constructor of Standalone MM instance. + + @param[in] ImageHandle The firmware allocated handle for the EFI imag= e. + @param[in] SystemTable A pointer to the EFI MM System Table. + + @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. +**/ +EFI_STATUS +EFIAPI +StandaloneMmMemoryProtectionHobLibConstructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_MM_SYSTEM_TABLE *SystemTable + ) +{ + return MmMemoryProtectionHobLibConstructorCommon (); +} diff --git a/MdeModulePkg/Library/MemoryProtectionHobLib/DxeMemoryProtectio= nHobLib.inf b/MdeModulePkg/Library/MemoryProtectionHobLib/DxeMemoryProtecti= onHobLib.inf new file mode 100644 index 000000000000..57ca55446b81 --- /dev/null +++ b/MdeModulePkg/Library/MemoryProtectionHobLib/DxeMemoryProtectionHobLib= .inf @@ -0,0 +1,34 @@ +## @file +# DXE library instance to support platform-specific global controls for al= l memory protections. +# +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D DxeMemoryProtectionHobLib + FILE_GUID =3D f497f7de-b9ab-4b9f-807e-89778922542d + MODULE_TYPE =3D UEFI_DRIVER + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D DxeMemoryProtectionHobLib|DXE_DRIVER = DXE_CORE UEFI_APPLICATION UEFI_DRIVER + CONSTRUCTOR =3D DxeMemoryProtectionHobLibConstructor + +# +# VALID_ARCHITECTURES =3D IA32 X64 AARCH64 +# + +[Sources] + DxeMemoryProtectionHobLib.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + +[LibraryClasses] + HobLib + DebugLib + BaseMemoryLib + +[Guids] + gDxeMemoryProtectionSettingsGuid diff --git a/MdeModulePkg/Library/MemoryProtectionHobLib/SmmMemoryProtectio= nHobLib.inf b/MdeModulePkg/Library/MemoryProtectionHobLib/SmmMemoryProtecti= onHobLib.inf new file mode 100644 index 000000000000..4651158bd405 --- /dev/null +++ b/MdeModulePkg/Library/MemoryProtectionHobLib/SmmMemoryProtectionHobLib= .inf @@ -0,0 +1,35 @@ +## @file +# SMM library instance to support platform-specific global controls for al= l memory protections. +# +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D SmmMemoryProtectionHobLib + FILE_GUID =3D dc9666f4-917f-400d-8026-2b3beeeff195 + MODULE_TYPE =3D DXE_SMM_DRIVER + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D MmMemoryProtectionHobLib|SMM_CORE DXE= _SMM_DRIVER + CONSTRUCTOR =3D SmmMemoryProtectionHobLibConstructor + +# +# VALID_ARCHITECTURES =3D IA32 X64 AARCH64 +# + +[Sources] + MmCommonMemoryProtectionHobLib.c + SmmMemoryProtectionHobLib.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + +[LibraryClasses] + HobLib + DebugLib + BaseMemoryLib + +[Guids] + gMmMemoryProtectionSettingsGuid diff --git a/MdeModulePkg/Library/MemoryProtectionHobLib/StandaloneMmMemory= ProtectionHobLib.inf b/MdeModulePkg/Library/MemoryProtectionHobLib/Standalo= neMmMemoryProtectionHobLib.inf new file mode 100644 index 000000000000..3cadb5ec6e9a --- /dev/null +++ b/MdeModulePkg/Library/MemoryProtectionHobLib/StandaloneMmMemoryProtect= ionHobLib.inf @@ -0,0 +1,36 @@ +## @file +# SMM library instance to support platform-specific global controls for al= l memory protections. +# +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D StandaloneMmMemoryProtectionHobLib + FILE_GUID =3D C0A0D9C4-A249-483A-86EA-D73146D397B3 + MODULE_TYPE =3D MM_CORE_STANDALONE + PI_SPECIFICATION_VERSION =3D 0x00010032 + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D MmMemoryProtectionHobLib|MM_CORE_STAN= DALONE MM_STANDALONE + CONSTRUCTOR =3D StandaloneMmMemoryProtectionHobLibCon= structor + +# +# VALID_ARCHITECTURES =3D IA32 X64 AARCH64 +# + +[Sources] + MmCommonMemoryProtectionHobLib.c + StandaloneMmMemoryProtectionHobLib.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + +[LibraryClasses] + HobLib + DebugLib + BaseMemoryLib + +[Guids] + gMmMemoryProtectionSettingsGuid diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc index ab6848dc934b..bad4318771f9 100644 --- a/MdeModulePkg/MdeModulePkg.dsc +++ b/MdeModulePkg/MdeModulePkg.dsc @@ -237,6 +237,9 @@ [Components] MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf MdeModulePkg/Library/LockBoxNullLib/LockBoxNullLib.inf + MdeModulePkg/Library/MemoryProtectionHobLib/DxeMemoryProtectionHobLib.inf + MdeModulePkg/Library/MemoryProtectionHobLib/SmmMemoryProtectionHobLib.inf + MdeModulePkg/Library/MemoryProtectionHobLib/StandaloneMmMemoryProtection= HobLib.inf MdeModulePkg/Library/MemoryProtectionHobLibNull/DxeMemoryProtectionHobLi= bNull.inf MdeModulePkg/Library/MemoryProtectionHobLibNull/MmMemoryProtectionHobLib= Null.inf MdeModulePkg/Library/PciHostBridgeLibNull/PciHostBridgeLibNull.inf --=20 2.36.1.windows.1 -=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 (#105989): https://edk2.groups.io/g/devel/message/105989 Mute This Topic: https://groups.io/mt/99437081/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-