about summary refs log tree commit diff
diff options
context:
space:
mode:
authorhexcoder- <heiko@hexco.de>2021-06-05 11:51:03 +0200
committerhexcoder- <heiko@hexco.de>2021-06-05 11:51:03 +0200
commit0d50ee494751e8dd83e24fd138e396fe940a15c7 (patch)
tree186970428d5c1fec136496225893b521bc177a16
parent43eca8203a278183120d93fbf0cd3df2b7fd2392 (diff)
downloadafl++-0d50ee494751e8dd83e24fd138e396fe940a15c7.tar.gz
restored timeout handling (with SIGALRM for now)
-rw-r--r--src/afl-analyze.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/afl-analyze.c b/src/afl-analyze.c
index aabdbf1a..5d5c4b8c 100644
--- a/src/afl-analyze.c
+++ b/src/afl-analyze.c
@@ -225,6 +225,20 @@ static s32 write_to_file(u8 *path, u8 *mem, u32 len) {
 
 }
 
+
+/* Handle timeout signal. */
+
+static void handle_timeout(int sig) {
+
+  (void)sig;
+
+  child_timed_out = 1;
+
+  if (child_pid > 0) kill(child_pid, SIGKILL);
+
+}
+
+
 /* Execute target application. Returns exec checksum, or 0 if program
    times out. */
 
@@ -904,6 +918,11 @@ static void setup_signal_handlers(void) {
   sigaction(SIGINT, &sa, NULL);
   sigaction(SIGTERM, &sa, NULL);
 
+  /* Exec timeout notifications. */
+
+  sa.sa_handler = handle_timeout;
+  sigaction(SIGALRM, &sa, NULL);
+
 }
 
 /* Display usage hints. */