From 7886691a9375e91f7612059aaecf204689186281 Mon Sep 17 00:00:00 2001 From: Mikhail Krichanov Date: Mon, 26 Jun 2023 12:04:30 +0300 Subject: [PATCH] Revert "MdeModulePkg: Enable forward edge CFI in mem attributes table" This reverts commit e4ef609319236a018c60b84f68d9d923c4ba383e. --- MdeModulePkg/Core/Dxe/DxeMain.h | 2 -- MdeModulePkg/Core/Dxe/Image/Image.c | 10 ---------- MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c | 8 +------- 3 files changed, 1 insertion(+), 19 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/DxeMain.h b/MdeModulePkg/Core/Dxe/DxeMain.h index e78c52de02..35e7bbd6a6 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain.h +++ b/MdeModulePkg/Core/Dxe/DxeMain.h @@ -261,8 +261,6 @@ extern EFI_MEMORY_TYPE_INFORMATION gMemoryTypeInformation[EfiMaxMemoryType extern BOOLEAN gDispatcherRunning; extern EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate; -extern BOOLEAN gMemoryAttributesTableForwardCfi; - extern EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE gLoadModuleAtFixAddressConfigurationTable; extern BOOLEAN gLoadFixedAddressCodeMemoryReady; extern LOADED_IMAGE_PRIVATE_DATA * mCurrentImage; diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c b/MdeModulePkg/Core/Dxe/Image/Image.c index 4a6a6bbba4..d0d127fa95 100644 --- a/MdeModulePkg/Core/Dxe/Image/Image.c +++ b/MdeModulePkg/Core/Dxe/Image/Image.c @@ -1336,16 +1336,6 @@ CoreLoadImageCommon ( CoreNewDebugImageInfoEntry (EFI_DEBUG_IMAGE_INFO_TYPE_NORMAL, &Image->Info, Image->Handle, &ImageContext); } - // - // Check whether we are loading a runtime image that lacks support for - // IBT/BTI landing pads. - // - if ((Image->ImageContext.ImageCodeMemoryType == EfiRuntimeServicesCode) && - ((Image->ImageContext.DllCharacteristicsEx & EFI_IMAGE_DLLCHARACTERISTICS_EX_FORWARD_CFI_COMPAT) == 0)) - { - gMemoryAttributesTableForwardCfi = FALSE; - } - // // Reinstall loaded image protocol to fire any notifications // diff --git a/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c b/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c index 047982812d..98e8fab500 100644 --- a/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c +++ b/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c @@ -92,7 +92,6 @@ BOOLEAN mMemoryAttributesTableEnable = TRUE; BOOLEAN mMemoryAttributesTableEndOfDxe = FALSE; EFI_MEMORY_ATTRIBUTES_TABLE *mMemoryAttributesTable = NULL; BOOLEAN mMemoryAttributesTableReadyToBoot = FALSE; -BOOLEAN gMemoryAttributesTableForwardCfi = TRUE; /** Install MemoryAttributesTable. @@ -186,12 +185,7 @@ InstallMemoryAttributesTable ( MemoryAttributesTable->Version = EFI_MEMORY_ATTRIBUTES_TABLE_VERSION; MemoryAttributesTable->NumberOfEntries = RuntimeEntryCount; MemoryAttributesTable->DescriptorSize = (UINT32)DescriptorSize; - if (gMemoryAttributesTableForwardCfi) { - MemoryAttributesTable->Flags = EFI_MEMORY_ATTRIBUTES_FLAGS_RT_FORWARD_CONTROL_FLOW_GUARD; - } else { - MemoryAttributesTable->Flags = 0; - } - + MemoryAttributesTable->Flags = 0; DEBUG ((DEBUG_VERBOSE, "MemoryAttributesTable:\n")); DEBUG ((DEBUG_VERBOSE, " Version - 0x%08x\n", MemoryAttributesTable->Version)); DEBUG ((DEBUG_VERBOSE, " NumberOfEntries - 0x%08x\n", MemoryAttributesTable->NumberOfEntries));