diff --git a/Cargo.toml b/Cargo.toml index 88274a9d3d..04189391d4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,6 +49,43 @@ exclude = [ [workspace.package] version = "0.13.2" +[workspace.dependencies] +backtrace = { version = "0.3.74", default-features = false } # Used to get the stacktrace in StacktraceObserver +bindgen = "0.70.1" +clap = "4.5.18" +cc = "1.1.21" +cmake = "0.1.51" +document-features = "0.2.10" +foldhash = { version = "0.1.2", default-features = false } # The hash function already used in hashbrown +hashbrown = { version = "0.15.1", default-features = false } # A faster hashmap, nostd compatible +libc = "0.2.159" # For (*nix) libc +log = "0.4.22" +meminterval = "0.4.1" +mimalloc = { version = "0.1.43", default-features = false } +nix = { version = "0.29.0", default-features = false } +num_enum = { version = "0.7.3", default-features = false } +num-traits = { version = "0.2.19", default-features = false } +paste = "1.0.15" +postcard = { version = "1.0.10", features = [ + "alloc", +], default-features = false } # no_std compatible serde serialization format +rangemap = "1.5.1" +regex = "1.10.6" +rustversion = "1.0.17" +serde = { version = "1.0.210", default-features = false } # serialization lib +serial_test = { version = "3.1.1", default-features = false } +serde_json = { version = "1.0.128", default-features = false } +serde_yaml = { version = "0.9.34" } # For parsing the injections yaml file +strum = "0.26.3" +strum_macros = "0.26.4" +toml = "0.8.19" # For parsing the injections toml file +typed-builder = "0.20.0" # Implement the builder pattern at compiletime +uuid = { version = "1.10.0", features = ["serde", "v4"] } +which = { version = "7.0.0" } +windows = "0.58.0" +z3 = "0.12.1" + + [workspace.lints.rust] # Forbid unexpected_cfgs = "forbid" diff --git a/libafl/Cargo.toml b/libafl/Cargo.toml index 40b67de9cb..019f2d4ad1 100644 --- a/libafl/Cargo.toml +++ b/libafl/Cargo.toml @@ -99,7 +99,7 @@ tcp_manager = ["tokio", "std"] tcp_compression = ["tcp_manager", "libafl_bolts/gzip"] ## Enable multi-machine support -multi_machine = ["tokio", "std", "enumflags2", "ahash/std"] +multi_machine = ["tokio", "std", "enumflags2", "foldhash/std"] ## Enables the `NaiveTokenizer` and `StacktraceObserver` regex = ["std", "dep:regex"] @@ -126,7 +126,7 @@ concolic_mutation = ["z3"] tui_monitor = ["ratatui", "crossterm"] ## Enables `UnicodeClassificationStage` and associated mutators, which allow for mutations which preserve the Unicode property data -unicode = ["libafl_bolts/alloc", "ahash/std", "serde/rc", "bitvec"] +unicode = ["libafl_bolts/alloc", "foldhash/std", "serde/rc", "bitvec"] ## Enable multi-part input formats and mutators multipart_inputs = ["arrayvec", "rand_trait"] @@ -189,7 +189,7 @@ nautilus = [ rustversion = "1.0.17" [dev-dependencies] -serde_json = { version = "1.0.128", default-features = false, features = [ +serde_json = { workspace = true, default-features = false, features = [ "alloc", ] } # clippy-suggested optimised byte counter @@ -201,32 +201,27 @@ libafl_bolts = { version = "0.13.2", path = "../libafl_bolts", default-features ] } libafl_derive = { version = "0.13.2", path = "../libafl_derive", optional = true } -rustversion = { version = "1.0.17" } +rustversion = { workspace = true } tuple_list = { version = "0.1.3" } -hashbrown = { version = "0.15.0", features = [ +hashbrown = { workspace = true, features = [ "serde", - "default-hasher", ], default-features = false } # A faster hashmap, nostd compatible -num-traits = { version = "0.2.19", default-features = false } -serde = { version = "1.0.210", default-features = false, features = [ - "alloc", -] } # serialization lib -postcard = { version = "1.0.10", features = [ - "alloc", -], default-features = false } # no_std compatible serde serialization format +num-traits = { workspace = true, default-features = false } +serde = { workspace = true, features = ["alloc"] } # serialization lib +postcard = { workspace = true } # no_std compatible serde serialization format bincode = { version = "1.3.3", optional = true } c2rust-bitfields = { version = "0.19.0", features = ["no_std"] } -ahash = { version = "0.8.11", default-features = false } # The hash function already used in hashbrown -meminterval = { version = "0.4.1", features = ["serde"] } -backtrace = { version = "0.3.74", default-features = false, optional = true } # Used to get the stacktrace in StacktraceObserver -typed-builder = { version = "0.20.0", optional = true } # Implement the builder pattern at compiletime +foldhash = { workspace = true } # The hash function already used in hashbrown +meminterval = { workspace = true, features = ["serde"] } +backtrace = { workspace = true, optional = true } # Used to get the stacktrace in StacktraceObserver +typed-builder = { workspace = true, optional = true } # Implement the builder pattern at compiletime -serde_json = { version = "1.0.128", optional = true, default-features = false, features = [ +serde_json = { workspace = true, optional = true, default-features = false, features = [ "alloc", ] } -nix = { version = "0.29.0", default-features = true, optional = true } -regex = { version = "1.10.6", optional = true } -uuid = { version = "1.10.0", optional = true, features = ["serde", "v4"] } +nix = { workspace = true, default-features = true, optional = true } +regex = { workspace = true, optional = true } +uuid = { workspace = true, optional = true, features = ["serde", "v4"] } libm = "0.2.8" ratatui = { version = "0.29.0", default-features = false, features = [ 'crossterm', @@ -237,7 +232,7 @@ prometheus-client = { version = "0.22.3", optional = true } # For the prometheus tide = { version = "0.16.0", optional = true } async-std = { version = "1.13.0", features = ["attributes"], optional = true } futures = { version = "0.3.30", optional = true } -log = { version = "0.4.22" } +log = { workspace = true } tokio = { version = "1.40.0", optional = true, features = [ "sync", "net", @@ -268,24 +263,24 @@ pyo3 = { version = "0.22.3", features = ["gil-refs"], optional = true } regex-syntax = { version = "0.8.4", optional = true } # For nautilus # optional-dev deps (change when target.'cfg(accessible(::std))'.test-dependencies will be stable) -serial_test = { version = "3.1.1", optional = true, default-features = false, features = [ +serial_test = { workspace = true, optional = true, default-features = false, features = [ "logging", ] } # Document all features of this crate (for `cargo doc`) -document-features = { version = "0.2.10", optional = true } +document-features = { workspace = true, optional = true } # Optional -clap = { version = "4.5.18", optional = true } +clap = { workspace = true, optional = true } [lints] workspace = true [target.'cfg(unix)'.dependencies] -libc = { version = "0.2.59" } # For (*nix) libc -z3 = { version = "0.12.1", optional = true } # for concolic mutation +libc = { workspace = true } # For (*nix) libc +z3 = { workspace = true, optional = true } # for concolic mutation [target.'cfg(windows)'.dependencies] -windows = { version = "0.58.0", features = [ +windows = { workspace = true, features = [ "Win32_Foundation", "Win32_System_Threading", "Win32_System_Diagnostics_Debug", @@ -296,4 +291,4 @@ windows = { version = "0.58.0", features = [ ] } [target.'cfg(windows)'.build-dependencies] -windows = { version = "0.58.0" } +windows = { workspace = true } diff --git a/libafl/src/events/mod.rs b/libafl/src/events/mod.rs index 43f051f1de..f0ac1fd610 100644 --- a/libafl/src/events/mod.rs +++ b/libafl/src/events/mod.rs @@ -29,8 +29,8 @@ use core::{ time::Duration, }; -use ahash::RandomState; pub use broker_hooks::*; +use foldhash::fast::FixedState; #[cfg(feature = "std")] pub use launcher::*; #[cfg(all(unix, feature = "std"))] @@ -197,7 +197,7 @@ impl EventConfig { /// Create a new [`EventConfig`] from a name hash #[must_use] pub fn from_name(name: &str) -> Self { - let mut hasher = RandomState::with_seeds(0, 0, 0, 0).build_hasher(); //AHasher::new_with_keys(0, 0); + let mut hasher = FixedState::with_seed(1337).build_hasher(); //AHasher::new_with_keys(0, 0); hasher.write(name.as_bytes()); EventConfig::FromName { name_hash: hasher.finish(), diff --git a/libafl/src/inputs/bytes.rs b/libafl/src/inputs/bytes.rs index 127e672953..5323833689 100644 --- a/libafl/src/inputs/bytes.rs +++ b/libafl/src/inputs/bytes.rs @@ -9,7 +9,7 @@ use core::{ #[cfg(feature = "std")] use std::{fs::File, io::Read, path::Path}; -use ahash::RandomState; +use foldhash::fast::FixedState; #[cfg(feature = "std")] use libafl_bolts::{fs::write_file_atomic, Error}; use libafl_bolts::{ownedref::OwnedSlice, HasLen}; @@ -51,7 +51,7 @@ impl Input for BytesInput { /// Generate a name for this input fn generate_name(&self, _id: Option) -> String { - let mut hasher = RandomState::with_seeds(0, 0, 0, 0).build_hasher(); + let mut hasher = FixedState::with_seed(1337).build_hasher(); hasher.write(self.bytes()); format!("{:016x}", hasher.finish()) } diff --git a/libafl/src/inputs/encoded.rs b/libafl/src/inputs/encoded.rs index e3f5897e18..70073eb9be 100644 --- a/libafl/src/inputs/encoded.rs +++ b/libafl/src/inputs/encoded.rs @@ -13,7 +13,7 @@ use core::{ hash::{BuildHasher, Hasher}, }; -use ahash::RandomState; +use foldhash::fast::FixedState; use hashbrown::HashMap; use libafl_bolts::{Error, HasLen}; #[cfg(feature = "regex")] @@ -204,7 +204,7 @@ impl Input for EncodedInput { /// Generate a name for this input #[must_use] fn generate_name(&self, _id: Option) -> String { - let mut hasher = RandomState::with_seeds(0, 0, 0, 0).build_hasher(); + let mut hasher = FixedState::with_seed(1337).build_hasher(); for code in &self.codes { hasher.write(&code.to_le_bytes()); } diff --git a/libafl/src/inputs/gramatron.rs b/libafl/src/inputs/gramatron.rs index 443ee51ad3..a9fa5fa3a1 100644 --- a/libafl/src/inputs/gramatron.rs +++ b/libafl/src/inputs/gramatron.rs @@ -5,7 +5,7 @@ use core::{ hash::{BuildHasher, Hasher}, }; -use ahash::RandomState; +use foldhash::fast::FixedState; use libafl_bolts::{Error, HasLen}; use serde::{Deserialize, Serialize}; @@ -45,7 +45,7 @@ impl Input for GramatronInput { /// Generate a name for this input #[must_use] fn generate_name(&self, _id: Option) -> String { - let mut hasher = RandomState::with_seeds(0, 0, 0, 0).build_hasher(); + let mut hasher = FixedState::with_seed(1337).build_hasher(); for term in &self.terms { hasher.write(term.symbol.as_bytes()); } diff --git a/libafl/src/observers/map/const_map.rs b/libafl/src/observers/map/const_map.rs index b84428949a..a68e1ed633 100644 --- a/libafl/src/observers/map/const_map.rs +++ b/libafl/src/observers/map/const_map.rs @@ -3,12 +3,12 @@ use alloc::{borrow::Cow, vec::Vec}; use core::{ fmt::Debug, - hash::{Hash, Hasher}, + hash::{BuildHasher, Hash, Hasher}, ops::{Deref, DerefMut}, ptr::NonNull, }; -use ahash::RandomState; +use foldhash::fast::FixedState; use libafl_bolts::{ownedref::OwnedMutSizedSlice, HasLen, Named}; use serde::{de::DeserializeOwned, Deserialize, Serialize}; @@ -113,7 +113,7 @@ where #[inline] fn hash_simple(&self) -> u64 { - RandomState::with_seeds(0, 0, 0, 0).hash_one(self) + FixedState::with_seed(1337).hash_one(self) } /// Reset the map diff --git a/libafl/src/observers/map/mod.rs b/libafl/src/observers/map/mod.rs index d73dedfbb3..65d20e07c7 100644 --- a/libafl/src/observers/map/mod.rs +++ b/libafl/src/observers/map/mod.rs @@ -3,11 +3,11 @@ use alloc::{borrow::Cow, vec::Vec}; use core::{ fmt::Debug, - hash::{Hash, Hasher}, + hash::{BuildHasher, Hash, Hasher}, ops::{Deref, DerefMut}, }; -use ahash::RandomState; +use foldhash::fast::FixedState; use libafl_bolts::{ownedref::OwnedMutSlice, AsSlice, AsSliceMut, HasLen, Named, Truncate}; use serde::{de::DeserializeOwned, Deserialize, Serialize}; @@ -528,7 +528,7 @@ where #[inline] fn hash_simple(&self) -> u64 { - RandomState::with_seeds(0, 0, 0, 0).hash_one(self) + FixedState::with_seed(1337).hash_one(self) } #[inline] diff --git a/libafl/src/observers/map/multi_map.rs b/libafl/src/observers/map/multi_map.rs index 7c0bf533b9..d03b11d258 100644 --- a/libafl/src/observers/map/multi_map.rs +++ b/libafl/src/observers/map/multi_map.rs @@ -3,12 +3,12 @@ use alloc::{borrow::Cow, vec::Vec}; use core::{ fmt::Debug, - hash::{Hash, Hasher}, + hash::{BuildHasher, Hash, Hasher}, iter::Flatten, slice::{Iter, IterMut}, }; -use ahash::RandomState; +use foldhash::fast::FixedState; use libafl_bolts::{ ownedref::OwnedMutSlice, AsIter, AsIterMut, AsSlice, AsSliceMut, HasLen, Named, }; @@ -127,7 +127,7 @@ where #[inline] fn hash_simple(&self) -> u64 { - RandomState::with_seeds(0, 0, 0, 0).hash_one(self) + FixedState::with_seed(1337).hash_one(self) } fn reset_map(&mut self) -> Result<(), Error> { diff --git a/libafl/src/observers/map/owned_map.rs b/libafl/src/observers/map/owned_map.rs index 66d0fc7e8b..e789af6cc0 100644 --- a/libafl/src/observers/map/owned_map.rs +++ b/libafl/src/observers/map/owned_map.rs @@ -3,11 +3,11 @@ use alloc::{borrow::Cow, vec::Vec}; use core::{ fmt::Debug, - hash::{Hash, Hasher}, + hash::{BuildHasher, Hash, Hasher}, ops::{Deref, DerefMut}, }; -use ahash::RandomState; +use foldhash::fast::FixedState; use libafl_bolts::{AsSlice, AsSliceMut, HasLen, Named}; use serde::{de::DeserializeOwned, Deserialize, Serialize}; @@ -108,7 +108,7 @@ where #[inline] fn hash_simple(&self) -> u64 { - RandomState::with_seeds(0, 0, 0, 0).hash_one(self) + FixedState::with_seed(1337).hash_one(self) } #[inline] diff --git a/libafl/src/observers/map/variable_map.rs b/libafl/src/observers/map/variable_map.rs index ec1a5feda3..5a52dbac69 100644 --- a/libafl/src/observers/map/variable_map.rs +++ b/libafl/src/observers/map/variable_map.rs @@ -3,11 +3,11 @@ use alloc::{borrow::Cow, vec::Vec}; use core::{ fmt::Debug, - hash::{Hash, Hasher}, + hash::{BuildHasher, Hash, Hasher}, ops::{Deref, DerefMut}, }; -use ahash::RandomState; +use foldhash::fast::FixedState; use libafl_bolts::{ ownedref::{OwnedMutPtr, OwnedMutSlice}, AsSlice, AsSliceMut, HasLen, Named, @@ -115,7 +115,7 @@ where #[inline] fn hash_simple(&self) -> u64 { - RandomState::with_seeds(0, 0, 0, 0).hash_one(self) + FixedState::with_seed(1337).hash_one(self) } /// Reset the map diff --git a/libafl/src/observers/value.rs b/libafl/src/observers/value.rs index 47fcde05a2..3eec4793ac 100644 --- a/libafl/src/observers/value.rs +++ b/libafl/src/observers/value.rs @@ -4,11 +4,11 @@ use alloc::{borrow::Cow, boxed::Box, vec::Vec}; use core::{ cell::{Ref, RefCell, RefMut}, fmt::Debug, - hash::{Hash, Hasher}, + hash::{BuildHasher, Hash, Hasher}, ops::{Deref, DerefMut}, }; -use ahash::RandomState; +use foldhash::fast::FixedState; use libafl_bolts::{ownedref::OwnedRef, AsIter, AsIterMut, AsSlice, AsSliceMut, HasLen, Named}; use serde::{de::DeserializeOwned, Deserialize, Serialize}; @@ -77,7 +77,7 @@ impl Named for ValueObserver<'_, T> { impl ObserverWithHashField for ValueObserver<'_, T> { fn hash(&self) -> Option { - Some(RandomState::with_seeds(1, 2, 3, 4).hash_one(self.value.as_ref())) + Some(FixedState::with_seed(1337).hash_one(self.value.as_ref())) } } @@ -156,7 +156,7 @@ where T: Hash, { fn hash(&self) -> Option { - Some(RandomState::with_seeds(1, 2, 3, 4).hash_one(&*self.value.as_ref().borrow())) + Some(FixedState::with_seed(1337).hash_one(&*self.value.as_ref().borrow())) } } @@ -311,7 +311,7 @@ where /// Panics if the contained value is already mutably borrowed (calls /// [`RefCell::borrow`]). fn hash_simple(&self) -> u64 { - RandomState::with_seeds(0, 0, 0, 0).hash_one(self) + FixedState::with_seed(1337).hash_one(self) } /// Panics if the contained value is already mutably borrowed (calls diff --git a/libafl/src/stages/tmin.rs b/libafl/src/stages/tmin.rs index b3e61e07bb..9590696e56 100644 --- a/libafl/src/stages/tmin.rs +++ b/libafl/src/stages/tmin.rs @@ -4,9 +4,14 @@ use alloc::{ borrow::{Cow, ToOwned}, string::ToString, }; -use core::{borrow::BorrowMut, fmt::Debug, hash::Hash, marker::PhantomData}; +use core::{ + borrow::BorrowMut, + fmt::Debug, + hash::{BuildHasher, Hash}, + marker::PhantomData, +}; -use ahash::RandomState; +use foldhash::fast::FixedState; use libafl_bolts::{ tuples::{Handle, Handled, MatchName, MatchNameRef}, HasLen, Named, @@ -102,7 +107,7 @@ where let mut base = state.current_input_cloned()?; // potential post operation if base is replaced by a shorter input let mut base_post = None; - let base_hash = RandomState::with_seeds(0, 0, 0, 0).hash_one(&base); + let base_hash = FixedState::with_seed(1337).hash_one(&base); mark_feature_time!(state, PerfFeature::GetInputFromCorpus); fuzzer.execute_input(state, executor, manager, &base)?; @@ -181,7 +186,7 @@ where i = next_i; } - let new_hash = RandomState::with_seeds(0, 0, 0, 0).hash_one(&base); + let new_hash = FixedState::with_seed(1337).hash_one(&base); if base_hash != new_hash { let exit_kind = fuzzer.execute_input(state, executor, manager, &base)?; let observers = executor.observers(); diff --git a/libafl_bolts/Cargo.toml b/libafl_bolts/Cargo.toml index cf6adcc38a..a6c26035ed 100644 --- a/libafl_bolts/Cargo.toml +++ b/libafl_bolts/Cargo.toml @@ -55,7 +55,7 @@ std = [ ] ## Enables all features that allocate in `no_std` -alloc = ["serde/alloc", "hashbrown", "postcard", "erased-serde/alloc", "ahash"] +alloc = ["serde/alloc", "hashbrown", "postcard", "erased-serde/alloc"] ## Provide the `#[derive(SerdeAny)]` macro. derive = ["libafl_derive"] @@ -117,68 +117,63 @@ llmp_debug = ["alloc", "std"] llmp_small_maps = ["alloc"] [build-dependencies] -rustversion = { version = "1.0.17" } +rustversion = { workspace = true } [dependencies] libafl_derive = { version = "0.13.2", optional = true, path = "../libafl_derive" } static_assertions = "1.1.0" tuple_list = { version = "0.1.3" } -hashbrown = { version = "0.15.0", features = [ +hashbrown = { workspace = true, features = [ "serde", - "default-hasher", - "raw-entry", ], default-features = false, optional = true } # A faster hashmap, nostd compatible xxhash-rust = { version = "0.8.12", features = [ "xxh3", ], optional = true } # xxh3 hashing for rust -serde = { version = "1.0.210", default-features = false, features = [ +serde = { workspace = true, default-features = false, features = [ "derive", ] } # serialization lib erased-serde = { version = "0.4.5", default-features = false, optional = true } # erased serde -postcard = { version = "1.0.10", features = [ - "alloc", -], default-features = false, optional = true } # no_std compatible serde serialization format -num_enum = { version = "0.7.3", default-features = false } -ahash = { version = "0.8.11", default-features = false, optional = true } # The hash function already used in hashbrown -foldhash = { version = "0.1.3", default-features = false } # After hashbrown 0.15.0 -backtrace = { version = "0.3.74", default-features = true, optional = true } # Used to get the stacktrace in StacktraceObserver +postcard = { workspace = true, optional = true } # no_std compatible serde serialization format +num_enum = { workspace = true, default-features = false } +foldhash = { workspace = true } #, optional = true } # The hash function already used in hashbrown +backtrace = { workspace = true, default-features = true, optional = true } # Used to get the stacktrace in StacktraceObserver ctor = { optional = true, version = "0.2.8" } miniz_oxide = { version = "0.8.0", optional = true } hostname = { version = "0.4.0", optional = true } # Is there really no gethostname in the stdlib? rand_core = { version = "0.6.4", optional = true } -nix = { version = "0.29.0", optional = true, default-features = false, features = [ +nix = { workspace = true, optional = true, default-features = false, features = [ "fs", "signal", "socket", "poll", ] } -uuid = { version = "1.10.0", optional = true, features = ["serde", "v4"] } -clap = { version = "4.5.18", features = [ +uuid = { workspace = true, optional = true, features = ["serde", "v4"] } +clap = { workspace = true, features = [ "derive", "wrap_help", ], optional = true } # CLI parsing, for libafl_bolts::cli / the `cli` feature -log = { version = "0.4.22" } +log = { workspace = true } pyo3 = { version = "0.22.3", optional = true, features = ["serde", "macros"] } # optional-dev deps (change when target.'cfg(accessible(::std))'.test-dependencies will be stable) -serial_test = { version = "3.1.1", optional = true, default-features = false, features = [ +serial_test = { workspace = true, optional = true, default-features = false, features = [ "logging", ] } # Document all features of this crate (for `cargo doc`) -document-features = { version = "0.2.10", optional = true } +document-features = { workspace = true, optional = true } [lints] workspace = true [target.'cfg(unix)'.dependencies] -libc = { version = "0.2.59" } # For (*nix) libc +libc = { workspace = true } # For (*nix) libc uds = { version = "0.4.2", optional = true, default-features = false } [target.'cfg(windows)'.dependencies] -windows = { version = "0.58.0", features = [ +windows = { workspace = true, features = [ "Win32_Foundation", "Win32_System_Threading", "Win32_System_Diagnostics_Debug", @@ -191,7 +186,7 @@ windows = { version = "0.58.0", features = [ windows-result = "0.2.0" [target.'cfg(windows)'.build-dependencies] -windows = { version = "0.58.0" } +windows = { workspace = true } [target.'cfg(target_vendor = "apple")'.dependencies] mach = "0.3.2" diff --git a/libafl_bolts/src/lib.rs b/libafl_bolts/src/lib.rs index ebfee24327..a736f874c3 100644 --- a/libafl_bolts/src/lib.rs +++ b/libafl_bolts/src/lib.rs @@ -110,7 +110,7 @@ pub mod shmem; pub mod staterestore; #[cfg(feature = "alloc")] pub mod subrange; -// TODO: reenable once ahash works in no-alloc +// TODO: reenable once/if foldhash works in no-alloc #[cfg(any(feature = "xxh3", feature = "alloc"))] pub mod tuples; @@ -143,9 +143,9 @@ pub mod bolts_prelude { use alloc::boxed::Box; #[cfg(feature = "alloc")] use alloc::{borrow::Cow, vec::Vec}; -#[cfg(all(not(feature = "xxh3"), feature = "alloc"))] +use foldhash::fast::FixedState; +#[cfg(not(feature = "xxh3"))] use core::hash::BuildHasher; -#[cfg(any(feature = "xxh3", feature = "alloc"))] use core::hash::Hasher; #[cfg(feature = "std")] use std::time::{SystemTime, UNIX_EPOCH}; @@ -158,10 +158,6 @@ use std::{ panic, }; -// There's a bug in ahash that doesn't let it build in `alloc` without once_cell right now. -// TODO: re-enable once is resolved. -#[cfg(all(not(feature = "xxh3"), feature = "alloc"))] -use ahash::RandomState; use log::SetLoggerError; use serde::{Deserialize, Serialize}; #[cfg(feature = "xxh3")] @@ -238,13 +234,12 @@ fn display_error_backtrace(_f: &mut fmt::Formatter, _err: &ErrorBacktrace) -> fm /// Returns the hasher for the input with a given hash, depending on features: /// [`xxh3_64`](https://docs.rs/xxhash-rust/latest/xxhash_rust/xxh3/fn.xxh3_64.html) /// if the `xxh3` feature is used, /// else [`ahash`](https://docs.rs/ahash/latest/ahash/). -#[cfg(any(feature = "xxh3", feature = "alloc"))] #[must_use] pub fn hasher_std() -> impl Hasher + Clone { #[cfg(feature = "xxh3")] return xxhash_rust::xxh3::Xxh3::new(); #[cfg(not(feature = "xxh3"))] - RandomState::with_seeds(0, 0, 0, 0).build_hasher() + FixedState::with_seed(1337).build_hasher() } /// Hashes the input with a given hash diff --git a/libafl_bolts/src/staterestore.rs b/libafl_bolts/src/staterestore.rs index 4607771379..462a8e083e 100644 --- a/libafl_bolts/src/staterestore.rs +++ b/libafl_bolts/src/staterestore.rs @@ -15,7 +15,7 @@ use std::{ ptr::read_volatile, }; -use ahash::RandomState; +use foldhash::fast::FixedState; use serde::{de::DeserializeOwned, Serialize}; use crate::{ @@ -120,7 +120,7 @@ where if size_of::() + serialized.len() > self.shmem.len() { // generate a filename - let mut hasher = RandomState::with_seeds(0, 0, 0, 0).build_hasher(); + let mut hasher = FixedState::with_seed(1337).build_hasher(); // Using the last few k as randomness for a filename, hoping it's unique. hasher.write(&serialized[serialized.len().saturating_sub(4096)..]); diff --git a/libafl_cc/Cargo.toml b/libafl_cc/Cargo.toml index 1a73bd3a39..e2005f0d3c 100644 --- a/libafl_cc/Cargo.toml +++ b/libafl_cc/Cargo.toml @@ -44,14 +44,14 @@ dump-cfg = [] profiling = [] [build-dependencies] -cc = { version = "1.1.21", features = ["parallel"] } -which = { version = "7.0.0" } +cc = { workspace = true, features = ["parallel"] } +which = { workspace = true } [target.'cfg(target_vendor = "apple")'.build-dependencies] glob = "0.3.1" [dependencies] -serde = { version = "1.0.210", default-features = false, features = [ +serde = { workspace = true, default-features = false, features = [ "alloc", "derive", ] } # serialization lib diff --git a/libafl_concolic/symcc_libafl/Cargo.toml b/libafl_concolic/symcc_libafl/Cargo.toml index 4d3d859c2e..8c1150be55 100644 --- a/libafl_concolic/symcc_libafl/Cargo.toml +++ b/libafl_concolic/symcc_libafl/Cargo.toml @@ -34,9 +34,9 @@ build = ["which", "cmake"] clone = ["which"] [dependencies] -which = { version = "7.0.0", optional = true } -cmake = { version = "0.1.51", optional = true } -log = { version = "0.4.22" } +which = { workspace = true, optional = true } +cmake = { workspace = true, optional = true } +log = { workspace = true } [lints] workspace = true diff --git a/libafl_concolic/symcc_runtime/Cargo.toml b/libafl_concolic/symcc_runtime/Cargo.toml index 4dee260cd8..5484ccf9e4 100644 --- a/libafl_concolic/symcc_runtime/Cargo.toml +++ b/libafl_concolic/symcc_runtime/Cargo.toml @@ -43,13 +43,13 @@ libafl_bolts = { path = "../../libafl_bolts", version = "0.13.2", default-featur unchecked_unwrap = "4.0.0" ctor = "0.2.8" -libc = { version = "0.2.59" } +libc = { workspace = true } [build-dependencies] -cmake = { version = "0.1.51" } -bindgen = { version = "0.70.1" } -regex = { version = "1.10.6" } -which = { version = "7.0.0" } +cmake = { workspace = true } +bindgen = { workspace = true } +regex = { workspace = true } +which = { workspace = true } symcc_libafl = { path = "../symcc_libafl", version = "0.13.2" } [lints] diff --git a/libafl_concolic/test/dump_constraints/Cargo.toml b/libafl_concolic/test/dump_constraints/Cargo.toml index 53917b07d8..adf42fda92 100644 --- a/libafl_concolic/test/dump_constraints/Cargo.toml +++ b/libafl_concolic/test/dump_constraints/Cargo.toml @@ -22,7 +22,7 @@ categories = [ [dependencies] libafl = { path = "../../../libafl" } libafl_bolts = { path = "../../../libafl_bolts" } -clap = { version = "4.5.18", features = ["derive"] } +clap = { workspace = true, features = ["derive"] } [lints] workspace = true diff --git a/libafl_frida/Cargo.toml b/libafl_frida/Cargo.toml index bc5a6180f5..d8eced3a17 100644 --- a/libafl_frida/Cargo.toml +++ b/libafl_frida/Cargo.toml @@ -44,7 +44,7 @@ track_hit_feedbacks = ["libafl/track_hit_feedbacks"] auto-download = ["frida-gum-sys/auto-download", "frida-gum/auto-download"] [build-dependencies] -cc = { version = "1.1.21", features = ["parallel"] } +cc = { workspace = true, features = ["parallel"] } [dependencies] libafl = { path = "../libafl", default-features = false, version = "0.13.2", features = [ @@ -61,11 +61,10 @@ libafl_targets = { path = "../libafl_targets", version = "0.13.2", features = [ "std", "sancov_cmplog", ] } - -nix = { version = "0.29.0", default-features = true, features = ["mman"] } -libc = { version = "0.2.59" } -hashbrown = { version = "0.15.1", default-features = true } -rangemap = { version = "1.5.1" } +nix = { workspace = true, default-features = true, features = ["mman"] } +libc = { workspace = true } +hashbrown = { workspace = true, default-features = true } +rangemap = { workspace = true } frida-gum-sys = { version = "0.15.1", features = [ "event-sink", "invocation-listener", @@ -80,28 +79,28 @@ dynasmrt = "3.0.1" color-backtrace = { version = "0.6.1", features = ["resolve-modules"] } termcolor = "1.4.1" -serde = { version = "1.0.210", default-features = true } -backtrace = { version = "0.3.74", default-features = false, features = [ +serde = { workspace = true, default-features = true } +backtrace = { workspace = true, default-features = false, features = [ "std", "serde", ] } -num-traits = { version = "0.2.19", default-features = true } -ahash = { version = "0.8.11", default-features = true } # The hash function already used in hashbrown -paste = { version = "1.0.15" } -log = { version = "0.4.22" } +num-traits = { workspace = true, default-features = true } +foldhash = { workspace = true, default-features = true } +paste = { workspace = true } +log = { workspace = true } mmap-rs = "0.6.1" bit_reverse = "0.1.8" yaxpeax-arch = "0.3.2" -document-features = { version = "0.2.10", optional = true } # Document all features of this crate (for `cargo doc`) +document-features = { workspace = true, optional = true } # Document all features of this crate (for `cargo doc`) [dev-dependencies] -serial_test = { version = "3.1.1", default-features = false, features = [ +serial_test = { workspace = true, default-features = false, features = [ "logging", ] } -clap = { version = "4.5.18", features = ["derive"] } +clap = { workspace = true, features = ["derive"] } libloading = "0.8.5" -mimalloc = { version = "0.1.43", default-features = false } +mimalloc = { workspace = true, default-features = false } dlmalloc = { version = "0.2.6", features = ["global"] } [lints] diff --git a/libafl_frida/src/drcov_rt.rs b/libafl_frida/src/drcov_rt.rs index 4b250cc3c9..b5d8e779f2 100644 --- a/libafl_frida/src/drcov_rt.rs +++ b/libafl_frida/src/drcov_rt.rs @@ -5,7 +5,7 @@ use std::{ rc::Rc, }; -use ahash::RandomState; +use foldhash::fast::FixedState; use frida_gum::ModuleMap; use libafl::{ inputs::{HasTargetBytes, Input}, @@ -55,11 +55,11 @@ impl FridaRuntime for DrCovRuntime { return Ok(()); } - let mut input_hasher = RandomState::with_seeds(0, 0, 0, 0).build_hasher(); + let mut input_hasher = FixedState::with_seed(1337).build_hasher(); input_hasher.write(input.target_bytes().as_slice()); let input_hash = input_hasher.finish(); - let mut coverage_hasher = RandomState::with_seeds(0, 0, 0, 0).build_hasher(); + let mut coverage_hasher = FixedState::with_seed(1337).build_hasher(); for bb in &self.drcov_basic_blocks { coverage_hasher.write_usize(bb.start); coverage_hasher.write_usize(bb.end); diff --git a/libafl_libfuzzer/Cargo.toml b/libafl_libfuzzer/Cargo.toml index b16055ef5e..a578036a1d 100644 --- a/libafl_libfuzzer/Cargo.toml +++ b/libafl_libfuzzer/Cargo.toml @@ -14,7 +14,7 @@ include = ["/src", "/Cargo.toml", "/build.rs", "/runtime"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [build-dependencies] -cc = { version = "1.1.21" } +cc = "1.0.106" rustversion = "1.0.17" toml = { version = "0.8.19", features = ["preserve_order"] } @@ -43,7 +43,7 @@ libafl-libfuzzer-use-version = [] [dependencies] libfuzzer-sys = { version = "0.4.7", default-features = false } -document-features = { version = "0.2.10", optional = true } +document-features = { workspace = true, optional = true } [package.metadata.docs.rs] features = ["document-features"] diff --git a/libafl_libfuzzer/runtime/Cargo.toml.template b/libafl_libfuzzer/runtime/Cargo.toml.template index f48773aef2..213a191e43 100644 --- a/libafl_libfuzzer/runtime/Cargo.toml.template +++ b/libafl_libfuzzer/runtime/Cargo.toml.template @@ -65,7 +65,7 @@ libafl_targets = { path = "../libafl_targets", features = [ "sanitizer_interfaces", ] } -ahash = { version = "0.8.11", default-features = false } +foldhash = { version = "0.1.2", default-features = false } libc = "0.2.159" log = { version = "0.4.22", features = ["release_max_level_info"] } mimalloc = { version = "0.1.43", default-features = false } @@ -74,9 +74,7 @@ rand = "0.8.5" serde = { version = "1.0.210", default-features = true, features = [ "derive", ] } # serialization lib -hashbrown = { version = "0.14.5", default-features = true, features = [ - "serde", -] } +hashbrown = { version = "0.14.5", default-features = true } # for identifying if we can grimoire-ify utf8-chars = "3.0.4" diff --git a/libafl_nyx/Cargo.toml b/libafl_nyx/Cargo.toml index 98f9c4d32f..a81bbac088 100644 --- a/libafl_nyx/Cargo.toml +++ b/libafl_nyx/Cargo.toml @@ -36,8 +36,8 @@ libafl_targets = { path = "../libafl_targets", version = "0.13.2", features = [ "sancov_cmplog", ] } -nix = { version = "0.29.0", default-features = true, features = ["fs"] } -typed-builder = { version = "0.20.0" } +nix = { workspace = true, default-features = true, features = ["fs"] } +typed-builder = { workspace = true } [lints] workspace = true diff --git a/libafl_qemu/Cargo.toml b/libafl_qemu/Cargo.toml index f84ce72a1e..90ee7abee2 100644 --- a/libafl_qemu/Cargo.toml +++ b/libafl_qemu/Cargo.toml @@ -101,48 +101,48 @@ libafl_targets = { path = "../libafl_targets", version = "0.13.2" } libafl_qemu_sys = { path = "./libafl_qemu_sys", version = "0.13.2", default-features = false } libafl_derive = { path = "../libafl_derive", version = "0.13.2" } -serde = { version = "1.0.210", default-features = false, features = [ +serde = { workspace = true, default-features = false, features = [ "alloc", ] } # serialization lib -hashbrown = { version = "0.15.1", default-features = true, features = [ +hashbrown = { workspace = true, default-features = true, features = [ "serde", ] } # A faster hashmap, nostd compatible -num-traits = { version = "0.2.19", default-features = true } +num-traits = { workspace = true, default-features = true } num-derive = "0.4.2" -num_enum = { version = "0.7.3", default-features = true } +num_enum = { workspace = true, default-features = true } goblin = "0.9.2" -libc = { version = "0.2.59" } +libc = { workspace = true } strum = "0.26.3" strum_macros = "0.26.4" syscall-numbers = "4.0.0" -meminterval = { version = "0.4.1" } +meminterval = { workspace = true } thread_local = "1.1.8" capstone = "0.12.0" -rangemap = { version = "1.5.1" } -log = { version = "0.4.22" } +rangemap = { workspace = true } +log = { workspace = true } object = "0.36.4" addr2line = "0.24.1" typed-arena = "2.0.2" -paste = { version = "1.0.15" } +paste = { workspace = true } enum-map = "2.7.3" -serde_yaml = { version = "0.9.34", optional = true } # For parsing the injections yaml file -toml = { version = "0.8.19", optional = true } # For parsing the injections toml file +serde_yaml = { workspace = true, optional = true } # For parsing the injections yaml file +toml = { workspace = true, optional = true } # For parsing the injections toml file pyo3 = { version = "0.22.3", optional = true, features = [ "multiple-pymethods", ] } bytes-utils = "0.1.4" -typed-builder = { version = "0.20.0" } +typed-builder = { workspace = true } memmap2 = "0.9.5" getset = "0.1.3" # Document all features of this crate (for `cargo doc`) -document-features = { version = "0.2.10", optional = true } +document-features = { workspace = true, optional = true } [build-dependencies] libafl_qemu_build = { path = "./libafl_qemu_build", version = "0.13.2" } pyo3-build-config = { version = "0.22.3", optional = true } -rustversion = { version = "1.0.17" } -bindgen = { version = "0.70.1" } -cc = { version = "1.1.21" } +rustversion = { workspace = true } +bindgen = { workspace = true } +cc = { workspace = true } [lib] name = "libafl_qemu" diff --git a/libafl_qemu/libafl_qemu_build/Cargo.toml b/libafl_qemu/libafl_qemu_build/Cargo.toml index 4c25c2fb69..ed4771eafa 100644 --- a/libafl_qemu/libafl_qemu_build/Cargo.toml +++ b/libafl_qemu/libafl_qemu_build/Cargo.toml @@ -30,14 +30,14 @@ paranoid_debug = [ ] # Will perform as many checks as possible. The target will be greatly slowed down. [dependencies] -bindgen = { version = "0.70.1" } -which = { version = "7.0.0" } +bindgen = { workspace = true } +which = { workspace = true } json = "0.12.4" shell-words = "1.1.0" pkg-config = "0.3.31" -cc = { version = "1.1.21" } -regex = { version = "1.10.6" } -rustversion = { version = "1.0.17" } +cc = { workspace = true } +regex = { workspace = true } +rustversion = { workspace = true } rustc_version = "0.4.1" [lints] diff --git a/libafl_qemu/libafl_qemu_sys/Cargo.toml b/libafl_qemu/libafl_qemu_sys/Cargo.toml index 240758a629..5d89ebf1e5 100644 --- a/libafl_qemu/libafl_qemu_sys/Cargo.toml +++ b/libafl_qemu/libafl_qemu_sys/Cargo.toml @@ -58,17 +58,17 @@ paranoid_debug = [ ] # Will perform as many checks as possible. The target will be greatly slowed down. [dependencies] -paste = { version = "1.0.15" } -num_enum = { version = "0.7.3", default-features = true } -libc = { version = "0.2.59" } -strum = { version = "0.26.3" } -strum_macros = { version = "0.26.4" } +paste = { workspace = true } +num_enum = { workspace = true, default-features = true } +libc = { workspace = true } +strum = { workspace = true } +strum_macros = { workspace = true } pyo3 = { version = "0.22.3", optional = true } [build-dependencies] libafl_qemu_build = { path = "../libafl_qemu_build", version = "0.13.2" } pyo3-build-config = { version = "0.22.3", optional = true } -rustversion = { version = "1.0.17" } +rustversion = { workspace = true } [lints] workspace = true diff --git a/libafl_sugar/Cargo.toml b/libafl_sugar/Cargo.toml index 1aa72c9758..399a825103 100644 --- a/libafl_sugar/Cargo.toml +++ b/libafl_sugar/Cargo.toml @@ -65,11 +65,11 @@ libafl_bolts = { path = "../libafl_bolts", version = "0.13.2" } libafl_targets = { path = "../libafl_targets", version = "0.13.2" } # Document all features of this crate (for `cargo doc`) -document-features = { version = "0.2.10", optional = true } +document-features = { workspace = true, optional = true } -typed-builder = { version = "0.20.0" } # Implement the builder pattern at compiletime +typed-builder = { workspace = true } # Implement the builder pattern at compiletime pyo3 = { version = "0.22.3", optional = true } -log = { version = "0.4.22" } +log = { workspace = true } [target.'cfg(target_os = "linux")'.dependencies] libafl_qemu = { path = "../libafl_qemu", version = "0.13.2" } diff --git a/libafl_targets/Cargo.toml b/libafl_targets/Cargo.toml index 8ec5dd3496..5a7b6aed62 100644 --- a/libafl_targets/Cargo.toml +++ b/libafl_targets/Cargo.toml @@ -52,7 +52,7 @@ sancov_cmplog = [ sancov_pcguard = ["sancov_pcguard_hitcounts"] sanitizer_interfaces = [] clippy = [] # Ignore compiler warnings during clippy -observers = ["meminterval", "ahash"] +observers = ["meminterval", "foldhash"] common = [ ] # Compile common C code defining sanitizer options and cross-platform intrinsics coverage = ["common"] # Compile C code definining coverage maps @@ -74,18 +74,18 @@ libafl = { path = "../libafl", version = "0.13.2", default-features = false, fea ] } libafl_bolts = { path = "../libafl_bolts", version = "0.13.2", default-features = false, features = [ ] } -libc = { version = "0.2.59" } -hashbrown = { version = "0.15.1", default-features = true } +libc = { workspace = true } +hashbrown = { workspace = true, default-features = true } once_cell = "1.19.0" -log = { version = "0.4.22" } -rustversion = { version = "1.0.17" } +log = { workspace = true } +rustversion = { workspace = true } -rangemap = { version = "1.5.1" } -serde = { version = "1.0.210", default-features = false, features = [ +rangemap = { workspace = true } +serde = { workspace = true, default-features = false, features = [ "alloc", ] } # serialization lib -meminterval = { version = "0.4.1", features = ["serde"], optional = true } -ahash = { version = "0.8.11", default-features = false, optional = true } +meminterval = { workspace = true, features = ["serde"], optional = true } +foldhash = { workspace = true, default-features = false, optional = true } [lints] workspace = true diff --git a/libafl_targets/src/sancov_8bit.rs b/libafl_targets/src/sancov_8bit.rs index b4ef07bcde..0c82a0d0d8 100644 --- a/libafl_targets/src/sancov_8bit.rs +++ b/libafl_targets/src/sancov_8bit.rs @@ -84,7 +84,7 @@ mod observers { slice::{from_raw_parts, Iter, IterMut}, }; - use ahash::RandomState; + use foldhash::fast::FixedState; use libafl::{ observers::{DifferentialObserver, MapObserver, Observer}, Error, @@ -233,7 +233,7 @@ mod observers { #[inline] fn hash_simple(&self) -> u64 { - RandomState::with_seeds(0, 0, 0, 0).hash_one(self) + FixedState::with_seed(1337).hash_one(self) } fn reset_map(&mut self) -> Result<(), Error> { diff --git a/libafl_tinyinst/Cargo.toml b/libafl_tinyinst/Cargo.toml index 6d1d9f1f78..b3c1e48f5e 100644 --- a/libafl_tinyinst/Cargo.toml +++ b/libafl_tinyinst/Cargo.toml @@ -31,10 +31,10 @@ libafl_bolts = { path = "../libafl_bolts", version = "0.13.2", features = [ ] } tinyinst = { git = "https://github.com/AFLplusplus/tinyinst-rs" } # tinyinst-rs = { path = "../../tinyinst-rs" } -log = { version = "0.4.22" } +log = { workspace = true } [build-dependencies] -cmake = { version = "0.1.51" } +cmake = { workspace = true } [lints] workspace = true diff --git a/utils/deexit/Cargo.toml b/utils/deexit/Cargo.toml index e3446888fb..f15b0e0cf5 100644 --- a/utils/deexit/Cargo.toml +++ b/utils/deexit/Cargo.toml @@ -23,7 +23,7 @@ categories = [ # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -log = { version = "0.4.22" } +log = { workspace = true } [lib] name = "deexit" diff --git a/utils/desyscall/Cargo.toml b/utils/desyscall/Cargo.toml index 5cd13f2065..c6a5bce7f4 100644 --- a/utils/desyscall/Cargo.toml +++ b/utils/desyscall/Cargo.toml @@ -22,7 +22,7 @@ libc = "0.2" rusty-fork = "0.3.0" [build-dependencies] -cc = { version = "1.1.21" } +cc = "1" [lib] name = "desyscall" diff --git a/utils/gramatron/construct_automata/Cargo.toml b/utils/gramatron/construct_automata/Cargo.toml index 4ab30d371d..75d4b5e677 100644 --- a/utils/gramatron/construct_automata/Cargo.toml +++ b/utils/gramatron/construct_automata/Cargo.toml @@ -25,12 +25,12 @@ categories = [ [dependencies] libafl = { path = "../../../libafl", default-features = false } -serde_json = { version = "1.0.128", default-features = true } -regex = { version = "1.10.6" } -postcard = { version = "1.0.10", features = [ +serde_json = { workspace = true, default-features = true } +regex = { workspace = true } +postcard = { workspace = true, features = [ "alloc", ], default-features = false } # no_std compatible serde serialization format -clap = { version = "4.5.18", features = ["derive"] } +clap = { workspace = true, features = ["derive"] } [lints] workspace = true diff --git a/utils/libafl_benches/Cargo.toml b/utils/libafl_benches/Cargo.toml index ceaa2ab6c0..7909837e60 100644 --- a/utils/libafl_benches/Cargo.toml +++ b/utils/libafl_benches/Cargo.toml @@ -27,7 +27,7 @@ libafl_bolts = { path = "../../libafl_bolts", default-features = false, features ] } # libafl_bolts criterion = "0.5.1" # Benchmarking -ahash = { version = "0.8.11", default-features = false } # The hash function already used in hashbrown +foldhash = { workspace = true, default-features = false } # The hash function already used in hashbrown rustc-hash = { version = "2.0.0", default-features = false } # yet another hash xxhash-rust = { version = "0.8.12", features = [ "xxh3", diff --git a/utils/libafl_benches/benches/hash_speeds.rs b/utils/libafl_benches/benches/hash_speeds.rs index a929a6a51e..b742b72104 100644 --- a/utils/libafl_benches/benches/hash_speeds.rs +++ b/utils/libafl_benches/benches/hash_speeds.rs @@ -23,9 +23,10 @@ fn criterion_benchmark(c: &mut Criterion) { /*c.bench_function("const_xxh3", |b| { b.iter(|| const_xxh3::xxh3_64_with_seed(black_box(&bench_vec), 0)) });*/ - c.bench_function("ahash", |b| { + c.bench_function("foldhash", |b| { b.iter(|| { - let mut hasher = ahash::RandomState::with_seeds(123, 456, 789, 123).build_hasher(); + let mut hasher = + foldhash::fast::FixedState::with_seeds(123, 456, 789, 123).build_hasher(); hasher.write(black_box(&bench_vec)); black_box(hasher.finish()); }); diff --git a/utils/libafl_jumper/Cargo.toml b/utils/libafl_jumper/Cargo.toml index ebf3c263da..9a97fdb707 100644 --- a/utils/libafl_jumper/Cargo.toml +++ b/utils/libafl_jumper/Cargo.toml @@ -13,7 +13,7 @@ default = ["std"] std = [] [build-dependencies] -cc = { version = "1.1.21" } +cc = "1" [dependencies] hex = { version = "0.4", default-features = false }