Replace uses std HashMap with hashbrown for consistency (#2387)

* Replace uses std HashMap with hashbrown for consistency

* fix

* more fix

* Hashbrownify libfuzzer_runtime

* more
This commit is contained in:
Dominik Maier 2024-07-12 17:42:07 +02:00 committed by GitHub
parent 7feeb00546
commit 79cbc16800
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 25 additions and 30 deletions

View File

@ -1,6 +1,7 @@
use alloc::vec::Vec;
use std::{collections::HashSet, mem};
use core::mem;
use hashbrown::HashSet;
use libafl_bolts::{rands::Rand, Error};
use crate::common::nautilus::grammartec::{
@ -310,8 +311,9 @@ mod tests {
string::{String, ToString},
vec::Vec,
};
use std::{collections::HashSet, str};
use core::str;
use hashbrown::HashSet;
use libafl_bolts::rands::StdRand;
use crate::{

View File

@ -1,6 +1,7 @@
use alloc::vec::Vec;
use std::{cmp, collections::HashSet, io, io::Write, marker::Sized};
use std::{cmp, io, io::Write, marker::Sized};
use hashbrown::HashSet;
use libafl_bolts::rands::Rand;
use pyo3::{
prelude::{PyObject, PyResult, Python},

View File

@ -6,8 +6,6 @@
#[cfg(target_arch = "aarch64")]
use core::ffi::c_void;
#[cfg(all(feature = "cmplog", target_arch = "x86_64"))]
use std::collections::HashMap;
use std::rc::Rc;
use dynasmrt::dynasm;
@ -23,6 +21,8 @@ use frida_gum::{
};
use frida_gum_sys::Insn;
#[cfg(all(feature = "cmplog", target_arch = "x86_64"))]
use hashbrown::HashMap;
#[cfg(all(feature = "cmplog", target_arch = "x86_64"))]
use iced_x86::{
BlockEncoder, Code, DecoderOptions, Instruction, InstructionBlock, MemoryOperand, MemorySize,
OpKind, Register,

View File

@ -42,6 +42,7 @@ mimalloc = { version = "0.1.34", default-features = false }
num-traits = "0.2.15"
rand = "0.8.5"
serde = { version = "1.0", features = ["derive"] } # serialization lib
hashbrown = "0.14"
# for identifying if we can grimoire-ify
utf8-chars = "3.0.1"

View File

@ -0,0 +1,2 @@
group_imports = "StdExternalCrate"
imports_granularity = "Crate"

View File

@ -1,11 +1,12 @@
use std::{
cell::RefCell,
collections::{hash_map::Entry, BTreeMap, HashMap},
collections::BTreeMap,
io::ErrorKind,
path::PathBuf,
sync::atomic::{AtomicU64, Ordering},
};
use hashbrown::{hash_map::Entry, HashMap};
use libafl::{
corpus::{
inmemory::{TestcaseStorage, TestcaseStorageMap},

View File

@ -1,8 +1,6 @@
use std::{
collections::{HashSet, VecDeque},
path::PathBuf,
};
use std::{collections::VecDeque, path::PathBuf};
use hashbrown::HashSet;
use libafl::{Error, HasMetadata};
use libafl_bolts::impl_serdeany;
use serde::{Deserialize, Serialize};

View File

@ -1,8 +1,6 @@
use std::{
collections::{BTreeSet, HashMap},
marker::PhantomData,
};
use std::{collections::BTreeSet, marker::PhantomData};
use hashbrown::HashMap;
use libafl::{
corpus::{Corpus, CorpusId, Testcase},
feedbacks::MapNoveltiesMetadata,

View File

@ -1,5 +1,3 @@
#[cfg(emulation_mode = "systemmode")]
use std::collections::HashSet;
use std::{
fmt::{Debug, Display, Error, Formatter},
rc::Rc,
@ -7,6 +5,8 @@ use std::{
use enum_map::{Enum, EnumMap};
use hashbrown::HashMap;
#[cfg(emulation_mode = "systemmode")]
use hashbrown::HashSet;
use libafl::{
executors::ExitKind,
inputs::HasTargetBytes,

View File

@ -1,13 +1,8 @@
#![allow(clippy::cast_possible_wrap)]
use std::{
borrow::Cow,
collections::{HashMap, HashSet},
env, fs,
path::PathBuf,
sync::Mutex,
};
use std::{borrow::Cow, env, fs, path::PathBuf, sync::Mutex};
use hashbrown::{HashMap, HashSet};
use libafl::{executors::ExitKind, inputs::UsesInput, observers::ObserversTuple, HasMetadata};
use libc::{
c_void, MAP_ANON, MAP_FAILED, MAP_FIXED, MAP_NORESERVE, MAP_PRIVATE, PROT_READ, PROT_WRITE,

View File

@ -1,6 +1,7 @@
use core::{fmt::Debug, ops::Range};
use std::{cell::UnsafeCell, collections::HashSet, hash::BuildHasher};
use std::{cell::UnsafeCell, hash::BuildHasher};
use hashbrown::HashSet;
use libafl::{executors::ExitKind, inputs::UsesInput, observers::ObserversTuple};
use libafl_bolts::tuples::{MatchFirstType, SplitBorrowExtractFirstType};
use libafl_qemu_sys::{GuestAddr, GuestPhysAddr};

View File

@ -1,10 +1,6 @@
use std::{
cell::UnsafeCell,
collections::{HashMap, HashSet},
mem::MaybeUninit,
sync::Mutex,
};
use std::{cell::UnsafeCell, mem::MaybeUninit, sync::Mutex};
use hashbrown::{HashMap, HashSet};
use libafl::{inputs::UsesInput, HasMetadata};
use libafl_qemu_sys::{GuestAddr, MmapPerms};
use meminterval::{Interval, IntervalTree};