Skip to content

Better abstractions for dealing with host addresses #333

@DemiMarie

Description

@DemiMarie

Right now, using this crate requires extracting raw pointers to host memory and passing them to various ioctls. This is very error-prone: see cloud-hypervisor/cloud-hypervisor#7129 for a partial fix to the problems I have seen in Cloud Hypervisor.

A much better approach would be to have various types that owned the host memory, or at least a reference to it. One would obtain this type by mapping memory into a guest, a VFIO container, or something else. Dropping the type would unmap the memory and release the reference. The host address of the memory would not be directly available to applications, preventing it from being misused.

Another option would be to instead have the memory regions be responsible for unmapping the data when dropped. This requires hard-coding VFIO and the hypervisor, but that might be an acceptable compromise for a simpler design.

CC @alyssais who reviewed cloud-hypervisor/cloud-hypervisor#7129, of which this is a continuation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions