aboutsummaryrefslogtreecommitdiffstats
path: root/executor/common_test.h
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-07-20 20:26:05 +0200
committerDmitry Vyukov <dvyukov@google.com>2018-07-24 12:04:27 +0200
commit9fe4bdc5f1037a409e82299f36117030114c7b94 (patch)
treed3d73c1f69ded8152436be47684a07baa0e7f6ec /executor/common_test.h
parentdb7957bc09bf5715d33e4c56b8614579aa94000a (diff)
executor: overhaul
Make as much code as possible shared between all OSes. In particular main is now common across all OSes. Make more code shared between executor and csource (in particular, loop function and threaded execution logic). Also make loop and threaded logic shared across all OSes. Make more posix/unix code shared across OSes (e.g. signal handling, pthread creation, etc). Plus other changes along similar lines. Also support test OS in executor (based on portable posix) and add 4 arches that cover all execution modes (fork server/no fork server, shmem/no shmem). This change paves way for testing of executor code and allows to preserve consistency across OSes and executor/csource.
Diffstat (limited to 'executor/common_test.h')
-rw-r--r--executor/common_test.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/executor/common_test.h b/executor/common_test.h
new file mode 100644
index 000000000..38accf58a
--- /dev/null
+++ b/executor/common_test.h
@@ -0,0 +1,30 @@
+// Copyright 2018 syzkaller project authors. All rights reserved.
+// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
+
+// This file is shared between executor and csource package.
+
+#include <stdlib.h>
+#include <unistd.h>
+
+#if SYZ_EXECUTOR || __NR_syz_mmap
+static long syz_mmap(long a0, long a1)
+{
+ return 0;
+}
+#endif
+
+#if SYZ_EXECUTOR || SYZ_SANDBOX_NONE
+static void loop();
+static int do_sandbox_none(void)
+{
+ loop();
+ doexit(0);
+}
+#endif
+
+#define do_sandbox_setuid() 0
+#define do_sandbox_namespace() 0
+#define setup_loop()
+#define reset_loop()
+#define setup_test()
+#define reset_test()