From efc804fe7d2ce816ba3e19cd286d05a5bd0f2c98 Mon Sep 17 00:00:00 2001 From: Dominik Maier Date: Sun, 2 Jan 2022 17:52:44 +0100 Subject: [PATCH] Updated dependencies (#443) * updated dependencies * updated info in toml * Windows fixes * fixed immport * u32 -> i32 * ignore i32 overflows in constants * removed unused double allow --- fuzzers/frida_libpng/Cargo.toml | 4 +- fuzzers/fuzzbench/Cargo.toml | 2 +- fuzzers/fuzzbench_qemu/Cargo.toml | 2 +- libafl/Cargo.toml | 14 ++-- libafl/src/bolts/os/mod.rs | 3 +- libafl/src/bolts/os/windows_exceptions.rs | 96 +++++++++++------------ libafl/src/bolts/shmem.rs | 21 ++++- libafl_frida/Cargo.toml | 8 +- libafl_qemu/Cargo.toml | 6 +- libafl_sugar/Cargo.toml | 2 +- libafl_targets/Cargo.toml | 2 +- 11 files changed, 88 insertions(+), 72 deletions(-) diff --git a/fuzzers/frida_libpng/Cargo.toml b/fuzzers/frida_libpng/Cargo.toml index bbd3ce266e..43f56f2b79 100644 --- a/fuzzers/frida_libpng/Cargo.toml +++ b/fuzzers/frida_libpng/Cargo.toml @@ -35,9 +35,9 @@ libafl_frida = { path = "../../libafl_frida", features = ["cmplog"] } libafl_targets = { path = "../../libafl_targets", features = ["sancov_cmplog"] } lazy_static = "1.4.0" libc = "0.2" -libloading = "0.7.0" +libloading = "0.7" num-traits = "0.2.14" -rangemap = "0.1.10" +rangemap = "0.1" structopt = "0.3.25" serde = "1.0" mimalloc = { version = "*", default-features = false } diff --git a/fuzzers/fuzzbench/Cargo.toml b/fuzzers/fuzzbench/Cargo.toml index e3410e1fcf..45bb98dd5b 100644 --- a/fuzzers/fuzzbench/Cargo.toml +++ b/fuzzers/fuzzbench/Cargo.toml @@ -25,7 +25,7 @@ libafl_targets = { path = "../../libafl_targets/", features = ["sancov_pcguard_h # TODO Include it only when building cc libafl_cc = { path = "../../libafl_cc/" } clap = { version = "3.0.0-rc.4", features = ["default"] } -nix = "0.23.0" +nix = "0.23" mimalloc = { version = "*", default-features = false } [lib] diff --git a/fuzzers/fuzzbench_qemu/Cargo.toml b/fuzzers/fuzzbench_qemu/Cargo.toml index 6182b85cec..b8b5240324 100644 --- a/fuzzers/fuzzbench_qemu/Cargo.toml +++ b/fuzzers/fuzzbench_qemu/Cargo.toml @@ -15,4 +15,4 @@ debug = true libafl = { path = "../../libafl/" } libafl_qemu = { path = "../../libafl_qemu/", features = ["x86_64"] } clap = { version = "3.0.0-rc.4", features = ["default"] } -nix = "0.23.0" +nix = "0.23" diff --git a/libafl/Cargo.toml b/libafl/Cargo.toml index a643145650..34a4520ff3 100644 --- a/libafl/Cargo.toml +++ b/libafl/Cargo.toml @@ -39,7 +39,7 @@ criterion = "0.3" # Benchmarking ahash = "0.7" # another hash fxhash = "0.2.1" # yet another hash xxhash-rust = { version = "0.8.2", features = ["xxh3"] } # xxh3 hashing for rust -serde_json = "1.0.60" +serde_json = "1.0" num_cpus = "1.0" # cpu count, for llmp example serial_test = "0.5" @@ -54,18 +54,18 @@ postcard = { version = "0.7", features = ["alloc"] } # no_std compatible serde s bincode = {version = "1.3", optional = true } static_assertions = "1.1.0" ctor = "0.1.20" -num_enum = { version = "0.5.1", default-features = false } +num_enum = { version = "0.5.4", default-features = false } typed-builder = "0.9.1" # Implement the builder pattern at compiletime ahash = { version = "0.7", default-features=false, features=["compile-time-rng"] } # The hash function already used in hashbrown intervaltree = { version = "0.2.7", default-features = false, features = ["serde"] } libafl_derive = { version = "0.7.0", optional = true, path = "../libafl_derive" } serde_json = { version = "1.0", optional = true, default-features = false, features = ["alloc"] } # an easy way to debug print SerdeAnyMap -miniz_oxide = { version = "0.4.4", optional = true} +miniz_oxide = { version = "0.5", optional = true} core_affinity = { version = "0.5", git = "https://github.com/s1341/core_affinity_rs", rev = "6648a7a", optional = true } hostname = { version = "^0.3", optional = true } # Is there really no gethostname in the stdlib? -rand_core = { version = "0.5.1", optional = true } # This dependency allows us to export our RomuRand as rand::Rng. -nix = { version = "0.23.0", optional = true } +rand_core = { version = "0.5.1", optional = true } # This dependency allows us to export our RomuRand as rand::Rng. We cannot update to the latest version because it breaks compatibility to microsoft lain. +nix = { version = "0.23", optional = true } regex = { version = "1", optional = true } build_id = { version = "0.2.1", git = "https://github.com/domenukk/build_id", rev = "6a61943", optional = true } uuid = { version = "0.8.2", optional = true, features = ["serde", "v4"] } @@ -86,10 +86,10 @@ regex = "1.4.5" backtrace = "0.3" [target.'cfg(windows)'.dependencies] -windows = { version = "0.28.0", features = ["std", "Win32_Foundation", "Win32_System_Threading", "Win32_System_Diagnostics_Debug", "Win32_System_Kernel", "Win32_System_Memory", "Win32_Security"] } +windows = { version = "0.29.0", features = ["std", "Win32_Foundation", "Win32_System_Threading", "Win32_System_Diagnostics_Debug", "Win32_System_Kernel", "Win32_System_Memory", "Win32_Security"] } [target.'cfg(windows)'.build-dependencies] -windows = "0.28.0" +windows = "0.29.0" [[bench]] name = "rand_speeds" diff --git a/libafl/src/bolts/os/mod.rs b/libafl/src/bolts/os/mod.rs index 71394ed988..068865cbae 100644 --- a/libafl/src/bolts/os/mod.rs +++ b/libafl/src/bolts/os/mod.rs @@ -24,8 +24,9 @@ pub mod pipes; #[cfg(all(unix, feature = "std"))] use std::ffi::CString; +// Allow a few extra features we need for the whole module #[cfg(all(windows, feature = "std"))] -#[allow(missing_docs)] +#[allow(missing_docs, overflowing_literals)] pub mod windows_exceptions; #[cfg(unix)] diff --git a/libafl/src/bolts/os/windows_exceptions.rs b/libafl/src/bolts/os/windows_exceptions.rs index a970e0153a..e50152bc21 100644 --- a/libafl/src/bolts/os/windows_exceptions.rs +++ b/libafl/src/bolts/os/windows_exceptions.rs @@ -36,55 +36,55 @@ pub const SIGABRT: i32 = 22; pub const SIGABRT2: i32 = 22; // From https://github.com/wine-mirror/wine/blob/master/include/winnt.h#L611 -pub const STATUS_WAIT_0: u32 = 0x00000000; -pub const STATUS_ABANDONED_WAIT_0: u32 = 0x00000080; -pub const STATUS_USER_APC: u32 = 0x000000C0; -pub const STATUS_TIMEOUT: u32 = 0x00000102; -pub const STATUS_PENDING: u32 = 0x00000103; -pub const STATUS_SEGMENT_NOTIFICATION: u32 = 0x40000005; -pub const STATUS_FATAL_APP_EXIT: u32 = 0x40000015; -pub const STATUS_GUARD_PAGE_VIOLATION: u32 = 0x80000001; -pub const STATUS_DATATYPE_MISALIGNMENT: u32 = 0x80000002; -pub const STATUS_BREAKPOINT: u32 = 0x80000003; -pub const STATUS_SINGLE_STEP: u32 = 0x80000004; -pub const STATUS_LONGJUMP: u32 = 0x80000026; -pub const STATUS_UNWIND_CONSOLIDATE: u32 = 0x80000029; -pub const STATUS_ACCESS_VIOLATION: u32 = 0xC0000005; -pub const STATUS_IN_PAGE_ERROR: u32 = 0xC0000006; -pub const STATUS_INVALID_HANDLE: u32 = 0xC0000008; -pub const STATUS_NO_MEMORY: u32 = 0xC0000017; -pub const STATUS_ILLEGAL_INSTRUCTION: u32 = 0xC000001D; -pub const STATUS_NONCONTINUABLE_EXCEPTION: u32 = 0xC0000025; -pub const STATUS_INVALID_DISPOSITION: u32 = 0xC0000026; -pub const STATUS_ARRAY_BOUNDS_EXCEEDED: u32 = 0xC000008C; -pub const STATUS_FLOAT_DENORMAL_OPERAND: u32 = 0xC000008D; -pub const STATUS_FLOAT_DIVIDE_BY_ZERO: u32 = 0xC000008E; -pub const STATUS_FLOAT_INEXACT_RESULT: u32 = 0xC000008F; -pub const STATUS_FLOAT_INVALID_OPERATION: u32 = 0xC0000090; -pub const STATUS_FLOAT_OVERFLOW: u32 = 0xC0000091; -pub const STATUS_FLOAT_STACK_CHECK: u32 = 0xC0000092; -pub const STATUS_FLOAT_UNDERFLOW: u32 = 0xC0000093; -pub const STATUS_INTEGER_DIVIDE_BY_ZERO: u32 = 0xC0000094; -pub const STATUS_INTEGER_OVERFLOW: u32 = 0xC0000095; -pub const STATUS_PRIVILEGED_INSTRUCTION: u32 = 0xC0000096; -pub const STATUS_STACK_OVERFLOW: u32 = 0xC00000FD; -pub const STATUS_DLL_NOT_FOUND: u32 = 0xC0000135; -pub const STATUS_ORDINAL_NOT_FOUND: u32 = 0xC0000138; -pub const STATUS_ENTRYPOINT_NOT_FOUND: u32 = 0xC0000139; -pub const STATUS_CONTROL_C_EXIT: u32 = 0xC000013A; -pub const STATUS_DLL_INIT_FAILED: u32 = 0xC0000142; -pub const STATUS_FLOAT_MULTIPLE_FAULTS: u32 = 0xC00002B4; -pub const STATUS_FLOAT_MULTIPLE_TRAPS: u32 = 0xC00002B5; -pub const STATUS_REG_NAT_CONSUMPTION: u32 = 0xC00002C9; -pub const STATUS_HEAP_CORRUPTION: u32 = 0xC0000374; -pub const STATUS_STACK_BUFFER_OVERRUN: u32 = 0xC0000409; -pub const STATUS_INVALID_CRUNTIME_PARAMETER: u32 = 0xC0000417; -pub const STATUS_ASSERTION_FAILURE: u32 = 0xC0000420; -pub const STATUS_SXS_EARLY_DEACTIVATION: u32 = 0xC015000F; -pub const STATUS_SXS_INVALID_DEACTIVATION: u32 = 0xC0150010; +pub const STATUS_WAIT_0: i32 = 0x00000000; +pub const STATUS_ABANDONED_WAIT_0: i32 = 0x00000080; +pub const STATUS_USER_APC: i32 = 0x000000C0; +pub const STATUS_TIMEOUT: i32 = 0x00000102; +pub const STATUS_PENDING: i32 = 0x00000103; +pub const STATUS_SEGMENT_NOTIFICATION: i32 = 0x40000005; +pub const STATUS_FATAL_APP_EXIT: i32 = 0x40000015; +pub const STATUS_GUARD_PAGE_VIOLATION: i32 = 0x80000001; +pub const STATUS_DATATYPE_MISALIGNMENT: i32 = 0x80000002; +pub const STATUS_BREAKPOINT: i32 = 0x80000003; +pub const STATUS_SINGLE_STEP: i32 = 0x80000004; +pub const STATUS_LONGJUMP: i32 = 0x80000026; +pub const STATUS_UNWIND_CONSOLIDATE: i32 = 0x80000029; +pub const STATUS_ACCESS_VIOLATION: i32 = 0xC0000005; +pub const STATUS_IN_PAGE_ERROR: i32 = 0xC0000006; +pub const STATUS_INVALID_HANDLE: i32 = 0xC0000008; +pub const STATUS_NO_MEMORY: i32 = 0xC0000017; +pub const STATUS_ILLEGAL_INSTRUCTION: i32 = 0xC000001D; +pub const STATUS_NONCONTINUABLE_EXCEPTION: i32 = 0xC0000025; +pub const STATUS_INVALID_DISPOSITION: i32 = 0xC0000026; +pub const STATUS_ARRAY_BOUNDS_EXCEEDED: i32 = 0xC000008C; +pub const STATUS_FLOAT_DENORMAL_OPERAND: i32 = 0xC000008D; +pub const STATUS_FLOAT_DIVIDE_BY_ZERO: i32 = 0xC000008E; +pub const STATUS_FLOAT_INEXACT_RESULT: i32 = 0xC000008F; +pub const STATUS_FLOAT_INVALID_OPERATION: i32 = 0xC0000090; +pub const STATUS_FLOAT_OVERFLOW: i32 = 0xC0000091; +pub const STATUS_FLOAT_STACK_CHECK: i32 = 0xC0000092; +pub const STATUS_FLOAT_UNDERFLOW: i32 = 0xC0000093; +pub const STATUS_INTEGER_DIVIDE_BY_ZERO: i32 = 0xC0000094; +pub const STATUS_INTEGER_OVERFLOW: i32 = 0xC0000095; +pub const STATUS_PRIVILEGED_INSTRUCTION: i32 = 0xC0000096; +pub const STATUS_STACK_OVERFLOW: i32 = 0xC00000FD; +pub const STATUS_DLL_NOT_FOUND: i32 = 0xC0000135; +pub const STATUS_ORDINAL_NOT_FOUND: i32 = 0xC0000138; +pub const STATUS_ENTRYPOINT_NOT_FOUND: i32 = 0xC0000139; +pub const STATUS_CONTROL_C_EXIT: i32 = 0xC000013A; +pub const STATUS_DLL_INIT_FAILED: i32 = 0xC0000142; +pub const STATUS_FLOAT_MULTIPLE_FAULTS: i32 = 0xC00002B4; +pub const STATUS_FLOAT_MULTIPLE_TRAPS: i32 = 0xC00002B5; +pub const STATUS_REG_NAT_CONSUMPTION: i32 = 0xC00002C9; +pub const STATUS_HEAP_CORRUPTION: i32 = 0xC0000374; +pub const STATUS_STACK_BUFFER_OVERRUN: i32 = 0xC0000409; +pub const STATUS_INVALID_CRUNTIME_PARAMETER: i32 = 0xC0000417; +pub const STATUS_ASSERTION_FAILURE: i32 = 0xC0000420; +pub const STATUS_SXS_EARLY_DEACTIVATION: i32 = 0xC015000F; +pub const STATUS_SXS_INVALID_DEACTIVATION: i32 = 0xC0150010; #[derive(Debug, TryFromPrimitive, Clone, Copy)] -#[repr(u32)] +#[repr(i32)] pub enum ExceptionCode { // From https://docs.microsoft.com/en-us/windows/win32/debug/getexceptioncode AccessViolation = STATUS_ACCESS_VIOLATION, @@ -157,7 +157,7 @@ pub static CRASH_EXCEPTIONS: &[ExceptionCode] = &[ impl PartialEq for ExceptionCode { fn eq(&self, other: &Self) -> bool { - *self as u32 == *other as u32 + *self as i32 == *other as i32 } } diff --git a/libafl/src/bolts/shmem.rs b/libafl/src/bolts/shmem.rs index 51f9d3befc..83f9c7048f 100644 --- a/libafl/src/bolts/shmem.rs +++ b/libafl/src/bolts/shmem.rs @@ -1071,7 +1071,11 @@ pub mod win32_shmem { Error, }; - use core::{ffi::c_void, ptr, slice}; + use core::{ + ffi::c_void, + fmt::{self, Debug, Formatter}, + ptr, slice, + }; use std::convert::TryInto; use uuid::Uuid; @@ -1086,7 +1090,7 @@ pub mod win32_shmem { }; /// The default Sharedmap impl for windows using shmctl & shmget - #[derive(Clone, Debug)] + #[derive(Clone)] pub struct Win32ShMem { id: ShMemId, handle: HANDLE, @@ -1094,6 +1098,17 @@ pub mod win32_shmem { map_size: usize, } + impl Debug for Win32ShMem { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.debug_struct("Win32ShMem") + .field("id", &self.id) + .field("handle", &self.handle.0) + .field("map", &self.map) + .field("map_size", &self.map_size) + .finish() + } + } + impl Win32ShMem { fn new_map(map_size: usize) -> Result { unsafe { @@ -1137,7 +1152,7 @@ pub mod win32_shmem { let map_str_bytes = id.id; // Unlike MapViewOfFile this one needs u32 let handle = OpenFileMappingA( - FILE_MAP_ALL_ACCESS.0, + FILE_MAP_ALL_ACCESS, BOOL(0), PSTR(&map_str_bytes as *const u8 as *mut u8), ); diff --git a/libafl_frida/Cargo.toml b/libafl_frida/Cargo.toml index a862bdbe05..3aef9c2849 100644 --- a/libafl_frida/Cargo.toml +++ b/libafl_frida/Cargo.toml @@ -21,16 +21,16 @@ cc = { version = "1.0", features = ["parallel"] } [dependencies] libafl = { path = "../libafl", version = "0.7.0", features = ["std", "libafl_derive"] } libafl_targets = { path = "../libafl_targets", version = "0.7.0", features = ["std", "sancov_cmplog"] } -nix = "0.23.0" +nix = "0.23" libc = "0.2" hashbrown = "0.11" -libloading = "0.7.0" -rangemap = "0.1.10" +libloading = "0.7" +rangemap = "0.1" frida-gum-sys = { version = "0.3", features = [ "auto-download", "event-sink", "invocation-listener"] } frida-gum = { version = "0.6.1", features = [ "auto-download", "event-sink", "invocation-listener"] } core_affinity = { version = "0.5", git = "https://github.com/s1341/core_affinity_rs", rev = "6648a7a" } regex = "1.4" -dynasmrt = "1.0.1" +dynasmrt = "1.2" capstone = "0.10.0" color-backtrace ={ version = "0.5", features = [ "resolve-modules" ] } termcolor = "1.1.2" diff --git a/libafl_qemu/Cargo.toml b/libafl_qemu/Cargo.toml index 135df1cfaf..ce838ff875 100644 --- a/libafl_qemu/Cargo.toml +++ b/libafl_qemu/Cargo.toml @@ -26,9 +26,9 @@ clippy = [] # special feature for clippy, don't use in normal projects§ libafl = { path = "../libafl", version = "0.7.0" } libafl_targets = { path = "../libafl_targets", version = "0.7.0" } serde = { version = "1.0", default-features = false, features = ["alloc"] } # serialization lib -hashbrown = { version = "0.9", features = ["serde", "ahash-compile-time-rng"] } # A faster hashmap, nostd compatible +hashbrown = { version = "0.11", features = ["serde", "ahash-compile-time-rng"] } # A faster hashmap, nostd compatible num-traits = "0.2" -num_enum = "0.5.1" +num_enum = "0.5.4" goblin = "0.4.2" libc = "0.2" strum = "0.21" @@ -40,7 +40,7 @@ pyo3 = { version = "0.15", optional = true } [build-dependencies] cc = { version = "1.0" } which = "4.1" -pyo3-build-config = { version = "0.14.5", optional = true } +pyo3-build-config = { version = "0.15", optional = true } [lib] name = "libafl_qemu" diff --git a/libafl_sugar/Cargo.toml b/libafl_sugar/Cargo.toml index cece221df0..4c0f4fc65c 100644 --- a/libafl_sugar/Cargo.toml +++ b/libafl_sugar/Cargo.toml @@ -23,7 +23,7 @@ arm = ["libafl_qemu/arm"] # build qemu for arm aarch64 = ["libafl_qemu/aarch64"] # build qemu for aarch64 [build-dependencies] -pyo3-build-config = { version = "0.14.5", optional = true } +pyo3-build-config = { version = "0.15", optional = true } [dependencies] libafl = { path = "../libafl", version = "0.7.0" } diff --git a/libafl_targets/Cargo.toml b/libafl_targets/Cargo.toml index 6168b13539..01f635388e 100644 --- a/libafl_targets/Cargo.toml +++ b/libafl_targets/Cargo.toml @@ -27,7 +27,7 @@ clippy = [] # Ignore compiler warnings during clippy cc = { version = "1.0", features = ["parallel"] } [dependencies] -rangemap = "0.1.10" +rangemap = "0.1" libafl = { path = "../libafl", version = "0.7.0", features = [] } serde = { version = "1.0", default-features = false, features = ["alloc"] } # serialization lib # serde-big-array = "0.3.2"