aboutsummaryrefslogtreecommitdiffstats
path: root/executor/common.h
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2017-02-01 15:08:17 +0100
committerGitHub <noreply@github.com>2017-02-01 15:08:17 +0100
commit066f6fcd548686c486b7c4647bb11e83f2e7aecd (patch)
tree646cccb35941964c04c88a926cb545b7c7d139fc /executor/common.h
parentf2979ea7868a71ce0e9f9e53f717cd70385e43af (diff)
parentf81d9da13a6522d6336a95063675d6132c4bdd87 (diff)
Merge pull request #126 from xairy/tun-fix
executor: fix undefined setup_tun() function error in c repros
Diffstat (limited to 'executor/common.h')
-rw-r--r--executor/common.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/executor/common.h b/executor/common.h
index f32ed44a7..6e92743f5 100644
--- a/executor/common.h
+++ b/executor/common.h
@@ -283,10 +283,8 @@ static void initialize_tun(uint64_t pid)
static void setup_tun(uint64_t pid, bool enable_tun)
{
-#ifdef __NR_syz_emit_ethernet
if (enable_tun)
initialize_tun(pid);
-#endif
}
static uintptr_t syz_emit_ethernet(uintptr_t a0, uintptr_t a1)
@@ -497,7 +495,9 @@ static int do_sandbox_none(int executor_pid, bool enable_tun)
return pid;
sandbox_common();
+#ifdef __NR_syz_emit_ethernet
setup_tun(executor_pid, enable_tun);
+#endif
loop();
doexit(1);
@@ -512,7 +512,9 @@ static int do_sandbox_setuid(int executor_pid, bool enable_tun)
return pid;
sandbox_common();
+#ifdef __NR_syz_emit_ethernet
setup_tun(executor_pid, enable_tun);
+#endif
const int nobody = 65534;
if (setgroups(0, NULL))
@@ -566,9 +568,11 @@ static int namespace_sandbox_proc(void* arg)
if (!write_file("/proc/self/gid_map", "0 %d 1\n", real_gid))
fail("write of /proc/self/gid_map failed");
+#ifdef __NR_syz_emit_ethernet
// For sandbox namespace we setup tun after initializing uid mapping,
// otherwise ip commands fail.
setup_tun(epid, etun);
+#endif
if (mkdir("./syz-tmp", 0777))
fail("mkdir(syz-tmp) failed");