From 41fbd28cce8d1ca9b9726a40f4242b18fb0f8146 Mon Sep 17 00:00:00 2001 From: aarnav Date: Thu, 15 Aug 2024 11:32:35 +0200 Subject: [PATCH] fix forkserver sending message when not necessary --- unicornafl.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/unicornafl.cpp b/unicornafl.cpp index 2ab53a17..f7c9eb59 100644 --- a/unicornafl.cpp +++ b/unicornafl.cpp @@ -537,14 +537,13 @@ class UCAFL { /* Parent supports testcases via shared map - and the user wants to * use it. Tell AFL. */ status = (FS_OPT_ENABLED | FS_OPT_SHDMEM_FUZZ); + /* 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. */ + if (write(FORKSRV_FD + 1, &status, 4) != 4) + return UC_AFL_RET_NO_AFL; } - /* 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. */ - - if (write(FORKSRV_FD + 1, &status, 4) != 4) - return UC_AFL_RET_NO_AFL; /* afl tells us in an extra message if it accepted this option or not */ if (this->afl_testcase_ptr_ && getenv(SHM_FUZZ_ENV_VAR)) {