Skip to content

Commit 6cd97e7

Browse files
authored
Decouple fuzzer functions from event manager (#2915)
* decouple fuzzer from em * lol * 3 * fix tcp * fix * fix * fix * fixer * std * fixer * plz * plzplzplz * plzplzplzplz * mm * more * symbol * a * a * mm * mmm * mmmm * mmmmm * ff
1 parent ace2a76 commit 6cd97e7

File tree

31 files changed

+485
-601
lines changed

31 files changed

+485
-601
lines changed

MIGRATION.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# 0.15.0 -> 0.16.0
2+
- `EventManager` is refactored to avoid calling function from `Fuzzer`, thus we do not evaluate testcases in `EventManager` anymore.
3+
- Now we have `EventReceiver` in `events` module, and `EventProessor` in `fuzzer` module.
4+
- `EventReceiver` is responsible for receiving testcases and delegates its evaluation to `EventProcessor`.
5+
- `EventProcessor` is responsible for evaluating the testcases passed by the `EventReceiver`.
6+
- Since we don't evaluate testcases in the `EventManager` anymore. `on_fire` and `post_exec` have been deleted from `EventManagerHook`.
7+
- Similarly `pre_exec` has been renamed to `pre_receive`.
18

29
# 0.14.1 -> 0.15.0
310
- `MmapShMem::new` and `MmapShMemProvider::new_shmem_with_id` now take `AsRef<Path>` instead of a byte array for the filename/id.

fuzzers/baby/baby_fuzzer_custom_executor/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use libafl::monitors::tui::TuiMonitor;
77
#[cfg(not(feature = "tui"))]
88
use libafl::monitors::SimpleMonitor;
99
use libafl::{
10-
corpus::{Corpus, InMemoryCorpus, OnDiskCorpus},
10+
corpus::{InMemoryCorpus, OnDiskCorpus},
1111
events::SimpleEventManager,
1212
executors::{Executor, ExitKind, WithObservers},
1313
feedback_and_fast,

fuzzers/baby/baby_fuzzer_unicode/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ pub fn main() {
123123
&mut state,
124124
&mut executor,
125125
&mut mgr,
126-
BytesInput::new(vec![b'a']),
126+
&BytesInput::new(vec![b'a']),
127127
)
128128
.unwrap();
129129

fuzzers/forkserver/libafl-fuzz/src/fuzzer.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ pub type LibaflFuzzState =
7878
#[cfg(not(feature = "fuzzbench"))]
7979
type LibaflFuzzManager = CentralizedEventManager<
8080
LlmpRestartingEventManager<(), BytesInput, LibaflFuzzState, StdShMem, StdShMemProvider>,
81-
(),
8281
BytesInput,
8382
LibaflFuzzState,
8483
StdShMem,

fuzzers/forkserver/libafl-fuzz/src/hooks.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ impl<I, S> EventManagerHook<I, S> for LibAflFuzzEventHook
1414
where
1515
S: Stoppable,
1616
{
17-
fn pre_exec(
17+
fn pre_receive(
1818
&mut self,
1919
state: &mut S,
2020
_client_id: ClientId,
@@ -26,7 +26,4 @@ where
2626
}
2727
Ok(true)
2828
}
29-
fn post_exec(&mut self, _state: &mut S, _client_id: ClientId) -> Result<bool, Error> {
30-
Ok(true)
31-
}
3229
}

fuzzers/inprocess/libfuzzer_libpng_centralized/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ pub extern "C" fn libafl_main() {
141141

142142
let mut secondary_run_client =
143143
|state: Option<_>,
144-
mut mgr: CentralizedEventManager<_, _, _, _, _, _>,
144+
mut mgr: CentralizedEventManager<_, _, _, _, _>,
145145
_client_description: ClientDescription| {
146146
// Create an observation channel using the coverage map
147147
let edges_observer =

fuzzers/inprocess/sqlite_centralized_multi_machine/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ pub extern "C" fn libafl_main() {
157157

158158
let mut secondary_run_client =
159159
|state: Option<_>,
160-
mut mgr: CentralizedEventManager<_, _, _, _, _, _>,
160+
mut mgr: CentralizedEventManager<_, _, _, _, _>,
161161
_client_description: ClientDescription| {
162162
// Create an observation channel using the coverage map
163163
let edges_observer =

fuzzers/structure_aware/baby_fuzzer_grimoire/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ pub fn main() {
164164

165165
for input in initial_inputs {
166166
fuzzer
167-
.evaluate_input(&mut state, &mut executor, &mut mgr, input)
167+
.evaluate_input(&mut state, &mut executor, &mut mgr, &input)
168168
.unwrap();
169169
}
170170

fuzzers/structure_aware/baby_fuzzer_multi/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ pub fn main() {
151151
]);
152152

153153
fuzzer
154-
.evaluate_input(&mut state, &mut executor, &mut mgr, initial)
154+
.evaluate_input(&mut state, &mut executor, &mut mgr, &initial)
155155
.unwrap();
156156

157157
// Setup a mutational stage with a basic bytes mutator

0 commit comments

Comments
 (0)