From e5d3015f47ca8f88dfedb85243e8e77957bd51cd Mon Sep 17 00:00:00 2001 From: Patrick Meyer Date: Thu, 6 May 2021 23:08:51 +0200 Subject: executor: initial darwin support --- executor/common_bsd.h | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'executor/common_bsd.h') diff --git a/executor/common_bsd.h b/executor/common_bsd.h index 1bed0cf3c..398d402fb 100644 --- a/executor/common_bsd.h +++ b/executor/common_bsd.h @@ -89,12 +89,11 @@ static int fault_injected(int fd) #endif -#if GOOS_openbsd - +#if GOOS_openbsd || GOOS_darwin #define __syscall syscall +#endif // GOOS_openbsd || GOOS_darwin -#if SYZ_EXECUTOR || __NR_syz_open_pts - +#if GOOS_openbsd && (SYZ_EXECUTOR || __NR_syz_open_pts) #include #include @@ -110,15 +109,18 @@ static uintptr_t syz_open_pts(void) close(master); return slave; } - -#endif // SYZ_EXECUTOR || __NR_syz_open_pts - -#endif // GOOS_openbsd +#endif // GOOS_openbsd && (SYZ_EXECUTOR || __NR_syz_open_pts) #if SYZ_EXECUTOR || SYZ_NET_INJECTION #include +// FIXME(HerrSpace): XNU has xnu/bsd/netinet/if_tun.h, but it's not shipped in +// the installed header files (probably internal). It's also likely not very +// interesting, as XNU only ships a tun driver called utun, not tap which is +// currently required for SYZ_NET_INJECTION anyhow. +#if !GOOS_darwin #include +#endif // !GOOS_darwin #include static int tunfd = -1; @@ -269,7 +271,7 @@ static void initialize_tun(int tun_id) #endif // SYZ_EXECUTOR || SYZ_NET_INJECTION -#if SYZ_EXECUTOR || __NR_syz_emit_ethernet && SYZ_NET_INJECTION +#if !GOOS_darwin && SYZ_EXECUTOR || __NR_syz_emit_ethernet && SYZ_NET_INJECTION #include #include @@ -287,7 +289,7 @@ static long syz_emit_ethernet(volatile long a0, volatile long a1) } #endif -#if SYZ_EXECUTOR || SYZ_NET_INJECTION && (__NR_syz_extract_tcp_res || SYZ_REPEAT) +#if !GOOS_darwin && SYZ_EXECUTOR || SYZ_NET_INJECTION && (__NR_syz_extract_tcp_res || SYZ_REPEAT) #include static int read_tun(char* data, int size) @@ -305,14 +307,14 @@ static int read_tun(char* data, int size) } #endif -#if SYZ_EXECUTOR || __NR_syz_extract_tcp_res && SYZ_NET_INJECTION +#if !GOOS_darwin && SYZ_EXECUTOR || __NR_syz_extract_tcp_res && SYZ_NET_INJECTION struct tcp_resources { uint32 seq; uint32 ack; }; -#if GOOS_freebsd +#if GOOS_freebsd || GOOS_darwin #include #else #include -- cgit mrf-deployment