diff --git a/libafl/Cargo.toml b/libafl/Cargo.toml index a7fc88f4a0..603db866d1 100644 --- a/libafl/Cargo.toml +++ b/libafl/Cargo.toml @@ -6,7 +6,7 @@ description = "Slot your own fuzzers together and extend their features using Ru documentation = "https://docs.rs/libafl" repository = "https://github.com/AFLplusplus/LibAFL/" license = "MIT OR Apache-2.0" -keywords = ["fuzzing", "testing"] +keywords = ["fuzzing", "testing", "security"] edition = "2018" build = "build.rs" @@ -18,7 +18,6 @@ ahash = "0.6.1" # another hash fxhash = "0.2.1" # yet another hash xxhash-rust = { version = "0.8.0", features = ["const_xxh3", "xxh3"] } # xxh3 hashing for rust serde_json = "1.0.60" - num_cpus = "1.0" # cpu count, for llmp example [[bench]] @@ -35,9 +34,9 @@ harness = false #debug = true [features] -default = ["std", "anymapdbg", "derive"] +default = ["std", "anymap_debug", "derive"] std = [] # print, sharedmap, ... support -anymapdbg = ["serde_json"] # uses serde_json to Debug the anymap trait. Disable for smaller footprint. +anymap_debug = ["serde_json"] # uses serde_json to Debug the anymap trait. Disable for smaller footprint. derive = ["libafl_derive"] # provide derive(SerdeAny) macro. llmp_small_maps = [] # reduces initial map size for llmp llmp_debug = [] # Enables debug output for LLMP @@ -59,7 +58,6 @@ static_assertions = "1.1.0" ctor = "*" libafl_derive = { version = "*", optional = true, path = "../libafl_derive" } serde_json = { version = "1.0", optional = true, default-features = false, features = ["alloc"] } # an easy way to debug print SerdeAnyMap -#TODO: for llmp brotli = { version = "3.3.0", default-features = false } # brotli compression num_enum = "0.5.1" backtrace = "0.3" # for llmp_debug diff --git a/libafl/src/bolts/serdeany.rs b/libafl/src/bolts/serdeany.rs index b83335b9cb..8782238756 100644 --- a/libafl/src/bolts/serdeany.rs +++ b/libafl/src/bolts/serdeany.rs @@ -5,9 +5,6 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer}; use alloc::boxed::Box; use core::any::{Any, TypeId}; -#[cfg(feature = "anymap_debug")] -use serde_json; - // yolo pub fn pack_type_id(id: u64) -> TypeId { @@ -181,15 +178,15 @@ macro_rules! create_serde_registry_for_trait { } } - #[cfg(fature = "anymapdbg")] + #[cfg(feature = "anymap_debug")] impl fmt::Debug for SerdeAnyMap { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { let json = serde_json::to_string(&self); - write!(f, "SerdeAnyMap: [{}]", json) + write!(f, "SerdeAnyMap: [{:?}]", json) } } - #[cfg(not(fature = "anymapdbg"))] + #[cfg(not(feature = "anymap_debug"))] impl fmt::Debug for SerdeAnyMap { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "SerdeAnymap with {} elements", self.len()) diff --git a/libafl/src/events/llmp.rs b/libafl/src/events/llmp.rs index e9a8115efe..729a1a5d07 100644 --- a/libafl/src/events/llmp.rs +++ b/libafl/src/events/llmp.rs @@ -8,24 +8,13 @@ use serde::{de::DeserializeOwned, Serialize}; use core::ptr::read_volatile; #[cfg(feature = "std")] -use crate::bolts::llmp::LlmpReceiver; - -#[cfg(all(feature = "std", windows))] -use crate::utils::startable_self; - -#[cfg(all(feature = "std", unix))] -use crate::utils::{fork, ForkResult}; - -#[cfg(all(feature = "std", unix))] -use crate::bolts::shmem::UnixShMemProvider; - -#[cfg(all(feature = "std", target_os = "android"))] -use crate::bolts::os::ashmem_server::AshmemService; -#[cfg(feature = "std")] -use crate::bolts::shmem::StdShMemProvider; +use crate::bolts::{ + llmp::{LlmpClient, LlmpReceiver}, + shmem::StdShMemProvider, +}; use crate::{ bolts::{ - llmp::{self, LlmpClient, LlmpClientDescription, LlmpSender, Tag}, + llmp::{self, LlmpClientDescription, LlmpSender, Tag}, shmem::ShMemProvider, }, corpus::CorpusScheduler, @@ -39,6 +28,18 @@ use crate::{ Error, }; +#[cfg(all(feature = "std", windows))] +use crate::utils::startable_self; + +#[cfg(all(feature = "std", unix))] +use crate::{ + bolts::shmem::UnixShMemProvider, + utils::{fork, ForkResult}, +}; + +#[cfg(all(feature = "std", target_os = "android"))] +use crate::bolts::os::ashmem_server::AshmemService; + /// Forward this to the client const _LLMP_TAG_EVENT_TO_CLIENT: llmp::Tag = 0x2C11E471; /// Only handle this in the broker diff --git a/libafl/src/inputs/bytes.rs b/libafl/src/inputs/bytes.rs index ade150fd98..345f1a67da 100644 --- a/libafl/src/inputs/bytes.rs +++ b/libafl/src/inputs/bytes.rs @@ -11,10 +11,11 @@ use std::{ path::Path, }; +#[cfg(feature = "std")] +use crate::Error; use crate::{ bolts::ownedref::OwnedSlice, inputs::{HasBytesVec, HasLen, HasTargetBytes, Input}, - Error, }; /// A bytes input is the basic input