Skip to content

Add memory mapping support with KVM #709

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

Merged
merged 1 commit into from
Jul 10, 2025
Merged

Conversation

jprendes
Copy link
Contributor

This PR adds memory mapping with KVM.
This means that we are now only missing support for memory mapping on Windows.

It also adds a smoke test for the supported platforms.

@jprendes jprendes added the kind/enhancement For PRs adding features, improving functionality, docs, tests, etc. label Jul 10, 2025
@jprendes jprendes marked this pull request as ready for review July 10, 2025 11:00
@jprendes
Copy link
Contributor Author

I tried making the test a bit more complex, where the guest tries to access an mmap buffer that hasn't been mapped by the host.
That guest function call fails with Err(Error("MMIO access address 0x100000000")) as expected, but then the sandbox seem to be left in a bad state even after the state is restored from the last snapshot.

Subsequent call (a simple PrintOutput call in this case) fails with

Err(GuestAborted(8, "panicked at /home/jprendes/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/flatbuffers-25.2.10/src/endian_scalar.rs:142:5:\ninsufficient capacity for emplace_scalar, needed 1 got 0"))

I think there must be some sandbox state we aren't correctly restoring after a guest call fails with certain modes.

@jprendes jprendes force-pushed the kvm-mmap branch 2 times, most recently from 07a0e93 to b7adcf4 Compare July 10, 2025 12:02
Copy link
Member

@syntactically syntactically left a comment

Choose a reason for hiding this comment

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

LGTM

@jprendes jprendes merged commit 39df600 into hyperlight-dev:main Jul 10, 2025
32 checks passed
@jprendes jprendes deleted the kvm-mmap branch July 10, 2025 14:11
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.

2 participants