ok github.com/google/syzkaller/dashboard/app (cached) ? github.com/google/syzkaller/dashboard/dashapi [no test files] ? github.com/google/syzkaller/executor [no test files] ok github.com/google/syzkaller/pkg/ast 2.548s ok github.com/google/syzkaller/pkg/bisect 98.310s ok github.com/google/syzkaller/pkg/build 2.225s ? github.com/google/syzkaller/pkg/cmdprof [no test files] ok github.com/google/syzkaller/pkg/compiler 14.112s ok github.com/google/syzkaller/pkg/config (cached) ? github.com/google/syzkaller/pkg/cover [no test files] --- FAIL: TestGenerate (9.69s) --- FAIL: TestGenerate/freebsd/386 (1.51s) csource_test.go:66: seed=1596553425896528322 --- FAIL: TestGenerate/freebsd/386/0 (0.98s) csource_test.go:122: opts: {Threaded:false Collide:false Repeat:true RepeatTimes:0 Procs:0 Sandbox:none Fault:false FaultCall:0 FaultNth:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false VhciInjection:false UseTmpDir:true HandleSegv:false Repro:false Trace:false} program: mkdir(&(0x7f0000000000)='./file0\x00', 0xa5) getpeername(0xffffffffffffff9c, &(0x7f0000000040)=@in6={0x1c, 0x1c, 0xffffffffffffffff, 0x0, @mcast2}, &(0x7f0000000080)=0x1c) r0 = fcntl$dupfd(0xffffffffffffffff, 0x11, 0xffffffffffffff9c) setsockopt$inet6_tcp_TCP_CONGESTION(r0, 0x6, 0x40, &(0x7f00000000c0)='chd\x00', 0x4) r1 = socket$inet6_icmp_raw(0x1c, 0x3, 0x3a) getsockopt$inet_sctp_SCTP_PEER_ADDR_PARAMS(r0, 0x84, 0xa, &(0x7f0000000100)={@in={{0x10, 0x2, 0x3, @multicast2}}, 0x0, 0x401, 0x7, 0x1, 0x4, 0x400, 0x20}, &(0x7f00000001c0)=0xa0) setsockopt$inet6_sctp_SCTP_ADD_STREAMS(r1, 0x84, 0x903, &(0x7f0000000200)={r2, 0x8, 0xffff}, 0x8) r3 = dup(0xffffffffffffffff) readlinkat(r3, &(0x7f0000000240)='./file0\x00', &(0x7f0000000280)=""/33, 0x21) shm_open2(&(0x7f00000002c0)='./file0\x00', 0x0, 0x50, 0x0, &(0x7f0000000300)='/#@\x00') syz_emit_ethernet(0x58, &(0x7f0000000000)={@remote, @broadcast, [], {@generic={0xe73d, "bb14e45374361790bbc0da8140f66ab0fc1174330be7643994f9efa065c589b84619520c53618a6bd0481668f70423425878138df97e84886332d304258618e730f3e0f2a1460c285b19"}}}) syz_execute_func(&(0x7f0000000080)="7e02c4e1e1160965260f01fac4c3497c50057dc4e27dbdc7f30f1efcc4e179108112f44a60c4e3b5cf3f5f36ea090000006f37c4c1b4142f") syz_extract_tcp_res(&(0x7f00000000c0), 0x80000000, 0xa23) csource_test.go:123: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void remove_dir(const char* dir) { DIR* dp; struct dirent* ep; dp = opendir(dir); if (dp == NULL) exit(1); while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } if (unlink(filename)) exit(1); } closedir(dp); if (rmdir(dir)) exit(1); } static void sandbox_common() { if (setsid() == -1) exit(1); struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 8 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 0; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); } static void loop(); static int do_sandbox_none(void) { sandbox_common(); loop(); return 0; } static long syz_execute_func(volatile long text) { volatile long p[8] = {0}; (void)p; ((void (*)(void))(text))(); return 0; } static void execute_one(void); #define WAIT_FLAGS 0 static void loop(void) { int iter; for (iter = 0;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5 * 1000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xffffffffffffffff}; void execute_one(void) { intptr_t res = 0; memcpy((void*)0x10000000, "./file0\000", 8); syscall(SYS_mkdir, 0x10000000, 0xa5); *(uint32_t*)0x10000080 = 0x1c; syscall(SYS_getpeername, 0xffffff9c, 0x10000040, 0x10000080); res = syscall(SYS_fcntl, -1, 0x11, 0xffffff9c); if (res != -1) r[0] = res; memcpy((void*)0x100000c0, "chd\000", 4); syscall(SYS_setsockopt, (intptr_t)r[0], 6, 0x40, 0x100000c0, 4); res = syscall(SYS_socket, 0x1c, 3, 0x3a); if (res != -1) r[1] = res; *(uint8_t*)0x10000100 = 0x10; *(uint8_t*)0x10000101 = 2; *(uint16_t*)0x10000102 = htobe16(0x4e23); *(uint32_t*)0x10000104 = htobe32(0xe0000002); *(uint8_t*)0x10000108 = 0; *(uint8_t*)0x10000109 = 0; *(uint8_t*)0x1000010a = 0; *(uint8_t*)0x1000010b = 0; *(uint8_t*)0x1000010c = 0; *(uint8_t*)0x1000010d = 0; *(uint8_t*)0x1000010e = 0; *(uint8_t*)0x1000010f = 0; *(uint64_t*)0x10000110 = 0; *(uint64_t*)0x10000118 = 0; *(uint64_t*)0x10000120 = 0; *(uint64_t*)0x10000128 = 0; *(uint64_t*)0x10000130 = 0; *(uint64_t*)0x10000138 = 0; *(uint64_t*)0x10000140 = 0; *(uint64_t*)0x10000148 = 0; *(uint64_t*)0x10000150 = 0; *(uint64_t*)0x10000158 = 0; *(uint64_t*)0x10000160 = 0; *(uint64_t*)0x10000168 = 0; *(uint64_t*)0x10000170 = 0; *(uint64_t*)0x10000178 = 0; *(uint64_t*)0x10000180 = 0; *(uint32_t*)0x10000188 = 0; *(uint32_t*)0x1000018c = 0x401; *(uint32_t*)0x10000190 = 7; *(uint32_t*)0x10000194 = 1; *(uint32_t*)0x10000198 = 4; *(uint16_t*)0x1000019c = 0x400; *(uint8_t*)0x1000019e = 0x20; *(uint32_t*)0x100001c0 = 0xa0; res = syscall(SYS_getsockopt, (intptr_t)r[0], 0x84, 0xa, 0x10000100, 0x100001c0); if (res != -1) r[2] = *(uint32_t*)0x10000188; *(uint32_t*)0x10000200 = r[2]; *(uint16_t*)0x10000204 = 8; *(uint16_t*)0x10000206 = -1; syscall(SYS_setsockopt, (intptr_t)r[1], 0x84, 0x903, 0x10000200, 8); res = syscall(SYS_dup, -1); if (res != -1) r[3] = res; memcpy((void*)0x10000240, "./file0\000", 8); syscall(SYS_readlinkat, (intptr_t)r[3], 0x10000240, 0x10000280, 0x21); memcpy((void*)0x100002c0, "./file0\000", 8); memcpy((void*)0x10000300, "/#@\000", 4); syscall(SYS_shm_open2, 0x100002c0, 0, 0x50, 0, 0x10000300); *(uint8_t*)0x10000000 = 0xaa; *(uint8_t*)0x10000001 = 0xaa; *(uint8_t*)0x10000002 = 0xaa; *(uint8_t*)0x10000003 = 0xaa; *(uint8_t*)0x10000004 = 0xaa; *(uint8_t*)0x10000005 = 0xbb; *(uint8_t*)0x10000006 = -1; *(uint8_t*)0x10000007 = -1; *(uint8_t*)0x10000008 = -1; *(uint8_t*)0x10000009 = -1; *(uint8_t*)0x1000000a = -1; *(uint8_t*)0x1000000b = -1; *(uint16_t*)0x1000000c = htobe16(0xe73d); memcpy((void*)0x1000000e, "\xbb\x14\xe4\x53\x74\x36\x17\x90\xbb\xc0\xda\x81\x40\xf6\x6a\xb0\xfc\x11\x74\x33\x0b\xe7\x64\x39\x94\xf9\xef\xa0\x65\xc5\x89\xb8\x46\x19\x52\x0c\x53\x61\x8a\x6b\xd0\x48\x16\x68\xf7\x04\x23\x42\x58\x78\x13\x8d\xf9\x7e\x84\x88\x63\x32\xd3\x04\x25\x86\x18\xe7\x30\xf3\xe0\xf2\xa1\x46\x0c\x28\x5b\x19", 74); memcpy((void*)0x10000080, "\x7e\x02\xc4\xe1\xe1\x16\x09\x65\x26\x0f\x01\xfa\xc4\xc3\x49\x7c\x50\x05\x7d\xc4\xe2\x7d\xbd\xc7\xf3\x0f\x1e\xfc\xc4\xe1\x79\x10\x81\x12\xf4\x4a\x60\xc4\xe3\xb5\xcf\x3f\x5f\x36\xea\x09\x00\x00\x00\x6f\x37\xc4\xc1\xb4\x14\x2f", 56); syz_execute_func(0x10000080); } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); use_temporary_dir(); do_sandbox_none(); return 0; } :221:10: error: use of undeclared identifier 'SYS_shm_open2' syscall(SYS_shm_open2, 0x100002c0, 0, 0x50, 0, 0x10000300); ^ 1 error generated. compiler invocation: clang [-o /tmp/syz-executor030270719 -DGOOS_freebsd=1 -DGOARCH_386=1 -DHOSTGOOS_freebsd=1 -x c - -m32 -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -static -lc++ -Wno-overflow] --- FAIL: TestGenerate/freebsd/386/8 (1.42s) csource_test.go:122: opts: {Threaded:true Collide:false Repeat:true RepeatTimes:0 Procs:0 Sandbox:setuid Fault:false FaultCall:0 FaultNth:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false VhciInjection:false UseTmpDir:true HandleSegv:false Repro:false Trace:false} program: mkdir(&(0x7f0000000000)='./file0\x00', 0xa5) getpeername(0xffffffffffffff9c, &(0x7f0000000040)=@in6={0x1c, 0x1c, 0xffffffffffffffff, 0x0, @mcast2}, &(0x7f0000000080)=0x1c) r0 = fcntl$dupfd(0xffffffffffffffff, 0x11, 0xffffffffffffff9c) setsockopt$inet6_tcp_TCP_CONGESTION(r0, 0x6, 0x40, &(0x7f00000000c0)='chd\x00', 0x4) r1 = socket$inet6_icmp_raw(0x1c, 0x3, 0x3a) getsockopt$inet_sctp_SCTP_PEER_ADDR_PARAMS(r0, 0x84, 0xa, &(0x7f0000000100)={@in={{0x10, 0x2, 0x3, @multicast2}}, 0x0, 0x401, 0x7, 0x1, 0x4, 0x400, 0x20}, &(0x7f00000001c0)=0xa0) setsockopt$inet6_sctp_SCTP_ADD_STREAMS(r1, 0x84, 0x903, &(0x7f0000000200)={r2, 0x8, 0xffff}, 0x8) r3 = dup(0xffffffffffffffff) readlinkat(r3, &(0x7f0000000240)='./file0\x00', &(0x7f0000000280)=""/33, 0x21) shm_open2(&(0x7f00000002c0)='./file0\x00', 0x0, 0x50, 0x0, &(0x7f0000000300)='/#@\x00') syz_emit_ethernet(0x58, &(0x7f0000000000)={@remote, @broadcast, [], {@generic={0xe73d, "bb14e45374361790bbc0da8140f66ab0fc1174330be7643994f9efa065c589b84619520c53618a6bd0481668f70423425878138df97e84886332d304258618e730f3e0f2a1460c285b19"}}}) syz_execute_func(&(0x7f0000000080)="7e02c4e1e1160965260f01fac4c3497c50057dc4e27dbdc7f30f1efcc4e179108112f44a60c4e3b5cf3f5f36ea090000006f37c4c1b4142f") syz_extract_tcp_res(&(0x7f00000000c0), 0x80000000, 0xa23) csource_test.go:123: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void remove_dir(const char* dir) { DIR* dp; struct dirent* ep; dp = opendir(dir); if (dp == NULL) exit(1); while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } if (unlink(filename)) exit(1); } closedir(dp); if (rmdir(dir)) exit(1); } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i; for (i = 0; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { pthread_mutex_t mu; pthread_cond_t cv; int state; } event_t; static void event_init(event_t* ev) { if (pthread_mutex_init(&ev->mu, 0)) exit(1); if (pthread_cond_init(&ev->cv, 0)) exit(1); ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { pthread_mutex_lock(&ev->mu); if (ev->state) exit(1); ev->state = 1; pthread_mutex_unlock(&ev->mu); pthread_cond_broadcast(&ev->cv); } static void event_wait(event_t* ev) { pthread_mutex_lock(&ev->mu); while (!ev->state) pthread_cond_wait(&ev->cv, &ev->mu); pthread_mutex_unlock(&ev->mu); } static int event_isset(event_t* ev) { pthread_mutex_lock(&ev->mu); int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; pthread_mutex_lock(&ev->mu); for (;;) { if (ev->state) break; uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); now = current_time_ms(); if (now - start > timeout) break; } int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static void sandbox_common() { if (setsid() == -1) exit(1); struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 8 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 0; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); } static void loop(); static int wait_for_loop(int pid) { if (pid < 0) exit(1); int status = 0; while (waitpid(-1, &status, WUNTRACED) != pid) { } return WEXITSTATUS(status); } static int do_sandbox_setuid(void) { int pid = fork(); if (pid != 0) return wait_for_loop(pid); sandbox_common(); char pwbuf[1024]; struct passwd *pw, pwres; if (getpwnam_r("nobody", &pwres, pwbuf, sizeof(pwbuf), &pw) != 0 || !pw) exit(1); if (setgroups(0, NULL)) exit(1); if (setgid(pw->pw_gid)) exit(1); if (setuid(pw->pw_uid)) exit(1); loop(); exit(1); } static long syz_execute_func(volatile long text) { volatile long p[8] = {0}; (void)p; ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 13; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); event_timedwait(&th->done, 45); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); #define WAIT_FLAGS 0 static void loop(void) { int iter; for (iter = 0;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5 * 1000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xffffffffffffffff}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: memcpy((void*)0x10000000, "./file0\000", 8); syscall(SYS_mkdir, 0x10000000, 0xa5); break; case 1: *(uint32_t*)0x10000080 = 0x1c; syscall(SYS_getpeername, 0xffffff9c, 0x10000040, 0x10000080); break; case 2: res = syscall(SYS_fcntl, -1, 0x11, 0xffffff9c); if (res != -1) r[0] = res; break; case 3: memcpy((void*)0x100000c0, "chd\000", 4); syscall(SYS_setsockopt, (intptr_t)r[0], 6, 0x40, 0x100000c0, 4); break; case 4: res = syscall(SYS_socket, 0x1c, 3, 0x3a); if (res != -1) r[1] = res; break; case 5: *(uint8_t*)0x10000100 = 0x10; *(uint8_t*)0x10000101 = 2; *(uint16_t*)0x10000102 = htobe16(0x4e23); *(uint32_t*)0x10000104 = htobe32(0xe0000002); *(uint8_t*)0x10000108 = 0; *(uint8_t*)0x10000109 = 0; *(uint8_t*)0x1000010a = 0; *(uint8_t*)0x1000010b = 0; *(uint8_t*)0x1000010c = 0; *(uint8_t*)0x1000010d = 0; *(uint8_t*)0x1000010e = 0; *(uint8_t*)0x1000010f = 0; *(uint64_t*)0x10000110 = 0; *(uint64_t*)0x10000118 = 0; *(uint64_t*)0x10000120 = 0; *(uint64_t*)0x10000128 = 0; *(uint64_t*)0x10000130 = 0; *(uint64_t*)0x10000138 = 0; *(uint64_t*)0x10000140 = 0; *(uint64_t*)0x10000148 = 0; *(uint64_t*)0x10000150 = 0; *(uint64_t*)0x10000158 = 0; *(uint64_t*)0x10000160 = 0; *(uint64_t*)0x10000168 = 0; *(uint64_t*)0x10000170 = 0; *(uint64_t*)0x10000178 = 0; *(uint64_t*)0x10000180 = 0; *(uint32_t*)0x10000188 = 0; *(uint32_t*)0x1000018c = 0x401; *(uint32_t*)0x10000190 = 7; *(uint32_t*)0x10000194 = 1; *(uint32_t*)0x10000198 = 4; *(uint16_t*)0x1000019c = 0x400; *(uint8_t*)0x1000019e = 0x20; *(uint32_t*)0x100001c0 = 0xa0; res = syscall(SYS_getsockopt, (intptr_t)r[0], 0x84, 0xa, 0x10000100, 0x100001c0); if (res != -1) r[2] = *(uint32_t*)0x10000188; break; case 6: *(uint32_t*)0x10000200 = r[2]; *(uint16_t*)0x10000204 = 8; *(uint16_t*)0x10000206 = -1; syscall(SYS_setsockopt, (intptr_t)r[1], 0x84, 0x903, 0x10000200, 8); break; case 7: res = syscall(SYS_dup, -1); if (res != -1) r[3] = res; break; case 8: memcpy((void*)0x10000240, "./file0\000", 8); syscall(SYS_readlinkat, (intptr_t)r[3], 0x10000240, 0x10000280, 0x21); break; case 9: memcpy((void*)0x100002c0, "./file0\000", 8); memcpy((void*)0x10000300, "/#@\000", 4); syscall(SYS_shm_open2, 0x100002c0, 0, 0x50, 0, 0x10000300); break; case 10: *(uint8_t*)0x10000000 = 0xaa; *(uint8_t*)0x10000001 = 0xaa; *(uint8_t*)0x10000002 = 0xaa; *(uint8_t*)0x10000003 = 0xaa; *(uint8_t*)0x10000004 = 0xaa; *(uint8_t*)0x10000005 = 0xbb; *(uint8_t*)0x10000006 = -1; *(uint8_t*)0x10000007 = -1; *(uint8_t*)0x10000008 = -1; *(uint8_t*)0x10000009 = -1; *(uint8_t*)0x1000000a = -1; *(uint8_t*)0x1000000b = -1; *(uint16_t*)0x1000000c = htobe16(0xe73d); memcpy((void*)0x1000000e, "\xbb\x14\xe4\x53\x74\x36\x17\x90\xbb\xc0\xda\x81\x40\xf6\x6a\xb0\xfc\x11\x74\x33\x0b\xe7\x64\x39\x94\xf9\xef\xa0\x65\xc5\x89\xb8\x46\x19\x52\x0c\x53\x61\x8a\x6b\xd0\x48\x16\x68\xf7\x04\x23\x42\x58\x78\x13\x8d\xf9\x7e\x84\x88\x63\x32\xd3\x04\x25\x86\x18\xe7\x30\xf3\xe0\xf2\xa1\x46\x0c\x28\x5b\x19", 74); break; case 11: memcpy((void*)0x10000080, "\x7e\x02\xc4\xe1\xe1\x16\x09\x65\x26\x0f\x01\xfa\xc4\xc3\x49\x7c\x50\x05\x7d\xc4\xe2\x7d\xbd\xc7\xf3\x0f\x1e\xfc\xc4\xe1\x79\x10\x81\x12\xf4\x4a\x60\xc4\xe3\xb5\xcf\x3f\x5f\x36\xea\x09\x00\x00\x00\x6f\x37\xc4\xc1\xb4\x14\x2f", 56); syz_execute_func(0x10000080); break; case 12: break; } } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); use_temporary_dir(); do_sandbox_setuid(); return 0; } :404:11: error: use of undeclared identifier 'SYS_shm_open2' syscall(SYS_shm_open2, 0x100002c0, 0, 0x50, 0, 0x10000300); ^ 1 error generated. compiler invocation: clang [-o /tmp/syz-executor660631634 -DGOOS_freebsd=1 -DGOARCH_386=1 -DHOSTGOOS_freebsd=1 -x c - -m32 -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -static -lc++ -Wno-overflow] --- FAIL: TestGenerate/freebsd/386/12 (1.56s) csource_test.go:122: opts: {Threaded:true Collide:false Repeat:true RepeatTimes:0 Procs:0 Sandbox:none Fault:false FaultCall:0 FaultNth:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false VhciInjection:false UseTmpDir:true HandleSegv:false Repro:true Trace:false} program: mkdir(&(0x7f0000000000)='./file0\x00', 0xa5) getpeername(0xffffffffffffff9c, &(0x7f0000000040)=@in6={0x1c, 0x1c, 0xffffffffffffffff, 0x0, @mcast2}, &(0x7f0000000080)=0x1c) r0 = fcntl$dupfd(0xffffffffffffffff, 0x11, 0xffffffffffffff9c) setsockopt$inet6_tcp_TCP_CONGESTION(r0, 0x6, 0x40, &(0x7f00000000c0)='chd\x00', 0x4) r1 = socket$inet6_icmp_raw(0x1c, 0x3, 0x3a) getsockopt$inet_sctp_SCTP_PEER_ADDR_PARAMS(r0, 0x84, 0xa, &(0x7f0000000100)={@in={{0x10, 0x2, 0x3, @multicast2}}, 0x0, 0x401, 0x7, 0x1, 0x4, 0x400, 0x20}, &(0x7f00000001c0)=0xa0) setsockopt$inet6_sctp_SCTP_ADD_STREAMS(r1, 0x84, 0x903, &(0x7f0000000200)={r2, 0x8, 0xffff}, 0x8) r3 = dup(0xffffffffffffffff) readlinkat(r3, &(0x7f0000000240)='./file0\x00', &(0x7f0000000280)=""/33, 0x21) shm_open2(&(0x7f00000002c0)='./file0\x00', 0x0, 0x50, 0x0, &(0x7f0000000300)='/#@\x00') syz_emit_ethernet(0x58, &(0x7f0000000000)={@remote, @broadcast, [], {@generic={0xe73d, "bb14e45374361790bbc0da8140f66ab0fc1174330be7643994f9efa065c589b84619520c53618a6bd0481668f70423425878138df97e84886332d304258618e730f3e0f2a1460c285b19"}}}) syz_execute_func(&(0x7f0000000080)="7e02c4e1e1160965260f01fac4c3497c50057dc4e27dbdc7f30f1efcc4e179108112f44a60c4e3b5cf3f5f36ea090000006f37c4c1b4142f") syz_extract_tcp_res(&(0x7f00000000c0), 0x80000000, 0xa23) csource_test.go:123: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void remove_dir(const char* dir) { DIR* dp; struct dirent* ep; dp = opendir(dir); if (dp == NULL) exit(1); while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } if (unlink(filename)) exit(1); } closedir(dp); if (rmdir(dir)) exit(1); } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i; for (i = 0; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { pthread_mutex_t mu; pthread_cond_t cv; int state; } event_t; static void event_init(event_t* ev) { if (pthread_mutex_init(&ev->mu, 0)) exit(1); if (pthread_cond_init(&ev->cv, 0)) exit(1); ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { pthread_mutex_lock(&ev->mu); if (ev->state) exit(1); ev->state = 1; pthread_mutex_unlock(&ev->mu); pthread_cond_broadcast(&ev->cv); } static void event_wait(event_t* ev) { pthread_mutex_lock(&ev->mu); while (!ev->state) pthread_cond_wait(&ev->cv, &ev->mu); pthread_mutex_unlock(&ev->mu); } static int event_isset(event_t* ev) { pthread_mutex_lock(&ev->mu); int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; pthread_mutex_lock(&ev->mu); for (;;) { if (ev->state) break; uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); now = current_time_ms(); if (now - start > timeout) break; } int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static void sandbox_common() { if (setsid() == -1) exit(1); struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 8 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 0; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); } static void loop(); static int do_sandbox_none(void) { sandbox_common(); loop(); return 0; } static long syz_execute_func(volatile long text) { volatile long p[8] = {0}; (void)p; ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } int i, call, thread; for (call = 0; call < 13; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); event_timedwait(&th->done, 45); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); #define WAIT_FLAGS 0 static void loop(void) { int iter; for (iter = 0;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5 * 1000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xffffffffffffffff}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: memcpy((void*)0x10000000, "./file0\000", 8); syscall(SYS_mkdir, 0x10000000, 0xa5); break; case 1: *(uint32_t*)0x10000080 = 0x1c; syscall(SYS_getpeername, 0xffffff9c, 0x10000040, 0x10000080); break; case 2: res = syscall(SYS_fcntl, -1, 0x11, 0xffffff9c); if (res != -1) r[0] = res; break; case 3: memcpy((void*)0x100000c0, "chd\000", 4); syscall(SYS_setsockopt, (intptr_t)r[0], 6, 0x40, 0x100000c0, 4); break; case 4: res = syscall(SYS_socket, 0x1c, 3, 0x3a); if (res != -1) r[1] = res; break; case 5: *(uint8_t*)0x10000100 = 0x10; *(uint8_t*)0x10000101 = 2; *(uint16_t*)0x10000102 = htobe16(0x4e23); *(uint32_t*)0x10000104 = htobe32(0xe0000002); *(uint8_t*)0x10000108 = 0; *(uint8_t*)0x10000109 = 0; *(uint8_t*)0x1000010a = 0; *(uint8_t*)0x1000010b = 0; *(uint8_t*)0x1000010c = 0; *(uint8_t*)0x1000010d = 0; *(uint8_t*)0x1000010e = 0; *(uint8_t*)0x1000010f = 0; *(uint64_t*)0x10000110 = 0; *(uint64_t*)0x10000118 = 0; *(uint64_t*)0x10000120 = 0; *(uint64_t*)0x10000128 = 0; *(uint64_t*)0x10000130 = 0; *(uint64_t*)0x10000138 = 0; *(uint64_t*)0x10000140 = 0; *(uint64_t*)0x10000148 = 0; *(uint64_t*)0x10000150 = 0; *(uint64_t*)0x10000158 = 0; *(uint64_t*)0x10000160 = 0; *(uint64_t*)0x10000168 = 0; *(uint64_t*)0x10000170 = 0; *(uint64_t*)0x10000178 = 0; *(uint64_t*)0x10000180 = 0; *(uint32_t*)0x10000188 = 0; *(uint32_t*)0x1000018c = 0x401; *(uint32_t*)0x10000190 = 7; *(uint32_t*)0x10000194 = 1; *(uint32_t*)0x10000198 = 4; *(uint16_t*)0x1000019c = 0x400; *(uint8_t*)0x1000019e = 0x20; *(uint32_t*)0x100001c0 = 0xa0; res = syscall(SYS_getsockopt, (intptr_t)r[0], 0x84, 0xa, 0x10000100, 0x100001c0); if (res != -1) r[2] = *(uint32_t*)0x10000188; break; case 6: *(uint32_t*)0x10000200 = r[2]; *(uint16_t*)0x10000204 = 8; *(uint16_t*)0x10000206 = -1; syscall(SYS_setsockopt, (intptr_t)r[1], 0x84, 0x903, 0x10000200, 8); break; case 7: res = syscall(SYS_dup, -1); if (res != -1) r[3] = res; break; case 8: memcpy((void*)0x10000240, "./file0\000", 8); syscall(SYS_readlinkat, (intptr_t)r[3], 0x10000240, 0x10000280, 0x21); break; case 9: memcpy((void*)0x100002c0, "./file0\000", 8); memcpy((void*)0x10000300, "/#@\000", 4); syscall(SYS_shm_open2, 0x100002c0, 0, 0x50, 0, 0x10000300); break; case 10: *(uint8_t*)0x10000000 = 0xaa; *(uint8_t*)0x10000001 = 0xaa; *(uint8_t*)0x10000002 = 0xaa; *(uint8_t*)0x10000003 = 0xaa; *(uint8_t*)0x10000004 = 0xaa; *(uint8_t*)0x10000005 = 0xbb; *(uint8_t*)0x10000006 = -1; *(uint8_t*)0x10000007 = -1; *(uint8_t*)0x10000008 = -1; *(uint8_t*)0x10000009 = -1; *(uint8_t*)0x1000000a = -1; *(uint8_t*)0x1000000b = -1; *(uint16_t*)0x1000000c = htobe16(0xe73d); memcpy((void*)0x1000000e, "\xbb\x14\xe4\x53\x74\x36\x17\x90\xbb\xc0\xda\x81\x40\xf6\x6a\xb0\xfc\x11\x74\x33\x0b\xe7\x64\x39\x94\xf9\xef\xa0\x65\xc5\x89\xb8\x46\x19\x52\x0c\x53\x61\x8a\x6b\xd0\x48\x16\x68\xf7\x04\x23\x42\x58\x78\x13\x8d\xf9\x7e\x84\x88\x63\x32\xd3\x04\x25\x86\x18\xe7\x30\xf3\xe0\xf2\xa1\x46\x0c\x28\x5b\x19", 74); break; case 11: memcpy((void*)0x10000080, "\x7e\x02\xc4\xe1\xe1\x16\x09\x65\x26\x0f\x01\xfa\xc4\xc3\x49\x7c\x50\x05\x7d\xc4\xe2\x7d\xbd\xc7\xf3\x0f\x1e\xfc\xc4\xe1\x79\x10\x81\x12\xf4\x4a\x60\xc4\xe3\xb5\xcf\x3f\x5f\x36\xea\x09\x00\x00\x00\x6f\x37\xc4\xc1\xb4\x14\x2f", 56); syz_execute_func(0x10000080); break; case 12: break; } } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); use_temporary_dir(); do_sandbox_none(); return 0; } :383:11: error: use of undeclared identifier 'SYS_shm_open2' syscall(SYS_shm_open2, 0x100002c0, 0, 0x50, 0, 0x10000300); ^ 1 error generated. compiler invocation: clang [-o /tmp/syz-executor702660489 -DGOOS_freebsd=1 -DGOARCH_386=1 -DHOSTGOOS_freebsd=1 -x c - -m32 -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -static -lc++ -Wno-overflow] --- FAIL: TestGenerate/freebsd/386/11 (1.73s) csource_test.go:122: opts: {Threaded:true Collide:false Repeat:true RepeatTimes:0 Procs:0 Sandbox:none Fault:false FaultCall:0 FaultNth:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false VhciInjection:false UseTmpDir:true HandleSegv:true Repro:false Trace:false} program: mkdir(&(0x7f0000000000)='./file0\x00', 0xa5) getpeername(0xffffffffffffff9c, &(0x7f0000000040)=@in6={0x1c, 0x1c, 0xffffffffffffffff, 0x0, @mcast2}, &(0x7f0000000080)=0x1c) r0 = fcntl$dupfd(0xffffffffffffffff, 0x11, 0xffffffffffffff9c) setsockopt$inet6_tcp_TCP_CONGESTION(r0, 0x6, 0x40, &(0x7f00000000c0)='chd\x00', 0x4) r1 = socket$inet6_icmp_raw(0x1c, 0x3, 0x3a) getsockopt$inet_sctp_SCTP_PEER_ADDR_PARAMS(r0, 0x84, 0xa, &(0x7f0000000100)={@in={{0x10, 0x2, 0x3, @multicast2}}, 0x0, 0x401, 0x7, 0x1, 0x4, 0x400, 0x20}, &(0x7f00000001c0)=0xa0) setsockopt$inet6_sctp_SCTP_ADD_STREAMS(r1, 0x84, 0x903, &(0x7f0000000200)={r2, 0x8, 0xffff}, 0x8) r3 = dup(0xffffffffffffffff) readlinkat(r3, &(0x7f0000000240)='./file0\x00', &(0x7f0000000280)=""/33, 0x21) shm_open2(&(0x7f00000002c0)='./file0\x00', 0x0, 0x50, 0x0, &(0x7f0000000300)='/#@\x00') syz_emit_ethernet(0x58, &(0x7f0000000000)={@remote, @broadcast, [], {@generic={0xe73d, "bb14e45374361790bbc0da8140f66ab0fc1174330be7643994f9efa065c589b84619520c53618a6bd0481668f70423425878138df97e84886332d304258618e730f3e0f2a1460c285b19"}}}) syz_execute_func(&(0x7f0000000080)="7e02c4e1e1160965260f01fac4c3497c50057dc4e27dbdc7f30f1efcc4e179108112f44a60c4e3b5cf3f5f36ea090000006f37c4c1b4142f") syz_extract_tcp_res(&(0x7f00000000c0), 0x80000000, 0xa23) csource_test.go:123: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static __thread int skip_segv; static __thread jmp_buf segv_env; static void segv_handler(int sig, siginfo_t* info, void* ctx) { uintptr_t addr = (uintptr_t)info->si_addr; const uintptr_t prog_start = 1 << 20; const uintptr_t prog_end = 100 << 20; if (__atomic_load_n(&skip_segv, __ATOMIC_RELAXED) && (addr < prog_start || addr > prog_end)) { _longjmp(segv_env, 1); } exit(sig); } static void install_segv_handler(void) { struct sigaction sa; memset(&sa, 0, sizeof(sa)); sa.sa_sigaction = segv_handler; sa.sa_flags = SA_NODEFER | SA_SIGINFO; sigaction(SIGSEGV, &sa, NULL); sigaction(SIGBUS, &sa, NULL); } #define NONFAILING(...) { __atomic_fetch_add(&skip_segv, 1, __ATOMIC_SEQ_CST); if (_setjmp(segv_env) == 0) { __VA_ARGS__; } __atomic_fetch_sub(&skip_segv, 1, __ATOMIC_SEQ_CST); } static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void remove_dir(const char* dir) { DIR* dp; struct dirent* ep; dp = opendir(dir); if (dp == NULL) exit(1); while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } if (unlink(filename)) exit(1); } closedir(dp); if (rmdir(dir)) exit(1); } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i; for (i = 0; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { pthread_mutex_t mu; pthread_cond_t cv; int state; } event_t; static void event_init(event_t* ev) { if (pthread_mutex_init(&ev->mu, 0)) exit(1); if (pthread_cond_init(&ev->cv, 0)) exit(1); ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { pthread_mutex_lock(&ev->mu); if (ev->state) exit(1); ev->state = 1; pthread_mutex_unlock(&ev->mu); pthread_cond_broadcast(&ev->cv); } static void event_wait(event_t* ev) { pthread_mutex_lock(&ev->mu); while (!ev->state) pthread_cond_wait(&ev->cv, &ev->mu); pthread_mutex_unlock(&ev->mu); } static int event_isset(event_t* ev) { pthread_mutex_lock(&ev->mu); int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; pthread_mutex_lock(&ev->mu); for (;;) { if (ev->state) break; uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); now = current_time_ms(); if (now - start > timeout) break; } int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static void sandbox_common() { if (setsid() == -1) exit(1); struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 8 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 0; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); } static void loop(); static int do_sandbox_none(void) { sandbox_common(); loop(); return 0; } static long syz_execute_func(volatile long text) { volatile long p[8] = {0}; (void)p; ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 13; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); event_timedwait(&th->done, 45); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); #define WAIT_FLAGS 0 static void loop(void) { int iter; for (iter = 0;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5 * 1000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xffffffffffffffff}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: NONFAILING(memcpy((void*)0x10000000, "./file0\000", 8)); syscall(SYS_mkdir, 0x10000000, 0xa5); break; case 1: NONFAILING(*(uint32_t*)0x10000080 = 0x1c); syscall(SYS_getpeername, 0xffffff9c, 0x10000040, 0x10000080); break; case 2: res = syscall(SYS_fcntl, -1, 0x11, 0xffffff9c); if (res != -1) r[0] = res; break; case 3: NONFAILING(memcpy((void*)0x100000c0, "chd\000", 4)); syscall(SYS_setsockopt, (intptr_t)r[0], 6, 0x40, 0x100000c0, 4); break; case 4: res = syscall(SYS_socket, 0x1c, 3, 0x3a); if (res != -1) r[1] = res; break; case 5: NONFAILING(*(uint8_t*)0x10000100 = 0x10); NONFAILING(*(uint8_t*)0x10000101 = 2); NONFAILING(*(uint16_t*)0x10000102 = htobe16(0x4e23)); NONFAILING(*(uint32_t*)0x10000104 = htobe32(0xe0000002)); NONFAILING(*(uint8_t*)0x10000108 = 0); NONFAILING(*(uint8_t*)0x10000109 = 0); NONFAILING(*(uint8_t*)0x1000010a = 0); NONFAILING(*(uint8_t*)0x1000010b = 0); NONFAILING(*(uint8_t*)0x1000010c = 0); NONFAILING(*(uint8_t*)0x1000010d = 0); NONFAILING(*(uint8_t*)0x1000010e = 0); NONFAILING(*(uint8_t*)0x1000010f = 0); NONFAILING(*(uint64_t*)0x10000110 = 0); NONFAILING(*(uint64_t*)0x10000118 = 0); NONFAILING(*(uint64_t*)0x10000120 = 0); NONFAILING(*(uint64_t*)0x10000128 = 0); NONFAILING(*(uint64_t*)0x10000130 = 0); NONFAILING(*(uint64_t*)0x10000138 = 0); NONFAILING(*(uint64_t*)0x10000140 = 0); NONFAILING(*(uint64_t*)0x10000148 = 0); NONFAILING(*(uint64_t*)0x10000150 = 0); NONFAILING(*(uint64_t*)0x10000158 = 0); NONFAILING(*(uint64_t*)0x10000160 = 0); NONFAILING(*(uint64_t*)0x10000168 = 0); NONFAILING(*(uint64_t*)0x10000170 = 0); NONFAILING(*(uint64_t*)0x10000178 = 0); NONFAILING(*(uint64_t*)0x10000180 = 0); NONFAILING(*(uint32_t*)0x10000188 = 0); NONFAILING(*(uint32_t*)0x1000018c = 0x401); NONFAILING(*(uint32_t*)0x10000190 = 7); NONFAILING(*(uint32_t*)0x10000194 = 1); NONFAILING(*(uint32_t*)0x10000198 = 4); NONFAILING(*(uint16_t*)0x1000019c = 0x400); NONFAILING(*(uint8_t*)0x1000019e = 0x20); NONFAILING(*(uint32_t*)0x100001c0 = 0xa0); res = syscall(SYS_getsockopt, (intptr_t)r[0], 0x84, 0xa, 0x10000100, 0x100001c0); if (res != -1) NONFAILING(r[2] = *(uint32_t*)0x10000188); break; case 6: NONFAILING(*(uint32_t*)0x10000200 = r[2]); NONFAILING(*(uint16_t*)0x10000204 = 8); NONFAILING(*(uint16_t*)0x10000206 = -1); syscall(SYS_setsockopt, (intptr_t)r[1], 0x84, 0x903, 0x10000200, 8); break; case 7: res = syscall(SYS_dup, -1); if (res != -1) r[3] = res; break; case 8: NONFAILING(memcpy((void*)0x10000240, "./file0\000", 8)); syscall(SYS_readlinkat, (intptr_t)r[3], 0x10000240, 0x10000280, 0x21); break; case 9: NONFAILING(memcpy((void*)0x100002c0, "./file0\000", 8)); NONFAILING(memcpy((void*)0x10000300, "/#@\000", 4)); syscall(SYS_shm_open2, 0x100002c0, 0, 0x50, 0, 0x10000300); break; case 10: NONFAILING(*(uint8_t*)0x10000000 = 0xaa); NONFAILING(*(uint8_t*)0x10000001 = 0xaa); NONFAILING(*(uint8_t*)0x10000002 = 0xaa); NONFAILING(*(uint8_t*)0x10000003 = 0xaa); NONFAILING(*(uint8_t*)0x10000004 = 0xaa); NONFAILING(*(uint8_t*)0x10000005 = 0xbb); NONFAILING(*(uint8_t*)0x10000006 = -1); NONFAILING(*(uint8_t*)0x10000007 = -1); NONFAILING(*(uint8_t*)0x10000008 = -1); NONFAILING(*(uint8_t*)0x10000009 = -1); NONFAILING(*(uint8_t*)0x1000000a = -1); NONFAILING(*(uint8_t*)0x1000000b = -1); NONFAILING(*(uint16_t*)0x1000000c = htobe16(0xe73d)); NONFAILING(memcpy((void*)0x1000000e, "\xbb\x14\xe4\x53\x74\x36\x17\x90\xbb\xc0\xda\x81\x40\xf6\x6a\xb0\xfc\x11\x74\x33\x0b\xe7\x64\x39\x94\xf9\xef\xa0\x65\xc5\x89\xb8\x46\x19\x52\x0c\x53\x61\x8a\x6b\xd0\x48\x16\x68\xf7\x04\x23\x42\x58\x78\x13\x8d\xf9\x7e\x84\x88\x63\x32\xd3\x04\x25\x86\x18\xe7\x30\xf3\xe0\xf2\xa1\x46\x0c\x28\x5b\x19", 74)); break; case 11: NONFAILING(memcpy((void*)0x10000080, "\x7e\x02\xc4\xe1\xe1\x16\x09\x65\x26\x0f\x01\xfa\xc4\xc3\x49\x7c\x50\x05\x7d\xc4\xe2\x7d\xbd\xc7\xf3\x0f\x1e\xfc\xc4\xe1\x79\x10\x81\x12\xf4\x4a\x60\xc4\xe3\xb5\xcf\x3f\x5f\x36\xea\x09\x00\x00\x00\x6f\x37\xc4\xc1\xb4\x14\x2f", 56)); NONFAILING(syz_execute_func(0x10000080)); break; case 12: break; } } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); install_segv_handler(); use_temporary_dir(); do_sandbox_none(); return 0; } :408:11: error: use of undeclared identifier 'SYS_shm_open2' syscall(SYS_shm_open2, 0x100002c0, 0, 0x50, 0, 0x10000300); ^ 1 error generated. compiler invocation: clang [-o /tmp/syz-executor139052966 -DGOOS_freebsd=1 -DGOARCH_386=1 -DHOSTGOOS_freebsd=1 -x c - -m32 -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -static -lc++ -Wno-overflow] --- FAIL: TestGenerate/freebsd/386/13 (1.89s) csource_test.go:122: opts: {Threaded:true Collide:false Repeat:true RepeatTimes:0 Procs:0 Sandbox:none Fault:false FaultCall:0 FaultNth:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false VhciInjection:false UseTmpDir:true HandleSegv:false Repro:false Trace:true} program: mkdir(&(0x7f0000000000)='./file0\x00', 0xa5) getpeername(0xffffffffffffff9c, &(0x7f0000000040)=@in6={0x1c, 0x1c, 0xffffffffffffffff, 0x0, @mcast2}, &(0x7f0000000080)=0x1c) r0 = fcntl$dupfd(0xffffffffffffffff, 0x11, 0xffffffffffffff9c) setsockopt$inet6_tcp_TCP_CONGESTION(r0, 0x6, 0x40, &(0x7f00000000c0)='chd\x00', 0x4) r1 = socket$inet6_icmp_raw(0x1c, 0x3, 0x3a) getsockopt$inet_sctp_SCTP_PEER_ADDR_PARAMS(r0, 0x84, 0xa, &(0x7f0000000100)={@in={{0x10, 0x2, 0x3, @multicast2}}, 0x0, 0x401, 0x7, 0x1, 0x4, 0x400, 0x20}, &(0x7f00000001c0)=0xa0) setsockopt$inet6_sctp_SCTP_ADD_STREAMS(r1, 0x84, 0x903, &(0x7f0000000200)={r2, 0x8, 0xffff}, 0x8) r3 = dup(0xffffffffffffffff) readlinkat(r3, &(0x7f0000000240)='./file0\x00', &(0x7f0000000280)=""/33, 0x21) shm_open2(&(0x7f00000002c0)='./file0\x00', 0x0, 0x50, 0x0, &(0x7f0000000300)='/#@\x00') syz_emit_ethernet(0x58, &(0x7f0000000000)={@remote, @broadcast, [], {@generic={0xe73d, "bb14e45374361790bbc0da8140f66ab0fc1174330be7643994f9efa065c589b84619520c53618a6bd0481668f70423425878138df97e84886332d304258618e730f3e0f2a1460c285b19"}}}) syz_execute_func(&(0x7f0000000080)="7e02c4e1e1160965260f01fac4c3497c50057dc4e27dbdc7f30f1efcc4e179108112f44a60c4e3b5cf3f5f36ea090000006f37c4c1b4142f") syz_extract_tcp_res(&(0x7f00000000c0), 0x80000000, 0xa23) csource_test.go:123: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void remove_dir(const char* dir) { DIR* dp; struct dirent* ep; dp = opendir(dir); if (dp == NULL) exit(1); while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } if (unlink(filename)) exit(1); } closedir(dp); if (rmdir(dir)) exit(1); } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i; for (i = 0; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { pthread_mutex_t mu; pthread_cond_t cv; int state; } event_t; static void event_init(event_t* ev) { if (pthread_mutex_init(&ev->mu, 0)) exit(1); if (pthread_cond_init(&ev->cv, 0)) exit(1); ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { pthread_mutex_lock(&ev->mu); if (ev->state) exit(1); ev->state = 1; pthread_mutex_unlock(&ev->mu); pthread_cond_broadcast(&ev->cv); } static void event_wait(event_t* ev) { pthread_mutex_lock(&ev->mu); while (!ev->state) pthread_cond_wait(&ev->cv, &ev->mu); pthread_mutex_unlock(&ev->mu); } static int event_isset(event_t* ev) { pthread_mutex_lock(&ev->mu); int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; pthread_mutex_lock(&ev->mu); for (;;) { if (ev->state) break; uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); now = current_time_ms(); if (now - start > timeout) break; } int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static void sandbox_common() { if (setsid() == -1) exit(1); struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 8 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 0; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); } static void loop(); static int do_sandbox_none(void) { sandbox_common(); loop(); return 0; } static long syz_execute_func(volatile long text) { volatile long p[8] = {0}; (void)p; ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { fprintf(stderr, "### start\n"); int i, call, thread; for (call = 0; call < 13; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); event_timedwait(&th->done, 45); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); #define WAIT_FLAGS 0 static void loop(void) { int iter; for (iter = 0;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5 * 1000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xffffffffffffffff}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: memcpy((void*)0x10000000, "./file0\000", 8); res = syscall(SYS_mkdir, 0x10000000, 0xa5); fprintf(stderr, "### call=0 errno=%u\n", res == -1 ? errno : 0); break; case 1: *(uint32_t*)0x10000080 = 0x1c; res = syscall(SYS_getpeername, 0xffffff9c, 0x10000040, 0x10000080); fprintf(stderr, "### call=1 errno=%u\n", res == -1 ? errno : 0); break; case 2: res = syscall(SYS_fcntl, -1, 0x11, 0xffffff9c); fprintf(stderr, "### call=2 errno=%u\n", res == -1 ? errno : 0); if (res != -1) r[0] = res; break; case 3: memcpy((void*)0x100000c0, "chd\000", 4); res = syscall(SYS_setsockopt, (intptr_t)r[0], 6, 0x40, 0x100000c0, 4); fprintf(stderr, "### call=3 errno=%u\n", res == -1 ? errno : 0); break; case 4: res = syscall(SYS_socket, 0x1c, 3, 0x3a); fprintf(stderr, "### call=4 errno=%u\n", res == -1 ? errno : 0); if (res != -1) r[1] = res; break; case 5: *(uint8_t*)0x10000100 = 0x10; *(uint8_t*)0x10000101 = 2; *(uint16_t*)0x10000102 = htobe16(0x4e23); *(uint32_t*)0x10000104 = htobe32(0xe0000002); *(uint8_t*)0x10000108 = 0; *(uint8_t*)0x10000109 = 0; *(uint8_t*)0x1000010a = 0; *(uint8_t*)0x1000010b = 0; *(uint8_t*)0x1000010c = 0; *(uint8_t*)0x1000010d = 0; *(uint8_t*)0x1000010e = 0; *(uint8_t*)0x1000010f = 0; *(uint64_t*)0x10000110 = 0; *(uint64_t*)0x10000118 = 0; *(uint64_t*)0x10000120 = 0; *(uint64_t*)0x10000128 = 0; *(uint64_t*)0x10000130 = 0; *(uint64_t*)0x10000138 = 0; *(uint64_t*)0x10000140 = 0; *(uint64_t*)0x10000148 = 0; *(uint64_t*)0x10000150 = 0; *(uint64_t*)0x10000158 = 0; *(uint64_t*)0x10000160 = 0; *(uint64_t*)0x10000168 = 0; *(uint64_t*)0x10000170 = 0; *(uint64_t*)0x10000178 = 0; *(uint64_t*)0x10000180 = 0; *(uint32_t*)0x10000188 = 0; *(uint32_t*)0x1000018c = 0x401; *(uint32_t*)0x10000190 = 7; *(uint32_t*)0x10000194 = 1; *(uint32_t*)0x10000198 = 4; *(uint16_t*)0x1000019c = 0x400; *(uint8_t*)0x1000019e = 0x20; *(uint32_t*)0x100001c0 = 0xa0; res = syscall(SYS_getsockopt, (intptr_t)r[0], 0x84, 0xa, 0x10000100, 0x100001c0); fprintf(stderr, "### call=5 errno=%u\n", res == -1 ? errno : 0); if (res != -1) r[2] = *(uint32_t*)0x10000188; break; case 6: *(uint32_t*)0x10000200 = r[2]; *(uint16_t*)0x10000204 = 8; *(uint16_t*)0x10000206 = -1; res = syscall(SYS_setsockopt, (intptr_t)r[1], 0x84, 0x903, 0x10000200, 8); fprintf(stderr, "### call=6 errno=%u\n", res == -1 ? errno : 0); break; case 7: res = syscall(SYS_dup, -1); fprintf(stderr, "### call=7 errno=%u\n", res == -1 ? errno : 0); if (res != -1) r[3] = res; break; case 8: memcpy((void*)0x10000240, "./file0\000", 8); res = syscall(SYS_readlinkat, (intptr_t)r[3], 0x10000240, 0x10000280, 0x21); fprintf(stderr, "### call=8 errno=%u\n", res == -1 ? errno : 0); break; case 9: memcpy((void*)0x100002c0, "./file0\000", 8); memcpy((void*)0x10000300, "/#@\000", 4); res = syscall(SYS_shm_open2, 0x100002c0, 0, 0x50, 0, 0x10000300); fprintf(stderr, "### call=9 errno=%u\n", res == -1 ? errno : 0); break; case 10: *(uint8_t*)0x10000000 = 0xaa; *(uint8_t*)0x10000001 = 0xaa; *(uint8_t*)0x10000002 = 0xaa; *(uint8_t*)0x10000003 = 0xaa; *(uint8_t*)0x10000004 = 0xaa; *(uint8_t*)0x10000005 = 0xbb; *(uint8_t*)0x10000006 = -1; *(uint8_t*)0x10000007 = -1; *(uint8_t*)0x10000008 = -1; *(uint8_t*)0x10000009 = -1; *(uint8_t*)0x1000000a = -1; *(uint8_t*)0x1000000b = -1; *(uint16_t*)0x1000000c = htobe16(0xe73d); memcpy((void*)0x1000000e, "\xbb\x14\xe4\x53\x74\x36\x17\x90\xbb\xc0\xda\x81\x40\xf6\x6a\xb0\xfc\x11\x74\x33\x0b\xe7\x64\x39\x94\xf9\xef\xa0\x65\xc5\x89\xb8\x46\x19\x52\x0c\x53\x61\x8a\x6b\xd0\x48\x16\x68\xf7\x04\x23\x42\x58\x78\x13\x8d\xf9\x7e\x84\x88\x63\x32\xd3\x04\x25\x86\x18\xe7\x30\xf3\xe0\xf2\xa1\x46\x0c\x28\x5b\x19", 74); (void)res; break; case 11: memcpy((void*)0x10000080, "\x7e\x02\xc4\xe1\xe1\x16\x09\x65\x26\x0f\x01\xfa\xc4\xc3\x49\x7c\x50\x05\x7d\xc4\xe2\x7d\xbd\xc7\xf3\x0f\x1e\xfc\xc4\xe1\x79\x10\x81\x12\xf4\x4a\x60\xc4\xe3\xb5\xcf\x3f\x5f\x36\xea\x09\x00\x00\x00\x6f\x37\xc4\xc1\xb4\x14\x2f", 56); res = -1; errno = EFAULT; res = syz_execute_func(0x10000080); fprintf(stderr, "### call=11 errno=%u\n", res == -1 ? errno : 0); break; case 12: (void)res; break; } } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); use_temporary_dir(); do_sandbox_none(); return 0; } :391:17: error: use of undeclared identifier 'SYS_shm_open2' res = syscall(SYS_shm_open2, 0x100002c0, 0, 0x50, 0, 0x10000300); ^ 1 error generated. compiler invocation: clang [-o /tmp/syz-executor729246036 -DGOOS_freebsd=1 -DGOARCH_386=1 -DHOSTGOOS_freebsd=1 -x c - -m32 -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -static -lc++ -Wno-overflow] --- FAIL: TestGenerate/freebsd/386/14 (1.93s) csource_test.go:122: opts: {Threaded:true Collide:true Repeat:true RepeatTimes:0 Procs:2 Sandbox:none Fault:false FaultCall:0 FaultNth:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false VhciInjection:false UseTmpDir:true HandleSegv:false Repro:true Trace:false} program: mkdir(&(0x7f0000000000)='./file0\x00', 0xa5) getpeername(0xffffffffffffff9c, &(0x7f0000000040)=@in6={0x1c, 0x1c, 0xffffffffffffffff, 0x0, @mcast2}, &(0x7f0000000080)=0x1c) r0 = fcntl$dupfd(0xffffffffffffffff, 0x11, 0xffffffffffffff9c) setsockopt$inet6_tcp_TCP_CONGESTION(r0, 0x6, 0x40, &(0x7f00000000c0)='chd\x00', 0x4) r1 = socket$inet6_icmp_raw(0x1c, 0x3, 0x3a) getsockopt$inet_sctp_SCTP_PEER_ADDR_PARAMS(r0, 0x84, 0xa, &(0x7f0000000100)={@in={{0x10, 0x2, 0x3, @multicast2}}, 0x0, 0x401, 0x7, 0x1, 0x4, 0x400, 0x20}, &(0x7f00000001c0)=0xa0) setsockopt$inet6_sctp_SCTP_ADD_STREAMS(r1, 0x84, 0x903, &(0x7f0000000200)={r2, 0x8, 0xffff}, 0x8) r3 = dup(0xffffffffffffffff) readlinkat(r3, &(0x7f0000000240)='./file0\x00', &(0x7f0000000280)=""/33, 0x21) shm_open2(&(0x7f00000002c0)='./file0\x00', 0x0, 0x50, 0x0, &(0x7f0000000300)='/#@\x00') syz_emit_ethernet(0x58, &(0x7f0000000000)={@remote, @broadcast, [], {@generic={0xe73d, "bb14e45374361790bbc0da8140f66ab0fc1174330be7643994f9efa065c589b84619520c53618a6bd0481668f70423425878138df97e84886332d304258618e730f3e0f2a1460c285b19"}}}) syz_execute_func(&(0x7f0000000080)="7e02c4e1e1160965260f01fac4c3497c50057dc4e27dbdc7f30f1efcc4e179108112f44a60c4e3b5cf3f5f36ea090000006f37c4c1b4142f") syz_extract_tcp_res(&(0x7f00000000c0), 0x80000000, 0xa23) csource_test.go:123: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static unsigned long long procid; static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void remove_dir(const char* dir) { DIR* dp; struct dirent* ep; dp = opendir(dir); if (dp == NULL) exit(1); while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } if (unlink(filename)) exit(1); } closedir(dp); if (rmdir(dir)) exit(1); } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i; for (i = 0; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { pthread_mutex_t mu; pthread_cond_t cv; int state; } event_t; static void event_init(event_t* ev) { if (pthread_mutex_init(&ev->mu, 0)) exit(1); if (pthread_cond_init(&ev->cv, 0)) exit(1); ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { pthread_mutex_lock(&ev->mu); if (ev->state) exit(1); ev->state = 1; pthread_mutex_unlock(&ev->mu); pthread_cond_broadcast(&ev->cv); } static void event_wait(event_t* ev) { pthread_mutex_lock(&ev->mu); while (!ev->state) pthread_cond_wait(&ev->cv, &ev->mu); pthread_mutex_unlock(&ev->mu); } static int event_isset(event_t* ev) { pthread_mutex_lock(&ev->mu); int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; pthread_mutex_lock(&ev->mu); for (;;) { if (ev->state) break; uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); now = current_time_ms(); if (now - start > timeout) break; } int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static void sandbox_common() { if (setsid() == -1) exit(1); struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 8 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 0; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); } static void loop(); static int do_sandbox_none(void) { sandbox_common(); loop(); return 0; } static long syz_execute_func(volatile long text) { volatile long p[8] = {0}; (void)p; ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } int i, call, thread; int collide = 0; again: for (call = 0; call < 13; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (collide && (call % 2) == 0) break; event_timedwait(&th->done, 45); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); if (!collide) { collide = 1; goto again; } } static void execute_one(void); #define WAIT_FLAGS 0 static void loop(void) { int iter; for (iter = 0;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5 * 1000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xffffffffffffffff}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: memcpy((void*)0x10000000, "./file0\000", 8); syscall(SYS_mkdir, 0x10000000, 0xa5); break; case 1: *(uint32_t*)0x10000080 = 0x1c; syscall(SYS_getpeername, 0xffffff9c, 0x10000040, 0x10000080); break; case 2: res = syscall(SYS_fcntl, -1, 0x11, 0xffffff9c); if (res != -1) r[0] = res; break; case 3: memcpy((void*)0x100000c0, "chd\000", 4); syscall(SYS_setsockopt, (intptr_t)r[0], 6, 0x40, 0x100000c0, 4); break; case 4: res = syscall(SYS_socket, 0x1c, 3, 0x3a); if (res != -1) r[1] = res; break; case 5: *(uint8_t*)0x10000100 = 0x10; *(uint8_t*)0x10000101 = 2; *(uint16_t*)0x10000102 = htobe16(0x4e23 + procid*4); *(uint32_t*)0x10000104 = htobe32(0xe0000002); *(uint8_t*)0x10000108 = 0; *(uint8_t*)0x10000109 = 0; *(uint8_t*)0x1000010a = 0; *(uint8_t*)0x1000010b = 0; *(uint8_t*)0x1000010c = 0; *(uint8_t*)0x1000010d = 0; *(uint8_t*)0x1000010e = 0; *(uint8_t*)0x1000010f = 0; *(uint64_t*)0x10000110 = 0; *(uint64_t*)0x10000118 = 0; *(uint64_t*)0x10000120 = 0; *(uint64_t*)0x10000128 = 0; *(uint64_t*)0x10000130 = 0; *(uint64_t*)0x10000138 = 0; *(uint64_t*)0x10000140 = 0; *(uint64_t*)0x10000148 = 0; *(uint64_t*)0x10000150 = 0; *(uint64_t*)0x10000158 = 0; *(uint64_t*)0x10000160 = 0; *(uint64_t*)0x10000168 = 0; *(uint64_t*)0x10000170 = 0; *(uint64_t*)0x10000178 = 0; *(uint64_t*)0x10000180 = 0; *(uint32_t*)0x10000188 = 0; *(uint32_t*)0x1000018c = 0x401; *(uint32_t*)0x10000190 = 7; *(uint32_t*)0x10000194 = 1; *(uint32_t*)0x10000198 = 4; *(uint16_t*)0x1000019c = 0x400; *(uint8_t*)0x1000019e = 0x20; *(uint32_t*)0x100001c0 = 0xa0; res = syscall(SYS_getsockopt, (intptr_t)r[0], 0x84, 0xa, 0x10000100, 0x100001c0); if (res != -1) r[2] = *(uint32_t*)0x10000188; break; case 6: *(uint32_t*)0x10000200 = r[2]; *(uint16_t*)0x10000204 = 8; *(uint16_t*)0x10000206 = -1; syscall(SYS_setsockopt, (intptr_t)r[1], 0x84, 0x903, 0x10000200, 8); break; case 7: res = syscall(SYS_dup, -1); if (res != -1) r[3] = res; break; case 8: memcpy((void*)0x10000240, "./file0\000", 8); syscall(SYS_readlinkat, (intptr_t)r[3], 0x10000240, 0x10000280, 0x21); break; case 9: memcpy((void*)0x100002c0, "./file0\000", 8); memcpy((void*)0x10000300, "/#@\000", 4); syscall(SYS_shm_open2, 0x100002c0, 0, 0x50, 0, 0x10000300); break; case 10: *(uint8_t*)0x10000000 = 0xaa; *(uint8_t*)0x10000001 = 0xaa; *(uint8_t*)0x10000002 = 0xaa; *(uint8_t*)0x10000003 = 0xaa; *(uint8_t*)0x10000004 = 0xaa; *(uint8_t*)0x10000005 = 0xbb; *(uint8_t*)0x10000006 = -1; *(uint8_t*)0x10000007 = -1; *(uint8_t*)0x10000008 = -1; *(uint8_t*)0x10000009 = -1; *(uint8_t*)0x1000000a = -1; *(uint8_t*)0x1000000b = -1; *(uint16_t*)0x1000000c = htobe16(0xe73d); memcpy((void*)0x1000000e, "\xbb\x14\xe4\x53\x74\x36\x17\x90\xbb\xc0\xda\x81\x40\xf6\x6a\xb0\xfc\x11\x74\x33\x0b\xe7\x64\x39\x94\xf9\xef\xa0\x65\xc5\x89\xb8\x46\x19\x52\x0c\x53\x61\x8a\x6b\xd0\x48\x16\x68\xf7\x04\x23\x42\x58\x78\x13\x8d\xf9\x7e\x84\x88\x63\x32\xd3\x04\x25\x86\x18\xe7\x30\xf3\xe0\xf2\xa1\x46\x0c\x28\x5b\x19", 74); break; case 11: memcpy((void*)0x10000080, "\x7e\x02\xc4\xe1\xe1\x16\x09\x65\x26\x0f\x01\xfa\xc4\xc3\x49\x7c\x50\x05\x7d\xc4\xe2\x7d\xbd\xc7\xf3\x0f\x1e\xfc\xc4\xe1\x79\x10\x81\x12\xf4\x4a\x60\xc4\xe3\xb5\xcf\x3f\x5f\x36\xea\x09\x00\x00\x00\x6f\x37\xc4\xc1\xb4\x14\x2f", 56); syz_execute_func(0x10000080); break; case 12: break; } } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); for (procid = 0; procid < 2; procid++) { if (fork() == 0) { use_temporary_dir(); do_sandbox_none(); } } sleep(1000000); return 0; } :393:11: error: use of undeclared identifier 'SYS_shm_open2' syscall(SYS_shm_open2, 0x100002c0, 0, 0x50, 0, 0x10000300); ^ 1 error generated. compiler invocation: clang [-o /tmp/syz-executor528348835 -DGOOS_freebsd=1 -DGOARCH_386=1 -DHOSTGOOS_freebsd=1 -x c - -m32 -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -static -lc++ -Wno-overflow] --- FAIL: TestGenerate/freebsd/386/4 (1.53s) csource_test.go:122: opts: {Threaded:true Collide:false Repeat:true RepeatTimes:10 Procs:0 Sandbox:none Fault:false FaultCall:0 FaultNth:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false VhciInjection:false UseTmpDir:true HandleSegv:false Repro:false Trace:false} program: mkdir(&(0x7f0000000000)='./file0\x00', 0xa5) getpeername(0xffffffffffffff9c, &(0x7f0000000040)=@in6={0x1c, 0x1c, 0xffffffffffffffff, 0x0, @mcast2}, &(0x7f0000000080)=0x1c) r0 = fcntl$dupfd(0xffffffffffffffff, 0x11, 0xffffffffffffff9c) setsockopt$inet6_tcp_TCP_CONGESTION(r0, 0x6, 0x40, &(0x7f00000000c0)='chd\x00', 0x4) r1 = socket$inet6_icmp_raw(0x1c, 0x3, 0x3a) getsockopt$inet_sctp_SCTP_PEER_ADDR_PARAMS(r0, 0x84, 0xa, &(0x7f0000000100)={@in={{0x10, 0x2, 0x3, @multicast2}}, 0x0, 0x401, 0x7, 0x1, 0x4, 0x400, 0x20}, &(0x7f00000001c0)=0xa0) setsockopt$inet6_sctp_SCTP_ADD_STREAMS(r1, 0x84, 0x903, &(0x7f0000000200)={r2, 0x8, 0xffff}, 0x8) r3 = dup(0xffffffffffffffff) readlinkat(r3, &(0x7f0000000240)='./file0\x00', &(0x7f0000000280)=""/33, 0x21) shm_open2(&(0x7f00000002c0)='./file0\x00', 0x0, 0x50, 0x0, &(0x7f0000000300)='/#@\x00') syz_emit_ethernet(0x58, &(0x7f0000000000)={@remote, @broadcast, [], {@generic={0xe73d, "bb14e45374361790bbc0da8140f66ab0fc1174330be7643994f9efa065c589b84619520c53618a6bd0481668f70423425878138df97e84886332d304258618e730f3e0f2a1460c285b19"}}}) syz_execute_func(&(0x7f0000000080)="7e02c4e1e1160965260f01fac4c3497c50057dc4e27dbdc7f30f1efcc4e179108112f44a60c4e3b5cf3f5f36ea090000006f37c4c1b4142f") syz_extract_tcp_res(&(0x7f00000000c0), 0x80000000, 0xa23) csource_test.go:123: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void remove_dir(const char* dir) { DIR* dp; struct dirent* ep; dp = opendir(dir); if (dp == NULL) exit(1); while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } if (unlink(filename)) exit(1); } closedir(dp); if (rmdir(dir)) exit(1); } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i; for (i = 0; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { pthread_mutex_t mu; pthread_cond_t cv; int state; } event_t; static void event_init(event_t* ev) { if (pthread_mutex_init(&ev->mu, 0)) exit(1); if (pthread_cond_init(&ev->cv, 0)) exit(1); ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { pthread_mutex_lock(&ev->mu); if (ev->state) exit(1); ev->state = 1; pthread_mutex_unlock(&ev->mu); pthread_cond_broadcast(&ev->cv); } static void event_wait(event_t* ev) { pthread_mutex_lock(&ev->mu); while (!ev->state) pthread_cond_wait(&ev->cv, &ev->mu); pthread_mutex_unlock(&ev->mu); } static int event_isset(event_t* ev) { pthread_mutex_lock(&ev->mu); int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; pthread_mutex_lock(&ev->mu); for (;;) { if (ev->state) break; uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); now = current_time_ms(); if (now - start > timeout) break; } int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static void sandbox_common() { if (setsid() == -1) exit(1); struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 8 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 0; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); } static void loop(); static int do_sandbox_none(void) { sandbox_common(); loop(); return 0; } static long syz_execute_func(volatile long text) { volatile long p[8] = {0}; (void)p; ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 13; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); event_timedwait(&th->done, 45); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); #define WAIT_FLAGS 0 static void loop(void) { int iter; for (iter = 0; iter < 10; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5 * 1000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xffffffffffffffff}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: memcpy((void*)0x10000000, "./file0\000", 8); syscall(SYS_mkdir, 0x10000000, 0xa5); break; case 1: *(uint32_t*)0x10000080 = 0x1c; syscall(SYS_getpeername, 0xffffff9c, 0x10000040, 0x10000080); break; case 2: res = syscall(SYS_fcntl, -1, 0x11, 0xffffff9c); if (res != -1) r[0] = res; break; case 3: memcpy((void*)0x100000c0, "chd\000", 4); syscall(SYS_setsockopt, (intptr_t)r[0], 6, 0x40, 0x100000c0, 4); break; case 4: res = syscall(SYS_socket, 0x1c, 3, 0x3a); if (res != -1) r[1] = res; break; case 5: *(uint8_t*)0x10000100 = 0x10; *(uint8_t*)0x10000101 = 2; *(uint16_t*)0x10000102 = htobe16(0x4e23); *(uint32_t*)0x10000104 = htobe32(0xe0000002); *(uint8_t*)0x10000108 = 0; *(uint8_t*)0x10000109 = 0; *(uint8_t*)0x1000010a = 0; *(uint8_t*)0x1000010b = 0; *(uint8_t*)0x1000010c = 0; *(uint8_t*)0x1000010d = 0; *(uint8_t*)0x1000010e = 0; *(uint8_t*)0x1000010f = 0; *(uint64_t*)0x10000110 = 0; *(uint64_t*)0x10000118 = 0; *(uint64_t*)0x10000120 = 0; *(uint64_t*)0x10000128 = 0; *(uint64_t*)0x10000130 = 0; *(uint64_t*)0x10000138 = 0; *(uint64_t*)0x10000140 = 0; *(uint64_t*)0x10000148 = 0; *(uint64_t*)0x10000150 = 0; *(uint64_t*)0x10000158 = 0; *(uint64_t*)0x10000160 = 0; *(uint64_t*)0x10000168 = 0; *(uint64_t*)0x10000170 = 0; *(uint64_t*)0x10000178 = 0; *(uint64_t*)0x10000180 = 0; *(uint32_t*)0x10000188 = 0; *(uint32_t*)0x1000018c = 0x401; *(uint32_t*)0x10000190 = 7; *(uint32_t*)0x10000194 = 1; *(uint32_t*)0x10000198 = 4; *(uint16_t*)0x1000019c = 0x400; *(uint8_t*)0x1000019e = 0x20; *(uint32_t*)0x100001c0 = 0xa0; res = syscall(SYS_getsockopt, (intptr_t)r[0], 0x84, 0xa, 0x10000100, 0x100001c0); if (res != -1) r[2] = *(uint32_t*)0x10000188; break; case 6: *(uint32_t*)0x10000200 = r[2]; *(uint16_t*)0x10000204 = 8; *(uint16_t*)0x10000206 = -1; syscall(SYS_setsockopt, (intptr_t)r[1], 0x84, 0x903, 0x10000200, 8); break; case 7: res = syscall(SYS_dup, -1); if (res != -1) r[3] = res; break; case 8: memcpy((void*)0x10000240, "./file0\000", 8); syscall(SYS_readlinkat, (intptr_t)r[3], 0x10000240, 0x10000280, 0x21); break; case 9: memcpy((void*)0x100002c0, "./file0\000", 8); memcpy((void*)0x10000300, "/#@\000", 4); syscall(SYS_shm_open2, 0x100002c0, 0, 0x50, 0, 0x10000300); break; case 10: *(uint8_t*)0x10000000 = 0xaa; *(uint8_t*)0x10000001 = 0xaa; *(uint8_t*)0x10000002 = 0xaa; *(uint8_t*)0x10000003 = 0xaa; *(uint8_t*)0x10000004 = 0xaa; *(uint8_t*)0x10000005 = 0xbb; *(uint8_t*)0x10000006 = -1; *(uint8_t*)0x10000007 = -1; *(uint8_t*)0x10000008 = -1; *(uint8_t*)0x10000009 = -1; *(uint8_t*)0x1000000a = -1; *(uint8_t*)0x1000000b = -1; *(uint16_t*)0x1000000c = htobe16(0xe73d); memcpy((void*)0x1000000e, "\xbb\x14\xe4\x53\x74\x36\x17\x90\xbb\xc0\xda\x81\x40\xf6\x6a\xb0\xfc\x11\x74\x33\x0b\xe7\x64\x39\x94\xf9\xef\xa0\x65\xc5\x89\xb8\x46\x19\x52\x0c\x53\x61\x8a\x6b\xd0\x48\x16\x68\xf7\x04\x23\x42\x58\x78\x13\x8d\xf9\x7e\x84\x88\x63\x32\xd3\x04\x25\x86\x18\xe7\x30\xf3\xe0\xf2\xa1\x46\x0c\x28\x5b\x19", 74); break; case 11: memcpy((void*)0x10000080, "\x7e\x02\xc4\xe1\xe1\x16\x09\x65\x26\x0f\x01\xfa\xc4\xc3\x49\x7c\x50\x05\x7d\xc4\xe2\x7d\xbd\xc7\xf3\x0f\x1e\xfc\xc4\xe1\x79\x10\x81\x12\xf4\x4a\x60\xc4\xe3\xb5\xcf\x3f\x5f\x36\xea\x09\x00\x00\x00\x6f\x37\xc4\xc1\xb4\x14\x2f", 56); syz_execute_func(0x10000080); break; case 12: break; } } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); use_temporary_dir(); do_sandbox_none(); return 0; } :381:11: error: use of undeclared identifier 'SYS_shm_open2' syscall(SYS_shm_open2, 0x100002c0, 0, 0x50, 0, 0x10000300); ^ 1 error generated. compiler invocation: clang [-o /tmp/syz-executor112621773 -DGOOS_freebsd=1 -DGOARCH_386=1 -DHOSTGOOS_freebsd=1 -x c - -m32 -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -static -lc++ -Wno-overflow] --- FAIL: TestGenerate/freebsd/386/10 (2.00s) csource_test.go:122: opts: {Threaded:true Collide:false Repeat:true RepeatTimes:0 Procs:0 Sandbox:none Fault:false FaultCall:0 FaultNth:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false VhciInjection:false UseTmpDir:false HandleSegv:false Repro:false Trace:false} program: mkdir(&(0x7f0000000000)='./file0\x00', 0xa5) getpeername(0xffffffffffffff9c, &(0x7f0000000040)=@in6={0x1c, 0x1c, 0xffffffffffffffff, 0x0, @mcast2}, &(0x7f0000000080)=0x1c) r0 = fcntl$dupfd(0xffffffffffffffff, 0x11, 0xffffffffffffff9c) setsockopt$inet6_tcp_TCP_CONGESTION(r0, 0x6, 0x40, &(0x7f00000000c0)='chd\x00', 0x4) r1 = socket$inet6_icmp_raw(0x1c, 0x3, 0x3a) getsockopt$inet_sctp_SCTP_PEER_ADDR_PARAMS(r0, 0x84, 0xa, &(0x7f0000000100)={@in={{0x10, 0x2, 0x3, @multicast2}}, 0x0, 0x401, 0x7, 0x1, 0x4, 0x400, 0x20}, &(0x7f00000001c0)=0xa0) setsockopt$inet6_sctp_SCTP_ADD_STREAMS(r1, 0x84, 0x903, &(0x7f0000000200)={r2, 0x8, 0xffff}, 0x8) r3 = dup(0xffffffffffffffff) readlinkat(r3, &(0x7f0000000240)='./file0\x00', &(0x7f0000000280)=""/33, 0x21) shm_open2(&(0x7f00000002c0)='./file0\x00', 0x0, 0x50, 0x0, &(0x7f0000000300)='/#@\x00') syz_emit_ethernet(0x58, &(0x7f0000000000)={@remote, @broadcast, [], {@generic={0xe73d, "bb14e45374361790bbc0da8140f66ab0fc1174330be7643994f9efa065c589b84619520c53618a6bd0481668f70423425878138df97e84886332d304258618e730f3e0f2a1460c285b19"}}}) syz_execute_func(&(0x7f0000000080)="7e02c4e1e1160965260f01fac4c3497c50057dc4e27dbdc7f30f1efcc4e179108112f44a60c4e3b5cf3f5f36ea090000006f37c4c1b4142f") syz_extract_tcp_res(&(0x7f00000000c0), 0x80000000, 0xa23) csource_test.go:123: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i; for (i = 0; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { pthread_mutex_t mu; pthread_cond_t cv; int state; } event_t; static void event_init(event_t* ev) { if (pthread_mutex_init(&ev->mu, 0)) exit(1); if (pthread_cond_init(&ev->cv, 0)) exit(1); ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { pthread_mutex_lock(&ev->mu); if (ev->state) exit(1); ev->state = 1; pthread_mutex_unlock(&ev->mu); pthread_cond_broadcast(&ev->cv); } static void event_wait(event_t* ev) { pthread_mutex_lock(&ev->mu); while (!ev->state) pthread_cond_wait(&ev->cv, &ev->mu); pthread_mutex_unlock(&ev->mu); } static int event_isset(event_t* ev) { pthread_mutex_lock(&ev->mu); int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; pthread_mutex_lock(&ev->mu); for (;;) { if (ev->state) break; uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); now = current_time_ms(); if (now - start > timeout) break; } int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static void sandbox_common() { if (setsid() == -1) exit(1); struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 8 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 0; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); } static void loop(); static int do_sandbox_none(void) { sandbox_common(); loop(); return 0; } static long syz_execute_func(volatile long text) { volatile long p[8] = {0}; (void)p; ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 13; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); event_timedwait(&th->done, 45); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); #define WAIT_FLAGS 0 static void loop(void) { int iter; for (iter = 0;; iter++) { int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5 * 1000) continue; kill_and_wait(pid, &status); break; } } } uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xffffffffffffffff}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: memcpy((void*)0x10000000, "./file0\000", 8); syscall(SYS_mkdir, 0x10000000, 0xa5); break; case 1: *(uint32_t*)0x10000080 = 0x1c; syscall(SYS_getpeername, 0xffffff9c, 0x10000040, 0x10000080); break; case 2: res = syscall(SYS_fcntl, -1, 0x11, 0xffffff9c); if (res != -1) r[0] = res; break; case 3: memcpy((void*)0x100000c0, "chd\000", 4); syscall(SYS_setsockopt, (intptr_t)r[0], 6, 0x40, 0x100000c0, 4); break; case 4: res = syscall(SYS_socket, 0x1c, 3, 0x3a); if (res != -1) r[1] = res; break; case 5: *(uint8_t*)0x10000100 = 0x10; *(uint8_t*)0x10000101 = 2; *(uint16_t*)0x10000102 = htobe16(0x4e23); *(uint32_t*)0x10000104 = htobe32(0xe0000002); *(uint8_t*)0x10000108 = 0; *(uint8_t*)0x10000109 = 0; *(uint8_t*)0x1000010a = 0; *(uint8_t*)0x1000010b = 0; *(uint8_t*)0x1000010c = 0; *(uint8_t*)0x1000010d = 0; *(uint8_t*)0x1000010e = 0; *(uint8_t*)0x1000010f = 0; *(uint64_t*)0x10000110 = 0; *(uint64_t*)0x10000118 = 0; *(uint64_t*)0x10000120 = 0; *(uint64_t*)0x10000128 = 0; *(uint64_t*)0x10000130 = 0; *(uint64_t*)0x10000138 = 0; *(uint64_t*)0x10000140 = 0; *(uint64_t*)0x10000148 = 0; *(uint64_t*)0x10000150 = 0; *(uint64_t*)0x10000158 = 0; *(uint64_t*)0x10000160 = 0; *(uint64_t*)0x10000168 = 0; *(uint64_t*)0x10000170 = 0; *(uint64_t*)0x10000178 = 0; *(uint64_t*)0x10000180 = 0; *(uint32_t*)0x10000188 = 0; *(uint32_t*)0x1000018c = 0x401; *(uint32_t*)0x10000190 = 7; *(uint32_t*)0x10000194 = 1; *(uint32_t*)0x10000198 = 4; *(uint16_t*)0x1000019c = 0x400; *(uint8_t*)0x1000019e = 0x20; *(uint32_t*)0x100001c0 = 0xa0; res = syscall(SYS_getsockopt, (intptr_t)r[0], 0x84, 0xa, 0x10000100, 0x100001c0); if (res != -1) r[2] = *(uint32_t*)0x10000188; break; case 6: *(uint32_t*)0x10000200 = r[2]; *(uint16_t*)0x10000204 = 8; *(uint16_t*)0x10000206 = -1; syscall(SYS_setsockopt, (intptr_t)r[1], 0x84, 0x903, 0x10000200, 8); break; case 7: res = syscall(SYS_dup, -1); if (res != -1) r[3] = res; break; case 8: memcpy((void*)0x10000240, "./file0\000", 8); syscall(SYS_readlinkat, (intptr_t)r[3], 0x10000240, 0x10000280, 0x21); break; case 9: memcpy((void*)0x100002c0, "./file0\000", 8); memcpy((void*)0x10000300, "/#@\000", 4); syscall(SYS_shm_open2, 0x100002c0, 0, 0x50, 0, 0x10000300); break; case 10: *(uint8_t*)0x10000000 = 0xaa; *(uint8_t*)0x10000001 = 0xaa; *(uint8_t*)0x10000002 = 0xaa; *(uint8_t*)0x10000003 = 0xaa; *(uint8_t*)0x10000004 = 0xaa; *(uint8_t*)0x10000005 = 0xbb; *(uint8_t*)0x10000006 = -1; *(uint8_t*)0x10000007 = -1; *(uint8_t*)0x10000008 = -1; *(uint8_t*)0x10000009 = -1; *(uint8_t*)0x1000000a = -1; *(uint8_t*)0x1000000b = -1; *(uint16_t*)0x1000000c = htobe16(0xe73d); memcpy((void*)0x1000000e, "\xbb\x14\xe4\x53\x74\x36\x17\x90\xbb\xc0\xda\x81\x40\xf6\x6a\xb0\xfc\x11\x74\x33\x0b\xe7\x64\x39\x94\xf9\xef\xa0\x65\xc5\x89\xb8\x46\x19\x52\x0c\x53\x61\x8a\x6b\xd0\x48\x16\x68\xf7\x04\x23\x42\x58\x78\x13\x8d\xf9\x7e\x84\x88\x63\x32\xd3\x04\x25\x86\x18\xe7\x30\xf3\xe0\xf2\xa1\x46\x0c\x28\x5b\x19", 74); break; case 11: memcpy((void*)0x10000080, "\x7e\x02\xc4\xe1\xe1\x16\x09\x65\x26\x0f\x01\xfa\xc4\xc3\x49\x7c\x50\x05\x7d\xc4\xe2\x7d\xbd\xc7\xf3\x0f\x1e\xfc\xc4\xe1\x79\x10\x81\x12\xf4\x4a\x60\xc4\xe3\xb5\xcf\x3f\x5f\x36\xea\x09\x00\x00\x00\x6f\x37\xc4\xc1\xb4\x14\x2f", 56); syz_execute_func(0x10000080); break; case 12: break; } } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); do_sandbox_none(); return 0; } :333:11: error: use of undeclared identifier 'SYS_shm_open2' syscall(SYS_shm_open2, 0x100002c0, 0, 0x50, 0, 0x10000300); ^ 1 error generated. compiler invocation: clang [-o /tmp/syz-executor167539144 -DGOOS_freebsd=1 -DGOARCH_386=1 -DHOSTGOOS_freebsd=1 -x c - -m32 -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -static -lc++ -Wno-overflow] --- FAIL: TestGenerate/freebsd/386/7 (1.72s) csource_test.go:122: opts: {Threaded:true Collide:false Repeat:true RepeatTimes:0 Procs:0 Sandbox: Fault:false FaultCall:0 FaultNth:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false VhciInjection:false UseTmpDir:true HandleSegv:false Repro:false Trace:false} program: mkdir(&(0x7f0000000000)='./file0\x00', 0xa5) getpeername(0xffffffffffffff9c, &(0x7f0000000040)=@in6={0x1c, 0x1c, 0xffffffffffffffff, 0x0, @mcast2}, &(0x7f0000000080)=0x1c) r0 = fcntl$dupfd(0xffffffffffffffff, 0x11, 0xffffffffffffff9c) setsockopt$inet6_tcp_TCP_CONGESTION(r0, 0x6, 0x40, &(0x7f00000000c0)='chd\x00', 0x4) r1 = socket$inet6_icmp_raw(0x1c, 0x3, 0x3a) getsockopt$inet_sctp_SCTP_PEER_ADDR_PARAMS(r0, 0x84, 0xa, &(0x7f0000000100)={@in={{0x10, 0x2, 0x3, @multicast2}}, 0x0, 0x401, 0x7, 0x1, 0x4, 0x400, 0x20}, &(0x7f00000001c0)=0xa0) setsockopt$inet6_sctp_SCTP_ADD_STREAMS(r1, 0x84, 0x903, &(0x7f0000000200)={r2, 0x8, 0xffff}, 0x8) r3 = dup(0xffffffffffffffff) readlinkat(r3, &(0x7f0000000240)='./file0\x00', &(0x7f0000000280)=""/33, 0x21) shm_open2(&(0x7f00000002c0)='./file0\x00', 0x0, 0x50, 0x0, &(0x7f0000000300)='/#@\x00') syz_emit_ethernet(0x58, &(0x7f0000000000)={@remote, @broadcast, [], {@generic={0xe73d, "bb14e45374361790bbc0da8140f66ab0fc1174330be7643994f9efa065c589b84619520c53618a6bd0481668f70423425878138df97e84886332d304258618e730f3e0f2a1460c285b19"}}}) syz_execute_func(&(0x7f0000000080)="7e02c4e1e1160965260f01fac4c3497c50057dc4e27dbdc7f30f1efcc4e179108112f44a60c4e3b5cf3f5f36ea090000006f37c4c1b4142f") syz_extract_tcp_res(&(0x7f00000000c0), 0x80000000, 0xa23) csource_test.go:123: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void remove_dir(const char* dir) { DIR* dp; struct dirent* ep; dp = opendir(dir); if (dp == NULL) exit(1); while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } if (unlink(filename)) exit(1); } closedir(dp); if (rmdir(dir)) exit(1); } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i; for (i = 0; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { pthread_mutex_t mu; pthread_cond_t cv; int state; } event_t; static void event_init(event_t* ev) { if (pthread_mutex_init(&ev->mu, 0)) exit(1); if (pthread_cond_init(&ev->cv, 0)) exit(1); ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { pthread_mutex_lock(&ev->mu); if (ev->state) exit(1); ev->state = 1; pthread_mutex_unlock(&ev->mu); pthread_cond_broadcast(&ev->cv); } static void event_wait(event_t* ev) { pthread_mutex_lock(&ev->mu); while (!ev->state) pthread_cond_wait(&ev->cv, &ev->mu); pthread_mutex_unlock(&ev->mu); } static int event_isset(event_t* ev) { pthread_mutex_lock(&ev->mu); int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; pthread_mutex_lock(&ev->mu); for (;;) { if (ev->state) break; uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); now = current_time_ms(); if (now - start > timeout) break; } int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static long syz_execute_func(volatile long text) { volatile long p[8] = {0}; (void)p; ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 13; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); event_timedwait(&th->done, 45); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); #define WAIT_FLAGS 0 static void loop(void) { int iter; for (iter = 0;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5 * 1000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xffffffffffffffff}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: memcpy((void*)0x10000000, "./file0\000", 8); syscall(SYS_mkdir, 0x10000000, 0xa5); break; case 1: *(uint32_t*)0x10000080 = 0x1c; syscall(SYS_getpeername, 0xffffff9c, 0x10000040, 0x10000080); break; case 2: res = syscall(SYS_fcntl, -1, 0x11, 0xffffff9c); if (res != -1) r[0] = res; break; case 3: memcpy((void*)0x100000c0, "chd\000", 4); syscall(SYS_setsockopt, (intptr_t)r[0], 6, 0x40, 0x100000c0, 4); break; case 4: res = syscall(SYS_socket, 0x1c, 3, 0x3a); if (res != -1) r[1] = res; break; case 5: *(uint8_t*)0x10000100 = 0x10; *(uint8_t*)0x10000101 = 2; *(uint16_t*)0x10000102 = htobe16(0x4e23); *(uint32_t*)0x10000104 = htobe32(0xe0000002); *(uint8_t*)0x10000108 = 0; *(uint8_t*)0x10000109 = 0; *(uint8_t*)0x1000010a = 0; *(uint8_t*)0x1000010b = 0; *(uint8_t*)0x1000010c = 0; *(uint8_t*)0x1000010d = 0; *(uint8_t*)0x1000010e = 0; *(uint8_t*)0x1000010f = 0; *(uint64_t*)0x10000110 = 0; *(uint64_t*)0x10000118 = 0; *(uint64_t*)0x10000120 = 0; *(uint64_t*)0x10000128 = 0; *(uint64_t*)0x10000130 = 0; *(uint64_t*)0x10000138 = 0; *(uint64_t*)0x10000140 = 0; *(uint64_t*)0x10000148 = 0; *(uint64_t*)0x10000150 = 0; *(uint64_t*)0x10000158 = 0; *(uint64_t*)0x10000160 = 0; *(uint64_t*)0x10000168 = 0; *(uint64_t*)0x10000170 = 0; *(uint64_t*)0x10000178 = 0; *(uint64_t*)0x10000180 = 0; *(uint32_t*)0x10000188 = 0; *(uint32_t*)0x1000018c = 0x401; *(uint32_t*)0x10000190 = 7; *(uint32_t*)0x10000194 = 1; *(uint32_t*)0x10000198 = 4; *(uint16_t*)0x1000019c = 0x400; *(uint8_t*)0x1000019e = 0x20; *(uint32_t*)0x100001c0 = 0xa0; res = syscall(SYS_getsockopt, (intptr_t)r[0], 0x84, 0xa, 0x10000100, 0x100001c0); if (res != -1) r[2] = *(uint32_t*)0x10000188; break; case 6: *(uint32_t*)0x10000200 = r[2]; *(uint16_t*)0x10000204 = 8; *(uint16_t*)0x10000206 = -1; syscall(SYS_setsockopt, (intptr_t)r[1], 0x84, 0x903, 0x10000200, 8); break; case 7: res = syscall(SYS_dup, -1); if (res != -1) r[3] = res; break; case 8: memcpy((void*)0x10000240, "./file0\000", 8); syscall(SYS_readlinkat, (intptr_t)r[3], 0x10000240, 0x10000280, 0x21); break; case 9: memcpy((void*)0x100002c0, "./file0\000", 8); memcpy((void*)0x10000300, "/#@\000", 4); syscall(SYS_shm_open2, 0x100002c0, 0, 0x50, 0, 0x10000300); break; case 10: *(uint8_t*)0x10000000 = 0xaa; *(uint8_t*)0x10000001 = 0xaa; *(uint8_t*)0x10000002 = 0xaa; *(uint8_t*)0x10000003 = 0xaa; *(uint8_t*)0x10000004 = 0xaa; *(uint8_t*)0x10000005 = 0xbb; *(uint8_t*)0x10000006 = -1; *(uint8_t*)0x10000007 = -1; *(uint8_t*)0x10000008 = -1; *(uint8_t*)0x10000009 = -1; *(uint8_t*)0x1000000a = -1; *(uint8_t*)0x1000000b = -1; *(uint16_t*)0x1000000c = htobe16(0xe73d); memcpy((void*)0x1000000e, "\xbb\x14\xe4\x53\x74\x36\x17\x90\xbb\xc0\xda\x81\x40\xf6\x6a\xb0\xfc\x11\x74\x33\x0b\xe7\x64\x39\x94\xf9\xef\xa0\x65\xc5\x89\xb8\x46\x19\x52\x0c\x53\x61\x8a\x6b\xd0\x48\x16\x68\xf7\x04\x23\x42\x58\x78\x13\x8d\xf9\x7e\x84\x88\x63\x32\xd3\x04\x25\x86\x18\xe7\x30\xf3\xe0\xf2\xa1\x46\x0c\x28\x5b\x19", 74); break; case 11: memcpy((void*)0x10000080, "\x7e\x02\xc4\xe1\xe1\x16\x09\x65\x26\x0f\x01\xfa\xc4\xc3\x49\x7c\x50\x05\x7d\xc4\xe2\x7d\xbd\xc7\xf3\x0f\x1e\xfc\xc4\xe1\x79\x10\x81\x12\xf4\x4a\x60\xc4\xe3\xb5\xcf\x3f\x5f\x36\xea\x09\x00\x00\x00\x6f\x37\xc4\xc1\xb4\x14\x2f", 56); syz_execute_func(0x10000080); break; case 12: break; } } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); use_temporary_dir(); loop(); return 0; } :352:11: error: use of undeclared identifier 'SYS_shm_open2' syscall(SYS_shm_open2, 0x100002c0, 0, 0x50, 0, 0x10000300); ^ 1 error generated. compiler invocation: clang [-o /tmp/syz-executor255075463 -DGOOS_freebsd=1 -DGOARCH_386=1 -DHOSTGOOS_freebsd=1 -x c - -m32 -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -static -lc++ -Wno-overflow] --- FAIL: TestGenerate/freebsd/386/2 (1.73s) csource_test.go:120: --- FAIL: TestGenerate/freebsd/386/9 (2.44s) csource_test.go:122: opts: {Threaded:true Collide:false Repeat:true RepeatTimes:0 Procs:0 Sandbox:none Fault:false FaultCall:0 FaultNth:0 Leak:false NetInjection:true NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false VhciInjection:false UseTmpDir:true HandleSegv:false Repro:false Trace:false} program: mkdir(&(0x7f0000000000)='./file0\x00', 0xa5) getpeername(0xffffffffffffff9c, &(0x7f0000000040)=@in6={0x1c, 0x1c, 0xffffffffffffffff, 0x0, @mcast2}, &(0x7f0000000080)=0x1c) r0 = fcntl$dupfd(0xffffffffffffffff, 0x11, 0xffffffffffffff9c) setsockopt$inet6_tcp_TCP_CONGESTION(r0, 0x6, 0x40, &(0x7f00000000c0)='chd\x00', 0x4) r1 = socket$inet6_icmp_raw(0x1c, 0x3, 0x3a) getsockopt$inet_sctp_SCTP_PEER_ADDR_PARAMS(r0, 0x84, 0xa, &(0x7f0000000100)={@in={{0x10, 0x2, 0x3, @multicast2}}, 0x0, 0x401, 0x7, 0x1, 0x4, 0x400, 0x20}, &(0x7f00000001c0)=0xa0) setsockopt$inet6_sctp_SCTP_ADD_STREAMS(r1, 0x84, 0x903, &(0x7f0000000200)={r2, 0x8, 0xffff}, 0x8) r3 = dup(0xffffffffffffffff) readlinkat(r3, &(0x7f0000000240)='./file0\x00', &(0x7f0000000280)=""/33, 0x21) shm_open2(&(0x7f00000002c0)='./file0\x00', 0x0, 0x50, 0x0, &(0x7f0000000300)='/#@\x00') syz_emit_ethernet(0x58, &(0x7f0000000000)={@remote, @broadcast, [], {@generic={0xe73d, "bb14e45374361790bbc0da8140f66ab0fc1174330be7643994f9efa065c589b84619520c53618a6bd0481668f70423425878138df97e84886332d304258618e730f3e0f2a1460c285b19"}}}) syz_execute_func(&(0x7f0000000080)="7e02c4e1e1160965260f01fac4c3497c50057dc4e27dbdc7f30f1efcc4e179108112f44a60c4e3b5cf3f5f36ea090000006f37c4c1b4142f") syz_extract_tcp_res(&(0x7f00000000c0), 0x80000000, 0xa23) csource_test.go:123: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static unsigned long long procid; static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void remove_dir(const char* dir) { DIR* dp; struct dirent* ep; dp = opendir(dir); if (dp == NULL) exit(1); while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } if (unlink(filename)) exit(1); } closedir(dp); if (rmdir(dir)) exit(1); } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i; for (i = 0; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { pthread_mutex_t mu; pthread_cond_t cv; int state; } event_t; static void event_init(event_t* ev) { if (pthread_mutex_init(&ev->mu, 0)) exit(1); if (pthread_cond_init(&ev->cv, 0)) exit(1); ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { pthread_mutex_lock(&ev->mu); if (ev->state) exit(1); ev->state = 1; pthread_mutex_unlock(&ev->mu); pthread_cond_broadcast(&ev->cv); } static void event_wait(event_t* ev) { pthread_mutex_lock(&ev->mu); while (!ev->state) pthread_cond_wait(&ev->cv, &ev->mu); pthread_mutex_unlock(&ev->mu); } static int event_isset(event_t* ev) { pthread_mutex_lock(&ev->mu); int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; pthread_mutex_lock(&ev->mu); for (;;) { if (ev->state) break; uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); now = current_time_ms(); if (now - start > timeout) break; } int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static int tunfd = -1; #define MAX_TUN 4 #define TUN_IFACE "tap%d" #define TUN_DEVICE "/dev/tap%d" #define LOCAL_MAC "aa:aa:aa:aa:aa:aa" #define REMOTE_MAC "aa:aa:aa:aa:aa:bb" #define LOCAL_IPV4 "172.20.%d.170" #define REMOTE_IPV4 "172.20.%d.187" #define LOCAL_IPV6 "fe80::%02hxaa" #define REMOTE_IPV6 "fe80::%02hxbb" static void vsnprintf_check(char* str, size_t size, const char* format, va_list args) { int rv; rv = vsnprintf(str, size, format, args); if (rv < 0) exit(1); if ((size_t)rv >= size) exit(1); } static void snprintf_check(char* str, size_t size, const char* format, ...) { va_list args; va_start(args, format); vsnprintf_check(str, size, format, args); va_end(args); } #define COMMAND_MAX_LEN 128 #define PATH_PREFIX "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin " #define PATH_PREFIX_LEN (sizeof(PATH_PREFIX) - 1) static void execute_command(bool panic, const char* format, ...) { va_list args; char command[PATH_PREFIX_LEN + COMMAND_MAX_LEN]; int rv; va_start(args, format); memcpy(command, PATH_PREFIX, PATH_PREFIX_LEN); vsnprintf_check(command + PATH_PREFIX_LEN, COMMAND_MAX_LEN, format, args); va_end(args); rv = system(command); if (rv) { if (panic) exit(1); } } static void initialize_tun(int tun_id) { if (tun_id < 0 || tun_id >= MAX_TUN) { exit(1); } char tun_device[sizeof(TUN_DEVICE)]; snprintf_check(tun_device, sizeof(tun_device), TUN_DEVICE, tun_id); char tun_iface[sizeof(TUN_IFACE)]; snprintf_check(tun_iface, sizeof(tun_iface), TUN_IFACE, tun_id); execute_command(0, "ifconfig %s destroy", tun_device); tunfd = open(tun_device, O_RDWR | O_NONBLOCK); if ((tunfd < 0) && (errno == ENOENT)) { execute_command(0, "kldload -q if_tap"); tunfd = open(tun_device, O_RDWR | O_NONBLOCK); } if (tunfd == -1) { printf("tun: can't open %s: errno=%d\n", tun_device, errno); return; } const int kTunFd = 240; if (dup2(tunfd, kTunFd) < 0) exit(1); close(tunfd); tunfd = kTunFd; char local_mac[sizeof(LOCAL_MAC)]; snprintf_check(local_mac, sizeof(local_mac), LOCAL_MAC); execute_command(1, "ifconfig %s ether %s", tun_iface, local_mac); char local_ipv4[sizeof(LOCAL_IPV4)]; snprintf_check(local_ipv4, sizeof(local_ipv4), LOCAL_IPV4, tun_id); execute_command(1, "ifconfig %s inet %s netmask 255.255.255.0", tun_iface, local_ipv4); char remote_mac[sizeof(REMOTE_MAC)]; char remote_ipv4[sizeof(REMOTE_IPV4)]; snprintf_check(remote_mac, sizeof(remote_mac), REMOTE_MAC); snprintf_check(remote_ipv4, sizeof(remote_ipv4), REMOTE_IPV4, tun_id); execute_command(0, "arp -s %s %s", remote_ipv4, remote_mac); char local_ipv6[sizeof(LOCAL_IPV6)]; snprintf_check(local_ipv6, sizeof(local_ipv6), LOCAL_IPV6, tun_id); execute_command(1, "ifconfig %s inet6 %s", tun_iface, local_ipv6); char remote_ipv6[sizeof(REMOTE_IPV6)]; snprintf_check(remote_ipv6, sizeof(remote_ipv6), REMOTE_IPV6, tun_id); execute_command(0, "ndp -s %s%%%s %s", remote_ipv6, tun_iface, remote_mac); } static long syz_emit_ethernet(volatile long a0, volatile long a1) { if (tunfd < 0) return (uintptr_t)-1; size_t length = a0; const char* data = (char*)a1; return write(tunfd, data, length); } static int read_tun(char* data, int size) { if (tunfd < 0) return -1; int rv = read(tunfd, data, size); if (rv < 0) { if (errno == EAGAIN) return -1; exit(1); } return rv; } struct tcp_resources { uint32_t seq; uint32_t ack; }; static long syz_extract_tcp_res(volatile long a0, volatile long a1, volatile long a2) { if (tunfd < 0) return (uintptr_t)-1; char data[1000]; int rv = read_tun(&data[0], sizeof(data)); if (rv == -1) return (uintptr_t)-1; size_t length = rv; struct tcphdr* tcphdr; if (length < sizeof(struct ether_header)) return (uintptr_t)-1; struct ether_header* ethhdr = (struct ether_header*)&data[0]; if (ethhdr->ether_type == htons(ETHERTYPE_IP)) { if (length < sizeof(struct ether_header) + sizeof(struct ip)) return (uintptr_t)-1; struct ip* iphdr = (struct ip*)&data[sizeof(struct ether_header)]; if (iphdr->ip_p != IPPROTO_TCP) return (uintptr_t)-1; if (length < sizeof(struct ether_header) + iphdr->ip_hl * 4 + sizeof(struct tcphdr)) return (uintptr_t)-1; tcphdr = (struct tcphdr*)&data[sizeof(struct ether_header) + iphdr->ip_hl * 4]; } else { if (length < sizeof(struct ether_header) + sizeof(struct ip6_hdr)) return (uintptr_t)-1; struct ip6_hdr* ipv6hdr = (struct ip6_hdr*)&data[sizeof(struct ether_header)]; if (ipv6hdr->ip6_nxt != IPPROTO_TCP) return (uintptr_t)-1; if (length < sizeof(struct ether_header) + sizeof(struct ip6_hdr) + sizeof(struct tcphdr)) return (uintptr_t)-1; tcphdr = (struct tcphdr*)&data[sizeof(struct ether_header) + sizeof(struct ip6_hdr)]; } struct tcp_resources* res = (struct tcp_resources*)a0; res->seq = htonl(ntohl(tcphdr->th_seq) + (uint32_t)a1); res->ack = htonl(ntohl(tcphdr->th_ack) + (uint32_t)a2); return 0; } static void sandbox_common() { if (setsid() == -1) exit(1); struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 8 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 0; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); } static void loop(); static int do_sandbox_none(void) { sandbox_common(); initialize_tun(procid); loop(); return 0; } static long syz_execute_func(volatile long text) { volatile long p[8] = {0}; (void)p; ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 13; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); event_timedwait(&th->done, 45); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); #define WAIT_FLAGS 0 static void loop(void) { int iter; for (iter = 0;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5 * 1000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xffffffffffffffff}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: memcpy((void*)0x10000000, "./file0\000", 8); syscall(SYS_mkdir, 0x10000000, 0xa5); break; case 1: *(uint32_t*)0x10000080 = 0x1c; syscall(SYS_getpeername, 0xffffff9c, 0x10000040, 0x10000080); break; case 2: res = syscall(SYS_fcntl, -1, 0x11, 0xffffff9c); if (res != -1) r[0] = res; break; case 3: memcpy((void*)0x100000c0, "chd\000", 4); syscall(SYS_setsockopt, (intptr_t)r[0], 6, 0x40, 0x100000c0, 4); break; case 4: res = syscall(SYS_socket, 0x1c, 3, 0x3a); if (res != -1) r[1] = res; break; case 5: *(uint8_t*)0x10000100 = 0x10; *(uint8_t*)0x10000101 = 2; *(uint16_t*)0x10000102 = htobe16(0x4e23); *(uint32_t*)0x10000104 = htobe32(0xe0000002); *(uint8_t*)0x10000108 = 0; *(uint8_t*)0x10000109 = 0; *(uint8_t*)0x1000010a = 0; *(uint8_t*)0x1000010b = 0; *(uint8_t*)0x1000010c = 0; *(uint8_t*)0x1000010d = 0; *(uint8_t*)0x1000010e = 0; *(uint8_t*)0x1000010f = 0; *(uint64_t*)0x10000110 = 0; *(uint64_t*)0x10000118 = 0; *(uint64_t*)0x10000120 = 0; *(uint64_t*)0x10000128 = 0; *(uint64_t*)0x10000130 = 0; *(uint64_t*)0x10000138 = 0; *(uint64_t*)0x10000140 = 0; *(uint64_t*)0x10000148 = 0; *(uint64_t*)0x10000150 = 0; *(uint64_t*)0x10000158 = 0; *(uint64_t*)0x10000160 = 0; *(uint64_t*)0x10000168 = 0; *(uint64_t*)0x10000170 = 0; *(uint64_t*)0x10000178 = 0; *(uint64_t*)0x10000180 = 0; *(uint32_t*)0x10000188 = 0; *(uint32_t*)0x1000018c = 0x401; *(uint32_t*)0x10000190 = 7; *(uint32_t*)0x10000194 = 1; *(uint32_t*)0x10000198 = 4; *(uint16_t*)0x1000019c = 0x400; *(uint8_t*)0x1000019e = 0x20; *(uint32_t*)0x100001c0 = 0xa0; res = syscall(SYS_getsockopt, (intptr_t)r[0], 0x84, 0xa, 0x10000100, 0x100001c0); if (res != -1) r[2] = *(uint32_t*)0x10000188; break; case 6: *(uint32_t*)0x10000200 = r[2]; *(uint16_t*)0x10000204 = 8; *(uint16_t*)0x10000206 = -1; syscall(SYS_setsockopt, (intptr_t)r[1], 0x84, 0x903, 0x10000200, 8); break; case 7: res = syscall(SYS_dup, -1); if (res != -1) r[3] = res; break; case 8: memcpy((void*)0x10000240, "./file0\000", 8); syscall(SYS_readlinkat, (intptr_t)r[3], 0x10000240, 0x10000280, 0x21); break; case 9: memcpy((void*)0x100002c0, "./file0\000", 8); memcpy((void*)0x10000300, "/#@\000", 4); syscall(SYS_shm_open2, 0x100002c0, 0, 0x50, 0, 0x10000300); break; case 10: *(uint8_t*)0x10000000 = 0xaa; *(uint8_t*)0x10000001 = 0xaa; *(uint8_t*)0x10000002 = 0xaa; *(uint8_t*)0x10000003 = 0xaa; *(uint8_t*)0x10000004 = 0xaa; *(uint8_t*)0x10000005 = 0xbb; *(uint8_t*)0x10000006 = -1; *(uint8_t*)0x10000007 = -1; *(uint8_t*)0x10000008 = -1; *(uint8_t*)0x10000009 = -1; *(uint8_t*)0x1000000a = -1; *(uint8_t*)0x1000000b = -1; *(uint16_t*)0x1000000c = htobe16(0xe73d); memcpy((void*)0x1000000e, "\xbb\x14\xe4\x53\x74\x36\x17\x90\xbb\xc0\xda\x81\x40\xf6\x6a\xb0\xfc\x11\x74\x33\x0b\xe7\x64\x39\x94\xf9\xef\xa0\x65\xc5\x89\xb8\x46\x19\x52\x0c\x53\x61\x8a\x6b\xd0\x48\x16\x68\xf7\x04\x23\x42\x58\x78\x13\x8d\xf9\x7e\x84\x88\x63\x32\xd3\x04\x25\x86\x18\xe7\x30\xf3\xe0\xf2\xa1\x46\x0c\x28\x5b\x19", 74); syz_emit_ethernet(0x58, 0x10000000); break; case 11: memcpy((void*)0x10000080, "\x7e\x02\xc4\xe1\xe1\x16\x09\x65\x26\x0f\x01\xfa\xc4\xc3\x49\x7c\x50\x05\x7d\xc4\xe2\x7d\xbd\xc7\xf3\x0f\x1e\xfc\xc4\xe1\x79\x10\x81\x12\xf4\x4a\x60\xc4\xe3\xb5\xcf\x3f\x5f\x36\xea\x09\x00\x00\x00\x6f\x37\xc4\xc1\xb4\x14\x2f", 56); syz_execute_func(0x10000080); break; case 12: syz_extract_tcp_res(0x100000c0, 0x80000000, 0xa23); break; } } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); use_temporary_dir(); do_sandbox_none(); return 0; } :555:11: error: use of undeclared identifier 'SYS_shm_open2' syscall(SYS_shm_open2, 0x100002c0, 0, 0x50, 0, 0x10000300); ^ 1 error generated. compiler invocation: clang [-o /tmp/syz-executor341408826 -DGOOS_freebsd=1 -DGOARCH_386=1 -DHOSTGOOS_freebsd=1 -x c - -m32 -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -static -lc++ -Wno-overflow] --- FAIL: TestGenerate/freebsd/386/6 (1.79s) csource_test.go:120: --- FAIL: TestGenerate/freebsd/386/3 (1.62s) csource_test.go:120: --- FAIL: TestGenerate/freebsd/386/5 (1.92s) csource_test.go:120: --- FAIL: TestGenerate/freebsd/386/1 (1.56s) csource_test.go:120: FAIL FAIL github.com/google/syzkaller/pkg/csource 20.365s ok github.com/google/syzkaller/pkg/db (cached) ok github.com/google/syzkaller/pkg/email (cached) ? github.com/google/syzkaller/pkg/gce [no test files] ? github.com/google/syzkaller/pkg/gcs [no test files] ? github.com/google/syzkaller/pkg/hash [no test files] ok github.com/google/syzkaller/pkg/host 2.132s ? github.com/google/syzkaller/pkg/html [no test files] ok github.com/google/syzkaller/pkg/ifuzz (cached) ? github.com/google/syzkaller/pkg/ifuzz/gen [no test files] ? github.com/google/syzkaller/pkg/ifuzz/generated [no test files] ok github.com/google/syzkaller/pkg/instance 4.735s ok github.com/google/syzkaller/pkg/ipc 9.932s ? github.com/google/syzkaller/pkg/ipc/ipcconfig [no test files] ok github.com/google/syzkaller/pkg/kd (cached) ok github.com/google/syzkaller/pkg/log (cached) ok github.com/google/syzkaller/pkg/mgrconfig 0.071s ok github.com/google/syzkaller/pkg/osutil (cached) ok github.com/google/syzkaller/pkg/report 8.710s ok github.com/google/syzkaller/pkg/repro 1.982s ? github.com/google/syzkaller/pkg/rpctype [no test files] --- FAIL: Test (1.81s) --- FAIL: Test/64 (56.08s) run.go:67: align0 C : OK run.go:67: align0 /repeat C : BROKEN (non-forking loop) run.go:67: align0 /thr C : OK run.go:67: align0 /thr/repeat C : BROKEN (non-forking loop) run.go:67: align0 none : OK run.go:67: align0 none C : OK run.go:67: align0 none/repeat : OK run.go:67: align0 none/repeat C : BROKEN (non-forking loop) run.go:67: align0 none/thr : OK run.go:67: align0 none/thr C : OK run.go:67: align0 none/thr/repeat : OK run.go:67: align0 none/thr/repeat C : BROKEN (non-forking loop) run.go:67: align0_be C : SKIP (excluded by constraints) run.go:67: align0_be /repeat C : BROKEN (non-forking loop) run.go:67: align0_be /thr C : SKIP (excluded by constraints) run.go:67: align0_be /thr/repeat C : BROKEN (non-forking loop) run.go:67: align0_be none : SKIP (excluded by constraints) run.go:67: align0_be none C : SKIP (excluded by constraints) run.go:67: align0_be none/repeat : SKIP (excluded by constraints) run.go:67: align0_be none/repeat C : BROKEN (non-forking loop) run.go:67: align0_be none/thr : SKIP (excluded by constraints) run.go:67: align0_be none/thr C : SKIP (excluded by constraints) run.go:67: align0_be none/thr/repeat : SKIP (excluded by constraints) run.go:67: align0_be none/thr/repeat C : BROKEN (non-forking loop) run.go:67: bf C : OK run.go:67: bf /repeat C : BROKEN (non-forking loop) run.go:67: bf /thr C : OK run.go:67: bf /thr/repeat C : BROKEN (non-forking loop) run.go:67: bf none : OK run.go:67: bf none C : OK run.go:67: bf none/repeat : OK run.go:67: bf none/repeat C : BROKEN (non-forking loop) run.go:67: bf none/thr : OK run.go:67: bf none/thr C : OK run.go:67: bf none/thr/repeat : OK run.go:67: bf none/thr/repeat C : BROKEN (non-forking loop) run.go:67: bf2 C : OK run.go:67: bf2 /repeat C : BROKEN (non-forking loop) run.go:67: bf2 /thr C : OK run.go:67: bf2 /thr/repeat C : BROKEN (non-forking loop) run.go:67: bf2 none : OK run.go:67: bf2 none C : OK run.go:67: bf2 none/repeat : OK run.go:67: bf2 none/repeat C : BROKEN (non-forking loop) run.go:67: bf2 none/thr : OK run.go:67: bf2 none/thr C : OK run.go:67: bf2 none/thr/repeat : OK run.go:67: bf2 none/thr/repeat C : BROKEN (non-forking loop) run.go:67: bf2_be C : SKIP (excluded by constraints) run.go:67: bf2_be /repeat C : BROKEN (non-forking loop) run.go:67: bf2_be /thr C : SKIP (excluded by constraints) run.go:67: bf2_be /thr/repeat C : BROKEN (non-forking loop) run.go:67: bf2_be none : SKIP (excluded by constraints) run.go:67: bf2_be none C : SKIP (excluded by constraints) run.go:67: bf2_be none/repeat : SKIP (excluded by constraints) run.go:67: bf2_be none/repeat C : BROKEN (non-forking loop) run.go:67: bf2_be none/thr : SKIP (excluded by constraints) run.go:67: bf2_be none/thr C : SKIP (excluded by constraints) run.go:67: bf2_be none/thr/repeat : SKIP (excluded by constraints) run.go:67: bf2_be none/thr/repeat C : BROKEN (non-forking loop) run.go:67: bf_be C : SKIP (excluded by constraints) run.go:67: bf_be /repeat C : BROKEN (non-forking loop) run.go:67: bf_be /thr C : SKIP (excluded by constraints) run.go:67: bf_be /thr/repeat C : BROKEN (non-forking loop) run.go:67: bf_be none : SKIP (excluded by constraints) run.go:67: bf_be none C : SKIP (excluded by constraints) run.go:67: bf_be none/repeat : SKIP (excluded by constraints) run.go:67: bf_be none/repeat C : BROKEN (non-forking loop) run.go:67: bf_be none/thr : SKIP (excluded by constraints) run.go:67: bf_be none/thr C : SKIP (excluded by constraints) run.go:67: bf_be none/thr/repeat : SKIP (excluded by constraints) run.go:67: bf_be none/thr/repeat C : BROKEN (non-forking loop) run.go:67: errno C : OK run.go:67: errno /repeat C : BROKEN (non-forking loop) run.go:67: errno /thr C : OK run.go:67: errno /thr/repeat C : BROKEN (non-forking loop) run.go:67: errno none : OK run.go:67: errno none C : OK run.go:67: errno none/repeat : OK run.go:67: errno none/repeat C : BROKEN (non-forking loop) run.go:67: errno none/thr : OK run.go:67: errno none/thr C : OK run.go:67: errno none/thr/repeat : OK run.go:67: errno none/thr/repeat C : BROKEN (non-forking loop) run.go:67: exit0 C : OK run.go:67: exit0 /repeat C : BROKEN (non-forking loop) run.go:67: exit0 /thr C : OK run.go:67: exit0 /thr/repeat C : BROKEN (non-forking loop) run.go:67: exit0 none : OK run.go:67: exit0 none C : OK run.go:67: exit0 none/repeat : OK run.go:67: exit0 none/repeat C : BROKEN (non-forking loop) run.go:67: exit0 none/thr : OK run.go:67: exit0 none/thr C : OK run.go:67: exit0 none/thr/repeat : OK run.go:67: exit0 none/thr/repeat C : BROKEN (non-forking loop) run.go:67: exit1 C : OK run.go:67: exit1 /repeat C : BROKEN (non-forking loop) run.go:67: exit1 /thr C : OK run.go:67: exit1 /thr/repeat C : BROKEN (non-forking loop) run.go:67: exit1 none : OK run.go:67: exit1 none C : OK run.go:67: exit1 none/repeat : OK run.go:67: exit1 none/repeat C : BROKEN (non-forking loop) run.go:67: exit1 none/thr : OK run.go:67: exit1 none/thr C : OK run.go:67: exit1 none/thr/repeat : OK run.go:67: exit1 none/thr/repeat C : BROKEN (non-forking loop) run.go:67: fmt C : OK run.go:67: fmt /repeat C : BROKEN (non-forking loop) run.go:67: fmt /thr C : OK run.go:67: fmt /thr/repeat C : BROKEN (non-forking loop) run.go:67: fmt none : OK run.go:67: fmt none C : OK run.go:67: fmt none/repeat : OK run.go:67: fmt none/repeat C : BROKEN (non-forking loop) run.go:67: fmt none/thr : OK run.go:67: fmt none/thr C : OK run.go:67: fmt none/thr/repeat : OK run.go:67: fmt none/thr/repeat C : BROKEN (non-forking loop) run.go:67: nla C : OK run.go:67: nla /repeat C : BROKEN (non-forking loop) run.go:67: nla /thr C : OK run.go:67: nla /thr/repeat C : BROKEN (non-forking loop) run.go:67: nla none : OK run.go:67: nla none C : OK run.go:67: nla none/repeat : OK run.go:67: nla none/repeat C : BROKEN (non-forking loop) run.go:67: nla none/thr : OK run.go:67: nla none/thr C : OK run.go:67: nla none/thr/repeat : OK run.go:67: nla none/thr/repeat C : BROKEN (non-forking loop) run.go:67: nonfailing C : FAIL: run 0: call 0 is not executed ### start run.go:67: nonfailing /repeat C : BROKEN (non-forking loop) run.go:67: nonfailing /thr C : FAIL: run 0: call 0 is not executed ### start run.go:67: nonfailing /thr/repeat C : BROKEN (non-forking loop) run.go:67: nonfailing none : FAIL: run 0: call 0 is not executed run.go:67: nonfailing none C : FAIL: run 0: call 0 is not executed ### start run.go:67: nonfailing none/repeat : FAIL: run 0: call 0 is not executed run.go:67: nonfailing none/repeat C : BROKEN (non-forking loop) run.go:67: nonfailing none/thr : FAIL: run 0: call 0 is not executed run.go:67: nonfailing none/thr C : FAIL: run 0: call 0 is not executed ### start run.go:67: nonfailing none/thr/repeat : FAIL: run 0: call 0 is not executed run.go:67: nonfailing none/thr/repeat C : BROKEN (non-forking loop) run.go:67: strings C : OK run.go:67: strings /repeat C : BROKEN (non-forking loop) run.go:67: strings /thr C : OK run.go:67: strings /thr/repeat C : BROKEN (non-forking loop) run.go:67: strings none : OK run.go:67: strings none C : OK run.go:67: strings none/repeat : OK run.go:67: strings none/repeat C : BROKEN (non-forking loop) run.go:67: strings none/thr : OK run.go:67: strings none/thr C : OK run.go:67: strings none/thr/repeat : OK run.go:67: strings none/thr/repeat C : BROKEN (non-forking loop) run.go:67: test C : OK run.go:67: test /repeat C : BROKEN (non-forking loop) run.go:67: test /thr C : OK run.go:67: test /thr/repeat C : BROKEN (non-forking loop) run.go:67: test none : OK run.go:67: test none C : OK run.go:67: test none/repeat : OK run.go:67: test none/repeat C : BROKEN (non-forking loop) run.go:67: test none/thr : OK run.go:67: test none/thr C : OK run.go:67: test none/thr/repeat : OK run.go:67: test none/thr/repeat C : BROKEN (non-forking loop) run.go:67: zero_args C : OK run.go:67: zero_args /repeat C : BROKEN (non-forking loop) run.go:67: zero_args /thr C : OK run.go:67: zero_args /thr/repeat C : BROKEN (non-forking loop) run.go:67: zero_args none : OK run.go:67: zero_args none C : OK run.go:67: zero_args none/repeat : OK run.go:67: zero_args none/repeat C : BROKEN (non-forking loop) run.go:67: zero_args none/thr : OK run.go:67: zero_args none/thr C : OK run.go:67: zero_args none/thr/repeat : OK run.go:67: zero_args none/thr/repeat C : BROKEN (non-forking loop) run.go:67: ok: 88, broken: 60, skip: 24, fail: 8 run_test.go:95: tests failed FAIL FAIL github.com/google/syzkaller/pkg/runtest 58.014s ok github.com/google/syzkaller/pkg/serializer (cached) ? github.com/google/syzkaller/pkg/signal [no test files] ok github.com/google/syzkaller/pkg/symbolizer (cached) ok github.com/google/syzkaller/pkg/vcs (cached) ok github.com/google/syzkaller/prog 19.287s ok github.com/google/syzkaller/prog/test (cached) ? github.com/google/syzkaller/sys [no test files] ? github.com/google/syzkaller/sys/akaros [no test files] ? github.com/google/syzkaller/sys/akaros/gen [no test files] ? github.com/google/syzkaller/sys/freebsd [no test files] ? github.com/google/syzkaller/sys/freebsd/gen [no test files] ? github.com/google/syzkaller/sys/fuchsia [no test files] ? github.com/google/syzkaller/sys/fuchsia/fidlgen [no test files] ? github.com/google/syzkaller/sys/fuchsia/gen [no test files] ? github.com/google/syzkaller/sys/fuchsia/layout [no test files] ok github.com/google/syzkaller/sys/linux 0.195s ? github.com/google/syzkaller/sys/linux/gen [no test files] ? github.com/google/syzkaller/sys/netbsd [no test files] ? github.com/google/syzkaller/sys/netbsd/gen [no test files] ok github.com/google/syzkaller/sys/openbsd 0.235s ? github.com/google/syzkaller/sys/openbsd/gen [no test files] ? github.com/google/syzkaller/sys/syz-extract [no test files] ? github.com/google/syzkaller/sys/syz-sysgen [no test files] ? github.com/google/syzkaller/sys/targets [no test files] ? github.com/google/syzkaller/sys/test [no test files] ? github.com/google/syzkaller/sys/test/gen [no test files] ? github.com/google/syzkaller/sys/trusty [no test files] ? github.com/google/syzkaller/sys/trusty/gen [no test files] ? github.com/google/syzkaller/sys/windows [no test files] ? github.com/google/syzkaller/sys/windows/gen [no test files] ok github.com/google/syzkaller/syz-ci 1.588s ok github.com/google/syzkaller/syz-fuzzer 0.761s ok github.com/google/syzkaller/syz-hub 0.159s ok github.com/google/syzkaller/syz-hub/state (cached) ? github.com/google/syzkaller/syz-manager [no test files] ? github.com/google/syzkaller/tools/syz-benchcmp [no test files] ? github.com/google/syzkaller/tools/syz-bisect [no test files] ? github.com/google/syzkaller/tools/syz-check [no test files] ? github.com/google/syzkaller/tools/syz-cover [no test files] ? github.com/google/syzkaller/tools/syz-crush [no test files] ? github.com/google/syzkaller/tools/syz-db [no test files] ? github.com/google/syzkaller/tools/syz-execprog [no test files] ? github.com/google/syzkaller/tools/syz-expand [no test files] ? github.com/google/syzkaller/tools/syz-fmt [no test files] ? github.com/google/syzkaller/tools/syz-imagegen [no test files] ok github.com/google/syzkaller/tools/syz-linter (cached) ? github.com/google/syzkaller/tools/syz-make [no test files] ? github.com/google/syzkaller/tools/syz-mutate [no test files] ? github.com/google/syzkaller/tools/syz-prog2c [no test files] ? github.com/google/syzkaller/tools/syz-reporter [no test files] ? github.com/google/syzkaller/tools/syz-repro [no test files] ? github.com/google/syzkaller/tools/syz-reprolist [no test files] ? github.com/google/syzkaller/tools/syz-runtest [no test files] ? github.com/google/syzkaller/tools/syz-showprio [no test files] ? github.com/google/syzkaller/tools/syz-stress [no test files] ? github.com/google/syzkaller/tools/syz-symbolize [no test files] ? github.com/google/syzkaller/tools/syz-testbuild [no test files] ? github.com/google/syzkaller/tools/syz-trace2syz [no test files] ok github.com/google/syzkaller/tools/syz-trace2syz/parser 0.069s ok github.com/google/syzkaller/tools/syz-trace2syz/proggen 0.419s ? github.com/google/syzkaller/tools/syz-tty [no test files] ? github.com/google/syzkaller/tools/syz-upgrade [no test files] ? github.com/google/syzkaller/tools/syz-usbgen [no test files] ok github.com/google/syzkaller/vm 10.169s ? github.com/google/syzkaller/vm/adb [no test files] ? github.com/google/syzkaller/vm/bhyve [no test files] ? github.com/google/syzkaller/vm/gce [no test files] ? github.com/google/syzkaller/vm/gvisor [no test files] ok github.com/google/syzkaller/vm/isolated (cached) ? github.com/google/syzkaller/vm/kvm [no test files] ? github.com/google/syzkaller/vm/odroid [no test files] ? github.com/google/syzkaller/vm/qemu [no test files] ok github.com/google/syzkaller/vm/vmimpl (cached) ? github.com/google/syzkaller/vm/vmm [no test files] FAIL