Problem:

The NX bit in page table is not expected for new allocated EfiBootServicesCode

if bit7(EfiConventionalMemory) is zero and bit0(EfiReservedMemoryType) is one of PcdDxeNxMemoryProtectionPolicy.

 

Flow:

When bit0 of PcdDxeNxMemoryProtectionPolicy is set to 1, the EfiReservedMemoryType attribute is EFI_MEMORY_XP,

the NX bit is set for EfiReservedMemoryType memory in InitializeDxeNxMemoryProtectionPolicy().

 

 

In CoreInternalAllocatePages, if request a specific address but can't be found in current memory map,

it does a special “memory promotion”.

PromoteMemoryResource() is called to find memory resource and add UNTESTED memory region to be system memory.

The type of UNTESTED memory is EfiGcdMemoryTypeReserved.

 

In CoreAddRange(), the new memory resource is added to allocable system memory resource,

the new type is EfiConventionalMemory but the memory attribute is not really changed, NX bit is still set.

 

Before return to caller, ApplyMemoryProtectionPolicy() is used to convert memory attribute,

however, both bit7(EfiConventionalMemory) and bit3(EfiBootServicesCode) are zero, memory attribute is not changed.

NX bit is still set.

 

AllocatePages returns a EfiBootServicesCode memory but its NX bit is set.

-The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission.
_._,_._,_

Groups.io Links:

You receive all messages sent to this group.

View/Reply Online (#119807) | | Mute This Topic | New Topic
Your Subscription | Contact Group Owner | Unsubscribe [rebecca@openfw.io]

_._,_._,_