From 98e1f572eec8791ccaf63cd69da605ab57040ce5 Mon Sep 17 00:00:00 2001 From: Taylor Beebe Date: Fri, 19 Jan 2024 09:25:56 -0800 Subject: [PATCH] Rename Memory Attribute Protocol Global Description Renames MemoryAttributeProtocol global to mMemoryAttributeProtocol to match convention. - [ ] Impacts functionality? - **Functionality** - Does the change ultimately impact how firmware functions? - Examples: Add a new library, publish a new PPI, update an algorithm, ... - [ ] Impacts security? - **Security** - Does the change have a direct security impact on an application, flow, or firmware? - Examples: Crypto algorithm change, buffer overflow fix, parameter validation improvement, ... - [x] Breaking change? - **Breaking change** - Will anyone consuming this change experience a break in build or boot behavior? - Examples: Add a new library class, move a module to a different repo, call a function in a new library class in a pre-existing module, ... - [ ] Includes tests? - **Tests** - Does the change include any explicit test code? - Examples: Unit tests, integration tests, robot tests, ... - [ ] Includes documentation? - **Documentation** - Does the change contain explicit documentation additions outside direct code modifications (and comments)? - Examples: Update readme file, add feature readme file, link to documentation on an a separate Web page, ... How This Was Tested N/A Integration Instructions N/A --- MdeModulePkg/Core/Dxe/DxeMain.h | 2 +- MdeModulePkg/Core/Dxe/Mem/Page.c | 4 ++-- MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c | 4 ++-- MdeModulePkg/Core/Dxe/Misc/MemoryProtectionSupport.c | 10 +++++----- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/DxeMain.h b/MdeModulePkg/Core/Dxe/DxeMain.h index 7f1b81a180..a35a4bf282 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain.h +++ b/MdeModulePkg/Core/Dxe/DxeMain.h @@ -274,7 +274,7 @@ extern EFI_SECURITY_ARCH_PROTOCOL *gSecurity; extern EFI_SECURITY2_ARCH_PROTOCOL *gSecurity2; extern EFI_BDS_ARCH_PROTOCOL *gBds; extern EFI_SMM_BASE2_PROTOCOL *gSmmBase2; -extern EFI_MEMORY_ATTRIBUTE_PROTOCOL *MemoryAttributeProtocol; // MU_CHANGE +extern EFI_MEMORY_ATTRIBUTE_PROTOCOL *mMemoryAttributeProtocol; // MU_CHANGE extern volatile EFI_TPL gEfiCurrentTpl; // MS_CHANGE diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/Page.c index c5012924f3..7dd6bf0267 100644 --- a/MdeModulePkg/Core/Dxe/Mem/Page.c +++ b/MdeModulePkg/Core/Dxe/Mem/Page.c @@ -1570,8 +1570,8 @@ CoreInternalFreePages ( // MU_CHANGE Start: Unprotect page(s) before free if the memory will be cleared on free UINT64 Attributes; - if (DebugClearMemoryEnabled () && (MemoryAttributeProtocol != NULL)) { - Status = MemoryAttributeProtocol->GetMemoryAttributes (MemoryAttributeProtocol, Memory, EFI_PAGES_TO_SIZE (NumberOfPages), &Attributes); + if (DebugClearMemoryEnabled () && (mMemoryAttributeProtocol != NULL)) { + Status = mMemoryAttributeProtocol->GetMemoryAttributes (mMemoryAttributeProtocol, Memory, EFI_PAGES_TO_SIZE (NumberOfPages), &Attributes); if ((Attributes & EFI_MEMORY_RO) || (Attributes & EFI_MEMORY_RP) || (Status == EFI_NO_MAPPING)) { Status = ClearAccessAttributesFromMemoryRange (Memory, EFI_PAGES_TO_SIZE (NumberOfPages)); diff --git a/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c b/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c index da5179a79a..53100e2a6e 100644 --- a/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c +++ b/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c @@ -1580,8 +1580,8 @@ ApplyMemoryProtectionPolicy ( // To catch the edge case where the attributes are not consistent across the range, get the // attributes from the page table to see if they are consistent. If they are not consistent, // GetMemoryAttributes() will return an error. - if (MemoryAttributeProtocol != NULL) { - if (!EFI_ERROR (MemoryAttributeProtocol->GetMemoryAttributes (MemoryAttributeProtocol, Memory, Length, &OldAttributes)) && + if (mMemoryAttributeProtocol != NULL) { + if (!EFI_ERROR (mMemoryAttributeProtocol->GetMemoryAttributes (mMemoryAttributeProtocol, Memory, Length, &OldAttributes)) && (OldAttributes == NewAttributes)) { return EFI_SUCCESS; diff --git a/MdeModulePkg/Core/Dxe/Misc/MemoryProtectionSupport.c b/MdeModulePkg/Core/Dxe/Misc/MemoryProtectionSupport.c index a383db1a8c..d282c5399c 100644 --- a/MdeModulePkg/Core/Dxe/Misc/MemoryProtectionSupport.c +++ b/MdeModulePkg/Core/Dxe/Misc/MemoryProtectionSupport.c @@ -26,7 +26,7 @@ MEMORY_PROTECTION_SPECIAL_REGION_PRIVATE_LIST_HEAD mSpecialMemoryRegionsPrivate }; BOOLEAN mEnhancedMemoryProtectionActive = TRUE; -EFI_MEMORY_ATTRIBUTE_PROTOCOL *MemoryAttributeProtocol = NULL; +EFI_MEMORY_ATTRIBUTE_PROTOCOL *mMemoryAttributeProtocol = NULL; UINT8 *mBitmapGlobal = NULL; LIST_ENTRY **mArrayOfListEntryPointers = NULL; @@ -3434,7 +3434,7 @@ MemoryAttributeProtocolNotify ( { EFI_STATUS Status; - Status = gBS->LocateProtocol (&gEfiMemoryAttributeProtocolGuid, NULL, (VOID **)&MemoryAttributeProtocol); + Status = gBS->LocateProtocol (&gEfiMemoryAttributeProtocolGuid, NULL, (VOID **)&mMemoryAttributeProtocol); if (EFI_ERROR (Status)) { DEBUG (( @@ -3529,8 +3529,8 @@ UninstallMemoryAttributeProtocol ( UINTN Index; EFI_HANDLE *HandleBuffer; - if (MemoryAttributeProtocol == NULL) { - Status = gBS->LocateProtocol (&gEfiMemoryAttributeProtocolGuid, NULL, (VOID **)&MemoryAttributeProtocol); + if (mMemoryAttributeProtocol == NULL) { + Status = gBS->LocateProtocol (&gEfiMemoryAttributeProtocolGuid, NULL, (VOID **)&mMemoryAttributeProtocol); if (EFI_ERROR (Status)) { return; } @@ -3549,7 +3549,7 @@ UninstallMemoryAttributeProtocol ( Status = gBS->UninstallProtocolInterface ( HandleBuffer[Index], &gEfiMemoryAttributeProtocolGuid, - MemoryAttributeProtocol + mMemoryAttributeProtocol ); ASSERT_EFI_ERROR (Status); }