Branch: refs/heads/master
  Home:   https://github.com/tianocore/edk2
  Commit: 254641f342ac3c1991e0e4d32c0ea9c8cfc723f3
      
https://github.com/tianocore/edk2/commit/254641f342ac3c1991e0e4d32c0ea9c8cfc723f3
  Author: Oliver Smith-Denny <[email protected]>
  Date:   2024-08-29 (Thu, 29 Aug 2024)

  Changed paths:
    M MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c

  Log Message:
  -----------
  MdeModulePkg: MAT: Do Not Set EfiMemoryMappedIo[PortSpace] Attrs

Per UEFI spec 2.10 section 4.6.3 EFI_MEMORY_ATTRIBUTES_TABLE,

"The Memory Attributes Table is currently used to describe memory
protections that may be applied to the EFI Runtime code and data
by an operating system or hypervisor. Consumers of this table must
currently ignore entries containing any values for Type except for
EfiRuntimeServicesData and EfiRuntimeServicesCode to ensure
compatibility with future uses of this table."

However, the current MAT code also enforces attributes for
EfiMemoryMappedIo and EfiMemoryMappedIoPortSpace, which it should
not be. Per
https://edk2.groups.io/g/devel/topic/patch_v1_mdemodulepkg/105570114?p=,,,20,0,0,0::recentpostdate/sticky,,,20,2,0,105570114,
it was suggested to remove these types from the MAT logic.

This patch removes EfiMemoryMappedIo and EfiMemoryMappedIoPortSpace
from the MAT logic in accordance with the UEFI spec.

Signed-off-by: Oliver Smith-Denny <[email protected]>


  Commit: bb248a95091ab542440053d9c289a97e80eb6630
      
https://github.com/tianocore/edk2/commit/bb248a95091ab542440053d9c289a97e80eb6630
  Author: Oliver Smith-Denny <[email protected]>
  Date:   2024-08-29 (Thu, 29 Aug 2024)

  Changed paths:
    M MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c

  Log Message:
  -----------
  MdeModulePkg: MAT Set RO/XP on Code/Data Sections Outside Image Memory

The Memory Attributes Table is generated by fetching the EFI memory map
and splitting entries which contain loaded images so DATA and CODE
sections have separate descriptors. The splitting is done via a call to
SplitTable() which
marks image DATA sections with the EFI_MEMORY_XP attribute and CODE
sections with the EFI_MEMORY_RO attribute when
splitting. After this process, there may still be EfiRuntimeServicesCode
regions which did not have their attributes set because they are not
part of loaded images.

This patch updates the MAT EnforceMemoryMapAttribute logic to set the
access attributes of runtime memory regions which are not part of loaded
images (have not had their access attributes set). The attributes of the
code regions will be read-only and no-execute because the UEFI spec
dictates that runtime code regions should only contain loaded EFI
modules.

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4832

Refs:
1.
https://edk2.groups.io/g/devel/topic/patch_v1_mdemodulepkg/105570114?p=,,,20,0,0,0::recentpostdate/sticky,,,20,2,0,105570114
2.
https://edk2.groups.io/g/devel/topic/mdemodulepkg_fix_mat/105477564?p=,,,20,0,0,0::recentpostdate/sticky,,,20,2,0,105477564

Signed-off-by: Oliver Smith-Denny <[email protected]>


Compare: https://github.com/tianocore/edk2/compare/31f022500549...bb248a95091a

To unsubscribe from these emails, change your notification settings at 
https://github.com/tianocore/edk2/settings/notifications


_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to