From b37e2825934ee6fefa1d5c4596dc2e7b1f152cc2 Mon Sep 17 00:00:00 2001 From: wcampbell Date: Sun, 14 Apr 2024 00:27:48 -0400 Subject: [PATCH] fuzz: Use mimalloc --- fuzz/Cargo.lock | 41 ++++++++++++++++++++++++--------- fuzz/Cargo.toml | 1 + fuzz/fuzz_targets/filesystem.rs | 5 ++++ 3 files changed, 36 insertions(+), 11 deletions(-) diff --git a/fuzz/Cargo.lock b/fuzz/Cargo.lock index 99cc18b8..1c37b9c5 100644 --- a/fuzz/Cargo.lock +++ b/fuzz/Cargo.lock @@ -39,6 +39,7 @@ version = "0.0.0" dependencies = [ "backhand", "libafl_libfuzzer", + "mimalloc", ] [[package]] @@ -225,6 +226,16 @@ dependencies = [ "once_cell", ] +[[package]] +name = "libmimalloc-sys" +version = "0.1.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3979b5c37ece694f1f5e51e7ecc871fdb0f517ed04ee45f88d15d6d553cb9664" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "litrs" version = "0.4.1" @@ -248,6 +259,15 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +[[package]] +name = "mimalloc" +version = "0.1.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa01922b5ea280a911e323e4d2fd24b7fe5cc4042e0d2cda3c40775cdc4bdc9c" +dependencies = [ + "libmimalloc-sys", +] + [[package]] name = "miniz_oxide" version = "0.7.1" @@ -366,18 +386,18 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "thiserror" -version = "1.0.57" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" +checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.57" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" +checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2", "quote", @@ -458,29 +478,28 @@ dependencies = [ [[package]] name = "zstd" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bffb3309596d527cfcba7dfc6ed6052f1d39dfbd7c867aa2e865e4a449c10110" +checksum = "2d789b1514203a1120ad2429eae43a7bd32b90976a7bb8a05f7ec02fa88cc23a" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "7.0.0" +version = "7.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43747c7422e2924c11144d5229878b98180ef8b06cca4ab5af37afc8a8d8ea3e" +checksum = "1cd99b45c6bc03a018c8b8a86025678c87e55526064e38f9df301989dce7ec0a" dependencies = [ "zstd-sys", ] [[package]] name = "zstd-sys" -version = "2.0.8+zstd.1.5.5" +version = "2.0.10+zstd.1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5556e6ee25d32df2586c098bbfa278803692a20d0ab9565e049480d52707ec8c" +checksum = "c253a4914af5bafc8fa8c86ee400827e83cf6ec01195ec1f1ed8441bf00d65aa" dependencies = [ "cc", - "libc", "pkg-config", ] diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index 974f4d55..dd71c18c 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -10,6 +10,7 @@ cargo-fuzz = true [dependencies] # libfuzzer-sys = "0.4" libfuzzer-sys = { git = "https://github.com/AFLplusplus/LibAFL.git", branch = "libfuzzer-best", package = "libafl_libfuzzer" } +mimalloc = { version = "*", default-features = false } [dependencies.backhand] path = "../backhand" diff --git a/fuzz/fuzz_targets/filesystem.rs b/fuzz/fuzz_targets/filesystem.rs index 07955cf2..98b262d7 100644 --- a/fuzz/fuzz_targets/filesystem.rs +++ b/fuzz/fuzz_targets/filesystem.rs @@ -1,5 +1,10 @@ #![no_main] +use mimalloc::MiMalloc; + +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + use backhand::FilesystemReader; use libfuzzer_sys::fuzz_target;