diff options
| author | Michael Tüxen <tuexen@fh-muenster.de> | 2018-12-01 11:22:39 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2018-12-01 10:22:39 +0000 |
| commit | 5a58167323289751602879a986a1b9f95531a31b (patch) | |
| tree | a73fd4ca00d50e07c60e129c39ad52af300c8fa4 /executor | |
| parent | d8988561c04c0244155309bdf701998b9fb98dd5 (diff) | |
executor: add support for tap interfaces on FreeBSD
Diffstat (limited to 'executor')
| -rw-r--r-- | executor/common_bsd.h | 18 | ||||
| -rw-r--r-- | executor/defs.h | 2 | ||||
| -rw-r--r-- | executor/syscalls.h | 3 |
3 files changed, 20 insertions, 3 deletions
diff --git a/executor/common_bsd.h b/executor/common_bsd.h index be9fa4029..0d95dc42e 100644 --- a/executor/common_bsd.h +++ b/executor/common_bsd.h @@ -33,6 +33,10 @@ static uintptr_t syz_open_pts(void) #endif // SYZ_EXECUTOR || __NR_syz_open_pts +#endif // GOOS_openbsd + +#if GOOS_freebsd || GOOS_openbsd + #if SYZ_EXECUTOR || SYZ_TUN_ENABLE #include <fcntl.h> @@ -115,6 +119,12 @@ static void initialize_tun(int tun_id) snprintf_check(tun_device, sizeof(tun_device), TUN_DEVICE, tun_id); tunfd = open(tun_device, O_RDWR | O_NONBLOCK); +#if GOOS_freebsd + if ((tunfd < 0) && (errno == ENOENT)) { + execute_command(0, "kldload -q if_tap"); + tunfd = open(tun_device, O_RDWR | O_NONBLOCK); + } +#endif if (tunfd == -1) { #if SYZ_EXECUTOR fail("tun: can't open %s\n", tun_device); @@ -188,7 +198,11 @@ struct tcp_resources { uint32 ack; }; +#if GOOS_freebsd +#include <net/ethernet.h> +#else #include <net/ethertypes.h> +#endif #include <net/if.h> #include <net/if_arp.h> #include <netinet/in.h> @@ -250,13 +264,13 @@ static long syz_extract_tcp_res(long a0, long a1, long a2) return 0; } #endif -#endif // GOOS_openbsd +#endif // GOOS_freebsd || GOOS_openbsd #if SYZ_EXECUTOR || SYZ_SANDBOX_NONE static void loop(); static int do_sandbox_none(void) { -#if GOOS_openbsd && (SYZ_EXECUTOR || SYZ_TUN_ENABLE) +#if (GOOS_freebsd || GOOS_openbsd) && (SYZ_EXECUTOR || SYZ_TUN_ENABLE) initialize_tun(procid); #endif loop(); diff --git a/executor/defs.h b/executor/defs.h index a68b51024..92c89a2ad 100644 --- a/executor/defs.h +++ b/executor/defs.h @@ -20,7 +20,7 @@ #if GOARCH_amd64 #define GOARCH "amd64" -#define SYZ_REVISION "fe257e9b1cf5311f7b1627e649739577c6308e26" +#define SYZ_REVISION "4929654e4c6f12c8222436a5269c97497bd7efee" #define SYZ_EXECUTOR_USES_FORK_SERVER 1 #define SYZ_EXECUTOR_USES_SHMEM 1 #define SYZ_PAGE_SIZE 4096 diff --git a/executor/syscalls.h b/executor/syscalls.h index da4128612..b58ae2389 100644 --- a/executor/syscalls.h +++ b/executor/syscalls.h @@ -472,7 +472,10 @@ const call_t syscalls[] = { {"symlink", 57}, {"symlinkat", 502}, {"sync", 36}, + {"syz_emit_ethernet", 0, (syscall_t)syz_emit_ethernet}, {"syz_execute_func", 0, (syscall_t)syz_execute_func}, + {"syz_extract_tcp_res", 0, (syscall_t)syz_extract_tcp_res}, + {"syz_extract_tcp_res$synack", 0, (syscall_t)syz_extract_tcp_res}, {"truncate", 479}, {"unlink", 10}, {"unlinkat", 503}, |
