forked from googleprojectzero/winafl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
afl-staticinstr.h
52 lines (39 loc) · 1.48 KB
/
afl-staticinstr.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
WinAFL persistent loop implementation for statically instrumented target
-----------------------------------------------------------------------
Written by Axel "0vercl0k" Souchet <[email protected]>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at:
http://www.apache.org/licenses/LICENSE-2.0
This header is the glue you need to make afl-fuzz and your statically
instrumented target play nice together.
The entry-point __afl_persistent_loop is meant to be called at the start of the harness,
in a loop like below. The function will set up everything needed to communicate
and synchronize with afl-fuzz - if it is present (named pipe, shm, etc).
while(__afl_persistent_loop()) {
// init state
// exercise target
// clear state
}
If afl-fuzz isn't detected, then the function will simply return TRUE the first
time so that the body gets executed once.
*/
#pragma once
#include <Windows.h>
#include <stdint.h>
#include <tchar.h>
#if defined(_M_X64) || defined(__amd64__)
#error Static instrumentation is only available for 32 bit binaries
#endif
//
// Enable the variable behavior debugging mode.
//
// #define AFL_STATIC_VARIABLE_BEHAVIOR_DEBUG
#ifdef __cplusplus
extern "C" {
#endif
BOOL __afl_persistent_loop();
#ifdef __cplusplus
}
#endif