From 71ac44a0c25ff6c56c29e47f864e9e0ebf167ffc Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Wed, 6 Dec 2017 09:44:21 +0100 Subject: executor: fix build exitf function was not defined with some combinations of options in csource. Fix defines and switch exitf back to fail, fail already checks ENOMEM/EAGAIN, so there is no reason to use exitf in this particular case. --- executor/common.h | 4 ++-- executor/common_linux.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'executor') diff --git a/executor/common.h b/executor/common.h index b7a0706fd..662ddea84 100644 --- a/executor/common.h +++ b/executor/common.h @@ -68,7 +68,7 @@ const int kErrorStatus = 68; #if defined(SYZ_EXECUTOR) || (defined(SYZ_REPEAT) && defined(SYZ_WAIT_REPEAT)) || \ defined(SYZ_USE_TMP_DIR) || defined(SYZ_TUN_ENABLE) || defined(SYZ_SANDBOX_NAMESPACE) || \ - defined(SYZ_SANDBOX_SETUID) || defined(SYZ_FAULT_INJECTION) || defined(__NR_syz_kvm_setup_cpu) + defined(SYZ_SANDBOX_NONE) || defined(SYZ_SANDBOX_SETUID) || defined(__NR_syz_kvm_setup_cpu) // logical error (e.g. invalid input program), use as an assert() alernative NORETURN static void fail(const char* msg, ...) { @@ -97,7 +97,7 @@ NORETURN static void error(const char* msg, ...) } #endif -#if defined(SYZ_EXECUTOR) || (defined(SYZ_REPEAT) && defined(SYZ_WAIT_REPEAT) && defined(SYZ_USE_TMP_DIR)) +#if defined(SYZ_EXECUTOR) || (defined(SYZ_REPEAT) && defined(SYZ_WAIT_REPEAT) && defined(SYZ_USE_TMP_DIR)) || defined(SYZ_FAULT_INJECTION) // just exit (e.g. due to temporal ENOMEM error) NORETURN static void exitf(const char* msg, ...) { diff --git a/executor/common_linux.h b/executor/common_linux.h index b405b999b..a28783ee1 100644 --- a/executor/common_linux.h +++ b/executor/common_linux.h @@ -723,7 +723,7 @@ static int do_sandbox_none(int executor_pid, bool enable_tun) unshare(CLONE_NEWPID); int pid = fork(); if (pid < 0) - exitf("sandbox fork failed"); + fail("sandbox fork failed"); if (pid) return pid; @@ -743,7 +743,7 @@ static int do_sandbox_setuid(int executor_pid, bool enable_tun) unshare(CLONE_NEWPID); int pid = fork(); if (pid < 0) - exitf("sandbox fork failed"); + fail("sandbox fork failed"); if (pid) return pid; @@ -876,7 +876,7 @@ static int do_sandbox_namespace(int executor_pid, bool enable_tun) pid = clone(namespace_sandbox_proc, &sandbox_stack[sizeof(sandbox_stack) - 64], CLONE_NEWUSER | CLONE_NEWPID, NULL); if (pid < 0) - exitf("sandbox clone failed"); + fail("sandbox clone failed"); return pid; } #endif @@ -1011,7 +1011,7 @@ void loop() #endif int pid = fork(); if (pid < 0) - exitf("loop fork failed"); + fail("loop fork failed"); if (pid == 0) { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setpgrp(); -- cgit mrf-deployment