about summary refs log tree commit diff
path: root/instrumentation/afl-compiler-rt.o.c
diff options
context:
space:
mode:
authorNils Bars <nils.bars@rub.de>2022-10-20 13:14:29 +0200
committerNils Bars <nils.bars@rub.de>2022-10-20 18:08:07 +0200
commitf84ea696606b3dd6ae40006e5efb9f178651e916 (patch)
tree3989c18c5f2705925d012b1ca4a6bd3bfa9f2c83 /instrumentation/afl-compiler-rt.o.c
parent5ccf38941472bda9415d14edc4ecefaa43c79d67 (diff)
downloadafl++-f84ea696606b3dd6ae40006e5efb9f178651e916.tar.gz
Fix child reaping on fuzzer termination
This commit contains the following changes:
    - Call `waitpid()` on the child and the fork server when terminating the
      fuzzer; thus, we do not end up with zombies.
    - Rename `fsrv.kill_signal` to `fsrv.child_kill_signal`, since the
      documentation states that the signal is used to terminate the *child*.
    - Use SIGTERM instead of fsrv.(child)_kill_signal, thus the fork server
      can always reap the child.
Diffstat (limited to 'instrumentation/afl-compiler-rt.o.c')
-rw-r--r--instrumentation/afl-compiler-rt.o.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/instrumentation/afl-compiler-rt.o.c b/instrumentation/afl-compiler-rt.o.c
index 20069824..8c09d9d8 100644
--- a/instrumentation/afl-compiler-rt.o.c
+++ b/instrumentation/afl-compiler-rt.o.c
@@ -159,6 +159,7 @@ static void at_exit(int signal) {
   if (unlikely(child_pid > 0)) {
 
     kill(child_pid, SIGKILL);
+    waitpid(child_pid, NULL, 0);
     child_pid = -1;
 
   }
@@ -2407,4 +2408,3 @@ void __afl_set_persistent_mode(u8 mode) {
 }
 
 #undef write_error
-