Struct enarx_shim_kvm::hostcall::UserMemScope
source · [−]pub struct UserMemScope;
Expand description
Memory validation scope
Trait Implementations
sourceimpl Platform for UserMemScope
impl Platform for UserMemScope
sourcefn validate_mut<T>(&self, ptr: usize) -> Result<&mut T, c_int>
fn validate_mut<T>(&self, ptr: usize) -> Result<&mut T, c_int>
Validates that the memory pointed to by ptr
of the type T
is:
- in valid address space and writable for the lifetime of
self
. - “dereferenceable” in the sense defined in the ptr module documentation.
- ptr is non-null and aligned
- not borrowed already and registers the memory as borrowed mutably.
Returns a mutable borrow if valid, otherwise EINVAL
.
sourcefn validate<T>(&self, ptr: usize) -> Result<&T, c_int>
fn validate<T>(&self, ptr: usize) -> Result<&T, c_int>
Validates that the memory pointed to by ptr
of the type T
is:
- in valid address space and readable for the lifetime of
self
. - “dereferenceable” in the sense defined in the ptr module documentation.
- ptr is non-null and aligned
- not borrowed already and registers the memory as borrowed.
Returns an immutable borrow if valid, otherwise EINVAL
.
sourcefn validate_slice_mut<T: Sized>(
&self,
ptr: usize,
count: usize
) -> Result<&mut [T]>
fn validate_slice_mut<T: Sized>(
&self,
ptr: usize,
count: usize
) -> Result<&mut [T]>
Validates that a region for len
elements of type T
is:
- in valid address space and writable for the lifetime of
self
. - “dereferenceable” in the sense defined in the ptr module documentation.
- ptr is non-null and aligned
- not borrowed already and registers the memory as borrowed mutably.
Returns a mutable borrow if valid, otherwise EINVAL
.
sourcefn validate_slice<T: Sized>(&self, ptr: usize, count: usize) -> Result<&[T]>
fn validate_slice<T: Sized>(&self, ptr: usize, count: usize) -> Result<&[T]>
Validates that a region of memory is valid for read-only access for len
elements of type T
.
- in valid address space and writable for the lifetime of
self
. - “dereferenceable” in the sense defined in the ptr module documentation.
- ptr is non-null and aligned
- not borrowed already and registers the memory as borrowed.
Returns an immutable borrow if valid, otherwise EINVAL
.
sourcefn validate_iovec_slice_mut(
&self,
iov: usize,
iovcnt: usize
) -> Result<&mut [&mut [u8]], i32>
fn validate_iovec_slice_mut(
&self,
iov: usize,
iovcnt: usize
) -> Result<&mut [&mut [u8]], i32>
Validates that pointer iov
points to represents a slice of iovcnt
pointers to [libc::iovec
] structures
valid for read-write access. Read more
sourcefn validate_iovec_slice(&self, iov: usize, iovcnt: usize) -> Result<&[&[u8]], i32>
fn validate_iovec_slice(&self, iov: usize, iovcnt: usize) -> Result<&[&[u8]], i32>
Validates that pointer iov
points to represents a slice of iovcnt
pointers to [libc::iovec
] structures
valid for read-only access. Read more
sourcefn validate_str(&self, ptr: usize) -> Result<&[u8], i32>
fn validate_str(&self, ptr: usize) -> Result<&[u8], i32>
Validates that a region of memory represents a C string and is valid for read-only access. Read more
sourcefn validate_sockaddr_output(
&self,
addr: usize,
addrlen: usize
) -> Result<SockaddrOutput<'_>, i32>
fn validate_sockaddr_output(
&self,
addr: usize,
addrlen: usize
) -> Result<SockaddrOutput<'_>, i32>
Validates that pointer addrlen
points to socklen_t
and addr
points to
a byte array of size *addrlen
and is valid for read-write access. Read more
Auto Trait Implementations
impl RefUnwindSafe for UserMemScope
impl Send for UserMemScope
impl Sync for UserMemScope
impl Unpin for UserMemScope
impl UnwindSafe for UserMemScope
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more