aboutsummaryrefslogtreecommitdiffstats
path: root/executor
diff options
context:
space:
mode:
Diffstat (limited to 'executor')
-rw-r--r--executor/common.h3
-rw-r--r--executor/common_linux.h8
-rw-r--r--executor/executor_linux.h1
3 files changed, 12 insertions, 0 deletions
diff --git a/executor/common.h b/executor/common.h
index 1d0616d70..2671db7d7 100644
--- a/executor/common.h
+++ b/executor/common.h
@@ -704,6 +704,9 @@ int main(void)
#if SYZ_FAULT_INJECTION
setup_fault();
#endif
+#if SYZ_ENABLE_KCSAN
+ setup_kcsan();
+#endif
#if SYZ_HANDLE_SEGV
install_segv_handler();
diff --git a/executor/common_linux.h b/executor/common_linux.h
index 2d36b998e..13bc71011 100644
--- a/executor/common_linux.h
+++ b/executor/common_linux.h
@@ -2778,3 +2778,11 @@ static void setup_binfmt_misc()
write_file("/proc/sys/fs/binfmt_misc/register", ":syz1:M:1:\x02::./file0:POC");
}
#endif
+
+#if SYZ_EXECUTOR || SYZ_ENABLE_KCSAN
+static void setup_kcsan()
+{
+ if (!write_file("/proc/kcsaninfo", "on"))
+ fail("failed to enable KCSAN");
+}
+#endif
diff --git a/executor/executor_linux.h b/executor/executor_linux.h
index fdd274162..45a0bf8aa 100644
--- a/executor/executor_linux.h
+++ b/executor/executor_linux.h
@@ -181,4 +181,5 @@ static feature_t features[] = {
{"leak", setup_leak},
{"fault", setup_fault},
{"binfmt_misc", setup_binfmt_misc},
+ {"kcsan", setup_kcsan},
};