8000 Remove Linux-only restriction from map_region on MultiUseSandbox by jsturtevant · Pull Request #1330 · hyperlight-dev/hyperlight · GitHub
[go: up one dir, main page]

Skip to content

Remove Linux-only restriction from map_region on MultiUseSandbox#1330

Merged
jsturtevant merged 2 commits intomainfrom
remove-linux-only-map-region
Mar 20, 2026
Merged

Remove Linux-only restriction from map_region on MultiUseSandbox#1330
jsturtevant merged 2 commits intomainfrom
remove-linux-only-map-region

Conversation

@jsturtevant
Copy link
Contributor
@jsturtevant jsturtevant commented Mar 20, 2026

Motivation

MultiUseSandbox::map_region was gated behind #[cfg(target_os = "linux")], but the underlying VirtualMachine::map_memory trait has implementations for all three hypervisor backends (KVM, MSHV, and WHP) after #1313.

The map_region method 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::tests pass on Windows (where they were previously skipped).

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>
@jsturtevant jsturtevant added the kind/enhancement For PRs adding features, improving functionality, docs, tests, etc. label Mar 20, 2026
@jsturtevant jsturtevant requested a review from Copilot March 20, 2026 00:06
Copy link
Contributor
Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 from MultiUseSandbox::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>
@jsturtevant jsturtevant merged commit 1e45758 into main Mar 20, 2026
44 checks passed
@jsturtevant jsturtevant deleted the remove-linux-only-map-region branch March 20, 2026 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement For PRs adding features, improving functionality, docs, tests, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

0