Skip to content

fix: Validate guest address ranges for overlapping regions in map_region - #1369

Closed
Richard-Durkee wants to merge 1 commit into
hyperlight-dev:mainfrom
Richard-Durkee:fix/validate-map-region-overlap
Closed

Richard-Durkee wants to merge 1 commit into
hyperlight-dev:mainfrom
Richard-Durkee:fix/validate-map-region-overlap

Conversation

@Richard-Durkee

Copy link
Copy Markdown
Contributor

Add overlap validation to HyperlightVm::map_region to enforce the safety contract documented on VirtualMachine::map_memory, which requires that memory regions must not overlap.

The check validates the new region against:

  • Existing dynamically mapped regions (mmap_regions)
  • The snapshot region (starting at BASE_ADDRESS)
  • The scratch region (at the top of the GPA space)

Add Overlapping variant to MapRegionError with a descriptive message showing both the new and conflicting ranges.

Add four tests covering:

  • Exact duplicate mapping rejection
  • Partial overlap rejection
  • Adjacent non-overlapping regions (should succeed)
  • Overlap with the snapshot region

@ludfjig ludfjig added the C-bug For PRs that fix bugs label Apr 21, 2026
Closes #1289

Signed-off-by: Richard Durkee <Richard-Durkee@users.noreply.github.com>
@Richard-Durkee Richard-Durkee closed this by deleting the head repository May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-bug For PRs that fix bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants