Module shared_mem

Source
Expand description

A wrapper around unsafe functionality to create and initialize a memory region for a guest running in a sandbox.

Structs§

ExclusiveSharedMemory
These three structures represent various phases of the lifecycle of a memory buffer that is shared with the guest. An ExclusiveSharedMemory is used for certain operations that unrestrictedly write to the shared memory, including setting it up and taking snapshots.
GuestSharedMemory
A GuestSharedMemory is used to represent the reference to all-of-memory that is taken by the virtual cpu. Because of the memory model limitations that affect HostSharedMemory, it is likely fairly important (to ensure that our UB remains limited to interaction with an external compilation unit that likely can’t be discovered by the compiler) that rust users do not perform racy accesses to the guest communication buffers that are also accessed by HostSharedMemory.
HostMapping
A representation of a host mapping of a shared memory region, which will be released when this structure is Drop’d. This is not individually Clone (since it holds ownership of the mapping), or Send or Sync, since it doesn’t ensure any particular synchronization.
HostSharedMemory
A HostSharedMemory allows synchronized accesses to guest communication buffers, allowing it to be used concurrently with a GuestSharedMemory.

Traits§

AllValid
An unsafe marker trait for types for which all bit patterns are valid. This is required in order for it to be safe to read a value of a particular type out of the sandbox from the HostSharedMemory.
SharedMemory
A trait that abstracts over the particular kind of SharedMemory, used when invoking operations from Rust that absolutely must have exclusive control over the shared memory for correctness + performance, like snapshotting.