fmt
This commit is contained in:
commit
4a33419746
@ -55,6 +55,8 @@ use core::{
|
|||||||
sync::atomic::{compiler_fence, Ordering},
|
sync::atomic::{compiler_fence, Ordering},
|
||||||
time::Duration,
|
time::Duration,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(feature = "std")]
|
||||||
use std::{
|
use std::{
|
||||||
io::{Read, Write},
|
io::{Read, Write},
|
||||||
net::{TcpListener, TcpStream},
|
net::{TcpListener, TcpStream},
|
||||||
@ -64,6 +66,7 @@ use std::{
|
|||||||
use crate::utils::next_pow2;
|
use crate::utils::next_pow2;
|
||||||
use crate::AflError;
|
use crate::AflError;
|
||||||
|
|
||||||
|
#[cfg(feature = "std")]
|
||||||
use super::shmem_translated::AflShmem;
|
use super::shmem_translated::AflShmem;
|
||||||
|
|
||||||
/// We'll start off with 256 megabyte maps per fuzzer client
|
/// We'll start off with 256 megabyte maps per fuzzer client
|
||||||
|
@ -1,31 +1,29 @@
|
|||||||
|
// TODO: llmp can be no_std, if we abstract away page creation
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
pub mod llmp;
|
pub mod llmp;
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
pub mod shmem_translated;
|
pub mod shmem_translated;
|
||||||
|
|
||||||
use alloc::string::String;
|
use alloc::string::{String, ToString};
|
||||||
|
use alloc::vec::Vec;
|
||||||
|
use core::time::Duration;
|
||||||
use core::{marker::PhantomData, time};
|
use core::{marker::PhantomData, time};
|
||||||
|
#[cfg(feature = "std")]
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
//#[cfg(feature = "std")]
|
|
||||||
//pub mod shmem_translated;
|
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
use std::time::Duration;
|
use self::llmp::Tag;
|
||||||
|
|
||||||
use crate::corpus::Corpus;
|
use crate::corpus::Corpus;
|
||||||
use crate::executors::Executor;
|
use crate::executors::Executor;
|
||||||
use crate::feedbacks::FeedbacksTuple;
|
use crate::feedbacks::FeedbacksTuple;
|
||||||
use crate::inputs::Input;
|
use crate::inputs::Input;
|
||||||
use crate::observers::ObserversTuple;
|
use crate::observers::ObserversTuple;
|
||||||
|
#[cfg(feature = "std")]
|
||||||
use crate::serde_anymap::Ptr;
|
use crate::serde_anymap::Ptr;
|
||||||
use crate::utils::Rand;
|
use crate::utils::Rand;
|
||||||
use crate::AflError;
|
use crate::AflError;
|
||||||
use crate::{engines::State, utils};
|
use crate::{engines::State, utils};
|
||||||
|
|
||||||
use self::llmp::Tag;
|
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
/// Indicate if an event worked or not
|
/// Indicate if an event worked or not
|
||||||
pub enum BrokerEventResult {
|
pub enum BrokerEventResult {
|
||||||
@ -377,6 +375,8 @@ where
|
|||||||
message,
|
message,
|
||||||
phantom: _,
|
phantom: _,
|
||||||
} => {
|
} => {
|
||||||
|
let (_, _) = (message, severity_level);
|
||||||
|
#[cfg(feature = "std")]
|
||||||
println!("[LOG {}]: {}", severity_level, message);
|
println!("[LOG {}]: {}", severity_level, message);
|
||||||
Ok(BrokerEventResult::Handled)
|
Ok(BrokerEventResult::Handled)
|
||||||
} //_ => Ok(BrokerEventResult::Forward),
|
} //_ => Ok(BrokerEventResult::Forward),
|
||||||
@ -725,6 +725,7 @@ where
|
|||||||
phantom: PhantomData<(C, E, OT, FT, I, R)>,
|
phantom: PhantomData<(C, E, OT, FT, I, R)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "std")]
|
||||||
impl<C, E, OT, FT, I, R, ST> LlmpEventManager<C, E, OT, FT, I, R, ST>
|
impl<C, E, OT, FT, I, R, ST> LlmpEventManager<C, E, OT, FT, I, R, ST>
|
||||||
where
|
where
|
||||||
C: Corpus<I, R>,
|
C: Corpus<I, R>,
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
use alloc::string::{String, ToString};
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
use core::marker::PhantomData;
|
use core::marker::PhantomData;
|
||||||
use num::Integer;
|
use num::Integer;
|
||||||
@ -254,7 +255,7 @@ where
|
|||||||
pub fn with_history_map(name: &'static str, history_map: Vec<T>) -> Self {
|
pub fn with_history_map(name: &'static str, history_map: Vec<T>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
history_map: history_map,
|
history_map: history_map,
|
||||||
name: name.into(),
|
name: name.to_string(),
|
||||||
phantom: PhantomData,
|
phantom: PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
extern crate num;
|
extern crate num;
|
||||||
|
|
||||||
|
use alloc::string::{String, ToString};
|
||||||
|
use alloc::vec::Vec;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::serde_anymap::{Cptr, ArrayMut};
|
use crate::serde_anymap::{ArrayMut, Cptr};
|
||||||
use crate::tuples::{MatchNameAndType, MatchType, Named, TupleList};
|
use crate::tuples::{MatchNameAndType, MatchType, Named, TupleList};
|
||||||
use crate::AflError;
|
use crate::AflError;
|
||||||
|
|
||||||
@ -192,7 +194,7 @@ where
|
|||||||
let initial = if map.len() > 0 { map[0] } else { T::default() };
|
let initial = if map.len() > 0 { map[0] } else { T::default() };
|
||||||
Self {
|
Self {
|
||||||
map: ArrayMut::Cptr((map.as_mut_ptr(), map.len())),
|
map: ArrayMut::Cptr((map.as_mut_ptr(), map.len())),
|
||||||
name: name.into(),
|
name: name.to_string(),
|
||||||
initial,
|
initial,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -203,7 +205,7 @@ where
|
|||||||
let initial = if len > 0 { *map_ptr } else { T::default() };
|
let initial = if len > 0 { *map_ptr } else { T::default() };
|
||||||
StdMapObserver {
|
StdMapObserver {
|
||||||
map: ArrayMut::Cptr((map_ptr, len)),
|
map: ArrayMut::Cptr((map_ptr, len)),
|
||||||
name: name.into(),
|
name: name.to_string(),
|
||||||
initial,
|
initial,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -293,7 +295,12 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a new MapObserver from a raw pointer
|
/// Creates a new MapObserver from a raw pointer
|
||||||
pub fn new_from_ptr(name: &'static str, map_ptr: *mut T, max_len: usize, size_ptr: *const usize) -> Self {
|
pub fn new_from_ptr(
|
||||||
|
name: &'static str,
|
||||||
|
map_ptr: *mut T,
|
||||||
|
max_len: usize,
|
||||||
|
size_ptr: *const usize,
|
||||||
|
) -> Self {
|
||||||
unsafe {
|
unsafe {
|
||||||
let initial = if max_len > 0 { *map_ptr } else { T::default() };
|
let initial = if max_len > 0 { *map_ptr } else { T::default() };
|
||||||
VariableMapObserver {
|
VariableMapObserver {
|
||||||
|
@ -84,8 +84,10 @@ pub fn current_time() -> time::Duration {
|
|||||||
/// Current time (fixed fallback for no_std)
|
/// Current time (fixed fallback for no_std)
|
||||||
#[cfg(not(feature = "std"))]
|
#[cfg(not(feature = "std"))]
|
||||||
#[inline]
|
#[inline]
|
||||||
fn current_time() -> time::Duration {
|
pub fn current_time() -> time::Duration {
|
||||||
self.start_time()
|
// We may not have a rt clock available.
|
||||||
|
// TODO: Make it somehow plugin-able
|
||||||
|
time::Duration::from_millis(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
|
@ -7,7 +7,7 @@ use afl::engines::Engine;
|
|||||||
use afl::engines::Fuzzer;
|
use afl::engines::Fuzzer;
|
||||||
use afl::engines::State;
|
use afl::engines::State;
|
||||||
use afl::engines::StdFuzzer;
|
use afl::engines::StdFuzzer;
|
||||||
use afl::events::{SimpleStats, LlmpEventManager};
|
use afl::events::{LlmpEventManager, SimpleStats};
|
||||||
use afl::executors::inmemory::InMemoryExecutor;
|
use afl::executors::inmemory::InMemoryExecutor;
|
||||||
use afl::executors::{Executor, ExitKind};
|
use afl::executors::{Executor, ExitKind};
|
||||||
use afl::feedbacks::MaxMapFeedback;
|
use afl::feedbacks::MaxMapFeedback;
|
||||||
|
@ -7,7 +7,7 @@ use afl::engines::Engine;
|
|||||||
use afl::engines::Fuzzer;
|
use afl::engines::Fuzzer;
|
||||||
use afl::engines::State;
|
use afl::engines::State;
|
||||||
use afl::engines::StdFuzzer;
|
use afl::engines::StdFuzzer;
|
||||||
use afl::events::{SimpleStats, LlmpEventManager};
|
use afl::events::{LlmpEventManager, SimpleStats};
|
||||||
use afl::executors::inmemory::InMemoryExecutor;
|
use afl::executors::inmemory::InMemoryExecutor;
|
||||||
use afl::executors::{Executor, ExitKind};
|
use afl::executors::{Executor, ExitKind};
|
||||||
use afl::feedbacks::MaxMapFeedback;
|
use afl::feedbacks::MaxMapFeedback;
|
||||||
@ -66,7 +66,10 @@ pub extern "C" fn fuzz_main_loop() {
|
|||||||
}
|
}
|
||||||
println!("We're a client, let's fuzz :)");
|
println!("We're a client, let's fuzz :)");
|
||||||
|
|
||||||
let edges_observer = VariableMapObserver::new(&NAME_COV_MAP, unsafe { &mut fuzz_hitcounts_map }, unsafe { &fuzz_edges_id });
|
let edges_observer =
|
||||||
|
VariableMapObserver::new(&NAME_COV_MAP, unsafe { &mut fuzz_hitcounts_map }, unsafe {
|
||||||
|
&fuzz_edges_id
|
||||||
|
});
|
||||||
let edges_feedback = MaxMapFeedback::new_with_observer(&NAME_COV_MAP, &edges_observer);
|
let edges_feedback = MaxMapFeedback::new_with_observer(&NAME_COV_MAP, &edges_observer);
|
||||||
|
|
||||||
let executor = InMemoryExecutor::new("QEMUFuzzer", harness, tuple_list!(edges_observer));
|
let executor = InMemoryExecutor::new("QEMUFuzzer", harness, tuple_list!(edges_observer));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user