align code with 'main' branch

This commit is contained in:
Omree 2021-05-26 18:12:59 +03:00
parent b59752eba5
commit 5bd08a6eee
22 changed files with 64 additions and 114 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "baby_fuzzer"
version = "0.3.1"
version = "0.3.2"
authors = ["Andrea Fioraldi <andreafioraldi@gmail.com>", "Dominik Maier <domenukk@gmail.com>"]
edition = "2018"

View File

@ -1,6 +1,6 @@
[package]
name = "frida_libpng"
version = "0.3.1"
version = "0.3.2"
authors = ["Andrea Fioraldi <andreafioraldi@gmail.com>", "Dominik Maier <domenukk@gmail.com>"]
edition = "2018"
build = "build.rs"
@ -21,11 +21,11 @@ num_cpus = "1.0"
which = "4.1"
[target.'cfg(unix)'.dependencies]
libafl = { path = "../../libafl/", features = [ "std", "llmp_bind_public" ] } #, "llmp_small_maps", "llmp_debug"]}
libafl_frida = { path = "../../libafl_frida" }
libafl = { path = "../../libafl/", features = [ "std", "llmp_compression", "llmp_bind_public" ] } #, "llmp_small_maps", "llmp_debug"]}
capstone = "0.8.0"
frida-gum = { version = "0.5.1", features = [ "auto-download", "backtrace", "event-sink", "invocation-listener"] }
libafl_targets = { path = "../../libafl_targets", version = "0.1.0" , features = ["value_profile"] }
libafl_frida = { path = "../../libafl_frida", version = "0.3.2" }
libafl_targets = { path = "../../libafl_targets", version = "0.3.2" , features = ["sancov_cmplog"] }
lazy_static = "1.4.0"
libc = "0.2"
libloading = "0.7.0"

View File

@ -1,6 +1,6 @@
[package]
name = "libfuzzer_libmozjpeg"
version = "0.3.1"
version = "0.3.2"
authors = ["Andrea Fioraldi <andreafioraldi@gmail.com>", "Dominik Maier <domenukk@gmail.com>"]
edition = "2018"

View File

@ -15,6 +15,7 @@ use libafl::{
feedback_or,
feedbacks::{CrashFeedback, MapFeedbackState, MaxMapFeedback},
fuzzer::{Fuzzer, StdFuzzer},
inputs::{BytesInput, HasTargetBytes},
mutators::scheduled::{havoc_mutations, tokens_mutations, StdScheduledMutator},
mutators::token_mutations::Tokens,
observers::StdMapObserver,

View File

@ -1,6 +1,6 @@
[package]
name = "libfuzzer_libpng"
version = "0.3.1"
version = "0.3.2"
authors = ["Andrea Fioraldi <andreafioraldi@gmail.com>", "Dominik Maier <domenukk@gmail.com>"]
edition = "2018"

View File

@ -16,6 +16,7 @@ use libafl::{
feedback_or,
feedbacks::{CrashFeedback, MapFeedbackState, MaxMapFeedback, TimeFeedback, TimeoutFeedback},
fuzzer::{Fuzzer, StdFuzzer},
inputs::{BytesInput, HasTargetBytes},
mutators::scheduled::{havoc_mutations, tokens_mutations, StdScheduledMutator},
mutators::token_mutations::Tokens,
observers::{HitcountsMapObserver, StdMapObserver, TimeObserver},

View File

@ -1,6 +1,6 @@
[package]
name = "libfuzzer_libpng_launcher"
version = "0.3.1"
version = "0.3.2"
authors = ["Andrea Fioraldi <andreafioraldi@gmail.com>", "Dominik Maier <domenukk@gmail.com>"]
edition = "2018"

View File

@ -24,6 +24,7 @@ use libafl::{
feedback_or,
feedbacks::{CrashFeedback, MapFeedbackState, MaxMapFeedback, TimeFeedback, TimeoutFeedback},
fuzzer::{Fuzzer, StdFuzzer},
inputs::{BytesInput, HasTargetBytes},
mutators::scheduled::{havoc_mutations, tokens_mutations, StdScheduledMutator},
mutators::token_mutations::Tokens,
observers::{HitcountsMapObserver, StdMapObserver, TimeObserver},

View File

@ -1,6 +1,6 @@
[package]
name = "libfuzzer_reachability"
version = "0.3.1"
version = "0.3.2"
authors = ["Andrea Fioraldi <andreafioraldi@gmail.com>", "Dominik Maier <domenukk@gmail.com>"]
edition = "2018"

View File

@ -1,6 +1,6 @@
[package]
name = "libfuzzer_stb_image"
version = "0.3.1"
version = "0.3.2"
authors = ["Andrea Fioraldi <andreafioraldi@gmail.com>", "Dominik Maier <domenukk@gmail.com>"]
edition = "2018"
build = "build.rs"

View File

@ -20,7 +20,7 @@ use libafl::{
observers::{StdMapObserver, TimeObserver},
stages::{StdMutationalStage, TracingStage},
state::{HasCorpus, StdState},
stats::SimpleStats,
stats::MultiStats,
Error,
};

View File

@ -1,6 +1,6 @@
[package]
name = "libafl"
version = "0.3.1"
version = "0.3.2"
authors = ["Andrea Fioraldi <andreafioraldi@gmail.com>", "Dominik Maier <domenukk@gmail.com>"]
description = "Slot your own fuzzers together and extend their features using Rust"
documentation = "https://docs.rs/libafl"
@ -52,7 +52,7 @@ path = "./examples/llmp_test/main.rs"
required-features = ["std"]
[dependencies]
libafl_derive = { optional = true, path = "../libafl_derive", version = "0.3.1" }
libafl_derive = { optional = true, path = "../libafl_derive", version = "0.3.2" }
tuple_list = "0.1.2"
hashbrown = { version = "0.9", features = ["serde", "ahash-compile-time-rng"] } # A faster hashmap, nostd compatible
num = "0.4.0"

View File

@ -170,7 +170,7 @@ where
let client = stats.client_stats_mut_for(sender_id);
client.update_corpus_size(*corpus_size as u64);
client.update_executions(*executions as u64, *time);
stats.display(event.name().to_string() + " #" + &sender_id.to_string());
stats.display(event.name().to_string(), sender_id);
Ok(BrokerEventResult::Forward)
}
Event::UpdateStats {
@ -181,7 +181,17 @@ where
// TODO: The stats buffer should be added on client add.
let client = stats.client_stats_mut_for(sender_id);
client.update_executions(*executions as u64, *time);
stats.display(event.name().to_string() + " #" + &sender_id.to_string());
stats.display(event.name().to_string(), sender_id);
Ok(BrokerEventResult::Handled)
}
Event::UpdateUserStats {
name,
value,
phantom: _,
} => {
let client = stats.client_stats_mut_for(sender_id);
client.update_user_stats(name.clone(), value.clone());
stats.display(event.name().to_string(), sender_id);
Ok(BrokerEventResult::Handled)
}
#[cfg(feature = "introspection")]

View File

@ -1,42 +1,22 @@
//! A `CombinedExecutor` wraps a primary executor and a secondary one
use core::marker::PhantomData;
use crate::{
executors::{
Executor, ExitKind, HasExecHooks, HasExecHooksTuple, HasObservers, HasObserversHooks,
},
executors::{Executor, ExitKind, HasExecHooksTuple, HasObservers, HasObserversHooks},
inputs::Input,
observers::ObserversTuple,
Error,
};
/// A [`CombinedExecutor`] wraps a primary executor, forwarding its methods, and a secondary one
pub struct CombinedExecutor<A, B, I>
where
A: Executor<I>,
B: Executor<I>,
I: Input,
{
pub struct CombinedExecutor<A, B> {
primary: A,
secondary: B,
phantom: PhantomData<I>,
}
impl<A, B, I> CombinedExecutor<A, B, I>
where
A: Executor<I>,
B: Executor<I>,
I: Input,
{
impl<A, B> CombinedExecutor<A, B> {
/// Create a new `CombinedExecutor`, wrapping the given `executor`s.
pub fn new(primary: A, secondary: B) -> Self {
Self {
primary,
secondary,
phantom: PhantomData,
}
pub fn new<EM, I, S, Z>(primary: A, secondary: B) -> Self {
Self { primary, secondary }
}
/// Retrieve the primary `Executor` that is wrapped by this `CombinedExecutor`.
@ -50,22 +30,26 @@ where
}
}
impl<A, B, I> Executor<I> for CombinedExecutor<A, B, I>
impl<A, B, EM, I, S, Z> Executor<EM, I, S, Z> for CombinedExecutor<A, B>
where
A: Executor<I>,
B: Executor<I>,
A: Executor<EM, I, S, Z>,
B: Executor<EM, I, S, Z>,
I: Input,
{
fn run_target(&mut self, input: &I) -> Result<ExitKind, Error> {
self.primary.run_target(input)
fn run_target(
&mut self,
fuzzer: &mut Z,
state: &mut S,
mgr: &mut EM,
input: &I,
) -> Result<ExitKind, Error> {
self.primary.run_target(fuzzer, state, mgr, input)
}
}
impl<A, B, I, OT> HasObservers<OT> for CombinedExecutor<A, B, I>
impl<A, B, OT> HasObservers<OT> for CombinedExecutor<A, B>
where
A: Executor<I> + HasObservers<OT>,
B: Executor<I>,
I: Input,
A: HasObservers<OT>,
OT: ObserversTuple,
{
#[inline]
@ -79,40 +63,10 @@ where
}
}
impl<A, B, EM, I, OT, S, Z> HasObserversHooks<EM, I, OT, S, Z> for CombinedExecutor<A, B, I>
impl<A, B, EM, I, OT, S, Z> HasObserversHooks<EM, I, OT, S, Z> for CombinedExecutor<A, B>
where
A: Executor<I> + HasObservers<OT>,
B: Executor<I>,
A: HasObservers<OT>,
I: Input,
OT: ObserversTuple + HasExecHooksTuple<EM, I, S, Z>,
{
}
impl<A, B, EM, I, S, Z> HasExecHooks<EM, I, S, Z> for CombinedExecutor<A, B, I>
where
A: Executor<I> + HasExecHooks<EM, I, S, Z>,
B: Executor<I>,
I: Input,
{
#[inline]
fn pre_exec(
&mut self,
fuzzer: &mut Z,
state: &mut S,
mgr: &mut EM,
input: &I,
) -> Result<(), Error> {
self.primary.pre_exec(fuzzer, state, mgr, input)
}
#[inline]
fn post_exec(
&mut self,
fuzzer: &mut Z,
state: &mut S,
mgr: &mut EM,
input: &I,
) -> Result<(), Error> {
self.primary.post_exec(fuzzer, state, mgr, input)
}
}

View File

@ -4,8 +4,6 @@ pub mod inprocess;
pub use inprocess::InProcessExecutor;
pub mod timeout;
pub use timeout::TimeoutExecutor;
pub mod combined;
pub use combined::CombinedExecutor;
#[cfg(all(feature = "std", unix))]
pub mod forkserver;

View File

@ -2,7 +2,7 @@ use core::{marker::PhantomData, mem::drop};
use crate::{
corpus::Corpus,
executors::{Executor, HasExecHooks, HasExecHooksTuple, HasObservers, HasObserversHooks},
executors::{Executor, HasExecHooksTuple, HasObservers, HasObserversHooks},
inputs::Input,
mark_feature_time,
observers::ObserversTuple,
@ -21,10 +21,7 @@ pub struct TracingStage<C, EM, I, OT, S, TE, Z>
where
I: Input,
C: Corpus<I>,
TE: Executor<I>
+ HasObservers<OT>
+ HasExecHooks<EM, I, S, Z>
+ HasObserversHooks<EM, I, OT, S, Z>,
TE: Executor<EM, I, S, Z> + HasObservers<OT> + HasObserversHooks<EM, I, OT, S, Z>,
OT: ObserversTuple + HasExecHooksTuple<EM, I, S, Z>,
S: HasClientPerfStats + HasExecutions + HasCorpus<C, I>,
{
@ -37,10 +34,7 @@ impl<E, C, EM, I, OT, S, TE, Z> Stage<E, EM, S, Z> for TracingStage<C, EM, I, OT
where
I: Input,
C: Corpus<I>,
TE: Executor<I>
+ HasObservers<OT>
+ HasExecHooks<EM, I, S, Z>
+ HasObserversHooks<EM, I, OT, S, Z>,
TE: Executor<EM, I, S, Z> + HasObservers<OT> + HasObserversHooks<EM, I, OT, S, Z>,
OT: ObserversTuple + HasExecHooksTuple<EM, I, S, Z>,
S: HasClientPerfStats + HasExecutions + HasCorpus<C, I>,
{
@ -68,19 +62,12 @@ where
mark_feature_time!(state, PerfFeature::PreExecObservers);
start_timer!(state);
drop(
self.tracer_executor
.pre_exec(fuzzer, state, manager, &input)?;
mark_feature_time!(state, PerfFeature::PreExec);
start_timer!(state);
let _ = self.tracer_executor.run_target(&input)?;
.run_target(fuzzer, state, manager, &input)?,
);
mark_feature_time!(state, PerfFeature::TargetExecution);
start_timer!(state);
self.tracer_executor
.post_exec(fuzzer, state, manager, &input)?;
mark_feature_time!(state, PerfFeature::PostExec);
*state.executions_mut() += 1;
start_timer!(state);
@ -96,10 +83,7 @@ impl<C, EM, I, OT, S, TE, Z> TracingStage<C, EM, I, OT, S, TE, Z>
where
I: Input,
C: Corpus<I>,
TE: Executor<I>
+ HasObservers<OT>
+ HasExecHooks<EM, I, S, Z>
+ HasObserversHooks<EM, I, OT, S, Z>,
TE: Executor<EM, I, S, Z> + HasObservers<OT> + HasObserversHooks<EM, I, OT, S, Z>,
OT: ObserversTuple + HasExecHooksTuple<EM, I, S, Z>,
S: HasClientPerfStats + HasExecutions + HasCorpus<C, I>,
{

View File

@ -1,6 +1,6 @@
[package]
name = "libafl_cc"
version = "0.3.1"
version = "0.3.2"
authors = ["Andrea Fioraldi <andreafioraldi@gmail.com>"]
description = "Commodity library to wrap compilers and link LibAFL"
documentation = "https://docs.rs/libafl_cc"

View File

@ -1,6 +1,6 @@
[package]
name = "libafl_derive"
version = "0.3.1"
version = "0.3.2"
authors = ["Andrea Fioraldi <andreafioraldi@gmail.com>"]
description = "Derive proc-macro crate for LibAFL"
documentation = "https://docs.rs/libafl_derive"

View File

@ -1,6 +1,6 @@
[package]
name = "libafl_frida"
version = "0.3.1"
version = "0.3.2"
authors = ["s1341 <github@shmarya.net>"]
description = "Frida backend library for LibAFL"
documentation = "https://docs.rs/libafl_frida"
@ -15,7 +15,7 @@ cc = { version = "1.0", features = ["parallel"] }
[dependencies]
libafl = { path = "../libafl", version = "0.3.1", features = ["std", "libafl_derive"] }
libafl_targets = { path = "../libafl_targets", version = "0.3.1", features = ["cmplog"] }
libafl_targets = { path = "../libafl_targets", version = "0.3.2", features = ["sancov_cmplog"] }
nix = "0.20.0"
libc = "0.2.92"
hashbrown = "0.11"

View File

@ -83,7 +83,7 @@ pub struct FridaInstrumentationHelper<'a> {
transformer: Option<Transformer<'a>>,
#[cfg(target_arch = "aarch64")]
capstone: Capstone,
asan_runtime: Rc<RefCell<AsanRuntime>>,
asan_runtime: AsanRuntime,
cmplog_runtime: CmpLogRuntime,
ranges: RangeMap<usize, (u16, &'a str)>,
options: &'a FridaOptions,

View File

@ -1,6 +1,6 @@
[package]
name = "libafl_targets"
version = "0.3.1"
version = "0.3.2"
authors = ["Andrea Fioraldi <andreafioraldi@gmail.com>"]
description = "Common code for target instrumentation that can be used combined with LibAFL"
documentation = "https://docs.rs/libafl_targets"
@ -25,6 +25,6 @@ cc = { version = "1.0", features = ["parallel"] }
[dependencies]
rangemap = "0.1.10"
libafl = { path = "../libafl", version = "0.3", features = [] }
libafl = { path = "../libafl", version = "0.3.2", features = [] }
serde = { version = "1.0", default-features = false, features = ["alloc"] } # serialization lib
serde-big-array = "0.3.2"

View File

@ -11,6 +11,7 @@ do
echo "[+] Checking fmt and building $fuzzer"
cd $fuzzer \
&& cargo fmt --all -- --check \
&& cargo clippy \
&& cargo build \
&& cd .. \
|| exit 1