Trait libafl_bolts::shmem::ShMem
source · pub trait ShMem: Sized + Debug + Clone + AsSlice<Entry = u8> + AsMutSlice<Entry = u8> {
// Required methods
fn id(&self) -> ShMemId;
fn len(&self) -> usize;
// Provided methods
fn is_empty(&self) -> bool { ... }
unsafe fn as_object<T: Sized + 'static>(&self) -> &T { ... }
unsafe fn as_object_mut<T: Sized + 'static>(&mut self) -> &mut T { ... }
unsafe fn as_objects_slice<T: Sized + 'static>(&self, len: usize) -> &[T] { ... }
unsafe fn as_objects_slice_mut<T: Sized + 'static>(
&mut self,
len: usize
) -> &mut [T] { ... }
fn description(&self) -> ShMemDescription { ... }
fn write_to_env(&self, env_name: &str) -> Result<(), Error> { ... }
}
Expand description
A ShMem
is an interface to shared maps.
They are the backbone of crate::llmp
for inter-process communication.
All you need for scaling on a new target is to implement this interface, as well as the respective ShMemProvider
.
Required Methods§
Provided Methods§
sourceunsafe fn as_object<T: Sized + 'static>(&self) -> &T
unsafe fn as_object<T: Sized + 'static>(&self) -> &T
Convert to an owned object reference
Safety
This function is not safe as the object may be not initialized.
The user is responsible to initialize the object with something like
*shmem.as_object_mut::<T>() = T::new();
sourceunsafe fn as_object_mut<T: Sized + 'static>(&mut self) -> &mut T
unsafe fn as_object_mut<T: Sized + 'static>(&mut self) -> &mut T
Convert to an owned object mutable reference
Safety
This function is not safe as the object may be not initialized.
The user is responsible to initialize the object with something like
*shmem.as_object_mut::<T>() = T::new();
sourceunsafe fn as_objects_slice<T: Sized + 'static>(&self, len: usize) -> &[T]
unsafe fn as_objects_slice<T: Sized + 'static>(&self, len: usize) -> &[T]
Convert to a slice of type &[T]
Safety
This function is not safe as the object may be not initialized. The user is responsible to initialize the objects in the slice
sourceunsafe fn as_objects_slice_mut<T: Sized + 'static>(
&mut self,
len: usize
) -> &mut [T]
unsafe fn as_objects_slice_mut<T: Sized + 'static>( &mut self, len: usize ) -> &mut [T]
Convert to a slice of type &mut [T]
Safety
This function is not safe as the object may be not initialized. The user is responsible to initialize the objects in the slice
sourcefn description(&self) -> ShMemDescription
fn description(&self) -> ShMemDescription
Get the description of the shared memory mapping