On 4/18/2024 6:56 AM, Huang, Yanbo wrote:
The PCD PcdPlatformEfiRtCodeMemorySize is used in https://github.com/tianocore/edk2-platforms/blob/master/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c This PCD seems defined the size allocated for run time services code, and the similar PCD is PcdPlatformEfiRtDataMemorySize, seems defined the size allocated for run time services data. I guess dandan means if the runtime services code size is small than the PCD defined, then the " Extra EfiRuntimeServicesCode regions which aren't part of loaded runtime images." size should be FixedPcdGet32 (PcdPlatformEfiRtCodeMemorySize) - the actual runtime image code size?
Drawing the lines here, we will lie in the EFI_MEMORY_MAP to say that all bin memory is allocated, regardless of this PCD: https://github.com/tianocore/edk2/blob/0afb8743493853e30171f6000de51242e22a1eb8/MdeModulePkg/Core/Dxe/Mem/Page.c#L1973-L1989 So this is just junk unallocated memory that we are reporting as a type it *could* be if an allocation occurs to minimize failures of ExitBootServices. Which is questionable. But in terms of attributes, I would expect we either have this unallocated memory marked the same as the bin type or better, mark it RP if we can (Taylor is making a change to set RP on free memory by default, so we would have this in the page table, but we would need to decide what we tell the OS). Going back to the questionableness of this: can we not report the entire bin as allocated memory to the OS? I understand what the comment is saying; I don't like that we will lie to the OS and reserve larger chunks of runtime memory than we actually need and that will get the wrong permissions set on it (for example making this garbage data be executable). Thanks, Oliver -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117994): https://edk2.groups.io/g/devel/message/117994 Mute This Topic: https://groups.io/mt/105477564/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-