Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introspection #58

Merged
merged 24 commits into from
May 7, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
12b9584
Rework to put `ClientPerfStats` in `State` and pass that along. Still…
ctfhacker Apr 7, 2021
c017d72
Add perf_stats feature to libafl/Cargo.toml
ctfhacker Apr 7, 2021
23061ef
Update feedbacks to have with_perf
ctfhacker Apr 12, 2021
9469776
Merge branch 'real_time_benchmarks' of github.com:AFLplusplus/LibAFL …
ctfhacker Apr 12, 2021
542738c
Merge branch 'dev' into real_time_benchmarks
ctfhacker Apr 18, 2021
fedb5f8
Remove unneeeded print statement
ctfhacker Apr 18, 2021
7423cef
cargo fmt all the things
ctfhacker Apr 18, 2021
4ad9c10
use local llvmint vs cpu specific asm for reading cycle counter
ctfhacker Apr 19, 2021
b9a0c7c
Remove debug testing code
ctfhacker Apr 19, 2021
2a96fe3
Stats timeout to 3 seconds
ctfhacker Apr 19, 2021
55703cb
Inline smallish functions for ClientPerfStats
ctfhacker Apr 19, 2021
042bfce
Remove .libs/llvmint and have the correct conditional compilation of …
ctfhacker Apr 19, 2021
2b6b369
pub(crate) the NUM_FEEDBACK and NUM_STAGES consts
ctfhacker Apr 19, 2021
8219da3
Merge branch 'dev' into real_time_benchmarks
domenukk Apr 26, 2021
33df973
perf_stats->instrospection; merged dev; moved back to x86 stable
domenukk May 1, 2021
b9e75c0
Tcp Broker to Broker Communication (#66)
domenukk May 1, 2021
3fb4626
merged dev
domenukk May 1, 2021
0ac407a
adapted to new feedback interface;;
domenukk May 6, 2021
6cc1e96
clippy fixes
domenukk May 6, 2021
1fa893e
fallback to systemtime on non-x86
domenukk May 6, 2021
5d1eb27
make clippy more strict
domenukk May 7, 2021
f56f340
small fixes
andreafioraldi May 7, 2021
1e61748
bump 0.2.1
andreafioraldi May 7, 2021
92116b9
readme
andreafioraldi May 7, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions libafl/.libs/llvmint/Cargo.toml

This file was deleted.

6 changes: 0 additions & 6 deletions libafl/.libs/llvmint/src/lib.rs

This file was deleted.

4 changes: 1 addition & 3 deletions libafl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ anymapdbg = ["serde_json"] # uses serde_json to Debug the anymap trait. Disable
derive = ["libafl_derive"] # provide derive(SerdeAny) macro.
llmp_small_maps = [] # reduces initial map size for llmp
llmp_debug = [] # Enables debug output for LLMP
perf_stats = ["llvmint"] # Include performance statistics of the fuzzing pipeline
perf_stats = [] # Include performance statistics of the fuzzing pipeline

[[example]]
name = "llmp_test"
Expand All @@ -57,9 +57,7 @@ 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
num_enum = "0.5.1"

backtrace = "0.3" # for llmp_debug
llvmint = { path = "./.libs/llvmint", optional = true } # Contains llvm.readcyclecounter for perf_stats

[target.'cfg(unix)'.dependencies]
libc = "0.2" # For (*nix) libc
Expand Down
7 changes: 6 additions & 1 deletion libafl/src/cpu.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
//! Architecture agnostic processor features

extern {
#[link_name = "llvm.readcyclecounter"]
pub fn readcyclecounter() -> u64;
}

/// Read time counter using [`llvmint::readcyclecounter`]
///
/// This function is a wrapper around [`llvmint`] to make it easier to test various
/// implementations of reading a cycle counter. In this way, an experiment only has to
/// change this implementation rather than every instead of [`cpu::read_time_counter`]
pub fn read_time_counter() -> u64 {
unsafe { llvmint::readcyclecounter() }
unsafe { readcyclecounter() }
}
1 change: 1 addition & 0 deletions libafl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Welcome to libAFL
*/

#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(feature = "perf_stats", feature(link_llvm_intrinsics))]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ins't this feature perma-unstable? Might be worth depending on llvmint instead of requiring nightly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so too. Seems like the stable and hardware-independent way to go for now

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I plan to use it in libafl_frida anyways, if that helps.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oof... llvmint depends on simdty which uses nightly features...
Not good.
We can either do our own C wrapper or go back to the initial proposal to do it using libc...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok so we do want to enforce std features. I can convert everything to just using Instant rather than the pure u64. It won't work for no_std obviously. I guess I forgot not everyone doesn't run on nightly all the time ;-)

I guess asking to run in nightly for perf_stats might be a big ask as well?

Yeah llvmint relying on simdty was the reason I ripped out just the extern in the first place.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the C wrapper is the way to go...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C wrappers are the way to go but be careful, Rust code is compiled with LLVM but the C code may be compiled with GCC or MSVC, depends on the build.rs.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I discovered the hard way that __builtin_thread_pointer is not universally accepted.


#[macro_use]
extern crate alloc;
Expand Down