-
-
Notifications
You must be signed in to change notification settings - Fork 388
Introspection #58
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
Changes from 7 commits
12b9584
c017d72
23061ef
9469776
542738c
fedb5f8
7423cef
4ad9c10
b9a0c7c
2a96fe3
55703cb
042bfce
2b6b369
8219da3
33df973
b9e75c0
3fb4626
0ac407a
6cc1e96
1fa893e
5d1eb27
f56f340
1e61748
92116b9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
PWD=`pwd` | ||
|
||
all: | ||
# Build the libpng libfuzzer library | ||
cargo build --release | ||
|
||
# Build the libpng harness | ||
$(PWD)/target/release/cxx \ | ||
$(PWD)/harness.cc \ | ||
$(PWD)/libpng-1.6.37/.libs/libpng16.a \ | ||
-I$(PWD)/libpng-1.6.37/ \ | ||
-o fuzzer \ | ||
-lm -lz | ||
|
||
run: all | ||
./fuzzer & | ||
./fuzzer >/dev/null 2>/dev/null & | ||
|
||
test: all | ||
timeout 60s ./fuzzer & | ||
timeout 59s taskset 0x00000001 ./fuzzer >/dev/null 2>/dev/null & | ||
timeout 59s taskset 0x00000002 ./fuzzer >/dev/null 2>/dev/null & | ||
timeout 59s taskset 0x00000004 ./fuzzer >/dev/null 2>/dev/null & | ||
timeout 59s taskset 0x00000008 ./fuzzer >/dev/null 2>/dev/null & | ||
# timeout 59s taskset 0x00000010 ./fuzzer >/dev/null 2>/dev/null & | ||
# timeout 59s taskset 0x00000020 ./fuzzer >/dev/null 2>/dev/null & | ||
# timeout 59s taskset 0x00000040 ./fuzzer >/dev/null 2>/dev/null & | ||
# timeout 59s taskset 0x00000080 ./fuzzer >/dev/null 2>/dev/null & | ||
# timeout 59s taskset 0x00000100 ./fuzzer >/dev/null 2>/dev/null & | ||
# timeout 59s taskset 0x00000200 ./fuzzer >/dev/null 2>/dev/null & | ||
# timeout 59s taskset 0x00000400 ./fuzzer >/dev/null 2>/dev/null & | ||
# timeout 59s taskset 0x00000800 ./fuzzer >/dev/null 2>/dev/null & | ||
# timeout 59s taskset 0x00001000 ./fuzzer >/dev/null 2>/dev/null & | ||
# timeout 59s taskset 0x00002000 ./fuzzer >/dev/null 2>/dev/null & | ||
# timeout 59s taskset 0x00004000 ./fuzzer >/dev/null 2>/dev/null & | ||
# timeout 59s taskset 0x00008000 ./fuzzer >/dev/null 2>/dev/null & | ||
# timeout 59s taskset 0x00010000 ./fuzzer >/dev/null 2>/dev/null & | ||
# timeout 59s taskset 0x00020000 ./fuzzer >/dev/null 2>/dev/null & | ||
# timeout 59s taskset 0x00040000 ./fuzzer >/dev/null 2>/dev/null & | ||
# timeout 59s taskset 0x00080000 ./fuzzer >/dev/null 2>/dev/null & | ||
# timeout 59s taskset 0x00100000 ./fuzzer >/dev/null 2>/dev/null & | ||
# timeout 59s taskset 0x00200000 ./fuzzer >/dev/null 2>/dev/null & | ||
# timeout 59s taskset 0x00400000 ./fuzzer >/dev/null 2>/dev/null & | ||
# timeout 59s taskset 0x00800000 ./fuzzer >/dev/null 2>/dev/null & | ||
# timeout 59s taskset 0x01000000 ./fuzzer >/dev/null 2>/dev/null & | ||
# timeout 59s taskset 0x02000000 ./fuzzer >/dev/null 2>/dev/null & | ||
# timeout 59s taskset 0x04000000 ./fuzzer >/dev/null 2>/dev/null & | ||
# timeout 59s taskset 0x08000000 ./fuzzer >/dev/null 2>/dev/null & | ||
# timeout 59s taskset 0x10000000 ./fuzzer >/dev/null 2>/dev/null & | ||
# timeout 59s taskset 0x20000000 ./fuzzer >/dev/null 2>/dev/null & | ||
# timeout 59s taskset 0x40000000 ./fuzzer >/dev/null 2>/dev/null & | ||
# timeout 59s taskset 0x80000000 ./fuzzer >/dev/null 2>/dev/null & |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//! Architecture agnostic utility functions | ||
|
||
/// Read the time counter. This is primarily used for benchmarking various components in | ||
/// the fuzzer. | ||
#[cfg(target_arch = "x86_64")] | ||
pub fn read_time_counter() -> u64 { | ||
unsafe { core::arch::x86_64::_rdtsc() } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be worth using https://docs.rs/llvmint/0.0.3/llvmint/fn.readcyclecounter.html, as that will automatically do the right thing for each arch. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds really useful for more obscure platforms! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh sure! Didn't know about the llvm intrinsic. If we're okay with the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The original thought was to add those specific instructions similar to Google's benchmark: https://github.com/google/benchmark/blob/master/src/cycleclock.h I think that would mitigate the external dependency just for one instruction per arch. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But that would require asm... which is not stable. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's go with
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or since it's a feature flag anyway, just llvmint is fine too, if it's too much work otherwise There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just pushed a fix using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Edit from the last comment.. i had the wrong |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -239,7 +239,7 @@ where | |
let client = stats.client_stats_mut_for(sender_id); | ||
client.update_corpus_size(*corpus_size as u64); | ||
client.update_executions(*executions as u64, *time); | ||
stats.display(event.name().to_string() + " #" + &sender_id.to_string()); | ||
// stats.display(event.name().to_string() + " #" + &sender_id.to_string()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @domenukk porcodio, now we have to release again because this line was commented |
||
Ok(BrokerEventResult::Forward) | ||
} | ||
Event::UpdateStats { | ||
|
@@ -250,7 +250,35 @@ where | |
// TODO: The stats buffer should be added on client add. | ||
let client = stats.client_stats_mut_for(sender_id); | ||
client.update_executions(*executions as u64, *time); | ||
stats.display(event.name().to_string() + " #" + &sender_id.to_string()); | ||
if sender_id == 1 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't be needed, I agree |
||
stats.display(event.name().to_string() + " #" + &sender_id.to_string()); | ||
} | ||
Ok(BrokerEventResult::Handled) | ||
} | ||
#[cfg(feature = "perf_stats")] | ||
Event::UpdatePerfStats { | ||
time, | ||
executions, | ||
perf_stats, | ||
phantom: _, | ||
} => { | ||
// TODO: The stats buffer should be added on client add. | ||
|
||
// Get the client for the sender ID | ||
let client = stats.client_stats_mut_for(sender_id); | ||
|
||
// Update the normal stats for this client | ||
client.update_executions(*executions as u64, *time); | ||
|
||
// Update the performance stats for this client | ||
client.update_perf_stats(*perf_stats); | ||
|
||
// Display the stats via `.display` only on core #1 | ||
if sender_id == 1 { | ||
stats.display(event.name().to_string() + " #" + &sender_id.to_string()); | ||
} | ||
|
||
// Correctly handled the event | ||
Ok(BrokerEventResult::Handled) | ||
} | ||
Event::Objective { objective_size } => { | ||
|
Uh oh!
There was an error while loading. Please reload this page.