mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-15 03:18:07 +00:00
code format
This commit is contained in:
@ -195,7 +195,6 @@ enum {
|
||||
|
||||
};
|
||||
|
||||
|
||||
#define operator_num 16
|
||||
#define swarm_num 5
|
||||
#define period_core 500000
|
||||
@ -875,7 +874,7 @@ void show_init_stats(afl_state_t *);
|
||||
/* Run */
|
||||
|
||||
fsrv_run_result_t run_target(afl_state_t *, afl_forkserver_t *fsrv, u32);
|
||||
void write_to_testcase(afl_state_t *, void *, u32);
|
||||
void write_to_testcase(afl_state_t *, void *, u32);
|
||||
u8 calibrate_case(afl_state_t *, struct queue_entry *, u8 *, u32, u8);
|
||||
void sync_fuzzers(afl_state_t *);
|
||||
u8 trim_case(afl_state_t *, struct queue_entry *, u8 *);
|
||||
|
@ -63,7 +63,7 @@ typedef struct afl_forkserver {
|
||||
|
||||
FILE *plot_file; /* Gnuplot output file */
|
||||
|
||||
u8 last_run_timed_out; /* Traced process timed out? */
|
||||
u8 last_run_timed_out; /* Traced process timed out? */
|
||||
|
||||
u8 last_kill_signal; /* Signal that killed the child */
|
||||
|
||||
@ -97,9 +97,10 @@ void afl_fsrv_init(afl_forkserver_t *fsrv);
|
||||
void afl_fsrv_init_dup(afl_forkserver_t *fsrv_to, afl_forkserver_t *from);
|
||||
void afl_fsrv_start(afl_forkserver_t *fsrv, char **argv,
|
||||
volatile u8 *stop_soon_p, u8 debug_child_output);
|
||||
fsrv_run_result_t afl_fsrv_run_target(afl_forkserver_t *fsrv, volatile u8 *stop_soon_p);
|
||||
void afl_fsrv_killall(void);
|
||||
void afl_fsrv_deinit(afl_forkserver_t *fsrv);
|
||||
fsrv_run_result_t afl_fsrv_run_target(afl_forkserver_t *fsrv,
|
||||
volatile u8 * stop_soon_p);
|
||||
void afl_fsrv_killall(void);
|
||||
void afl_fsrv_deinit(afl_forkserver_t *fsrv);
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define MSG_FORK_ON_APPLE \
|
||||
|
@ -80,7 +80,7 @@ static u8 edges_only, /* Ignore hit counts? */
|
||||
use_stdin = 1; /* Use stdin for program input? */
|
||||
|
||||
static volatile u8 stop_soon, /* Ctrl-C pressed? */
|
||||
child_timed_out; /* Child timed out? */
|
||||
child_timed_out; /* Child timed out? */
|
||||
|
||||
static u8 *target_path;
|
||||
static u8 qemu_mode;
|
||||
|
@ -643,7 +643,8 @@ static void afl_fsrv_kill(afl_forkserver_t *fsrv) {
|
||||
/* Execute target application, monitoring for timeouts. Return status
|
||||
information. The called program will update afl->fsrv->trace_bits. */
|
||||
|
||||
fsrv_run_result_t afl_fsrv_run_target(afl_forkserver_t *fsrv, volatile u8 *stop_soon_p) {
|
||||
fsrv_run_result_t afl_fsrv_run_target(afl_forkserver_t *fsrv,
|
||||
volatile u8 * stop_soon_p) {
|
||||
|
||||
s32 res;
|
||||
u32 exec_ms;
|
||||
@ -777,3 +778,4 @@ void afl_fsrv_deinit(afl_forkserver_t *fsrv) {
|
||||
list_remove(&fsrv_list, fsrv);
|
||||
|
||||
}
|
||||
|
||||
|
@ -704,7 +704,8 @@ u8 save_if_interesting(afl_state_t *afl, void *mem, u32 len, u8 fault) {
|
||||
#ifndef SIMPLE_FILES
|
||||
|
||||
snprintf(fn, PATH_MAX, "%s/crashes/id:%06llu,sig:%02u,%s", afl->out_dir,
|
||||
afl->unique_crashes, afl->fsrv.last_kill_signal, describe_op(afl, 0));
|
||||
afl->unique_crashes, afl->fsrv.last_kill_signal,
|
||||
describe_op(afl, 0));
|
||||
|
||||
#else
|
||||
|
||||
|
@ -131,7 +131,8 @@ static u8 colorization(afl_state_t *afl, u8 *buf, u32 len, u32 exec_cksum) {
|
||||
|
||||
u32 cksum;
|
||||
u64 start_us = get_cur_time_us();
|
||||
if (unlikely(get_exec_checksum(afl, buf, len, &cksum))) goto checksum_fail;
|
||||
if (unlikely(get_exec_checksum(afl, buf, len, &cksum)))
|
||||
goto checksum_fail;
|
||||
|
||||
u64 stop_us = get_cur_time_us();
|
||||
|
||||
|
@ -32,7 +32,8 @@
|
||||
/* Execute target application, monitoring for timeouts. Return status
|
||||
information. The called program will update afl->fsrv->trace_bits. */
|
||||
|
||||
fsrv_run_result_t run_target(afl_state_t *afl, afl_forkserver_t *fsrv, u32 timeout) {
|
||||
fsrv_run_result_t run_target(afl_state_t *afl, afl_forkserver_t *fsrv,
|
||||
u32 timeout) {
|
||||
|
||||
fsrv_run_result_t res = afl_fsrv_run_target(&afl->fsrv, &afl->stop_soon);
|
||||
|
||||
@ -294,7 +295,8 @@ u8 calibrate_case(afl_state_t *afl, struct queue_entry *q, u8 *use_mem,
|
||||
parent. This is a non-critical problem, but something to warn the user
|
||||
about. */
|
||||
|
||||
if (!afl->dumb_mode && first_run && !fault && !new_bits) fault = FSRV_RUN_NOBITS;
|
||||
if (!afl->dumb_mode && first_run && !fault && !new_bits)
|
||||
fault = FSRV_RUN_NOBITS;
|
||||
|
||||
abort_calibration:
|
||||
|
||||
|
@ -109,7 +109,8 @@ void write_stats_file(afl_state_t *afl, double bitmap_cvg, double stability,
|
||||
(cur_time - afl->start_time) / 1000, getpid(),
|
||||
afl->queue_cycle ? (afl->queue_cycle - 1) : 0, afl->cycles_wo_finds,
|
||||
afl->fsrv.total_execs,
|
||||
afl->fsrv.total_execs / ((double)(get_cur_time() - afl->start_time) / 1000),
|
||||
afl->fsrv.total_execs /
|
||||
((double)(get_cur_time() - afl->start_time) / 1000),
|
||||
afl->queued_paths, afl->queued_favored, afl->queued_discovered,
|
||||
afl->queued_imported, afl->max_depth, afl->current_entry,
|
||||
afl->pending_favored, afl->pending_not_fuzzed, afl->queued_variable,
|
||||
|
@ -236,12 +236,13 @@ static void write_to_testcase(afl_forkserver_t *fsrv, void *mem, u32 len) {
|
||||
/* Execute target application. */
|
||||
|
||||
void run_target_forkserver(afl_forkserver_t *fsrv, char **argv, u8 *mem,
|
||||
u32 len) {
|
||||
u32 len) {
|
||||
|
||||
write_to_testcase(fsrv, mem, len);
|
||||
|
||||
fsrv_run_result_t res = afl_fsrv_run_target(fsrv, &stop_soon);
|
||||
if (res == FSRV_RUN_NOINST || res == FSRV_RUN_ERROR) FATAL("Error running target");
|
||||
if (res == FSRV_RUN_NOINST || res == FSRV_RUN_ERROR)
|
||||
FATAL("Error running target");
|
||||
|
||||
classify_counts(fsrv->trace_bits,
|
||||
binary_mode ? count_class_binary : count_class_human);
|
||||
|
@ -273,16 +273,12 @@ static u8 run_target(afl_forkserver_t *fsrv, char **argv, u8 *mem, u32 len,
|
||||
|
||||
if (hang_mode) {
|
||||
|
||||
switch (ret)
|
||||
{
|
||||
case FSRV_RUN_TMOUT:
|
||||
return 1;
|
||||
case FSRV_RUN_CRASH:
|
||||
missed_crashes++;
|
||||
return 0;
|
||||
default:
|
||||
missed_hangs++;
|
||||
return 0;
|
||||
switch (ret) {
|
||||
|
||||
case FSRV_RUN_TMOUT: return 1;
|
||||
case FSRV_RUN_CRASH: missed_crashes++; return 0;
|
||||
default: missed_hangs++; return 0;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -579,8 +575,8 @@ finalize_all:
|
||||
" Fruitless execs : " cRST "termination=%u crash=%u\n\n",
|
||||
100 - ((double)in_len) * 100 / orig_len, in_len,
|
||||
in_len == 1 ? "" : "s",
|
||||
((double)(alpha_d_total)) * 100 / (in_len ? in_len : 1), fsrv->total_execs,
|
||||
missed_paths, missed_crashes);
|
||||
((double)(alpha_d_total)) * 100 / (in_len ? in_len : 1),
|
||||
fsrv->total_execs, missed_paths, missed_crashes);
|
||||
return;
|
||||
|
||||
}
|
||||
@ -590,10 +586,12 @@ finalize_all:
|
||||
"%0.02f%%\n" cGRA " Number of execs done : " cRST "%llu\n" cGRA
|
||||
" Fruitless execs : " cRST "path=%u crash=%u hang=%s%u\n\n",
|
||||
100 - ((double)in_len) * 100 / orig_len, in_len, in_len == 1 ? "" : "s",
|
||||
((double)(alpha_d_total)) * 100 / (in_len ? in_len : 1), fsrv->total_execs,
|
||||
missed_paths, missed_crashes, missed_hangs ? cLRD : "", missed_hangs);
|
||||
((double)(alpha_d_total)) * 100 / (in_len ? in_len : 1),
|
||||
fsrv->total_execs, missed_paths, missed_crashes,
|
||||
missed_hangs ? cLRD : "", missed_hangs);
|
||||
|
||||
if (fsrv->total_execs > 50 && missed_hangs * 10 > fsrv->total_execs && !hang_mode)
|
||||
if (fsrv->total_execs > 50 && missed_hangs * 10 > fsrv->total_execs &&
|
||||
!hang_mode)
|
||||
WARNF(cLRD "Frequent timeouts - results may be skewed." cRST);
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user