diff options
| author | Greg Steuck <greg@nest.cx> | 2023-04-25 17:16:52 +0100 |
|---|---|---|
| committer | Greg Steuck <blackgnezdo@gmail.com> | 2023-04-27 09:52:01 -0700 |
| commit | 95acf4d2258e7311d1d4deff0ab95053abf65fd1 (patch) | |
| tree | 336665ed993f106affd9da98d0c184d49c108319 | |
| parent | a18ed5a24b4dd24f8b3e9ac673347e182c9de81a (diff) | |
executor: remove openbsd bits out of common_bsd.h
| -rw-r--r-- | executor/common_bsd.h | 48 | ||||
| -rw-r--r-- | pkg/csource/generated.go | 42 |
2 files changed, 2 insertions, 88 deletions
diff --git a/executor/common_bsd.h b/executor/common_bsd.h index eac88fd3c..ca8635d27 100644 --- a/executor/common_bsd.h +++ b/executor/common_bsd.h @@ -11,24 +11,6 @@ #include <string.h> #include <sys/syscall.h> -#if GOOS_openbsd -// Needed syscall libc stubs. -#include <dirent.h> -#include <fcntl.h> -#include <poll.h> -#include <sys/event.h> -#include <sys/ioctl.h> -#include <sys/ktrace.h> -#include <sys/mman.h> -#include <sys/msg.h> -#include <sys/sem.h> -#include <sys/shm.h> -#include <sys/socket.h> -#include <sys/stat.h> -#include <sys/sysctl.h> -#include <sys/syslog.h> -#endif // GOOS_openbsd - #if GOOS_netbsd #if SYZ_EXECUTOR || __NR_syz_usb_connect @@ -109,31 +91,10 @@ static int fault_injected(int fd) #endif -#if GOOS_openbsd -#define CAST -#endif // GOOS_openbsd #if GOOS_darwin #define __syscall syscall #endif // GOOS_darwin -#if GOOS_openbsd && (SYZ_EXECUTOR || __NR_syz_open_pts) -#include <termios.h> -#include <util.h> - -static uintptr_t syz_open_pts(void) -{ - int master, slave; - - if (openpty(&master, &slave, NULL, NULL, NULL) == -1) - return -1; - // Move the master fd up in order to reduce the chances of the fuzzer - // generating a call to close(2) with the same fd. - if (dup2(master, master + 100) != -1) - close(master); - return slave; -} -#endif // GOOS_openbsd && (SYZ_EXECUTOR || __NR_syz_open_pts) - #if SYZ_EXECUTOR || SYZ_NET_INJECTION #include <fcntl.h> @@ -155,8 +116,6 @@ static int tunfd = -1; // The maximum number of tun devices is limited by the way IP addresses // are assigned. Based on this, the limit is 256. #define MAX_TUN 256 -#elif GOOS_openbsd -#define MAX_TUN 8 #else // Maximum number of tun devices in the default install. #define MAX_TUN 4 @@ -274,9 +233,7 @@ static void initialize_tun(int tun_id) snprintf_check(local_mac, sizeof(local_mac), LOCAL_MAC); // Set the MAC address of the interface to LOCAL_MAC -#if GOOS_openbsd - execute_command(1, "ifconfig %s lladdr %s", tun_iface, local_mac); -#elif GOOS_netbsd +#if GOOS_netbsd execute_command(1, "ifconfig %s link %s", tun_iface, local_mac); #else execute_command(1, "ifconfig %s ether %s", tun_iface, local_mac); @@ -437,9 +394,6 @@ static void sandbox_common() // Some minimal sandboxing. struct rlimit rlim; #ifdef GOOS_freebsd - // Documented bug in OpenBSD. - // This causes frequent random aborts. Reason unknown. - // This also causes ENOMEM on NetBSD during early init. rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_AS, &rlim); diff --git a/pkg/csource/generated.go b/pkg/csource/generated.go index 0d0a31e7a..bb62ff41a 100644 --- a/pkg/csource/generated.go +++ b/pkg/csource/generated.go @@ -490,23 +490,6 @@ void child() #include <string.h> #include <sys/syscall.h> -#if GOOS_openbsd -#include <dirent.h> -#include <fcntl.h> -#include <poll.h> -#include <sys/event.h> -#include <sys/ioctl.h> -#include <sys/ktrace.h> -#include <sys/mman.h> -#include <sys/msg.h> -#include <sys/sem.h> -#include <sys/shm.h> -#include <sys/socket.h> -#include <sys/stat.h> -#include <sys/sysctl.h> -#include <sys/syslog.h> -#endif - #if GOOS_netbsd #if SYZ_EXECUTOR || __NR_syz_usb_connect @@ -1698,29 +1681,10 @@ static int fault_injected(int fd) #endif -#if GOOS_openbsd -#define CAST -#endif #if GOOS_darwin #define __syscall syscall #endif -#if GOOS_openbsd && (SYZ_EXECUTOR || __NR_syz_open_pts) -#include <termios.h> -#include <util.h> - -static uintptr_t syz_open_pts(void) -{ - int master, slave; - - if (openpty(&master, &slave, NULL, NULL, NULL) == -1) - return -1; - if (dup2(master, master + 100) != -1) - close(master); - return slave; -} -#endif - #if SYZ_EXECUTOR || SYZ_NET_INJECTION #include <fcntl.h> @@ -1735,8 +1699,6 @@ static int tunfd = -1; #define MAX_TUN 64 #elif GOOS_freebsd #define MAX_TUN 256 -#elif GOOS_openbsd -#define MAX_TUN 8 #else #define MAX_TUN 4 #endif @@ -1840,9 +1802,7 @@ static void initialize_tun(int tun_id) char local_mac[sizeof(LOCAL_MAC)]; snprintf_check(local_mac, sizeof(local_mac), LOCAL_MAC); -#if GOOS_openbsd - execute_command(1, "ifconfig %s lladdr %s", tun_iface, local_mac); -#elif GOOS_netbsd +#if GOOS_netbsd execute_command(1, "ifconfig %s link %s", tun_iface, local_mac); #else execute_command(1, "ifconfig %s ether %s", tun_iface, local_mac); |
