Skip to content

Validate guest address ranges for overlapping regions in map_region / map_file_cow #1289

Closed

Description

@simongdavies

Summary

HyperlightVm::map_region does not check whether a new guest address range overlaps with an already-mapped region. The VirtualMachine::map_memory safety contract explicitly requires non-overlapping regions, but map_region does not enforce this precondition. On WHP, overlapping mappings return a cryptic HRESULT (confirmed — WHvMapGpaRange2 rejects the call and the error is wrapped as a generic WindowsError). On KVM and MSHV, the behaviour is kernel/hypervisor-version-dependent and may range from an explicit error to silent shadowing of the previous mapping, risking data corruption.

Current Behaviour

HyperlightVm::map_region (in src/hyperlight_host/src/hypervisor/hyperlight_vm.rs) validates page alignment of guest and host addresses, assigns a unique slot, and calls the platform-specific map_memory. It does not check the new guest_region against existing entries in self.mmap_regions.

The existing mapped regions are readily available via self.mmap_regions (a Vec<(u32, MemoryRegion)>), so adding the check is straightforward.

Activity

  1. added this to the v0.14.0 milestone on Mar 11, 2026
  2. added
    lifecycle/confirmedBug is verified or proposal seems reasonable
    and removed on Mar 11, 2026
  3. added 16 commits that reference this issue on May 19, 2026
    bb16213
    3075ff3
    f2c4072
    cfd33a6
    fa24c67
    5f016ed
    5e09e95
    7b5b668
    e7ab604
    4ed3239
    406492a
    7d43308
    119ea15
    7bdfefe
    b7f04d2
    247fef6
  4. added a commit that references this issue on May 28, 2026
    8c91a4d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    lifecycle/confirmedBug is verified or proposal seems reasonable

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions