Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
No results found
Show changes
Commits on Source (1)
......@@ -59,7 +59,7 @@ void __attribute__((constructor)) zafl_setupSharedMemory();
void __attribute__((destructor)) zafl_dumpTracemap();
// always setup a trace map so that an instrumented applicatin will run
// always setup a trace map so that an instrumented application will run
// even if not running under AFL
static void zafl_setupSharedMemory()
{
......@@ -96,11 +96,7 @@ void zafl_initAflForkServer()
if (fork_server_initialized) return;
if (getenv("ZAFL_DEBUG")) debug = 1;
zafl_setupSharedMemory();
if (debug)
printf("libzafl: map is at %p\n", zafl_trace_map);
if (!zafl_trace_map) {
zafl_trace_map = (u8*)malloc(MAP_SIZE);
......@@ -108,6 +104,10 @@ void zafl_initAflForkServer()
printf("no shmem detected: fake it: zafl_trace_map = %p, malloc_size(%d)\n", zafl_trace_map, MAP_SIZE);
}
// force map entry to get past afl sanity checks
if (debug)
zafl_trace_map[MAP_SIZE-1] = 1;
int n = write(FORKSRV_FD+1, &__afl_temp_data,4);
if( n!=4 ) {
if (debug)
......@@ -115,18 +115,14 @@ void zafl_initAflForkServer()
return;
}
// force map entry to get past afl sanity checks
if (debug)
zafl_trace_map[MAP_SIZE-1] = 1;
fork_server_initialized = 1;
// afl forkserver handshake
while(1) {
n = read(FORKSRV_FD,&__afl_temp_data,4);
if(n != 4) {
perror("Error reading fork server\n");
return;
perror("Error reading fork server\n");
return;
}
__afl_fork_pid = fork();
......@@ -163,6 +159,7 @@ void zafl_dumpTracemap()
if (!debug) return;
if (!zafl_trace_map) return;
printf("\nDEBUG output: trace map:\n");
for (i = 0; i < MAP_SIZE; ++i)
{
if (zafl_trace_map[i]!=0)
......