-
Notifications
You must be signed in to change notification settings - Fork 115
Description
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.