feat: pass file mapping info via PEB with label support#1322
Merged
simongdavies merged 1 commit intohyperlight-dev:mainfrom Mar 19, 2026
Merged
feat: pass file mapping info via PEB with label support#1322simongdavies merged 1 commit intohyperlight-dev:mainfrom
simongdavies merged 1 commit intohyperlight-dev:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the Hyperlight host↔guest ABI by adding file-mapping metadata (guest address, size, label) to the PEB, enabling guests to discover host-mapped files and their identities. It reserves space for a fixed-size FileMappingInfo array immediately after the PEB to keep the layout stable.
Changes:
- Add
FileMappingInfo+MAX_FILE_MAPPINGSand extendHyperlightPEBwith afile_mappingsdescriptor. - Add optional
labelsupport tomap_file_cow, validate mapping overlaps, and enforce the max mapping count. - Update memory layout sizing to reserve space for the PEB + mappings array, and write mapping entries into the PEB at map time / evolve time.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/hyperlight_host/src/sandbox/uninitialized_evolve.rs | Writes file mapping metadata into the PEB during evolve for deferred mappings. |
| src/hyperlight_host/src/sandbox/uninitialized.rs | Adds label parameter + limit/overlap validation for deferred file mappings. |
| src/hyperlight_host/src/sandbox/initialized_multi_use.rs | Adds label parameter, validates overlaps, writes mapping metadata into the PEB, updates tests for new signature. |
| src/hyperlight_host/src/sandbox/file_mapping.rs | Stores a fixed-size C-string label in prepared mappings and validates/truncates labels. |
| src/hyperlight_host/src/mem/mgr.rs | Adds write_file_mapping_entry to write FileMappingInfo entries into the PEB’s reserved array. |
| src/hyperlight_host/src/mem/layout.rs | Reserves space after the PEB for MAX_FILE_MAPPINGS entries and wires up PEB offsets/pointers. |
| src/hyperlight_host/examples/crashdump/main.rs | Updates map_file_cow calls for the new label parameter. |
| src/hyperlight_common/src/mem.rs | Adds shared ABI types/constants and extends HyperlightPEB with file_mappings. |
You can also share your feedback on Copilot code review. Take the survey.
jsturtevant
reviewed
Mar 19, 2026
danbugs
added a commit
to nanvix/hyperlight
that referenced
this pull request
Mar 19, 2026
Cherry-pick of hyperlight-dev#1322. Add FileMappingInfo struct (guest_addr, size, label) and file_mappings field to HyperlightPEB so file mapping metadata is communicated to the guest through the PEB. Space for MAX_FILE_MAPPINGS (32) entries is statically reserved after the PEB struct to avoid dynamic layout changes. - Add label parameter to map_file_cow (optional, defaults to filename) - Add shared memory overlap validation (full mapped range) - Add inter-mapping overlap detection - Add write_file_mapping_entry on SandboxMemoryManager - Add MAX_FILE_MAPPINGS limit enforcement at registration time - Update PEB region sizing in get_memory_regions and layout tests
8ccd282 to
fec04d7
Compare
Add FileMappingInfo struct (guest_addr, size, label) and file_mappings field to HyperlightPEB so file mapping metadata is communicated to the guest through the PEB. Space for MAX_FILE_MAPPINGS (32) entries is statically reserved after the PEB struct to avoid dynamic layout changes. - Add label parameter to map_file_cow (optional, defaults to filename) - Add shared memory overlap validation (full mapped range) - Add inter-mapping overlap detection - Add write_file_mapping_entry on SandboxMemoryManager - Add MAX_FILE_MAPPINGS limit enforcement at registration time - Update PEB region sizing in get_memory_regions and layout tests Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
fec04d7 to
d67f8e6
Compare
danbugs
approved these changes
Mar 19, 2026
Contributor
danbugs
left a comment
There was a problem hiding this comment.
LGTM to me. Just 2 questions and 1 nit.
jsturtevant
approved these changes
Mar 19, 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.
Add FileMappingInfo struct (guest_addr, size, label) and file_mappings field to HyperlightPEB so file mapping metadata is communicated to the guest through the PEB. Space for MAX_FILE_MAPPINGS (32) entries is statically reserved after the PEB struct to avoid dynamic layout changes.