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