diff options
Diffstat (limited to 'executor')
| -rw-r--r-- | executor/common.h | 30 | ||||
| -rw-r--r-- | executor/syscalls.h | 6 |
2 files changed, 18 insertions, 18 deletions
diff --git a/executor/common.h b/executor/common.h index 6a166b6dd..8ced8313b 100644 --- a/executor/common.h +++ b/executor/common.h @@ -148,7 +148,7 @@ const int kErrorStatus = 68; // And this does not work as well. _exit has own handling of failing exit_group // in the form of HLT instruction, it will divert control flow from our loop. // So call the syscall directly. -__attribute__((noreturn)) void doexit(int status) +__attribute__((noreturn)) static void doexit(int status) { volatile unsigned i; syscall(__NR_exit_group, status); @@ -167,7 +167,7 @@ __attribute__((noreturn)) void doexit(int status) defined(SYZ_TUN_ENABLE) || defined(SYZ_SANDBOX_NAMESPACE) || defined(SYZ_SANDBOX_SETUID) || \ defined(SYZ_FAULT_INJECTION) || defined(__NR_syz_kvm_setup_cpu) // logical error (e.g. invalid input program), use as an assert() alernative -__attribute__((noreturn)) void fail(const char* msg, ...) +__attribute__((noreturn)) static void fail(const char* msg, ...) { int e = errno; fflush(stdout); @@ -184,7 +184,7 @@ __attribute__((noreturn)) void fail(const char* msg, ...) #if defined(SYZ_EXECUTOR) // kernel error (e.g. wrong syscall return value) -__attribute__((noreturn)) void error(const char* msg, ...) +__attribute__((noreturn)) static void error(const char* msg, ...) { fflush(stdout); va_list args; @@ -198,7 +198,7 @@ __attribute__((noreturn)) void error(const char* msg, ...) #if defined(SYZ_EXECUTOR) || (defined(SYZ_REPEAT) && defined(SYZ_WAIT_REPEAT)) // just exit (e.g. due to temporal ENOMEM error) -__attribute__((noreturn)) void exitf(const char* msg, ...) +__attribute__((noreturn)) static void exitf(const char* msg, ...) { int e = errno; fflush(stdout); @@ -214,7 +214,7 @@ __attribute__((noreturn)) void exitf(const char* msg, ...) #if defined(SYZ_EXECUTOR) || defined(SYZ_DEBUG) static int flag_debug; -void debug(const char* msg, ...) +static void debug(const char* msg, ...) { if (!flag_debug) return; @@ -243,8 +243,8 @@ void debug(const char* msg, ...) #endif #if defined(SYZ_EXECUTOR) || defined(SYZ_HANDLE_SEGV) -__thread int skip_segv; -__thread jmp_buf segv_env; +static __thread int skip_segv; +static __thread jmp_buf segv_env; static void segv_handler(int sig, siginfo_t* info, void* uctx) { @@ -349,7 +349,7 @@ static void execute_command(const char* format, ...) va_end(args); } -int tunfd = -1; +static int tunfd = -1; // We just need this to be large enough to hold headers that we parse (ethernet/ip/tcp). // Rest of the packet (if any) will be silently truncated which is fine. @@ -425,7 +425,7 @@ static void setup_tun(uint64_t pid, bool enable_tun) } #endif -#if defined(SYZ_EXECUTOR) || (defined(SYZ_TUN_ENABLE) && (defined(__NR_syz_extract_tcp_res) || defined(SYZ_REPEAT))) +#if defined(SYZ_EXECUTOR) || (defined(SYZ_TUN_ENABLE) && (defined(__NR_syz_extract_tcp_res) || defined(SYZ_REPEAT) && defined(SYZ_WAIT_REPEAT))) static int read_tun(char* data, int size) { int rv = read(tunfd, data, size); @@ -452,17 +452,17 @@ static void debug_dump_data(const char* data, int length) } #endif -#if defined(SYZ_EXECUTOR) || defined(SYZ_USE_CHECKSUMS) || defined(__NR_syz_test) +#if defined(SYZ_EXECUTOR) || defined(SYZ_USE_CHECKSUMS) struct csum_inet { uint32_t acc; }; -void csum_inet_init(struct csum_inet* csum) +static void csum_inet_init(struct csum_inet* csum) { csum->acc = 0; } -void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) +static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) { if (length == 0) return; @@ -478,7 +478,7 @@ void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length csum->acc = (csum->acc & 0xffff) + (csum->acc >> 16); } -uint16_t csum_inet_digest(struct csum_inet* csum) +static uint16_t csum_inet_digest(struct csum_inet* csum) { return ~csum->acc; } @@ -499,8 +499,8 @@ static uintptr_t syz_emit_ethernet(uintptr_t a0, uintptr_t a1) } #endif -#if defined(SYZ_EXECUTOR) || (defined(SYZ_REPEAT) && defined(SYZ_TUN_ENABLE)) -void flush_tun() +#if defined(SYZ_EXECUTOR) || (defined(SYZ_REPEAT) && defined(SYZ_WAIT_REPEAT) && defined(SYZ_TUN_ENABLE)) +static void flush_tun() { char data[SYZ_TUN_MAX_PACKET_SIZE]; while (read_tun(&data[0], sizeof(data)) != -1) diff --git a/executor/syscalls.h b/executor/syscalls.h index e6ba186b6..9662d7718 100644 --- a/executor/syscalls.h +++ b/executor/syscalls.h @@ -15,7 +15,7 @@ struct call_t { }; #if defined(__x86_64__) || 0 -call_t syscalls[] = { +static call_t syscalls[] = { {"accept", 43}, {"accept$alg", 43}, {"accept$ax25", 43}, @@ -1524,7 +1524,7 @@ call_t syscalls[] = { #endif #if defined(__aarch64__) || 0 -call_t syscalls[] = { +static call_t syscalls[] = { {"accept", 202}, {"accept$alg", 202}, {"accept$ax25", 202}, @@ -3033,7 +3033,7 @@ call_t syscalls[] = { #endif #if defined(__ppc64__) || defined(__PPC64__) || defined(__powerpc64__) || 0 -call_t syscalls[] = { +static call_t syscalls[] = { {"accept", 330}, {"accept$alg", 330}, {"accept$ax25", 330}, |
