-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UefiCpuPkg/PiSmmCpuDxeSmm:Check resource HOB range before mapping #6431
base: master
Are you sure you want to change the base?
Conversation
Count++; | ||
ResourceHobEnd = Hob.ResourceDescriptor->PhysicalStart + Hob.ResourceDescriptor->ResourceLength; | ||
|
||
if (ResourceHobEnd <= MaxPhysicalAddress) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just need assert:
ASSERT ((Hob.ResourceDescriptor->PhysicalStart < MaxPhysicalAddress) && (ResourceHobEnd < MaxPhysicalAddress))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if the unexpected behavior happens in release build?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for any issue check, we will use the debug version. Here, it's just help us quick find the problem. debug log will also not output in release version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per offline talk with Jiaxin, will add CpuDeadLoop here.
It maybe a better choice here to expose the invalid resource HOB range(MMIO range from platform) here early
(*MemoryRegion)[Index].Attribute = EFI_MEMORY_XP; | ||
if (Hob.ResourceDescriptor->ResourceAttribute == EFI_RESOURCE_ATTRIBUTE_READ_ONLY_PROTECTED) { | ||
(*MemoryRegion)[Index].Attribute |= EFI_MEMORY_RO; | ||
ResourceHobEnd = Hob.ResourceDescriptor->PhysicalStart + Hob.ResourceDescriptor->ResourceLength; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't need change here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean remove line 175 directly use the variable in line 177? I'm fine with it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i mean once we assert, those code are not needed.
This commit is to check if the resource HOB range does not exceed the max supported physical address. The function BuildMemoryMapFromResDescHobs is to build Memory Region from resource HOBs. Then the memory maps will be used during creating or modifying SMM page table. If the resource HOB range exceeds the max supported physical address, then subsequent calling of PageTableMap() will fail. Signed-off-by: Dun Tan <dun.tan@intel.com>
bb4499d
to
230dcfd
Compare
Description
This commit is to check if the resource HOB range does not exceed the max supported physical address.
The function BuildMemoryMapFromResDescHobs is to build Memory Region from resource HOBs. Then the memory maps will be used during creating or modifying SMM page table. If the resource HOB range exceeds the max supported physical address, then subsequent calling of PageTableMap() will fail.
How This Was Tested
Tested in Intel internal server platform with x86 standalone MM enabled and succussfully booted into shell