Repository navigation
underhill_mem: reject oversized page numbers and test memory access - #5235
Open
Sunil Muthuswamy (sunilmut) wants to merge 1 commit into
Open
Sunil Muthuswamy (sunilmut) wants to merge 1 commit into
Sunil Muthuswamy (sunilmut) wants to merge 1 commit into
Conversation
|
This PR modifies files containing For more on why we check whole files, instead of just diffs, check out the Rustonomicon |
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Guest-controlled GPN validation affects OpenHCL’s VTL0 memory-isolation boundary, warranting human security review because end-to-end hypercall rejection was not runtime-validated.
No open issues 🎉
What changed in this PR
This PR hardens OpenHCL’s guest-memory validation by rejecting page numbers whose byte addresses overflow, preventing them from aliasing valid RAM and causing visibility-bitmap panics.
Changes:
- Use checked page-to-address conversion and make the RAM check independently testable.
- Add regression and behavior tests for overflow, memory permissions, execute views, and shared/private visibility.
- Test registration-failure isolation and concurrent overlapping registration; enable tracing in unit tests.
| File | Description |
|---|---|
openhcl/underhill_mem/src/registrar.rs |
Adds failure-isolation and concurrent-registration tests. |
openhcl/underhill_mem/src/mapping.rs |
Adds permission, execute-view, and visibility tests. |
openhcl/underhill_mem/src/lib.rs |
Rejects overflowing page numbers, updates callers, and adds regression coverage. |
openhcl/underhill_mem/Cargo.toml |
Adds the tracing-enabled test dependency. |
Cargo.lock |
Records the added test dependency. |
Review effort: Balanced
Reject oversized guest page numbers before checking guest RAM. Test changes: - Verify oversized page numbers are rejected. - Check read/write permissions and kernel/user instruction-read access. - Verify shared/private mapping errors leave memory unchanged. - Ensure registration failures do not block unrelated RAM. - Check overlapping registration requests succeed without duplicates.
Sunil Muthuswamy (sunilmut)
force-pushed
the
user/sunilmut/malformed-gpn-repro
branch
from
November 26, 2026 22:33
374749c to
d0f073f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The guest-RAM check converted a guest page number to an address with
gpn << 12, which discards high bits. An oversized GPN such as(1 << 52) | 4was accepted as page 4, while later bitmap indexing used theoriginal GPN, leading to a panic in the visibility bitmap.
This change converts with
checked_mul(HV_PAGE_SIZE)and rejects GPNs whoseaddress does not fit. Valid GPNs behave as before. The private RAM check now
takes the
MemoryLayoutinstead of&selfso it can be unit tested; its fivecallers pass their existing layout.
Test changes:
kernel/user instruction-read views, shared/private mapping errors that leave
data unchanged, registration-failure isolation, and concurrent overlapping
registration without duplicate work.