Skip to content

Commit 847b43a

Browse files
committed
AFL_OLD_FORKSERVER
1 parent 6d5811d commit 847b43a

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

accel/tcg/cpu-exec.c

+15-11
Original file line numberDiff line numberDiff line change
@@ -635,29 +635,33 @@ void afl_setup(void) {
635635

636636
void afl_forkserver(CPUState *cpu) {
637637

638-
// u32 map_size = 0;
639-
unsigned char tmp[4] = {0};
640-
641638
if (forkserver_installed == 1) return;
642639
forkserver_installed = 1;
643640

644641
if (getenv("AFL_QEMU_DEBUG_MAPS")) open_self_maps(cpu->env_ptr, 1);
645642

643+
//u32 map_size = 0;
644+
unsigned char tmp[4] = {0};
646645
pid_t child_pid;
647646
int t_fd[2];
648647
u8 child_stopped = 0;
649648
u32 was_killed;
650649
int status = 0;
651650

652-
// with the max ID value
653-
if (MAP_SIZE <= FS_OPT_MAX_MAPSIZE)
654-
status |= (FS_OPT_SET_MAPSIZE(MAP_SIZE) | FS_OPT_MAPSIZE);
655-
if (lkm_snapshot) status |= FS_OPT_SNAPSHOT;
656-
if (sharedmem_fuzzing != 0) status |= FS_OPT_SHDMEM_FUZZ;
657-
if (status) status |= (FS_OPT_ENABLED | FS_OPT_NEWCMPLOG);
658-
if (getenv("AFL_DEBUG"))
659-
fprintf(stderr, "Debug: Sending status %08x\n", status);
651+
if (!getenv("AFL_OLD_FORKSERVER")) {
652+
653+
// with the max ID value
654+
if (MAP_SIZE <= FS_OPT_MAX_MAPSIZE)
655+
status |= (FS_OPT_SET_MAPSIZE(MAP_SIZE) | FS_OPT_MAPSIZE);
656+
if (lkm_snapshot) status |= FS_OPT_SNAPSHOT;
657+
if (sharedmem_fuzzing != 0) status |= FS_OPT_SHDMEM_FUZZ;
658+
if (status) status |= (FS_OPT_ENABLED | FS_OPT_NEWCMPLOG);
659+
660+
}
661+
660662
memcpy(tmp, &status, 4);
663+
if (getenv("AFL_DEBUG"))
664+
fprintf(stderr, "Debug: Sending status 0x%08x\n", status);
661665

662666
/* Tell the parent that we're alive. If the parent doesn't want
663667
to talk, assume that we're not running in forkserver mode. */

0 commit comments

Comments
 (0)