Set the memory protections on Arm virtual platforms. Because the QemuFg parser is not currently available in ArmVirtPkg, use the RELEASE profile by default.
Signed-off-by: Taylor Beebe <taylor.d.be...@gmail.com> Cc: Ard Biesheuvel <ardb+tianoc...@kernel.org> Cc: Leif Lindholm <quic_llind...@quicinc.com> Cc: Sami Mujawar <sami.muja...@arm.com> Cc: Gerd Hoffmann <kra...@redhat.com> --- ArmVirtPkg/MemoryInitPei/MemoryInitPeim.c | 11 +++++++++-- ArmVirtPkg/MemoryInitPei/MemoryInitPeim.inf | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ArmVirtPkg/MemoryInitPei/MemoryInitPeim.c b/ArmVirtPkg/MemoryInitPei/MemoryInitPeim.c index ef88a9df1d62..90718d05abe8 100644 --- a/ArmVirtPkg/MemoryInitPei/MemoryInitPeim.c +++ b/ArmVirtPkg/MemoryInitPei/MemoryInitPeim.c @@ -11,6 +11,7 @@ #include <Library/ArmPlatformLib.h> #include <Library/DebugLib.h> #include <Library/HobLib.h> +#include <Library/SetMemoryProtectionsLib.h> #include <Library/PeimEntryPoint.h> #include <Library/PeiServicesLib.h> #include <Library/PcdLib.h> @@ -76,8 +77,9 @@ InitializeMemory ( IN CONST EFI_PEI_SERVICES **PeiServices ) { - UINTN UefiMemoryBase; - EFI_STATUS Status; + UINTN UefiMemoryBase; + EFI_STATUS Status; + DXE_MEMORY_PROTECTION_SETTINGS DxeSettings; ASSERT (FixedPcdGet64 (PcdSystemMemoryBase) < (UINT64)MAX_ALLOC_ADDRESS); @@ -100,5 +102,10 @@ InitializeMemory ( ); ASSERT_EFI_ERROR (Status); + DxeSettings = DxeMemoryProtectionProfiles[DxeMemoryProtectionSettingsRelease].Settings; + DxeSettings.NullPointerDetection.DisableEndOfDxe = TRUE; + + SetDxeMemoryProtectionSettings (&DxeSettings, DxeMemoryProtectionSettingsRelease); + return Status; } diff --git a/ArmVirtPkg/MemoryInitPei/MemoryInitPeim.inf b/ArmVirtPkg/MemoryInitPei/MemoryInitPeim.inf index 2039f71a0ebe..d13325a89e14 100644 --- a/ArmVirtPkg/MemoryInitPei/MemoryInitPeim.inf +++ b/ArmVirtPkg/MemoryInitPei/MemoryInitPeim.inf @@ -34,6 +34,7 @@ [LibraryClasses] ArmLib ArmPlatformLib MemoryInitPeiLib + SetMemoryProtectionsLib [Guids] gEfiMemoryTypeInformationGuid -- 2.42.0.windows.2 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108886): https://edk2.groups.io/g/devel/message/108886 Mute This Topic: https://groups.io/mt/101469964/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-