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

fix: Validate guest address ranges for overlapping regions in map_region#1369
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

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 kind/bugfix For PRs that fix bugs label Apr 21, 2026
@Richard-Durkee Richard-Durkee force-pushed the fix/validate-map-region-overlap branch 5 times, most recently from f7de997 to f69d523 Compare May 19, 2026 13:37
Closes #1289

Signed-off-by: Richard Durkee <Richard-Durkee@users.noreply.github.com>
@Richard-Durkee Richard-Durkee force-pushed the fix/validate-map-region-overlap branch from f69d523 to 644165f Compare May 19, 2026 16:23
@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

kind/bugfix For PRs that fix bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants