? github.com/google/syzkaller/dashboard/dashapi [no test files] ok github.com/google/syzkaller/dashboard/app (cached) ok github.com/google/syzkaller/executor 0.469s ok github.com/google/syzkaller/pkg/asset (cached) ok github.com/google/syzkaller/pkg/ast 1.155s ok github.com/google/syzkaller/pkg/auth (cached) ? github.com/google/syzkaller/pkg/debugtracer [no test files] ? github.com/google/syzkaller/pkg/hash [no test files] ? github.com/google/syzkaller/pkg/gcs [no test files] ? github.com/google/syzkaller/pkg/html/pages [no test files] ? github.com/google/syzkaller/pkg/ifuzz/iset [no test files] ? github.com/google/syzkaller/pkg/ifuzz/powerpc [no test files] ? github.com/google/syzkaller/pkg/ifuzz/powerpc/generated [no test files] ? github.com/google/syzkaller/pkg/ifuzz/x86 [no test files] ? github.com/google/syzkaller/pkg/ifuzz/x86/gen [no test files] ? github.com/google/syzkaller/pkg/ifuzz/x86/generated [no test files] ? github.com/google/syzkaller/pkg/ipc/ipcconfig [no test files] ? github.com/google/syzkaller/pkg/kcidb [no test files] ? github.com/google/syzkaller/pkg/report/crash [no test files] ? github.com/google/syzkaller/pkg/rpctype [no test files] ? github.com/google/syzkaller/pkg/stats/syzbotstats [no test files] ? github.com/google/syzkaller/pkg/testutil [no test files] ? github.com/google/syzkaller/pkg/tools [no test files] ok github.com/google/syzkaller/pkg/bisect 167.499s ok github.com/google/syzkaller/pkg/bisect/minimize (cached) ok github.com/google/syzkaller/pkg/build 11.738s ok github.com/google/syzkaller/pkg/compiler 12.379s ok github.com/google/syzkaller/pkg/config (cached) ok github.com/google/syzkaller/pkg/corpus 1.532s ok github.com/google/syzkaller/pkg/cover 0.409s ok github.com/google/syzkaller/pkg/cover/backend 1.881s --- FAIL: TestGenerate (14.22s) --- FAIL: TestGenerate/openbsd/amd64 (0.03s) testutil.go:33: seed=1712872475025100918 testutil.go:33: seed=1712872475056659310 --- FAIL: TestGenerate/openbsd/amd64/0 (1.17s) csource_test.go:150: opts: {Threaded:false Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: r0 = openat$wsmuxkbd(0xffffffffffffff9c, &(0x7f0000000000), 0x20000, 0x0) (fail_nth: 1) r1 = accept$unix(r0, &(0x7f0000000040)=@file={0x0, ""/248}, &(0x7f0000000140)=0xfa) (async) r2 = getuid() (rerun: 4) getsockopt$SO_PEERCRED(r0, 0xffff, 0x1022, &(0x7f00000001c0)={0x0, 0x0, 0x0}, 0xc) chown(&(0x7f0000000180)='./file0\x00', r2, r3) bind(r1, &(0x7f0000000200)=@un=@abs={0x1, 0x0, 0x1}, 0x8) close(r0) mknod(&(0x7f0000000240)='./file0\x00', 0x100, 0x2) getsockopt$sock_timeval(r0, 0xffff, 0x1005, &(0x7f0000000280), &(0x7f00000002c0)=0x10) bind$inet6(r0, &(0x7f0000000300)={0x18, 0x3, 0x1ff, 0x5}, 0xc) syz_emit_ethernet(0x10c, &(0x7f0000000000)={@empty, @empty, [], {@generic={0x80f2, "961f1fcb2f7f4cf2d7246215711c6da70853b100bd7776418a8afef6a228178cc26bae556f82cd5b9d4399f29b1507307298cd20118e65db32c1d22941bfac3a8b1b753685ef611dcb8f7bca5aca235e21a9b3325e0b3db73ca42ff035eec10b2517988d0f7455645ae86e3da964b66fa2fc940836f41f0fbc7cbf421ebc9d05e643c8fd4b547ad8221d1aabe91ecb63589a96f6117c9fadeafa8f1e901982f6750358119e21c6d564818141905cb897612dafe7d8ee459ac6cb9f67848448abc14c59a530ae4a045561e140ba558965d6d6fd1c7d56e57fcf2e236631c090bedff1402267f1b4a1402fe280d869264459254fb631603557611281b0aabd"}}}) syz_execute_func(&(0x7f0000000140)="c463d55d8453b762bfca0fc483457fd800c44379623a0dc4e1bd5dd7660f10fcc461397641920faaf30f00adab36000026440f7092320000006ec4e1c9fa5fad") syz_extract_tcp_res(&(0x7f0000000180), 0x7, 0x8) syz_open_pts() csource_test.go:151: 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 #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 __attribute__((noinline)) remove_dir(const char* dir) { DIR* dp = opendir(dir); if (dp == NULL) { if (errno == EACCES) { if (rmdir(dir)) exit(1); return; } exit(1); } struct dirent* ep = 0; 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); while (rmdir(dir)) { exit(1); } } static int inject_fault(int nth) { return 0; } static void setup_fault() { } #define CAST static uintptr_t syz_open_pts(void) { int master, slave; if (openpty(&master, &slave, NULL, NULL, NULL) == -1) return -1; if (dup2(master, master + 100) != -1) close(master); return slave; } static void sandbox_common() { if (setsid() == -1) exit(1); struct rlimit 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) { ((void (*)(void))(text))(); return 0; } static void execute_one(void); #define WAIT_FLAGS 0 static void loop(void) { int iter = 0; for (;; 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 < 5000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0x0}; void execute_one(void) { intptr_t res = 0; memcpy((void*)0x20000000, "/dev/wskbd\000", 11); inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(openat))(/*fd=*/0xffffffffffffff9c, /*file=*/0x20000000, /*flags=O_DIRECTORY*/0x20000, /*mode=*/0); if (res != -1) r[0] = res; *(uint32_t*)0x20000140 = 0xfa; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(accept))(/*fd=*/r[0], /*peer=*/0x20000040, /*peerlen=*/0x20000140); if (res != -1) r[1] = res; res = -1; res = ((intptr_t(*)())CAST(getuid))(); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)())CAST(getuid))(); } } if (res != -1) r[2] = res; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(getsockopt))(/*fd=*/r[0], /*level=*/0xffff, /*optname=*/0x1022, /*optval=*/0x200001c0, /*optlen=*/0xc); if (res != -1) r[3] = *(uint32_t*)0x200001c8; memcpy((void*)0x20000180, "./file0\000", 8); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(chown))(/*file=*/0x20000180, /*uid=*/r[2], /*gid=*/r[3]); *(uint16_t*)0x20000200 = 1; *(uint8_t*)0x20000202 = 0; *(uint32_t*)0x20000204 = 0x4e21; ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(bind))(/*fd=*/r[1], /*addr=*/0x20000200, /*addrlen=*/8); ((intptr_t(*)(intptr_t))CAST(close))(/*fd=*/r[0]); memcpy((void*)0x20000240, "./file0\000", 8); NONFAILING(((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(mknod))(/*file=*/0x20000240, /*mode=*/0x100, /*dev=*/2)); /* major = 0, minor = 2 */ *(uint32_t*)0x200002c0 = 0x10; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(getsockopt))(/*fd=*/r[0], /*level=*/0xffff, /*optname=SO_SNDTIMEO*/0x1005, /*optval=*/0x20000280, /*optlen=*/0x200002c0); *(uint16_t*)0x20000300 = 0x18; *(uint16_t*)0x20000302 = htobe16(0x4e23); *(uint32_t*)0x20000304 = 0x1ff; *(uint32_t*)0x20000308 = 5; ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(bind))(/*fd=*/r[0], /*addr=*/0x20000300, /*addrlen=*/0xc); memcpy((void*)0x20000140, "\xc4\x63\xd5\x5d\x84\x53\xb7\x62\xbf\xca\x0f\xc4\x83\x45\x7f\xd8\x00\xc4\x43\x79\x62\x3a\x0d\xc4\xe1\xbd\x5d\xd7\x66\x0f\x10\xfc\xc4\x61\x39\x76\x41\x92\x0f\xaa\xf3\x0f\x00\xad\xab\x36\x00\x00\x26\x44\x0f\x70\x92\x32\x00\x00\x00\x6e\xc4\xe1\xc9\xfa\x5f\xad", 64); syz_execute_func(/*text=*/0x20000140); syz_open_pts(); } int main(void) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(mmap))(/*addr=*/0x20000000, /*len=*/0x1000000, /*prot=PROT_WRITE|PROT_READ*/3, /*flags=MAP_ANONYMOUS|MAP_FIXED|MAP_PRIVATE*/0x1012, /*fd=*/-1, /*offset=*/0); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :231:2: error: call to undeclared function 'NONFAILING'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration] NONFAILING(((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(mknod))(/*file=*/0x20000240, /*mode=*/0x100, /*dev=*/2)); /* major = 0, minor = 2 */ ^ 1 error generated. compiler invocation: c++ [-o /tmp/syz-executor1230161068 -DGOOS_openbsd=1 -DGOARCH_amd64=1 -DHOSTGOOS_openbsd=1 -x c - -m64 -static -lutil -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-but-set-variable -Wno-unused-command-line-argument] --- FAIL: TestGenerate/openbsd/amd64/8 (1.25s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:setuid SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: r0 = openat$wsmuxkbd(0xffffffffffffff9c, &(0x7f0000000000), 0x20000, 0x0) (fail_nth: 1) r1 = accept$unix(r0, &(0x7f0000000040)=@file={0x0, ""/248}, &(0x7f0000000140)=0xfa) (async) r2 = getuid() (rerun: 4) getsockopt$SO_PEERCRED(r0, 0xffff, 0x1022, &(0x7f00000001c0)={0x0, 0x0, 0x0}, 0xc) chown(&(0x7f0000000180)='./file0\x00', r2, r3) bind(r1, &(0x7f0000000200)=@un=@abs={0x1, 0x0, 0x1}, 0x8) close(r0) mknod(&(0x7f0000000240)='./file0\x00', 0x100, 0x2) getsockopt$sock_timeval(r0, 0xffff, 0x1005, &(0x7f0000000280), &(0x7f00000002c0)=0x10) bind$inet6(r0, &(0x7f0000000300)={0x18, 0x3, 0x1ff, 0x5}, 0xc) syz_emit_ethernet(0x10c, &(0x7f0000000000)={@empty, @empty, [], {@generic={0x80f2, "961f1fcb2f7f4cf2d7246215711c6da70853b100bd7776418a8afef6a228178cc26bae556f82cd5b9d4399f29b1507307298cd20118e65db32c1d22941bfac3a8b1b753685ef611dcb8f7bca5aca235e21a9b3325e0b3db73ca42ff035eec10b2517988d0f7455645ae86e3da964b66fa2fc940836f41f0fbc7cbf421ebc9d05e643c8fd4b547ad8221d1aabe91ecb63589a96f6117c9fadeafa8f1e901982f6750358119e21c6d564818141905cb897612dafe7d8ee459ac6cb9f67848448abc14c59a530ae4a045561e140ba558965d6d6fd1c7d56e57fcf2e236631c090bedff1402267f1b4a1402fe280d869264459254fb631603557611281b0aabd"}}}) syz_execute_func(&(0x7f0000000140)="c463d55d8453b762bfca0fc483457fd800c44379623a0dc4e1bd5dd7660f10fcc461397641920faaf30f00adab36000026440f7092320000006ec4e1c9fa5fad") syz_extract_tcp_res(&(0x7f0000000180), 0x7, 0x8) syz_open_pts() csource_test.go:151: 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 #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 __attribute__((noinline)) remove_dir(const char* dir) { DIR* dp = opendir(dir); if (dp == NULL) { if (errno == EACCES) { if (rmdir(dir)) exit(1); return; } exit(1); } struct dirent* ep = 0; 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); while (rmdir(dir)) { exit(1); } } static int inject_fault(int nth) { return 0; } static void setup_fault() { } 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 = 0; for (; 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; } #define CAST static uintptr_t syz_open_pts(void) { int master, slave; if (openpty(&master, &slave, NULL, NULL, NULL) == -1) return -1; if (dup2(master, master + 100) != -1) close(master); return slave; } static void sandbox_common() { struct rlimit 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) { ((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 < 12; 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 (call == 1) break; event_timedwait(&th->done, 50); 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 = 0; for (;; 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 < 5000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: memcpy((void*)0x20000000, "/dev/wskbd\000", 11); inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(openat))(/*fd=*/0xffffffffffffff9c, /*file=*/0x20000000, /*flags=O_DIRECTORY*/0x20000, /*mode=*/0); if (res != -1) r[0] = res; break; case 1: *(uint32_t*)0x20000140 = 0xfa; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(accept))(/*fd=*/r[0], /*peer=*/0x20000040, /*peerlen=*/0x20000140); if (res != -1) r[1] = res; break; case 2: res = -1; res = ((intptr_t(*)())CAST(getuid))(); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)())CAST(getuid))(); } } if (res != -1) r[2] = res; break; case 3: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(getsockopt))(/*fd=*/r[0], /*level=*/0xffff, /*optname=*/0x1022, /*optval=*/0x200001c0, /*optlen=*/0xc); if (res != -1) r[3] = *(uint32_t*)0x200001c8; break; case 4: memcpy((void*)0x20000180, "./file0\000", 8); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(chown))(/*file=*/0x20000180, /*uid=*/r[2], /*gid=*/r[3]); break; case 5: *(uint16_t*)0x20000200 = 1; *(uint8_t*)0x20000202 = 0; *(uint32_t*)0x20000204 = 0x4e21; ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(bind))(/*fd=*/r[1], /*addr=*/0x20000200, /*addrlen=*/8); break; case 6: ((intptr_t(*)(intptr_t))CAST(close))(/*fd=*/r[0]); break; case 7: memcpy((void*)0x20000240, "./file0\000", 8); NONFAILING(((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(mknod))(/*file=*/0x20000240, /*mode=*/0x100, /*dev=*/2)); /* major = 0, minor = 2 */ break; case 8: *(uint32_t*)0x200002c0 = 0x10; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(getsockopt))(/*fd=*/r[0], /*level=*/0xffff, /*optname=SO_SNDTIMEO*/0x1005, /*optval=*/0x20000280, /*optlen=*/0x200002c0); break; case 9: *(uint16_t*)0x20000300 = 0x18; *(uint16_t*)0x20000302 = htobe16(0x4e23); *(uint32_t*)0x20000304 = 0x1ff; *(uint32_t*)0x20000308 = 5; ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(bind))(/*fd=*/r[0], /*addr=*/0x20000300, /*addrlen=*/0xc); break; case 10: memcpy((void*)0x20000140, "\xc4\x63\xd5\x5d\x84\x53\xb7\x62\xbf\xca\x0f\xc4\x83\x45\x7f\xd8\x00\xc4\x43\x79\x62\x3a\x0d\xc4\xe1\xbd\x5d\xd7\x66\x0f\x10\xfc\xc4\x61\x39\x76\x41\x92\x0f\xaa\xf3\x0f\x00\xad\xab\x36\x00\x00\x26\x44\x0f\x70\x92\x32\x00\x00\x00\x6e\xc4\xe1\xc9\xfa\x5f\xad", 64); syz_execute_func(/*text=*/0x20000140); break; case 11: syz_open_pts(); break; } } int main(void) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(mmap))(/*addr=*/0x20000000, /*len=*/0x1000000, /*prot=PROT_WRITE|PROT_READ*/3, /*flags=MAP_ANONYMOUS|MAP_FIXED|MAP_PRIVATE*/0x1012, /*fd=*/-1, /*offset=*/0); setup_fault(); use_temporary_dir(); do_sandbox_setuid(); return 0; } :409:3: error: call to undeclared function 'NONFAILING'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration] NONFAILING(((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(mknod))(/*file=*/0x20000240, /*mode=*/0x100, /*dev=*/2)); /* major = 0, minor = 2 */ ^ 1 error generated. compiler invocation: c++ [-o /tmp/syz-executor1178041971 -DGOOS_openbsd=1 -DGOARCH_amd64=1 -DHOSTGOOS_openbsd=1 -x c - -m64 -static -lutil -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-but-set-variable -Wno-unused-command-line-argument] --- FAIL: TestGenerate/openbsd/amd64/9 (1.29s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none SandboxArg:-9223372036854775808 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: r0 = openat$wsmuxkbd(0xffffffffffffff9c, &(0x7f0000000000), 0x20000, 0x0) (fail_nth: 1) r1 = accept$unix(r0, &(0x7f0000000040)=@file={0x0, ""/248}, &(0x7f0000000140)=0xfa) (async) r2 = getuid() (rerun: 4) getsockopt$SO_PEERCRED(r0, 0xffff, 0x1022, &(0x7f00000001c0)={0x0, 0x0, 0x0}, 0xc) chown(&(0x7f0000000180)='./file0\x00', r2, r3) bind(r1, &(0x7f0000000200)=@un=@abs={0x1, 0x0, 0x1}, 0x8) close(r0) mknod(&(0x7f0000000240)='./file0\x00', 0x100, 0x2) getsockopt$sock_timeval(r0, 0xffff, 0x1005, &(0x7f0000000280), &(0x7f00000002c0)=0x10) bind$inet6(r0, &(0x7f0000000300)={0x18, 0x3, 0x1ff, 0x5}, 0xc) syz_emit_ethernet(0x10c, &(0x7f0000000000)={@empty, @empty, [], {@generic={0x80f2, "961f1fcb2f7f4cf2d7246215711c6da70853b100bd7776418a8afef6a228178cc26bae556f82cd5b9d4399f29b1507307298cd20118e65db32c1d22941bfac3a8b1b753685ef611dcb8f7bca5aca235e21a9b3325e0b3db73ca42ff035eec10b2517988d0f7455645ae86e3da964b66fa2fc940836f41f0fbc7cbf421ebc9d05e643c8fd4b547ad8221d1aabe91ecb63589a96f6117c9fadeafa8f1e901982f6750358119e21c6d564818141905cb897612dafe7d8ee459ac6cb9f67848448abc14c59a530ae4a045561e140ba558965d6d6fd1c7d56e57fcf2e236631c090bedff1402267f1b4a1402fe280d869264459254fb631603557611281b0aabd"}}}) syz_execute_func(&(0x7f0000000140)="c463d55d8453b762bfca0fc483457fd800c44379623a0dc4e1bd5dd7660f10fcc461397641920faaf30f00adab36000026440f7092320000006ec4e1c9fa5fad") syz_extract_tcp_res(&(0x7f0000000180), 0x7, 0x8) syz_open_pts() csource_test.go:151: 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 #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 __attribute__((noinline)) remove_dir(const char* dir) { DIR* dp = opendir(dir); if (dp == NULL) { if (errno == EACCES) { if (rmdir(dir)) exit(1); return; } exit(1); } struct dirent* ep = 0; 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); while (rmdir(dir)) { exit(1); } } static int inject_fault(int nth) { return 0; } static void setup_fault() { } 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 = 0; for (; 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; } #define CAST static uintptr_t syz_open_pts(void) { int master, slave; if (openpty(&master, &slave, NULL, NULL, NULL) == -1) return -1; if (dup2(master, master + 100) != -1) close(master); return slave; } static void sandbox_common() { struct rlimit 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) { ((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 < 12; 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 (call == 1) break; event_timedwait(&th->done, 50); 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 = 0; for (;; 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 < 5000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: memcpy((void*)0x20000000, "/dev/wskbd\000", 11); inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(openat))(/*fd=*/0xffffffffffffff9c, /*file=*/0x20000000, /*flags=O_DIRECTORY*/0x20000, /*mode=*/0); if (res != -1) r[0] = res; break; case 1: *(uint32_t*)0x20000140 = 0xfa; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(accept))(/*fd=*/r[0], /*peer=*/0x20000040, /*peerlen=*/0x20000140); if (res != -1) r[1] = res; break; case 2: res = -1; res = ((intptr_t(*)())CAST(getuid))(); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)())CAST(getuid))(); } } if (res != -1) r[2] = res; break; case 3: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(getsockopt))(/*fd=*/r[0], /*level=*/0xffff, /*optname=*/0x1022, /*optval=*/0x200001c0, /*optlen=*/0xc); if (res != -1) r[3] = *(uint32_t*)0x200001c8; break; case 4: memcpy((void*)0x20000180, "./file0\000", 8); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(chown))(/*file=*/0x20000180, /*uid=*/r[2], /*gid=*/r[3]); break; case 5: *(uint16_t*)0x20000200 = 1; *(uint8_t*)0x20000202 = 0; *(uint32_t*)0x20000204 = 0x4e21; ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(bind))(/*fd=*/r[1], /*addr=*/0x20000200, /*addrlen=*/8); break; case 6: ((intptr_t(*)(intptr_t))CAST(close))(/*fd=*/r[0]); break; case 7: memcpy((void*)0x20000240, "./file0\000", 8); NONFAILING(((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(mknod))(/*file=*/0x20000240, /*mode=*/0x100, /*dev=*/2)); /* major = 0, minor = 2 */ break; case 8: *(uint32_t*)0x200002c0 = 0x10; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(getsockopt))(/*fd=*/r[0], /*level=*/0xffff, /*optname=SO_SNDTIMEO*/0x1005, /*optval=*/0x20000280, /*optlen=*/0x200002c0); break; case 9: *(uint16_t*)0x20000300 = 0x18; *(uint16_t*)0x20000302 = htobe16(0x4e23); *(uint32_t*)0x20000304 = 0x1ff; *(uint32_t*)0x20000308 = 5; ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(bind))(/*fd=*/r[0], /*addr=*/0x20000300, /*addrlen=*/0xc); break; case 10: memcpy((void*)0x20000140, "\xc4\x63\xd5\x5d\x84\x53\xb7\x62\xbf\xca\x0f\xc4\x83\x45\x7f\xd8\x00\xc4\x43\x79\x62\x3a\x0d\xc4\xe1\xbd\x5d\xd7\x66\x0f\x10\xfc\xc4\x61\x39\x76\x41\x92\x0f\xaa\xf3\x0f\x00\xad\xab\x36\x00\x00\x26\x44\x0f\x70\x92\x32\x00\x00\x00\x6e\xc4\xe1\xc9\xfa\x5f\xad", 64); syz_execute_func(/*text=*/0x20000140); break; case 11: syz_open_pts(); break; } } int main(void) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(mmap))(/*addr=*/0x20000000, /*len=*/0x1000000, /*prot=PROT_WRITE|PROT_READ*/3, /*flags=MAP_ANONYMOUS|MAP_FIXED|MAP_PRIVATE*/0x1012, /*fd=*/-1, /*offset=*/0); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :386:3: error: call to undeclared function 'NONFAILING'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration] NONFAILING(((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(mknod))(/*file=*/0x20000240, /*mode=*/0x100, /*dev=*/2)); /* major = 0, minor = 2 */ ^ 1 error generated. compiler invocation: c++ [-o /tmp/syz-executor3248343646 -DGOOS_openbsd=1 -DGOARCH_amd64=1 -DHOSTGOOS_openbsd=1 -x c - -m64 -static -lutil -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-but-set-variable -Wno-unused-command-line-argument] --- FAIL: TestGenerate/openbsd/amd64/15 (1.50s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:true LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: r0 = openat$wsmuxkbd(0xffffffffffffff9c, &(0x7f0000000000), 0x20000, 0x0) (fail_nth: 1) r1 = accept$unix(r0, &(0x7f0000000040)=@file={0x0, ""/248}, &(0x7f0000000140)=0xfa) (async) r2 = getuid() (rerun: 4) getsockopt$SO_PEERCRED(r0, 0xffff, 0x1022, &(0x7f00000001c0)={0x0, 0x0, 0x0}, 0xc) chown(&(0x7f0000000180)='./file0\x00', r2, r3) bind(r1, &(0x7f0000000200)=@un=@abs={0x1, 0x0, 0x1}, 0x8) close(r0) mknod(&(0x7f0000000240)='./file0\x00', 0x100, 0x2) getsockopt$sock_timeval(r0, 0xffff, 0x1005, &(0x7f0000000280), &(0x7f00000002c0)=0x10) bind$inet6(r0, &(0x7f0000000300)={0x18, 0x3, 0x1ff, 0x5}, 0xc) syz_emit_ethernet(0x10c, &(0x7f0000000000)={@empty, @empty, [], {@generic={0x80f2, "961f1fcb2f7f4cf2d7246215711c6da70853b100bd7776418a8afef6a228178cc26bae556f82cd5b9d4399f29b1507307298cd20118e65db32c1d22941bfac3a8b1b753685ef611dcb8f7bca5aca235e21a9b3325e0b3db73ca42ff035eec10b2517988d0f7455645ae86e3da964b66fa2fc940836f41f0fbc7cbf421ebc9d05e643c8fd4b547ad8221d1aabe91ecb63589a96f6117c9fadeafa8f1e901982f6750358119e21c6d564818141905cb897612dafe7d8ee459ac6cb9f67848448abc14c59a530ae4a045561e140ba558965d6d6fd1c7d56e57fcf2e236631c090bedff1402267f1b4a1402fe280d869264459254fb631603557611281b0aabd"}}}) syz_execute_func(&(0x7f0000000140)="c463d55d8453b762bfca0fc483457fd800c44379623a0dc4e1bd5dd7660f10fcc461397641920faaf30f00adab36000026440f7092320000006ec4e1c9fa5fad") syz_extract_tcp_res(&(0x7f0000000180), 0x7, 0x8) syz_open_pts() csource_test.go:151: 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 #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 __attribute__((noinline)) remove_dir(const char* dir) { DIR* dp = opendir(dir); if (dp == NULL) { if (errno == EACCES) { if (rmdir(dir)) exit(1); return; } exit(1); } struct dirent* ep = 0; 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); while (rmdir(dir)) { exit(1); } } static int inject_fault(int nth) { return 0; } static void setup_fault() { } 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 = 0; for (; 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; } #define CAST static uintptr_t syz_open_pts(void) { int master, slave; if (openpty(&master, &slave, NULL, NULL, NULL) == -1) return -1; if (dup2(master, master + 100) != -1) close(master); return slave; } static void sandbox_common() { struct rlimit 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) { ((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 < 12; 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 (call == 1) break; event_timedwait(&th->done, 50); 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 = 0; for (;; 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 < 5000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: memcpy((void*)0x20000000, "/dev/wskbd\000", 11); inject_fault(1); res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(openat))(/*fd=*/0xffffffffffffff9c, /*file=*/0x20000000, /*flags=O_DIRECTORY*/0x20000, /*mode=*/0); fprintf(stderr, "### call=0 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); if (res != -1) r[0] = res; break; case 1: *(uint32_t*)0x20000140 = 0xfa; res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(accept))(/*fd=*/r[0], /*peer=*/0x20000040, /*peerlen=*/0x20000140); fprintf(stderr, "### call=1 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); if (res != -1) r[1] = res; break; case 2: res = -1; errno = EFAULT; res = ((intptr_t(*)())CAST(getuid))(); fprintf(stderr, "### call=2 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)())CAST(getuid))(); } } if (res != -1) r[2] = res; break; case 3: res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(getsockopt))(/*fd=*/r[0], /*level=*/0xffff, /*optname=*/0x1022, /*optval=*/0x200001c0, /*optlen=*/0xc); fprintf(stderr, "### call=3 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); if (res != -1) r[3] = *(uint32_t*)0x200001c8; break; case 4: memcpy((void*)0x20000180, "./file0\000", 8); res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(chown))(/*file=*/0x20000180, /*uid=*/r[2], /*gid=*/r[3]); fprintf(stderr, "### call=4 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); break; case 5: *(uint16_t*)0x20000200 = 1; *(uint8_t*)0x20000202 = 0; *(uint32_t*)0x20000204 = 0x4e21; res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(bind))(/*fd=*/r[1], /*addr=*/0x20000200, /*addrlen=*/8); fprintf(stderr, "### call=5 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); break; case 6: res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t))CAST(close))(/*fd=*/r[0]); fprintf(stderr, "### call=6 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); break; case 7: memcpy((void*)0x20000240, "./file0\000", 8); res = -1; errno = EFAULT; NONFAILING(res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(mknod))(/*file=*/0x20000240, /*mode=*/0x100, /*dev=*/2)); /* major = 0, minor = 2 */ fprintf(stderr, "### call=7 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); break; case 8: *(uint32_t*)0x200002c0 = 0x10; res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(getsockopt))(/*fd=*/r[0], /*level=*/0xffff, /*optname=SO_SNDTIMEO*/0x1005, /*optval=*/0x20000280, /*optlen=*/0x200002c0); fprintf(stderr, "### call=8 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); break; case 9: *(uint16_t*)0x20000300 = 0x18; *(uint16_t*)0x20000302 = htobe16(0x4e23); *(uint32_t*)0x20000304 = 0x1ff; *(uint32_t*)0x20000308 = 5; res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(bind))(/*fd=*/r[0], /*addr=*/0x20000300, /*addrlen=*/0xc); fprintf(stderr, "### call=9 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); break; case 10: memcpy((void*)0x20000140, "\xc4\x63\xd5\x5d\x84\x53\xb7\x62\xbf\xca\x0f\xc4\x83\x45\x7f\xd8\x00\xc4\x43\x79\x62\x3a\x0d\xc4\xe1\xbd\x5d\xd7\x66\x0f\x10\xfc\xc4\x61\x39\x76\x41\x92\x0f\xaa\xf3\x0f\x00\xad\xab\x36\x00\x00\x26\x44\x0f\x70\x92\x32\x00\x00\x00\x6e\xc4\xe1\xc9\xfa\x5f\xad", 64); res = -1; errno = EFAULT; res = syz_execute_func(/*text=*/0x20000140); fprintf(stderr, "### call=10 errno=%u\n", res == -1 ? errno : 0); break; case 11: res = -1; errno = EFAULT; res = syz_open_pts(); fprintf(stderr, "### call=11 errno=%u\n", res == -1 ? errno : 0); break; } } int main(void) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(mmap))(/*addr=*/0x20000000, /*len=*/0x1000000, /*prot=PROT_WRITE|PROT_READ*/3, /*flags=MAP_ANONYMOUS|MAP_FIXED|MAP_PRIVATE*/0x1012, /*fd=*/-1, /*offset=*/0); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :406:3: error: call to undeclared function 'NONFAILING'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration] NONFAILING(res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(mknod))(/*file=*/0x20000240, /*mode=*/0x100, /*dev=*/2)); /* major = 0, minor = 2 */ ^ 1 error generated. compiler invocation: c++ [-o /tmp/syz-executor3183701209 -DGOOS_openbsd=1 -DGOARCH_amd64=1 -DHOSTGOOS_openbsd=1 -x c - -m64 -static -lutil -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-but-set-variable -Wno-unused-command-line-argument] --- FAIL: TestGenerate/openbsd/amd64/2 (1.78s) csource_test.go:150: opts: {Threaded:true Repeat:false RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: r0 = openat$wsmuxkbd(0xffffffffffffff9c, &(0x7f0000000000), 0x20000, 0x0) (fail_nth: 1) r1 = accept$unix(r0, &(0x7f0000000040)=@file={0x0, ""/248}, &(0x7f0000000140)=0xfa) (async) r2 = getuid() (rerun: 4) getsockopt$SO_PEERCRED(r0, 0xffff, 0x1022, &(0x7f00000001c0)={0x0, 0x0, 0x0}, 0xc) chown(&(0x7f0000000180)='./file0\x00', r2, r3) bind(r1, &(0x7f0000000200)=@un=@abs={0x1, 0x0, 0x1}, 0x8) close(r0) mknod(&(0x7f0000000240)='./file0\x00', 0x100, 0x2) getsockopt$sock_timeval(r0, 0xffff, 0x1005, &(0x7f0000000280), &(0x7f00000002c0)=0x10) bind$inet6(r0, &(0x7f0000000300)={0x18, 0x3, 0x1ff, 0x5}, 0xc) syz_emit_ethernet(0x10c, &(0x7f0000000000)={@empty, @empty, [], {@generic={0x80f2, "961f1fcb2f7f4cf2d7246215711c6da70853b100bd7776418a8afef6a228178cc26bae556f82cd5b9d4399f29b1507307298cd20118e65db32c1d22941bfac3a8b1b753685ef611dcb8f7bca5aca235e21a9b3325e0b3db73ca42ff035eec10b2517988d0f7455645ae86e3da964b66fa2fc940836f41f0fbc7cbf421ebc9d05e643c8fd4b547ad8221d1aabe91ecb63589a96f6117c9fadeafa8f1e901982f6750358119e21c6d564818141905cb897612dafe7d8ee459ac6cb9f67848448abc14c59a530ae4a045561e140ba558965d6d6fd1c7d56e57fcf2e236631c090bedff1402267f1b4a1402fe280d869264459254fb631603557611281b0aabd"}}}) syz_execute_func(&(0x7f0000000140)="c463d55d8453b762bfca0fc483457fd800c44379623a0dc4e1bd5dd7660f10fcc461397641920faaf30f00adab36000026440f7092320000006ec4e1c9fa5fad") syz_extract_tcp_res(&(0x7f0000000180), 0x7, 0x8) syz_open_pts() csource_test.go:151: 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 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 int inject_fault(int nth) { return 0; } static void setup_fault() { } 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 = 0; for (; 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; } #define CAST static uintptr_t syz_open_pts(void) { int master, slave; if (openpty(&master, &slave, NULL, NULL, NULL) == -1) return -1; if (dup2(master, master + 100) != -1) close(master); return slave; } static void sandbox_common() { struct rlimit 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) { ((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 loop(void) { int i, call, thread; for (call = 0; call < 12; 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 (call == 1) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: memcpy((void*)0x20000000, "/dev/wskbd\000", 11); inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(openat))(/*fd=*/0xffffffffffffff9c, /*file=*/0x20000000, /*flags=O_DIRECTORY*/0x20000, /*mode=*/0); if (res != -1) r[0] = res; break; case 1: *(uint32_t*)0x20000140 = 0xfa; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(accept))(/*fd=*/r[0], /*peer=*/0x20000040, /*peerlen=*/0x20000140); if (res != -1) r[1] = res; break; case 2: res = -1; res = ((intptr_t(*)())CAST(getuid))(); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)())CAST(getuid))(); } } if (res != -1) r[2] = res; break; case 3: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(getsockopt))(/*fd=*/r[0], /*level=*/0xffff, /*optname=*/0x1022, /*optval=*/0x200001c0, /*optlen=*/0xc); if (res != -1) r[3] = *(uint32_t*)0x200001c8; break; case 4: memcpy((void*)0x20000180, "./file0\000", 8); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(chown))(/*file=*/0x20000180, /*uid=*/r[2], /*gid=*/r[3]); break; case 5: *(uint16_t*)0x20000200 = 1; *(uint8_t*)0x20000202 = 0; *(uint32_t*)0x20000204 = 0x4e21; ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(bind))(/*fd=*/r[1], /*addr=*/0x20000200, /*addrlen=*/8); break; case 6: ((intptr_t(*)(intptr_t))CAST(close))(/*fd=*/r[0]); break; case 7: memcpy((void*)0x20000240, "./file0\000", 8); NONFAILING(((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(mknod))(/*file=*/0x20000240, /*mode=*/0x100, /*dev=*/2)); /* major = 0, minor = 2 */ break; case 8: *(uint32_t*)0x200002c0 = 0x10; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(getsockopt))(/*fd=*/r[0], /*level=*/0xffff, /*optname=SO_SNDTIMEO*/0x1005, /*optval=*/0x20000280, /*optlen=*/0x200002c0); break; case 9: *(uint16_t*)0x20000300 = 0x18; *(uint16_t*)0x20000302 = htobe16(0x4e23); *(uint32_t*)0x20000304 = 0x1ff; *(uint32_t*)0x20000308 = 5; ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(bind))(/*fd=*/r[0], /*addr=*/0x20000300, /*addrlen=*/0xc); break; case 10: memcpy((void*)0x20000140, "\xc4\x63\xd5\x5d\x84\x53\xb7\x62\xbf\xca\x0f\xc4\x83\x45\x7f\xd8\x00\xc4\x43\x79\x62\x3a\x0d\xc4\xe1\xbd\x5d\xd7\x66\x0f\x10\xfc\xc4\x61\x39\x76\x41\x92\x0f\xaa\xf3\x0f\x00\xad\xab\x36\x00\x00\x26\x44\x0f\x70\x92\x32\x00\x00\x00\x6e\xc4\xe1\xc9\xfa\x5f\xad", 64); syz_execute_func(/*text=*/0x20000140); break; case 11: syz_open_pts(); break; } } int main(void) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(mmap))(/*addr=*/0x20000000, /*len=*/0x1000000, /*prot=PROT_WRITE|PROT_READ*/3, /*flags=MAP_ANONYMOUS|MAP_FIXED|MAP_PRIVATE*/0x1012, /*fd=*/-1, /*offset=*/0); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :306:3: error: call to undeclared function 'NONFAILING'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration] NONFAILING(((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(mknod))(/*file=*/0x20000240, /*mode=*/0x100, /*dev=*/2)); /* major = 0, minor = 2 */ ^ 1 error generated. compiler invocation: c++ [-o /tmp/syz-executor3938502893 -DGOOS_openbsd=1 -DGOARCH_amd64=1 -DHOSTGOOS_openbsd=1 -x c - -m64 -static -lutil -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-but-set-variable -Wno-unused-command-line-argument] --- FAIL: TestGenerate/openbsd/amd64/14 (1.97s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:true Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: r0 = openat$wsmuxkbd(0xffffffffffffff9c, &(0x7f0000000000), 0x20000, 0x0) (fail_nth: 1) r1 = accept$unix(r0, &(0x7f0000000040)=@file={0x0, ""/248}, &(0x7f0000000140)=0xfa) (async) r2 = getuid() (rerun: 4) getsockopt$SO_PEERCRED(r0, 0xffff, 0x1022, &(0x7f00000001c0)={0x0, 0x0, 0x0}, 0xc) chown(&(0x7f0000000180)='./file0\x00', r2, r3) bind(r1, &(0x7f0000000200)=@un=@abs={0x1, 0x0, 0x1}, 0x8) close(r0) mknod(&(0x7f0000000240)='./file0\x00', 0x100, 0x2) getsockopt$sock_timeval(r0, 0xffff, 0x1005, &(0x7f0000000280), &(0x7f00000002c0)=0x10) bind$inet6(r0, &(0x7f0000000300)={0x18, 0x3, 0x1ff, 0x5}, 0xc) syz_emit_ethernet(0x10c, &(0x7f0000000000)={@empty, @empty, [], {@generic={0x80f2, "961f1fcb2f7f4cf2d7246215711c6da70853b100bd7776418a8afef6a228178cc26bae556f82cd5b9d4399f29b1507307298cd20118e65db32c1d22941bfac3a8b1b753685ef611dcb8f7bca5aca235e21a9b3325e0b3db73ca42ff035eec10b2517988d0f7455645ae86e3da964b66fa2fc940836f41f0fbc7cbf421ebc9d05e643c8fd4b547ad8221d1aabe91ecb63589a96f6117c9fadeafa8f1e901982f6750358119e21c6d564818141905cb897612dafe7d8ee459ac6cb9f67848448abc14c59a530ae4a045561e140ba558965d6d6fd1c7d56e57fcf2e236631c090bedff1402267f1b4a1402fe280d869264459254fb631603557611281b0aabd"}}}) syz_execute_func(&(0x7f0000000140)="c463d55d8453b762bfca0fc483457fd800c44379623a0dc4e1bd5dd7660f10fcc461397641920faaf30f00adab36000026440f7092320000006ec4e1c9fa5fad") syz_extract_tcp_res(&(0x7f0000000180), 0x7, 0x8) syz_open_pts() csource_test.go:151: 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 #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 __attribute__((noinline)) remove_dir(const char* dir) { DIR* dp = opendir(dir); if (dp == NULL) { if (errno == EACCES) { if (rmdir(dir)) exit(1); return; } exit(1); } struct dirent* ep = 0; 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); while (rmdir(dir)) { exit(1); } } static int inject_fault(int nth) { return 0; } static void setup_fault() { } 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 = 0; for (; 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; } #define CAST static uintptr_t syz_open_pts(void) { int master, slave; if (openpty(&master, &slave, NULL, NULL, NULL) == -1) return -1; if (dup2(master, master + 100) != -1) close(master); return slave; } static void sandbox_common() { struct rlimit 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) { ((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 < 12; 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 (call == 1) break; event_timedwait(&th->done, 50); 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 = 0; for (;; 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 < 5000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: memcpy((void*)0x20000000, "/dev/wskbd\000", 11); inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(openat))(/*fd=*/0xffffffffffffff9c, /*file=*/0x20000000, /*flags=O_DIRECTORY*/0x20000, /*mode=*/0); if (res != -1) r[0] = res; break; case 1: *(uint32_t*)0x20000140 = 0xfa; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(accept))(/*fd=*/r[0], /*peer=*/0x20000040, /*peerlen=*/0x20000140); if (res != -1) r[1] = res; break; case 2: res = -1; res = ((intptr_t(*)())CAST(getuid))(); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)())CAST(getuid))(); } } if (res != -1) r[2] = res; break; case 3: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(getsockopt))(/*fd=*/r[0], /*level=*/0xffff, /*optname=*/0x1022, /*optval=*/0x200001c0, /*optlen=*/0xc); if (res != -1) r[3] = *(uint32_t*)0x200001c8; break; case 4: memcpy((void*)0x20000180, "./file0\000", 8); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(chown))(/*file=*/0x20000180, /*uid=*/r[2], /*gid=*/r[3]); break; case 5: *(uint16_t*)0x20000200 = 1; *(uint8_t*)0x20000202 = 0; *(uint32_t*)0x20000204 = 0x4e21; ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(bind))(/*fd=*/r[1], /*addr=*/0x20000200, /*addrlen=*/8); break; case 6: ((intptr_t(*)(intptr_t))CAST(close))(/*fd=*/r[0]); break; case 7: memcpy((void*)0x20000240, "./file0\000", 8); NONFAILING(((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(mknod))(/*file=*/0x20000240, /*mode=*/0x100, /*dev=*/2)); /* major = 0, minor = 2 */ break; case 8: *(uint32_t*)0x200002c0 = 0x10; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(getsockopt))(/*fd=*/r[0], /*level=*/0xffff, /*optname=SO_SNDTIMEO*/0x1005, /*optval=*/0x20000280, /*optlen=*/0x200002c0); break; case 9: *(uint16_t*)0x20000300 = 0x18; *(uint16_t*)0x20000302 = htobe16(0x4e23); *(uint32_t*)0x20000304 = 0x1ff; *(uint32_t*)0x20000308 = 5; ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(bind))(/*fd=*/r[0], /*addr=*/0x20000300, /*addrlen=*/0xc); break; case 10: memcpy((void*)0x20000140, "\xc4\x63\xd5\x5d\x84\x53\xb7\x62\xbf\xca\x0f\xc4\x83\x45\x7f\xd8\x00\xc4\x43\x79\x62\x3a\x0d\xc4\xe1\xbd\x5d\xd7\x66\x0f\x10\xfc\xc4\x61\x39\x76\x41\x92\x0f\xaa\xf3\x0f\x00\xad\xab\x36\x00\x00\x26\x44\x0f\x70\x92\x32\x00\x00\x00\x6e\xc4\xe1\xc9\xfa\x5f\xad", 64); syz_execute_func(/*text=*/0x20000140); break; case 11: syz_open_pts(); break; } } int main(void) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(mmap))(/*addr=*/0x20000000, /*len=*/0x1000000, /*prot=PROT_WRITE|PROT_READ*/3, /*flags=MAP_ANONYMOUS|MAP_FIXED|MAP_PRIVATE*/0x1012, /*fd=*/-1, /*offset=*/0); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :388:3: error: call to undeclared function 'NONFAILING'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration] NONFAILING(((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(mknod))(/*file=*/0x20000240, /*mode=*/0x100, /*dev=*/2)); /* major = 0, minor = 2 */ ^ 1 error generated. compiler invocation: c++ [-o /tmp/syz-executor139676557 -DGOOS_openbsd=1 -DGOARCH_amd64=1 -DHOSTGOOS_openbsd=1 -x c - -m64 -static -lutil -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-but-set-variable -Wno-unused-command-line-argument] --- FAIL: TestGenerate/openbsd/amd64/16 (2.39s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:2 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:true Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: r0 = openat$wsmuxkbd(0xffffffffffffff9c, &(0x7f0000000000), 0x20000, 0x0) (fail_nth: 1) r1 = accept$unix(r0, &(0x7f0000000040)=@file={0x0, ""/248}, &(0x7f0000000140)=0xfa) (async) r2 = getuid() (rerun: 4) getsockopt$SO_PEERCRED(r0, 0xffff, 0x1022, &(0x7f00000001c0)={0x0, 0x0, 0x0}, 0xc) chown(&(0x7f0000000180)='./file0\x00', r2, r3) bind(r1, &(0x7f0000000200)=@un=@abs={0x1, 0x0, 0x1}, 0x8) close(r0) mknod(&(0x7f0000000240)='./file0\x00', 0x100, 0x2) getsockopt$sock_timeval(r0, 0xffff, 0x1005, &(0x7f0000000280), &(0x7f00000002c0)=0x10) bind$inet6(r0, &(0x7f0000000300)={0x18, 0x3, 0x1ff, 0x5}, 0xc) syz_emit_ethernet(0x10c, &(0x7f0000000000)={@empty, @empty, [], {@generic={0x80f2, "961f1fcb2f7f4cf2d7246215711c6da70853b100bd7776418a8afef6a228178cc26bae556f82cd5b9d4399f29b1507307298cd20118e65db32c1d22941bfac3a8b1b753685ef611dcb8f7bca5aca235e21a9b3325e0b3db73ca42ff035eec10b2517988d0f7455645ae86e3da964b66fa2fc940836f41f0fbc7cbf421ebc9d05e643c8fd4b547ad8221d1aabe91ecb63589a96f6117c9fadeafa8f1e901982f6750358119e21c6d564818141905cb897612dafe7d8ee459ac6cb9f67848448abc14c59a530ae4a045561e140ba558965d6d6fd1c7d56e57fcf2e236631c090bedff1402267f1b4a1402fe280d869264459254fb631603557611281b0aabd"}}}) syz_execute_func(&(0x7f0000000140)="c463d55d8453b762bfca0fc483457fd800c44379623a0dc4e1bd5dd7660f10fcc461397641920faaf30f00adab36000026440f7092320000006ec4e1c9fa5fad") syz_extract_tcp_res(&(0x7f0000000180), 0x7, 0x8) syz_open_pts() csource_test.go:151: 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 #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 __attribute__((noinline)) remove_dir(const char* dir) { DIR* dp = opendir(dir); if (dp == NULL) { if (errno == EACCES) { if (rmdir(dir)) exit(1); return; } exit(1); } struct dirent* ep = 0; 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); while (rmdir(dir)) { exit(1); } } static int inject_fault(int nth) { return 0; } static void setup_fault() { } 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 = 0; for (; 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; } #define CAST static uintptr_t syz_open_pts(void) { int master, slave; if (openpty(&master, &slave, NULL, NULL, NULL) == -1) return -1; if (dup2(master, master + 100) != -1) close(master); return slave; } static void sandbox_common() { struct rlimit 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) { ((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 < 12; 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 (call == 1) break; event_timedwait(&th->done, 50); 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 = 0; for (;; 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 < 5000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: memcpy((void*)0x20000000, "/dev/wskbd\000", 11); inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(openat))(/*fd=*/0xffffffffffffff9c, /*file=*/0x20000000, /*flags=O_DIRECTORY*/0x20000, /*mode=*/0); if (res != -1) r[0] = res; break; case 1: *(uint32_t*)0x20000140 = 0xfa; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(accept))(/*fd=*/r[0], /*peer=*/0x20000040, /*peerlen=*/0x20000140); if (res != -1) r[1] = res; break; case 2: res = -1; res = ((intptr_t(*)())CAST(getuid))(); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)())CAST(getuid))(); } } if (res != -1) r[2] = res; break; case 3: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(getsockopt))(/*fd=*/r[0], /*level=*/0xffff, /*optname=*/0x1022, /*optval=*/0x200001c0, /*optlen=*/0xc); if (res != -1) r[3] = *(uint32_t*)0x200001c8; break; case 4: memcpy((void*)0x20000180, "./file0\000", 8); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(chown))(/*file=*/0x20000180, /*uid=*/r[2], /*gid=*/r[3]); break; case 5: *(uint16_t*)0x20000200 = 1; *(uint8_t*)0x20000202 = 0; *(uint32_t*)0x20000204 = 0x4e21 + procid*4; ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(bind))(/*fd=*/r[1], /*addr=*/0x20000200, /*addrlen=*/8); break; case 6: ((intptr_t(*)(intptr_t))CAST(close))(/*fd=*/r[0]); break; case 7: memcpy((void*)0x20000240, "./file0\000", 8); NONFAILING(((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(mknod))(/*file=*/0x20000240, /*mode=*/0x100, /*dev=*/2)); /* major = 0, minor = 2 */ break; case 8: *(uint32_t*)0x200002c0 = 0x10; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(getsockopt))(/*fd=*/r[0], /*level=*/0xffff, /*optname=SO_SNDTIMEO*/0x1005, /*optval=*/0x20000280, /*optlen=*/0x200002c0); break; case 9: *(uint16_t*)0x20000300 = 0x18; *(uint16_t*)0x20000302 = htobe16(0x4e23 + procid*4); *(uint32_t*)0x20000304 = 0x1ff; *(uint32_t*)0x20000308 = 5; ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(bind))(/*fd=*/r[0], /*addr=*/0x20000300, /*addrlen=*/0xc); break; case 10: memcpy((void*)0x20000140, "\xc4\x63\xd5\x5d\x84\x53\xb7\x62\xbf\xca\x0f\xc4\x83\x45\x7f\xd8\x00\xc4\x43\x79\x62\x3a\x0d\xc4\xe1\xbd\x5d\xd7\x66\x0f\x10\xfc\xc4\x61\x39\x76\x41\x92\x0f\xaa\xf3\x0f\x00\xad\xab\x36\x00\x00\x26\x44\x0f\x70\x92\x32\x00\x00\x00\x6e\xc4\xe1\xc9\xfa\x5f\xad", 64); syz_execute_func(/*text=*/0x20000140); break; case 11: syz_open_pts(); break; } } int main(void) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(mmap))(/*addr=*/0x20000000, /*len=*/0x1000000, /*prot=PROT_WRITE|PROT_READ*/3, /*flags=MAP_ANONYMOUS|MAP_FIXED|MAP_PRIVATE*/0x1012, /*fd=*/-1, /*offset=*/0); setup_fault(); for (procid = 0; procid < 2; procid++) { if (fork() == 0) { use_temporary_dir(); do_sandbox_none(); } } sleep(1000000); return 0; } :390:3: error: call to undeclared function 'NONFAILING'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration] NONFAILING(((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(mknod))(/*file=*/0x20000240, /*mode=*/0x100, /*dev=*/2)); /* major = 0, minor = 2 */ ^ 1 error generated. compiler invocation: c++ [-o /tmp/syz-executor1072873841 -DGOOS_openbsd=1 -DGOARCH_amd64=1 -DHOSTGOOS_openbsd=1 -x c - -m64 -static -lutil -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-but-set-variable -Wno-unused-command-line-argument] --- FAIL: TestGenerate/openbsd/amd64/10 (4.18s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none SandboxArg:9223372036854775807 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: r0 = openat$wsmuxkbd(0xffffffffffffff9c, &(0x7f0000000000), 0x20000, 0x0) (fail_nth: 1) r1 = accept$unix(r0, &(0x7f0000000040)=@file={0x0, ""/248}, &(0x7f0000000140)=0xfa) (async) r2 = getuid() (rerun: 4) getsockopt$SO_PEERCRED(r0, 0xffff, 0x1022, &(0x7f00000001c0)={0x0, 0x0, 0x0}, 0xc) chown(&(0x7f0000000180)='./file0\x00', r2, r3) bind(r1, &(0x7f0000000200)=@un=@abs={0x1, 0x0, 0x1}, 0x8) close(r0) mknod(&(0x7f0000000240)='./file0\x00', 0x100, 0x2) getsockopt$sock_timeval(r0, 0xffff, 0x1005, &(0x7f0000000280), &(0x7f00000002c0)=0x10) bind$inet6(r0, &(0x7f0000000300)={0x18, 0x3, 0x1ff, 0x5}, 0xc) syz_emit_ethernet(0x10c, &(0x7f0000000000)={@empty, @empty, [], {@generic={0x80f2, "961f1fcb2f7f4cf2d7246215711c6da70853b100bd7776418a8afef6a228178cc26bae556f82cd5b9d4399f29b1507307298cd20118e65db32c1d22941bfac3a8b1b753685ef611dcb8f7bca5aca235e21a9b3325e0b3db73ca42ff035eec10b2517988d0f7455645ae86e3da964b66fa2fc940836f41f0fbc7cbf421ebc9d05e643c8fd4b547ad8221d1aabe91ecb63589a96f6117c9fadeafa8f1e901982f6750358119e21c6d564818141905cb897612dafe7d8ee459ac6cb9f67848448abc14c59a530ae4a045561e140ba558965d6d6fd1c7d56e57fcf2e236631c090bedff1402267f1b4a1402fe280d869264459254fb631603557611281b0aabd"}}}) syz_execute_func(&(0x7f0000000140)="c463d55d8453b762bfca0fc483457fd800c44379623a0dc4e1bd5dd7660f10fcc461397641920faaf30f00adab36000026440f7092320000006ec4e1c9fa5fad") syz_extract_tcp_res(&(0x7f0000000180), 0x7, 0x8) syz_open_pts() csource_test.go:151: 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 #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 __attribute__((noinline)) remove_dir(const char* dir) { DIR* dp = opendir(dir); if (dp == NULL) { if (errno == EACCES) { if (rmdir(dir)) exit(1); return; } exit(1); } struct dirent* ep = 0; 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); while (rmdir(dir)) { exit(1); } } static int inject_fault(int nth) { return 0; } static void setup_fault() { } 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 = 0; for (; 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; } #define CAST static uintptr_t syz_open_pts(void) { int master, slave; if (openpty(&master, &slave, NULL, NULL, NULL) == -1) return -1; if (dup2(master, master + 100) != -1) close(master); return slave; } static void sandbox_common() { struct rlimit 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) { ((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 < 12; 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 (call == 1) break; event_timedwait(&th->done, 50); 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 = 0; for (;; 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 < 5000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: memcpy((void*)0x20000000, "/dev/wskbd\000", 11); inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(openat))(/*fd=*/0xffffffffffffff9c, /*file=*/0x20000000, /*flags=O_DIRECTORY*/0x20000, /*mode=*/0); if (res != -1) r[0] = res; break; case 1: *(uint32_t*)0x20000140 = 0xfa; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(accept))(/*fd=*/r[0], /*peer=*/0x20000040, /*peerlen=*/0x20000140); if (res != -1) r[1] = res; break; case 2: res = -1; res = ((intptr_t(*)())CAST(getuid))(); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)())CAST(getuid))(); } } if (res != -1) r[2] = res; break; case 3: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(getsockopt))(/*fd=*/r[0], /*level=*/0xffff, /*optname=*/0x1022, /*optval=*/0x200001c0, /*optlen=*/0xc); if (res != -1) r[3] = *(uint32_t*)0x200001c8; break; case 4: memcpy((void*)0x20000180, "./file0\000", 8); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(chown))(/*file=*/0x20000180, /*uid=*/r[2], /*gid=*/r[3]); break; case 5: *(uint16_t*)0x20000200 = 1; *(uint8_t*)0x20000202 = 0; *(uint32_t*)0x20000204 = 0x4e21; ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(bind))(/*fd=*/r[1], /*addr=*/0x20000200, /*addrlen=*/8); break; case 6: ((intptr_t(*)(intptr_t))CAST(close))(/*fd=*/r[0]); break; case 7: memcpy((void*)0x20000240, "./file0\000", 8); NONFAILING(((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(mknod))(/*file=*/0x20000240, /*mode=*/0x100, /*dev=*/2)); /* major = 0, minor = 2 */ break; case 8: *(uint32_t*)0x200002c0 = 0x10; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(getsockopt))(/*fd=*/r[0], /*level=*/0xffff, /*optname=SO_SNDTIMEO*/0x1005, /*optval=*/0x20000280, /*optlen=*/0x200002c0); break; case 9: *(uint16_t*)0x20000300 = 0x18; *(uint16_t*)0x20000302 = htobe16(0x4e23); *(uint32_t*)0x20000304 = 0x1ff; *(uint32_t*)0x20000308 = 5; ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(bind))(/*fd=*/r[0], /*addr=*/0x20000300, /*addrlen=*/0xc); break; case 10: memcpy((void*)0x20000140, "\xc4\x63\xd5\x5d\x84\x53\xb7\x62\xbf\xca\x0f\xc4\x83\x45\x7f\xd8\x00\xc4\x43\x79\x62\x3a\x0d\xc4\xe1\xbd\x5d\xd7\x66\x0f\x10\xfc\xc4\x61\x39\x76\x41\x92\x0f\xaa\xf3\x0f\x00\xad\xab\x36\x00\x00\x26\x44\x0f\x70\x92\x32\x00\x00\x00\x6e\xc4\xe1\xc9\xfa\x5f\xad", 64); syz_execute_func(/*text=*/0x20000140); break; case 11: syz_open_pts(); break; } } int main(void) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(mmap))(/*addr=*/0x20000000, /*len=*/0x1000000, /*prot=PROT_WRITE|PROT_READ*/3, /*flags=MAP_ANONYMOUS|MAP_FIXED|MAP_PRIVATE*/0x1012, /*fd=*/-1, /*offset=*/0); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :386:3: error: call to undeclared function 'NONFAILING'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration] NONFAILING(((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(mknod))(/*file=*/0x20000240, /*mode=*/0x100, /*dev=*/2)); /* major = 0, minor = 2 */ ^ 1 error generated. compiler invocation: c++ [-o /tmp/syz-executor3194554395 -DGOOS_openbsd=1 -DGOARCH_amd64=1 -DHOSTGOOS_openbsd=1 -x c - -m64 -static -lutil -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-but-set-variable -Wno-unused-command-line-argument] --- FAIL: TestGenerate/openbsd/amd64/5 (4.28s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:4 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: r0 = openat$wsmuxkbd(0xffffffffffffff9c, &(0x7f0000000000), 0x20000, 0x0) (fail_nth: 1) r1 = accept$unix(r0, &(0x7f0000000040)=@file={0x0, ""/248}, &(0x7f0000000140)=0xfa) (async) r2 = getuid() (rerun: 4) getsockopt$SO_PEERCRED(r0, 0xffff, 0x1022, &(0x7f00000001c0)={0x0, 0x0, 0x0}, 0xc) chown(&(0x7f0000000180)='./file0\x00', r2, r3) bind(r1, &(0x7f0000000200)=@un=@abs={0x1, 0x0, 0x1}, 0x8) close(r0) mknod(&(0x7f0000000240)='./file0\x00', 0x100, 0x2) getsockopt$sock_timeval(r0, 0xffff, 0x1005, &(0x7f0000000280), &(0x7f00000002c0)=0x10) bind$inet6(r0, &(0x7f0000000300)={0x18, 0x3, 0x1ff, 0x5}, 0xc) syz_emit_ethernet(0x10c, &(0x7f0000000000)={@empty, @empty, [], {@generic={0x80f2, "961f1fcb2f7f4cf2d7246215711c6da70853b100bd7776418a8afef6a228178cc26bae556f82cd5b9d4399f29b1507307298cd20118e65db32c1d22941bfac3a8b1b753685ef611dcb8f7bca5aca235e21a9b3325e0b3db73ca42ff035eec10b2517988d0f7455645ae86e3da964b66fa2fc940836f41f0fbc7cbf421ebc9d05e643c8fd4b547ad8221d1aabe91ecb63589a96f6117c9fadeafa8f1e901982f6750358119e21c6d564818141905cb897612dafe7d8ee459ac6cb9f67848448abc14c59a530ae4a045561e140ba558965d6d6fd1c7d56e57fcf2e236631c090bedff1402267f1b4a1402fe280d869264459254fb631603557611281b0aabd"}}}) syz_execute_func(&(0x7f0000000140)="c463d55d8453b762bfca0fc483457fd800c44379623a0dc4e1bd5dd7660f10fcc461397641920faaf30f00adab36000026440f7092320000006ec4e1c9fa5fad") syz_extract_tcp_res(&(0x7f0000000180), 0x7, 0x8) syz_open_pts() csource_test.go:151: 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 #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 __attribute__((noinline)) remove_dir(const char* dir) { DIR* dp = opendir(dir); if (dp == NULL) { if (errno == EACCES) { if (rmdir(dir)) exit(1); return; } exit(1); } struct dirent* ep = 0; 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); while (rmdir(dir)) { exit(1); } } static int inject_fault(int nth) { return 0; } static void setup_fault() { } 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 = 0; for (; 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; } #define CAST static uintptr_t syz_open_pts(void) { int master, slave; if (openpty(&master, &slave, NULL, NULL, NULL) == -1) return -1; if (dup2(master, master + 100) != -1) close(master); return slave; } static void sandbox_common() { struct rlimit 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) { ((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 < 12; 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 (call == 1) break; event_timedwait(&th->done, 50); 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 = 0; for (;; 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 < 5000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: memcpy((void*)0x20000000, "/dev/wskbd\000", 11); inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(openat))(/*fd=*/0xffffffffffffff9c, /*file=*/0x20000000, /*flags=O_DIRECTORY*/0x20000, /*mode=*/0); if (res != -1) r[0] = res; break; case 1: *(uint32_t*)0x20000140 = 0xfa; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(accept))(/*fd=*/r[0], /*peer=*/0x20000040, /*peerlen=*/0x20000140); if (res != -1) r[1] = res; break; case 2: res = -1; res = ((intptr_t(*)())CAST(getuid))(); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)())CAST(getuid))(); } } if (res != -1) r[2] = res; break; case 3: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(getsockopt))(/*fd=*/r[0], /*level=*/0xffff, /*optname=*/0x1022, /*optval=*/0x200001c0, /*optlen=*/0xc); if (res != -1) r[3] = *(uint32_t*)0x200001c8; break; case 4: memcpy((void*)0x20000180, "./file0\000", 8); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(chown))(/*file=*/0x20000180, /*uid=*/r[2], /*gid=*/r[3]); break; case 5: *(uint16_t*)0x20000200 = 1; *(uint8_t*)0x20000202 = 0; *(uint32_t*)0x20000204 = 0x4e21 + procid*4; ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(bind))(/*fd=*/r[1], /*addr=*/0x20000200, /*addrlen=*/8); break; case 6: ((intptr_t(*)(intptr_t))CAST(close))(/*fd=*/r[0]); break; case 7: memcpy((void*)0x20000240, "./file0\000", 8); NONFAILING(((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(mknod))(/*file=*/0x20000240, /*mode=*/0x100, /*dev=*/2)); /* major = 0, minor = 2 */ break; case 8: *(uint32_t*)0x200002c0 = 0x10; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(getsockopt))(/*fd=*/r[0], /*level=*/0xffff, /*optname=SO_SNDTIMEO*/0x1005, /*optval=*/0x20000280, /*optlen=*/0x200002c0); break; case 9: *(uint16_t*)0x20000300 = 0x18; *(uint16_t*)0x20000302 = htobe16(0x4e23 + procid*4); *(uint32_t*)0x20000304 = 0x1ff; *(uint32_t*)0x20000308 = 5; ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(bind))(/*fd=*/r[0], /*addr=*/0x20000300, /*addrlen=*/0xc); break; case 10: memcpy((void*)0x20000140, "\xc4\x63\xd5\x5d\x84\x53\xb7\x62\xbf\xca\x0f\xc4\x83\x45\x7f\xd8\x00\xc4\x43\x79\x62\x3a\x0d\xc4\xe1\xbd\x5d\xd7\x66\x0f\x10\xfc\xc4\x61\x39\x76\x41\x92\x0f\xaa\xf3\x0f\x00\xad\xab\x36\x00\x00\x26\x44\x0f\x70\x92\x32\x00\x00\x00\x6e\xc4\xe1\xc9\xfa\x5f\xad", 64); syz_execute_func(/*text=*/0x20000140); break; case 11: syz_open_pts(); break; } } int main(void) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(mmap))(/*addr=*/0x20000000, /*len=*/0x1000000, /*prot=PROT_WRITE|PROT_READ*/3, /*flags=MAP_ANONYMOUS|MAP_FIXED|MAP_PRIVATE*/0x1012, /*fd=*/-1, /*offset=*/0); setup_fault(); for (procid = 0; procid < 4; procid++) { if (fork() == 0) { use_temporary_dir(); do_sandbox_none(); } } sleep(1000000); return 0; } :388:3: error: call to undeclared function 'NONFAILING'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration] NONFAILING(((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(mknod))(/*file=*/0x20000240, /*mode=*/0x100, /*dev=*/2)); /* major = 0, minor = 2 */ ^ 1 error generated. compiler invocation: c++ [-o /tmp/syz-executor177104940 -DGOOS_openbsd=1 -DGOARCH_amd64=1 -DHOSTGOOS_openbsd=1 -x c - -m64 -static -lutil -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-but-set-variable -Wno-unused-command-line-argument] --- FAIL: TestGenerate/openbsd/amd64/12 (4.31s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:false HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: r0 = openat$wsmuxkbd(0xffffffffffffff9c, &(0x7f0000000000), 0x20000, 0x0) (fail_nth: 1) r1 = accept$unix(r0, &(0x7f0000000040)=@file={0x0, ""/248}, &(0x7f0000000140)=0xfa) (async) r2 = getuid() (rerun: 4) getsockopt$SO_PEERCRED(r0, 0xffff, 0x1022, &(0x7f00000001c0)={0x0, 0x0, 0x0}, 0xc) chown(&(0x7f0000000180)='./file0\x00', r2, r3) bind(r1, &(0x7f0000000200)=@un=@abs={0x1, 0x0, 0x1}, 0x8) close(r0) mknod(&(0x7f0000000240)='./file0\x00', 0x100, 0x2) getsockopt$sock_timeval(r0, 0xffff, 0x1005, &(0x7f0000000280), &(0x7f00000002c0)=0x10) bind$inet6(r0, &(0x7f0000000300)={0x18, 0x3, 0x1ff, 0x5}, 0xc) syz_emit_ethernet(0x10c, &(0x7f0000000000)={@empty, @empty, [], {@generic={0x80f2, "961f1fcb2f7f4cf2d7246215711c6da70853b100bd7776418a8afef6a228178cc26bae556f82cd5b9d4399f29b1507307298cd20118e65db32c1d22941bfac3a8b1b753685ef611dcb8f7bca5aca235e21a9b3325e0b3db73ca42ff035eec10b2517988d0f7455645ae86e3da964b66fa2fc940836f41f0fbc7cbf421ebc9d05e643c8fd4b547ad8221d1aabe91ecb63589a96f6117c9fadeafa8f1e901982f6750358119e21c6d564818141905cb897612dafe7d8ee459ac6cb9f67848448abc14c59a530ae4a045561e140ba558965d6d6fd1c7d56e57fcf2e236631c090bedff1402267f1b4a1402fe280d869264459254fb631603557611281b0aabd"}}}) syz_execute_func(&(0x7f0000000140)="c463d55d8453b762bfca0fc483457fd800c44379623a0dc4e1bd5dd7660f10fcc461397641920faaf30f00adab36000026440f7092320000006ec4e1c9fa5fad") syz_extract_tcp_res(&(0x7f0000000180), 0x7, 0x8) syz_open_pts() csource_test.go:151: 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 #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 int inject_fault(int nth) { return 0; } static void setup_fault() { } 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 = 0; for (; 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; } #define CAST static uintptr_t syz_open_pts(void) { int master, slave; if (openpty(&master, &slave, NULL, NULL, NULL) == -1) return -1; if (dup2(master, master + 100) != -1) close(master); return slave; } static void sandbox_common() { struct rlimit 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) { ((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 < 12; 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 (call == 1) break; event_timedwait(&th->done, 50); 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 = 0; for (;; 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 < 5000) continue; kill_and_wait(pid, &status); break; } } } uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: memcpy((void*)0x20000000, "/dev/wskbd\000", 11); inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(openat))(/*fd=*/0xffffffffffffff9c, /*file=*/0x20000000, /*flags=O_DIRECTORY*/0x20000, /*mode=*/0); if (res != -1) r[0] = res; break; case 1: *(uint32_t*)0x20000140 = 0xfa; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(accept))(/*fd=*/r[0], /*peer=*/0x20000040, /*peerlen=*/0x20000140); if (res != -1) r[1] = res; break; case 2: res = -1; res = ((intptr_t(*)())CAST(getuid))(); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)())CAST(getuid))(); } } if (res != -1) r[2] = res; break; case 3: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(getsockopt))(/*fd=*/r[0], /*level=*/0xffff, /*optname=*/0x1022, /*optval=*/0x200001c0, /*optlen=*/0xc); if (res != -1) r[3] = *(uint32_t*)0x200001c8; break; case 4: memcpy((void*)0x20000180, "./file0\000", 8); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(chown))(/*file=*/0x20000180, /*uid=*/r[2], /*gid=*/r[3]); break; case 5: *(uint16_t*)0x20000200 = 1; *(uint8_t*)0x20000202 = 0; *(uint32_t*)0x20000204 = 0x4e21; ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(bind))(/*fd=*/r[1], /*addr=*/0x20000200, /*addrlen=*/8); break; case 6: ((intptr_t(*)(intptr_t))CAST(close))(/*fd=*/r[0]); break; case 7: memcpy((void*)0x20000240, "./file0\000", 8); NONFAILING(((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(mknod))(/*file=*/0x20000240, /*mode=*/0x100, /*dev=*/2)); /* major = 0, minor = 2 */ break; case 8: *(uint32_t*)0x200002c0 = 0x10; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(getsockopt))(/*fd=*/r[0], /*level=*/0xffff, /*optname=SO_SNDTIMEO*/0x1005, /*optval=*/0x20000280, /*optlen=*/0x200002c0); break; case 9: *(uint16_t*)0x20000300 = 0x18; *(uint16_t*)0x20000302 = htobe16(0x4e23); *(uint32_t*)0x20000304 = 0x1ff; *(uint32_t*)0x20000308 = 5; ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(bind))(/*fd=*/r[0], /*addr=*/0x20000300, /*addrlen=*/0xc); break; case 10: memcpy((void*)0x20000140, "\xc4\x63\xd5\x5d\x84\x53\xb7\x62\xbf\xca\x0f\xc4\x83\x45\x7f\xd8\x00\xc4\x43\x79\x62\x3a\x0d\xc4\xe1\xbd\x5d\xd7\x66\x0f\x10\xfc\xc4\x61\x39\x76\x41\x92\x0f\xaa\xf3\x0f\x00\xad\xab\x36\x00\x00\x26\x44\x0f\x70\x92\x32\x00\x00\x00\x6e\xc4\xe1\xc9\xfa\x5f\xad", 64); syz_execute_func(/*text=*/0x20000140); break; case 11: syz_open_pts(); break; } } int main(void) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(mmap))(/*addr=*/0x20000000, /*len=*/0x1000000, /*prot=PROT_WRITE|PROT_READ*/3, /*flags=MAP_ANONYMOUS|MAP_FIXED|MAP_PRIVATE*/0x1012, /*fd=*/-1, /*offset=*/0); setup_fault(); do_sandbox_none(); return 0; } :333:3: error: call to undeclared function 'NONFAILING'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration] NONFAILING(((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(mknod))(/*file=*/0x20000240, /*mode=*/0x100, /*dev=*/2)); /* major = 0, minor = 2 */ ^ 1 error generated. compiler invocation: c++ [-o /tmp/syz-executor3941362868 -DGOOS_openbsd=1 -DGOARCH_amd64=1 -DHOSTGOOS_openbsd=1 -x c - -m64 -static -lutil -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-but-set-variable -Wno-unused-command-line-argument] --- FAIL: TestGenerate/openbsd/amd64/1 (1.93s) csource_test.go:148: --- FAIL: TestGenerate/openbsd/amd64/7 (5.30s) csource_test.go:148: --- FAIL: TestGenerate/openbsd/amd64/6 (3.53s) csource_test.go:148: --- FAIL: TestGenerate/openbsd/amd64/4 (5.58s) csource_test.go:148: --- FAIL: TestGenerate/openbsd/amd64/11 (3.87s) csource_test.go:148: --- FAIL: TestGenerate/openbsd/amd64/3 (1.74s) csource_test.go:148: FAIL FAIL github.com/google/syzkaller/pkg/csource 20.847s ok github.com/google/syzkaller/pkg/db (cached) ok github.com/google/syzkaller/pkg/email (cached) ok github.com/google/syzkaller/pkg/email/lore (cached) ok github.com/google/syzkaller/pkg/fuzzer 0.362s ok github.com/google/syzkaller/pkg/gce (cached) ok github.com/google/syzkaller/pkg/host 16.659s ok github.com/google/syzkaller/pkg/html (cached) ok github.com/google/syzkaller/pkg/ifuzz (cached) ok github.com/google/syzkaller/pkg/image 3.972s ok github.com/google/syzkaller/pkg/instance 15.233s ok github.com/google/syzkaller/pkg/ipc 34.419s ok github.com/google/syzkaller/pkg/kconfig (cached) ok github.com/google/syzkaller/pkg/kd (cached) ok github.com/google/syzkaller/pkg/log (cached) ok github.com/google/syzkaller/pkg/mgrconfig 13.352s ok github.com/google/syzkaller/pkg/osutil (cached) ok github.com/google/syzkaller/pkg/report 27.966s ok github.com/google/syzkaller/pkg/repro 16.965s ok github.com/google/syzkaller/pkg/runtest 91.925s ok github.com/google/syzkaller/pkg/serializer (cached) ok github.com/google/syzkaller/pkg/signal (cached) ok github.com/google/syzkaller/pkg/stats (cached) ok github.com/google/syzkaller/pkg/subsystem (cached) ok github.com/google/syzkaller/pkg/subsystem/linux (cached) ok github.com/google/syzkaller/pkg/subsystem/lists (cached) ok github.com/google/syzkaller/pkg/symbolizer (cached) ok github.com/google/syzkaller/pkg/tool (cached) ok github.com/google/syzkaller/pkg/vcs (cached) ? github.com/google/syzkaller/sys [no test files] ? github.com/google/syzkaller/sys/akaros [no test files] ? github.com/google/syzkaller/sys/darwin [no test files] ? github.com/google/syzkaller/sys/akaros/gen [no test files] ? github.com/google/syzkaller/sys/darwin/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/layout [no test files] ? github.com/google/syzkaller/sys/fuchsia/fidlgen [no test files] ? github.com/google/syzkaller/sys/fuchsia [no test files] ? github.com/google/syzkaller/sys/fuchsia/gen [no test files] ? github.com/google/syzkaller/sys/linux/gen [no test files] ? github.com/google/syzkaller/sys/netbsd/gen [no test files] ? 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/targets [no test files] ? github.com/google/syzkaller/sys/syz-sysgen [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] ? github.com/google/syzkaller/syz-runner [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-build [no test files] ? github.com/google/syzkaller/tools/syz-check [no test files] ? github.com/google/syzkaller/tools/syz-crush [no test files] ? github.com/google/syzkaller/tools/syz-cover [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-fillreports [no test files] ? github.com/google/syzkaller/tools/syz-fmt [no test files] ? github.com/google/syzkaller/tools/syz-kcidb [no test files] ? github.com/google/syzkaller/tools/syz-hubtool [no test files] ? github.com/google/syzkaller/tools/syz-lore [no test files] ? github.com/google/syzkaller/tools/syz-make [no test files] ? github.com/google/syzkaller/tools/syz-minconfig [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-query-subsystems [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] ok github.com/google/syzkaller/prog 29.816s ok github.com/google/syzkaller/prog/test 1.638s ok github.com/google/syzkaller/sys/linux 1.352s ok github.com/google/syzkaller/sys/netbsd (cached) ok github.com/google/syzkaller/sys/openbsd (cached) ? github.com/google/syzkaller/tools/syz-testbuild [no test files] ? github.com/google/syzkaller/tools/syz-trace2syz [no test files] ? 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] ? github.com/google/syzkaller/vm/bhyve [no test files] ? github.com/google/syzkaller/vm/cuttlefish [no test files] ? github.com/google/syzkaller/vm/adb [no test files] ? github.com/google/syzkaller/vm/gvisor [no test files] ? github.com/google/syzkaller/vm/gce [no test files] ? github.com/google/syzkaller/vm/kvm [no test files] ? github.com/google/syzkaller/vm/odroid [no test files] ? github.com/google/syzkaller/vm/proxyapp/mocks [no test files] ? github.com/google/syzkaller/vm/proxyapp/proxyrpc [no test files] ? github.com/google/syzkaller/vm/qemu [no test files] ? github.com/google/syzkaller/vm/starnix [no test files] ? github.com/google/syzkaller/vm/vmm [no test files] ? github.com/google/syzkaller/vm/vmware [no test files] ok github.com/google/syzkaller/syz-ci 29.009s ok github.com/google/syzkaller/syz-fuzzer 0.215s ok github.com/google/syzkaller/syz-hub 0.471s ok github.com/google/syzkaller/syz-hub/state 0.430s ok github.com/google/syzkaller/syz-manager 8.031s ok github.com/google/syzkaller/syz-verifier 8.236s ok github.com/google/syzkaller/tools/syz-kconf (cached) ok github.com/google/syzkaller/tools/syz-linter (cached) ok github.com/google/syzkaller/tools/syz-testbed 7.216s ok github.com/google/syzkaller/tools/syz-trace2syz/parser 0.183s ok github.com/google/syzkaller/tools/syz-trace2syz/proggen 2.326s ok github.com/google/syzkaller/vm 17.658s ok github.com/google/syzkaller/vm/isolated 6.283s ok github.com/google/syzkaller/vm/proxyapp 7.810s ok github.com/google/syzkaller/vm/vmimpl 4.320s FAIL