Rename Reference to Handle (#2142)

* rename

* rename

* fmt

* fix

* fmt
This commit is contained in:
Dongjia "toka" Zhang 2024-05-04 18:16:28 +02:00 committed by GitHub
parent 41ff7438eb
commit b0ac25a7b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
37 changed files with 154 additions and 155 deletions

View File

@ -21,7 +21,7 @@ use libafl::{
use libafl_bolts::{ use libafl_bolts::{
rands::StdRand, rands::StdRand,
shmem::{ShMem, ShMemProvider, UnixShMemProvider}, shmem::{ShMem, ShMemProvider, UnixShMemProvider},
tuples::{tuple_list, MatchNameRef, Merge, Referenceable}, tuples::{tuple_list, Handler, MatchNameRef, Merge},
AsSliceMut, Truncate, AsSliceMut, Truncate,
}; };
use libafl_targets::EDGES_MAP_SIZE_IN_USE; use libafl_targets::EDGES_MAP_SIZE_IN_USE;
@ -166,7 +166,7 @@ pub fn main() {
// Create the executor for the forkserver // Create the executor for the forkserver
let args = opt.arguments; let args = opt.arguments;
let observer_ref = edges_observer.reference(); let observer_ref = edges_observer.handle();
let mut tokens = Tokens::new(); let mut tokens = Tokens::new();
let mut executor = ForkserverExecutor::builder() let mut executor = ForkserverExecutor::builder()

View File

@ -22,7 +22,7 @@ use libafl_bolts::{
current_nanos, current_nanos,
rands::StdRand, rands::StdRand,
shmem::{ShMem, ShMemProvider, UnixShMemProvider}, shmem::{ShMem, ShMemProvider, UnixShMemProvider},
tuples::{tuple_list, Merge, Referenceable}, tuples::{tuple_list, Handler, Merge},
AsSliceMut, Truncate, AsSliceMut, Truncate,
}; };
use nix::sys::signal::Signal; use nix::sys::signal::Signal;
@ -163,7 +163,7 @@ pub fn main() {
// Create the executor for the forkserver // Create the executor for the forkserver
let args = opt.arguments; let args = opt.arguments;
let observer_ref = edges_observer.reference(); let observer_ref = edges_observer.handle();
let mut tokens = Tokens::new(); let mut tokens = Tokens::new();
let mut executor = ForkserverExecutor::builder() let mut executor = ForkserverExecutor::builder()

View File

@ -37,7 +37,7 @@ use libafl_bolts::{
ownedref::OwnedRefMut, ownedref::OwnedRefMut,
rands::StdRand, rands::StdRand,
shmem::{ShMem, ShMemProvider, UnixShMemProvider}, shmem::{ShMem, ShMemProvider, UnixShMemProvider},
tuples::{tuple_list, Merge, Referenceable}, tuples::{tuple_list, Handler, Merge},
AsSliceMut, AsSliceMut,
}; };
use libafl_targets::{ use libafl_targets::{
@ -355,7 +355,7 @@ fn fuzz(
let cmpmap = unsafe { OwnedRefMut::from_shmem(&mut cmplog_shmem) }; let cmpmap = unsafe { OwnedRefMut::from_shmem(&mut cmplog_shmem) };
let cmplog_observer = AFLppCmpLogObserver::new("cmplog", cmpmap, true); let cmplog_observer = AFLppCmpLogObserver::new("cmplog", cmpmap, true);
let cmplog_ref = cmplog_observer.reference(); let cmplog_ref = cmplog_observer.handle();
let cmplog_executor = ForkserverExecutor::builder() let cmplog_executor = ForkserverExecutor::builder()
.program(exec) .program(exec)

View File

@ -42,7 +42,7 @@ use libafl_bolts::{
current_nanos, current_nanos,
rands::StdRand, rands::StdRand,
shmem::{ShMem, ShMemProvider, StdShMemProvider}, shmem::{ShMem, ShMemProvider, StdShMemProvider},
tuples::{tuple_list, Referenceable}, tuples::{tuple_list, Handler},
AsSlice, AsSliceMut, AsSlice, AsSliceMut,
}; };
use libafl_targets::{ use libafl_targets::{
@ -207,7 +207,7 @@ fn fuzz(
// The concolic observer observers the concolic shared memory map. // The concolic observer observers the concolic shared memory map.
let concolic_observer = ConcolicObserver::new("concolic", concolic_shmem.as_slice_mut()); let concolic_observer = ConcolicObserver::new("concolic", concolic_shmem.as_slice_mut());
let concolic_ref = concolic_observer.reference(); let concolic_ref = concolic_observer.handle();
// The order of the stages matter! // The order of the stages matter!
let mut stages = tuple_list!( let mut stages = tuple_list!(

View File

@ -7,7 +7,7 @@ use core::{hash::Hash, marker::PhantomData};
use hashbrown::{HashMap, HashSet}; use hashbrown::{HashMap, HashSet};
use libafl_bolts::{ use libafl_bolts::{
current_time, current_time,
tuples::{Reference, Referenceable}, tuples::{Handle, Handler},
AsIter, Named, AsIter, Named,
}; };
use num_traits::ToPrimitive; use num_traits::ToPrimitive;
@ -51,7 +51,7 @@ where
/// Algorithm based on WMOPT: <https://hexhive.epfl.ch/publications/files/21ISSTA2.pdf> /// Algorithm based on WMOPT: <https://hexhive.epfl.ch/publications/files/21ISSTA2.pdf>
#[derive(Debug)] #[derive(Debug)]
pub struct MapCorpusMinimizer<C, E, O, T, TS> { pub struct MapCorpusMinimizer<C, E, O, T, TS> {
obs_ref: Reference<C>, obs_ref: Handle<C>,
phantom: PhantomData<(E, O, T, TS)>, phantom: PhantomData<(E, O, T, TS)>,
} }
@ -70,7 +70,7 @@ where
/// in the future to get observed maps from an executed input. /// in the future to get observed maps from an executed input.
pub fn new(obs: &C) -> Self { pub fn new(obs: &C) -> Self {
Self { Self {
obs_ref: obs.reference(), obs_ref: obs.handle(),
phantom: PhantomData, phantom: PhantomData,
} }
} }

View File

@ -11,7 +11,7 @@ use alloc::{boxed::Box, string::String, vec::Vec};
use core::{marker::PhantomData, num::NonZeroUsize, time::Duration}; use core::{marker::PhantomData, num::NonZeroUsize, time::Duration};
#[cfg(feature = "adaptive_serialization")] #[cfg(feature = "adaptive_serialization")]
use libafl_bolts::tuples::{Reference, Referenceable}; use libafl_bolts::tuples::{Handle, Handler};
#[cfg(feature = "llmp_compression")] #[cfg(feature = "llmp_compression")]
use libafl_bolts::{ use libafl_bolts::{
compress::GzipCompressor, compress::GzipCompressor,
@ -226,7 +226,7 @@ where
#[cfg(feature = "llmp_compression")] #[cfg(feature = "llmp_compression")]
compressor: GzipCompressor, compressor: GzipCompressor,
#[cfg(feature = "adaptive_serialization")] #[cfg(feature = "adaptive_serialization")]
time_ref: Reference<TimeObserver>, time_ref: Handle<TimeObserver>,
is_main: bool, is_main: bool,
} }
@ -270,7 +270,7 @@ where
self.inner.should_serialize_cnt_mut() self.inner.should_serialize_cnt_mut()
} }
fn time_ref(&self) -> &Reference<TimeObserver> { fn time_ref(&self) -> &Handle<TimeObserver> {
&self.time_ref &self.time_ref
} }
} }
@ -493,7 +493,7 @@ where
client, client,
#[cfg(feature = "llmp_compression")] #[cfg(feature = "llmp_compression")]
compressor: GzipCompressor::new(COMPRESS_THRESHOLD), compressor: GzipCompressor::new(COMPRESS_THRESHOLD),
time_ref: time_obs.reference(), time_ref: time_obs.handle(),
is_main, is_main,
}) })
} }
@ -532,7 +532,7 @@ where
client, client,
#[cfg(feature = "llmp_compression")] #[cfg(feature = "llmp_compression")]
compressor: GzipCompressor::new(COMPRESS_THRESHOLD), compressor: GzipCompressor::new(COMPRESS_THRESHOLD),
time_ref: time_obs.reference(), time_ref: time_obs.handle(),
is_main, is_main,
}) })
} }
@ -570,7 +570,7 @@ where
client: LlmpClient::on_existing_from_env(shmem_provider, env_name)?, client: LlmpClient::on_existing_from_env(shmem_provider, env_name)?,
#[cfg(feature = "llmp_compression")] #[cfg(feature = "llmp_compression")]
compressor: GzipCompressor::new(COMPRESS_THRESHOLD), compressor: GzipCompressor::new(COMPRESS_THRESHOLD),
time_ref: time_obs.reference(), time_ref: time_obs.handle(),
is_main, is_main,
}) })
} }
@ -606,7 +606,7 @@ where
client: LlmpClient::existing_client_from_description(shmem_provider, description)?, client: LlmpClient::existing_client_from_description(shmem_provider, description)?,
#[cfg(feature = "llmp_compression")] #[cfg(feature = "llmp_compression")]
compressor: GzipCompressor::new(COMPRESS_THRESHOLD), compressor: GzipCompressor::new(COMPRESS_THRESHOLD),
time_ref: time_obs.reference(), time_ref: time_obs.handle(),
is_main, is_main,
}) })
} }

View File

@ -33,7 +33,7 @@ use libafl_bolts::os::dup2;
#[cfg(all(feature = "std", any(windows, not(feature = "fork"))))] #[cfg(all(feature = "std", any(windows, not(feature = "fork"))))]
use libafl_bolts::os::startable_self; use libafl_bolts::os::startable_self;
#[cfg(feature = "adaptive_serialization")] #[cfg(feature = "adaptive_serialization")]
use libafl_bolts::tuples::{Reference, Referenceable}; use libafl_bolts::tuples::{Handle, Handler};
#[cfg(all(unix, feature = "std", feature = "fork"))] #[cfg(all(unix, feature = "std", feature = "fork"))]
use libafl_bolts::{ use libafl_bolts::{
core_affinity::get_core_ids, core_affinity::get_core_ids,
@ -125,7 +125,7 @@ where
#[builder(default = None)] #[builder(default = None)]
remote_broker_addr: Option<SocketAddr>, remote_broker_addr: Option<SocketAddr>,
#[cfg(feature = "adaptive_serialization")] #[cfg(feature = "adaptive_serialization")]
time_ref: Reference<TimeObserver>, time_ref: Handle<TimeObserver>,
/// If this launcher should spawn a new `broker` on `[Self::broker_port]` (default). /// If this launcher should spawn a new `broker` on `[Self::broker_port]` (default).
/// The reason you may not want this is, if you already have a [`Launcher`] /// The reason you may not want this is, if you already have a [`Launcher`]
/// with a different configuration (for the same target) running on this machine. /// with a different configuration (for the same target) running on this machine.
@ -683,7 +683,7 @@ where
.serialize_state(self.serialize_state) .serialize_state(self.serialize_state)
.hooks(tuple_list!()); .hooks(tuple_list!());
#[cfg(feature = "adaptive_serialization")] #[cfg(feature = "adaptive_serialization")]
let builder = builder.time_ref(self.time_obs.reference()); let builder = builder.time_ref(self.time_obs.handle());
let (state, mgr) = builder.build().launch()?; let (state, mgr) = builder.build().launch()?;
#[cfg(not(feature = "adaptive_serialization"))] #[cfg(not(feature = "adaptive_serialization"))]
@ -727,7 +727,7 @@ where
.hooks(tuple_list!()); .hooks(tuple_list!());
#[cfg(feature = "adaptive_serialization")] #[cfg(feature = "adaptive_serialization")]
let builder = builder.time_ref(self.time_obs.reference()); let builder = builder.time_ref(self.time_obs.handle());
builder.build().launch()?; builder.build().launch()?;

View File

@ -33,7 +33,7 @@ use libafl_bolts::{
#[cfg(feature = "adaptive_serialization")] #[cfg(feature = "adaptive_serialization")]
use libafl_bolts::{ use libafl_bolts::{
current_time, current_time,
tuples::{Reference, Referenceable}, tuples::{Handle, Handler},
}; };
#[cfg(feature = "std")] #[cfg(feature = "std")]
use libafl_bolts::{llmp::LlmpConnection, shmem::StdShMemProvider, staterestore::StateRestorer}; use libafl_bolts::{llmp::LlmpConnection, shmem::StdShMemProvider, staterestore::StateRestorer};
@ -367,7 +367,7 @@ where
#[cfg(feature = "adaptive_serialization")] #[cfg(feature = "adaptive_serialization")]
should_serialize_cnt: usize, should_serialize_cnt: usize,
#[cfg(feature = "adaptive_serialization")] #[cfg(feature = "adaptive_serialization")]
time_ref: Reference<TimeObserver>, time_ref: Handle<TimeObserver>,
phantom: PhantomData<S>, phantom: PhantomData<S>,
} }
@ -403,7 +403,7 @@ where
&mut self.should_serialize_cnt &mut self.should_serialize_cnt
} }
fn time_ref(&self) -> &Reference<TimeObserver> { fn time_ref(&self) -> &Handle<TimeObserver> {
&self.time_ref &self.time_ref
} }
} }
@ -498,7 +498,7 @@ where
pub fn new( pub fn new(
llmp: LlmpClient<SP>, llmp: LlmpClient<SP>,
configuration: EventConfig, configuration: EventConfig,
time_ref: Reference<TimeObserver>, time_ref: Handle<TimeObserver>,
) -> Result<Self, Error> { ) -> Result<Self, Error> {
Ok(LlmpEventManager { Ok(LlmpEventManager {
hooks: tuple_list!(), hooks: tuple_list!(),
@ -525,7 +525,7 @@ where
shmem_provider: SP, shmem_provider: SP,
port: u16, port: u16,
configuration: EventConfig, configuration: EventConfig,
time_ref: Reference<TimeObserver>, time_ref: Handle<TimeObserver>,
) -> Result<LlmpEventManager<(), S, SP>, Error> { ) -> Result<LlmpEventManager<(), S, SP>, Error> {
let llmp = LlmpClient::create_attach_to_tcp(shmem_provider, port)?; let llmp = LlmpClient::create_attach_to_tcp(shmem_provider, port)?;
Self::new(llmp, configuration, time_ref) Self::new(llmp, configuration, time_ref)
@ -538,7 +538,7 @@ where
shmem_provider: SP, shmem_provider: SP,
env_name: &str, env_name: &str,
configuration: EventConfig, configuration: EventConfig,
time_ref: Reference<TimeObserver>, time_ref: Handle<TimeObserver>,
) -> Result<LlmpEventManager<(), S, SP>, Error> { ) -> Result<LlmpEventManager<(), S, SP>, Error> {
let llmp = LlmpClient::on_existing_from_env(shmem_provider, env_name)?; let llmp = LlmpClient::on_existing_from_env(shmem_provider, env_name)?;
Self::new(llmp, configuration, time_ref) Self::new(llmp, configuration, time_ref)
@ -550,7 +550,7 @@ where
shmem_provider: SP, shmem_provider: SP,
description: &LlmpClientDescription, description: &LlmpClientDescription,
configuration: EventConfig, configuration: EventConfig,
time_ref: Reference<TimeObserver>, time_ref: Handle<TimeObserver>,
) -> Result<LlmpEventManager<(), S, SP>, Error> { ) -> Result<LlmpEventManager<(), S, SP>, Error> {
let llmp = LlmpClient::existing_client_from_description(shmem_provider, description)?; let llmp = LlmpClient::existing_client_from_description(shmem_provider, description)?;
Self::new(llmp, configuration, time_ref) Self::new(llmp, configuration, time_ref)
@ -628,7 +628,7 @@ where
llmp: LlmpClient<SP>, llmp: LlmpClient<SP>,
configuration: EventConfig, configuration: EventConfig,
hooks: EMH, hooks: EMH,
time_ref: Reference<TimeObserver>, time_ref: Handle<TimeObserver>,
) -> Result<Self, Error> { ) -> Result<Self, Error> {
Ok(Self { Ok(Self {
hooks, hooks,
@ -657,7 +657,7 @@ where
port: u16, port: u16,
configuration: EventConfig, configuration: EventConfig,
hooks: EMH, hooks: EMH,
time_ref: Reference<TimeObserver>, time_ref: Handle<TimeObserver>,
) -> Result<Self, Error> { ) -> Result<Self, Error> {
let llmp = LlmpClient::create_attach_to_tcp(shmem_provider, port)?; let llmp = LlmpClient::create_attach_to_tcp(shmem_provider, port)?;
Self::with_hooks(llmp, configuration, hooks, time_ref) Self::with_hooks(llmp, configuration, hooks, time_ref)
@ -672,7 +672,7 @@ where
env_name: &str, env_name: &str,
configuration: EventConfig, configuration: EventConfig,
hooks: EMH, hooks: EMH,
time_ref: Reference<TimeObserver>, time_ref: Handle<TimeObserver>,
) -> Result<Self, Error> { ) -> Result<Self, Error> {
let llmp = LlmpClient::on_existing_from_env(shmem_provider, env_name)?; let llmp = LlmpClient::on_existing_from_env(shmem_provider, env_name)?;
Self::with_hooks(llmp, configuration, hooks, time_ref) Self::with_hooks(llmp, configuration, hooks, time_ref)
@ -685,7 +685,7 @@ where
description: &LlmpClientDescription, description: &LlmpClientDescription,
configuration: EventConfig, configuration: EventConfig,
hooks: EMH, hooks: EMH,
time_ref: Reference<TimeObserver>, time_ref: Handle<TimeObserver>,
) -> Result<Self, Error> { ) -> Result<Self, Error> {
let llmp = LlmpClient::existing_client_from_description(shmem_provider, description)?; let llmp = LlmpClient::existing_client_from_description(shmem_provider, description)?;
Self::with_hooks(llmp, configuration, hooks, time_ref) Self::with_hooks(llmp, configuration, hooks, time_ref)
@ -1091,7 +1091,7 @@ where
self.llmp_mgr.should_serialize_cnt_mut() self.llmp_mgr.should_serialize_cnt_mut()
} }
fn time_ref(&self) -> &Reference<TimeObserver> { fn time_ref(&self) -> &Handle<TimeObserver> {
&self.llmp_mgr.time_ref &self.llmp_mgr.time_ref
} }
} }
@ -1362,7 +1362,7 @@ where
.broker_port(broker_port) .broker_port(broker_port)
.configuration(configuration) .configuration(configuration)
.hooks(tuple_list!()) .hooks(tuple_list!())
.time_ref(time_obs.reference()) .time_ref(time_obs.handle())
.build() .build()
.launch() .launch()
} }
@ -1412,7 +1412,7 @@ where
/// The hooks passed to event manager: /// The hooks passed to event manager:
hooks: EMH, hooks: EMH,
#[cfg(feature = "adaptive_serialization")] #[cfg(feature = "adaptive_serialization")]
time_ref: Reference<TimeObserver>, time_ref: Handle<TimeObserver>,
#[builder(setter(skip), default = PhantomData)] #[builder(setter(skip), default = PhantomData)]
phantom_data: PhantomData<(EMH, S)>, phantom_data: PhantomData<(EMH, S)>,
} }
@ -2058,7 +2058,7 @@ mod tests {
use core::sync::atomic::{compiler_fence, Ordering}; use core::sync::atomic::{compiler_fence, Ordering};
#[cfg(feature = "adaptive_serialization")] #[cfg(feature = "adaptive_serialization")]
use libafl_bolts::tuples::Referenceable; use libafl_bolts::tuples::Handler;
use libafl_bolts::{ use libafl_bolts::{
llmp::{LlmpClient, LlmpSharedMap}, llmp::{LlmpClient, LlmpSharedMap},
rands::StdRand, rands::StdRand,
@ -2092,7 +2092,7 @@ mod tests {
let time = TimeObserver::new("time"); let time = TimeObserver::new("time");
#[cfg(feature = "adaptive_serialization")] #[cfg(feature = "adaptive_serialization")]
let time_ref = time.reference(); let time_ref = time.handle();
let mut corpus = InMemoryCorpus::<BytesInput>::new(); let mut corpus = InMemoryCorpus::<BytesInput>::new();
let testcase = Testcase::new(vec![0; 4].into()); let testcase = Testcase::new(vec![0; 4].into());

View File

@ -33,7 +33,7 @@ pub use launcher::*;
#[cfg(all(unix, feature = "std"))] #[cfg(all(unix, feature = "std"))]
use libafl_bolts::os::unix_signals::{siginfo_t, ucontext_t, Handler, Signal}; use libafl_bolts::os::unix_signals::{siginfo_t, ucontext_t, Handler, Signal};
#[cfg(feature = "adaptive_serialization")] #[cfg(feature = "adaptive_serialization")]
use libafl_bolts::tuples::{MatchNameRef, Reference}; use libafl_bolts::tuples::{Handle, MatchNameRef};
use libafl_bolts::{current_time, ClientId}; use libafl_bolts::{current_time, ClientId};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[cfg(feature = "std")] #[cfg(feature = "std")]
@ -859,8 +859,8 @@ pub trait AdaptiveSerializer {
/// How many times shoukd have been serialized an observer (mut) /// How many times shoukd have been serialized an observer (mut)
fn should_serialize_cnt_mut(&mut self) -> &mut usize; fn should_serialize_cnt_mut(&mut self) -> &mut usize;
/// A [`Reference`] to the time observer to determine the `time_factor` /// A [`Handle`] to the time observer to determine the `time_factor`
fn time_ref(&self) -> &Reference<TimeObserver>; fn time_ref(&self) -> &Handle<TimeObserver>;
/// Serialize the observer using the `time_factor` and `percentage_threshold`. /// Serialize the observer using the `time_factor` and `percentage_threshold`.
/// These parameters are unique to each of the different types of `EventManager` /// These parameters are unique to each of the different types of `EventManager`

View File

@ -22,7 +22,7 @@ use libafl_bolts::{
fs::{get_unique_std_input_file, InputFile}, fs::{get_unique_std_input_file, InputFile},
os::{dup2, pipes::Pipe}, os::{dup2, pipes::Pipe},
shmem::{ShMem, ShMemProvider, UnixShMemProvider}, shmem::{ShMem, ShMemProvider, UnixShMemProvider},
tuples::{MatchNameRef, Prepend, RefIndexable, Reference, Referenceable}, tuples::{Handle, Handler, MatchNameRef, Prepend, RefIndexable},
AsSlice, AsSliceMut, Truncate, AsSlice, AsSliceMut, Truncate,
}; };
use nix::{ use nix::{
@ -498,7 +498,7 @@ where
phantom: PhantomData<S>, phantom: PhantomData<S>,
map_size: Option<usize>, map_size: Option<usize>,
#[cfg(feature = "regex")] #[cfg(feature = "regex")]
asan_obs: Reference<AsanBacktraceObserver>, asan_obs: Handle<AsanBacktraceObserver>,
timeout: TimeSpec, timeout: TimeSpec,
crash_exitcode: Option<i8>, crash_exitcode: Option<i8>,
} }
@ -587,7 +587,7 @@ pub struct ForkserverExecutorBuilder<'a, SP> {
kill_signal: Option<Signal>, kill_signal: Option<Signal>,
timeout: Option<Duration>, timeout: Option<Duration>,
#[cfg(feature = "regex")] #[cfg(feature = "regex")]
asan_obs: Option<Reference<AsanBacktraceObserver>>, asan_obs: Option<Handle<AsanBacktraceObserver>>,
crash_exitcode: Option<i8>, crash_exitcode: Option<i8>,
} }
@ -640,7 +640,7 @@ impl<'a, SP> ForkserverExecutorBuilder<'a, SP> {
asan_obs: self asan_obs: self
.asan_obs .asan_obs
.clone() .clone()
.unwrap_or(AsanBacktraceObserver::default().reference()), .unwrap_or(AsanBacktraceObserver::default().handle()),
crash_exitcode: self.crash_exitcode, crash_exitcode: self.crash_exitcode,
}) })
} }
@ -702,7 +702,7 @@ impl<'a, SP> ForkserverExecutorBuilder<'a, SP> {
asan_obs: self asan_obs: self
.asan_obs .asan_obs
.clone() .clone()
.unwrap_or(AsanBacktraceObserver::default().reference()), .unwrap_or(AsanBacktraceObserver::default().handle()),
crash_exitcode: self.crash_exitcode, crash_exitcode: self.crash_exitcode,
}) })
} }

View File

@ -7,7 +7,7 @@ use alloc::borrow::Cow;
use core::{fmt::Debug, marker::PhantomData}; use core::{fmt::Debug, marker::PhantomData};
use libafl_bolts::{ use libafl_bolts::{
tuples::{MatchNameRef, Reference, Referenceable}, tuples::{Handle, Handler, MatchNameRef},
Named, Named,
}; };
@ -28,7 +28,7 @@ use crate::{
/// Requires a [`ConcolicObserver`] to observe the concolic trace. /// Requires a [`ConcolicObserver`] to observe the concolic trace.
#[derive(Debug)] #[derive(Debug)]
pub struct ConcolicFeedback<'map, S> { pub struct ConcolicFeedback<'map, S> {
obs_ref: Reference<ConcolicObserver<'map>>, obs_ref: Handle<ConcolicObserver<'map>>,
phantom: PhantomData<S>, phantom: PhantomData<S>,
} }
@ -38,7 +38,7 @@ impl<'map, S> ConcolicFeedback<'map, S> {
#[must_use] #[must_use]
pub fn from_observer(observer: &ConcolicObserver<'map>) -> Self { pub fn from_observer(observer: &ConcolicObserver<'map>) -> Self {
Self { Self {
obs_ref: observer.reference(), obs_ref: observer.handle(),
phantom: PhantomData, phantom: PhantomData,
} }
} }

View File

@ -8,7 +8,7 @@ use core::{
}; };
use libafl_bolts::{ use libafl_bolts::{
tuples::{MatchName, MatchNameRef, Reference, Referenceable}, tuples::{Handle, Handler, MatchName, MatchNameRef},
Named, Named,
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -58,9 +58,9 @@ where
/// This feedback's name /// This feedback's name
name: Cow<'static, str>, name: Cow<'static, str>,
/// The first observer to compare against /// The first observer to compare against
o1_ref: Reference<O1>, o1_ref: Handle<O1>,
/// The second observer to compare against /// The second observer to compare against
o2_ref: Reference<O2>, o2_ref: Handle<O2>,
/// The function used to compare the two observers /// The function used to compare the two observers
compare_fn: F, compare_fn: F,
phantomm: PhantomData<(I, S)>, phantomm: PhantomData<(I, S)>,
@ -74,8 +74,8 @@ where
{ {
/// Create a new [`DiffFeedback`] using two observers and a test function. /// Create a new [`DiffFeedback`] using two observers and a test function.
pub fn new(name: &'static str, o1: &O1, o2: &O2, compare_fn: F) -> Result<Self, Error> { pub fn new(name: &'static str, o1: &O1, o2: &O2, compare_fn: F) -> Result<Self, Error> {
let o1_ref = o1.reference(); let o1_ref = o1.handle();
let o2_ref = o2.reference(); let o2_ref = o2.handle();
if o1_ref.name() == o2_ref.name() { if o1_ref.name() == o2_ref.name() {
Err(Error::illegal_argument(format!( Err(Error::illegal_argument(format!(
"DiffFeedback: observer names must be different (both were {})", "DiffFeedback: observer names must be different (both were {})",

View File

@ -3,7 +3,7 @@ use core::{fmt::Debug, hash::Hash};
use hashbrown::HashSet; use hashbrown::HashSet;
use libafl_bolts::{ use libafl_bolts::{
tuples::{MatchNameRef, Reference, Referenceable}, tuples::{Handle, Handler, MatchNameRef},
Error, HasRefCnt, Named, Error, HasRefCnt, Named,
}; };
use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde::{de::DeserializeOwned, Deserialize, Serialize};
@ -73,7 +73,7 @@ pub struct ListFeedback<T>
where where
T: Hash + Eq, T: Hash + Eq,
{ {
obs_ref: Reference<ListObserver<T>>, obs_ref: Handle<ListObserver<T>>,
novelty: HashSet<T>, novelty: HashSet<T>,
} }
@ -163,7 +163,7 @@ where
#[must_use] #[must_use]
pub fn new(observer: &ListObserver<T>) -> Self { pub fn new(observer: &ListObserver<T>) -> Self {
Self { Self {
obs_ref: observer.reference(), obs_ref: observer.handle(),
novelty: HashSet::<T>::new(), novelty: HashSet::<T>::new(),
} }
} }

View File

@ -12,7 +12,7 @@ use core::{
#[rustversion::nightly] #[rustversion::nightly]
use libafl_bolts::AsSlice; use libafl_bolts::AsSlice;
use libafl_bolts::{ use libafl_bolts::{
tuples::{MatchNameRef, Reference, Referenceable}, tuples::{Handle, Handler, MatchNameRef},
AsIter, HasRefCnt, Named, AsIter, HasRefCnt, Named,
}; };
use num_traits::PrimInt; use num_traits::PrimInt;
@ -388,7 +388,7 @@ pub struct MapFeedback<C, N, O, R, T> {
/// Name identifier of this instance /// Name identifier of this instance
name: Cow<'static, str>, name: Cow<'static, str>,
/// Name identifier of the observer /// Name identifier of the observer
map_ref: Reference<C>, map_ref: Handle<C>,
/// Name of the feedback as shown in the `UserStats` /// Name of the feedback as shown in the `UserStats`
stats_name: Cow<'static, str>, stats_name: Cow<'static, str>,
/// Phantom Data of Reducer /// Phantom Data of Reducer
@ -668,7 +668,7 @@ where
type Observer = C; type Observer = C;
#[inline] #[inline]
fn observer_ref(&self) -> &Reference<C> { fn observer_ref(&self) -> &Handle<C> {
&self.map_ref &self.map_ref
} }
} }
@ -697,7 +697,7 @@ where
Self { Self {
novelties: if C::NOVELTIES { Some(vec![]) } else { None }, novelties: if C::NOVELTIES { Some(vec![]) } else { None },
name: map_observer.name().clone(), name: map_observer.name().clone(),
map_ref: map_observer.reference(), map_ref: map_observer.handle(),
stats_name: create_stats_name(map_observer.name()), stats_name: create_stats_name(map_observer.name()),
phantom: PhantomData, phantom: PhantomData,
} }
@ -711,7 +711,7 @@ where
let name = Cow::from(name); let name = Cow::from(name);
Self { Self {
novelties: if C::NOVELTIES { Some(vec![]) } else { None }, novelties: if C::NOVELTIES { Some(vec![]) } else { None },
map_ref: map_observer.reference(), map_ref: map_observer.handle(),
stats_name: create_stats_name(&name), stats_name: create_stats_name(&name),
name, name,
phantom: PhantomData, phantom: PhantomData,

View File

@ -14,7 +14,7 @@ use core::{
pub use concolic::ConcolicFeedback; pub use concolic::ConcolicFeedback;
pub use differential::DiffFeedback; pub use differential::DiffFeedback;
use libafl_bolts::{ use libafl_bolts::{
tuples::{MatchNameRef, Reference, Referenceable}, tuples::{Handle, Handler, MatchNameRef},
Named, Named,
}; };
pub use list::*; pub use list::*;
@ -143,7 +143,7 @@ pub trait HasObserverReference {
type Observer: ?Sized; type Observer: ?Sized;
/// The name associated with the observer /// The name associated with the observer
fn observer_ref(&self) -> &Reference<Self::Observer>; fn observer_ref(&self) -> &Handle<Self::Observer>;
} }
/// A combined feedback consisting of multiple [`Feedback`]s /// A combined feedback consisting of multiple [`Feedback`]s
@ -934,7 +934,7 @@ pub type TimeoutFeedbackFactory = DefaultFeedbackFactory<TimeoutFeedback>;
/// It decides, if the given [`TimeObserver`] value of a run is interesting. /// It decides, if the given [`TimeObserver`] value of a run is interesting.
#[derive(Serialize, Deserialize, Clone, Debug)] #[derive(Serialize, Deserialize, Clone, Debug)]
pub struct TimeFeedback { pub struct TimeFeedback {
obs_ref: Reference<TimeObserver>, obs_ref: Handle<TimeObserver>,
} }
impl<S> Feedback<S> for TimeFeedback impl<S> Feedback<S> for TimeFeedback
@ -995,7 +995,7 @@ impl TimeFeedback {
#[must_use] #[must_use]
pub fn new(observer: &TimeObserver) -> Self { pub fn new(observer: &TimeObserver) -> Self {
Self { Self {
obs_ref: observer.reference(), obs_ref: observer.handle(),
} }
} }
} }

View File

@ -5,7 +5,7 @@ use std::{fmt::Debug, marker::PhantomData};
use hashbrown::HashSet; use hashbrown::HashSet;
use libafl_bolts::{ use libafl_bolts::{
tuples::{MatchNameRef, Reference, Referenceable}, tuples::{Handle, Handler, MatchNameRef},
Named, Named,
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -82,7 +82,7 @@ impl HashSetState<u64> for NewHashFeedbackMetadata {
#[derive(Serialize, Deserialize, Clone, Debug)] #[derive(Serialize, Deserialize, Clone, Debug)]
pub struct NewHashFeedback<O, S> { pub struct NewHashFeedback<O, S> {
name: Cow<'static, str>, name: Cow<'static, str>,
o_ref: Reference<O>, o_ref: Handle<O>,
/// Initial capacity of hash set /// Initial capacity of hash set
capacity: usize, capacity: usize,
phantom: PhantomData<S>, phantom: PhantomData<S>,
@ -149,7 +149,7 @@ impl<O, S> HasObserverReference for NewHashFeedback<O, S> {
type Observer = O; type Observer = O;
#[inline] #[inline]
fn observer_ref(&self) -> &Reference<O> { fn observer_ref(&self) -> &Handle<O> {
&self.o_ref &self.o_ref
} }
} }
@ -176,7 +176,7 @@ where
pub fn with_capacity(observer: &O, capacity: usize) -> Self { pub fn with_capacity(observer: &O, capacity: usize) -> Self {
Self { Self {
name: Cow::from(NEWHASHFEEDBACK_PREFIX.to_string() + observer.name()), name: Cow::from(NEWHASHFEEDBACK_PREFIX.to_string() + observer.name()),
o_ref: observer.reference(), o_ref: observer.handle(),
capacity, capacity,
phantom: PhantomData, phantom: PhantomData,
} }

View File

@ -4,7 +4,7 @@ use alloc::{borrow::Cow, string::String};
use libafl_bolts::{ use libafl_bolts::{
impl_serdeany, impl_serdeany,
tuples::{MatchNameRef, Reference, Referenceable}, tuples::{Handle, Handler, MatchNameRef},
Named, Named,
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -32,7 +32,7 @@ impl_serdeany!(StdOutMetadata);
/// is never interesting (use with an OR). /// is never interesting (use with an OR).
#[derive(Serialize, Deserialize, Clone, Debug)] #[derive(Serialize, Deserialize, Clone, Debug)]
pub struct StdOutToMetadataFeedback { pub struct StdOutToMetadataFeedback {
o_ref: Reference<StdOutObserver>, o_ref: Handle<StdOutObserver>,
} }
impl<S> Feedback<S> for StdOutToMetadataFeedback impl<S> Feedback<S> for StdOutToMetadataFeedback
@ -104,7 +104,7 @@ impl StdOutToMetadataFeedback {
#[must_use] #[must_use]
pub fn new(observer: &StdOutObserver) -> Self { pub fn new(observer: &StdOutObserver) -> Self {
Self { Self {
o_ref: observer.reference(), o_ref: observer.handle(),
} }
} }
} }
@ -122,7 +122,7 @@ impl_serdeany!(StdErrMetadata);
/// is never interesting (use with an OR). /// is never interesting (use with an OR).
#[derive(Serialize, Deserialize, Clone, Debug)] #[derive(Serialize, Deserialize, Clone, Debug)]
pub struct StdErrToMetadataFeedback { pub struct StdErrToMetadataFeedback {
o_ref: Reference<StdErrObserver>, o_ref: Handle<StdErrObserver>,
} }
impl<S> Feedback<S> for StdErrToMetadataFeedback impl<S> Feedback<S> for StdErrToMetadataFeedback
@ -194,7 +194,7 @@ impl StdErrToMetadataFeedback {
#[must_use] #[must_use]
pub fn new(observer: &StdErrObserver) -> Self { pub fn new(observer: &StdErrObserver) -> Self {
Self { Self {
o_ref: observer.reference(), o_ref: observer.handle(),
} }
} }
} }

View File

@ -390,7 +390,7 @@ where
} }
} }
/// Reference the stored auxiliary data associated with the [`CmpObserverMetadata`] /// Handle the stored auxiliary data associated with the [`CmpObserverMetadata`]
pub fn data(&self) -> &M::Data { pub fn data(&self) -> &M::Data {
&self.data &self.data
} }

View File

@ -29,7 +29,7 @@ pub use weighted::{StdWeightedScheduler, WeightedScheduler};
pub mod tuneable; pub mod tuneable;
use libafl_bolts::{ use libafl_bolts::{
rands::Rand, rands::Rand,
tuples::{MatchNameRef, Reference}, tuples::{Handle, MatchNameRef},
}; };
pub use tuneable::*; pub use tuneable::*;
@ -82,7 +82,7 @@ where
fn set_last_hash(&mut self, value: usize); fn set_last_hash(&mut self, value: usize);
/// Get the observer map observer name /// Get the observer map observer name
fn map_observer_ref(&self) -> &Reference<C>; fn map_observer_ref(&self) -> &Handle<C>;
/// Called when a [`Testcase`] is added to the corpus /// Called when a [`Testcase`] is added to the corpus
fn on_add_metadata(&self, state: &mut Self::State, idx: CorpusId) -> Result<(), Error> { fn on_add_metadata(&self, state: &mut Self::State, idx: CorpusId) -> Result<(), Error> {

View File

@ -4,7 +4,7 @@ use alloc::vec::Vec;
use core::{marker::PhantomData, time::Duration}; use core::{marker::PhantomData, time::Duration};
use libafl_bolts::{ use libafl_bolts::{
tuples::{Reference, Referenceable}, tuples::{Handle, Handler},
Named, Named,
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -173,7 +173,7 @@ pub enum PowerSchedule {
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct PowerQueueScheduler<C, O, S> { pub struct PowerQueueScheduler<C, O, S> {
strat: PowerSchedule, strat: PowerSchedule,
map_observer_ref: Reference<C>, map_observer_ref: Handle<C>,
last_hash: usize, last_hash: usize,
phantom: PhantomData<(O, S)>, phantom: PhantomData<(O, S)>,
} }
@ -226,7 +226,7 @@ where
self.last_hash = hash; self.last_hash = hash;
} }
fn map_observer_ref(&self) -> &Reference<C> { fn map_observer_ref(&self) -> &Handle<C> {
&self.map_observer_ref &self.map_observer_ref
} }
} }
@ -305,7 +305,7 @@ where
} }
PowerQueueScheduler { PowerQueueScheduler {
strat, strat,
map_observer_ref: map_observer.reference(), map_observer_ref: map_observer.handle(),
last_hash: 0, last_hash: 0,
phantom: PhantomData, phantom: PhantomData,
} }

View File

@ -6,7 +6,7 @@ use core::marker::PhantomData;
use hashbrown::HashMap; use hashbrown::HashMap;
use libafl_bolts::{ use libafl_bolts::{
rands::Rand, rands::Rand,
tuples::{Reference, Referenceable}, tuples::{Handle, Handler},
Named, Named,
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -98,7 +98,7 @@ libafl_bolts::impl_serdeany!(WeightedScheduleMetadata);
pub struct WeightedScheduler<C, F, O, S> { pub struct WeightedScheduler<C, F, O, S> {
table_invalidated: bool, table_invalidated: bool,
strat: Option<PowerSchedule>, strat: Option<PowerSchedule>,
map_observer_ref: Reference<C>, map_observer_ref: Handle<C>,
last_hash: usize, last_hash: usize,
phantom: PhantomData<(F, O, S)>, phantom: PhantomData<(F, O, S)>,
} }
@ -124,7 +124,7 @@ where
Self { Self {
strat, strat,
map_observer_ref: map_observer.reference(), map_observer_ref: map_observer.handle(),
last_hash: 0, last_hash: 0,
table_invalidated: true, table_invalidated: true,
phantom: PhantomData, phantom: PhantomData,
@ -274,7 +274,7 @@ where
self.last_hash = hash; self.last_hash = hash;
} }
fn map_observer_ref(&self) -> &Reference<C> { fn map_observer_ref(&self) -> &Handle<C> {
&self.map_observer_ref &self.map_observer_ref
} }
} }

View File

@ -4,7 +4,7 @@ use alloc::{borrow::Cow, vec::Vec};
use core::{fmt::Debug, marker::PhantomData, time::Duration}; use core::{fmt::Debug, marker::PhantomData, time::Duration};
use hashbrown::HashSet; use hashbrown::HashSet;
use libafl_bolts::{current_time, impl_serdeany, tuples::Reference, AsIter, Named}; use libafl_bolts::{current_time, impl_serdeany, tuples::Handle, AsIter, Named};
use num_traits::Bounded; use num_traits::Bounded;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -63,7 +63,7 @@ impl UnstableEntriesMetadata {
/// The calibration stage will measure the average exec time and the target's stability for this input. /// The calibration stage will measure the average exec time and the target's stability for this input.
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct CalibrationStage<C, O, OT, S> { pub struct CalibrationStage<C, O, OT, S> {
map_observer_ref: Reference<C>, map_observer_ref: Handle<C>,
map_name: Cow<'static, str>, map_name: Cow<'static, str>,
stage_max: usize, stage_max: usize,
/// If we should track stability /// If we should track stability

View File

@ -4,7 +4,7 @@ use core::{cmp::Ordering, fmt::Debug, marker::PhantomData, ops::Range};
use libafl_bolts::{ use libafl_bolts::{
rands::Rand, rands::Rand,
tuples::{Reference, Referenceable}, tuples::{Handle, Handler},
Named, Named,
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -55,7 +55,7 @@ impl Ord for Earlier {
/// The mutational stage using power schedules /// The mutational stage using power schedules
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct ColorizationStage<C, E, EM, O, Z> { pub struct ColorizationStage<C, E, EM, O, Z> {
map_observer_ref: Reference<C>, map_observer_ref: Handle<C>,
#[allow(clippy::type_complexity)] #[allow(clippy::type_complexity)]
phantom: PhantomData<(E, EM, O, E, Z)>, phantom: PhantomData<(E, EM, O, E, Z)>,
} }
@ -168,7 +168,7 @@ where
executor: &mut E, executor: &mut E,
state: &mut E::State, state: &mut E::State,
manager: &mut EM, manager: &mut EM,
obs_ref: &Reference<C>, obs_ref: &Handle<C>,
) -> Result<E::Input, Error> { ) -> Result<E::Input, Error> {
let mut input = state.current_input_cloned()?; let mut input = state.current_input_cloned()?;
// The backup of the input // The backup of the input
@ -301,7 +301,7 @@ where
/// Creates a new [`ColorizationStage`] /// Creates a new [`ColorizationStage`]
pub fn new(map_observer: &C) -> Self { pub fn new(map_observer: &C) -> Self {
Self { Self {
map_observer_ref: map_observer.reference(), map_observer_ref: map_observer.handle(),
phantom: PhantomData, phantom: PhantomData,
} }
} }
@ -313,7 +313,7 @@ where
state: &mut E::State, state: &mut E::State,
manager: &mut EM, manager: &mut EM,
input: E::Input, input: E::Input,
obs_ref: &Reference<C>, obs_ref: &Handle<C>,
) -> Result<usize, Error> { ) -> Result<usize, Error> {
executor.observers_mut().pre_exec_all(state, &input)?; executor.observers_mut().pre_exec_all(state, &input)?;

View File

@ -9,7 +9,7 @@ use alloc::{string::ToString, vec::Vec};
use core::marker::PhantomData; use core::marker::PhantomData;
use libafl_bolts::{ use libafl_bolts::{
tuples::{MatchNameRef, Reference}, tuples::{Handle, MatchNameRef},
Named, Named,
}; };
@ -39,7 +39,7 @@ use crate::{
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct ConcolicTracingStage<'a, EM, TE, Z> { pub struct ConcolicTracingStage<'a, EM, TE, Z> {
inner: TracingStage<EM, TE, Z>, inner: TracingStage<EM, TE, Z>,
obs_ref: Reference<ConcolicObserver<'a>>, obs_ref: Handle<ConcolicObserver<'a>>,
} }
impl<EM, TE, Z> UsesState for ConcolicTracingStage<'_, EM, TE, Z> impl<EM, TE, Z> UsesState for ConcolicTracingStage<'_, EM, TE, Z>
@ -95,7 +95,7 @@ where
impl<'a, EM, TE, Z> ConcolicTracingStage<'a, EM, TE, Z> { impl<'a, EM, TE, Z> ConcolicTracingStage<'a, EM, TE, Z> {
/// Creates a new default tracing stage using the given [`Executor`], observing traces from a /// Creates a new default tracing stage using the given [`Executor`], observing traces from a
/// [`ConcolicObserver`] with the given name. /// [`ConcolicObserver`] with the given name.
pub fn new(inner: TracingStage<EM, TE, Z>, obs_ref: Reference<ConcolicObserver<'a>>) -> Self { pub fn new(inner: TracingStage<EM, TE, Z>, obs_ref: Handle<ConcolicObserver<'a>>) -> Self {
Self { inner, obs_ref } Self { inner, obs_ref }
} }
} }

View File

@ -4,7 +4,7 @@ use alloc::{borrow::Cow, vec::Vec};
use core::{fmt::Debug, marker::PhantomData}; use core::{fmt::Debug, marker::PhantomData};
use libafl_bolts::{ use libafl_bolts::{
tuples::{Reference, Referenceable}, tuples::{Handle, Handler},
AsSlice, Named, AsSlice, Named,
}; };
@ -43,7 +43,7 @@ fn find_next_char(list: &[Option<u8>], mut idx: usize, ch: u8) -> usize {
/// A stage that runs a tracer executor /// A stage that runs a tracer executor
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct GeneralizationStage<C, EM, O, OT, Z> { pub struct GeneralizationStage<C, EM, O, OT, Z> {
map_observer_ref: Reference<C>, map_observer_ref: Handle<C>,
#[allow(clippy::type_complexity)] #[allow(clippy::type_complexity)]
phantom: PhantomData<(EM, O, OT, Z)>, phantom: PhantomData<(EM, O, OT, Z)>,
} }
@ -347,7 +347,7 @@ where
pub fn new(map_observer: &C) -> Self { pub fn new(map_observer: &C) -> Self {
require_novelties_tracking!("GeneralizationStage", C); require_novelties_tracking!("GeneralizationStage", C);
Self { Self {
map_observer_ref: map_observer.reference(), map_observer_ref: map_observer.handle(),
phantom: PhantomData, phantom: PhantomData,
} }
} }

View File

@ -5,7 +5,7 @@ use core::{borrow::BorrowMut, fmt::Debug, hash::Hash, marker::PhantomData};
use ahash::RandomState; use ahash::RandomState;
use libafl_bolts::{ use libafl_bolts::{
tuples::{MatchNameRef, Reference, Referenceable}, tuples::{Handle, Handler, MatchNameRef},
HasLen, Named, HasLen, Named,
}; };
@ -353,7 +353,7 @@ where
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct MapEqualityFeedback<C, M, S> { pub struct MapEqualityFeedback<C, M, S> {
name: Cow<'static, str>, name: Cow<'static, str>,
map_ref: Reference<C>, map_ref: Handle<C>,
orig_hash: u64, orig_hash: u64,
phantom: PhantomData<(M, S)>, phantom: PhantomData<(M, S)>,
} }
@ -367,7 +367,7 @@ impl<C, M, S> Named for MapEqualityFeedback<C, M, S> {
impl<C, M, S> HasObserverReference for MapEqualityFeedback<C, M, S> { impl<C, M, S> HasObserverReference for MapEqualityFeedback<C, M, S> {
type Observer = C; type Observer = C;
fn observer_ref(&self) -> &Reference<Self::Observer> { fn observer_ref(&self) -> &Handle<Self::Observer> {
&self.map_ref &self.map_ref
} }
} }
@ -400,19 +400,19 @@ where
/// A feedback factory for ensuring that the maps for minimized inputs are the same /// A feedback factory for ensuring that the maps for minimized inputs are the same
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct MapEqualityFactory<C, M, S> { pub struct MapEqualityFactory<C, M, S> {
map_ref: Reference<C>, map_ref: Handle<C>,
phantom: PhantomData<(C, M, S)>, phantom: PhantomData<(C, M, S)>,
} }
impl<C, M, S> MapEqualityFactory<C, M, S> impl<C, M, S> MapEqualityFactory<C, M, S>
where where
M: MapObserver, M: MapObserver,
C: AsRef<M> + Referenceable, C: AsRef<M> + Handler,
{ {
/// Creates a new map equality feedback for the given observer /// Creates a new map equality feedback for the given observer
pub fn new(obs: &C) -> Self { pub fn new(obs: &C) -> Self {
Self { Self {
map_ref: obs.reference(), map_ref: obs.handle(),
phantom: PhantomData, phantom: PhantomData,
} }
} }
@ -421,7 +421,7 @@ where
impl<C, M, S> HasObserverReference for MapEqualityFactory<C, M, S> { impl<C, M, S> HasObserverReference for MapEqualityFactory<C, M, S> {
type Observer = C; type Observer = C;
fn observer_ref(&self) -> &Reference<C> { fn observer_ref(&self) -> &Handle<C> {
&self.map_ref &self.map_ref
} }
} }
@ -430,7 +430,7 @@ impl<C, M, OT, S> FeedbackFactory<MapEqualityFeedback<C, M, S>, S, OT>
for MapEqualityFactory<C, M, S> for MapEqualityFactory<C, M, S>
where where
M: MapObserver, M: MapObserver,
C: AsRef<M> + Referenceable, C: AsRef<M> + Handler,
OT: ObserversTuple<S>, OT: ObserversTuple<S>,
S: State + Debug, S: State + Debug,
{ {
@ -440,7 +440,7 @@ where
.expect("Should have been provided valid observer name."); .expect("Should have been provided valid observer name.");
MapEqualityFeedback { MapEqualityFeedback {
name: Cow::from("MapEq"), name: Cow::from("MapEq"),
map_ref: obs.reference(), map_ref: obs.handle(),
orig_hash: obs.as_ref().hash_simple(), orig_hash: obs.as_ref().hash_simple(),
phantom: PhantomData, phantom: PhantomData,
} }

View File

@ -318,7 +318,7 @@ pub trait ShMemProvider: Clone + Default + Debug {
} }
} }
/// A Reference Counted shared map, /// A Handle Counted shared map,
/// that can use internal mutability. /// that can use internal mutability.
/// Useful if the `ShMemProvider` needs to keep local state. /// Useful if the `ShMemProvider` needs to keep local state.
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
@ -367,7 +367,7 @@ impl<T: ShMemProvider> Drop for RcShMem<T> {
} }
} }
/// A Reference Counted `ShMemProvider`, /// A Handle Counted `ShMemProvider`,
/// that can use internal mutability. /// that can use internal mutability.
/// Useful if the `ShMemProvider` needs to keep local state. /// Useful if the `ShMemProvider` needs to keep local state.
#[derive(Debug, Clone)] #[derive(Debug, Clone)]

View File

@ -501,13 +501,13 @@ where
} }
} }
/// Structs that has `Reference ` /// Structs that has `Handle `
/// You should use this when you want to avoid specifying types using `match_name_type_mut` /// You should use this when you want to avoid specifying types using `match_name_type_mut`
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
pub trait Referenceable: Named { pub trait Handler: Named {
/// Return the `Reference ` /// Return the `Handle `
fn reference(&self) -> Reference<Self> { fn handle(&self) -> Handle<Self> {
Reference { Handle {
name: Named::name(self).clone(), name: Named::name(self).clone(),
phantom: PhantomData, phantom: PhantomData,
} }
@ -515,23 +515,23 @@ pub trait Referenceable: Named {
} }
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
impl<N> Referenceable for N where N: Named {} impl<N> Handler for N where N: Named {}
/// Object with the type T and the name associated with its concrete value /// Object with the type T and the name associated with its concrete value
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
pub struct Reference<T: ?Sized> { pub struct Handle<T: ?Sized> {
name: Cow<'static, str>, name: Cow<'static, str>,
#[serde(skip)] #[serde(skip)]
phantom: PhantomData<T>, phantom: PhantomData<T>,
} }
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
impl<T: ?Sized> Reference<T> { impl<T: ?Sized> Handle<T> {
/// Fetch the name of the referenced instance. /// Fetch the name of the referenced instance.
/// ///
/// We explicitly do *not* implement [`Named`], as this could potentially lead to confusion /// We explicitly do *not* implement [`Named`], as this could potentially lead to confusion
/// where we make a [`Reference`] of a [`Reference`] as [`Named`] is blanket implemented. /// where we make a [`Handle`] of a [`Handle`] as [`Named`] is blanket implemented.
#[must_use] #[must_use]
pub fn name(&self) -> &Cow<'static, str> { pub fn name(&self) -> &Cow<'static, str> {
&self.name &self.name
@ -539,7 +539,7 @@ impl<T: ?Sized> Reference<T> {
} }
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
impl<T> Clone for Reference<T> { impl<T> Clone for Handle<T> {
fn clone(&self) -> Self { fn clone(&self) -> Self {
Self { Self {
name: self.name.clone(), name: self.name.clone(),
@ -549,23 +549,23 @@ impl<T> Clone for Reference<T> {
} }
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
impl<T> Debug for Reference<T> { impl<T> Debug for Handle<T> {
fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
f.debug_struct("Reference") f.debug_struct("Handle")
.field("name", self.name()) .field("name", self.name())
.field("type", &type_name::<T>()) .field("type", &type_name::<T>())
.finish() .finish()
} }
} }
/// Search using `Reference ` /// Search using `Handle `
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
pub trait MatchNameRef { pub trait MatchNameRef {
/// Search using name and `Reference ` /// Search using name and `Handle `
fn get<T>(&self, rf: &Reference<T>) -> Option<&T>; fn get<T>(&self, rf: &Handle<T>) -> Option<&T>;
/// Search using name and `Reference ` /// Search using name and `Handle `
fn get_mut<T>(&mut self, rf: &Reference<T>) -> Option<&mut T>; fn get_mut<T>(&mut self, rf: &Handle<T>) -> Option<&mut T>;
} }
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
@ -574,11 +574,11 @@ impl<M> MatchNameRef for M
where where
M: MatchName, M: MatchName,
{ {
fn get<T>(&self, rf: &Reference<T>) -> Option<&T> { fn get<T>(&self, rf: &Handle<T>) -> Option<&T> {
self.match_name::<T>(&rf.name) self.match_name::<T>(&rf.name)
} }
fn get_mut<T>(&mut self, rf: &Reference<T>) -> Option<&mut T> { fn get_mut<T>(&mut self, rf: &Handle<T>) -> Option<&mut T> {
self.match_name_mut::<T>(&rf.name) self.match_name_mut::<T>(&rf.name)
} }
} }
@ -623,14 +623,14 @@ where
} }
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
impl<T, RM, M> Index<&Reference<T>> for RefIndexable<RM, M> impl<T, RM, M> Index<&Handle<T>> for RefIndexable<RM, M>
where where
RM: Deref<Target = M>, RM: Deref<Target = M>,
M: MatchName, M: MatchName,
{ {
type Output = T; type Output = T;
fn index(&self, index: &Reference<T>) -> &Self::Output { fn index(&self, index: &Handle<T>) -> &Self::Output {
let Some(e) = self.get(index) else { let Some(e) = self.get(index) else {
panic!("Could not find entry matching {index:?}") panic!("Could not find entry matching {index:?}")
}; };
@ -639,12 +639,12 @@ where
} }
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
impl<T, RM, M> IndexMut<&Reference<T>> for RefIndexable<RM, M> impl<T, RM, M> IndexMut<&Handle<T>> for RefIndexable<RM, M>
where where
RM: DerefMut<Target = M>, RM: DerefMut<Target = M>,
M: MatchName, M: MatchName,
{ {
fn index_mut(&mut self, index: &Reference<T>) -> &mut Self::Output { fn index_mut(&mut self, index: &Handle<T>) -> &mut Self::Output {
let Some(e) = self.get_mut(index) else { let Some(e) = self.get_mut(index) else {
panic!("Could not find entry matching {index:?}") panic!("Could not find entry matching {index:?}")
}; };

View File

@ -24,7 +24,7 @@ use libafl::{
}; };
use libafl_bolts::{ use libafl_bolts::{
ownedref::OwnedPtr, ownedref::OwnedPtr,
tuples::{MatchNameRef, Reference, Referenceable}, tuples::{Handle, Handler, MatchNameRef},
Named, SerdeAny, Named, SerdeAny,
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -646,7 +646,7 @@ impl AsanErrorsObserver {
#[derive(Serialize, Deserialize, Clone, Debug)] #[derive(Serialize, Deserialize, Clone, Debug)]
pub struct AsanErrorsFeedback<S> { pub struct AsanErrorsFeedback<S> {
errors: Option<AsanErrors>, errors: Option<AsanErrors>,
obs_ref: Reference<AsanErrorsObserver>, obs_ref: Handle<AsanErrorsObserver>,
phantom: PhantomData<S>, phantom: PhantomData<S>,
} }
@ -716,7 +716,7 @@ impl<S> AsanErrorsFeedback<S> {
pub fn new(obs: &AsanErrorsObserver) -> Self { pub fn new(obs: &AsanErrorsObserver) -> Self {
Self { Self {
errors: None, errors: None,
obs_ref: obs.reference(), obs_ref: obs.handle(),
phantom: PhantomData, phantom: PhantomData,
} }
} }

View File

@ -2340,6 +2340,7 @@ pub type DeviceReset = ::std::option::Option<unsafe extern "C" fn(dev: *mut Devi
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
pub struct DeviceClass { pub struct DeviceClass {
pub parent_class: ObjectClass, pub parent_class: ObjectClass,
#[doc = " @categories: device categories device belongs to"]
pub categories: [::std::os::raw::c_ulong; 1usize], pub categories: [::std::os::raw::c_ulong; 1usize],
#[doc = " @fw_name: name used to identify device to firmware interfaces"] #[doc = " @fw_name: name used to identify device to firmware interfaces"]
pub fw_name: *const ::std::os::raw::c_char, pub fw_name: *const ::std::os::raw::c_char,

View File

@ -26,7 +26,6 @@ pub const __USE_ATFILE: u32 = 1;
pub const __USE_FORTIFY_LEVEL: u32 = 0; pub const __USE_FORTIFY_LEVEL: u32 = 0;
pub const __GLIBC_USE_DEPRECATED_GETS: u32 = 0; pub const __GLIBC_USE_DEPRECATED_GETS: u32 = 0;
pub const __GLIBC_USE_DEPRECATED_SCANF: u32 = 0; pub const __GLIBC_USE_DEPRECATED_SCANF: u32 = 0;
pub const __GLIBC_USE_C2X_STRTOL: u32 = 0;
pub const _STDC_PREDEF_H: u32 = 1; pub const _STDC_PREDEF_H: u32 = 1;
pub const __STDC_IEC_559__: u32 = 1; pub const __STDC_IEC_559__: u32 = 1;
pub const __STDC_IEC_60559_BFP__: u32 = 201404; pub const __STDC_IEC_60559_BFP__: u32 = 201404;
@ -35,7 +34,7 @@ pub const __STDC_IEC_60559_COMPLEX__: u32 = 201404;
pub const __STDC_ISO_10646__: u32 = 201706; pub const __STDC_ISO_10646__: u32 = 201706;
pub const __GNU_LIBRARY__: u32 = 6; pub const __GNU_LIBRARY__: u32 = 6;
pub const __GLIBC__: u32 = 2; pub const __GLIBC__: u32 = 2;
pub const __GLIBC_MINOR__: u32 = 39; pub const __GLIBC_MINOR__: u32 = 35;
pub const _SYS_CDEFS_H: u32 = 1; pub const _SYS_CDEFS_H: u32 = 1;
pub const __glibc_c99_flexarr_available: u32 = 1; pub const __glibc_c99_flexarr_available: u32 = 1;
pub const __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI: u32 = 0; pub const __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI: u32 = 0;
@ -59,7 +58,6 @@ pub const _BITS_TIME64_H: u32 = 1;
pub const _BITS_WCHAR_H: u32 = 1; pub const _BITS_WCHAR_H: u32 = 1;
pub const _BITS_STDINT_INTN_H: u32 = 1; pub const _BITS_STDINT_INTN_H: u32 = 1;
pub const _BITS_STDINT_UINTN_H: u32 = 1; pub const _BITS_STDINT_UINTN_H: u32 = 1;
pub const _BITS_STDINT_LEAST_H: u32 = 1;
pub const INT8_MIN: i32 = -128; pub const INT8_MIN: i32 = -128;
pub const INT16_MIN: i32 = -32768; pub const INT16_MIN: i32 = -32768;
pub const INT32_MIN: i32 = -2147483648; pub const INT32_MIN: i32 = -2147483648;

View File

@ -6,7 +6,7 @@ use libafl::{
inputs::{Input, UsesInput}, inputs::{Input, UsesInput},
observers::{stacktrace::BacktraceObserver, ObserversTuple}, observers::{stacktrace::BacktraceObserver, ObserversTuple},
}; };
use libafl_bolts::tuples::{MatchFirstType, MatchNameRef, Reference, Referenceable}; use libafl_bolts::tuples::{Handle, Handler, MatchFirstType, MatchNameRef};
use libafl_qemu_sys::GuestAddr; use libafl_qemu_sys::GuestAddr;
use thread_local::ThreadLocal; use thread_local::ThreadLocal;
@ -439,7 +439,7 @@ where
#[derive(Debug)] #[derive(Debug)]
pub struct OnCrashBacktraceCollector<'a> { pub struct OnCrashBacktraceCollector<'a> {
callstack_hash: u64, callstack_hash: u64,
obs_ref: Reference<BacktraceObserver<'a>>, obs_ref: Handle<BacktraceObserver<'a>>,
} }
impl<'a> OnCrashBacktraceCollector<'a> { impl<'a> OnCrashBacktraceCollector<'a> {
@ -447,7 +447,7 @@ impl<'a> OnCrashBacktraceCollector<'a> {
pub fn new(observer: &BacktraceObserver<'a>) -> Self { pub fn new(observer: &BacktraceObserver<'a>) -> Self {
Self { Self {
callstack_hash: 0, callstack_hash: 0,
obs_ref: observer.reference(), obs_ref: observer.handle(),
} }
} }

View File

@ -25,7 +25,7 @@ use libafl_bolts::{
core_affinity::Cores, core_affinity::Cores,
rands::StdRand, rands::StdRand,
shmem::{ShMem, ShMemProvider, UnixShMemProvider}, shmem::{ShMem, ShMemProvider, UnixShMemProvider},
tuples::{tuple_list, Merge, Referenceable}, tuples::{tuple_list, Handler, Merge},
AsSliceMut, AsSliceMut,
}; };
use typed_builder::TypedBuilder; use typed_builder::TypedBuilder;
@ -115,7 +115,7 @@ impl<'a> ForkserverBytesCoverageSugar<'a> {
// Create an observation channel to keep track of the execution time // Create an observation channel to keep track of the execution time
let time_observer = TimeObserver::new("time"); let time_observer = TimeObserver::new("time");
let time_ref = time_observer.reference(); let time_ref = time_observer.handle();
let mut run_client = |state: Option<_>, let mut run_client = |state: Option<_>,
mut mgr: LlmpRestartingEventManager<_, _, _>, mut mgr: LlmpRestartingEventManager<_, _, _>,

View File

@ -29,7 +29,7 @@ use libafl_bolts::{
ownedref::OwnedMutSlice, ownedref::OwnedMutSlice,
rands::StdRand, rands::StdRand,
shmem::{ShMemProvider, StdShMemProvider}, shmem::{ShMemProvider, StdShMemProvider},
tuples::{tuple_list, Merge, Referenceable}, tuples::{tuple_list, Handler, Merge},
AsSlice, AsSlice,
}; };
use libafl_targets::{edges_map_mut_ptr, CmpLogObserver}; use libafl_targets::{edges_map_mut_ptr, CmpLogObserver};
@ -143,7 +143,7 @@ where
// Create an observation channel to keep track of the execution time // Create an observation channel to keep track of the execution time
let time_observer = TimeObserver::new("time"); let time_observer = TimeObserver::new("time");
let time_ref = time_observer.reference(); let time_ref = time_observer.handle();
let mut run_client = |state: Option<_>, let mut run_client = |state: Option<_>,
mut mgr: LlmpRestartingEventManager<_, _, _>, mut mgr: LlmpRestartingEventManager<_, _, _>,

View File

@ -32,7 +32,7 @@ use libafl_bolts::{
ownedref::OwnedMutSlice, ownedref::OwnedMutSlice,
rands::StdRand, rands::StdRand,
shmem::{ShMemProvider, StdShMemProvider}, shmem::{ShMemProvider, StdShMemProvider},
tuples::{tuple_list, Merge, Referenceable}, tuples::{tuple_list, Handler, Merge},
AsSlice, AsSlice,
}; };
pub use libafl_qemu::emu::Qemu; pub use libafl_qemu::emu::Qemu;
@ -148,7 +148,7 @@ where
// Create an observation channel to keep track of the execution time // Create an observation channel to keep track of the execution time
let time_observer = TimeObserver::new("time"); let time_observer = TimeObserver::new("time");
let time_ref = time_observer.reference(); let time_ref = time_observer.handle();
let mut run_client = |state: Option<_>, let mut run_client = |state: Option<_>,
mut mgr: LlmpRestartingEventManager<_, _, _>, mut mgr: LlmpRestartingEventManager<_, _, _>,

View File

@ -283,7 +283,7 @@ impl Debug for AFLppCmpLogVals {
impl AFLppCmpLogVals { impl AFLppCmpLogVals {
#[must_use] #[must_use]
/// Reference comparison values as comparison operands /// Handle comparison values as comparison operands
pub fn operands(&self) -> &[[AFLppCmpLogOperands; CMPLOG_MAP_H]; CMPLOG_MAP_W] { pub fn operands(&self) -> &[[AFLppCmpLogOperands; CMPLOG_MAP_H]; CMPLOG_MAP_W] {
unsafe { &self.operands } unsafe { &self.operands }
} }
@ -295,7 +295,7 @@ impl AFLppCmpLogVals {
} }
#[must_use] #[must_use]
/// Reference comparison values as comparison function operands /// Handle comparison values as comparison function operands
pub fn fn_operands( pub fn fn_operands(
&self, &self,
) -> &[[AFLppCmpLogFnOperands; CMPLOG_MAP_RTN_EXTENDED_H]; CMPLOG_MAP_W] { ) -> &[[AFLppCmpLogFnOperands; CMPLOG_MAP_RTN_EXTENDED_H]; CMPLOG_MAP_W] {
@ -450,7 +450,7 @@ impl AFLppCmpLogMap {
} }
#[must_use] #[must_use]
/// Reference the headers for the map /// Handle the headers for the map
pub fn headers(&self) -> &[AFLppCmpLogHeader] { pub fn headers(&self) -> &[AFLppCmpLogHeader] {
&self.headers &self.headers
} }
@ -462,7 +462,7 @@ impl AFLppCmpLogMap {
} }
#[must_use] #[must_use]
/// Reference the values for the map /// Handle the values for the map
pub fn values(&self) -> &AFLppCmpLogVals { pub fn values(&self) -> &AFLppCmpLogVals {
&self.vals &self.vals
} }

View File

@ -12,7 +12,7 @@ use libafl::{
Error, HasMetadata, HasNamedMetadata, Error, HasMetadata, HasNamedMetadata,
}; };
use libafl_bolts::{ use libafl_bolts::{
tuples::{MatchNameRef, Reference}, tuples::{Handle, MatchNameRef},
Named, Named,
}; };
@ -25,7 +25,7 @@ where
TE: UsesState, TE: UsesState,
{ {
tracer_executor: TE, tracer_executor: TE,
cmplog_observer_ref: Option<Reference<AFLppCmpLogObserver<'a, TE::State>>>, cmplog_observer_ref: Option<Handle<AFLppCmpLogObserver<'a, TE::State>>>,
#[allow(clippy::type_complexity)] #[allow(clippy::type_complexity)]
phantom: PhantomData<(EM, TE, Z)>, phantom: PhantomData<(EM, TE, Z)>,
} }
@ -151,7 +151,7 @@ where
/// With cmplog observer /// With cmplog observer
pub fn with_cmplog_observer( pub fn with_cmplog_observer(
tracer_executor: TE, tracer_executor: TE,
obs_ref: Reference<AFLppCmpLogObserver<'a, TE::State>>, obs_ref: Handle<AFLppCmpLogObserver<'a, TE::State>>,
) -> Self { ) -> Self {
Self { Self {
cmplog_observer_ref: Some(obs_ref), cmplog_observer_ref: Some(obs_ref),