OcAppleBootCompatLib: Update attributes after every allocation
@@ -275,6 +275,8 @@ OcAllocatePages (
{
EFI_STATUS Status;
BOOT_COMPAT_CONTEXT *BootCompat;
+ EFI_PHYSICAL_ADDRESS Address;
+ UINTN Pages;
BOOLEAN IsPerfAlloc;
BootCompat = GetBootCompatContext ();
@@ -299,7 +301,16 @@ OcAllocatePages (
Memory
);
- if (!EFI_ERROR (Status) && BootCompat->ServiceState.AppleBootNestedCount > 0) {
+ if (!EFI_ERROR (Status)) {
+ if (BootCompat->Settings.SyncRuntimePermissions && BootCompat->ServiceState.FwRuntime != NULL) {
+ Status = BootCompat->ServiceState.FwRuntime->GetExecArea (&Address, &Pages);
+
+ if (!EFI_ERROR (Status)) {
+ OcUpdateAttributes (Address, EfiRuntimeServicesCode, EFI_MEMORY_RO, EFI_MEMORY_XP);
+ }
+ }
+
+ if (BootCompat->ServiceState.AppleBootNestedCount > 0) {
if (IsPerfAlloc) {
//
// Called from boot.efi.
@@ -325,6 +336,7 @@ OcAllocatePages (
BootCompat->ServiceState.HibernateImageAddress = *Memory;
}
}
+ }
return Status;
}
