mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-15 19:38:09 +00:00
code format
This commit is contained in:
@ -691,17 +691,26 @@ static void __afl_start_forkserver(void) {
|
|||||||
|
|
||||||
void (*old_sigchld_handler)(int) = 0; // = signal(SIGCHLD, SIG_DFL);
|
void (*old_sigchld_handler)(int) = 0; // = signal(SIGCHLD, SIG_DFL);
|
||||||
|
|
||||||
if (__afl_map_size <= FS_OPT_MAX_MAPSIZE)
|
if (__afl_map_size <= FS_OPT_MAX_MAPSIZE) {
|
||||||
|
|
||||||
status_for_fsrv |= (FS_OPT_SET_MAPSIZE(__afl_map_size) | FS_OPT_MAPSIZE);
|
status_for_fsrv |= (FS_OPT_SET_MAPSIZE(__afl_map_size) | FS_OPT_MAPSIZE);
|
||||||
if (__afl_dictionary_len && __afl_dictionary) status_for_fsrv |= FS_OPT_AUTODICT;
|
|
||||||
if (__afl_sharedmem_fuzzing != 0) status_for_fsrv |= FS_OPT_SHDMEM_FUZZ;
|
}
|
||||||
if (status_for_fsrv) status_for_fsrv |= (FS_OPT_ENABLED);
|
|
||||||
|
if (__afl_dictionary_len && __afl_dictionary) {
|
||||||
|
|
||||||
|
status_for_fsrv |= FS_OPT_AUTODICT;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (__afl_sharedmem_fuzzing != 0) { status_for_fsrv |= FS_OPT_SHDMEM_FUZZ; }
|
||||||
|
if (status_for_fsrv) { status_for_fsrv |= (FS_OPT_ENABLED); }
|
||||||
memcpy(tmp, &status_for_fsrv, 4);
|
memcpy(tmp, &status_for_fsrv, 4);
|
||||||
|
|
||||||
/* Phone home and tell the parent that we're OK. If parent isn't there,
|
/* Phone home and tell the parent that we're OK. If parent isn't there,
|
||||||
assume we're not running in forkserver mode and just execute program. */
|
assume we're not running in forkserver mode and just execute program. */
|
||||||
|
|
||||||
if (write(FORKSRV_FD + 1, tmp, 4) != 4) return;
|
if (write(FORKSRV_FD + 1, tmp, 4) != 4) { return; }
|
||||||
|
|
||||||
if (__afl_sharedmem_fuzzing || (__afl_dictionary_len && __afl_dictionary)) {
|
if (__afl_sharedmem_fuzzing || (__afl_dictionary_len && __afl_dictionary)) {
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ bool AFLLTOPass::runOnModule(Module &M) {
|
|||||||
|
|
||||||
LLVMContext & C = M.getContext();
|
LLVMContext & C = M.getContext();
|
||||||
std::vector<std::string> dictionary;
|
std::vector<std::string> dictionary;
|
||||||
// std::vector<CallInst *> calls;
|
// std::vector<CallInst *> calls;
|
||||||
DenseMap<Value *, std::string *> valueMap;
|
DenseMap<Value *, std::string *> valueMap;
|
||||||
std::vector<BasicBlock *> BlockList;
|
std::vector<BasicBlock *> BlockList;
|
||||||
char * ptr;
|
char * ptr;
|
||||||
|
@ -106,6 +106,7 @@ bool CompareTransform::transformCmps(Module &M, const bool processStrcmp,
|
|||||||
FunctionCallee tolowerFn;
|
FunctionCallee tolowerFn;
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
|
||||||
#if LLVM_VERSION_MAJOR < 9
|
#if LLVM_VERSION_MAJOR < 9
|
||||||
Constant *
|
Constant *
|
||||||
#else
|
#else
|
||||||
@ -122,7 +123,9 @@ bool CompareTransform::transformCmps(Module &M, const bool processStrcmp,
|
|||||||
#else
|
#else
|
||||||
tolowerFn = c;
|
tolowerFn = c;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* iterate over all functions, bbs and instruction and add suitable calls to
|
/* iterate over all functions, bbs and instruction and add suitable calls to
|
||||||
* strcmp/memcmp/strncmp/strcasecmp/strncasecmp */
|
* strcmp/memcmp/strncmp/strcasecmp/strncasecmp */
|
||||||
for (auto &F : M) {
|
for (auto &F : M) {
|
||||||
|
@ -121,9 +121,12 @@ char compiler_mode_string[7][12] = {
|
|||||||
u8 *getthecwd() {
|
u8 *getthecwd() {
|
||||||
|
|
||||||
if (getcwd(cwd, sizeof(cwd)) == NULL) {
|
if (getcwd(cwd, sizeof(cwd)) == NULL) {
|
||||||
|
|
||||||
static u8 fail[] = "";
|
static u8 fail[] = "";
|
||||||
return fail;
|
return fail;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return cwd;
|
return cwd;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1451,11 +1454,11 @@ int main(int argc, char **argv, char **envp) {
|
|||||||
"of afl-cc.\n\n");
|
"of afl-cc.\n\n");
|
||||||
|
|
||||||
#if LLVM_MAJOR > 10 || (LLVM_MAJOR == 10 && LLVM_MINOR > 0)
|
#if LLVM_MAJOR > 10 || (LLVM_MAJOR == 10 && LLVM_MINOR > 0)
|
||||||
#define NATIVE_MSG \
|
#define NATIVE_MSG \
|
||||||
" NATIVE: use llvm's native PCGUARD instrumentation (less " \
|
" NATIVE: use llvm's native PCGUARD instrumentation (less " \
|
||||||
"performant)\n"
|
"performant)\n"
|
||||||
#else
|
#else
|
||||||
#define NATIVE_MSG ""
|
#define NATIVE_MSG ""
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SAYF(
|
SAYF(
|
||||||
@ -1635,7 +1638,7 @@ int main(int argc, char **argv, char **envp) {
|
|||||||
if (!instrument_mode) {
|
if (!instrument_mode) {
|
||||||
|
|
||||||
instrument_mode = INSTRUMENT_CFG;
|
instrument_mode = INSTRUMENT_CFG;
|
||||||
//ptr = instrument_mode_string[instrument_mode];
|
// ptr = instrument_mode_string[instrument_mode];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -703,7 +703,7 @@ save_if_interesting(afl_state_t *afl, void *mem, u32 len, u8 fault) {
|
|||||||
if (!classified) {
|
if (!classified) {
|
||||||
|
|
||||||
classify_counts(&afl->fsrv);
|
classify_counts(&afl->fsrv);
|
||||||
// classified = 1;
|
// classified = 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -446,7 +446,8 @@ static void try_to_add_to_dict(afl_state_t *afl, u64 v, u8 shape) {
|
|||||||
u32 k;
|
u32 k;
|
||||||
u8 cons_ff = 0, cons_0 = 0;
|
u8 cons_ff = 0, cons_0 = 0;
|
||||||
|
|
||||||
if (shape > sizeof(v)) FATAL("shape is greater than %zu, please report!", sizeof(v));
|
if (shape > sizeof(v))
|
||||||
|
FATAL("shape is greater than %zu, please report!", sizeof(v));
|
||||||
|
|
||||||
for (k = 0; k < shape; ++k) {
|
for (k = 0; k < shape; ++k) {
|
||||||
|
|
||||||
@ -670,7 +671,7 @@ static u8 rtn_fuzz(afl_state_t *afl, u32 key, u8 *orig_buf, u8 *buf, u32 len) {
|
|||||||
|
|
||||||
u8 status = 0;
|
u8 status = 0;
|
||||||
// opt not in the paper
|
// opt not in the paper
|
||||||
// u32 fails = 0;
|
// u32 fails = 0;
|
||||||
u8 found_one = 0;
|
u8 found_one = 0;
|
||||||
|
|
||||||
for (i = 0; i < loggeds; ++i) {
|
for (i = 0; i < loggeds; ++i) {
|
||||||
|
@ -682,7 +682,7 @@ void sync_fuzzers(afl_state_t *afl) {
|
|||||||
// same time. If so, the first temporary main node running again will demote
|
// same time. If so, the first temporary main node running again will demote
|
||||||
// themselves so this is not an issue
|
// themselves so this is not an issue
|
||||||
|
|
||||||
// u8 path2[PATH_MAX];
|
// u8 path2[PATH_MAX];
|
||||||
afl->is_main_node = 1;
|
afl->is_main_node = 1;
|
||||||
sprintf(path, "%s/is_main_node", afl->out_dir);
|
sprintf(path, "%s/is_main_node", afl->out_dir);
|
||||||
int fd = open(path, O_CREAT | O_RDWR, 0644);
|
int fd = open(path, O_CREAT | O_RDWR, 0644);
|
||||||
|
@ -299,7 +299,8 @@ int main(int argc, char **argv_orig, char **envp) {
|
|||||||
|
|
||||||
s32 opt, i, auto_sync = 0 /*, user_set_cache = 0*/;
|
s32 opt, i, auto_sync = 0 /*, user_set_cache = 0*/;
|
||||||
u64 prev_queued = 0;
|
u64 prev_queued = 0;
|
||||||
u32 sync_interval_cnt = 0, seek_to = 0, show_help = 0, map_size = get_map_size();
|
u32 sync_interval_cnt = 0, seek_to = 0, show_help = 0,
|
||||||
|
map_size = get_map_size();
|
||||||
u8 *extras_dir[4];
|
u8 *extras_dir[4];
|
||||||
u8 mem_limit_given = 0, exit_1 = 0, debug = 0,
|
u8 mem_limit_given = 0, exit_1 = 0, debug = 0,
|
||||||
extras_dir_cnt = 0 /*, have_p = 0*/;
|
extras_dir_cnt = 0 /*, have_p = 0*/;
|
||||||
@ -326,7 +327,7 @@ int main(int argc, char **argv_orig, char **envp) {
|
|||||||
|
|
||||||
if (get_afl_env("AFL_DEBUG")) { debug = afl->debug = 1; }
|
if (get_afl_env("AFL_DEBUG")) { debug = afl->debug = 1; }
|
||||||
|
|
||||||
// map_size = get_map_size();
|
// map_size = get_map_size();
|
||||||
afl_state_init(afl, map_size);
|
afl_state_init(afl, map_size);
|
||||||
afl->debug = debug;
|
afl->debug = debug;
|
||||||
afl_fsrv_init(&afl->fsrv);
|
afl_fsrv_init(&afl->fsrv);
|
||||||
|
@ -253,7 +253,7 @@ static void edit_params(int argc, char **argv) {
|
|||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
|
||||||
s32 pid, i, status;
|
s32 pid, i, status;
|
||||||
// u8 * ptr;
|
// u8 * ptr;
|
||||||
char thecwd[PATH_MAX];
|
char thecwd[PATH_MAX];
|
||||||
|
|
||||||
if (getenv("AFL_LD_CALLER") != NULL) {
|
if (getenv("AFL_LD_CALLER") != NULL) {
|
||||||
|
@ -1014,7 +1014,7 @@ int main(int argc, char **argv_orig, char **envp) {
|
|||||||
|
|
||||||
DIR * dir_in, *dir_out = NULL;
|
DIR * dir_in, *dir_out = NULL;
|
||||||
struct dirent *dir_ent;
|
struct dirent *dir_ent;
|
||||||
// int done = 0;
|
// int done = 0;
|
||||||
u8 infile[PATH_MAX], outfile[PATH_MAX];
|
u8 infile[PATH_MAX], outfile[PATH_MAX];
|
||||||
u8 wait_for_gdb = 0;
|
u8 wait_for_gdb = 0;
|
||||||
#if !defined(DT_REG)
|
#if !defined(DT_REG)
|
||||||
|
Reference in New Issue
Block a user