Abort instead of exit from forked tids and mons subprocesses
authorJennifer Richards <jennifer@painless-security.com>
Tue, 8 May 2018 17:01:31 +0000 (13:01 -0400)
committerJennifer Richards <jennifer@painless-security.com>
Tue, 8 May 2018 17:01:31 +0000 (13:01 -0400)
mon/mons.c
tid/tids.c

index b0a0400..cebe329 100644 (file)
@@ -255,7 +255,11 @@ int mons_accept(MONS_INSTANCE *mons, int listen)
         break;
     }
     close(conn);
-    exit(0); /* exit to kill forked child process */
+
+    /* This ought to be an exit(0), but log4shib does not play well with our (mis)use of threads and
+     * fork() in the main process. Until we sort that out, we abort() to force termination of this
+     * process. */
+    abort(); /* exit hard */
   }
 
   /* Only the parent process gets here */
index 0569333..1a29620 100644 (file)
@@ -442,7 +442,11 @@ static void tids_handle_proc(TIDS_INSTANCE *tids, int conn_fd, int result_fd)
 
   close(result_fd);
   close(conn_fd);
-  exit(0); /* exit to kill forked child process */
+
+  /* This ought to be an exit(0), but log4shib does not play well with our (mis)use of threads and
+ * fork() in the main process. Until we sort that out, we abort() to force termination of this
+ * process. */
+  abort(); /* exit hard */
 }
 
 /* Accept and process a connection on a port opened with tids_get_listener() */