about summary refs log tree commit diff
path: root/src/afl-fuzz-state.c
diff options
context:
space:
mode:
authorNils Bars <nils.bars@rub.de>2022-10-21 12:13:43 +0200
committerNils Bars <nils.bars@rub.de>2022-10-21 12:47:00 +0200
commit7512316b46a25180729ff8c568a6061a0ab19fea (patch)
tree81db6020d1d6e1c8d8f050fe647a25c79f1dd37d /src/afl-fuzz-state.c
parentf84ea696606b3dd6ae40006e5efb9f178651e916 (diff)
downloadafl++-7512316b46a25180729ff8c568a6061a0ab19fea.tar.gz
Add AFL_FORK_SERVER_KILL_SIGNAL environment variable.
The AFL_FORK_SERVER_KILL_SIGNAL variable allows to configure the signal
used to kill the fork server on termination.
Diffstat (limited to 'src/afl-fuzz-state.c')
-rw-r--r--src/afl-fuzz-state.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/afl-fuzz-state.c b/src/afl-fuzz-state.c
index 8bbef87c..ae6cb6c7 100644
--- a/src/afl-fuzz-state.c
+++ b/src/afl-fuzz-state.c
@@ -485,10 +485,15 @@ void read_afl_environment(afl_state_t *afl, char **envp) {
 #endif
 
           } else if (!strncmp(env, "AFL_KILL_SIGNAL",
+                              afl_environment_variable_len)) {
+
+            afl->afl_env.afl_child_kill_signal =
+                (u8 *)get_afl_env(afl_environment_variables[i]);
 
+          } else if (!strncmp(env, "AFL_FORK_SERVER_KILL_SIGNAL",
                               afl_environment_variable_len)) {
 
-            afl->afl_env.afl_kill_signal =
+            afl->afl_env.afl_fsrv_kill_signal =
                 (u8 *)get_afl_env(afl_environment_variables[i]);
 
           } else if (!strncmp(env, "AFL_TARGET_ENV",
@@ -657,8 +662,7 @@ void afl_states_stop(void) {
     /* NOTE: We need to make sure that the parent (the forkserver) reap the child (see below). */
     if (el->fsrv.child_pid > 0) kill(el->fsrv.child_pid, el->fsrv.child_kill_signal);
     if (el->fsrv.fsrv_pid > 0) {
-      /* This must be SIGTERM, to allow the forkserver to reap the child before exiting. */
-      kill(el->fsrv.fsrv_pid, SIGTERM);
+      kill(el->fsrv.fsrv_pid, el->fsrv.fsrv_kill_signal);
       /* Make sure the forkserver does not end up as zombie. */
       waitpid(el->fsrv.fsrv_pid, NULL, 0);
     }