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§

source

fn id(&self) -> ShMemId

Get the id of this shared memory mapping

source

fn len(&self) -> usize

Get the size of this mapping

Provided Methods§

source

fn is_empty(&self) -> bool

Check if the mapping is empty

source

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();

source

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();

source

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

source

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

source

fn description(&self) -> ShMemDescription

Get the description of the shared memory mapping

source

fn write_to_env(&self, env_name: &str) -> Result<(), Error>

Write this map’s config to env

Object Safety§

This trait is not object safe.

Implementors§

source§

impl ShMem for AshmemShMem

source§

impl ShMem for MmapShMem

source§

impl<SH> ShMem for ServedShMem<SH>
where SH: ShMem,

source§

impl<T> ShMem for RcShMem<T>
where T: ShMemProvider + Debug,