forked from firecracker-microvm/firecracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit e372729
committed
Add VolatileRead/VolatileWrite traits
These are essentially clones of the Read/Write traits from the standard
library, but instead of operating on &[u8] and &mut [u8], they operate
on VolatileSlices. We cannot use the stdlib traits to operate on guest
memory due to unsoundness concerns, see rust-vmm/vm-memory#217 and 228.
A default implementation is provided for `File` and `UnixStream` (as
these are the types for which firecracker needs them). I have done
experiements with instead providing a blanket implementation for `T:
AsRawFd`, however ran into some problems with trait coherence rules, as
such a blanket implementation makes the implementation of
Read/WriteVolatile for &[u8]/&mut [u8] impossible.
This allows us to also potentially choose different implementations for
different kind of `AsRawFd`s (e.g. using `recv` for sockets). This can
all be revised later though.
These traits would fit nicely into rust-vmm, and I'll put out feelers
about interest regarding these traits after our release tasks are done.
Signed-off-by: Patrick Roy <[email protected]>1 parent 9f17bff commit e372729Copy full SHA for e372729
File tree
Expand file treeCollapse file tree
1 file changed
+402
-3
lines changedOpen diff view settings
Filter options
- src/utils/src
Expand file treeCollapse file tree
1 file changed
+402
-3
lines changedOpen diff view settings
0 commit comments