Moved to no_std preamble (#643)
* Moved to no_std preamble * fixed use * no_std targets * derive no_std * fix yml * ci * alf * gitignore * fix python build * import cleanup * nostd * linux fix
This commit is contained in:
parent
5887d1a7b7
commit
763ed9a3e5
6
.github/workflows/build_and_test.yml
vendored
6
.github/workflows/build_and_test.yml
vendored
@ -38,6 +38,10 @@ jobs:
|
|||||||
run: cargo test
|
run: cargo test
|
||||||
- name: Test libafl no_std
|
- name: Test libafl no_std
|
||||||
run: cd libafl && cargo test --no-default-features
|
run: cd libafl && cargo test --no-default-features
|
||||||
|
- name: Test libafl_targets no_std
|
||||||
|
run: cd libafl_targets && cargo test --no-default-features
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ubuntu:
|
ubuntu:
|
||||||
@ -171,7 +175,7 @@ jobs:
|
|||||||
run: cd ./fuzzers/baby_no_std && cargo +nightly run || test $? -ne 0 || exit 1
|
run: cd ./fuzzers/baby_no_std && cargo +nightly run || test $? -ne 0 || exit 1
|
||||||
- name: no_std tests
|
- name: no_std tests
|
||||||
run: cd ./libafl && cargo test --no-default-features
|
run: cd ./libafl && cargo test --no-default-features
|
||||||
- name: armv6m-none-eabi (32 bit no_std) clippy
|
- name: libafl armv6m-none-eabi (32 bit no_std) clippy
|
||||||
run: cd ./libafl && cargo clippy --target thumbv6m-none-eabi --no-default-features
|
run: cd ./libafl && cargo clippy --target thumbv6m-none-eabi --no-default-features
|
||||||
build-docker:
|
build-docker:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -42,3 +42,5 @@ a
|
|||||||
forkserver_test
|
forkserver_test
|
||||||
__pycache__
|
__pycache__
|
||||||
*.lafl_lock
|
*.lafl_lock
|
||||||
|
|
||||||
|
*atomic_file_testfile*
|
||||||
|
@ -63,13 +63,17 @@
|
|||||||
//! }
|
//! }
|
||||||
//!```
|
//!```
|
||||||
|
|
||||||
|
#[cfg(feature = "frida_cli")]
|
||||||
|
use alloc::boxed::Box;
|
||||||
|
use alloc::{
|
||||||
|
string::{String, ToString},
|
||||||
|
vec::Vec,
|
||||||
|
};
|
||||||
use clap::{Command, CommandFactory, Parser};
|
use clap::{Command, CommandFactory, Parser};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
#[cfg(feature = "frida_cli")]
|
#[cfg(feature = "frida_cli")]
|
||||||
use std::error;
|
use std::error;
|
||||||
use std::net::SocketAddr;
|
use std::{net::SocketAddr, path::PathBuf, time::Duration};
|
||||||
use std::path::PathBuf;
|
|
||||||
use std::time::Duration;
|
|
||||||
|
|
||||||
use super::os::Cores;
|
use super::os::Cores;
|
||||||
use crate::Error;
|
use crate::Error;
|
||||||
@ -367,6 +371,8 @@ pub fn parse_args() -> FuzzerOptions {
|
|||||||
))]
|
))]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
#[cfg(feature = "frida_cli")]
|
||||||
|
use alloc::string::String;
|
||||||
|
|
||||||
/// pass a standard option and `--` followed by some options that `FuzzerOptions` doesn't know
|
/// pass a standard option and `--` followed by some options that `FuzzerOptions` doesn't know
|
||||||
/// about; expect the standard option to work normally, and everything after `--` to be
|
/// about; expect the standard option to work normally, and everything after `--` to be
|
||||||
|
@ -9,6 +9,9 @@ use std::{
|
|||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
use std::os::unix::prelude::{AsRawFd, RawFd};
|
use std::os::unix::prelude::{AsRawFd, RawFd};
|
||||||
|
|
||||||
|
#[cfg(feature = "std")]
|
||||||
|
use alloc::borrow::ToOwned;
|
||||||
|
|
||||||
use crate::Error;
|
use crate::Error;
|
||||||
|
|
||||||
/// The default filename to use to deliver testcases to the target
|
/// The default filename to use to deliver testcases to the target
|
||||||
|
@ -24,6 +24,8 @@ use crate::{
|
|||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(feature = "std")]
|
||||||
|
use alloc::string::ToString;
|
||||||
use core::fmt::{self, Debug, Formatter};
|
use core::fmt::{self, Debug, Formatter};
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
use core::marker::PhantomData;
|
use core::marker::PhantomData;
|
||||||
|
@ -73,6 +73,8 @@ use core::{
|
|||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[cfg(feature = "std")]
|
||||||
|
use alloc::string::ToString;
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
use std::{
|
use std::{
|
||||||
env,
|
env,
|
||||||
|
@ -12,6 +12,12 @@ use crate::{
|
|||||||
},
|
},
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(feature = "std")]
|
||||||
|
use alloc::{
|
||||||
|
string::{String, ToString},
|
||||||
|
vec::Vec,
|
||||||
|
};
|
||||||
use core::{mem::ManuallyDrop, ptr::addr_of};
|
use core::{mem::ManuallyDrop, ptr::addr_of};
|
||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
@ -539,6 +539,7 @@ pub mod unix_shmem {
|
|||||||
#[cfg(all(unix, feature = "std", not(target_os = "android")))]
|
#[cfg(all(unix, feature = "std", not(target_os = "android")))]
|
||||||
mod default {
|
mod default {
|
||||||
|
|
||||||
|
use alloc::string::ToString;
|
||||||
use core::{ptr, slice};
|
use core::{ptr, slice};
|
||||||
use libc::{
|
use libc::{
|
||||||
c_int, c_long, c_uchar, c_uint, c_ulong, c_ushort, close, ftruncate, mmap, munmap,
|
c_int, c_long, c_uchar, c_uint, c_ulong, c_ushort, close, ftruncate, mmap, munmap,
|
||||||
@ -919,6 +920,7 @@ pub mod unix_shmem {
|
|||||||
/// Module containing `ashmem` shared memory support, commonly used on Android.
|
/// Module containing `ashmem` shared memory support, commonly used on Android.
|
||||||
#[cfg(all(unix, feature = "std"))]
|
#[cfg(all(unix, feature = "std"))]
|
||||||
pub mod ashmem {
|
pub mod ashmem {
|
||||||
|
use alloc::string::ToString;
|
||||||
use core::{ptr, slice};
|
use core::{ptr, slice};
|
||||||
use libc::{
|
use libc::{
|
||||||
c_uint, c_ulong, c_void, close, ioctl, mmap, open, MAP_SHARED, O_RDWR, PROT_READ,
|
c_uint, c_ulong, c_void, close, ioctl, mmap, open, MAP_SHARED, O_RDWR, PROT_READ,
|
||||||
@ -1152,6 +1154,7 @@ pub mod win32_shmem {
|
|||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use alloc::string::String;
|
||||||
use core::{
|
use core::{
|
||||||
ffi::c_void,
|
ffi::c_void,
|
||||||
fmt::{self, Debug, Formatter},
|
fmt::{self, Debug, Formatter},
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
//! Stores and restores state when a client needs to relaunch.
|
//! Stores and restores state when a client needs to relaunch.
|
||||||
//! Uses a [`ShMem`] up to a threshold, then write to disk.
|
//! Uses a [`ShMem`] up to a threshold, then write to disk.
|
||||||
use ahash::AHasher;
|
use ahash::AHasher;
|
||||||
|
use alloc::string::{String, ToString};
|
||||||
use core::{hash::Hasher, marker::PhantomData, mem::size_of, ptr, slice};
|
use core::{hash::Hasher, marker::PhantomData, mem::size_of, ptr, slice};
|
||||||
use serde::{de::DeserializeOwned, Serialize};
|
use serde::{de::DeserializeOwned, Serialize};
|
||||||
use std::{
|
use std::{
|
||||||
@ -241,6 +242,10 @@ where
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|
||||||
|
use alloc::{
|
||||||
|
string::{String, ToString},
|
||||||
|
vec::Vec,
|
||||||
|
};
|
||||||
use serial_test::serial;
|
use serial_test::serial;
|
||||||
|
|
||||||
use crate::bolts::{
|
use crate::bolts::{
|
||||||
|
@ -140,6 +140,7 @@ pub mod pybind {
|
|||||||
use crate::corpus::pybind::PythonCorpus;
|
use crate::corpus::pybind::PythonCorpus;
|
||||||
use crate::corpus::CachedOnDiskCorpus;
|
use crate::corpus::CachedOnDiskCorpus;
|
||||||
use crate::inputs::BytesInput;
|
use crate::inputs::BytesInput;
|
||||||
|
use alloc::string::String;
|
||||||
use pyo3::prelude::*;
|
use pyo3::prelude::*;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
@ -211,6 +211,7 @@ pub mod pybind {
|
|||||||
use crate::corpus::pybind::PythonCorpus;
|
use crate::corpus::pybind::PythonCorpus;
|
||||||
use crate::corpus::OnDiskCorpus;
|
use crate::corpus::OnDiskCorpus;
|
||||||
use crate::inputs::BytesInput;
|
use crate::inputs::BytesInput;
|
||||||
|
use alloc::string::String;
|
||||||
use pyo3::prelude::*;
|
use pyo3::prelude::*;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
@ -354,6 +354,7 @@ pub mod pybind {
|
|||||||
use crate::bolts::ownedref::OwnedPtrMut;
|
use crate::bolts::ownedref::OwnedPtrMut;
|
||||||
use crate::inputs::{BytesInput, HasBytesVec};
|
use crate::inputs::{BytesInput, HasBytesVec};
|
||||||
use crate::pybind::PythonMetadata;
|
use crate::pybind::PythonMetadata;
|
||||||
|
use alloc::{boxed::Box, vec::Vec};
|
||||||
use pyo3::prelude::*;
|
use pyo3::prelude::*;
|
||||||
use pyo3::types::PyDict;
|
use pyo3::types::PyDict;
|
||||||
|
|
||||||
|
@ -4,6 +4,8 @@ use core::{
|
|||||||
marker::PhantomData,
|
marker::PhantomData,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(feature = "std")]
|
||||||
|
use alloc::{borrow::ToOwned, string::String, vec::Vec};
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
use std::os::unix::ffi::OsStrExt;
|
use std::os::unix::ffi::OsStrExt;
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
@ -696,6 +698,8 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
fn test_parse_afl_cmdline() {
|
fn test_parse_afl_cmdline() {
|
||||||
|
use alloc::string::ToString;
|
||||||
|
|
||||||
let mut mgr = SimpleEventManager::<BytesInput, _>::new(SimpleMonitor::new(|status| {
|
let mut mgr = SimpleEventManager::<BytesInput, _>::new(SimpleMonitor::new(|status| {
|
||||||
println!("{}", status);
|
println!("{}", status);
|
||||||
}));
|
}));
|
||||||
|
@ -27,6 +27,7 @@ use crate::{
|
|||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use alloc::{borrow::ToOwned, string::ToString, vec::Vec};
|
||||||
use nix::{
|
use nix::{
|
||||||
sys::{
|
sys::{
|
||||||
select::{pselect, FdSet},
|
select::{pselect, FdSet},
|
||||||
|
@ -18,6 +18,8 @@ use core::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use alloc::boxed::Box;
|
use alloc::boxed::Box;
|
||||||
|
#[cfg(all(unix, feature = "std"))]
|
||||||
|
use alloc::vec::Vec;
|
||||||
|
|
||||||
#[cfg(all(feature = "std", unix))]
|
#[cfg(all(feature = "std", unix))]
|
||||||
use std::intrinsics::transmute;
|
use std::intrinsics::transmute;
|
||||||
@ -507,6 +509,8 @@ pub fn inprocess_get_input<'a, I>() -> Option<&'a I> {
|
|||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
mod unix_signal_handler {
|
mod unix_signal_handler {
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
|
#[cfg(feature = "std")]
|
||||||
|
use alloc::{boxed::Box, string::String};
|
||||||
use core::mem::transmute;
|
use core::mem::transmute;
|
||||||
use libc::siginfo_t;
|
use libc::siginfo_t;
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
@ -854,6 +858,9 @@ mod unix_signal_handler {
|
|||||||
|
|
||||||
#[cfg(all(windows, feature = "std"))]
|
#[cfg(all(windows, feature = "std"))]
|
||||||
mod windows_exception_handler {
|
mod windows_exception_handler {
|
||||||
|
#[cfg(feature = "std")]
|
||||||
|
use alloc::boxed::Box;
|
||||||
|
use alloc::string::String;
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
use core::ffi::c_void;
|
use core::ffi::c_void;
|
||||||
use core::{mem::transmute, ptr};
|
use core::{mem::transmute, ptr};
|
||||||
@ -1550,6 +1557,7 @@ where
|
|||||||
/// signal handlers and `panic_hooks` for the child process
|
/// signal handlers and `panic_hooks` for the child process
|
||||||
#[cfg(all(feature = "std", unix))]
|
#[cfg(all(feature = "std", unix))]
|
||||||
pub mod child_signal_handlers {
|
pub mod child_signal_handlers {
|
||||||
|
use alloc::boxed::Box;
|
||||||
use libc::siginfo_t;
|
use libc::siginfo_t;
|
||||||
use std::panic;
|
use std::panic;
|
||||||
|
|
||||||
@ -1683,6 +1691,7 @@ pub mod pybind {
|
|||||||
use crate::inputs::{BytesInput, HasBytesVec};
|
use crate::inputs::{BytesInput, HasBytesVec};
|
||||||
use crate::observers::pybind::PythonObserversTuple;
|
use crate::observers::pybind::PythonObserversTuple;
|
||||||
use crate::state::pybind::{PythonStdState, PythonStdStateWrapper};
|
use crate::state::pybind::{PythonStdState, PythonStdStateWrapper};
|
||||||
|
use alloc::boxed::Box;
|
||||||
use pyo3::prelude::*;
|
use pyo3::prelude::*;
|
||||||
use pyo3::types::PyBytes;
|
use pyo3::types::PyBytes;
|
||||||
|
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
//! This feedback should be used in combination with another feedback as this feedback always considers testcases
|
//! This feedback should be used in combination with another feedback as this feedback always considers testcases
|
||||||
//! to be not interesting.
|
//! to be not interesting.
|
||||||
//! Requires a [`ConcolicObserver`] to observe the concolic trace.
|
//! Requires a [`ConcolicObserver`] to observe the concolic trace.
|
||||||
|
use alloc::{borrow::ToOwned, string::String};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
bolts::tuples::Named,
|
bolts::tuples::Named,
|
||||||
corpus::Testcase,
|
corpus::Testcase,
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
//! Nautilus grammar mutator, see <https://github.com/nautilus-fuzz/nautilus>
|
//! Nautilus grammar mutator, see <https://github.com/nautilus-fuzz/nautilus>
|
||||||
|
use alloc::string::String;
|
||||||
use core::fmt::Debug;
|
use core::fmt::Debug;
|
||||||
use grammartec::{chunkstore::ChunkStore, context::Context};
|
use grammartec::{chunkstore::ChunkStore, context::Context};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
use std::{fmt::Debug, marker::PhantomData};
|
use std::{fmt::Debug, marker::PhantomData};
|
||||||
|
|
||||||
|
use alloc::string::{String, ToString};
|
||||||
use hashbrown::HashSet;
|
use hashbrown::HashSet;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
@ -682,6 +682,7 @@ pub mod pybind {
|
|||||||
use crate::schedulers::QueueScheduler;
|
use crate::schedulers::QueueScheduler;
|
||||||
use crate::stages::pybind::PythonStagesTuple;
|
use crate::stages::pybind::PythonStagesTuple;
|
||||||
use crate::state::pybind::{PythonStdState, PythonStdStateWrapper};
|
use crate::state::pybind::{PythonStdState, PythonStdStateWrapper};
|
||||||
|
use alloc::{boxed::Box, vec::Vec};
|
||||||
use pyo3::prelude::*;
|
use pyo3::prelude::*;
|
||||||
|
|
||||||
/// `StdFuzzer` with fixed generics
|
/// `StdFuzzer` with fixed generics
|
||||||
|
@ -134,6 +134,7 @@ pub mod pybind {
|
|||||||
use crate::inputs::{BytesInput, HasBytesVec};
|
use crate::inputs::{BytesInput, HasBytesVec};
|
||||||
use crate::state::pybind::{PythonStdState, PythonStdStateWrapper};
|
use crate::state::pybind::{PythonStdState, PythonStdStateWrapper};
|
||||||
use crate::Error;
|
use crate::Error;
|
||||||
|
use alloc::vec::Vec;
|
||||||
use pyo3::prelude::*;
|
use pyo3::prelude::*;
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
//! Generators for the [`Nautilus`](https://github.com/RUB-SysSec/nautilus) grammar fuzzer
|
//! Generators for the [`Nautilus`](https://github.com/RUB-SysSec/nautilus) grammar fuzzer
|
||||||
use crate::{generators::Generator, inputs::nautilus::NautilusInput, Error};
|
use crate::{generators::Generator, inputs::nautilus::NautilusInput, Error};
|
||||||
use alloc::{string::String, vec::Vec};
|
use alloc::{
|
||||||
|
string::{String, ToString},
|
||||||
|
vec::Vec,
|
||||||
|
};
|
||||||
use core::fmt::Debug;
|
use core::fmt::Debug;
|
||||||
use grammartec::context::Context;
|
use grammartec::context::Context;
|
||||||
use std::{fs, io::BufReader, path::Path};
|
use std::{fs, io::BufReader, path::Path};
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
use ahash::AHasher;
|
use ahash::AHasher;
|
||||||
use core::hash::Hasher;
|
use core::hash::Hasher;
|
||||||
|
|
||||||
|
#[cfg(feature = "std")]
|
||||||
|
use alloc::string::ToString;
|
||||||
use alloc::{borrow::ToOwned, rc::Rc, string::String, vec::Vec};
|
use alloc::{borrow::ToOwned, rc::Rc, string::String, vec::Vec};
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
use core::str::from_utf8;
|
use core::str::from_utf8;
|
||||||
@ -256,6 +258,8 @@ impl EncodedInput {
|
|||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
use alloc::borrow::ToOwned;
|
||||||
|
|
||||||
use crate::inputs::encoded::{
|
use crate::inputs::encoded::{
|
||||||
InputDecoder, InputEncoder, NaiveTokenizer, TokenInputEncoderDecoder,
|
InputDecoder, InputEncoder, NaiveTokenizer, TokenInputEncoderDecoder,
|
||||||
};
|
};
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
//use ahash::AHasher;
|
//use ahash::AHasher;
|
||||||
//use core::hash::Hasher;
|
//use core::hash::Hasher;
|
||||||
|
|
||||||
use alloc::{rc::Rc, string::String};
|
use alloc::{rc::Rc, string::String, vec::Vec};
|
||||||
use core::{cell::RefCell, convert::From};
|
use core::{cell::RefCell, convert::From};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ Welcome to `LibAFL`
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![no_std]
|
||||||
// For `type_eq`
|
// For `type_eq`
|
||||||
#![cfg_attr(unstable_feature, feature(specialization))]
|
#![cfg_attr(unstable_feature, feature(specialization))]
|
||||||
// For `type_id` and owned things
|
// For `type_id` and owned things
|
||||||
@ -69,6 +69,9 @@ Welcome to `LibAFL`
|
|||||||
)
|
)
|
||||||
)]
|
)]
|
||||||
|
|
||||||
|
#[cfg(feature = "std")]
|
||||||
|
#[macro_use]
|
||||||
|
extern crate std;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
pub extern crate alloc;
|
pub extern crate alloc;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
@ -573,6 +576,7 @@ pub mod pybind {
|
|||||||
macro_rules! impl_serde_pyobjectwrapper {
|
macro_rules! impl_serde_pyobjectwrapper {
|
||||||
($struct_name:ident, $inner:tt) => {
|
($struct_name:ident, $inner:tt) => {
|
||||||
const _: () = {
|
const _: () = {
|
||||||
|
use alloc::vec::Vec;
|
||||||
use pyo3::prelude::*;
|
use pyo3::prelude::*;
|
||||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||||
|
|
||||||
|
@ -822,6 +822,7 @@ pub mod pybind {
|
|||||||
use pyo3::types::PyUnicode;
|
use pyo3::types::PyUnicode;
|
||||||
|
|
||||||
use super::ClientStats;
|
use super::ClientStats;
|
||||||
|
use alloc::{boxed::Box, string::String, vec::Vec};
|
||||||
use core::time::Duration;
|
use core::time::Duration;
|
||||||
|
|
||||||
// TODO create a PyObjectFnMut to pass, track stabilization of https://github.com/rust-lang/rust/issues/29625
|
// TODO create a PyObjectFnMut to pass, track stabilization of https://github.com/rust-lang/rust/issues/29625
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
use super::{current_time, format_duration_hms, Duration, String, TimedStats, TuiContext};
|
use super::{current_time, format_duration_hms, Duration, String, TimedStats, TuiContext};
|
||||||
|
|
||||||
|
use alloc::vec::Vec;
|
||||||
use tui::{
|
use tui::{
|
||||||
backend::Backend,
|
backend::Backend,
|
||||||
layout::{Alignment, Constraint, Direction, Layout, Rect},
|
layout::{Alignment, Constraint, Direction, Layout, Rect},
|
||||||
|
@ -170,16 +170,16 @@ impl Tokens {
|
|||||||
}
|
}
|
||||||
let pos_quote = match line.find('\"') {
|
let pos_quote = match line.find('\"') {
|
||||||
Some(x) => x,
|
Some(x) => x,
|
||||||
None => return Err(Error::illegal_argument("Illegal line: ".to_owned() + line)),
|
None => return Err(Error::illegal_argument(format!("Illegal line: {}", line))),
|
||||||
};
|
};
|
||||||
if line.chars().nth(line.len() - 1) != Some('"') {
|
if line.chars().nth(line.len() - 1) != Some('"') {
|
||||||
return Err(Error::illegal_argument("Illegal line: ".to_owned() + line));
|
return Err(Error::illegal_argument(format!("Illegal line: {}", line)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// extract item
|
// extract item
|
||||||
let item = match line.get(pos_quote + 1..line.len() - 1) {
|
let item = match line.get(pos_quote + 1..line.len() - 1) {
|
||||||
Some(x) => x,
|
Some(x) => x,
|
||||||
None => return Err(Error::illegal_argument("Illegal line: ".to_owned() + line)),
|
None => return Err(Error::illegal_argument(format!("Illegal line: {}", line))),
|
||||||
};
|
};
|
||||||
if item.is_empty() {
|
if item.is_empty() {
|
||||||
continue;
|
continue;
|
||||||
@ -189,9 +189,10 @@ impl Tokens {
|
|||||||
let token: Vec<u8> = match str_decode(item) {
|
let token: Vec<u8> = match str_decode(item) {
|
||||||
Ok(val) => val,
|
Ok(val) => val,
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
return Err(Error::illegal_argument(
|
return Err(Error::illegal_argument(format!(
|
||||||
"Illegal line (hex decoding): ".to_owned() + line,
|
"Illegal line (hex decoding): {}",
|
||||||
))
|
line
|
||||||
|
)))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
use crate::observers::concolic::{serialization_format::MessageFileReader, SymExpr, SymExprRef};
|
use crate::observers::concolic::{serialization_format::MessageFileReader, SymExpr, SymExprRef};
|
||||||
|
use alloc::vec::Vec;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// A metadata holding a buffer of a concolic trace.
|
/// A metadata holding a buffer of a concolic trace.
|
||||||
|
@ -4,6 +4,8 @@ use core::{
|
|||||||
num::NonZeroUsize,
|
num::NonZeroUsize,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(feature = "std")]
|
||||||
|
use alloc::vec::Vec;
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ use crate::{
|
|||||||
Observer,
|
Observer,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
use alloc::string::String;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// A standard [`ConcolicObserver`] observer, observing constraints written into a memory buffer.
|
/// A standard [`ConcolicObserver`] observer, observing constraints written into a memory buffer.
|
||||||
|
@ -383,6 +383,8 @@ impl<W: Write + Seek> MessageFileWriter<W> {
|
|||||||
mod serialization_tests {
|
mod serialization_tests {
|
||||||
use std::io::Cursor;
|
use std::io::Cursor;
|
||||||
|
|
||||||
|
use alloc::vec::Vec;
|
||||||
|
|
||||||
use super::{MessageFileReader, MessageFileWriter, SymExpr};
|
use super::{MessageFileReader, MessageFileWriter, SymExpr};
|
||||||
|
|
||||||
/// This test intends to ensure that the serialization format can efficiently encode the required information.
|
/// This test intends to ensure that the serialization format can efficiently encode the required information.
|
||||||
|
@ -1557,6 +1557,7 @@ pub mod pybind {
|
|||||||
|
|
||||||
macro_rules! define_python_map_observer {
|
macro_rules! define_python_map_observer {
|
||||||
($struct_name1:ident, $py_name1:tt, $struct_name2:ident, $py_name2:tt, $struct_name_trait:ident, $py_name_trait:tt, $datatype:ty, $wrapper_name: ident) => {
|
($struct_name1:ident, $py_name1:tt, $struct_name2:ident, $py_name2:tt, $struct_name_trait:ident, $py_name_trait:tt, $datatype:ty, $wrapper_name: ident) => {
|
||||||
|
|
||||||
#[pyclass(unsendable, name = $py_name1)]
|
#[pyclass(unsendable, name = $py_name1)]
|
||||||
#[allow(clippy::unsafe_derive_deserialize)]
|
#[allow(clippy::unsafe_derive_deserialize)]
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||||
@ -1628,7 +1629,7 @@ pub mod pybind {
|
|||||||
fn new(name: String, map: Vec<$datatype>) -> Self {
|
fn new(name: String, map: Vec<$datatype>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
//TODO: Not leak memory
|
//TODO: Not leak memory
|
||||||
inner: OwnedMapObserver::new(Box::leak(name.into_boxed_str()), map),
|
inner: OwnedMapObserver::new(alloc::boxed::Box::leak(name.into_boxed_str()), map),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ use crate::{
|
|||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use alloc::string::{String, ToString};
|
||||||
use backtrace::Backtrace;
|
use backtrace::Backtrace;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
//! The executor must explicitely support these observers.
|
//! The executor must explicitely support these observers.
|
||||||
//! For example, they are supported on the [`crate::executors::CommandExecutor`].
|
//! For example, they are supported on the [`crate::executors::CommandExecutor`].
|
||||||
|
|
||||||
|
use alloc::string::String;
|
||||||
|
|
||||||
use crate::{bolts::tuples::Named, observers::Observer};
|
use crate::{bolts::tuples::Named, observers::Observer};
|
||||||
|
|
||||||
/// An observer that captures stdout of a target.
|
/// An observer that captures stdout of a target.
|
||||||
|
@ -4,6 +4,10 @@
|
|||||||
|
|
||||||
use core::marker::PhantomData;
|
use core::marker::PhantomData;
|
||||||
|
|
||||||
|
use alloc::string::String;
|
||||||
|
#[cfg(feature = "concolic_mutation")]
|
||||||
|
use alloc::{borrow::ToOwned, string::ToString, vec::Vec};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
corpus::Corpus,
|
corpus::Corpus,
|
||||||
executors::{Executor, HasObservers},
|
executors::{Executor, HasObservers},
|
||||||
|
@ -268,6 +268,7 @@ pub mod pybind {
|
|||||||
use crate::stages::{Stage, StagesTuple};
|
use crate::stages::{Stage, StagesTuple};
|
||||||
use crate::state::pybind::{PythonStdState, PythonStdStateWrapper};
|
use crate::state::pybind::{PythonStdState, PythonStdStateWrapper};
|
||||||
use crate::Error;
|
use crate::Error;
|
||||||
|
use alloc::vec::Vec;
|
||||||
use pyo3::prelude::*;
|
use pyo3::prelude::*;
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
|
@ -668,6 +668,7 @@ pub mod pybind {
|
|||||||
use crate::state::{
|
use crate::state::{
|
||||||
HasCorpus, HasExecutions, HasMaxSize, HasMetadata, HasRand, HasSolutions, StdState,
|
HasCorpus, HasExecutions, HasMaxSize, HasMetadata, HasRand, HasSolutions, StdState,
|
||||||
};
|
};
|
||||||
|
use alloc::{boxed::Box, vec::Vec};
|
||||||
use pyo3::prelude::*;
|
use pyo3::prelude::*;
|
||||||
use pyo3::types::PyDict;
|
use pyo3::types::PyDict;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
//! Derives for `LibAFL`
|
//! Derives for `LibAFL`
|
||||||
|
|
||||||
|
#![no_std]
|
||||||
#![deny(rustdoc::broken_intra_doc_links)]
|
#![deny(rustdoc::broken_intra_doc_links)]
|
||||||
#![deny(clippy::all)]
|
#![deny(clippy::all)]
|
||||||
#![deny(clippy::pedantic)]
|
#![deny(clippy::pedantic)]
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
use core::fmt::{self, Debug, Formatter};
|
use core::fmt::{self, Debug, Formatter};
|
||||||
|
|
||||||
|
use alloc::string::{String, ToString};
|
||||||
use libafl::{
|
use libafl::{
|
||||||
bolts::{ownedref::OwnedRefMut, tuples::Named},
|
bolts::{ownedref::OwnedRefMut, tuples::Named},
|
||||||
executors::ExitKind,
|
executors::ExitKind,
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
//! writing basic-block trace files to be read by coverage analysis tools, such as [Lighthouse](https://github.com/gaasedelen/lighthouse),
|
//! writing basic-block trace files to be read by coverage analysis tools, such as [Lighthouse](https://github.com/gaasedelen/lighthouse),
|
||||||
//! [bncov](https://github.com/ForAllSecure/bncov), [dragondance](https://github.com/0ffffffffh/dragondance), etc.
|
//! [bncov](https://github.com/ForAllSecure/bncov), [dragondance](https://github.com/0ffffffffh/dragondance), etc.
|
||||||
|
|
||||||
|
use alloc::{string::String, vec::Vec};
|
||||||
use core::ptr::addr_of;
|
use core::ptr::addr_of;
|
||||||
use libafl::Error;
|
use libafl::Error;
|
||||||
use rangemap::RangeMap;
|
use rangemap::RangeMap;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
//! `libafl_targets` contains runtime code, injected in the target itself during compilation.
|
//! `libafl_targets` contains runtime code, injected in the target itself during compilation.
|
||||||
//!
|
//!
|
||||||
//!
|
//!
|
||||||
|
#![no_std]
|
||||||
#![deny(rustdoc::broken_intra_doc_links)]
|
#![deny(rustdoc::broken_intra_doc_links)]
|
||||||
#![deny(clippy::all)]
|
#![deny(clippy::all)]
|
||||||
#![deny(clippy::pedantic)]
|
#![deny(clippy::pedantic)]
|
||||||
@ -58,6 +59,9 @@
|
|||||||
)
|
)
|
||||||
)]
|
)]
|
||||||
|
|
||||||
|
#[cfg(feature = "std")]
|
||||||
|
#[macro_use]
|
||||||
|
extern crate std;
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate alloc;
|
extern crate alloc;
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
//! This makes `LibAFL` interoperable with harnesses written for other fuzzers like `Libfuzzer` and [`AFLplusplus`](aflplus.plus).
|
//! This makes `LibAFL` interoperable with harnesses written for other fuzzers like `Libfuzzer` and [`AFLplusplus`](aflplus.plus).
|
||||||
//! We will interact with a C++ target, so use external c functionality
|
//! We will interact with a C++ target, so use external c functionality
|
||||||
|
|
||||||
|
use alloc::{string::String, vec::Vec};
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
/// int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
|
/// int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
|
||||||
fn LLVMFuzzerTestOneInput(data: *const u8, size: usize) -> i32;
|
fn LLVMFuzzerTestOneInput(data: *const u8, size: usize) -> i32;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user