aboutsummaryrefslogtreecommitdiffstats
path: root/executor/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'executor/common.h')
-rw-r--r--executor/common.h23
1 files changed, 21 insertions, 2 deletions
diff --git a/executor/common.h b/executor/common.h
index 27a7380f7..db2e1204e 100644
--- a/executor/common.h
+++ b/executor/common.h
@@ -145,7 +145,8 @@ static void sleep_ms(uint64 ms)
}
#endif
-#if SYZ_EXECUTOR || SYZ_THREADED || SYZ_REPEAT && SYZ_EXECUTOR_USES_FORK_SERVER
+#if SYZ_EXECUTOR || SYZ_THREADED || SYZ_REPEAT && SYZ_EXECUTOR_USES_FORK_SERVER || \
+ SYZ_ENABLE_LEAK
#include <time.h>
static uint64 current_time_ms(void)
@@ -218,7 +219,7 @@ static void remove_dir(const char* dir)
#endif
#if !GOOS_linux
-#if SYZ_EXECUTOR || SYZ_FAULT_INJECTION
+#if SYZ_EXECUTOR
static int inject_fault(int nth)
{
return 0;
@@ -638,6 +639,11 @@ static void loop(void)
#if SYZ_EXECUTOR || SYZ_USE_TMP_DIR
remove_dir(cwdbuf);
#endif
+#if SYZ_ENABLE_LEAK
+ // Note: this will fail under setuid sandbox because we don't have
+ // write permissions for the kmemleak file.
+ check_leaks();
+#endif
}
}
#else
@@ -686,6 +692,16 @@ int main(void)
/*MMAP_DATA*/
#endif
+#if SYZ_ENABLE_BINFMT_MISC
+ setup_binfmt_misc();
+#endif
+#if SYZ_ENABLE_LEAK
+ setup_leak();
+#endif
+#if SYZ_FAULT_INJECTION
+ setup_fault();
+#endif
+
#if SYZ_HANDLE_SEGV
install_segv_handler();
#endif
@@ -706,6 +722,9 @@ int main(void)
}
sleep(1000000);
#endif
+#if !SYZ_PROCS && !SYZ_REPEAT && SYZ_ENABLE_LEAK
+ check_leaks();
+#endif
return 0;
}
#endif