Remove dependencies, add doc.rs metadata (#1450)
* Remove dependency, add doc.rs metadata * remove lazy_static * even less lazy_static * serial_test no default
This commit is contained in:
parent
c84c105fb9
commit
e89e8dbaab
@ -21,4 +21,4 @@ debug = true
|
||||
[dependencies]
|
||||
libafl = { path = "../../libafl/" }
|
||||
libafl_bolts = { path = "../../libafl_bolts/" }
|
||||
postcard = "0.7"
|
||||
postcard = { version = "1.0", features = ["alloc"], default-features = false } # no_std compatible serde serialization format
|
@ -11,6 +11,9 @@ keywords = ["fuzzing", "testing", "security"]
|
||||
edition = "2021"
|
||||
categories = ["development-tools::testing", "emulators", "embedded", "os", "no-std"]
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
||||
[features]
|
||||
default = ["std", "derive", "llmp_compression", "llmp_small_maps", "llmp_broker_timeouts", "rand_trait", "fork", "prelude", "gzip", "regex", "serdeany_autoreg", "tui_monitor"]
|
||||
std = ["serde_json", "serde_json/std", "nix", "serde/std", "bincode", "wait-timeout", "uuid", "backtrace", "serial_test", "libafl_bolts/std", "typed-builder"] # print, env, launcher ... support
|
||||
@ -102,7 +105,7 @@ concat-idents = { version = "1.1.3", optional = true }
|
||||
libcasr = { version = "2.7", optional = true}
|
||||
|
||||
# optional-dev deps (change when target.'cfg(accessible(::std))'.test-dependencies will be stable)
|
||||
serial_test = { version = "2", optional = true }
|
||||
serial_test = { version = "2", optional = true, default-features = false, features = ["logging"] }
|
||||
|
||||
# AGPL
|
||||
# !!! this create requires nightly
|
||||
|
@ -30,6 +30,7 @@ pub trait HashSetState<T> {
|
||||
|
||||
/// The state of [`NewHashFeedback`]
|
||||
#[derive(Default, Serialize, Deserialize, Clone, Debug)]
|
||||
#[allow(clippy::unsafe_derive_deserialize)]
|
||||
pub struct NewHashFeedbackMetadata {
|
||||
/// Contains information about untouched entries
|
||||
pub hash_set: HashSet<u64>,
|
||||
|
@ -6,6 +6,7 @@ use crate::observers::concolic::{serialization_format::MessageFileReader, SymExp
|
||||
|
||||
/// A metadata holding a buffer of a concolic trace.
|
||||
#[derive(Default, Serialize, Deserialize, Debug)]
|
||||
#[allow(clippy::unsafe_derive_deserialize)]
|
||||
pub struct ConcolicMetadata {
|
||||
/// Constraints data
|
||||
buffer: Vec<u8>,
|
||||
|
@ -11,9 +11,12 @@ keywords = ["fuzzing", "testing", "security"]
|
||||
edition = "2021"
|
||||
categories = ["development-tools::testing", "emulators", "embedded", "os", "no-std"]
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
||||
[features]
|
||||
default = ["std", "derive", "llmp_compression", "llmp_small_maps", "rand_trait", "prelude", "gzip", "serdeany_autoreg", "alloc"]
|
||||
std = ["serde_json", "serde_json/std", "hostname", "nix", "serde/std", "uuid", "byteorder", "backtrace", "uds", "serial_test", "alloc"] # print, env, ... support
|
||||
std = ["serde_json", "serde_json/std", "hostname", "nix", "serde/std", "uuid", "backtrace", "uds", "serial_test", "alloc"] # print, env, ... support
|
||||
alloc = ["serde/alloc", "hashbrown", "postcard", "erased-serde/alloc", "ahash"] # Enables all features that allocate in no_std
|
||||
derive = ["libafl_derive"] # provide derive(SerdeAny) macro.
|
||||
rand_trait = ["rand_core"] # If set, libafl's rand implementations will implement `rand::Rng`
|
||||
@ -62,18 +65,17 @@ hostname = { version = "^0.3", optional = true } # Is there really no gethostnam
|
||||
rand_core = { version = "0.6", optional = true }
|
||||
nix = { version = "0.26", optional = true }
|
||||
uuid = { version = "1.4", optional = true, features = ["serde", "v4"] }
|
||||
byteorder = { version = "1.4", optional = true }
|
||||
clap = {version = "4.0", features = ["derive", "wrap_help"], optional = true} # CLI parsing, for libafl_bolts::cli / the `cli` feature
|
||||
log = "0.4.20"
|
||||
|
||||
pyo3 = { version = "0.18.3", optional = true, features = ["serde", "macros"] }
|
||||
|
||||
# optional-dev deps (change when target.'cfg(accessible(::std))'.test-dependencies will be stable)
|
||||
serial_test = { version = "2", optional = true }
|
||||
serial_test = { version = "2", optional = true, default-features = false, features = ["logging"] }
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
libc = "0.2" # For (*nix) libc
|
||||
uds = { version = "0.4", optional = true, default_features = false }
|
||||
uds = { version = "0.4", optional = true, default-features = false }
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
windows = { version = "0.51.1", features = ["Win32_Foundation", "Win32_System_Threading", "Win32_System_Diagnostics_Debug", "Win32_System_Kernel", "Win32_System_Memory", "Win32_Security", "Win32_System_SystemInformation"] }
|
||||
|
@ -87,9 +87,10 @@ fn calculate() -> Uuid {
|
||||
let mut hasher = from_type_id(hasher);
|
||||
|
||||
let mut bytes = [0; 16];
|
||||
<byteorder::NativeEndian as byteorder::ByteOrder>::write_u64(&mut bytes[..8], hasher.finish());
|
||||
bytes[..8].copy_from_slice(&hasher.finish().to_ne_bytes());
|
||||
|
||||
hasher.write_u8(0);
|
||||
<byteorder::NativeEndian as byteorder::ByteOrder>::write_u64(&mut bytes[8..], hasher.finish());
|
||||
bytes[8..].copy_from_slice(&hasher.finish().to_ne_bytes());
|
||||
|
||||
*uuid::Builder::from_bytes(bytes)
|
||||
.set_variant(uuid::Variant::RFC4122)
|
||||
|
@ -13,6 +13,9 @@ categories = ["development-tools::testing", "emulators", "embedded", "os", "no-s
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
||||
[features]
|
||||
default = ["build", "clone"]
|
||||
build = ["which", "cmake"] # common functionality to build symcc
|
||||
|
@ -14,6 +14,9 @@ categories = ["development-tools::testing", "emulators", "embedded", "os", "no-s
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
||||
[features]
|
||||
# skips building and linking the C++ part of the runtime
|
||||
no-cpp-runtime = []
|
||||
@ -22,13 +25,12 @@ no-cpp-runtime = []
|
||||
unchecked_unwrap = "4"
|
||||
ctor = "0.2"
|
||||
libc = "0.2"
|
||||
libafl = { path = "../../libafl", version = "0.10.1", default-features=false, features=["std"] }
|
||||
libafl_bolts = { path = "../../libafl_bolts", version = "0.10.1", default-features=false, features=["std"] }
|
||||
libafl = { path = "../../libafl", version = "0.10.1", default-features=false, features=["std", "serdeany_autoreg"] }
|
||||
libafl_bolts = { path = "../../libafl_bolts", version = "0.10.1", default-features=false, features=["std", "serdeany_autoreg"] }
|
||||
|
||||
[build-dependencies]
|
||||
cmake = "0.1"
|
||||
bindgen = "0.63"
|
||||
regex = "1"
|
||||
lazy_static = "1.4"
|
||||
which = "4.4"
|
||||
symcc_libafl = { path = "../symcc_libafl", version = "0.10.1" }
|
||||
|
@ -1,4 +1,5 @@
|
||||
use std::{
|
||||
cell::RefCell,
|
||||
env,
|
||||
fs::File,
|
||||
io::Write,
|
||||
@ -6,18 +7,17 @@ use std::{
|
||||
process::exit,
|
||||
};
|
||||
|
||||
use lazy_static::lazy_static;
|
||||
use regex::{Regex, RegexBuilder};
|
||||
use symcc_libafl::clone_symcc;
|
||||
|
||||
const SYMCC_RUNTIME_FUNCTION_NAME_PREFIX: &str = "_cpp_";
|
||||
|
||||
lazy_static! {
|
||||
static ref FUNCTION_NAME_REGEX: Regex = Regex::new(r"pub fn (\w+)").unwrap();
|
||||
static ref EXPORTED_FUNCTION_REGEX: Regex = RegexBuilder::new(r"(pub fn \w+\([^\)]*\)[^;]*);")
|
||||
thread_local! {
|
||||
static FUNCTION_NAME_REGEX: RefCell<Regex> = RefCell::new(Regex::new(r"pub fn (\w+)").unwrap());
|
||||
static EXPORTED_FUNCTION_REGEX: RefCell<Regex> = RefCell::new(RegexBuilder::new(r"(pub fn \w+\([^\)]*\)[^;]*);")
|
||||
.multi_line(true)
|
||||
.build()
|
||||
.unwrap();
|
||||
.unwrap());
|
||||
}
|
||||
|
||||
fn main() {
|
||||
@ -88,7 +88,8 @@ fn write_cpp_function_export_macro(out_path: &Path, cpp_bindings: &bindgen::Bind
|
||||
() => {{",
|
||||
)
|
||||
.unwrap();
|
||||
EXPORTED_FUNCTION_REGEX
|
||||
EXPORTED_FUNCTION_REGEX.with(|x| {
|
||||
x.borrow()
|
||||
.captures_iter(&cpp_bindings.to_string())
|
||||
.for_each(|captures| {
|
||||
writeln!(
|
||||
@ -98,6 +99,7 @@ fn write_cpp_function_export_macro(out_path: &Path, cpp_bindings: &bindgen::Bind
|
||||
)
|
||||
.unwrap();
|
||||
});
|
||||
});
|
||||
writeln!(
|
||||
macro_file,
|
||||
" }};
|
||||
@ -156,17 +158,21 @@ fn write_rust_runtime_macro_file(out_path: &Path, symcc_src_path: &Path) {
|
||||
($macro:path; $($extra_ident:path),*) => {{",
|
||||
)
|
||||
.unwrap();
|
||||
EXPORTED_FUNCTION_REGEX
|
||||
EXPORTED_FUNCTION_REGEX.with(|x| {
|
||||
x.borrow()
|
||||
.captures_iter(&rust_bindings.to_string())
|
||||
.for_each(|captures| {
|
||||
writeln!(
|
||||
rust_runtime_macro,
|
||||
" $macro!({},{}; $($extra_ident),*);",
|
||||
&captures[1].replace("_rsym_", ""),
|
||||
&FUNCTION_NAME_REGEX.captures(&captures[1]).unwrap()[1]
|
||||
&FUNCTION_NAME_REGEX
|
||||
.with(|x| x.borrow().captures(&captures[1]))
|
||||
.unwrap()[1]
|
||||
)
|
||||
.unwrap();
|
||||
});
|
||||
});
|
||||
writeln!(
|
||||
rust_runtime_macro,
|
||||
" }};
|
||||
@ -178,7 +184,7 @@ fn write_rust_runtime_macro_file(out_path: &Path, symcc_src_path: &Path) {
|
||||
fn write_symcc_runtime_bindings_file(out_path: &Path, cpp_bindings: &bindgen::Bindings) {
|
||||
let mut bindings_file = File::create(out_path.join("bindings.rs")).unwrap();
|
||||
cpp_bindings.to_string().lines().for_each(|l| {
|
||||
if let Some(captures) = FUNCTION_NAME_REGEX.captures(l) {
|
||||
if let Some(captures) = FUNCTION_NAME_REGEX.with(|x| x.borrow().captures(l)) {
|
||||
let function_name = &captures[1];
|
||||
writeln!(
|
||||
bindings_file,
|
||||
@ -202,7 +208,7 @@ fn write_symcc_rename_header(rename_header_path: &Path, cpp_bindings: &bindgen::
|
||||
cpp_bindings
|
||||
.to_string()
|
||||
.lines()
|
||||
.filter_map(|l| FUNCTION_NAME_REGEX.captures(l))
|
||||
.filter_map(|l| FUNCTION_NAME_REGEX.with(|x| x.borrow().captures(l)))
|
||||
.map(|captures| captures[1].to_string())
|
||||
.for_each(|val| {
|
||||
writeln!(
|
||||
|
@ -17,6 +17,9 @@ categories = [
|
||||
"no-std"
|
||||
]
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
||||
[features]
|
||||
default = ["serdeany_autoreg"]
|
||||
cmplog = []
|
||||
@ -71,4 +74,4 @@ paste = "1.0"
|
||||
log = "0.4.20"
|
||||
|
||||
[dev-dependencies]
|
||||
serial_test = "1"
|
||||
serial_test = { version = "2", default-features = false, features = ["logging"] }
|
||||
|
@ -11,6 +11,9 @@ keywords = ["fuzzing", "qemu", "instrumentation"]
|
||||
edition = "2021"
|
||||
categories = ["development-tools::testing", "emulators", "embedded", "os", "no-std"]
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
||||
[features]
|
||||
default = ["fork", "build_libqasan", "serdeany_autoreg"]
|
||||
python = ["pyo3", "pyo3-build-config"]
|
||||
|
@ -17,6 +17,9 @@ categories = [
|
||||
"no-std",
|
||||
]
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
||||
[features]
|
||||
slirp = [] # build qemu with host libslirp (for user networking)
|
||||
|
||||
|
@ -11,6 +11,9 @@ keywords = ["fuzzing", "qemu", "instrumentation"]
|
||||
edition = "2021"
|
||||
categories = ["development-tools::testing", "emulators", "embedded", "os", "no-std"]
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
||||
[features]
|
||||
# The following architecture features are mutually exclusive.
|
||||
x86_64 = [] # build qemu for x86_64 (default)
|
||||
|
@ -12,6 +12,9 @@ edition = "2021"
|
||||
build = "build.rs"
|
||||
categories = ["development-tools::testing", "emulators", "embedded", "os", "no-std"]
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
||||
[features]
|
||||
python = ["pyo3", "libafl_qemu/python", "pyo3-build-config"]
|
||||
default = []
|
||||
|
@ -12,6 +12,9 @@ edition = "2021"
|
||||
categories = ["development-tools::testing", "emulators", "embedded", "os", "no-std"]
|
||||
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
||||
[features]
|
||||
default = ["std", "sanitizers_flags"]
|
||||
std = ["libafl/std"]
|
||||
|
@ -15,10 +15,9 @@ categories = ["development-tools::testing", "emulators", "embedded", "os", "no-s
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
libafl = { path = "../../../libafl" }
|
||||
serde_json = "1.0"
|
||||
regex = "1"
|
||||
postcard = "1.0"
|
||||
lazy_static = "1.4.0"
|
||||
libafl = { path = "../../../libafl" }
|
||||
postcard = { version = "1.0", features = ["alloc"], default-features = false } # no_std compatible serde serialization format
|
||||
clap = { version = "4.0", features = ["derive"] }
|
||||
log = "0.4.20"
|
||||
|
@ -4,14 +4,16 @@ use std::{
|
||||
io::{BufReader, Write},
|
||||
path::{Path, PathBuf},
|
||||
rc::Rc,
|
||||
sync::OnceLock,
|
||||
};
|
||||
|
||||
use clap::{self, Parser};
|
||||
use lazy_static::lazy_static;
|
||||
use libafl::generators::gramatron::{Automaton, Trigger};
|
||||
use regex::Regex;
|
||||
use serde_json::Value;
|
||||
|
||||
static RE: OnceLock<Regex> = OnceLock::new();
|
||||
|
||||
#[derive(Debug, Parser)]
|
||||
#[command(
|
||||
name = "construct_automata",
|
||||
@ -69,10 +71,8 @@ struct Stacks {
|
||||
}
|
||||
|
||||
fn tokenize(rule: &str) -> (String, Vec<String>, bool) {
|
||||
lazy_static! {
|
||||
static ref RE: Regex = Regex::new(r"([r])*'([\s\S]+)'([\s\S]*)").unwrap();
|
||||
}
|
||||
let cap = RE.captures(rule).unwrap();
|
||||
let re = RE.get_or_init(|| Regex::new(r"([r])*'([\s\S]+)'([\s\S]*)").unwrap());
|
||||
let cap = re.captures(rule).unwrap();
|
||||
let is_regex = cap.get(1).is_some();
|
||||
let terminal = cap.get(2).unwrap().as_str().to_owned();
|
||||
let ss = cap.get(3).map_or(vec![], |m| {
|
||||
|
Loading…
x
Reference in New Issue
Block a user