about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-09-02 17:54:54 +0200
committervan Hauser <vh@thc.org>2020-09-02 17:54:54 +0200
commit08f6e1d66aef1d005e85d6a7871358230a52f65d (patch)
tree96d9c579a3f4baee5345743dea1004e4838f1ea6 /src
parent28e457e8d833610bda8191f8420c57c4fa80bae3 (diff)
downloadafl++-08f6e1d66aef1d005e85d6a7871358230a52f65d.tar.gz
children terminate on sigpipe
Diffstat (limited to 'src')
-rw-r--r--src/afl-forkserver.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/afl-forkserver.c b/src/afl-forkserver.c
index cb4e00f9..58932bc4 100644
--- a/src/afl-forkserver.c
+++ b/src/afl-forkserver.c
@@ -251,6 +251,12 @@ static void afl_fauxsrv_execv(afl_forkserver_t *fsrv, char **argv) {
 
       }
 
+      // enable terminating on sigpipe in the childs
+      struct sigaction sa;
+      memset((char *)&sa, 0, sizeof(sa));
+      sa.sa_handler = SIG_DFL;
+      sigaction(SIGPIPE, &sa, NULL);
+
       signal(SIGCHLD, old_sigchld_handler);
       // FORKSRV_FD is for communication with AFL, we don't need it in the
       // child.
@@ -371,6 +377,13 @@ void afl_fsrv_start(afl_forkserver_t *fsrv, char **argv,
   if (!fsrv->fsrv_pid) {
 
     /* CHILD PROCESS */
+
+    // enable terminating on sigpipe in the childs
+    struct sigaction sa;
+    memset((char *)&sa, 0, sizeof(sa));
+    sa.sa_handler = SIG_DFL;
+    sigaction(SIGPIPE, &sa, NULL);
+
     struct rlimit r;
 
     /* Umpf. On OpenBSD, the default fd limit for root users is set to