Merge branch 'main' into dev

This commit is contained in:
Andrea Fioraldi 2021-03-01 18:41:45 +01:00 committed by GitHub
commit ff99a442e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 46 additions and 10 deletions

View File

@ -8,6 +8,7 @@ debug = true
[workspace] [workspace]
members = [ members = [
"libafl", "libafl",
"libafl_derive",
#example fuzzers #example fuzzers
"fuzzers/libfuzzer_libpng", "fuzzers/libfuzzer_libpng",

View File

@ -23,11 +23,11 @@ We're still working on the documentation. In the meantime, you can watch the Vid
[![Video explaining libAFL's core concepts](http://img.youtube.com/vi/3RWkT1Q5IV0/3.jpg)](http://www.youtube.com/watch?v=3RWkT1Q5IV0 "Fuzzers Like LEGO") [![Video explaining libAFL's core concepts](http://img.youtube.com/vi/3RWkT1Q5IV0/3.jpg)](http://www.youtube.com/watch?v=3RWkT1Q5IV0 "Fuzzers Like LEGO")
## Roadmap for release ## Roadmap for release
+ Minset corpus scheduler + ~~Minset corpus scheduler~~ still doc missing
+ Win32 shared mem and crash handler to have Windows in-process executor + Win32 shared mem and crash handler to have Windows in-process executor
+ Other feedbacks examples (e.g. maximize allocations to spot OOMs) + Other feedbacks examples (e.g. maximize allocations to spot OOMs)
+ Other objectives examples (e.g. execution of a given program point) + Other objectives examples (e.g. execution of a given program point)
+ A macro crate with derive directives (e.g. for SerdeAny impl). + ~~A macro crate with derive directives (e.g. for SerdeAny impl)~~ just `derive(SerdeAny)`, missing doc.
+ Good documentation + Good documentation
For further TODOs, see [TODO.md](./TODO.md) For further TODOs, see [TODO.md](./TODO.md)

View File

@ -1,11 +1,11 @@
# TODOs # TODOs
- [ ] Minset corpus scheduler - [x] ~~Minset corpus scheduler~~ still doc missing
- [ ] Win32 shared mem and crash handler to have Windows in-process executor - [ ] Win32 shared mem and crash handler to have Windows in-process executor
- [ ] Other feedbacks examples (e.g. maximize allocations to spot OOMs) - [ ] Other feedbacks examples (e.g. maximize allocations to spot OOMs)
- [ ] Other objectives examples (e.g. execution of a given program point) - [ ] Other objectives examples (e.g. execution of a given program point)
- [ ] Objective-Specific Corpuses (named per objective) - [ ] Objective-Specific Corpuses (named per objective)
- [ ] A macro crate with derive directives (e.g. for SerdeAny impl). - [x] A macro crate with derive directives (e.g. for SerdeAny impl).
- [ ] Good documentation - [ ] Good documentation
- [ ] LLMP brotli compression - [ ] LLMP brotli compression
- [ ] Timeouts (timeout observer, objective) - [ ] Timeouts (timeout observer, objective)

View File

@ -30,10 +30,11 @@ harness = false
#debug = true #debug = true
[features] [features]
default = ["std", "anymapdbg"] default = ["std", "anymapdbg", "derive"]
std = [] # print, sharedmap, ... support std = [] # print, sharedmap, ... support
runtime = [] # a runtime for clang inmem-executor runtime = [] # a runtime for clang inmem-executor
anymapdbg = [] # uses serde_json to Debug the anymap trait. Disable for smaller footprint. anymapdbg = ["serde_json"] # uses serde_json to Debug the anymap trait. Disable for smaller footprint.
derive = ["libafl_derive"] # provide derive(SerdeAny) macro.
[[example]] [[example]]
name = "llmp_test" name = "llmp_test"
@ -49,8 +50,9 @@ serde = { version = "1.0", default-features = false, features = ["alloc"] } # se
erased-serde = "0.3.12" erased-serde = "0.3.12"
postcard = { version = "0.5.1", features = ["alloc"] } # no_std compatible serde serialization fromat postcard = { version = "0.5.1", features = ["alloc"] } # no_std compatible serde serialization fromat
static_assertions = "1.1.0" static_assertions = "1.1.0"
serde_json = { version = "1.0", default-features = false, features = ["alloc"] } # an easy way to debug print SerdeAnyMap ctor = "*"
ctor = "0.1.3" libafl_derive = { version = "*", optional = true, path = "../libafl_derive" }
serde_json = { version = "1.0", optional = true, default-features = false, features = ["alloc"] } # an easy way to debug print SerdeAnyMap
#TODO: for llmp brotli = { version = "3.3.0", default-features = false } # brotli compression #TODO: for llmp brotli = { version = "3.3.0", default-features = false } # brotli compression
[target.'cfg(unix)'.dependencies] [target.'cfg(unix)'.dependencies]

View File

@ -12,6 +12,15 @@ extern crate static_assertions;
#[macro_use] #[macro_use]
extern crate ctor; extern crate ctor;
// Re-export derive(SerdeAny)
#[cfg(feature = "libafl_derive")]
#[allow(unused_imports)]
#[macro_use]
extern crate libafl_derive;
#[cfg(feature = "libafl_derive")]
#[doc(hidden)]
pub use libafl_derive::*;
pub mod bolts; pub mod bolts;
pub mod corpus; pub mod corpus;
pub mod events; pub mod events;

12
libafl_derive/Cargo.toml Normal file
View File

@ -0,0 +1,12 @@
[package]
name = "libafl_derive"
version = "0.1.0"
authors = ["Andrea Fioraldi <andreafioraldi@gmail.com>"]
edition = "2018"
[lib]
proc-macro = true
[dependencies]
syn = { version = "1", features = ["full", "extra-traits"] }
quote = "1"

12
libafl_derive/src/lib.rs Normal file
View File

@ -0,0 +1,12 @@
extern crate proc_macro;
use proc_macro::TokenStream;
use quote::quote;
use syn::{parse_macro_input, DeriveInput};
#[proc_macro_derive(SerdeAny)]
pub fn libafl_serdeany_derive(input: TokenStream) -> TokenStream {
let name = parse_macro_input!(input as DeriveInput).ident;
TokenStream::from(quote! {
libafl::impl_serdeany!(#name);
})
}