Remove Linux-only restriction from map_region on MultiUseSandbox#1330
Merged
jsturtevant merged 2 commits intomainfrom Mar 20, 2026
Merged
Remove Linux-only restriction from map_region on MultiUseSandbox#1330jsturtevant merged 2 commits intomainfrom
jsturtevant merged 2 commits intomainfrom
Conversation
The map_region method and its tests were gated behind #[cfg(target_os = "linux")] but the underlying VM trait (VirtualMachine::map_memory) has implementations for KVM, MSHV, and WHP (Windows). The method itself contains no platform-specific code. - Remove #[cfg(target_os = "linux")] from map_region, its imports (log_then_return, MemoryRegionFlags), and all related tests/helpers - Fix region_for_memory helper to use platform-correc 8000 t host base type (HostRegionBase on Windows, usize on Linux) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: James Sturtevant <jsturtevant@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Removes the Linux-only gating on MultiUseSandbox::map_region and enables related tests to run on Windows now that all hypervisor backends implement the underlying memory-mapping support.
Changes:
- Removed
#[cfg(target_os = "linux")]restriction fromMultiUseSandbox::map_region. - Un-gated
map_region-related tests so they execute on Windows. - Adjusted test helper(s) to compute host-region ranges correctly on Windows.
Replace platform-conditional #[cfg] blocks and verbose turbofish calls with host_region_base() and host_region_end() on SharedMemory. This simplifies mapping_at() and the test region_for_memory helper. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: James Sturtevant <jsturtevant@gmail.com>
simongdavies
approved these changes
Mar 20, 2026
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.
Motivation
MultiUseSandbox::map_regionwas gated behind#[cfg(target_os = "linux")], but the underlyingVirtualMachine::map_memorytrait has implementations for all three hypervisor backends (KVM, MSHV, and WHP) after #1313.The
map_regionmethod itself contains no platform-specific code — it just checks for writable flags, delegates to the VM, and bumps a counter. There's no reason to restrict it to Linux and we need it for the current hyperlight-wasm path.Verification
All 36
initialized_multi_use::testspass on Windows (where they were previously skipped).