Skip to content

Commit

Permalink
Update LibAFL
Browse files Browse the repository at this point in the history
  • Loading branch information
tokatoka committed Oct 10, 2024
1 parent 876f383 commit 605ce5d
Show file tree
Hide file tree
Showing 25 changed files with 172 additions and 152 deletions.
2 changes: 1 addition & 1 deletion LibAFL
Submodule LibAFL updated 804 files
10 changes: 5 additions & 5 deletions cmplog/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ use libafl::{
inputs::{BytesInput, HasTargetBytes},
monitors::SimpleMonitor,
mutators::{
scheduled::havoc_mutations, token_mutations::I2SRandReplace, tokens_mutations,
havoc_mutations::havoc_mutations, token_mutations::I2SRandReplace, tokens_mutations,
StdScheduledMutator, Tokens,
},
observers::{HitcountsMapObserver, TimeObserver},
Expand Down Expand Up @@ -163,7 +163,7 @@ fn run_testcases(filenames: &[&str]) {
// The actual target run starts here.
// Call LLVMFUzzerInitialize() if present.
let args: Vec<String> = env::args().collect();
if libfuzzer_initialize(&args) == -1 {
if unsafe { libfuzzer_initialize(&args) } == -1 {
println!("Warning: LLVMFuzzerInitialize failed with -1")
}

Expand All @@ -178,7 +178,7 @@ fn run_testcases(filenames: &[&str]) {
let mut buffer = vec![];
file.read_to_end(&mut buffer).expect("Buffer overflow");

libfuzzer_test_one_input(&buffer);
unsafe { libfuzzer_test_one_input(&buffer) };
}
}

Expand Down Expand Up @@ -269,7 +269,7 @@ fn fuzz(
// The actual target run starts here.
// Call LLVMFUzzerInitialize() if present.
let args: Vec<String> = env::args().collect();
if libfuzzer_initialize(&args) == -1 {
if unsafe { libfuzzer_initialize(&args) } == -1 {
println!("Warning: LLVMFuzzerInitialize failed with -1")
}

Expand All @@ -290,7 +290,7 @@ fn fuzz(
let mut harness = |input: &BytesInput| {
let target = input.target_bytes();
let buf = target.as_slice();
libfuzzer_test_one_input(buf);
unsafe { libfuzzer_test_one_input(buf) };
ExitKind::Ok
};

Expand Down
15 changes: 8 additions & 7 deletions coe/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use libafl::{
fuzzer::{Fuzzer, StdFuzzer},
inputs::{BytesInput, HasTargetBytes},
monitors::SimpleMonitor,
mutators::{scheduled::havoc_mutations, tokens_mutations, StdScheduledMutator, Tokens},
mutators::{havoc_mutations::havoc_mutations, tokens_mutations, StdScheduledMutator, Tokens},
observers::{HitcountsMapObserver, TimeObserver},
schedulers::{
powersched::PowerSchedule, IndexesLenTimeMinimizerScheduler, PowerQueueScheduler,
Expand Down Expand Up @@ -159,7 +159,7 @@ fn run_testcases(filenames: &[&str]) {
// The actual target run starts here.
// Call LLVMFUzzerInitialize() if present.
let args: Vec<String> = env::args().collect();
if libfuzzer_initialize(&args) == -1 {
if unsafe { libfuzzer_initialize(&args) } == -1 {
println!("Warning: LLVMFuzzerInitialize failed with -1")
}

Expand All @@ -174,7 +174,7 @@ fn run_testcases(filenames: &[&str]) {
let mut buffer = vec![];
file.read_to_end(&mut buffer).expect("Buffer overflow");

libfuzzer_test_one_input(&buffer);
unsafe { libfuzzer_test_one_input(&buffer) };
}
}

Expand Down Expand Up @@ -267,15 +267,16 @@ fn fuzz(
// The actual target run starts here.
// Call LLVMFUzzerInitialize() if present.
let args: Vec<String> = env::args().collect();
if libfuzzer_initialize(&args) == -1 {
if unsafe { libfuzzer_initialize(&args) } == -1 {
println!("Warning: LLVMFuzzerInitialize failed with -1")
}

let mutator = StdScheduledMutator::new(havoc_mutations().merge(tokens_mutations()));
let power = StdPowerMutationalStage::new(mutator);
let power: StdPowerMutationalStage<_, _, BytesInput, _, _> =
StdPowerMutationalStage::new(mutator);

// A minimization+queue policy to get testcasess from the corpus
let scheduler = PowerQueueScheduler::new(&mut state, &edges_observer, PowerSchedule::COE);
let scheduler = PowerQueueScheduler::new(&mut state, &edges_observer, PowerSchedule::coe());
let scheduler = IndexesLenTimeMinimizerScheduler::new(&edges_observer, scheduler);

// A fuzzer with feedbacks and a corpus scheduler
Expand All @@ -285,7 +286,7 @@ fn fuzz(
let mut harness = |input: &BytesInput| {
let target = input.target_bytes();
let buf = target.as_slice();
libfuzzer_test_one_input(buf);
unsafe { libfuzzer_test_one_input(buf) };
ExitKind::Ok
};

Expand Down
10 changes: 5 additions & 5 deletions cov_accounting/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use libafl::{
fuzzer::{Fuzzer, StdFuzzer},
inputs::{BytesInput, HasTargetBytes},
monitors::SimpleMonitor,
mutators::{scheduled::havoc_mutations, tokens_mutations, StdScheduledMutator, Tokens},
mutators::{havoc_mutations::havoc_mutations, tokens_mutations, StdScheduledMutator, Tokens},
observers::{HitcountsMapObserver, TimeObserver},
schedulers::{CoverageAccountingScheduler, QueueScheduler},
stages::StdMutationalStage,
Expand Down Expand Up @@ -159,7 +159,7 @@ fn run_testcases(filenames: &[&str]) {
// The actual target run starts here.
// Call LLVMFUzzerInitialize() if present.
let args: Vec<String> = env::args().collect();
if libfuzzer_initialize(&args) == -1 {
if unsafe { libfuzzer_initialize(&args) } == -1 {
println!("Warning: LLVMFuzzerInitialize failed with -1")
}

Expand All @@ -174,7 +174,7 @@ fn run_testcases(filenames: &[&str]) {
let mut buffer = vec![];
file.read_to_end(&mut buffer).expect("Buffer overflow");

libfuzzer_test_one_input(&buffer);
unsafe { libfuzzer_test_one_input(&buffer) };
}
}

Expand Down Expand Up @@ -263,7 +263,7 @@ fn fuzz(
// The actual target run starts here.
// Call LLVMFUzzerInitialize() if present.
let args: Vec<String> = env::args().collect();
if libfuzzer_initialize(&args) == -1 {
if unsafe { libfuzzer_initialize(&args) } == -1 {
println!("Warning: LLVMFuzzerInitialize failed with -1")
}

Expand All @@ -286,7 +286,7 @@ fn fuzz(
let mut harness = |input: &BytesInput| {
let target = input.target_bytes();
let buf = target.as_slice();
libfuzzer_test_one_input(buf);
unsafe { libfuzzer_test_one_input(buf) };
ExitKind::Ok
};

Expand Down
15 changes: 8 additions & 7 deletions explore/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use libafl::{
fuzzer::{Fuzzer, StdFuzzer},
inputs::{BytesInput, HasTargetBytes},
monitors::SimpleMonitor,
mutators::{scheduled::havoc_mutations, tokens_mutations, StdScheduledMutator, Tokens},
mutators::{havoc_mutations::havoc_mutations, tokens_mutations, StdScheduledMutator, Tokens},
observers::{HitcountsMapObserver, TimeObserver},
schedulers::{
powersched::PowerSchedule, IndexesLenTimeMinimizerScheduler, PowerQueueScheduler,
Expand Down Expand Up @@ -159,7 +159,7 @@ fn run_testcases(filenames: &[&str]) {
// The actual target run starts here.
// Call LLVMFUzzerInitialize() if present.
let args: Vec<String> = env::args().collect();
if libfuzzer_initialize(&args) == -1 {
if unsafe { libfuzzer_initialize(&args) } == -1 {
println!("Warning: LLVMFuzzerInitialize failed with -1")
}

Expand All @@ -174,7 +174,7 @@ fn run_testcases(filenames: &[&str]) {
let mut buffer = vec![];
file.read_to_end(&mut buffer).expect("Buffer overflow");

libfuzzer_test_one_input(&buffer);
unsafe { libfuzzer_test_one_input(&buffer) };
}
}

Expand Down Expand Up @@ -267,17 +267,18 @@ fn fuzz(
// The actual target run starts here.
// Call LLVMFUzzerInitialize() if present.
let args: Vec<String> = env::args().collect();
if libfuzzer_initialize(&args) == -1 {
if unsafe { libfuzzer_initialize(&args) } == -1 {
println!("Warning: LLVMFuzzerInitialize failed with -1")
}

let mutator = StdScheduledMutator::new(havoc_mutations().merge(tokens_mutations()));
let power = StdPowerMutationalStage::new(mutator);
let power: StdPowerMutationalStage<_, _, BytesInput, _, _> =
StdPowerMutationalStage::new(mutator);

// A minimization+queue policy to get testcasess from the corpus
let scheduler = IndexesLenTimeMinimizerScheduler::new(
&edges_observer,
PowerQueueScheduler::new(&mut state, &edges_observer, PowerSchedule::EXPLORE),
PowerQueueScheduler::new(&mut state, &edges_observer, PowerSchedule::explore()),
);

// A fuzzer with feedbacks and a corpus scheduler
Expand All @@ -287,7 +288,7 @@ fn fuzz(
let mut harness = |input: &BytesInput| {
let target = input.target_bytes();
let buf = target.as_slice();
libfuzzer_test_one_input(buf);
unsafe { libfuzzer_test_one_input(buf) };
ExitKind::Ok
};

Expand Down
15 changes: 8 additions & 7 deletions fast/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use libafl::{
fuzzer::{Fuzzer, StdFuzzer},
inputs::{BytesInput, HasTargetBytes},
monitors::SimpleMonitor,
mutators::{scheduled::havoc_mutations, tokens_mutations, StdScheduledMutator, Tokens},
mutators::{havoc_mutations::havoc_mutations, tokens_mutations, StdScheduledMutator, Tokens},
observers::{HitcountsMapObserver, TimeObserver},
schedulers::{
powersched::PowerSchedule, IndexesLenTimeMinimizerScheduler, PowerQueueScheduler,
Expand Down Expand Up @@ -160,7 +160,7 @@ fn run_testcases(filenames: &[&str]) {
// The actual target run starts here.
// Call LLVMFUzzerInitialize() if present.
let args: Vec<String> = env::args().collect();
if libfuzzer_initialize(&args) == -1 {
if unsafe { libfuzzer_initialize(&args) } == -1 {
println!("Warning: LLVMFuzzerInitialize failed with -1")
}

Expand All @@ -175,7 +175,7 @@ fn run_testcases(filenames: &[&str]) {
let mut buffer = vec![];
file.read_to_end(&mut buffer).expect("Buffer overflow");

libfuzzer_test_one_input(&buffer);
unsafe { libfuzzer_test_one_input(&buffer) };
}
}

Expand Down Expand Up @@ -268,17 +268,18 @@ fn fuzz(
// The actual target run starts here.
// Call LLVMFUzzerInitialize() if present.
let args: Vec<String> = env::args().collect();
if libfuzzer_initialize(&args) == -1 {
if unsafe { libfuzzer_initialize(&args) } == -1 {
println!("Warning: LLVMFuzzerInitialize failed with -1")
}

let mutator = StdScheduledMutator::new(havoc_mutations().merge(tokens_mutations()));
let power = StdPowerMutationalStage::new(mutator);
let power: StdPowerMutationalStage<_, _, BytesInput, _, _> =
StdPowerMutationalStage::new(mutator);

// A minimization+queue policy to get testcasess from the corpus
let scheduler = IndexesLenTimeMinimizerScheduler::new(
&edges_observer,
PowerQueueScheduler::new(&mut state, &edges_observer, PowerSchedule::FAST),
PowerQueueScheduler::new(&mut state, &edges_observer, PowerSchedule::fast()),
);

// A fuzzer with feedbacks and a corpus scheduler
Expand All @@ -288,7 +289,7 @@ fn fuzz(
let mut harness = |input: &BytesInput| {
let target = input.target_bytes();
let buf = target.as_slice();
libfuzzer_test_one_input(buf);
unsafe { libfuzzer_test_one_input(buf) };
ExitKind::Ok
};

Expand Down
15 changes: 8 additions & 7 deletions fast_ctx/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use libafl::{
fuzzer::{Fuzzer, StdFuzzer},
inputs::{BytesInput, HasTargetBytes},
monitors::SimpleMonitor,
mutators::{scheduled::havoc_mutations, tokens_mutations, StdScheduledMutator, Tokens},
mutators::{havoc_mutations::havoc_mutations, tokens_mutations, StdScheduledMutator, Tokens},
observers::{HitcountsMapObserver, TimeObserver},
schedulers::{
powersched::PowerSchedule, IndexesLenTimeMinimizerScheduler, PowerQueueScheduler,
Expand Down Expand Up @@ -160,7 +160,7 @@ fn run_testcases(filenames: &[&str]) {
// The actual target run starts here.
// Call LLVMFUzzerInitialize() if present.
let args: Vec<String> = env::args().collect();
if libfuzzer_initialize(&args) == -1 {
if unsafe { libfuzzer_initialize(&args) } == -1 {
println!("Warning: LLVMFuzzerInitialize failed with -1")
}

Expand All @@ -175,7 +175,7 @@ fn run_testcases(filenames: &[&str]) {
let mut buffer = vec![];
file.read_to_end(&mut buffer).expect("Buffer overflow");

libfuzzer_test_one_input(&buffer);
unsafe { libfuzzer_test_one_input(&buffer) };
}
}

Expand Down Expand Up @@ -268,17 +268,18 @@ fn fuzz(
// The actual target run starts here.
// Call LLVMFUzzerInitialize() if present.
let args: Vec<String> = env::args().collect();
if libfuzzer_initialize(&args) == -1 {
if unsafe { libfuzzer_initialize(&args) } == -1 {
println!("Warning: LLVMFuzzerInitialize failed with -1")
}

let mutator = StdScheduledMutator::new(havoc_mutations().merge(tokens_mutations()));
let power = StdPowerMutationalStage::new(mutator);
let power: StdPowerMutationalStage<_, _, BytesInput, _, _> =
StdPowerMutationalStage::new(mutator);

// A minimization+queue policy to get testcasess from the corpus
let scheduler = IndexesLenTimeMinimizerScheduler::new(
&edges_observer,
PowerQueueScheduler::new(&mut state, &edges_observer, PowerSchedule::FAST),
PowerQueueScheduler::new(&mut state, &edges_observer, PowerSchedule::fast()),
);

// A fuzzer with feedbacks and a corpus scheduler
Expand All @@ -288,7 +289,7 @@ fn fuzz(
let mut harness = |input: &BytesInput| {
let target = input.target_bytes();
let buf = target.as_slice();
libfuzzer_test_one_input(buf);
unsafe { libfuzzer_test_one_input(buf) };
ExitKind::Ok
};

Expand Down
15 changes: 8 additions & 7 deletions fast_ngram4/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use libafl::{
fuzzer::{Fuzzer, StdFuzzer},
inputs::{BytesInput, HasTargetBytes},
monitors::SimpleMonitor,
mutators::{scheduled::havoc_mutations, tokens_mutations, StdScheduledMutator, Tokens},
mutators::{havoc_mutations::havoc_mutations, tokens_mutations, StdScheduledMutator, Tokens},
observers::{HitcountsMapObserver, TimeObserver},
schedulers::{
powersched::PowerSchedule, IndexesLenTimeMinimizerScheduler, PowerQueueScheduler,
Expand Down Expand Up @@ -159,7 +159,7 @@ fn run_testcases(filenames: &[&str]) {
// The actual target run starts here.
// Call LLVMFUzzerInitialize() if present.
let args: Vec<String> = env::args().collect();
if libfuzzer_initialize(&args) == -1 {
if unsafe { libfuzzer_initialize(&args) } == -1 {
println!("Warning: LLVMFuzzerInitialize failed with -1")
}

Expand All @@ -174,7 +174,7 @@ fn run_testcases(filenames: &[&str]) {
let mut buffer = vec![];
file.read_to_end(&mut buffer).expect("Buffer overflow");

libfuzzer_test_one_input(&buffer);
unsafe { libfuzzer_test_one_input(&buffer) };
}
}

Expand Down Expand Up @@ -267,15 +267,16 @@ fn fuzz(
// The actual target run starts here.
// Call LLVMFUzzerInitialize() if present.
let args: Vec<String> = env::args().collect();
if libfuzzer_initialize(&args) == -1 {
if unsafe { libfuzzer_initialize(&args) } == -1 {
println!("Warning: LLVMFuzzerInitialize failed with -1")
}
let mutator = StdScheduledMutator::new(havoc_mutations().merge(tokens_mutations()));

let power = StdPowerMutationalStage::new(mutator);
let power: StdPowerMutationalStage<_, _, BytesInput, _, _> =
StdPowerMutationalStage::new(mutator);
let scheduler = IndexesLenTimeMinimizerScheduler::new(
&edges_observer,
PowerQueueScheduler::new(&mut state, &edges_observer, PowerSchedule::FAST),
PowerQueueScheduler::new(&mut state, &edges_observer, PowerSchedule::fast()),
);

// A fuzzer with feedbacks and a corpus scheduler
Expand All @@ -285,7 +286,7 @@ fn fuzz(
let mut harness = |input: &BytesInput| {
let target = input.target_bytes();
let buf = target.as_slice();
libfuzzer_test_one_input(buf);
unsafe { libfuzzer_test_one_input(buf) };
ExitKind::Ok
};

Expand Down
Loading

0 comments on commit 605ce5d

Please sign in to comment.