WHP: releasing file mappings after deleting partition in WhpVm::Drop - #1756
Closed
ludfjig wants to merge 1 commit into
Closed
WHP: releasing file mappings after deleting partition in WhpVm::Drop#1756ludfjig wants to merge 1 commit into
ludfjig wants to merge 1 commit into
Conversation
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
ludfjig
requested review from
andreiltd,
danbugs,
dblnz,
devigned,
jprendes,
jsturtevant,
simongdavies,
squillace and
syntactically
as code owners
August 21, 2026 21:04
Contributor
There was a problem hiding this comment.
Pull request overview
Reorders WHP teardown so mapped-file views remain valid until the partition is deleted.
Changes:
- Moves mapped-file cleanup after
WHvDeletePartition. - Prevents invalid host addresses during teardown.
- Moderate issue: failed partition deletion may still leave active mappings before views are released.
Suppressed comments (1)
src/hyperlight_host/src/hypervisor/virtual_machine/whp.rs:1380
- This ordering protects the
HYPERLIGHT_MAX_SURROGATES=0path, but the existing no-surrogate test drops only an unmapped VM, while the mapped-file cleanup test runs with the default surrogate mode. Add a Windows regression test that maps a file with surrogates disabled and then drops the VM, so this lifetime requirement is exercised.
for (handle, view) in self.file_mappings.drain(..) {
release_file_mapping(view, handle);
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+1379
to
+1380
| for (handle, view) in self.file_mappings.drain(..) { | ||
| release_file_mapping(view, handle); |
Contributor
Author
|
Closing, this was wrong! Whoops |
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.
Keep mapped-file views alive while WHP may still reference them. With surrogate processes disabled (
HYPERLIGHT_MAX_SURROGATES=0),WHvMapGpaRangeuses the host view directly. Releasing that view during VM teardown leaves an active GPA mapping backed by an invalid virtual address.This is a defensive change, I don't know of any current impact