afl qemu persistent hook

This commit is contained in:
Andrea Fioraldi
2020-02-07 20:43:17 +01:00
parent fd8fe4dd08
commit f2f6be5e99
13 changed files with 235 additions and 60 deletions

View File

@ -27,7 +27,7 @@
#include "afl-fuzz.h"
#include "cmplog.h"
static s32 cmplog_child_pid, cmplog_fsrv_ctl_fd, cmplog_fsrv_st_fd;
static s32 cmplog_fsrv_ctl_fd, cmplog_fsrv_st_fd;
void init_cmplog_forkserver(char** argv) {

View File

@ -252,7 +252,7 @@ u32 a_extras_cnt; /* Total number of tokens available */
u8 *(*post_handler)(u8 *buf, u32 *len);
u8 *cmplog_binary;
s32 cmplog_forksrv_pid;
s32 cmplog_child_pid, cmplog_forksrv_pid;
/* hooks for the custom mutator function */
size_t (*custom_mutator)(u8 *data, size_t size, u8 *mutated_out,

View File

@ -1822,6 +1822,8 @@ static void handle_stop_sig(int sig) {
if (child_pid > 0) kill(child_pid, SIGKILL);
if (forksrv_pid > 0) kill(forksrv_pid, SIGKILL);
if (cmplog_child_pid > 0) kill(cmplog_child_pid, SIGKILL);
if (cmplog_forksrv_pid > 0) kill(cmplog_forksrv_pid, SIGKILL);
}

View File

@ -1017,6 +1017,8 @@ int main(int argc, char** argv) {
if (child_pid > 0) kill(child_pid, SIGKILL);
if (forksrv_pid > 0) kill(forksrv_pid, SIGKILL);
if (cmplog_child_pid > 0) kill(cmplog_child_pid, SIGKILL);
if (cmplog_forksrv_pid > 0) kill(cmplog_forksrv_pid, SIGKILL);
/* Now that we've killed the forkserver, we wait for it to be able to get
* rusage stats. */
if (waitpid(forksrv_pid, NULL, 0) <= 0) { WARNF("error waitpid\n"); }