-
Notifications
You must be signed in to change notification settings - Fork 127
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
MdeModulePkg: Compatibility Mode: Only Remap System Memory Regions #1030
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release/202311 #1030 +/- ##
==================================================
- Coverage 1.35% 1.35% -0.01%
==================================================
Files 1304 1304
Lines 333790 333854 +64
Branches 5103 5103
==================================================
Hits 4512 4512
- Misses 329195 329259 +64
Partials 83 83
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
reviewing but i have some concerns about under/overflow and checking consistency between different fields
e896ea9
to
9dce760
Compare
@spbrogan, refactored to use SafeIntLib and to only use my own fields as the basis for further checks. |
When we enter memory protections compatibility mode, we attempt to disable null protection and remap 0 - 0xA0000 as RWX. This was done for x86 systems with broken shim/grubs on Linux that would attempt to use those regions. This resolved that issue and we could boot non-memory protection safe Linux images on x86 HW. However, this approach did not take into account systems that do not have that range marked as system memory, for example ARM64 systems do not have this requirement. As such, this would inappropriately map these regions as RWX when they were not system memory. This patch updates the remapping to only remap and disable null protection if these ranges are marked as system memory, otherwise it will leave them alone.
9dce760
to
3f3adb8
Compare
Discussed in person and requested changes were made.
Description
When we enter memory protections compatibility mode, we attempt to disable null protection and remap 0 - 0xA0000 as RWX. This was done for x86 systems with broken shim/grubs on Linux that would attempt to use those regions. This resolved that issue and we could boot non-memory protection safe Linux images on x86 HW. However, this approach did not take into account systems that do not have that range marked as system memory, for example ARM64 systems do not have this requirement. As such, this would inappropriately map these regions as RWX when they were not system memory.
This patch updates the remapping to only remap and disable null protection if these ranges are marked as system memory, otherwise it will leave them alone.
For each item, place an "x" in between
[
and]
if true. Example:[x]
.(you can also check items in the GitHub UI)
flow, or firmware?
validation improvement, ...
in build or boot behavior?
a function in a new library class in a pre-existing module, ...
outside direct code modifications (and comments)?
on an a separate Web page, ...
How This Was Tested
Tested on an ARM64 platform that does not have 0 - 0xA0000 as system memory, as well as an X86 system that does have that range as system memory, booting a Linux image on both that forces us to enter compatibility mode.
Integration Instructions
N/A.