ok github.com/google/syzkaller/dashboard/app (cached) ? github.com/google/syzkaller/dashboard/dashapi [no test files] ok github.com/google/syzkaller/executor 0.656s ok github.com/google/syzkaller/pkg/ast 3.446s ok github.com/google/syzkaller/pkg/auth (cached) ok github.com/google/syzkaller/pkg/bisect 54.386s ok github.com/google/syzkaller/pkg/build 0.160s ok github.com/google/syzkaller/pkg/compiler 11.687s ? github.com/google/syzkaller/pkg/config [no test files] ok github.com/google/syzkaller/pkg/cover (cached) ok github.com/google/syzkaller/pkg/cover/backend (cached) --- FAIL: TestGenerate (6.08s) --- FAIL: TestGenerate/freebsd/386 (0.84s) csource_test.go:52: seed=1633544594199892936 --- FAIL: TestGenerate/freebsd/386/1 (0.61s) csource_test.go:118: opts: {Threaded:true Collide:false Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Fault:false FaultCall:0 FaultNth:0}} program: r0 = kqueue() (fail_nth: 1) fcntl$setflags(r0, 0x2, 0x0) read(r0, &(0x7f0000000000)=""/57, 0x39) setsockopt$inet6_MCAST_LEAVE_GROUP(0xffffffffffffffff, 0x29, 0x51, &(0x7f0000000040)={0x4, {{0x1c, 0x1c, 0x3, 0x75, @empty, 0xdf52}}}, 0x80) fchmod(0xffffffffffffff9c, 0x80) sendto(0xffffffffffffffff, &(0x7f00000000c0)="f0da4f00d39f1b4de86997bbdb3642450da90dcb26fb91c90f629a8580f5f8e881e0469647607522dc805eb5953ea8ad5a75762736cc9f085952176a0744e839592e0687f16d3e", 0x47, 0x20188, 0x0, 0x0) r1 = accept$unix(0xffffffffffffff9c, 0x0, &(0x7f0000000140)) r2 = getppid() fhstatfs(&(0x7f0000000580)={{[0x4eecdb2d, 0x1]}, {0x100, 0x0, "35e5cf9585f49451ade1873fb93826b9"}}, &(0x7f00000005c0)={0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, [], 0x0, 0x0}) sendmsg$unix(r1, &(0x7f0000001600)={&(0x7f0000000180)=@file={0xa, 0x1, './file0\x00'}, 0xa, &(0x7f0000000540)=[{&(0x7f00000001c0)="6bca7e1c896c8d761e48bc4178d227d4cb149ce2bb7d220b8e3e2e9b91deb21446621bf63ff2cbafd4eb9bcf8a7a26bc51c3734e185d756053476d04b0cb4adf6290c5f17e2600256db3eb864c7d3e66a5bb274ddf980ddb34efccffbcfe5531ecf61f2b53689e295f91d655a694569d71732f", 0x73}, {&(0x7f0000000240)="d332313be24143da4f255aab51123847fa7632f17cf3ee7431c84243b3ee924d67b53776df412e0c9e81dd63a89e0f393bca1795193b56851b889cda6d366453d3aace82c4b8eef7afdd8e8c7a5a29770f5c3c56e76f6a40e8fed28a9a4c35321e5bb413d7a2e7e6b6069cf7a8627f5dcb48d6890d34de511381631513cdaf7ad4af86095e256a9d81a8a1b6fc30656275019b95f7b77c17c0b548d08892b49445e38143d778ba", 0xa7}, {&(0x7f0000000300)="0440076fd2f8b64040b380087d2a5cab89fc98dfdfb13e3cfe530d18dc89f18bbab2189b046cc1fd862fc07c58f4f09ed364141f765a72f0", 0x38}, {&(0x7f0000000340)="a9061fb6bd05bc02e579811704f0bf7492eacbc4d15131c6614ec9162c22420e80efdfa25a98d29e9ed2191a86e0b0a5590791a2231fe30bc005cf55c0cebd006873d9a3b94f03dfe9c1c886642a40b76c021a465aa1e2f1aee0fb487ccfda4058b264e5262f2edc7a0ed5a5dc94e5c31c222211b1e23168973789f5ed5d8d1728fe2e5e4694197a749b3505bd7602fb413aa3c2ec48e20452704b84c6d99f986fcf64d109794c97f31445c13524a9e6de832033c0514e1072a68c9941a1a3ee4acee71e059d8129b7983c85b222ffcd1fa3ba670d756fa1bdc53cccacba3b6de4d24e316fe0c6a2", 0xe8}, {&(0x7f0000000440)="b8afd9014ee3d8a83ab8c8eaa64cdb5f0e70fc6e3adf08ba675c6852819d8b03d19039245b607b2ef381d2a19fbe629b8da6421e5a05719de00b336c2805541979ea17bd1299fb169cf41e0b21b6fb477a6ecd4db55625517105b3e5d489e705f4c373ba434ce6b24048757651be81cea4ba53f73f746b584b3250c10e44177f25a80da62fe6ec0801569a5fdcd021e107d618772707f772486c5c3343a0df31ff28ded980069c30f6a08a48080dc203eb3c3456432a4dd9249f50f180138bab159c5bf3dbeff5ebec6de3e782fb47e8f090b7e961d4d6", 0xd7}], 0x5, &(0x7f0000001500)=[@cred={0x60, 0xffff, 0x3, r2, 0xffffffffffffffff, r3, 0x0, 0x10, [0x0, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xffffffffffffffff]}, @cred={0x60, 0xffff, 0x3, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0x10, [0x0, 0xffffffffffffffff, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffffffffffff]}, @rights={0x30, 0xffff, 0x1, [r0, 0xffffffffffffffff, r0, r0, r0, r0, r0, 0xffffffffffffff9c, 0xffffffffffffffff]}], 0xf0, 0x20080}, 0xc) syz_emit_ethernet(0x7e, &(0x7f0000000000)={@broadcast, @broadcast, [], {@ipv4={0x800, {{0x11, 0x4, 0x0, 0x9, 0x70, 0x65, 0xfff, 0x1, 0x45, 0x0, @empty, @empty, {[@rr={0x7, 0x27, 0x42, [@broadcast, @remote={0xac, 0x14, 0x0}, @local={0xac, 0x14, 0x0}, @multicast1, @remote={0xac, 0x14, 0x0}, @multicast2, @multicast1, @loopback, @broadcast]}, @generic={0x88, 0x6, "4e65f765"}]}}, @generic="28a61f895fbbf527b3987a02bb0dbc5f2d9e8fc684889186b7e0347c358ba58238965531ac7b77908372d8c3"}}}}) syz_execute_func(&(0x7f0000000080)="0f0fb69b097579bf2ef00fc70fc4e3150650137f0f2f06c4e3f9632600c4e1175c1f67260f72d10d669d0f71d600d9e9") syz_extract_tcp_res(&(0x7f00000000c0), 0x4, 0x0) csource_test.go:119: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void __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); if (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 BITMASK(bf_off,bf_len) (((1ull << (bf_len)) - 1) << (bf_off)) #define STORE_BY_BITMASK(type,htobe,addr,val,bf_off,bf_len) *(type*)(addr) = htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len)))) struct csum_inet { uint32_t acc; }; static void csum_inet_init(struct csum_inet* csum) { csum->acc = 0; } static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) { if (length == 0) return; size_t i = 0; for (; i < length - 1; i += 2) csum->acc += *(uint16_t*)&data[i]; if (length & 1) csum->acc += le16toh((uint16_t)data[length - 1]); while (csum->acc > 0xffff) csum->acc = (csum->acc & 0xffff) + (csum->acc >> 16); } static uint16_t csum_inet_digest(struct csum_inet* csum) { return ~csum->acc; } static void sandbox_common() { struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 8 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 0; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); } static void loop(); static int do_sandbox_none(void) { sandbox_common(); loop(); return 0; } static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 13; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); event_timedwait(&th->done, 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: inject_fault(1); res = syscall(SYS_kqueue); if (res != -1) r[0] = res; break; case 1: syscall(SYS_fcntl, (intptr_t)r[0], 2, 0); break; case 2: syscall(SYS_read, (intptr_t)r[0], 0x10000000, 0x39); break; case 3: *(uint32_t*)0x10000040 = 4; *(uint8_t*)0x10000044 = 0x1c; *(uint8_t*)0x10000045 = 0x1c; *(uint16_t*)0x10000046 = htobe16(0x4e23); *(uint32_t*)0x10000048 = 0x75; memset((void*)0x1000004c, 0, 16); *(uint32_t*)0x1000005c = 0xdf52; memset((void*)0x10000060, 0, 96); syscall(SYS_setsockopt, -1, 0x29, 0x51, 0x10000040, 0x80); break; case 4: syscall(SYS_fchmod, 0xffffff9c, 0x80); break; case 5: memcpy((void*)0x100000c0, "\xf0\xda\x4f\x00\xd3\x9f\x1b\x4d\xe8\x69\x97\xbb\xdb\x36\x42\x45\x0d\xa9\x0d\xcb\x26\xfb\x91\xc9\x0f\x62\x9a\x85\x80\xf5\xf8\xe8\x81\xe0\x46\x96\x47\x60\x75\x22\xdc\x80\x5e\xb5\x95\x3e\xa8\xad\x5a\x75\x76\x27\x36\xcc\x9f\x08\x59\x52\x17\x6a\x07\x44\xe8\x39\x59\x2e\x06\x87\xf1\x6d\x3e", 71); syscall(SYS_sendto, -1, 0x100000c0, 0x47, 0x20188, 0, 0); break; case 6: *(uint32_t*)0x10000140 = 0; res = syscall(SYS_accept, 0xffffff9c, 0, 0x10000140); if (res != -1) r[1] = res; break; case 7: res = syscall(SYS_getppid); if (res != -1) r[2] = res; break; case 8: *(uint32_t*)0x10000580 = 0x4eecdb2d; *(uint32_t*)0x10000584 = 1; *(uint16_t*)0x10000588 = 0x100; *(uint16_t*)0x1000058a = 0; memcpy((void*)0x1000058c, "\x35\xe5\xcf\x95\x85\xf4\x94\x51\xad\xe1\x87\x3f\xb9\x38\x26\xb9", 16); res = syscall(SYS_fhstatfs, 0x10000580, 0x100005c0); if (res != -1) r[3] = *(uint32_t*)0x1000067c; break; case 9: *(uint32_t*)0x10001600 = 0x10000180; *(uint8_t*)0x10000180 = 0xa; *(uint8_t*)0x10000181 = 1; memcpy((void*)0x10000182, "./file0\000", 8); *(uint32_t*)0x10001604 = 0xa; *(uint32_t*)0x10001608 = 0x10000540; *(uint32_t*)0x10000540 = 0x100001c0; memcpy((void*)0x100001c0, "\x6b\xca\x7e\x1c\x89\x6c\x8d\x76\x1e\x48\xbc\x41\x78\xd2\x27\xd4\xcb\x14\x9c\xe2\xbb\x7d\x22\x0b\x8e\x3e\x2e\x9b\x91\xde\xb2\x14\x46\x62\x1b\xf6\x3f\xf2\xcb\xaf\xd4\xeb\x9b\xcf\x8a\x7a\x26\xbc\x51\xc3\x73\x4e\x18\x5d\x75\x60\x53\x47\x6d\x04\xb0\xcb\x4a\xdf\x62\x90\xc5\xf1\x7e\x26\x00\x25\x6d\xb3\xeb\x86\x4c\x7d\x3e\x66\xa5\xbb\x27\x4d\xdf\x98\x0d\xdb\x34\xef\xcc\xff\xbc\xfe\x55\x31\xec\xf6\x1f\x2b\x53\x68\x9e\x29\x5f\x91\xd6\x55\xa6\x94\x56\x9d\x71\x73\x2f", 115); *(uint32_t*)0x10000544 = 0x73; *(uint32_t*)0x10000548 = 0x10000240; memcpy((void*)0x10000240, "\xd3\x32\x31\x3b\xe2\x41\x43\xda\x4f\x25\x5a\xab\x51\x12\x38\x47\xfa\x76\x32\xf1\x7c\xf3\xee\x74\x31\xc8\x42\x43\xb3\xee\x92\x4d\x67\xb5\x37\x76\xdf\x41\x2e\x0c\x9e\x81\xdd\x63\xa8\x9e\x0f\x39\x3b\xca\x17\x95\x19\x3b\x56\x85\x1b\x88\x9c\xda\x6d\x36\x64\x53\xd3\xaa\xce\x82\xc4\xb8\xee\xf7\xaf\xdd\x8e\x8c\x7a\x5a\x29\x77\x0f\x5c\x3c\x56\xe7\x6f\x6a\x40\xe8\xfe\xd2\x8a\x9a\x4c\x35\x32\x1e\x5b\xb4\x13\xd7\xa2\xe7\xe6\xb6\x06\x9c\xf7\xa8\x62\x7f\x5d\xcb\x48\xd6\x89\x0d\x34\xde\x51\x13\x81\x63\x15\x13\xcd\xaf\x7a\xd4\xaf\x86\x09\x5e\x25\x6a\x9d\x81\xa8\xa1\xb6\xfc\x30\x65\x62\x75\x01\x9b\x95\xf7\xb7\x7c\x17\xc0\xb5\x48\xd0\x88\x92\xb4\x94\x45\xe3\x81\x43\xd7\x78\xba", 167); *(uint32_t*)0x1000054c = 0xa7; *(uint32_t*)0x10000550 = 0x10000300; memcpy((void*)0x10000300, "\x04\x40\x07\x6f\xd2\xf8\xb6\x40\x40\xb3\x80\x08\x7d\x2a\x5c\xab\x89\xfc\x98\xdf\xdf\xb1\x3e\x3c\xfe\x53\x0d\x18\xdc\x89\xf1\x8b\xba\xb2\x18\x9b\x04\x6c\xc1\xfd\x86\x2f\xc0\x7c\x58\xf4\xf0\x9e\xd3\x64\x14\x1f\x76\x5a\x72\xf0", 56); *(uint32_t*)0x10000554 = 0x38; *(uint32_t*)0x10000558 = 0x10000340; memcpy((void*)0x10000340, "\xa9\x06\x1f\xb6\xbd\x05\xbc\x02\xe5\x79\x81\x17\x04\xf0\xbf\x74\x92\xea\xcb\xc4\xd1\x51\x31\xc6\x61\x4e\xc9\x16\x2c\x22\x42\x0e\x80\xef\xdf\xa2\x5a\x98\xd2\x9e\x9e\xd2\x19\x1a\x86\xe0\xb0\xa5\x59\x07\x91\xa2\x23\x1f\xe3\x0b\xc0\x05\xcf\x55\xc0\xce\xbd\x00\x68\x73\xd9\xa3\xb9\x4f\x03\xdf\xe9\xc1\xc8\x86\x64\x2a\x40\xb7\x6c\x02\x1a\x46\x5a\xa1\xe2\xf1\xae\xe0\xfb\x48\x7c\xcf\xda\x40\x58\xb2\x64\xe5\x26\x2f\x2e\xdc\x7a\x0e\xd5\xa5\xdc\x94\xe5\xc3\x1c\x22\x22\x11\xb1\xe2\x31\x68\x97\x37\x89\xf5\xed\x5d\x8d\x17\x28\xfe\x2e\x5e\x46\x94\x19\x7a\x74\x9b\x35\x05\xbd\x76\x02\xfb\x41\x3a\xa3\xc2\xec\x48\xe2\x04\x52\x70\x4b\x84\xc6\xd9\x9f\x98\x6f\xcf\x64\xd1\x09\x79\x4c\x97\xf3\x14\x45\xc1\x35\x24\xa9\xe6\xde\x83\x20\x33\xc0\x51\x4e\x10\x72\xa6\x8c\x99\x41\xa1\xa3\xee\x4a\xce\xe7\x1e\x05\x9d\x81\x29\xb7\x98\x3c\x85\xb2\x22\xff\xcd\x1f\xa3\xba\x67\x0d\x75\x6f\xa1\xbd\xc5\x3c\xcc\xac\xba\x3b\x6d\xe4\xd2\x4e\x31\x6f\xe0\xc6\xa2", 232); *(uint32_t*)0x1000055c = 0xe8; *(uint32_t*)0x10000560 = 0x10000440; memcpy((void*)0x10000440, "\xb8\xaf\xd9\x01\x4e\xe3\xd8\xa8\x3a\xb8\xc8\xea\xa6\x4c\xdb\x5f\x0e\x70\xfc\x6e\x3a\xdf\x08\xba\x67\x5c\x68\x52\x81\x9d\x8b\x03\xd1\x90\x39\x24\x5b\x60\x7b\x2e\xf3\x81\xd2\xa1\x9f\xbe\x62\x9b\x8d\xa6\x42\x1e\x5a\x05\x71\x9d\xe0\x0b\x33\x6c\x28\x05\x54\x19\x79\xea\x17\xbd\x12\x99\xfb\x16\x9c\xf4\x1e\x0b\x21\xb6\xfb\x47\x7a\x6e\xcd\x4d\xb5\x56\x25\x51\x71\x05\xb3\xe5\xd4\x89\xe7\x05\xf4\xc3\x73\xba\x43\x4c\xe6\xb2\x40\x48\x75\x76\x51\xbe\x81\xce\xa4\xba\x53\xf7\x3f\x74\x6b\x58\x4b\x32\x50\xc1\x0e\x44\x17\x7f\x25\xa8\x0d\xa6\x2f\xe6\xec\x08\x01\x56\x9a\x5f\xdc\xd0\x21\xe1\x07\xd6\x18\x77\x27\x07\xf7\x72\x48\x6c\x5c\x33\x43\xa0\xdf\x31\xff\x28\xde\xd9\x80\x06\x9c\x30\xf6\xa0\x8a\x48\x08\x0d\xc2\x03\xeb\x3c\x34\x56\x43\x2a\x4d\xd9\x24\x9f\x50\xf1\x80\x13\x8b\xab\x15\x9c\x5b\xf3\xdb\xef\xf5\xeb\xec\x6d\xe3\xe7\x82\xfb\x47\xe8\xf0\x90\xb7\xe9\x61\xd4\xd6", 215); *(uint32_t*)0x10000564 = 0xd7; *(uint32_t*)0x1000160c = 5; *(uint32_t*)0x10001610 = 0x10001500; *(uint32_t*)0x10001500 = 0x60; *(uint32_t*)0x10001504 = 0xffff; *(uint32_t*)0x10001508 = 3; *(uint32_t*)0x1000150c = r[2]; *(uint32_t*)0x10001510 = -1; *(uint32_t*)0x10001514 = r[3]; *(uint32_t*)0x10001518 = 0; *(uint16_t*)0x1000151c = 0x10; *(uint32_t*)0x10001520 = 0; *(uint32_t*)0x10001524 = 0; *(uint32_t*)0x10001528 = -1; *(uint32_t*)0x1000152c = -1; *(uint32_t*)0x10001530 = 0; *(uint32_t*)0x10001534 = -1; *(uint32_t*)0x10001538 = -1; *(uint32_t*)0x1000153c = -1; *(uint32_t*)0x10001540 = 0; *(uint32_t*)0x10001544 = 0; *(uint32_t*)0x10001548 = 0; *(uint32_t*)0x1000154c = -1; *(uint32_t*)0x10001550 = -1; *(uint32_t*)0x10001554 = 0; *(uint32_t*)0x10001558 = -1; *(uint32_t*)0x1000155c = 0; *(uint32_t*)0x10001560 = 0x60; *(uint32_t*)0x10001564 = 0xffff; *(uint32_t*)0x10001568 = 3; *(uint32_t*)0x1000156c = 0; *(uint32_t*)0x10001570 = 0; *(uint32_t*)0x10001574 = 0; *(uint32_t*)0x10001578 = -1; *(uint16_t*)0x1000157c = 0x10; *(uint32_t*)0x10001580 = 0; *(uint32_t*)0x10001584 = -1; *(uint32_t*)0x10001588 = 0; *(uint32_t*)0x1000158c = -1; *(uint32_t*)0x10001590 = -1; *(uint32_t*)0x10001594 = -1; *(uint32_t*)0x10001598 = -1; *(uint32_t*)0x1000159c = 0; *(uint32_t*)0x100015a0 = 0; *(uint32_t*)0x100015a4 = 0; *(uint32_t*)0x100015a8 = 0; *(uint32_t*)0x100015ac = 0; *(uint32_t*)0x100015b0 = -1; *(uint32_t*)0x100015b4 = 0; *(uint32_t*)0x100015b8 = 0; *(uint32_t*)0x100015bc = 0; *(uint32_t*)0x100015c0 = 0x30; *(uint32_t*)0x100015c4 = 0xffff; *(uint32_t*)0x100015c8 = 1; *(uint32_t*)0x100015cc = r[0]; *(uint32_t*)0x100015d0 = -1; *(uint32_t*)0x100015d4 = r[0]; *(uint32_t*)0x100015d8 = r[0]; *(uint32_t*)0x100015dc = r[0]; *(uint32_t*)0x100015e0 = r[0]; *(uint32_t*)0x100015e4 = r[0]; *(uint32_t*)0x100015e8 = 0xffffff9c; *(uint32_t*)0x100015ec = -1; *(uint32_t*)0x10001614 = 0xf0; *(uint32_t*)0x10001618 = 0x20080; syscall(SYS_sendmsg, (intptr_t)r[1], 0x10001600, 0xc); break; case 10: memcpy((void*)0x10000080, "\x0f\x0f\xb6\x9b\x09\x75\x79\xbf\x2e\xf0\x0f\xc7\x0f\xc4\xe3\x15\x06\x50\x13\x7f\x0f\x2f\x06\xc4\xe3\xf9\x63\x26\x00\xc4\xe1\x17\x5c\x1f\x67\x26\x0f\x72\xd1\x0d\x66\x9d\x0f\x71\xd6\x00\xd9\xe9", 48); syz_execute_func(0x10000080); break; } } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :195:13: error: unused function 'csum_inet_init' [-Werror,-Wunused-function] static void csum_inet_init(struct csum_inet* csum) ^ :200:13: error: unused function 'csum_inet_update' [-Werror,-Wunused-function] static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) ^ :213:17: error: unused function 'csum_inet_digest' [-Werror,-Wunused-function] static uint16_t csum_inet_digest(struct csum_inet* csum) ^ 3 errors generated. compiler invocation: clang [-o /tmp/syz-executor898830536 -DGOOS_freebsd=1 -DGOARCH_386=1 -DHOSTGOOS_freebsd=1 -x c - -m32 -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -static -lc++ -Wno-overflow] --- FAIL: TestGenerate/freebsd/386/8 (0.77s) csource_test.go:118: opts: {Threaded:true Collide:false Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox: Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Fault:false FaultCall:0 FaultNth:0}} program: r0 = kqueue() (fail_nth: 1) fcntl$setflags(r0, 0x2, 0x0) read(r0, &(0x7f0000000000)=""/57, 0x39) setsockopt$inet6_MCAST_LEAVE_GROUP(0xffffffffffffffff, 0x29, 0x51, &(0x7f0000000040)={0x4, {{0x1c, 0x1c, 0x3, 0x75, @empty, 0xdf52}}}, 0x80) fchmod(0xffffffffffffff9c, 0x80) sendto(0xffffffffffffffff, &(0x7f00000000c0)="f0da4f00d39f1b4de86997bbdb3642450da90dcb26fb91c90f629a8580f5f8e881e0469647607522dc805eb5953ea8ad5a75762736cc9f085952176a0744e839592e0687f16d3e", 0x47, 0x20188, 0x0, 0x0) r1 = accept$unix(0xffffffffffffff9c, 0x0, &(0x7f0000000140)) r2 = getppid() fhstatfs(&(0x7f0000000580)={{[0x4eecdb2d, 0x1]}, {0x100, 0x0, "35e5cf9585f49451ade1873fb93826b9"}}, &(0x7f00000005c0)={0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, [], 0x0, 0x0}) sendmsg$unix(r1, &(0x7f0000001600)={&(0x7f0000000180)=@file={0xa, 0x1, './file0\x00'}, 0xa, &(0x7f0000000540)=[{&(0x7f00000001c0)="6bca7e1c896c8d761e48bc4178d227d4cb149ce2bb7d220b8e3e2e9b91deb21446621bf63ff2cbafd4eb9bcf8a7a26bc51c3734e185d756053476d04b0cb4adf6290c5f17e2600256db3eb864c7d3e66a5bb274ddf980ddb34efccffbcfe5531ecf61f2b53689e295f91d655a694569d71732f", 0x73}, {&(0x7f0000000240)="d332313be24143da4f255aab51123847fa7632f17cf3ee7431c84243b3ee924d67b53776df412e0c9e81dd63a89e0f393bca1795193b56851b889cda6d366453d3aace82c4b8eef7afdd8e8c7a5a29770f5c3c56e76f6a40e8fed28a9a4c35321e5bb413d7a2e7e6b6069cf7a8627f5dcb48d6890d34de511381631513cdaf7ad4af86095e256a9d81a8a1b6fc30656275019b95f7b77c17c0b548d08892b49445e38143d778ba", 0xa7}, {&(0x7f0000000300)="0440076fd2f8b64040b380087d2a5cab89fc98dfdfb13e3cfe530d18dc89f18bbab2189b046cc1fd862fc07c58f4f09ed364141f765a72f0", 0x38}, {&(0x7f0000000340)="a9061fb6bd05bc02e579811704f0bf7492eacbc4d15131c6614ec9162c22420e80efdfa25a98d29e9ed2191a86e0b0a5590791a2231fe30bc005cf55c0cebd006873d9a3b94f03dfe9c1c886642a40b76c021a465aa1e2f1aee0fb487ccfda4058b264e5262f2edc7a0ed5a5dc94e5c31c222211b1e23168973789f5ed5d8d1728fe2e5e4694197a749b3505bd7602fb413aa3c2ec48e20452704b84c6d99f986fcf64d109794c97f31445c13524a9e6de832033c0514e1072a68c9941a1a3ee4acee71e059d8129b7983c85b222ffcd1fa3ba670d756fa1bdc53cccacba3b6de4d24e316fe0c6a2", 0xe8}, {&(0x7f0000000440)="b8afd9014ee3d8a83ab8c8eaa64cdb5f0e70fc6e3adf08ba675c6852819d8b03d19039245b607b2ef381d2a19fbe629b8da6421e5a05719de00b336c2805541979ea17bd1299fb169cf41e0b21b6fb477a6ecd4db55625517105b3e5d489e705f4c373ba434ce6b24048757651be81cea4ba53f73f746b584b3250c10e44177f25a80da62fe6ec0801569a5fdcd021e107d618772707f772486c5c3343a0df31ff28ded980069c30f6a08a48080dc203eb3c3456432a4dd9249f50f180138bab159c5bf3dbeff5ebec6de3e782fb47e8f090b7e961d4d6", 0xd7}], 0x5, &(0x7f0000001500)=[@cred={0x60, 0xffff, 0x3, r2, 0xffffffffffffffff, r3, 0x0, 0x10, [0x0, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xffffffffffffffff]}, @cred={0x60, 0xffff, 0x3, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0x10, [0x0, 0xffffffffffffffff, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffffffffffff]}, @rights={0x30, 0xffff, 0x1, [r0, 0xffffffffffffffff, r0, r0, r0, r0, r0, 0xffffffffffffff9c, 0xffffffffffffffff]}], 0xf0, 0x20080}, 0xc) syz_emit_ethernet(0x7e, &(0x7f0000000000)={@broadcast, @broadcast, [], {@ipv4={0x800, {{0x11, 0x4, 0x0, 0x9, 0x70, 0x65, 0xfff, 0x1, 0x45, 0x0, @empty, @empty, {[@rr={0x7, 0x27, 0x42, [@broadcast, @remote={0xac, 0x14, 0x0}, @local={0xac, 0x14, 0x0}, @multicast1, @remote={0xac, 0x14, 0x0}, @multicast2, @multicast1, @loopback, @broadcast]}, @generic={0x88, 0x6, "4e65f765"}]}}, @generic="28a61f895fbbf527b3987a02bb0dbc5f2d9e8fc684889186b7e0347c358ba58238965531ac7b77908372d8c3"}}}}) syz_execute_func(&(0x7f0000000080)="0f0fb69b097579bf2ef00fc70fc4e3150650137f0f2f06c4e3f9632600c4e1175c1f67260f72d10d669d0f71d600d9e9") syz_extract_tcp_res(&(0x7f00000000c0), 0x4, 0x0) csource_test.go:119: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void __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); if (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 BITMASK(bf_off,bf_len) (((1ull << (bf_len)) - 1) << (bf_off)) #define STORE_BY_BITMASK(type,htobe,addr,val,bf_off,bf_len) *(type*)(addr) = htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len)))) struct csum_inet { uint32_t acc; }; static void csum_inet_init(struct csum_inet* csum) { csum->acc = 0; } static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) { if (length == 0) return; size_t i = 0; for (; i < length - 1; i += 2) csum->acc += *(uint16_t*)&data[i]; if (length & 1) csum->acc += le16toh((uint16_t)data[length - 1]); while (csum->acc > 0xffff) csum->acc = (csum->acc & 0xffff) + (csum->acc >> 16); } static uint16_t csum_inet_digest(struct csum_inet* csum) { return ~csum->acc; } 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 < 13; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); event_timedwait(&th->done, 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: inject_fault(1); res = syscall(SYS_kqueue); if (res != -1) r[0] = res; break; case 1: syscall(SYS_fcntl, (intptr_t)r[0], 2, 0); break; case 2: syscall(SYS_read, (intptr_t)r[0], 0x10000000, 0x39); break; case 3: *(uint32_t*)0x10000040 = 4; *(uint8_t*)0x10000044 = 0x1c; *(uint8_t*)0x10000045 = 0x1c; *(uint16_t*)0x10000046 = htobe16(0x4e23); *(uint32_t*)0x10000048 = 0x75; memset((void*)0x1000004c, 0, 16); *(uint32_t*)0x1000005c = 0xdf52; memset((void*)0x10000060, 0, 96); syscall(SYS_setsockopt, -1, 0x29, 0x51, 0x10000040, 0x80); break; case 4: syscall(SYS_fchmod, 0xffffff9c, 0x80); break; case 5: memcpy((void*)0x100000c0, "\xf0\xda\x4f\x00\xd3\x9f\x1b\x4d\xe8\x69\x97\xbb\xdb\x36\x42\x45\x0d\xa9\x0d\xcb\x26\xfb\x91\xc9\x0f\x62\x9a\x85\x80\xf5\xf8\xe8\x81\xe0\x46\x96\x47\x60\x75\x22\xdc\x80\x5e\xb5\x95\x3e\xa8\xad\x5a\x75\x76\x27\x36\xcc\x9f\x08\x59\x52\x17\x6a\x07\x44\xe8\x39\x59\x2e\x06\x87\xf1\x6d\x3e", 71); syscall(SYS_sendto, -1, 0x100000c0, 0x47, 0x20188, 0, 0); break; case 6: *(uint32_t*)0x10000140 = 0; res = syscall(SYS_accept, 0xffffff9c, 0, 0x10000140); if (res != -1) r[1] = res; break; case 7: res = syscall(SYS_getppid); if (res != -1) r[2] = res; break; case 8: *(uint32_t*)0x10000580 = 0x4eecdb2d; *(uint32_t*)0x10000584 = 1; *(uint16_t*)0x10000588 = 0x100; *(uint16_t*)0x1000058a = 0; memcpy((void*)0x1000058c, "\x35\xe5\xcf\x95\x85\xf4\x94\x51\xad\xe1\x87\x3f\xb9\x38\x26\xb9", 16); res = syscall(SYS_fhstatfs, 0x10000580, 0x100005c0); if (res != -1) r[3] = *(uint32_t*)0x1000067c; break; case 9: *(uint32_t*)0x10001600 = 0x10000180; *(uint8_t*)0x10000180 = 0xa; *(uint8_t*)0x10000181 = 1; memcpy((void*)0x10000182, "./file0\000", 8); *(uint32_t*)0x10001604 = 0xa; *(uint32_t*)0x10001608 = 0x10000540; *(uint32_t*)0x10000540 = 0x100001c0; memcpy((void*)0x100001c0, "\x6b\xca\x7e\x1c\x89\x6c\x8d\x76\x1e\x48\xbc\x41\x78\xd2\x27\xd4\xcb\x14\x9c\xe2\xbb\x7d\x22\x0b\x8e\x3e\x2e\x9b\x91\xde\xb2\x14\x46\x62\x1b\xf6\x3f\xf2\xcb\xaf\xd4\xeb\x9b\xcf\x8a\x7a\x26\xbc\x51\xc3\x73\x4e\x18\x5d\x75\x60\x53\x47\x6d\x04\xb0\xcb\x4a\xdf\x62\x90\xc5\xf1\x7e\x26\x00\x25\x6d\xb3\xeb\x86\x4c\x7d\x3e\x66\xa5\xbb\x27\x4d\xdf\x98\x0d\xdb\x34\xef\xcc\xff\xbc\xfe\x55\x31\xec\xf6\x1f\x2b\x53\x68\x9e\x29\x5f\x91\xd6\x55\xa6\x94\x56\x9d\x71\x73\x2f", 115); *(uint32_t*)0x10000544 = 0x73; *(uint32_t*)0x10000548 = 0x10000240; memcpy((void*)0x10000240, "\xd3\x32\x31\x3b\xe2\x41\x43\xda\x4f\x25\x5a\xab\x51\x12\x38\x47\xfa\x76\x32\xf1\x7c\xf3\xee\x74\x31\xc8\x42\x43\xb3\xee\x92\x4d\x67\xb5\x37\x76\xdf\x41\x2e\x0c\x9e\x81\xdd\x63\xa8\x9e\x0f\x39\x3b\xca\x17\x95\x19\x3b\x56\x85\x1b\x88\x9c\xda\x6d\x36\x64\x53\xd3\xaa\xce\x82\xc4\xb8\xee\xf7\xaf\xdd\x8e\x8c\x7a\x5a\x29\x77\x0f\x5c\x3c\x56\xe7\x6f\x6a\x40\xe8\xfe\xd2\x8a\x9a\x4c\x35\x32\x1e\x5b\xb4\x13\xd7\xa2\xe7\xe6\xb6\x06\x9c\xf7\xa8\x62\x7f\x5d\xcb\x48\xd6\x89\x0d\x34\xde\x51\x13\x81\x63\x15\x13\xcd\xaf\x7a\xd4\xaf\x86\x09\x5e\x25\x6a\x9d\x81\xa8\xa1\xb6\xfc\x30\x65\x62\x75\x01\x9b\x95\xf7\xb7\x7c\x17\xc0\xb5\x48\xd0\x88\x92\xb4\x94\x45\xe3\x81\x43\xd7\x78\xba", 167); *(uint32_t*)0x1000054c = 0xa7; *(uint32_t*)0x10000550 = 0x10000300; memcpy((void*)0x10000300, "\x04\x40\x07\x6f\xd2\xf8\xb6\x40\x40\xb3\x80\x08\x7d\x2a\x5c\xab\x89\xfc\x98\xdf\xdf\xb1\x3e\x3c\xfe\x53\x0d\x18\xdc\x89\xf1\x8b\xba\xb2\x18\x9b\x04\x6c\xc1\xfd\x86\x2f\xc0\x7c\x58\xf4\xf0\x9e\xd3\x64\x14\x1f\x76\x5a\x72\xf0", 56); *(uint32_t*)0x10000554 = 0x38; *(uint32_t*)0x10000558 = 0x10000340; memcpy((void*)0x10000340, "\xa9\x06\x1f\xb6\xbd\x05\xbc\x02\xe5\x79\x81\x17\x04\xf0\xbf\x74\x92\xea\xcb\xc4\xd1\x51\x31\xc6\x61\x4e\xc9\x16\x2c\x22\x42\x0e\x80\xef\xdf\xa2\x5a\x98\xd2\x9e\x9e\xd2\x19\x1a\x86\xe0\xb0\xa5\x59\x07\x91\xa2\x23\x1f\xe3\x0b\xc0\x05\xcf\x55\xc0\xce\xbd\x00\x68\x73\xd9\xa3\xb9\x4f\x03\xdf\xe9\xc1\xc8\x86\x64\x2a\x40\xb7\x6c\x02\x1a\x46\x5a\xa1\xe2\xf1\xae\xe0\xfb\x48\x7c\xcf\xda\x40\x58\xb2\x64\xe5\x26\x2f\x2e\xdc\x7a\x0e\xd5\xa5\xdc\x94\xe5\xc3\x1c\x22\x22\x11\xb1\xe2\x31\x68\x97\x37\x89\xf5\xed\x5d\x8d\x17\x28\xfe\x2e\x5e\x46\x94\x19\x7a\x74\x9b\x35\x05\xbd\x76\x02\xfb\x41\x3a\xa3\xc2\xec\x48\xe2\x04\x52\x70\x4b\x84\xc6\xd9\x9f\x98\x6f\xcf\x64\xd1\x09\x79\x4c\x97\xf3\x14\x45\xc1\x35\x24\xa9\xe6\xde\x83\x20\x33\xc0\x51\x4e\x10\x72\xa6\x8c\x99\x41\xa1\xa3\xee\x4a\xce\xe7\x1e\x05\x9d\x81\x29\xb7\x98\x3c\x85\xb2\x22\xff\xcd\x1f\xa3\xba\x67\x0d\x75\x6f\xa1\xbd\xc5\x3c\xcc\xac\xba\x3b\x6d\xe4\xd2\x4e\x31\x6f\xe0\xc6\xa2", 232); *(uint32_t*)0x1000055c = 0xe8; *(uint32_t*)0x10000560 = 0x10000440; memcpy((void*)0x10000440, "\xb8\xaf\xd9\x01\x4e\xe3\xd8\xa8\x3a\xb8\xc8\xea\xa6\x4c\xdb\x5f\x0e\x70\xfc\x6e\x3a\xdf\x08\xba\x67\x5c\x68\x52\x81\x9d\x8b\x03\xd1\x90\x39\x24\x5b\x60\x7b\x2e\xf3\x81\xd2\xa1\x9f\xbe\x62\x9b\x8d\xa6\x42\x1e\x5a\x05\x71\x9d\xe0\x0b\x33\x6c\x28\x05\x54\x19\x79\xea\x17\xbd\x12\x99\xfb\x16\x9c\xf4\x1e\x0b\x21\xb6\xfb\x47\x7a\x6e\xcd\x4d\xb5\x56\x25\x51\x71\x05\xb3\xe5\xd4\x89\xe7\x05\xf4\xc3\x73\xba\x43\x4c\xe6\xb2\x40\x48\x75\x76\x51\xbe\x81\xce\xa4\xba\x53\xf7\x3f\x74\x6b\x58\x4b\x32\x50\xc1\x0e\x44\x17\x7f\x25\xa8\x0d\xa6\x2f\xe6\xec\x08\x01\x56\x9a\x5f\xdc\xd0\x21\xe1\x07\xd6\x18\x77\x27\x07\xf7\x72\x48\x6c\x5c\x33\x43\xa0\xdf\x31\xff\x28\xde\xd9\x80\x06\x9c\x30\xf6\xa0\x8a\x48\x08\x0d\xc2\x03\xeb\x3c\x34\x56\x43\x2a\x4d\xd9\x24\x9f\x50\xf1\x80\x13\x8b\xab\x15\x9c\x5b\xf3\xdb\xef\xf5\xeb\xec\x6d\xe3\xe7\x82\xfb\x47\xe8\xf0\x90\xb7\xe9\x61\xd4\xd6", 215); *(uint32_t*)0x10000564 = 0xd7; *(uint32_t*)0x1000160c = 5; *(uint32_t*)0x10001610 = 0x10001500; *(uint32_t*)0x10001500 = 0x60; *(uint32_t*)0x10001504 = 0xffff; *(uint32_t*)0x10001508 = 3; *(uint32_t*)0x1000150c = r[2]; *(uint32_t*)0x10001510 = -1; *(uint32_t*)0x10001514 = r[3]; *(uint32_t*)0x10001518 = 0; *(uint16_t*)0x1000151c = 0x10; *(uint32_t*)0x10001520 = 0; *(uint32_t*)0x10001524 = 0; *(uint32_t*)0x10001528 = -1; *(uint32_t*)0x1000152c = -1; *(uint32_t*)0x10001530 = 0; *(uint32_t*)0x10001534 = -1; *(uint32_t*)0x10001538 = -1; *(uint32_t*)0x1000153c = -1; *(uint32_t*)0x10001540 = 0; *(uint32_t*)0x10001544 = 0; *(uint32_t*)0x10001548 = 0; *(uint32_t*)0x1000154c = -1; *(uint32_t*)0x10001550 = -1; *(uint32_t*)0x10001554 = 0; *(uint32_t*)0x10001558 = -1; *(uint32_t*)0x1000155c = 0; *(uint32_t*)0x10001560 = 0x60; *(uint32_t*)0x10001564 = 0xffff; *(uint32_t*)0x10001568 = 3; *(uint32_t*)0x1000156c = 0; *(uint32_t*)0x10001570 = 0; *(uint32_t*)0x10001574 = 0; *(uint32_t*)0x10001578 = -1; *(uint16_t*)0x1000157c = 0x10; *(uint32_t*)0x10001580 = 0; *(uint32_t*)0x10001584 = -1; *(uint32_t*)0x10001588 = 0; *(uint32_t*)0x1000158c = -1; *(uint32_t*)0x10001590 = -1; *(uint32_t*)0x10001594 = -1; *(uint32_t*)0x10001598 = -1; *(uint32_t*)0x1000159c = 0; *(uint32_t*)0x100015a0 = 0; *(uint32_t*)0x100015a4 = 0; *(uint32_t*)0x100015a8 = 0; *(uint32_t*)0x100015ac = 0; *(uint32_t*)0x100015b0 = -1; *(uint32_t*)0x100015b4 = 0; *(uint32_t*)0x100015b8 = 0; *(uint32_t*)0x100015bc = 0; *(uint32_t*)0x100015c0 = 0x30; *(uint32_t*)0x100015c4 = 0xffff; *(uint32_t*)0x100015c8 = 1; *(uint32_t*)0x100015cc = r[0]; *(uint32_t*)0x100015d0 = -1; *(uint32_t*)0x100015d4 = r[0]; *(uint32_t*)0x100015d8 = r[0]; *(uint32_t*)0x100015dc = r[0]; *(uint32_t*)0x100015e0 = r[0]; *(uint32_t*)0x100015e4 = r[0]; *(uint32_t*)0x100015e8 = 0xffffff9c; *(uint32_t*)0x100015ec = -1; *(uint32_t*)0x10001614 = 0xf0; *(uint32_t*)0x10001618 = 0x20080; syscall(SYS_sendmsg, (intptr_t)r[1], 0x10001600, 0xc); break; case 10: memcpy((void*)0x10000080, "\x0f\x0f\xb6\x9b\x09\x75\x79\xbf\x2e\xf0\x0f\xc7\x0f\xc4\xe3\x15\x06\x50\x13\x7f\x0f\x2f\x06\xc4\xe3\xf9\x63\x26\x00\xc4\xe1\x17\x5c\x1f\x67\x26\x0f\x72\xd1\x0d\x66\x9d\x0f\x71\xd6\x00\xd9\xe9", 48); syz_execute_func(0x10000080); break; } } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); setup_fault(); use_temporary_dir(); loop(); return 0; } :194:13: error: unused function 'csum_inet_init' [-Werror,-Wunused-function] static void csum_inet_init(struct csum_inet* csum) ^ :199:13: error: unused function 'csum_inet_update' [-Werror,-Wunused-function] static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) ^ :212:17: error: unused function 'csum_inet_digest' [-Werror,-Wunused-function] static uint16_t csum_inet_digest(struct csum_inet* csum) ^ 3 errors generated. compiler invocation: clang [-o /tmp/syz-executor992085818 -DGOOS_freebsd=1 -DGOARCH_386=1 -DHOSTGOOS_freebsd=1 -x c - -m32 -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -static -lc++ -Wno-overflow] --- FAIL: TestGenerate/freebsd/386/0 (0.77s) csource_test.go:118: opts: {Threaded:false Collide:false Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Fault:false FaultCall:0 FaultNth:0}} program: r0 = kqueue() (fail_nth: 1) fcntl$setflags(r0, 0x2, 0x0) read(r0, &(0x7f0000000000)=""/57, 0x39) setsockopt$inet6_MCAST_LEAVE_GROUP(0xffffffffffffffff, 0x29, 0x51, &(0x7f0000000040)={0x4, {{0x1c, 0x1c, 0x3, 0x75, @empty, 0xdf52}}}, 0x80) fchmod(0xffffffffffffff9c, 0x80) sendto(0xffffffffffffffff, &(0x7f00000000c0)="f0da4f00d39f1b4de86997bbdb3642450da90dcb26fb91c90f629a8580f5f8e881e0469647607522dc805eb5953ea8ad5a75762736cc9f085952176a0744e839592e0687f16d3e", 0x47, 0x20188, 0x0, 0x0) r1 = accept$unix(0xffffffffffffff9c, 0x0, &(0x7f0000000140)) r2 = getppid() fhstatfs(&(0x7f0000000580)={{[0x4eecdb2d, 0x1]}, {0x100, 0x0, "35e5cf9585f49451ade1873fb93826b9"}}, &(0x7f00000005c0)={0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, [], 0x0, 0x0}) sendmsg$unix(r1, &(0x7f0000001600)={&(0x7f0000000180)=@file={0xa, 0x1, './file0\x00'}, 0xa, &(0x7f0000000540)=[{&(0x7f00000001c0)="6bca7e1c896c8d761e48bc4178d227d4cb149ce2bb7d220b8e3e2e9b91deb21446621bf63ff2cbafd4eb9bcf8a7a26bc51c3734e185d756053476d04b0cb4adf6290c5f17e2600256db3eb864c7d3e66a5bb274ddf980ddb34efccffbcfe5531ecf61f2b53689e295f91d655a694569d71732f", 0x73}, {&(0x7f0000000240)="d332313be24143da4f255aab51123847fa7632f17cf3ee7431c84243b3ee924d67b53776df412e0c9e81dd63a89e0f393bca1795193b56851b889cda6d366453d3aace82c4b8eef7afdd8e8c7a5a29770f5c3c56e76f6a40e8fed28a9a4c35321e5bb413d7a2e7e6b6069cf7a8627f5dcb48d6890d34de511381631513cdaf7ad4af86095e256a9d81a8a1b6fc30656275019b95f7b77c17c0b548d08892b49445e38143d778ba", 0xa7}, {&(0x7f0000000300)="0440076fd2f8b64040b380087d2a5cab89fc98dfdfb13e3cfe530d18dc89f18bbab2189b046cc1fd862fc07c58f4f09ed364141f765a72f0", 0x38}, {&(0x7f0000000340)="a9061fb6bd05bc02e579811704f0bf7492eacbc4d15131c6614ec9162c22420e80efdfa25a98d29e9ed2191a86e0b0a5590791a2231fe30bc005cf55c0cebd006873d9a3b94f03dfe9c1c886642a40b76c021a465aa1e2f1aee0fb487ccfda4058b264e5262f2edc7a0ed5a5dc94e5c31c222211b1e23168973789f5ed5d8d1728fe2e5e4694197a749b3505bd7602fb413aa3c2ec48e20452704b84c6d99f986fcf64d109794c97f31445c13524a9e6de832033c0514e1072a68c9941a1a3ee4acee71e059d8129b7983c85b222ffcd1fa3ba670d756fa1bdc53cccacba3b6de4d24e316fe0c6a2", 0xe8}, {&(0x7f0000000440)="b8afd9014ee3d8a83ab8c8eaa64cdb5f0e70fc6e3adf08ba675c6852819d8b03d19039245b607b2ef381d2a19fbe629b8da6421e5a05719de00b336c2805541979ea17bd1299fb169cf41e0b21b6fb477a6ecd4db55625517105b3e5d489e705f4c373ba434ce6b24048757651be81cea4ba53f73f746b584b3250c10e44177f25a80da62fe6ec0801569a5fdcd021e107d618772707f772486c5c3343a0df31ff28ded980069c30f6a08a48080dc203eb3c3456432a4dd9249f50f180138bab159c5bf3dbeff5ebec6de3e782fb47e8f090b7e961d4d6", 0xd7}], 0x5, &(0x7f0000001500)=[@cred={0x60, 0xffff, 0x3, r2, 0xffffffffffffffff, r3, 0x0, 0x10, [0x0, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xffffffffffffffff]}, @cred={0x60, 0xffff, 0x3, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0x10, [0x0, 0xffffffffffffffff, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffffffffffff]}, @rights={0x30, 0xffff, 0x1, [r0, 0xffffffffffffffff, r0, r0, r0, r0, r0, 0xffffffffffffff9c, 0xffffffffffffffff]}], 0xf0, 0x20080}, 0xc) syz_emit_ethernet(0x7e, &(0x7f0000000000)={@broadcast, @broadcast, [], {@ipv4={0x800, {{0x11, 0x4, 0x0, 0x9, 0x70, 0x65, 0xfff, 0x1, 0x45, 0x0, @empty, @empty, {[@rr={0x7, 0x27, 0x42, [@broadcast, @remote={0xac, 0x14, 0x0}, @local={0xac, 0x14, 0x0}, @multicast1, @remote={0xac, 0x14, 0x0}, @multicast2, @multicast1, @loopback, @broadcast]}, @generic={0x88, 0x6, "4e65f765"}]}}, @generic="28a61f895fbbf527b3987a02bb0dbc5f2d9e8fc684889186b7e0347c358ba58238965531ac7b77908372d8c3"}}}}) syz_execute_func(&(0x7f0000000080)="0f0fb69b097579bf2ef00fc70fc4e3150650137f0f2f06c4e3f9632600c4e1175c1f67260f72d10d669d0f71d600d9e9") syz_extract_tcp_res(&(0x7f00000000c0), 0x4, 0x0) csource_test.go:119: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void __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); if (rmdir(dir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } #define BITMASK(bf_off,bf_len) (((1ull << (bf_len)) - 1) << (bf_off)) #define STORE_BY_BITMASK(type,htobe,addr,val,bf_off,bf_len) *(type*)(addr) = htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len)))) struct csum_inet { uint32_t acc; }; static void csum_inet_init(struct csum_inet* csum) { csum->acc = 0; } static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) { if (length == 0) return; size_t i = 0; for (; i < length - 1; i += 2) csum->acc += *(uint16_t*)&data[i]; if (length & 1) csum->acc += le16toh((uint16_t)data[length - 1]); while (csum->acc > 0xffff) csum->acc = (csum->acc & 0xffff) + (csum->acc >> 16); } static uint16_t csum_inet_digest(struct csum_inet* csum) { return ~csum->acc; } static void sandbox_common() { if (setsid() == -1) exit(1); struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 8 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 0; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); } static void loop(); static int do_sandbox_none(void) { sandbox_common(); loop(); return 0; } static long syz_execute_func(volatile long text) { ((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; inject_fault(1); res = syscall(SYS_kqueue); if (res != -1) r[0] = res; syscall(SYS_fcntl, (intptr_t)r[0], 2, 0); syscall(SYS_read, (intptr_t)r[0], 0x10000000, 0x39); *(uint32_t*)0x10000040 = 4; *(uint8_t*)0x10000044 = 0x1c; *(uint8_t*)0x10000045 = 0x1c; *(uint16_t*)0x10000046 = htobe16(0x4e23); *(uint32_t*)0x10000048 = 0x75; memset((void*)0x1000004c, 0, 16); *(uint32_t*)0x1000005c = 0xdf52; memset((void*)0x10000060, 0, 96); syscall(SYS_setsockopt, -1, 0x29, 0x51, 0x10000040, 0x80); syscall(SYS_fchmod, 0xffffff9c, 0x80); memcpy((void*)0x100000c0, "\xf0\xda\x4f\x00\xd3\x9f\x1b\x4d\xe8\x69\x97\xbb\xdb\x36\x42\x45\x0d\xa9\x0d\xcb\x26\xfb\x91\xc9\x0f\x62\x9a\x85\x80\xf5\xf8\xe8\x81\xe0\x46\x96\x47\x60\x75\x22\xdc\x80\x5e\xb5\x95\x3e\xa8\xad\x5a\x75\x76\x27\x36\xcc\x9f\x08\x59\x52\x17\x6a\x07\x44\xe8\x39\x59\x2e\x06\x87\xf1\x6d\x3e", 71); syscall(SYS_sendto, -1, 0x100000c0, 0x47, 0x20188, 0, 0); *(uint32_t*)0x10000140 = 0; res = syscall(SYS_accept, 0xffffff9c, 0, 0x10000140); if (res != -1) r[1] = res; res = syscall(SYS_getppid); if (res != -1) r[2] = res; *(uint32_t*)0x10000580 = 0x4eecdb2d; *(uint32_t*)0x10000584 = 1; *(uint16_t*)0x10000588 = 0x100; *(uint16_t*)0x1000058a = 0; memcpy((void*)0x1000058c, "\x35\xe5\xcf\x95\x85\xf4\x94\x51\xad\xe1\x87\x3f\xb9\x38\x26\xb9", 16); res = syscall(SYS_fhstatfs, 0x10000580, 0x100005c0); if (res != -1) r[3] = *(uint32_t*)0x1000067c; *(uint32_t*)0x10001600 = 0x10000180; *(uint8_t*)0x10000180 = 0xa; *(uint8_t*)0x10000181 = 1; memcpy((void*)0x10000182, "./file0\000", 8); *(uint32_t*)0x10001604 = 0xa; *(uint32_t*)0x10001608 = 0x10000540; *(uint32_t*)0x10000540 = 0x100001c0; memcpy((void*)0x100001c0, "\x6b\xca\x7e\x1c\x89\x6c\x8d\x76\x1e\x48\xbc\x41\x78\xd2\x27\xd4\xcb\x14\x9c\xe2\xbb\x7d\x22\x0b\x8e\x3e\x2e\x9b\x91\xde\xb2\x14\x46\x62\x1b\xf6\x3f\xf2\xcb\xaf\xd4\xeb\x9b\xcf\x8a\x7a\x26\xbc\x51\xc3\x73\x4e\x18\x5d\x75\x60\x53\x47\x6d\x04\xb0\xcb\x4a\xdf\x62\x90\xc5\xf1\x7e\x26\x00\x25\x6d\xb3\xeb\x86\x4c\x7d\x3e\x66\xa5\xbb\x27\x4d\xdf\x98\x0d\xdb\x34\xef\xcc\xff\xbc\xfe\x55\x31\xec\xf6\x1f\x2b\x53\x68\x9e\x29\x5f\x91\xd6\x55\xa6\x94\x56\x9d\x71\x73\x2f", 115); *(uint32_t*)0x10000544 = 0x73; *(uint32_t*)0x10000548 = 0x10000240; memcpy((void*)0x10000240, "\xd3\x32\x31\x3b\xe2\x41\x43\xda\x4f\x25\x5a\xab\x51\x12\x38\x47\xfa\x76\x32\xf1\x7c\xf3\xee\x74\x31\xc8\x42\x43\xb3\xee\x92\x4d\x67\xb5\x37\x76\xdf\x41\x2e\x0c\x9e\x81\xdd\x63\xa8\x9e\x0f\x39\x3b\xca\x17\x95\x19\x3b\x56\x85\x1b\x88\x9c\xda\x6d\x36\x64\x53\xd3\xaa\xce\x82\xc4\xb8\xee\xf7\xaf\xdd\x8e\x8c\x7a\x5a\x29\x77\x0f\x5c\x3c\x56\xe7\x6f\x6a\x40\xe8\xfe\xd2\x8a\x9a\x4c\x35\x32\x1e\x5b\xb4\x13\xd7\xa2\xe7\xe6\xb6\x06\x9c\xf7\xa8\x62\x7f\x5d\xcb\x48\xd6\x89\x0d\x34\xde\x51\x13\x81\x63\x15\x13\xcd\xaf\x7a\xd4\xaf\x86\x09\x5e\x25\x6a\x9d\x81\xa8\xa1\xb6\xfc\x30\x65\x62\x75\x01\x9b\x95\xf7\xb7\x7c\x17\xc0\xb5\x48\xd0\x88\x92\xb4\x94\x45\xe3\x81\x43\xd7\x78\xba", 167); *(uint32_t*)0x1000054c = 0xa7; *(uint32_t*)0x10000550 = 0x10000300; memcpy((void*)0x10000300, "\x04\x40\x07\x6f\xd2\xf8\xb6\x40\x40\xb3\x80\x08\x7d\x2a\x5c\xab\x89\xfc\x98\xdf\xdf\xb1\x3e\x3c\xfe\x53\x0d\x18\xdc\x89\xf1\x8b\xba\xb2\x18\x9b\x04\x6c\xc1\xfd\x86\x2f\xc0\x7c\x58\xf4\xf0\x9e\xd3\x64\x14\x1f\x76\x5a\x72\xf0", 56); *(uint32_t*)0x10000554 = 0x38; *(uint32_t*)0x10000558 = 0x10000340; memcpy((void*)0x10000340, "\xa9\x06\x1f\xb6\xbd\x05\xbc\x02\xe5\x79\x81\x17\x04\xf0\xbf\x74\x92\xea\xcb\xc4\xd1\x51\x31\xc6\x61\x4e\xc9\x16\x2c\x22\x42\x0e\x80\xef\xdf\xa2\x5a\x98\xd2\x9e\x9e\xd2\x19\x1a\x86\xe0\xb0\xa5\x59\x07\x91\xa2\x23\x1f\xe3\x0b\xc0\x05\xcf\x55\xc0\xce\xbd\x00\x68\x73\xd9\xa3\xb9\x4f\x03\xdf\xe9\xc1\xc8\x86\x64\x2a\x40\xb7\x6c\x02\x1a\x46\x5a\xa1\xe2\xf1\xae\xe0\xfb\x48\x7c\xcf\xda\x40\x58\xb2\x64\xe5\x26\x2f\x2e\xdc\x7a\x0e\xd5\xa5\xdc\x94\xe5\xc3\x1c\x22\x22\x11\xb1\xe2\x31\x68\x97\x37\x89\xf5\xed\x5d\x8d\x17\x28\xfe\x2e\x5e\x46\x94\x19\x7a\x74\x9b\x35\x05\xbd\x76\x02\xfb\x41\x3a\xa3\xc2\xec\x48\xe2\x04\x52\x70\x4b\x84\xc6\xd9\x9f\x98\x6f\xcf\x64\xd1\x09\x79\x4c\x97\xf3\x14\x45\xc1\x35\x24\xa9\xe6\xde\x83\x20\x33\xc0\x51\x4e\x10\x72\xa6\x8c\x99\x41\xa1\xa3\xee\x4a\xce\xe7\x1e\x05\x9d\x81\x29\xb7\x98\x3c\x85\xb2\x22\xff\xcd\x1f\xa3\xba\x67\x0d\x75\x6f\xa1\xbd\xc5\x3c\xcc\xac\xba\x3b\x6d\xe4\xd2\x4e\x31\x6f\xe0\xc6\xa2", 232); *(uint32_t*)0x1000055c = 0xe8; *(uint32_t*)0x10000560 = 0x10000440; memcpy((void*)0x10000440, "\xb8\xaf\xd9\x01\x4e\xe3\xd8\xa8\x3a\xb8\xc8\xea\xa6\x4c\xdb\x5f\x0e\x70\xfc\x6e\x3a\xdf\x08\xba\x67\x5c\x68\x52\x81\x9d\x8b\x03\xd1\x90\x39\x24\x5b\x60\x7b\x2e\xf3\x81\xd2\xa1\x9f\xbe\x62\x9b\x8d\xa6\x42\x1e\x5a\x05\x71\x9d\xe0\x0b\x33\x6c\x28\x05\x54\x19\x79\xea\x17\xbd\x12\x99\xfb\x16\x9c\xf4\x1e\x0b\x21\xb6\xfb\x47\x7a\x6e\xcd\x4d\xb5\x56\x25\x51\x71\x05\xb3\xe5\xd4\x89\xe7\x05\xf4\xc3\x73\xba\x43\x4c\xe6\xb2\x40\x48\x75\x76\x51\xbe\x81\xce\xa4\xba\x53\xf7\x3f\x74\x6b\x58\x4b\x32\x50\xc1\x0e\x44\x17\x7f\x25\xa8\x0d\xa6\x2f\xe6\xec\x08\x01\x56\x9a\x5f\xdc\xd0\x21\xe1\x07\xd6\x18\x77\x27\x07\xf7\x72\x48\x6c\x5c\x33\x43\xa0\xdf\x31\xff\x28\xde\xd9\x80\x06\x9c\x30\xf6\xa0\x8a\x48\x08\x0d\xc2\x03\xeb\x3c\x34\x56\x43\x2a\x4d\xd9\x24\x9f\x50\xf1\x80\x13\x8b\xab\x15\x9c\x5b\xf3\xdb\xef\xf5\xeb\xec\x6d\xe3\xe7\x82\xfb\x47\xe8\xf0\x90\xb7\xe9\x61\xd4\xd6", 215); *(uint32_t*)0x10000564 = 0xd7; *(uint32_t*)0x1000160c = 5; *(uint32_t*)0x10001610 = 0x10001500; *(uint32_t*)0x10001500 = 0x60; *(uint32_t*)0x10001504 = 0xffff; *(uint32_t*)0x10001508 = 3; *(uint32_t*)0x1000150c = r[2]; *(uint32_t*)0x10001510 = -1; *(uint32_t*)0x10001514 = r[3]; *(uint32_t*)0x10001518 = 0; *(uint16_t*)0x1000151c = 0x10; *(uint32_t*)0x10001520 = 0; *(uint32_t*)0x10001524 = 0; *(uint32_t*)0x10001528 = -1; *(uint32_t*)0x1000152c = -1; *(uint32_t*)0x10001530 = 0; *(uint32_t*)0x10001534 = -1; *(uint32_t*)0x10001538 = -1; *(uint32_t*)0x1000153c = -1; *(uint32_t*)0x10001540 = 0; *(uint32_t*)0x10001544 = 0; *(uint32_t*)0x10001548 = 0; *(uint32_t*)0x1000154c = -1; *(uint32_t*)0x10001550 = -1; *(uint32_t*)0x10001554 = 0; *(uint32_t*)0x10001558 = -1; *(uint32_t*)0x1000155c = 0; *(uint32_t*)0x10001560 = 0x60; *(uint32_t*)0x10001564 = 0xffff; *(uint32_t*)0x10001568 = 3; *(uint32_t*)0x1000156c = 0; *(uint32_t*)0x10001570 = 0; *(uint32_t*)0x10001574 = 0; *(uint32_t*)0x10001578 = -1; *(uint16_t*)0x1000157c = 0x10; *(uint32_t*)0x10001580 = 0; *(uint32_t*)0x10001584 = -1; *(uint32_t*)0x10001588 = 0; *(uint32_t*)0x1000158c = -1; *(uint32_t*)0x10001590 = -1; *(uint32_t*)0x10001594 = -1; *(uint32_t*)0x10001598 = -1; *(uint32_t*)0x1000159c = 0; *(uint32_t*)0x100015a0 = 0; *(uint32_t*)0x100015a4 = 0; *(uint32_t*)0x100015a8 = 0; *(uint32_t*)0x100015ac = 0; *(uint32_t*)0x100015b0 = -1; *(uint32_t*)0x100015b4 = 0; *(uint32_t*)0x100015b8 = 0; *(uint32_t*)0x100015bc = 0; *(uint32_t*)0x100015c0 = 0x30; *(uint32_t*)0x100015c4 = 0xffff; *(uint32_t*)0x100015c8 = 1; *(uint32_t*)0x100015cc = r[0]; *(uint32_t*)0x100015d0 = -1; *(uint32_t*)0x100015d4 = r[0]; *(uint32_t*)0x100015d8 = r[0]; *(uint32_t*)0x100015dc = r[0]; *(uint32_t*)0x100015e0 = r[0]; *(uint32_t*)0x100015e4 = r[0]; *(uint32_t*)0x100015e8 = 0xffffff9c; *(uint32_t*)0x100015ec = -1; *(uint32_t*)0x10001614 = 0xf0; *(uint32_t*)0x10001618 = 0x20080; syscall(SYS_sendmsg, (intptr_t)r[1], 0x10001600, 0xc); memcpy((void*)0x10000080, "\x0f\x0f\xb6\x9b\x09\x75\x79\xbf\x2e\xf0\x0f\xc7\x0f\xc4\xe3\x15\x06\x50\x13\x7f\x0f\x2f\x06\xc4\xe3\xf9\x63\x26\x00\xc4\xe1\x17\x5c\x1f\x67\x26\x0f\x72\xd1\x0d\x66\x9d\x0f\x71\xd6\x00\xd9\xe9", 48); syz_execute_func(0x10000080); } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :105:13: error: unused function 'csum_inet_init' [-Werror,-Wunused-function] static void csum_inet_init(struct csum_inet* csum) ^ :110:13: error: unused function 'csum_inet_update' [-Werror,-Wunused-function] static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) ^ :123:17: error: unused function 'csum_inet_digest' [-Werror,-Wunused-function] static uint16_t csum_inet_digest(struct csum_inet* csum) ^ 3 errors generated. compiler invocation: clang [-o /tmp/syz-executor198115719 -DGOOS_freebsd=1 -DGOARCH_386=1 -DHOSTGOOS_freebsd=1 -x c - -m32 -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -static -lc++ -Wno-overflow] --- FAIL: TestGenerate/freebsd/386/14 (0.97s) csource_test.go:118: opts: {Threaded:true Collide:false Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false UseTmpDir:true HandleSegv:false Repro:false Trace:true LegacyOptions:{Fault:false FaultCall:0 FaultNth:0}} program: r0 = kqueue() (fail_nth: 1) fcntl$setflags(r0, 0x2, 0x0) read(r0, &(0x7f0000000000)=""/57, 0x39) setsockopt$inet6_MCAST_LEAVE_GROUP(0xffffffffffffffff, 0x29, 0x51, &(0x7f0000000040)={0x4, {{0x1c, 0x1c, 0x3, 0x75, @empty, 0xdf52}}}, 0x80) fchmod(0xffffffffffffff9c, 0x80) sendto(0xffffffffffffffff, &(0x7f00000000c0)="f0da4f00d39f1b4de86997bbdb3642450da90dcb26fb91c90f629a8580f5f8e881e0469647607522dc805eb5953ea8ad5a75762736cc9f085952176a0744e839592e0687f16d3e", 0x47, 0x20188, 0x0, 0x0) r1 = accept$unix(0xffffffffffffff9c, 0x0, &(0x7f0000000140)) r2 = getppid() fhstatfs(&(0x7f0000000580)={{[0x4eecdb2d, 0x1]}, {0x100, 0x0, "35e5cf9585f49451ade1873fb93826b9"}}, &(0x7f00000005c0)={0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, [], 0x0, 0x0}) sendmsg$unix(r1, &(0x7f0000001600)={&(0x7f0000000180)=@file={0xa, 0x1, './file0\x00'}, 0xa, &(0x7f0000000540)=[{&(0x7f00000001c0)="6bca7e1c896c8d761e48bc4178d227d4cb149ce2bb7d220b8e3e2e9b91deb21446621bf63ff2cbafd4eb9bcf8a7a26bc51c3734e185d756053476d04b0cb4adf6290c5f17e2600256db3eb864c7d3e66a5bb274ddf980ddb34efccffbcfe5531ecf61f2b53689e295f91d655a694569d71732f", 0x73}, {&(0x7f0000000240)="d332313be24143da4f255aab51123847fa7632f17cf3ee7431c84243b3ee924d67b53776df412e0c9e81dd63a89e0f393bca1795193b56851b889cda6d366453d3aace82c4b8eef7afdd8e8c7a5a29770f5c3c56e76f6a40e8fed28a9a4c35321e5bb413d7a2e7e6b6069cf7a8627f5dcb48d6890d34de511381631513cdaf7ad4af86095e256a9d81a8a1b6fc30656275019b95f7b77c17c0b548d08892b49445e38143d778ba", 0xa7}, {&(0x7f0000000300)="0440076fd2f8b64040b380087d2a5cab89fc98dfdfb13e3cfe530d18dc89f18bbab2189b046cc1fd862fc07c58f4f09ed364141f765a72f0", 0x38}, {&(0x7f0000000340)="a9061fb6bd05bc02e579811704f0bf7492eacbc4d15131c6614ec9162c22420e80efdfa25a98d29e9ed2191a86e0b0a5590791a2231fe30bc005cf55c0cebd006873d9a3b94f03dfe9c1c886642a40b76c021a465aa1e2f1aee0fb487ccfda4058b264e5262f2edc7a0ed5a5dc94e5c31c222211b1e23168973789f5ed5d8d1728fe2e5e4694197a749b3505bd7602fb413aa3c2ec48e20452704b84c6d99f986fcf64d109794c97f31445c13524a9e6de832033c0514e1072a68c9941a1a3ee4acee71e059d8129b7983c85b222ffcd1fa3ba670d756fa1bdc53cccacba3b6de4d24e316fe0c6a2", 0xe8}, {&(0x7f0000000440)="b8afd9014ee3d8a83ab8c8eaa64cdb5f0e70fc6e3adf08ba675c6852819d8b03d19039245b607b2ef381d2a19fbe629b8da6421e5a05719de00b336c2805541979ea17bd1299fb169cf41e0b21b6fb477a6ecd4db55625517105b3e5d489e705f4c373ba434ce6b24048757651be81cea4ba53f73f746b584b3250c10e44177f25a80da62fe6ec0801569a5fdcd021e107d618772707f772486c5c3343a0df31ff28ded980069c30f6a08a48080dc203eb3c3456432a4dd9249f50f180138bab159c5bf3dbeff5ebec6de3e782fb47e8f090b7e961d4d6", 0xd7}], 0x5, &(0x7f0000001500)=[@cred={0x60, 0xffff, 0x3, r2, 0xffffffffffffffff, r3, 0x0, 0x10, [0x0, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xffffffffffffffff]}, @cred={0x60, 0xffff, 0x3, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0x10, [0x0, 0xffffffffffffffff, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffffffffffff]}, @rights={0x30, 0xffff, 0x1, [r0, 0xffffffffffffffff, r0, r0, r0, r0, r0, 0xffffffffffffff9c, 0xffffffffffffffff]}], 0xf0, 0x20080}, 0xc) syz_emit_ethernet(0x7e, &(0x7f0000000000)={@broadcast, @broadcast, [], {@ipv4={0x800, {{0x11, 0x4, 0x0, 0x9, 0x70, 0x65, 0xfff, 0x1, 0x45, 0x0, @empty, @empty, {[@rr={0x7, 0x27, 0x42, [@broadcast, @remote={0xac, 0x14, 0x0}, @local={0xac, 0x14, 0x0}, @multicast1, @remote={0xac, 0x14, 0x0}, @multicast2, @multicast1, @loopback, @broadcast]}, @generic={0x88, 0x6, "4e65f765"}]}}, @generic="28a61f895fbbf527b3987a02bb0dbc5f2d9e8fc684889186b7e0347c358ba58238965531ac7b77908372d8c3"}}}}) syz_execute_func(&(0x7f0000000080)="0f0fb69b097579bf2ef00fc70fc4e3150650137f0f2f06c4e3f9632600c4e1175c1f67260f72d10d669d0f71d600d9e9") syz_extract_tcp_res(&(0x7f00000000c0), 0x4, 0x0) csource_test.go:119: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void __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); if (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 BITMASK(bf_off,bf_len) (((1ull << (bf_len)) - 1) << (bf_off)) #define STORE_BY_BITMASK(type,htobe,addr,val,bf_off,bf_len) *(type*)(addr) = htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len)))) struct csum_inet { uint32_t acc; }; static void csum_inet_init(struct csum_inet* csum) { csum->acc = 0; } static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) { if (length == 0) return; size_t i = 0; for (; i < length - 1; i += 2) csum->acc += *(uint16_t*)&data[i]; if (length & 1) csum->acc += le16toh((uint16_t)data[length - 1]); while (csum->acc > 0xffff) csum->acc = (csum->acc & 0xffff) + (csum->acc >> 16); } static uint16_t csum_inet_digest(struct csum_inet* csum) { return ~csum->acc; } static void sandbox_common() { struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 8 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 0; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); } static void loop(); static int do_sandbox_none(void) { sandbox_common(); loop(); return 0; } static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { fprintf(stderr, "### start\n"); int i, call, thread; for (call = 0; call < 13; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); event_timedwait(&th->done, 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: inject_fault(1); res = syscall(SYS_kqueue); fprintf(stderr, "### call=0 errno=%u\n", res == -1 ? errno : 0); if (res != -1) r[0] = res; break; case 1: res = syscall(SYS_fcntl, (intptr_t)r[0], 2, 0); fprintf(stderr, "### call=1 errno=%u\n", res == -1 ? errno : 0); break; case 2: res = syscall(SYS_read, (intptr_t)r[0], 0x10000000, 0x39); fprintf(stderr, "### call=2 errno=%u\n", res == -1 ? errno : 0); break; case 3: *(uint32_t*)0x10000040 = 4; *(uint8_t*)0x10000044 = 0x1c; *(uint8_t*)0x10000045 = 0x1c; *(uint16_t*)0x10000046 = htobe16(0x4e23); *(uint32_t*)0x10000048 = 0x75; memset((void*)0x1000004c, 0, 16); *(uint32_t*)0x1000005c = 0xdf52; memset((void*)0x10000060, 0, 96); res = syscall(SYS_setsockopt, -1, 0x29, 0x51, 0x10000040, 0x80); fprintf(stderr, "### call=3 errno=%u\n", res == -1 ? errno : 0); break; case 4: res = syscall(SYS_fchmod, 0xffffff9c, 0x80); fprintf(stderr, "### call=4 errno=%u\n", res == -1 ? errno : 0); break; case 5: memcpy((void*)0x100000c0, "\xf0\xda\x4f\x00\xd3\x9f\x1b\x4d\xe8\x69\x97\xbb\xdb\x36\x42\x45\x0d\xa9\x0d\xcb\x26\xfb\x91\xc9\x0f\x62\x9a\x85\x80\xf5\xf8\xe8\x81\xe0\x46\x96\x47\x60\x75\x22\xdc\x80\x5e\xb5\x95\x3e\xa8\xad\x5a\x75\x76\x27\x36\xcc\x9f\x08\x59\x52\x17\x6a\x07\x44\xe8\x39\x59\x2e\x06\x87\xf1\x6d\x3e", 71); res = syscall(SYS_sendto, -1, 0x100000c0, 0x47, 0x20188, 0, 0); fprintf(stderr, "### call=5 errno=%u\n", res == -1 ? errno : 0); break; case 6: *(uint32_t*)0x10000140 = 0; res = syscall(SYS_accept, 0xffffff9c, 0, 0x10000140); fprintf(stderr, "### call=6 errno=%u\n", res == -1 ? errno : 0); if (res != -1) r[1] = res; break; case 7: res = syscall(SYS_getppid); fprintf(stderr, "### call=7 errno=%u\n", res == -1 ? errno : 0); if (res != -1) r[2] = res; break; case 8: *(uint32_t*)0x10000580 = 0x4eecdb2d; *(uint32_t*)0x10000584 = 1; *(uint16_t*)0x10000588 = 0x100; *(uint16_t*)0x1000058a = 0; memcpy((void*)0x1000058c, "\x35\xe5\xcf\x95\x85\xf4\x94\x51\xad\xe1\x87\x3f\xb9\x38\x26\xb9", 16); res = syscall(SYS_fhstatfs, 0x10000580, 0x100005c0); fprintf(stderr, "### call=8 errno=%u\n", res == -1 ? errno : 0); if (res != -1) r[3] = *(uint32_t*)0x1000067c; break; case 9: *(uint32_t*)0x10001600 = 0x10000180; *(uint8_t*)0x10000180 = 0xa; *(uint8_t*)0x10000181 = 1; memcpy((void*)0x10000182, "./file0\000", 8); *(uint32_t*)0x10001604 = 0xa; *(uint32_t*)0x10001608 = 0x10000540; *(uint32_t*)0x10000540 = 0x100001c0; memcpy((void*)0x100001c0, "\x6b\xca\x7e\x1c\x89\x6c\x8d\x76\x1e\x48\xbc\x41\x78\xd2\x27\xd4\xcb\x14\x9c\xe2\xbb\x7d\x22\x0b\x8e\x3e\x2e\x9b\x91\xde\xb2\x14\x46\x62\x1b\xf6\x3f\xf2\xcb\xaf\xd4\xeb\x9b\xcf\x8a\x7a\x26\xbc\x51\xc3\x73\x4e\x18\x5d\x75\x60\x53\x47\x6d\x04\xb0\xcb\x4a\xdf\x62\x90\xc5\xf1\x7e\x26\x00\x25\x6d\xb3\xeb\x86\x4c\x7d\x3e\x66\xa5\xbb\x27\x4d\xdf\x98\x0d\xdb\x34\xef\xcc\xff\xbc\xfe\x55\x31\xec\xf6\x1f\x2b\x53\x68\x9e\x29\x5f\x91\xd6\x55\xa6\x94\x56\x9d\x71\x73\x2f", 115); *(uint32_t*)0x10000544 = 0x73; *(uint32_t*)0x10000548 = 0x10000240; memcpy((void*)0x10000240, "\xd3\x32\x31\x3b\xe2\x41\x43\xda\x4f\x25\x5a\xab\x51\x12\x38\x47\xfa\x76\x32\xf1\x7c\xf3\xee\x74\x31\xc8\x42\x43\xb3\xee\x92\x4d\x67\xb5\x37\x76\xdf\x41\x2e\x0c\x9e\x81\xdd\x63\xa8\x9e\x0f\x39\x3b\xca\x17\x95\x19\x3b\x56\x85\x1b\x88\x9c\xda\x6d\x36\x64\x53\xd3\xaa\xce\x82\xc4\xb8\xee\xf7\xaf\xdd\x8e\x8c\x7a\x5a\x29\x77\x0f\x5c\x3c\x56\xe7\x6f\x6a\x40\xe8\xfe\xd2\x8a\x9a\x4c\x35\x32\x1e\x5b\xb4\x13\xd7\xa2\xe7\xe6\xb6\x06\x9c\xf7\xa8\x62\x7f\x5d\xcb\x48\xd6\x89\x0d\x34\xde\x51\x13\x81\x63\x15\x13\xcd\xaf\x7a\xd4\xaf\x86\x09\x5e\x25\x6a\x9d\x81\xa8\xa1\xb6\xfc\x30\x65\x62\x75\x01\x9b\x95\xf7\xb7\x7c\x17\xc0\xb5\x48\xd0\x88\x92\xb4\x94\x45\xe3\x81\x43\xd7\x78\xba", 167); *(uint32_t*)0x1000054c = 0xa7; *(uint32_t*)0x10000550 = 0x10000300; memcpy((void*)0x10000300, "\x04\x40\x07\x6f\xd2\xf8\xb6\x40\x40\xb3\x80\x08\x7d\x2a\x5c\xab\x89\xfc\x98\xdf\xdf\xb1\x3e\x3c\xfe\x53\x0d\x18\xdc\x89\xf1\x8b\xba\xb2\x18\x9b\x04\x6c\xc1\xfd\x86\x2f\xc0\x7c\x58\xf4\xf0\x9e\xd3\x64\x14\x1f\x76\x5a\x72\xf0", 56); *(uint32_t*)0x10000554 = 0x38; *(uint32_t*)0x10000558 = 0x10000340; memcpy((void*)0x10000340, "\xa9\x06\x1f\xb6\xbd\x05\xbc\x02\xe5\x79\x81\x17\x04\xf0\xbf\x74\x92\xea\xcb\xc4\xd1\x51\x31\xc6\x61\x4e\xc9\x16\x2c\x22\x42\x0e\x80\xef\xdf\xa2\x5a\x98\xd2\x9e\x9e\xd2\x19\x1a\x86\xe0\xb0\xa5\x59\x07\x91\xa2\x23\x1f\xe3\x0b\xc0\x05\xcf\x55\xc0\xce\xbd\x00\x68\x73\xd9\xa3\xb9\x4f\x03\xdf\xe9\xc1\xc8\x86\x64\x2a\x40\xb7\x6c\x02\x1a\x46\x5a\xa1\xe2\xf1\xae\xe0\xfb\x48\x7c\xcf\xda\x40\x58\xb2\x64\xe5\x26\x2f\x2e\xdc\x7a\x0e\xd5\xa5\xdc\x94\xe5\xc3\x1c\x22\x22\x11\xb1\xe2\x31\x68\x97\x37\x89\xf5\xed\x5d\x8d\x17\x28\xfe\x2e\x5e\x46\x94\x19\x7a\x74\x9b\x35\x05\xbd\x76\x02\xfb\x41\x3a\xa3\xc2\xec\x48\xe2\x04\x52\x70\x4b\x84\xc6\xd9\x9f\x98\x6f\xcf\x64\xd1\x09\x79\x4c\x97\xf3\x14\x45\xc1\x35\x24\xa9\xe6\xde\x83\x20\x33\xc0\x51\x4e\x10\x72\xa6\x8c\x99\x41\xa1\xa3\xee\x4a\xce\xe7\x1e\x05\x9d\x81\x29\xb7\x98\x3c\x85\xb2\x22\xff\xcd\x1f\xa3\xba\x67\x0d\x75\x6f\xa1\xbd\xc5\x3c\xcc\xac\xba\x3b\x6d\xe4\xd2\x4e\x31\x6f\xe0\xc6\xa2", 232); *(uint32_t*)0x1000055c = 0xe8; *(uint32_t*)0x10000560 = 0x10000440; memcpy((void*)0x10000440, "\xb8\xaf\xd9\x01\x4e\xe3\xd8\xa8\x3a\xb8\xc8\xea\xa6\x4c\xdb\x5f\x0e\x70\xfc\x6e\x3a\xdf\x08\xba\x67\x5c\x68\x52\x81\x9d\x8b\x03\xd1\x90\x39\x24\x5b\x60\x7b\x2e\xf3\x81\xd2\xa1\x9f\xbe\x62\x9b\x8d\xa6\x42\x1e\x5a\x05\x71\x9d\xe0\x0b\x33\x6c\x28\x05\x54\x19\x79\xea\x17\xbd\x12\x99\xfb\x16\x9c\xf4\x1e\x0b\x21\xb6\xfb\x47\x7a\x6e\xcd\x4d\xb5\x56\x25\x51\x71\x05\xb3\xe5\xd4\x89\xe7\x05\xf4\xc3\x73\xba\x43\x4c\xe6\xb2\x40\x48\x75\x76\x51\xbe\x81\xce\xa4\xba\x53\xf7\x3f\x74\x6b\x58\x4b\x32\x50\xc1\x0e\x44\x17\x7f\x25\xa8\x0d\xa6\x2f\xe6\xec\x08\x01\x56\x9a\x5f\xdc\xd0\x21\xe1\x07\xd6\x18\x77\x27\x07\xf7\x72\x48\x6c\x5c\x33\x43\xa0\xdf\x31\xff\x28\xde\xd9\x80\x06\x9c\x30\xf6\xa0\x8a\x48\x08\x0d\xc2\x03\xeb\x3c\x34\x56\x43\x2a\x4d\xd9\x24\x9f\x50\xf1\x80\x13\x8b\xab\x15\x9c\x5b\xf3\xdb\xef\xf5\xeb\xec\x6d\xe3\xe7\x82\xfb\x47\xe8\xf0\x90\xb7\xe9\x61\xd4\xd6", 215); *(uint32_t*)0x10000564 = 0xd7; *(uint32_t*)0x1000160c = 5; *(uint32_t*)0x10001610 = 0x10001500; *(uint32_t*)0x10001500 = 0x60; *(uint32_t*)0x10001504 = 0xffff; *(uint32_t*)0x10001508 = 3; *(uint32_t*)0x1000150c = r[2]; *(uint32_t*)0x10001510 = -1; *(uint32_t*)0x10001514 = r[3]; *(uint32_t*)0x10001518 = 0; *(uint16_t*)0x1000151c = 0x10; *(uint32_t*)0x10001520 = 0; *(uint32_t*)0x10001524 = 0; *(uint32_t*)0x10001528 = -1; *(uint32_t*)0x1000152c = -1; *(uint32_t*)0x10001530 = 0; *(uint32_t*)0x10001534 = -1; *(uint32_t*)0x10001538 = -1; *(uint32_t*)0x1000153c = -1; *(uint32_t*)0x10001540 = 0; *(uint32_t*)0x10001544 = 0; *(uint32_t*)0x10001548 = 0; *(uint32_t*)0x1000154c = -1; *(uint32_t*)0x10001550 = -1; *(uint32_t*)0x10001554 = 0; *(uint32_t*)0x10001558 = -1; *(uint32_t*)0x1000155c = 0; *(uint32_t*)0x10001560 = 0x60; *(uint32_t*)0x10001564 = 0xffff; *(uint32_t*)0x10001568 = 3; *(uint32_t*)0x1000156c = 0; *(uint32_t*)0x10001570 = 0; *(uint32_t*)0x10001574 = 0; *(uint32_t*)0x10001578 = -1; *(uint16_t*)0x1000157c = 0x10; *(uint32_t*)0x10001580 = 0; *(uint32_t*)0x10001584 = -1; *(uint32_t*)0x10001588 = 0; *(uint32_t*)0x1000158c = -1; *(uint32_t*)0x10001590 = -1; *(uint32_t*)0x10001594 = -1; *(uint32_t*)0x10001598 = -1; *(uint32_t*)0x1000159c = 0; *(uint32_t*)0x100015a0 = 0; *(uint32_t*)0x100015a4 = 0; *(uint32_t*)0x100015a8 = 0; *(uint32_t*)0x100015ac = 0; *(uint32_t*)0x100015b0 = -1; *(uint32_t*)0x100015b4 = 0; *(uint32_t*)0x100015b8 = 0; *(uint32_t*)0x100015bc = 0; *(uint32_t*)0x100015c0 = 0x30; *(uint32_t*)0x100015c4 = 0xffff; *(uint32_t*)0x100015c8 = 1; *(uint32_t*)0x100015cc = r[0]; *(uint32_t*)0x100015d0 = -1; *(uint32_t*)0x100015d4 = r[0]; *(uint32_t*)0x100015d8 = r[0]; *(uint32_t*)0x100015dc = r[0]; *(uint32_t*)0x100015e0 = r[0]; *(uint32_t*)0x100015e4 = r[0]; *(uint32_t*)0x100015e8 = 0xffffff9c; *(uint32_t*)0x100015ec = -1; *(uint32_t*)0x10001614 = 0xf0; *(uint32_t*)0x10001618 = 0x20080; res = syscall(SYS_sendmsg, (intptr_t)r[1], 0x10001600, 0xc); fprintf(stderr, "### call=9 errno=%u\n", res == -1 ? errno : 0); break; case 10: memcpy((void*)0x10000080, "\x0f\x0f\xb6\x9b\x09\x75\x79\xbf\x2e\xf0\x0f\xc7\x0f\xc4\xe3\x15\x06\x50\x13\x7f\x0f\x2f\x06\xc4\xe3\xf9\x63\x26\x00\xc4\xe1\x17\x5c\x1f\x67\x26\x0f\x72\xd1\x0d\x66\x9d\x0f\x71\xd6\x00\xd9\xe9", 48); res = -1; errno = EFAULT; res = syz_execute_func(0x10000080); fprintf(stderr, "### call=10 errno=%u\n", res == -1 ? errno : 0); break; } } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :195:13: error: unused function 'csum_inet_init' [-Werror,-Wunused-function] static void csum_inet_init(struct csum_inet* csum) ^ :200:13: error: unused function 'csum_inet_update' [-Werror,-Wunused-function] static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) ^ :213:17: error: unused function 'csum_inet_digest' [-Werror,-Wunused-function] static uint16_t csum_inet_digest(struct csum_inet* csum) ^ 3 errors generated. compiler invocation: clang [-o /tmp/syz-executor993808721 -DGOOS_freebsd=1 -DGOARCH_386=1 -DHOSTGOOS_freebsd=1 -x c - -m32 -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -static -lc++ -Wno-overflow] --- FAIL: TestGenerate/freebsd/386/13 (1.23s) csource_test.go:118: opts: {Threaded:true Collide:false Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false UseTmpDir:true HandleSegv:false Repro:true Trace:false LegacyOptions:{Fault:false FaultCall:0 FaultNth:0}} program: r0 = kqueue() (fail_nth: 1) fcntl$setflags(r0, 0x2, 0x0) read(r0, &(0x7f0000000000)=""/57, 0x39) setsockopt$inet6_MCAST_LEAVE_GROUP(0xffffffffffffffff, 0x29, 0x51, &(0x7f0000000040)={0x4, {{0x1c, 0x1c, 0x3, 0x75, @empty, 0xdf52}}}, 0x80) fchmod(0xffffffffffffff9c, 0x80) sendto(0xffffffffffffffff, &(0x7f00000000c0)="f0da4f00d39f1b4de86997bbdb3642450da90dcb26fb91c90f629a8580f5f8e881e0469647607522dc805eb5953ea8ad5a75762736cc9f085952176a0744e839592e0687f16d3e", 0x47, 0x20188, 0x0, 0x0) r1 = accept$unix(0xffffffffffffff9c, 0x0, &(0x7f0000000140)) r2 = getppid() fhstatfs(&(0x7f0000000580)={{[0x4eecdb2d, 0x1]}, {0x100, 0x0, "35e5cf9585f49451ade1873fb93826b9"}}, &(0x7f00000005c0)={0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, [], 0x0, 0x0}) sendmsg$unix(r1, &(0x7f0000001600)={&(0x7f0000000180)=@file={0xa, 0x1, './file0\x00'}, 0xa, &(0x7f0000000540)=[{&(0x7f00000001c0)="6bca7e1c896c8d761e48bc4178d227d4cb149ce2bb7d220b8e3e2e9b91deb21446621bf63ff2cbafd4eb9bcf8a7a26bc51c3734e185d756053476d04b0cb4adf6290c5f17e2600256db3eb864c7d3e66a5bb274ddf980ddb34efccffbcfe5531ecf61f2b53689e295f91d655a694569d71732f", 0x73}, {&(0x7f0000000240)="d332313be24143da4f255aab51123847fa7632f17cf3ee7431c84243b3ee924d67b53776df412e0c9e81dd63a89e0f393bca1795193b56851b889cda6d366453d3aace82c4b8eef7afdd8e8c7a5a29770f5c3c56e76f6a40e8fed28a9a4c35321e5bb413d7a2e7e6b6069cf7a8627f5dcb48d6890d34de511381631513cdaf7ad4af86095e256a9d81a8a1b6fc30656275019b95f7b77c17c0b548d08892b49445e38143d778ba", 0xa7}, {&(0x7f0000000300)="0440076fd2f8b64040b380087d2a5cab89fc98dfdfb13e3cfe530d18dc89f18bbab2189b046cc1fd862fc07c58f4f09ed364141f765a72f0", 0x38}, {&(0x7f0000000340)="a9061fb6bd05bc02e579811704f0bf7492eacbc4d15131c6614ec9162c22420e80efdfa25a98d29e9ed2191a86e0b0a5590791a2231fe30bc005cf55c0cebd006873d9a3b94f03dfe9c1c886642a40b76c021a465aa1e2f1aee0fb487ccfda4058b264e5262f2edc7a0ed5a5dc94e5c31c222211b1e23168973789f5ed5d8d1728fe2e5e4694197a749b3505bd7602fb413aa3c2ec48e20452704b84c6d99f986fcf64d109794c97f31445c13524a9e6de832033c0514e1072a68c9941a1a3ee4acee71e059d8129b7983c85b222ffcd1fa3ba670d756fa1bdc53cccacba3b6de4d24e316fe0c6a2", 0xe8}, {&(0x7f0000000440)="b8afd9014ee3d8a83ab8c8eaa64cdb5f0e70fc6e3adf08ba675c6852819d8b03d19039245b607b2ef381d2a19fbe629b8da6421e5a05719de00b336c2805541979ea17bd1299fb169cf41e0b21b6fb477a6ecd4db55625517105b3e5d489e705f4c373ba434ce6b24048757651be81cea4ba53f73f746b584b3250c10e44177f25a80da62fe6ec0801569a5fdcd021e107d618772707f772486c5c3343a0df31ff28ded980069c30f6a08a48080dc203eb3c3456432a4dd9249f50f180138bab159c5bf3dbeff5ebec6de3e782fb47e8f090b7e961d4d6", 0xd7}], 0x5, &(0x7f0000001500)=[@cred={0x60, 0xffff, 0x3, r2, 0xffffffffffffffff, r3, 0x0, 0x10, [0x0, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xffffffffffffffff]}, @cred={0x60, 0xffff, 0x3, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0x10, [0x0, 0xffffffffffffffff, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffffffffffff]}, @rights={0x30, 0xffff, 0x1, [r0, 0xffffffffffffffff, r0, r0, r0, r0, r0, 0xffffffffffffff9c, 0xffffffffffffffff]}], 0xf0, 0x20080}, 0xc) syz_emit_ethernet(0x7e, &(0x7f0000000000)={@broadcast, @broadcast, [], {@ipv4={0x800, {{0x11, 0x4, 0x0, 0x9, 0x70, 0x65, 0xfff, 0x1, 0x45, 0x0, @empty, @empty, {[@rr={0x7, 0x27, 0x42, [@broadcast, @remote={0xac, 0x14, 0x0}, @local={0xac, 0x14, 0x0}, @multicast1, @remote={0xac, 0x14, 0x0}, @multicast2, @multicast1, @loopback, @broadcast]}, @generic={0x88, 0x6, "4e65f765"}]}}, @generic="28a61f895fbbf527b3987a02bb0dbc5f2d9e8fc684889186b7e0347c358ba58238965531ac7b77908372d8c3"}}}}) syz_execute_func(&(0x7f0000000080)="0f0fb69b097579bf2ef00fc70fc4e3150650137f0f2f06c4e3f9632600c4e1175c1f67260f72d10d669d0f71d600d9e9") syz_extract_tcp_res(&(0x7f00000000c0), 0x4, 0x0) csource_test.go:119: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void __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); if (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 BITMASK(bf_off,bf_len) (((1ull << (bf_len)) - 1) << (bf_off)) #define STORE_BY_BITMASK(type,htobe,addr,val,bf_off,bf_len) *(type*)(addr) = htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len)))) struct csum_inet { uint32_t acc; }; static void csum_inet_init(struct csum_inet* csum) { csum->acc = 0; } static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) { if (length == 0) return; size_t i = 0; for (; i < length - 1; i += 2) csum->acc += *(uint16_t*)&data[i]; if (length & 1) csum->acc += le16toh((uint16_t)data[length - 1]); while (csum->acc > 0xffff) csum->acc = (csum->acc & 0xffff) + (csum->acc >> 16); } static uint16_t csum_inet_digest(struct csum_inet* csum) { return ~csum->acc; } static void sandbox_common() { struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 8 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 0; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); } static void loop(); static int do_sandbox_none(void) { sandbox_common(); loop(); return 0; } static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } int i, call, thread; for (call = 0; call < 13; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); event_timedwait(&th->done, 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: inject_fault(1); res = syscall(SYS_kqueue); if (res != -1) r[0] = res; break; case 1: syscall(SYS_fcntl, (intptr_t)r[0], 2, 0); break; case 2: syscall(SYS_read, (intptr_t)r[0], 0x10000000, 0x39); break; case 3: *(uint32_t*)0x10000040 = 4; *(uint8_t*)0x10000044 = 0x1c; *(uint8_t*)0x10000045 = 0x1c; *(uint16_t*)0x10000046 = htobe16(0x4e23); *(uint32_t*)0x10000048 = 0x75; memset((void*)0x1000004c, 0, 16); *(uint32_t*)0x1000005c = 0xdf52; memset((void*)0x10000060, 0, 96); syscall(SYS_setsockopt, -1, 0x29, 0x51, 0x10000040, 0x80); break; case 4: syscall(SYS_fchmod, 0xffffff9c, 0x80); break; case 5: memcpy((void*)0x100000c0, "\xf0\xda\x4f\x00\xd3\x9f\x1b\x4d\xe8\x69\x97\xbb\xdb\x36\x42\x45\x0d\xa9\x0d\xcb\x26\xfb\x91\xc9\x0f\x62\x9a\x85\x80\xf5\xf8\xe8\x81\xe0\x46\x96\x47\x60\x75\x22\xdc\x80\x5e\xb5\x95\x3e\xa8\xad\x5a\x75\x76\x27\x36\xcc\x9f\x08\x59\x52\x17\x6a\x07\x44\xe8\x39\x59\x2e\x06\x87\xf1\x6d\x3e", 71); syscall(SYS_sendto, -1, 0x100000c0, 0x47, 0x20188, 0, 0); break; case 6: *(uint32_t*)0x10000140 = 0; res = syscall(SYS_accept, 0xffffff9c, 0, 0x10000140); if (res != -1) r[1] = res; break; case 7: res = syscall(SYS_getppid); if (res != -1) r[2] = res; break; case 8: *(uint32_t*)0x10000580 = 0x4eecdb2d; *(uint32_t*)0x10000584 = 1; *(uint16_t*)0x10000588 = 0x100; *(uint16_t*)0x1000058a = 0; memcpy((void*)0x1000058c, "\x35\xe5\xcf\x95\x85\xf4\x94\x51\xad\xe1\x87\x3f\xb9\x38\x26\xb9", 16); res = syscall(SYS_fhstatfs, 0x10000580, 0x100005c0); if (res != -1) r[3] = *(uint32_t*)0x1000067c; break; case 9: *(uint32_t*)0x10001600 = 0x10000180; *(uint8_t*)0x10000180 = 0xa; *(uint8_t*)0x10000181 = 1; memcpy((void*)0x10000182, "./file0\000", 8); *(uint32_t*)0x10001604 = 0xa; *(uint32_t*)0x10001608 = 0x10000540; *(uint32_t*)0x10000540 = 0x100001c0; memcpy((void*)0x100001c0, "\x6b\xca\x7e\x1c\x89\x6c\x8d\x76\x1e\x48\xbc\x41\x78\xd2\x27\xd4\xcb\x14\x9c\xe2\xbb\x7d\x22\x0b\x8e\x3e\x2e\x9b\x91\xde\xb2\x14\x46\x62\x1b\xf6\x3f\xf2\xcb\xaf\xd4\xeb\x9b\xcf\x8a\x7a\x26\xbc\x51\xc3\x73\x4e\x18\x5d\x75\x60\x53\x47\x6d\x04\xb0\xcb\x4a\xdf\x62\x90\xc5\xf1\x7e\x26\x00\x25\x6d\xb3\xeb\x86\x4c\x7d\x3e\x66\xa5\xbb\x27\x4d\xdf\x98\x0d\xdb\x34\xef\xcc\xff\xbc\xfe\x55\x31\xec\xf6\x1f\x2b\x53\x68\x9e\x29\x5f\x91\xd6\x55\xa6\x94\x56\x9d\x71\x73\x2f", 115); *(uint32_t*)0x10000544 = 0x73; *(uint32_t*)0x10000548 = 0x10000240; memcpy((void*)0x10000240, "\xd3\x32\x31\x3b\xe2\x41\x43\xda\x4f\x25\x5a\xab\x51\x12\x38\x47\xfa\x76\x32\xf1\x7c\xf3\xee\x74\x31\xc8\x42\x43\xb3\xee\x92\x4d\x67\xb5\x37\x76\xdf\x41\x2e\x0c\x9e\x81\xdd\x63\xa8\x9e\x0f\x39\x3b\xca\x17\x95\x19\x3b\x56\x85\x1b\x88\x9c\xda\x6d\x36\x64\x53\xd3\xaa\xce\x82\xc4\xb8\xee\xf7\xaf\xdd\x8e\x8c\x7a\x5a\x29\x77\x0f\x5c\x3c\x56\xe7\x6f\x6a\x40\xe8\xfe\xd2\x8a\x9a\x4c\x35\x32\x1e\x5b\xb4\x13\xd7\xa2\xe7\xe6\xb6\x06\x9c\xf7\xa8\x62\x7f\x5d\xcb\x48\xd6\x89\x0d\x34\xde\x51\x13\x81\x63\x15\x13\xcd\xaf\x7a\xd4\xaf\x86\x09\x5e\x25\x6a\x9d\x81\xa8\xa1\xb6\xfc\x30\x65\x62\x75\x01\x9b\x95\xf7\xb7\x7c\x17\xc0\xb5\x48\xd0\x88\x92\xb4\x94\x45\xe3\x81\x43\xd7\x78\xba", 167); *(uint32_t*)0x1000054c = 0xa7; *(uint32_t*)0x10000550 = 0x10000300; memcpy((void*)0x10000300, "\x04\x40\x07\x6f\xd2\xf8\xb6\x40\x40\xb3\x80\x08\x7d\x2a\x5c\xab\x89\xfc\x98\xdf\xdf\xb1\x3e\x3c\xfe\x53\x0d\x18\xdc\x89\xf1\x8b\xba\xb2\x18\x9b\x04\x6c\xc1\xfd\x86\x2f\xc0\x7c\x58\xf4\xf0\x9e\xd3\x64\x14\x1f\x76\x5a\x72\xf0", 56); *(uint32_t*)0x10000554 = 0x38; *(uint32_t*)0x10000558 = 0x10000340; memcpy((void*)0x10000340, "\xa9\x06\x1f\xb6\xbd\x05\xbc\x02\xe5\x79\x81\x17\x04\xf0\xbf\x74\x92\xea\xcb\xc4\xd1\x51\x31\xc6\x61\x4e\xc9\x16\x2c\x22\x42\x0e\x80\xef\xdf\xa2\x5a\x98\xd2\x9e\x9e\xd2\x19\x1a\x86\xe0\xb0\xa5\x59\x07\x91\xa2\x23\x1f\xe3\x0b\xc0\x05\xcf\x55\xc0\xce\xbd\x00\x68\x73\xd9\xa3\xb9\x4f\x03\xdf\xe9\xc1\xc8\x86\x64\x2a\x40\xb7\x6c\x02\x1a\x46\x5a\xa1\xe2\xf1\xae\xe0\xfb\x48\x7c\xcf\xda\x40\x58\xb2\x64\xe5\x26\x2f\x2e\xdc\x7a\x0e\xd5\xa5\xdc\x94\xe5\xc3\x1c\x22\x22\x11\xb1\xe2\x31\x68\x97\x37\x89\xf5\xed\x5d\x8d\x17\x28\xfe\x2e\x5e\x46\x94\x19\x7a\x74\x9b\x35\x05\xbd\x76\x02\xfb\x41\x3a\xa3\xc2\xec\x48\xe2\x04\x52\x70\x4b\x84\xc6\xd9\x9f\x98\x6f\xcf\x64\xd1\x09\x79\x4c\x97\xf3\x14\x45\xc1\x35\x24\xa9\xe6\xde\x83\x20\x33\xc0\x51\x4e\x10\x72\xa6\x8c\x99\x41\xa1\xa3\xee\x4a\xce\xe7\x1e\x05\x9d\x81\x29\xb7\x98\x3c\x85\xb2\x22\xff\xcd\x1f\xa3\xba\x67\x0d\x75\x6f\xa1\xbd\xc5\x3c\xcc\xac\xba\x3b\x6d\xe4\xd2\x4e\x31\x6f\xe0\xc6\xa2", 232); *(uint32_t*)0x1000055c = 0xe8; *(uint32_t*)0x10000560 = 0x10000440; memcpy((void*)0x10000440, "\xb8\xaf\xd9\x01\x4e\xe3\xd8\xa8\x3a\xb8\xc8\xea\xa6\x4c\xdb\x5f\x0e\x70\xfc\x6e\x3a\xdf\x08\xba\x67\x5c\x68\x52\x81\x9d\x8b\x03\xd1\x90\x39\x24\x5b\x60\x7b\x2e\xf3\x81\xd2\xa1\x9f\xbe\x62\x9b\x8d\xa6\x42\x1e\x5a\x05\x71\x9d\xe0\x0b\x33\x6c\x28\x05\x54\x19\x79\xea\x17\xbd\x12\x99\xfb\x16\x9c\xf4\x1e\x0b\x21\xb6\xfb\x47\x7a\x6e\xcd\x4d\xb5\x56\x25\x51\x71\x05\xb3\xe5\xd4\x89\xe7\x05\xf4\xc3\x73\xba\x43\x4c\xe6\xb2\x40\x48\x75\x76\x51\xbe\x81\xce\xa4\xba\x53\xf7\x3f\x74\x6b\x58\x4b\x32\x50\xc1\x0e\x44\x17\x7f\x25\xa8\x0d\xa6\x2f\xe6\xec\x08\x01\x56\x9a\x5f\xdc\xd0\x21\xe1\x07\xd6\x18\x77\x27\x07\xf7\x72\x48\x6c\x5c\x33\x43\xa0\xdf\x31\xff\x28\xde\xd9\x80\x06\x9c\x30\xf6\xa0\x8a\x48\x08\x0d\xc2\x03\xeb\x3c\x34\x56\x43\x2a\x4d\xd9\x24\x9f\x50\xf1\x80\x13\x8b\xab\x15\x9c\x5b\xf3\xdb\xef\xf5\xeb\xec\x6d\xe3\xe7\x82\xfb\x47\xe8\xf0\x90\xb7\xe9\x61\xd4\xd6", 215); *(uint32_t*)0x10000564 = 0xd7; *(uint32_t*)0x1000160c = 5; *(uint32_t*)0x10001610 = 0x10001500; *(uint32_t*)0x10001500 = 0x60; *(uint32_t*)0x10001504 = 0xffff; *(uint32_t*)0x10001508 = 3; *(uint32_t*)0x1000150c = r[2]; *(uint32_t*)0x10001510 = -1; *(uint32_t*)0x10001514 = r[3]; *(uint32_t*)0x10001518 = 0; *(uint16_t*)0x1000151c = 0x10; *(uint32_t*)0x10001520 = 0; *(uint32_t*)0x10001524 = 0; *(uint32_t*)0x10001528 = -1; *(uint32_t*)0x1000152c = -1; *(uint32_t*)0x10001530 = 0; *(uint32_t*)0x10001534 = -1; *(uint32_t*)0x10001538 = -1; *(uint32_t*)0x1000153c = -1; *(uint32_t*)0x10001540 = 0; *(uint32_t*)0x10001544 = 0; *(uint32_t*)0x10001548 = 0; *(uint32_t*)0x1000154c = -1; *(uint32_t*)0x10001550 = -1; *(uint32_t*)0x10001554 = 0; *(uint32_t*)0x10001558 = -1; *(uint32_t*)0x1000155c = 0; *(uint32_t*)0x10001560 = 0x60; *(uint32_t*)0x10001564 = 0xffff; *(uint32_t*)0x10001568 = 3; *(uint32_t*)0x1000156c = 0; *(uint32_t*)0x10001570 = 0; *(uint32_t*)0x10001574 = 0; *(uint32_t*)0x10001578 = -1; *(uint16_t*)0x1000157c = 0x10; *(uint32_t*)0x10001580 = 0; *(uint32_t*)0x10001584 = -1; *(uint32_t*)0x10001588 = 0; *(uint32_t*)0x1000158c = -1; *(uint32_t*)0x10001590 = -1; *(uint32_t*)0x10001594 = -1; *(uint32_t*)0x10001598 = -1; *(uint32_t*)0x1000159c = 0; *(uint32_t*)0x100015a0 = 0; *(uint32_t*)0x100015a4 = 0; *(uint32_t*)0x100015a8 = 0; *(uint32_t*)0x100015ac = 0; *(uint32_t*)0x100015b0 = -1; *(uint32_t*)0x100015b4 = 0; *(uint32_t*)0x100015b8 = 0; *(uint32_t*)0x100015bc = 0; *(uint32_t*)0x100015c0 = 0x30; *(uint32_t*)0x100015c4 = 0xffff; *(uint32_t*)0x100015c8 = 1; *(uint32_t*)0x100015cc = r[0]; *(uint32_t*)0x100015d0 = -1; *(uint32_t*)0x100015d4 = r[0]; *(uint32_t*)0x100015d8 = r[0]; *(uint32_t*)0x100015dc = r[0]; *(uint32_t*)0x100015e0 = r[0]; *(uint32_t*)0x100015e4 = r[0]; *(uint32_t*)0x100015e8 = 0xffffff9c; *(uint32_t*)0x100015ec = -1; *(uint32_t*)0x10001614 = 0xf0; *(uint32_t*)0x10001618 = 0x20080; syscall(SYS_sendmsg, (intptr_t)r[1], 0x10001600, 0xc); break; case 10: memcpy((void*)0x10000080, "\x0f\x0f\xb6\x9b\x09\x75\x79\xbf\x2e\xf0\x0f\xc7\x0f\xc4\xe3\x15\x06\x50\x13\x7f\x0f\x2f\x06\xc4\xe3\xf9\x63\x26\x00\xc4\xe1\x17\x5c\x1f\x67\x26\x0f\x72\xd1\x0d\x66\x9d\x0f\x71\xd6\x00\xd9\xe9", 48); syz_execute_func(0x10000080); break; } } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :195:13: error: unused function 'csum_inet_init' [-Werror,-Wunused-function] static void csum_inet_init(struct csum_inet* csum) ^ :200:13: error: unused function 'csum_inet_update' [-Werror,-Wunused-function] static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) ^ :213:17: error: unused function 'csum_inet_digest' [-Werror,-Wunused-function] static uint16_t csum_inet_digest(struct csum_inet* csum) ^ 3 errors generated. compiler invocation: clang [-o /tmp/syz-executor144804988 -DGOOS_freebsd=1 -DGOARCH_386=1 -DHOSTGOOS_freebsd=1 -x c - -m32 -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -static -lc++ -Wno-overflow] --- FAIL: TestGenerate/freebsd/386/2 (1.03s) csource_test.go:118: opts: {Threaded:true Collide:true Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Fault:false FaultCall:0 FaultNth:0}} program: r0 = kqueue() (fail_nth: 1) fcntl$setflags(r0, 0x2, 0x0) read(r0, &(0x7f0000000000)=""/57, 0x39) setsockopt$inet6_MCAST_LEAVE_GROUP(0xffffffffffffffff, 0x29, 0x51, &(0x7f0000000040)={0x4, {{0x1c, 0x1c, 0x3, 0x75, @empty, 0xdf52}}}, 0x80) fchmod(0xffffffffffffff9c, 0x80) sendto(0xffffffffffffffff, &(0x7f00000000c0)="f0da4f00d39f1b4de86997bbdb3642450da90dcb26fb91c90f629a8580f5f8e881e0469647607522dc805eb5953ea8ad5a75762736cc9f085952176a0744e839592e0687f16d3e", 0x47, 0x20188, 0x0, 0x0) r1 = accept$unix(0xffffffffffffff9c, 0x0, &(0x7f0000000140)) r2 = getppid() fhstatfs(&(0x7f0000000580)={{[0x4eecdb2d, 0x1]}, {0x100, 0x0, "35e5cf9585f49451ade1873fb93826b9"}}, &(0x7f00000005c0)={0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, [], 0x0, 0x0}) sendmsg$unix(r1, &(0x7f0000001600)={&(0x7f0000000180)=@file={0xa, 0x1, './file0\x00'}, 0xa, &(0x7f0000000540)=[{&(0x7f00000001c0)="6bca7e1c896c8d761e48bc4178d227d4cb149ce2bb7d220b8e3e2e9b91deb21446621bf63ff2cbafd4eb9bcf8a7a26bc51c3734e185d756053476d04b0cb4adf6290c5f17e2600256db3eb864c7d3e66a5bb274ddf980ddb34efccffbcfe5531ecf61f2b53689e295f91d655a694569d71732f", 0x73}, {&(0x7f0000000240)="d332313be24143da4f255aab51123847fa7632f17cf3ee7431c84243b3ee924d67b53776df412e0c9e81dd63a89e0f393bca1795193b56851b889cda6d366453d3aace82c4b8eef7afdd8e8c7a5a29770f5c3c56e76f6a40e8fed28a9a4c35321e5bb413d7a2e7e6b6069cf7a8627f5dcb48d6890d34de511381631513cdaf7ad4af86095e256a9d81a8a1b6fc30656275019b95f7b77c17c0b548d08892b49445e38143d778ba", 0xa7}, {&(0x7f0000000300)="0440076fd2f8b64040b380087d2a5cab89fc98dfdfb13e3cfe530d18dc89f18bbab2189b046cc1fd862fc07c58f4f09ed364141f765a72f0", 0x38}, {&(0x7f0000000340)="a9061fb6bd05bc02e579811704f0bf7492eacbc4d15131c6614ec9162c22420e80efdfa25a98d29e9ed2191a86e0b0a5590791a2231fe30bc005cf55c0cebd006873d9a3b94f03dfe9c1c886642a40b76c021a465aa1e2f1aee0fb487ccfda4058b264e5262f2edc7a0ed5a5dc94e5c31c222211b1e23168973789f5ed5d8d1728fe2e5e4694197a749b3505bd7602fb413aa3c2ec48e20452704b84c6d99f986fcf64d109794c97f31445c13524a9e6de832033c0514e1072a68c9941a1a3ee4acee71e059d8129b7983c85b222ffcd1fa3ba670d756fa1bdc53cccacba3b6de4d24e316fe0c6a2", 0xe8}, {&(0x7f0000000440)="b8afd9014ee3d8a83ab8c8eaa64cdb5f0e70fc6e3adf08ba675c6852819d8b03d19039245b607b2ef381d2a19fbe629b8da6421e5a05719de00b336c2805541979ea17bd1299fb169cf41e0b21b6fb477a6ecd4db55625517105b3e5d489e705f4c373ba434ce6b24048757651be81cea4ba53f73f746b584b3250c10e44177f25a80da62fe6ec0801569a5fdcd021e107d618772707f772486c5c3343a0df31ff28ded980069c30f6a08a48080dc203eb3c3456432a4dd9249f50f180138bab159c5bf3dbeff5ebec6de3e782fb47e8f090b7e961d4d6", 0xd7}], 0x5, &(0x7f0000001500)=[@cred={0x60, 0xffff, 0x3, r2, 0xffffffffffffffff, r3, 0x0, 0x10, [0x0, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xffffffffffffffff]}, @cred={0x60, 0xffff, 0x3, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0x10, [0x0, 0xffffffffffffffff, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffffffffffff]}, @rights={0x30, 0xffff, 0x1, [r0, 0xffffffffffffffff, r0, r0, r0, r0, r0, 0xffffffffffffff9c, 0xffffffffffffffff]}], 0xf0, 0x20080}, 0xc) syz_emit_ethernet(0x7e, &(0x7f0000000000)={@broadcast, @broadcast, [], {@ipv4={0x800, {{0x11, 0x4, 0x0, 0x9, 0x70, 0x65, 0xfff, 0x1, 0x45, 0x0, @empty, @empty, {[@rr={0x7, 0x27, 0x42, [@broadcast, @remote={0xac, 0x14, 0x0}, @local={0xac, 0x14, 0x0}, @multicast1, @remote={0xac, 0x14, 0x0}, @multicast2, @multicast1, @loopback, @broadcast]}, @generic={0x88, 0x6, "4e65f765"}]}}, @generic="28a61f895fbbf527b3987a02bb0dbc5f2d9e8fc684889186b7e0347c358ba58238965531ac7b77908372d8c3"}}}}) syz_execute_func(&(0x7f0000000080)="0f0fb69b097579bf2ef00fc70fc4e3150650137f0f2f06c4e3f9632600c4e1175c1f67260f72d10d669d0f71d600d9e9") syz_extract_tcp_res(&(0x7f00000000c0), 0x4, 0x0) csource_test.go:119: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void __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); if (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 BITMASK(bf_off,bf_len) (((1ull << (bf_len)) - 1) << (bf_off)) #define STORE_BY_BITMASK(type,htobe,addr,val,bf_off,bf_len) *(type*)(addr) = htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len)))) struct csum_inet { uint32_t acc; }; static void csum_inet_init(struct csum_inet* csum) { csum->acc = 0; } static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) { if (length == 0) return; size_t i = 0; for (; i < length - 1; i += 2) csum->acc += *(uint16_t*)&data[i]; if (length & 1) csum->acc += le16toh((uint16_t)data[length - 1]); while (csum->acc > 0xffff) csum->acc = (csum->acc & 0xffff) + (csum->acc >> 16); } static uint16_t csum_inet_digest(struct csum_inet* csum) { return ~csum->acc; } static void sandbox_common() { struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 8 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 0; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); } static void loop(); static int do_sandbox_none(void) { sandbox_common(); loop(); return 0; } static long syz_execute_func(volatile long text) { ((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; int collide = 0; again: for (call = 0; call < 13; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (collide && (call % 2) == 0) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); if (!collide) { collide = 1; goto again; } } static void execute_one(void); #define WAIT_FLAGS 0 static void loop(void) { int iter = 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: inject_fault(1); res = syscall(SYS_kqueue); if (res != -1) r[0] = res; break; case 1: syscall(SYS_fcntl, (intptr_t)r[0], 2, 0); break; case 2: syscall(SYS_read, (intptr_t)r[0], 0x10000000, 0x39); break; case 3: *(uint32_t*)0x10000040 = 4; *(uint8_t*)0x10000044 = 0x1c; *(uint8_t*)0x10000045 = 0x1c; *(uint16_t*)0x10000046 = htobe16(0x4e23); *(uint32_t*)0x10000048 = 0x75; memset((void*)0x1000004c, 0, 16); *(uint32_t*)0x1000005c = 0xdf52; memset((void*)0x10000060, 0, 96); syscall(SYS_setsockopt, -1, 0x29, 0x51, 0x10000040, 0x80); break; case 4: syscall(SYS_fchmod, 0xffffff9c, 0x80); break; case 5: memcpy((void*)0x100000c0, "\xf0\xda\x4f\x00\xd3\x9f\x1b\x4d\xe8\x69\x97\xbb\xdb\x36\x42\x45\x0d\xa9\x0d\xcb\x26\xfb\x91\xc9\x0f\x62\x9a\x85\x80\xf5\xf8\xe8\x81\xe0\x46\x96\x47\x60\x75\x22\xdc\x80\x5e\xb5\x95\x3e\xa8\xad\x5a\x75\x76\x27\x36\xcc\x9f\x08\x59\x52\x17\x6a\x07\x44\xe8\x39\x59\x2e\x06\x87\xf1\x6d\x3e", 71); syscall(SYS_sendto, -1, 0x100000c0, 0x47, 0x20188, 0, 0); break; case 6: *(uint32_t*)0x10000140 = 0; res = syscall(SYS_accept, 0xffffff9c, 0, 0x10000140); if (res != -1) r[1] = res; break; case 7: res = syscall(SYS_getppid); if (res != -1) r[2] = res; break; case 8: *(uint32_t*)0x10000580 = 0x4eecdb2d; *(uint32_t*)0x10000584 = 1; *(uint16_t*)0x10000588 = 0x100; *(uint16_t*)0x1000058a = 0; memcpy((void*)0x1000058c, "\x35\xe5\xcf\x95\x85\xf4\x94\x51\xad\xe1\x87\x3f\xb9\x38\x26\xb9", 16); res = syscall(SYS_fhstatfs, 0x10000580, 0x100005c0); if (res != -1) r[3] = *(uint32_t*)0x1000067c; break; case 9: *(uint32_t*)0x10001600 = 0x10000180; *(uint8_t*)0x10000180 = 0xa; *(uint8_t*)0x10000181 = 1; memcpy((void*)0x10000182, "./file0\000", 8); *(uint32_t*)0x10001604 = 0xa; *(uint32_t*)0x10001608 = 0x10000540; *(uint32_t*)0x10000540 = 0x100001c0; memcpy((void*)0x100001c0, "\x6b\xca\x7e\x1c\x89\x6c\x8d\x76\x1e\x48\xbc\x41\x78\xd2\x27\xd4\xcb\x14\x9c\xe2\xbb\x7d\x22\x0b\x8e\x3e\x2e\x9b\x91\xde\xb2\x14\x46\x62\x1b\xf6\x3f\xf2\xcb\xaf\xd4\xeb\x9b\xcf\x8a\x7a\x26\xbc\x51\xc3\x73\x4e\x18\x5d\x75\x60\x53\x47\x6d\x04\xb0\xcb\x4a\xdf\x62\x90\xc5\xf1\x7e\x26\x00\x25\x6d\xb3\xeb\x86\x4c\x7d\x3e\x66\xa5\xbb\x27\x4d\xdf\x98\x0d\xdb\x34\xef\xcc\xff\xbc\xfe\x55\x31\xec\xf6\x1f\x2b\x53\x68\x9e\x29\x5f\x91\xd6\x55\xa6\x94\x56\x9d\x71\x73\x2f", 115); *(uint32_t*)0x10000544 = 0x73; *(uint32_t*)0x10000548 = 0x10000240; memcpy((void*)0x10000240, "\xd3\x32\x31\x3b\xe2\x41\x43\xda\x4f\x25\x5a\xab\x51\x12\x38\x47\xfa\x76\x32\xf1\x7c\xf3\xee\x74\x31\xc8\x42\x43\xb3\xee\x92\x4d\x67\xb5\x37\x76\xdf\x41\x2e\x0c\x9e\x81\xdd\x63\xa8\x9e\x0f\x39\x3b\xca\x17\x95\x19\x3b\x56\x85\x1b\x88\x9c\xda\x6d\x36\x64\x53\xd3\xaa\xce\x82\xc4\xb8\xee\xf7\xaf\xdd\x8e\x8c\x7a\x5a\x29\x77\x0f\x5c\x3c\x56\xe7\x6f\x6a\x40\xe8\xfe\xd2\x8a\x9a\x4c\x35\x32\x1e\x5b\xb4\x13\xd7\xa2\xe7\xe6\xb6\x06\x9c\xf7\xa8\x62\x7f\x5d\xcb\x48\xd6\x89\x0d\x34\xde\x51\x13\x81\x63\x15\x13\xcd\xaf\x7a\xd4\xaf\x86\x09\x5e\x25\x6a\x9d\x81\xa8\xa1\xb6\xfc\x30\x65\x62\x75\x01\x9b\x95\xf7\xb7\x7c\x17\xc0\xb5\x48\xd0\x88\x92\xb4\x94\x45\xe3\x81\x43\xd7\x78\xba", 167); *(uint32_t*)0x1000054c = 0xa7; *(uint32_t*)0x10000550 = 0x10000300; memcpy((void*)0x10000300, "\x04\x40\x07\x6f\xd2\xf8\xb6\x40\x40\xb3\x80\x08\x7d\x2a\x5c\xab\x89\xfc\x98\xdf\xdf\xb1\x3e\x3c\xfe\x53\x0d\x18\xdc\x89\xf1\x8b\xba\xb2\x18\x9b\x04\x6c\xc1\xfd\x86\x2f\xc0\x7c\x58\xf4\xf0\x9e\xd3\x64\x14\x1f\x76\x5a\x72\xf0", 56); *(uint32_t*)0x10000554 = 0x38; *(uint32_t*)0x10000558 = 0x10000340; memcpy((void*)0x10000340, "\xa9\x06\x1f\xb6\xbd\x05\xbc\x02\xe5\x79\x81\x17\x04\xf0\xbf\x74\x92\xea\xcb\xc4\xd1\x51\x31\xc6\x61\x4e\xc9\x16\x2c\x22\x42\x0e\x80\xef\xdf\xa2\x5a\x98\xd2\x9e\x9e\xd2\x19\x1a\x86\xe0\xb0\xa5\x59\x07\x91\xa2\x23\x1f\xe3\x0b\xc0\x05\xcf\x55\xc0\xce\xbd\x00\x68\x73\xd9\xa3\xb9\x4f\x03\xdf\xe9\xc1\xc8\x86\x64\x2a\x40\xb7\x6c\x02\x1a\x46\x5a\xa1\xe2\xf1\xae\xe0\xfb\x48\x7c\xcf\xda\x40\x58\xb2\x64\xe5\x26\x2f\x2e\xdc\x7a\x0e\xd5\xa5\xdc\x94\xe5\xc3\x1c\x22\x22\x11\xb1\xe2\x31\x68\x97\x37\x89\xf5\xed\x5d\x8d\x17\x28\xfe\x2e\x5e\x46\x94\x19\x7a\x74\x9b\x35\x05\xbd\x76\x02\xfb\x41\x3a\xa3\xc2\xec\x48\xe2\x04\x52\x70\x4b\x84\xc6\xd9\x9f\x98\x6f\xcf\x64\xd1\x09\x79\x4c\x97\xf3\x14\x45\xc1\x35\x24\xa9\xe6\xde\x83\x20\x33\xc0\x51\x4e\x10\x72\xa6\x8c\x99\x41\xa1\xa3\xee\x4a\xce\xe7\x1e\x05\x9d\x81\x29\xb7\x98\x3c\x85\xb2\x22\xff\xcd\x1f\xa3\xba\x67\x0d\x75\x6f\xa1\xbd\xc5\x3c\xcc\xac\xba\x3b\x6d\xe4\xd2\x4e\x31\x6f\xe0\xc6\xa2", 232); *(uint32_t*)0x1000055c = 0xe8; *(uint32_t*)0x10000560 = 0x10000440; memcpy((void*)0x10000440, "\xb8\xaf\xd9\x01\x4e\xe3\xd8\xa8\x3a\xb8\xc8\xea\xa6\x4c\xdb\x5f\x0e\x70\xfc\x6e\x3a\xdf\x08\xba\x67\x5c\x68\x52\x81\x9d\x8b\x03\xd1\x90\x39\x24\x5b\x60\x7b\x2e\xf3\x81\xd2\xa1\x9f\xbe\x62\x9b\x8d\xa6\x42\x1e\x5a\x05\x71\x9d\xe0\x0b\x33\x6c\x28\x05\x54\x19\x79\xea\x17\xbd\x12\x99\xfb\x16\x9c\xf4\x1e\x0b\x21\xb6\xfb\x47\x7a\x6e\xcd\x4d\xb5\x56\x25\x51\x71\x05\xb3\xe5\xd4\x89\xe7\x05\xf4\xc3\x73\xba\x43\x4c\xe6\xb2\x40\x48\x75\x76\x51\xbe\x81\xce\xa4\xba\x53\xf7\x3f\x74\x6b\x58\x4b\x32\x50\xc1\x0e\x44\x17\x7f\x25\xa8\x0d\xa6\x2f\xe6\xec\x08\x01\x56\x9a\x5f\xdc\xd0\x21\xe1\x07\xd6\x18\x77\x27\x07\xf7\x72\x48\x6c\x5c\x33\x43\xa0\xdf\x31\xff\x28\xde\xd9\x80\x06\x9c\x30\xf6\xa0\x8a\x48\x08\x0d\xc2\x03\xeb\x3c\x34\x56\x43\x2a\x4d\xd9\x24\x9f\x50\xf1\x80\x13\x8b\xab\x15\x9c\x5b\xf3\xdb\xef\xf5\xeb\xec\x6d\xe3\xe7\x82\xfb\x47\xe8\xf0\x90\xb7\xe9\x61\xd4\xd6", 215); *(uint32_t*)0x10000564 = 0xd7; *(uint32_t*)0x1000160c = 5; *(uint32_t*)0x10001610 = 0x10001500; *(uint32_t*)0x10001500 = 0x60; *(uint32_t*)0x10001504 = 0xffff; *(uint32_t*)0x10001508 = 3; *(uint32_t*)0x1000150c = r[2]; *(uint32_t*)0x10001510 = -1; *(uint32_t*)0x10001514 = r[3]; *(uint32_t*)0x10001518 = 0; *(uint16_t*)0x1000151c = 0x10; *(uint32_t*)0x10001520 = 0; *(uint32_t*)0x10001524 = 0; *(uint32_t*)0x10001528 = -1; *(uint32_t*)0x1000152c = -1; *(uint32_t*)0x10001530 = 0; *(uint32_t*)0x10001534 = -1; *(uint32_t*)0x10001538 = -1; *(uint32_t*)0x1000153c = -1; *(uint32_t*)0x10001540 = 0; *(uint32_t*)0x10001544 = 0; *(uint32_t*)0x10001548 = 0; *(uint32_t*)0x1000154c = -1; *(uint32_t*)0x10001550 = -1; *(uint32_t*)0x10001554 = 0; *(uint32_t*)0x10001558 = -1; *(uint32_t*)0x1000155c = 0; *(uint32_t*)0x10001560 = 0x60; *(uint32_t*)0x10001564 = 0xffff; *(uint32_t*)0x10001568 = 3; *(uint32_t*)0x1000156c = 0; *(uint32_t*)0x10001570 = 0; *(uint32_t*)0x10001574 = 0; *(uint32_t*)0x10001578 = -1; *(uint16_t*)0x1000157c = 0x10; *(uint32_t*)0x10001580 = 0; *(uint32_t*)0x10001584 = -1; *(uint32_t*)0x10001588 = 0; *(uint32_t*)0x1000158c = -1; *(uint32_t*)0x10001590 = -1; *(uint32_t*)0x10001594 = -1; *(uint32_t*)0x10001598 = -1; *(uint32_t*)0x1000159c = 0; *(uint32_t*)0x100015a0 = 0; *(uint32_t*)0x100015a4 = 0; *(uint32_t*)0x100015a8 = 0; *(uint32_t*)0x100015ac = 0; *(uint32_t*)0x100015b0 = -1; *(uint32_t*)0x100015b4 = 0; *(uint32_t*)0x100015b8 = 0; *(uint32_t*)0x100015bc = 0; *(uint32_t*)0x100015c0 = 0x30; *(uint32_t*)0x100015c4 = 0xffff; *(uint32_t*)0x100015c8 = 1; *(uint32_t*)0x100015cc = r[0]; *(uint32_t*)0x100015d0 = -1; *(uint32_t*)0x100015d4 = r[0]; *(uint32_t*)0x100015d8 = r[0]; *(uint32_t*)0x100015dc = r[0]; *(uint32_t*)0x100015e0 = r[0]; *(uint32_t*)0x100015e4 = r[0]; *(uint32_t*)0x100015e8 = 0xffffff9c; *(uint32_t*)0x100015ec = -1; *(uint32_t*)0x10001614 = 0xf0; *(uint32_t*)0x10001618 = 0x20080; syscall(SYS_sendmsg, (intptr_t)r[1], 0x10001600, 0xc); break; case 10: memcpy((void*)0x10000080, "\x0f\x0f\xb6\x9b\x09\x75\x79\xbf\x2e\xf0\x0f\xc7\x0f\xc4\xe3\x15\x06\x50\x13\x7f\x0f\x2f\x06\xc4\xe3\xf9\x63\x26\x00\xc4\xe1\x17\x5c\x1f\x67\x26\x0f\x72\xd1\x0d\x66\x9d\x0f\x71\xd6\x00\xd9\xe9", 48); syz_execute_func(0x10000080); break; } } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :195:13: error: unused function 'csum_inet_init' [-Werror,-Wunused-function] static void csum_inet_init(struct csum_inet* csum) ^ :200:13: error: unused function 'csum_inet_update' [-Werror,-Wunused-function] static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) ^ :213:17: error: unused function 'csum_inet_digest' [-Werror,-Wunused-function] static uint16_t csum_inet_digest(struct csum_inet* csum) ^ 3 errors generated. compiler invocation: clang [-o /tmp/syz-executor992029454 -DGOOS_freebsd=1 -DGOARCH_386=1 -DHOSTGOOS_freebsd=1 -x c - -m32 -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -static -lc++ -Wno-overflow] --- FAIL: TestGenerate/freebsd/386/5 (1.16s) csource_test.go:118: opts: {Threaded:true Collide:false Repeat:true RepeatTimes:0 Procs:1 Slowdown:1 Sandbox:none Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Fault:false FaultCall:0 FaultNth:0}} program: r0 = kqueue() (fail_nth: 1) fcntl$setflags(r0, 0x2, 0x0) read(r0, &(0x7f0000000000)=""/57, 0x39) setsockopt$inet6_MCAST_LEAVE_GROUP(0xffffffffffffffff, 0x29, 0x51, &(0x7f0000000040)={0x4, {{0x1c, 0x1c, 0x3, 0x75, @empty, 0xdf52}}}, 0x80) fchmod(0xffffffffffffff9c, 0x80) sendto(0xffffffffffffffff, &(0x7f00000000c0)="f0da4f00d39f1b4de86997bbdb3642450da90dcb26fb91c90f629a8580f5f8e881e0469647607522dc805eb5953ea8ad5a75762736cc9f085952176a0744e839592e0687f16d3e", 0x47, 0x20188, 0x0, 0x0) r1 = accept$unix(0xffffffffffffff9c, 0x0, &(0x7f0000000140)) r2 = getppid() fhstatfs(&(0x7f0000000580)={{[0x4eecdb2d, 0x1]}, {0x100, 0x0, "35e5cf9585f49451ade1873fb93826b9"}}, &(0x7f00000005c0)={0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, [], 0x0, 0x0}) sendmsg$unix(r1, &(0x7f0000001600)={&(0x7f0000000180)=@file={0xa, 0x1, './file0\x00'}, 0xa, &(0x7f0000000540)=[{&(0x7f00000001c0)="6bca7e1c896c8d761e48bc4178d227d4cb149ce2bb7d220b8e3e2e9b91deb21446621bf63ff2cbafd4eb9bcf8a7a26bc51c3734e185d756053476d04b0cb4adf6290c5f17e2600256db3eb864c7d3e66a5bb274ddf980ddb34efccffbcfe5531ecf61f2b53689e295f91d655a694569d71732f", 0x73}, {&(0x7f0000000240)="d332313be24143da4f255aab51123847fa7632f17cf3ee7431c84243b3ee924d67b53776df412e0c9e81dd63a89e0f393bca1795193b56851b889cda6d366453d3aace82c4b8eef7afdd8e8c7a5a29770f5c3c56e76f6a40e8fed28a9a4c35321e5bb413d7a2e7e6b6069cf7a8627f5dcb48d6890d34de511381631513cdaf7ad4af86095e256a9d81a8a1b6fc30656275019b95f7b77c17c0b548d08892b49445e38143d778ba", 0xa7}, {&(0x7f0000000300)="0440076fd2f8b64040b380087d2a5cab89fc98dfdfb13e3cfe530d18dc89f18bbab2189b046cc1fd862fc07c58f4f09ed364141f765a72f0", 0x38}, {&(0x7f0000000340)="a9061fb6bd05bc02e579811704f0bf7492eacbc4d15131c6614ec9162c22420e80efdfa25a98d29e9ed2191a86e0b0a5590791a2231fe30bc005cf55c0cebd006873d9a3b94f03dfe9c1c886642a40b76c021a465aa1e2f1aee0fb487ccfda4058b264e5262f2edc7a0ed5a5dc94e5c31c222211b1e23168973789f5ed5d8d1728fe2e5e4694197a749b3505bd7602fb413aa3c2ec48e20452704b84c6d99f986fcf64d109794c97f31445c13524a9e6de832033c0514e1072a68c9941a1a3ee4acee71e059d8129b7983c85b222ffcd1fa3ba670d756fa1bdc53cccacba3b6de4d24e316fe0c6a2", 0xe8}, {&(0x7f0000000440)="b8afd9014ee3d8a83ab8c8eaa64cdb5f0e70fc6e3adf08ba675c6852819d8b03d19039245b607b2ef381d2a19fbe629b8da6421e5a05719de00b336c2805541979ea17bd1299fb169cf41e0b21b6fb477a6ecd4db55625517105b3e5d489e705f4c373ba434ce6b24048757651be81cea4ba53f73f746b584b3250c10e44177f25a80da62fe6ec0801569a5fdcd021e107d618772707f772486c5c3343a0df31ff28ded980069c30f6a08a48080dc203eb3c3456432a4dd9249f50f180138bab159c5bf3dbeff5ebec6de3e782fb47e8f090b7e961d4d6", 0xd7}], 0x5, &(0x7f0000001500)=[@cred={0x60, 0xffff, 0x3, r2, 0xffffffffffffffff, r3, 0x0, 0x10, [0x0, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xffffffffffffffff]}, @cred={0x60, 0xffff, 0x3, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0x10, [0x0, 0xffffffffffffffff, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffffffffffff]}, @rights={0x30, 0xffff, 0x1, [r0, 0xffffffffffffffff, r0, r0, r0, r0, r0, 0xffffffffffffff9c, 0xffffffffffffffff]}], 0xf0, 0x20080}, 0xc) syz_emit_ethernet(0x7e, &(0x7f0000000000)={@broadcast, @broadcast, [], {@ipv4={0x800, {{0x11, 0x4, 0x0, 0x9, 0x70, 0x65, 0xfff, 0x1, 0x45, 0x0, @empty, @empty, {[@rr={0x7, 0x27, 0x42, [@broadcast, @remote={0xac, 0x14, 0x0}, @local={0xac, 0x14, 0x0}, @multicast1, @remote={0xac, 0x14, 0x0}, @multicast2, @multicast1, @loopback, @broadcast]}, @generic={0x88, 0x6, "4e65f765"}]}}, @generic="28a61f895fbbf527b3987a02bb0dbc5f2d9e8fc684889186b7e0347c358ba58238965531ac7b77908372d8c3"}}}}) syz_execute_func(&(0x7f0000000080)="0f0fb69b097579bf2ef00fc70fc4e3150650137f0f2f06c4e3f9632600c4e1175c1f67260f72d10d669d0f71d600d9e9") syz_extract_tcp_res(&(0x7f00000000c0), 0x4, 0x0) csource_test.go:119: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void __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); if (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 BITMASK(bf_off,bf_len) (((1ull << (bf_len)) - 1) << (bf_off)) #define STORE_BY_BITMASK(type,htobe,addr,val,bf_off,bf_len) *(type*)(addr) = htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len)))) struct csum_inet { uint32_t acc; }; static void csum_inet_init(struct csum_inet* csum) { csum->acc = 0; } static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) { if (length == 0) return; size_t i = 0; for (; i < length - 1; i += 2) csum->acc += *(uint16_t*)&data[i]; if (length & 1) csum->acc += le16toh((uint16_t)data[length - 1]); while (csum->acc > 0xffff) csum->acc = (csum->acc & 0xffff) + (csum->acc >> 16); } static uint16_t csum_inet_digest(struct csum_inet* csum) { return ~csum->acc; } static void sandbox_common() { struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 8 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 0; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); } static void loop(); static int do_sandbox_none(void) { sandbox_common(); loop(); return 0; } static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 13; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); event_timedwait(&th->done, 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: inject_fault(1); res = syscall(SYS_kqueue); if (res != -1) r[0] = res; break; case 1: syscall(SYS_fcntl, (intptr_t)r[0], 2, 0); break; case 2: syscall(SYS_read, (intptr_t)r[0], 0x10000000, 0x39); break; case 3: *(uint32_t*)0x10000040 = 4; *(uint8_t*)0x10000044 = 0x1c; *(uint8_t*)0x10000045 = 0x1c; *(uint16_t*)0x10000046 = htobe16(0x4e23); *(uint32_t*)0x10000048 = 0x75; memset((void*)0x1000004c, 0, 16); *(uint32_t*)0x1000005c = 0xdf52; memset((void*)0x10000060, 0, 96); syscall(SYS_setsockopt, -1, 0x29, 0x51, 0x10000040, 0x80); break; case 4: syscall(SYS_fchmod, 0xffffff9c, 0x80); break; case 5: memcpy((void*)0x100000c0, "\xf0\xda\x4f\x00\xd3\x9f\x1b\x4d\xe8\x69\x97\xbb\xdb\x36\x42\x45\x0d\xa9\x0d\xcb\x26\xfb\x91\xc9\x0f\x62\x9a\x85\x80\xf5\xf8\xe8\x81\xe0\x46\x96\x47\x60\x75\x22\xdc\x80\x5e\xb5\x95\x3e\xa8\xad\x5a\x75\x76\x27\x36\xcc\x9f\x08\x59\x52\x17\x6a\x07\x44\xe8\x39\x59\x2e\x06\x87\xf1\x6d\x3e", 71); syscall(SYS_sendto, -1, 0x100000c0, 0x47, 0x20188, 0, 0); break; case 6: *(uint32_t*)0x10000140 = 0; res = syscall(SYS_accept, 0xffffff9c, 0, 0x10000140); if (res != -1) r[1] = res; break; case 7: res = syscall(SYS_getppid); if (res != -1) r[2] = res; break; case 8: *(uint32_t*)0x10000580 = 0x4eecdb2d; *(uint32_t*)0x10000584 = 1; *(uint16_t*)0x10000588 = 0x100; *(uint16_t*)0x1000058a = 0; memcpy((void*)0x1000058c, "\x35\xe5\xcf\x95\x85\xf4\x94\x51\xad\xe1\x87\x3f\xb9\x38\x26\xb9", 16); res = syscall(SYS_fhstatfs, 0x10000580, 0x100005c0); if (res != -1) r[3] = *(uint32_t*)0x1000067c; break; case 9: *(uint32_t*)0x10001600 = 0x10000180; *(uint8_t*)0x10000180 = 0xa; *(uint8_t*)0x10000181 = 1; memcpy((void*)0x10000182, "./file0\000", 8); *(uint32_t*)0x10001604 = 0xa; *(uint32_t*)0x10001608 = 0x10000540; *(uint32_t*)0x10000540 = 0x100001c0; memcpy((void*)0x100001c0, "\x6b\xca\x7e\x1c\x89\x6c\x8d\x76\x1e\x48\xbc\x41\x78\xd2\x27\xd4\xcb\x14\x9c\xe2\xbb\x7d\x22\x0b\x8e\x3e\x2e\x9b\x91\xde\xb2\x14\x46\x62\x1b\xf6\x3f\xf2\xcb\xaf\xd4\xeb\x9b\xcf\x8a\x7a\x26\xbc\x51\xc3\x73\x4e\x18\x5d\x75\x60\x53\x47\x6d\x04\xb0\xcb\x4a\xdf\x62\x90\xc5\xf1\x7e\x26\x00\x25\x6d\xb3\xeb\x86\x4c\x7d\x3e\x66\xa5\xbb\x27\x4d\xdf\x98\x0d\xdb\x34\xef\xcc\xff\xbc\xfe\x55\x31\xec\xf6\x1f\x2b\x53\x68\x9e\x29\x5f\x91\xd6\x55\xa6\x94\x56\x9d\x71\x73\x2f", 115); *(uint32_t*)0x10000544 = 0x73; *(uint32_t*)0x10000548 = 0x10000240; memcpy((void*)0x10000240, "\xd3\x32\x31\x3b\xe2\x41\x43\xda\x4f\x25\x5a\xab\x51\x12\x38\x47\xfa\x76\x32\xf1\x7c\xf3\xee\x74\x31\xc8\x42\x43\xb3\xee\x92\x4d\x67\xb5\x37\x76\xdf\x41\x2e\x0c\x9e\x81\xdd\x63\xa8\x9e\x0f\x39\x3b\xca\x17\x95\x19\x3b\x56\x85\x1b\x88\x9c\xda\x6d\x36\x64\x53\xd3\xaa\xce\x82\xc4\xb8\xee\xf7\xaf\xdd\x8e\x8c\x7a\x5a\x29\x77\x0f\x5c\x3c\x56\xe7\x6f\x6a\x40\xe8\xfe\xd2\x8a\x9a\x4c\x35\x32\x1e\x5b\xb4\x13\xd7\xa2\xe7\xe6\xb6\x06\x9c\xf7\xa8\x62\x7f\x5d\xcb\x48\xd6\x89\x0d\x34\xde\x51\x13\x81\x63\x15\x13\xcd\xaf\x7a\xd4\xaf\x86\x09\x5e\x25\x6a\x9d\x81\xa8\xa1\xb6\xfc\x30\x65\x62\x75\x01\x9b\x95\xf7\xb7\x7c\x17\xc0\xb5\x48\xd0\x88\x92\xb4\x94\x45\xe3\x81\x43\xd7\x78\xba", 167); *(uint32_t*)0x1000054c = 0xa7; *(uint32_t*)0x10000550 = 0x10000300; memcpy((void*)0x10000300, "\x04\x40\x07\x6f\xd2\xf8\xb6\x40\x40\xb3\x80\x08\x7d\x2a\x5c\xab\x89\xfc\x98\xdf\xdf\xb1\x3e\x3c\xfe\x53\x0d\x18\xdc\x89\xf1\x8b\xba\xb2\x18\x9b\x04\x6c\xc1\xfd\x86\x2f\xc0\x7c\x58\xf4\xf0\x9e\xd3\x64\x14\x1f\x76\x5a\x72\xf0", 56); *(uint32_t*)0x10000554 = 0x38; *(uint32_t*)0x10000558 = 0x10000340; memcpy((void*)0x10000340, "\xa9\x06\x1f\xb6\xbd\x05\xbc\x02\xe5\x79\x81\x17\x04\xf0\xbf\x74\x92\xea\xcb\xc4\xd1\x51\x31\xc6\x61\x4e\xc9\x16\x2c\x22\x42\x0e\x80\xef\xdf\xa2\x5a\x98\xd2\x9e\x9e\xd2\x19\x1a\x86\xe0\xb0\xa5\x59\x07\x91\xa2\x23\x1f\xe3\x0b\xc0\x05\xcf\x55\xc0\xce\xbd\x00\x68\x73\xd9\xa3\xb9\x4f\x03\xdf\xe9\xc1\xc8\x86\x64\x2a\x40\xb7\x6c\x02\x1a\x46\x5a\xa1\xe2\xf1\xae\xe0\xfb\x48\x7c\xcf\xda\x40\x58\xb2\x64\xe5\x26\x2f\x2e\xdc\x7a\x0e\xd5\xa5\xdc\x94\xe5\xc3\x1c\x22\x22\x11\xb1\xe2\x31\x68\x97\x37\x89\xf5\xed\x5d\x8d\x17\x28\xfe\x2e\x5e\x46\x94\x19\x7a\x74\x9b\x35\x05\xbd\x76\x02\xfb\x41\x3a\xa3\xc2\xec\x48\xe2\x04\x52\x70\x4b\x84\xc6\xd9\x9f\x98\x6f\xcf\x64\xd1\x09\x79\x4c\x97\xf3\x14\x45\xc1\x35\x24\xa9\xe6\xde\x83\x20\x33\xc0\x51\x4e\x10\x72\xa6\x8c\x99\x41\xa1\xa3\xee\x4a\xce\xe7\x1e\x05\x9d\x81\x29\xb7\x98\x3c\x85\xb2\x22\xff\xcd\x1f\xa3\xba\x67\x0d\x75\x6f\xa1\xbd\xc5\x3c\xcc\xac\xba\x3b\x6d\xe4\xd2\x4e\x31\x6f\xe0\xc6\xa2", 232); *(uint32_t*)0x1000055c = 0xe8; *(uint32_t*)0x10000560 = 0x10000440; memcpy((void*)0x10000440, "\xb8\xaf\xd9\x01\x4e\xe3\xd8\xa8\x3a\xb8\xc8\xea\xa6\x4c\xdb\x5f\x0e\x70\xfc\x6e\x3a\xdf\x08\xba\x67\x5c\x68\x52\x81\x9d\x8b\x03\xd1\x90\x39\x24\x5b\x60\x7b\x2e\xf3\x81\xd2\xa1\x9f\xbe\x62\x9b\x8d\xa6\x42\x1e\x5a\x05\x71\x9d\xe0\x0b\x33\x6c\x28\x05\x54\x19\x79\xea\x17\xbd\x12\x99\xfb\x16\x9c\xf4\x1e\x0b\x21\xb6\xfb\x47\x7a\x6e\xcd\x4d\xb5\x56\x25\x51\x71\x05\xb3\xe5\xd4\x89\xe7\x05\xf4\xc3\x73\xba\x43\x4c\xe6\xb2\x40\x48\x75\x76\x51\xbe\x81\xce\xa4\xba\x53\xf7\x3f\x74\x6b\x58\x4b\x32\x50\xc1\x0e\x44\x17\x7f\x25\xa8\x0d\xa6\x2f\xe6\xec\x08\x01\x56\x9a\x5f\xdc\xd0\x21\xe1\x07\xd6\x18\x77\x27\x07\xf7\x72\x48\x6c\x5c\x33\x43\xa0\xdf\x31\xff\x28\xde\xd9\x80\x06\x9c\x30\xf6\xa0\x8a\x48\x08\x0d\xc2\x03\xeb\x3c\x34\x56\x43\x2a\x4d\xd9\x24\x9f\x50\xf1\x80\x13\x8b\xab\x15\x9c\x5b\xf3\xdb\xef\xf5\xeb\xec\x6d\xe3\xe7\x82\xfb\x47\xe8\xf0\x90\xb7\xe9\x61\xd4\xd6", 215); *(uint32_t*)0x10000564 = 0xd7; *(uint32_t*)0x1000160c = 5; *(uint32_t*)0x10001610 = 0x10001500; *(uint32_t*)0x10001500 = 0x60; *(uint32_t*)0x10001504 = 0xffff; *(uint32_t*)0x10001508 = 3; *(uint32_t*)0x1000150c = r[2]; *(uint32_t*)0x10001510 = -1; *(uint32_t*)0x10001514 = r[3]; *(uint32_t*)0x10001518 = 0; *(uint16_t*)0x1000151c = 0x10; *(uint32_t*)0x10001520 = 0; *(uint32_t*)0x10001524 = 0; *(uint32_t*)0x10001528 = -1; *(uint32_t*)0x1000152c = -1; *(uint32_t*)0x10001530 = 0; *(uint32_t*)0x10001534 = -1; *(uint32_t*)0x10001538 = -1; *(uint32_t*)0x1000153c = -1; *(uint32_t*)0x10001540 = 0; *(uint32_t*)0x10001544 = 0; *(uint32_t*)0x10001548 = 0; *(uint32_t*)0x1000154c = -1; *(uint32_t*)0x10001550 = -1; *(uint32_t*)0x10001554 = 0; *(uint32_t*)0x10001558 = -1; *(uint32_t*)0x1000155c = 0; *(uint32_t*)0x10001560 = 0x60; *(uint32_t*)0x10001564 = 0xffff; *(uint32_t*)0x10001568 = 3; *(uint32_t*)0x1000156c = 0; *(uint32_t*)0x10001570 = 0; *(uint32_t*)0x10001574 = 0; *(uint32_t*)0x10001578 = -1; *(uint16_t*)0x1000157c = 0x10; *(uint32_t*)0x10001580 = 0; *(uint32_t*)0x10001584 = -1; *(uint32_t*)0x10001588 = 0; *(uint32_t*)0x1000158c = -1; *(uint32_t*)0x10001590 = -1; *(uint32_t*)0x10001594 = -1; *(uint32_t*)0x10001598 = -1; *(uint32_t*)0x1000159c = 0; *(uint32_t*)0x100015a0 = 0; *(uint32_t*)0x100015a4 = 0; *(uint32_t*)0x100015a8 = 0; *(uint32_t*)0x100015ac = 0; *(uint32_t*)0x100015b0 = -1; *(uint32_t*)0x100015b4 = 0; *(uint32_t*)0x100015b8 = 0; *(uint32_t*)0x100015bc = 0; *(uint32_t*)0x100015c0 = 0x30; *(uint32_t*)0x100015c4 = 0xffff; *(uint32_t*)0x100015c8 = 1; *(uint32_t*)0x100015cc = r[0]; *(uint32_t*)0x100015d0 = -1; *(uint32_t*)0x100015d4 = r[0]; *(uint32_t*)0x100015d8 = r[0]; *(uint32_t*)0x100015dc = r[0]; *(uint32_t*)0x100015e0 = r[0]; *(uint32_t*)0x100015e4 = r[0]; *(uint32_t*)0x100015e8 = 0xffffff9c; *(uint32_t*)0x100015ec = -1; *(uint32_t*)0x10001614 = 0xf0; *(uint32_t*)0x10001618 = 0x20080; syscall(SYS_sendmsg, (intptr_t)r[1], 0x10001600, 0xc); break; case 10: memcpy((void*)0x10000080, "\x0f\x0f\xb6\x9b\x09\x75\x79\xbf\x2e\xf0\x0f\xc7\x0f\xc4\xe3\x15\x06\x50\x13\x7f\x0f\x2f\x06\xc4\xe3\xf9\x63\x26\x00\xc4\xe1\x17\x5c\x1f\x67\x26\x0f\x72\xd1\x0d\x66\x9d\x0f\x71\xd6\x00\xd9\xe9", 48); syz_execute_func(0x10000080); break; } } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :195:13: error: unused function 'csum_inet_init' [-Werror,-Wunused-function] static void csum_inet_init(struct csum_inet* csum) ^ :200:13: error: unused function 'csum_inet_update' [-Werror,-Wunused-function] static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) ^ :213:17: error: unused function 'csum_inet_digest' [-Werror,-Wunused-function] static uint16_t csum_inet_digest(struct csum_inet* csum) ^ 3 errors generated. compiler invocation: clang [-o /tmp/syz-executor904806256 -DGOOS_freebsd=1 -DGOARCH_386=1 -DHOSTGOOS_freebsd=1 -x c - -m32 -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -static -lc++ -Wno-overflow] --- FAIL: TestGenerate/freebsd/386/11 (1.17s) csource_test.go:118: opts: {Threaded:true Collide:false Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false UseTmpDir:false HandleSegv:false Repro:false Trace:false LegacyOptions:{Fault:false FaultCall:0 FaultNth:0}} program: r0 = kqueue() (fail_nth: 1) fcntl$setflags(r0, 0x2, 0x0) read(r0, &(0x7f0000000000)=""/57, 0x39) setsockopt$inet6_MCAST_LEAVE_GROUP(0xffffffffffffffff, 0x29, 0x51, &(0x7f0000000040)={0x4, {{0x1c, 0x1c, 0x3, 0x75, @empty, 0xdf52}}}, 0x80) fchmod(0xffffffffffffff9c, 0x80) sendto(0xffffffffffffffff, &(0x7f00000000c0)="f0da4f00d39f1b4de86997bbdb3642450da90dcb26fb91c90f629a8580f5f8e881e0469647607522dc805eb5953ea8ad5a75762736cc9f085952176a0744e839592e0687f16d3e", 0x47, 0x20188, 0x0, 0x0) r1 = accept$unix(0xffffffffffffff9c, 0x0, &(0x7f0000000140)) r2 = getppid() fhstatfs(&(0x7f0000000580)={{[0x4eecdb2d, 0x1]}, {0x100, 0x0, "35e5cf9585f49451ade1873fb93826b9"}}, &(0x7f00000005c0)={0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, [], 0x0, 0x0}) sendmsg$unix(r1, &(0x7f0000001600)={&(0x7f0000000180)=@file={0xa, 0x1, './file0\x00'}, 0xa, &(0x7f0000000540)=[{&(0x7f00000001c0)="6bca7e1c896c8d761e48bc4178d227d4cb149ce2bb7d220b8e3e2e9b91deb21446621bf63ff2cbafd4eb9bcf8a7a26bc51c3734e185d756053476d04b0cb4adf6290c5f17e2600256db3eb864c7d3e66a5bb274ddf980ddb34efccffbcfe5531ecf61f2b53689e295f91d655a694569d71732f", 0x73}, {&(0x7f0000000240)="d332313be24143da4f255aab51123847fa7632f17cf3ee7431c84243b3ee924d67b53776df412e0c9e81dd63a89e0f393bca1795193b56851b889cda6d366453d3aace82c4b8eef7afdd8e8c7a5a29770f5c3c56e76f6a40e8fed28a9a4c35321e5bb413d7a2e7e6b6069cf7a8627f5dcb48d6890d34de511381631513cdaf7ad4af86095e256a9d81a8a1b6fc30656275019b95f7b77c17c0b548d08892b49445e38143d778ba", 0xa7}, {&(0x7f0000000300)="0440076fd2f8b64040b380087d2a5cab89fc98dfdfb13e3cfe530d18dc89f18bbab2189b046cc1fd862fc07c58f4f09ed364141f765a72f0", 0x38}, {&(0x7f0000000340)="a9061fb6bd05bc02e579811704f0bf7492eacbc4d15131c6614ec9162c22420e80efdfa25a98d29e9ed2191a86e0b0a5590791a2231fe30bc005cf55c0cebd006873d9a3b94f03dfe9c1c886642a40b76c021a465aa1e2f1aee0fb487ccfda4058b264e5262f2edc7a0ed5a5dc94e5c31c222211b1e23168973789f5ed5d8d1728fe2e5e4694197a749b3505bd7602fb413aa3c2ec48e20452704b84c6d99f986fcf64d109794c97f31445c13524a9e6de832033c0514e1072a68c9941a1a3ee4acee71e059d8129b7983c85b222ffcd1fa3ba670d756fa1bdc53cccacba3b6de4d24e316fe0c6a2", 0xe8}, {&(0x7f0000000440)="b8afd9014ee3d8a83ab8c8eaa64cdb5f0e70fc6e3adf08ba675c6852819d8b03d19039245b607b2ef381d2a19fbe629b8da6421e5a05719de00b336c2805541979ea17bd1299fb169cf41e0b21b6fb477a6ecd4db55625517105b3e5d489e705f4c373ba434ce6b24048757651be81cea4ba53f73f746b584b3250c10e44177f25a80da62fe6ec0801569a5fdcd021e107d618772707f772486c5c3343a0df31ff28ded980069c30f6a08a48080dc203eb3c3456432a4dd9249f50f180138bab159c5bf3dbeff5ebec6de3e782fb47e8f090b7e961d4d6", 0xd7}], 0x5, &(0x7f0000001500)=[@cred={0x60, 0xffff, 0x3, r2, 0xffffffffffffffff, r3, 0x0, 0x10, [0x0, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xffffffffffffffff]}, @cred={0x60, 0xffff, 0x3, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0x10, [0x0, 0xffffffffffffffff, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffffffffffff]}, @rights={0x30, 0xffff, 0x1, [r0, 0xffffffffffffffff, r0, r0, r0, r0, r0, 0xffffffffffffff9c, 0xffffffffffffffff]}], 0xf0, 0x20080}, 0xc) syz_emit_ethernet(0x7e, &(0x7f0000000000)={@broadcast, @broadcast, [], {@ipv4={0x800, {{0x11, 0x4, 0x0, 0x9, 0x70, 0x65, 0xfff, 0x1, 0x45, 0x0, @empty, @empty, {[@rr={0x7, 0x27, 0x42, [@broadcast, @remote={0xac, 0x14, 0x0}, @local={0xac, 0x14, 0x0}, @multicast1, @remote={0xac, 0x14, 0x0}, @multicast2, @multicast1, @loopback, @broadcast]}, @generic={0x88, 0x6, "4e65f765"}]}}, @generic="28a61f895fbbf527b3987a02bb0dbc5f2d9e8fc684889186b7e0347c358ba58238965531ac7b77908372d8c3"}}}}) syz_execute_func(&(0x7f0000000080)="0f0fb69b097579bf2ef00fc70fc4e3150650137f0f2f06c4e3f9632600c4e1175c1f67260f72d10d669d0f71d600d9e9") syz_extract_tcp_res(&(0x7f00000000c0), 0x4, 0x0) csource_test.go:119: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static 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 BITMASK(bf_off,bf_len) (((1ull << (bf_len)) - 1) << (bf_off)) #define STORE_BY_BITMASK(type,htobe,addr,val,bf_off,bf_len) *(type*)(addr) = htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len)))) struct csum_inet { uint32_t acc; }; static void csum_inet_init(struct csum_inet* csum) { csum->acc = 0; } static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) { if (length == 0) return; size_t i = 0; for (; i < length - 1; i += 2) csum->acc += *(uint16_t*)&data[i]; if (length & 1) csum->acc += le16toh((uint16_t)data[length - 1]); while (csum->acc > 0xffff) csum->acc = (csum->acc & 0xffff) + (csum->acc >> 16); } static uint16_t csum_inet_digest(struct csum_inet* csum) { return ~csum->acc; } static void sandbox_common() { struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 8 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 0; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); } static void loop(); static int do_sandbox_none(void) { sandbox_common(); loop(); return 0; } static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 13; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); event_timedwait(&th->done, 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: inject_fault(1); res = syscall(SYS_kqueue); if (res != -1) r[0] = res; break; case 1: syscall(SYS_fcntl, (intptr_t)r[0], 2, 0); break; case 2: syscall(SYS_read, (intptr_t)r[0], 0x10000000, 0x39); break; case 3: *(uint32_t*)0x10000040 = 4; *(uint8_t*)0x10000044 = 0x1c; *(uint8_t*)0x10000045 = 0x1c; *(uint16_t*)0x10000046 = htobe16(0x4e23); *(uint32_t*)0x10000048 = 0x75; memset((void*)0x1000004c, 0, 16); *(uint32_t*)0x1000005c = 0xdf52; memset((void*)0x10000060, 0, 96); syscall(SYS_setsockopt, -1, 0x29, 0x51, 0x10000040, 0x80); break; case 4: syscall(SYS_fchmod, 0xffffff9c, 0x80); break; case 5: memcpy((void*)0x100000c0, "\xf0\xda\x4f\x00\xd3\x9f\x1b\x4d\xe8\x69\x97\xbb\xdb\x36\x42\x45\x0d\xa9\x0d\xcb\x26\xfb\x91\xc9\x0f\x62\x9a\x85\x80\xf5\xf8\xe8\x81\xe0\x46\x96\x47\x60\x75\x22\xdc\x80\x5e\xb5\x95\x3e\xa8\xad\x5a\x75\x76\x27\x36\xcc\x9f\x08\x59\x52\x17\x6a\x07\x44\xe8\x39\x59\x2e\x06\x87\xf1\x6d\x3e", 71); syscall(SYS_sendto, -1, 0x100000c0, 0x47, 0x20188, 0, 0); break; case 6: *(uint32_t*)0x10000140 = 0; res = syscall(SYS_accept, 0xffffff9c, 0, 0x10000140); if (res != -1) r[1] = res; break; case 7: res = syscall(SYS_getppid); if (res != -1) r[2] = res; break; case 8: *(uint32_t*)0x10000580 = 0x4eecdb2d; *(uint32_t*)0x10000584 = 1; *(uint16_t*)0x10000588 = 0x100; *(uint16_t*)0x1000058a = 0; memcpy((void*)0x1000058c, "\x35\xe5\xcf\x95\x85\xf4\x94\x51\xad\xe1\x87\x3f\xb9\x38\x26\xb9", 16); res = syscall(SYS_fhstatfs, 0x10000580, 0x100005c0); if (res != -1) r[3] = *(uint32_t*)0x1000067c; break; case 9: *(uint32_t*)0x10001600 = 0x10000180; *(uint8_t*)0x10000180 = 0xa; *(uint8_t*)0x10000181 = 1; memcpy((void*)0x10000182, "./file0\000", 8); *(uint32_t*)0x10001604 = 0xa; *(uint32_t*)0x10001608 = 0x10000540; *(uint32_t*)0x10000540 = 0x100001c0; memcpy((void*)0x100001c0, "\x6b\xca\x7e\x1c\x89\x6c\x8d\x76\x1e\x48\xbc\x41\x78\xd2\x27\xd4\xcb\x14\x9c\xe2\xbb\x7d\x22\x0b\x8e\x3e\x2e\x9b\x91\xde\xb2\x14\x46\x62\x1b\xf6\x3f\xf2\xcb\xaf\xd4\xeb\x9b\xcf\x8a\x7a\x26\xbc\x51\xc3\x73\x4e\x18\x5d\x75\x60\x53\x47\x6d\x04\xb0\xcb\x4a\xdf\x62\x90\xc5\xf1\x7e\x26\x00\x25\x6d\xb3\xeb\x86\x4c\x7d\x3e\x66\xa5\xbb\x27\x4d\xdf\x98\x0d\xdb\x34\xef\xcc\xff\xbc\xfe\x55\x31\xec\xf6\x1f\x2b\x53\x68\x9e\x29\x5f\x91\xd6\x55\xa6\x94\x56\x9d\x71\x73\x2f", 115); *(uint32_t*)0x10000544 = 0x73; *(uint32_t*)0x10000548 = 0x10000240; memcpy((void*)0x10000240, "\xd3\x32\x31\x3b\xe2\x41\x43\xda\x4f\x25\x5a\xab\x51\x12\x38\x47\xfa\x76\x32\xf1\x7c\xf3\xee\x74\x31\xc8\x42\x43\xb3\xee\x92\x4d\x67\xb5\x37\x76\xdf\x41\x2e\x0c\x9e\x81\xdd\x63\xa8\x9e\x0f\x39\x3b\xca\x17\x95\x19\x3b\x56\x85\x1b\x88\x9c\xda\x6d\x36\x64\x53\xd3\xaa\xce\x82\xc4\xb8\xee\xf7\xaf\xdd\x8e\x8c\x7a\x5a\x29\x77\x0f\x5c\x3c\x56\xe7\x6f\x6a\x40\xe8\xfe\xd2\x8a\x9a\x4c\x35\x32\x1e\x5b\xb4\x13\xd7\xa2\xe7\xe6\xb6\x06\x9c\xf7\xa8\x62\x7f\x5d\xcb\x48\xd6\x89\x0d\x34\xde\x51\x13\x81\x63\x15\x13\xcd\xaf\x7a\xd4\xaf\x86\x09\x5e\x25\x6a\x9d\x81\xa8\xa1\xb6\xfc\x30\x65\x62\x75\x01\x9b\x95\xf7\xb7\x7c\x17\xc0\xb5\x48\xd0\x88\x92\xb4\x94\x45\xe3\x81\x43\xd7\x78\xba", 167); *(uint32_t*)0x1000054c = 0xa7; *(uint32_t*)0x10000550 = 0x10000300; memcpy((void*)0x10000300, "\x04\x40\x07\x6f\xd2\xf8\xb6\x40\x40\xb3\x80\x08\x7d\x2a\x5c\xab\x89\xfc\x98\xdf\xdf\xb1\x3e\x3c\xfe\x53\x0d\x18\xdc\x89\xf1\x8b\xba\xb2\x18\x9b\x04\x6c\xc1\xfd\x86\x2f\xc0\x7c\x58\xf4\xf0\x9e\xd3\x64\x14\x1f\x76\x5a\x72\xf0", 56); *(uint32_t*)0x10000554 = 0x38; *(uint32_t*)0x10000558 = 0x10000340; memcpy((void*)0x10000340, "\xa9\x06\x1f\xb6\xbd\x05\xbc\x02\xe5\x79\x81\x17\x04\xf0\xbf\x74\x92\xea\xcb\xc4\xd1\x51\x31\xc6\x61\x4e\xc9\x16\x2c\x22\x42\x0e\x80\xef\xdf\xa2\x5a\x98\xd2\x9e\x9e\xd2\x19\x1a\x86\xe0\xb0\xa5\x59\x07\x91\xa2\x23\x1f\xe3\x0b\xc0\x05\xcf\x55\xc0\xce\xbd\x00\x68\x73\xd9\xa3\xb9\x4f\x03\xdf\xe9\xc1\xc8\x86\x64\x2a\x40\xb7\x6c\x02\x1a\x46\x5a\xa1\xe2\xf1\xae\xe0\xfb\x48\x7c\xcf\xda\x40\x58\xb2\x64\xe5\x26\x2f\x2e\xdc\x7a\x0e\xd5\xa5\xdc\x94\xe5\xc3\x1c\x22\x22\x11\xb1\xe2\x31\x68\x97\x37\x89\xf5\xed\x5d\x8d\x17\x28\xfe\x2e\x5e\x46\x94\x19\x7a\x74\x9b\x35\x05\xbd\x76\x02\xfb\x41\x3a\xa3\xc2\xec\x48\xe2\x04\x52\x70\x4b\x84\xc6\xd9\x9f\x98\x6f\xcf\x64\xd1\x09\x79\x4c\x97\xf3\x14\x45\xc1\x35\x24\xa9\xe6\xde\x83\x20\x33\xc0\x51\x4e\x10\x72\xa6\x8c\x99\x41\xa1\xa3\xee\x4a\xce\xe7\x1e\x05\x9d\x81\x29\xb7\x98\x3c\x85\xb2\x22\xff\xcd\x1f\xa3\xba\x67\x0d\x75\x6f\xa1\xbd\xc5\x3c\xcc\xac\xba\x3b\x6d\xe4\xd2\x4e\x31\x6f\xe0\xc6\xa2", 232); *(uint32_t*)0x1000055c = 0xe8; *(uint32_t*)0x10000560 = 0x10000440; memcpy((void*)0x10000440, "\xb8\xaf\xd9\x01\x4e\xe3\xd8\xa8\x3a\xb8\xc8\xea\xa6\x4c\xdb\x5f\x0e\x70\xfc\x6e\x3a\xdf\x08\xba\x67\x5c\x68\x52\x81\x9d\x8b\x03\xd1\x90\x39\x24\x5b\x60\x7b\x2e\xf3\x81\xd2\xa1\x9f\xbe\x62\x9b\x8d\xa6\x42\x1e\x5a\x05\x71\x9d\xe0\x0b\x33\x6c\x28\x05\x54\x19\x79\xea\x17\xbd\x12\x99\xfb\x16\x9c\xf4\x1e\x0b\x21\xb6\xfb\x47\x7a\x6e\xcd\x4d\xb5\x56\x25\x51\x71\x05\xb3\xe5\xd4\x89\xe7\x05\xf4\xc3\x73\xba\x43\x4c\xe6\xb2\x40\x48\x75\x76\x51\xbe\x81\xce\xa4\xba\x53\xf7\x3f\x74\x6b\x58\x4b\x32\x50\xc1\x0e\x44\x17\x7f\x25\xa8\x0d\xa6\x2f\xe6\xec\x08\x01\x56\x9a\x5f\xdc\xd0\x21\xe1\x07\xd6\x18\x77\x27\x07\xf7\x72\x48\x6c\x5c\x33\x43\xa0\xdf\x31\xff\x28\xde\xd9\x80\x06\x9c\x30\xf6\xa0\x8a\x48\x08\x0d\xc2\x03\xeb\x3c\x34\x56\x43\x2a\x4d\xd9\x24\x9f\x50\xf1\x80\x13\x8b\xab\x15\x9c\x5b\xf3\xdb\xef\xf5\xeb\xec\x6d\xe3\xe7\x82\xfb\x47\xe8\xf0\x90\xb7\xe9\x61\xd4\xd6", 215); *(uint32_t*)0x10000564 = 0xd7; *(uint32_t*)0x1000160c = 5; *(uint32_t*)0x10001610 = 0x10001500; *(uint32_t*)0x10001500 = 0x60; *(uint32_t*)0x10001504 = 0xffff; *(uint32_t*)0x10001508 = 3; *(uint32_t*)0x1000150c = r[2]; *(uint32_t*)0x10001510 = -1; *(uint32_t*)0x10001514 = r[3]; *(uint32_t*)0x10001518 = 0; *(uint16_t*)0x1000151c = 0x10; *(uint32_t*)0x10001520 = 0; *(uint32_t*)0x10001524 = 0; *(uint32_t*)0x10001528 = -1; *(uint32_t*)0x1000152c = -1; *(uint32_t*)0x10001530 = 0; *(uint32_t*)0x10001534 = -1; *(uint32_t*)0x10001538 = -1; *(uint32_t*)0x1000153c = -1; *(uint32_t*)0x10001540 = 0; *(uint32_t*)0x10001544 = 0; *(uint32_t*)0x10001548 = 0; *(uint32_t*)0x1000154c = -1; *(uint32_t*)0x10001550 = -1; *(uint32_t*)0x10001554 = 0; *(uint32_t*)0x10001558 = -1; *(uint32_t*)0x1000155c = 0; *(uint32_t*)0x10001560 = 0x60; *(uint32_t*)0x10001564 = 0xffff; *(uint32_t*)0x10001568 = 3; *(uint32_t*)0x1000156c = 0; *(uint32_t*)0x10001570 = 0; *(uint32_t*)0x10001574 = 0; *(uint32_t*)0x10001578 = -1; *(uint16_t*)0x1000157c = 0x10; *(uint32_t*)0x10001580 = 0; *(uint32_t*)0x10001584 = -1; *(uint32_t*)0x10001588 = 0; *(uint32_t*)0x1000158c = -1; *(uint32_t*)0x10001590 = -1; *(uint32_t*)0x10001594 = -1; *(uint32_t*)0x10001598 = -1; *(uint32_t*)0x1000159c = 0; *(uint32_t*)0x100015a0 = 0; *(uint32_t*)0x100015a4 = 0; *(uint32_t*)0x100015a8 = 0; *(uint32_t*)0x100015ac = 0; *(uint32_t*)0x100015b0 = -1; *(uint32_t*)0x100015b4 = 0; *(uint32_t*)0x100015b8 = 0; *(uint32_t*)0x100015bc = 0; *(uint32_t*)0x100015c0 = 0x30; *(uint32_t*)0x100015c4 = 0xffff; *(uint32_t*)0x100015c8 = 1; *(uint32_t*)0x100015cc = r[0]; *(uint32_t*)0x100015d0 = -1; *(uint32_t*)0x100015d4 = r[0]; *(uint32_t*)0x100015d8 = r[0]; *(uint32_t*)0x100015dc = r[0]; *(uint32_t*)0x100015e0 = r[0]; *(uint32_t*)0x100015e4 = r[0]; *(uint32_t*)0x100015e8 = 0xffffff9c; *(uint32_t*)0x100015ec = -1; *(uint32_t*)0x10001614 = 0xf0; *(uint32_t*)0x10001618 = 0x20080; syscall(SYS_sendmsg, (intptr_t)r[1], 0x10001600, 0xc); break; case 10: memcpy((void*)0x10000080, "\x0f\x0f\xb6\x9b\x09\x75\x79\xbf\x2e\xf0\x0f\xc7\x0f\xc4\xe3\x15\x06\x50\x13\x7f\x0f\x2f\x06\xc4\xe3\xf9\x63\x26\x00\xc4\xe1\x17\x5c\x1f\x67\x26\x0f\x72\xd1\x0d\x66\x9d\x0f\x71\xd6\x00\xd9\xe9", 48); syz_execute_func(0x10000080); break; } } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); setup_fault(); do_sandbox_none(); return 0; } :149:13: error: unused function 'csum_inet_init' [-Werror,-Wunused-function] static void csum_inet_init(struct csum_inet* csum) ^ :154:13: error: unused function 'csum_inet_update' [-Werror,-Wunused-function] static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) ^ :167:17: error: unused function 'csum_inet_digest' [-Werror,-Wunused-function] static uint16_t csum_inet_digest(struct csum_inet* csum) ^ 3 errors generated. compiler invocation: clang [-o /tmp/syz-executor829301525 -DGOOS_freebsd=1 -DGOARCH_386=1 -DHOSTGOOS_freebsd=1 -x c - -m32 -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -static -lc++ -Wno-overflow] --- FAIL: TestGenerate/freebsd/386/15 (1.34s) csource_test.go:118: opts: {Threaded:true Collide:true Repeat:true RepeatTimes:0 Procs:2 Slowdown:1 Sandbox:none Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false UseTmpDir:true HandleSegv:false Repro:true Trace:false LegacyOptions:{Fault:false FaultCall:0 FaultNth:0}} program: r0 = kqueue() (fail_nth: 1) fcntl$setflags(r0, 0x2, 0x0) read(r0, &(0x7f0000000000)=""/57, 0x39) setsockopt$inet6_MCAST_LEAVE_GROUP(0xffffffffffffffff, 0x29, 0x51, &(0x7f0000000040)={0x4, {{0x1c, 0x1c, 0x3, 0x75, @empty, 0xdf52}}}, 0x80) fchmod(0xffffffffffffff9c, 0x80) sendto(0xffffffffffffffff, &(0x7f00000000c0)="f0da4f00d39f1b4de86997bbdb3642450da90dcb26fb91c90f629a8580f5f8e881e0469647607522dc805eb5953ea8ad5a75762736cc9f085952176a0744e839592e0687f16d3e", 0x47, 0x20188, 0x0, 0x0) r1 = accept$unix(0xffffffffffffff9c, 0x0, &(0x7f0000000140)) r2 = getppid() fhstatfs(&(0x7f0000000580)={{[0x4eecdb2d, 0x1]}, {0x100, 0x0, "35e5cf9585f49451ade1873fb93826b9"}}, &(0x7f00000005c0)={0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, [], 0x0, 0x0}) sendmsg$unix(r1, &(0x7f0000001600)={&(0x7f0000000180)=@file={0xa, 0x1, './file0\x00'}, 0xa, &(0x7f0000000540)=[{&(0x7f00000001c0)="6bca7e1c896c8d761e48bc4178d227d4cb149ce2bb7d220b8e3e2e9b91deb21446621bf63ff2cbafd4eb9bcf8a7a26bc51c3734e185d756053476d04b0cb4adf6290c5f17e2600256db3eb864c7d3e66a5bb274ddf980ddb34efccffbcfe5531ecf61f2b53689e295f91d655a694569d71732f", 0x73}, {&(0x7f0000000240)="d332313be24143da4f255aab51123847fa7632f17cf3ee7431c84243b3ee924d67b53776df412e0c9e81dd63a89e0f393bca1795193b56851b889cda6d366453d3aace82c4b8eef7afdd8e8c7a5a29770f5c3c56e76f6a40e8fed28a9a4c35321e5bb413d7a2e7e6b6069cf7a8627f5dcb48d6890d34de511381631513cdaf7ad4af86095e256a9d81a8a1b6fc30656275019b95f7b77c17c0b548d08892b49445e38143d778ba", 0xa7}, {&(0x7f0000000300)="0440076fd2f8b64040b380087d2a5cab89fc98dfdfb13e3cfe530d18dc89f18bbab2189b046cc1fd862fc07c58f4f09ed364141f765a72f0", 0x38}, {&(0x7f0000000340)="a9061fb6bd05bc02e579811704f0bf7492eacbc4d15131c6614ec9162c22420e80efdfa25a98d29e9ed2191a86e0b0a5590791a2231fe30bc005cf55c0cebd006873d9a3b94f03dfe9c1c886642a40b76c021a465aa1e2f1aee0fb487ccfda4058b264e5262f2edc7a0ed5a5dc94e5c31c222211b1e23168973789f5ed5d8d1728fe2e5e4694197a749b3505bd7602fb413aa3c2ec48e20452704b84c6d99f986fcf64d109794c97f31445c13524a9e6de832033c0514e1072a68c9941a1a3ee4acee71e059d8129b7983c85b222ffcd1fa3ba670d756fa1bdc53cccacba3b6de4d24e316fe0c6a2", 0xe8}, {&(0x7f0000000440)="b8afd9014ee3d8a83ab8c8eaa64cdb5f0e70fc6e3adf08ba675c6852819d8b03d19039245b607b2ef381d2a19fbe629b8da6421e5a05719de00b336c2805541979ea17bd1299fb169cf41e0b21b6fb477a6ecd4db55625517105b3e5d489e705f4c373ba434ce6b24048757651be81cea4ba53f73f746b584b3250c10e44177f25a80da62fe6ec0801569a5fdcd021e107d618772707f772486c5c3343a0df31ff28ded980069c30f6a08a48080dc203eb3c3456432a4dd9249f50f180138bab159c5bf3dbeff5ebec6de3e782fb47e8f090b7e961d4d6", 0xd7}], 0x5, &(0x7f0000001500)=[@cred={0x60, 0xffff, 0x3, r2, 0xffffffffffffffff, r3, 0x0, 0x10, [0x0, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xffffffffffffffff]}, @cred={0x60, 0xffff, 0x3, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0x10, [0x0, 0xffffffffffffffff, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffffffffffff]}, @rights={0x30, 0xffff, 0x1, [r0, 0xffffffffffffffff, r0, r0, r0, r0, r0, 0xffffffffffffff9c, 0xffffffffffffffff]}], 0xf0, 0x20080}, 0xc) syz_emit_ethernet(0x7e, &(0x7f0000000000)={@broadcast, @broadcast, [], {@ipv4={0x800, {{0x11, 0x4, 0x0, 0x9, 0x70, 0x65, 0xfff, 0x1, 0x45, 0x0, @empty, @empty, {[@rr={0x7, 0x27, 0x42, [@broadcast, @remote={0xac, 0x14, 0x0}, @local={0xac, 0x14, 0x0}, @multicast1, @remote={0xac, 0x14, 0x0}, @multicast2, @multicast1, @loopback, @broadcast]}, @generic={0x88, 0x6, "4e65f765"}]}}, @generic="28a61f895fbbf527b3987a02bb0dbc5f2d9e8fc684889186b7e0347c358ba58238965531ac7b77908372d8c3"}}}}) syz_execute_func(&(0x7f0000000080)="0f0fb69b097579bf2ef00fc70fc4e3150650137f0f2f06c4e3f9632600c4e1175c1f67260f72d10d669d0f71d600d9e9") syz_extract_tcp_res(&(0x7f00000000c0), 0x4, 0x0) csource_test.go:119: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static unsigned long long procid; static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void __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); if (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 BITMASK(bf_off,bf_len) (((1ull << (bf_len)) - 1) << (bf_off)) #define STORE_BY_BITMASK(type,htobe,addr,val,bf_off,bf_len) *(type*)(addr) = htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len)))) struct csum_inet { uint32_t acc; }; static void csum_inet_init(struct csum_inet* csum) { csum->acc = 0; } static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) { if (length == 0) return; size_t i = 0; for (; i < length - 1; i += 2) csum->acc += *(uint16_t*)&data[i]; if (length & 1) csum->acc += le16toh((uint16_t)data[length - 1]); while (csum->acc > 0xffff) csum->acc = (csum->acc & 0xffff) + (csum->acc >> 16); } static uint16_t csum_inet_digest(struct csum_inet* csum) { return ~csum->acc; } static void sandbox_common() { struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 8 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 0; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); } static void loop(); static int do_sandbox_none(void) { sandbox_common(); loop(); return 0; } static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } int i, call, thread; int collide = 0; again: for (call = 0; call < 13; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (collide && (call % 2) == 0) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); if (!collide) { collide = 1; goto again; } } static void execute_one(void); #define WAIT_FLAGS 0 static void loop(void) { int iter = 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: inject_fault(1); res = syscall(SYS_kqueue); if (res != -1) r[0] = res; break; case 1: syscall(SYS_fcntl, (intptr_t)r[0], 2, 0); break; case 2: syscall(SYS_read, (intptr_t)r[0], 0x10000000, 0x39); break; case 3: *(uint32_t*)0x10000040 = 4; *(uint8_t*)0x10000044 = 0x1c; *(uint8_t*)0x10000045 = 0x1c; *(uint16_t*)0x10000046 = htobe16(0x4e23 + procid*4); *(uint32_t*)0x10000048 = 0x75; memset((void*)0x1000004c, 0, 16); *(uint32_t*)0x1000005c = 0xdf52; memset((void*)0x10000060, 0, 96); syscall(SYS_setsockopt, -1, 0x29, 0x51, 0x10000040, 0x80); break; case 4: syscall(SYS_fchmod, 0xffffff9c, 0x80); break; case 5: memcpy((void*)0x100000c0, "\xf0\xda\x4f\x00\xd3\x9f\x1b\x4d\xe8\x69\x97\xbb\xdb\x36\x42\x45\x0d\xa9\x0d\xcb\x26\xfb\x91\xc9\x0f\x62\x9a\x85\x80\xf5\xf8\xe8\x81\xe0\x46\x96\x47\x60\x75\x22\xdc\x80\x5e\xb5\x95\x3e\xa8\xad\x5a\x75\x76\x27\x36\xcc\x9f\x08\x59\x52\x17\x6a\x07\x44\xe8\x39\x59\x2e\x06\x87\xf1\x6d\x3e", 71); syscall(SYS_sendto, -1, 0x100000c0, 0x47, 0x20188, 0, 0); break; case 6: *(uint32_t*)0x10000140 = 0; res = syscall(SYS_accept, 0xffffff9c, 0, 0x10000140); if (res != -1) r[1] = res; break; case 7: res = syscall(SYS_getppid); if (res != -1) r[2] = res; break; case 8: *(uint32_t*)0x10000580 = 0x4eecdb2d; *(uint32_t*)0x10000584 = 1; *(uint16_t*)0x10000588 = 0x100; *(uint16_t*)0x1000058a = 0; memcpy((void*)0x1000058c, "\x35\xe5\xcf\x95\x85\xf4\x94\x51\xad\xe1\x87\x3f\xb9\x38\x26\xb9", 16); res = syscall(SYS_fhstatfs, 0x10000580, 0x100005c0); if (res != -1) r[3] = *(uint32_t*)0x1000067c; break; case 9: *(uint32_t*)0x10001600 = 0x10000180; *(uint8_t*)0x10000180 = 0xa; *(uint8_t*)0x10000181 = 1; memcpy((void*)0x10000182, "./file0\000", 8); *(uint32_t*)0x10001604 = 0xa; *(uint32_t*)0x10001608 = 0x10000540; *(uint32_t*)0x10000540 = 0x100001c0; memcpy((void*)0x100001c0, "\x6b\xca\x7e\x1c\x89\x6c\x8d\x76\x1e\x48\xbc\x41\x78\xd2\x27\xd4\xcb\x14\x9c\xe2\xbb\x7d\x22\x0b\x8e\x3e\x2e\x9b\x91\xde\xb2\x14\x46\x62\x1b\xf6\x3f\xf2\xcb\xaf\xd4\xeb\x9b\xcf\x8a\x7a\x26\xbc\x51\xc3\x73\x4e\x18\x5d\x75\x60\x53\x47\x6d\x04\xb0\xcb\x4a\xdf\x62\x90\xc5\xf1\x7e\x26\x00\x25\x6d\xb3\xeb\x86\x4c\x7d\x3e\x66\xa5\xbb\x27\x4d\xdf\x98\x0d\xdb\x34\xef\xcc\xff\xbc\xfe\x55\x31\xec\xf6\x1f\x2b\x53\x68\x9e\x29\x5f\x91\xd6\x55\xa6\x94\x56\x9d\x71\x73\x2f", 115); *(uint32_t*)0x10000544 = 0x73; *(uint32_t*)0x10000548 = 0x10000240; memcpy((void*)0x10000240, "\xd3\x32\x31\x3b\xe2\x41\x43\xda\x4f\x25\x5a\xab\x51\x12\x38\x47\xfa\x76\x32\xf1\x7c\xf3\xee\x74\x31\xc8\x42\x43\xb3\xee\x92\x4d\x67\xb5\x37\x76\xdf\x41\x2e\x0c\x9e\x81\xdd\x63\xa8\x9e\x0f\x39\x3b\xca\x17\x95\x19\x3b\x56\x85\x1b\x88\x9c\xda\x6d\x36\x64\x53\xd3\xaa\xce\x82\xc4\xb8\xee\xf7\xaf\xdd\x8e\x8c\x7a\x5a\x29\x77\x0f\x5c\x3c\x56\xe7\x6f\x6a\x40\xe8\xfe\xd2\x8a\x9a\x4c\x35\x32\x1e\x5b\xb4\x13\xd7\xa2\xe7\xe6\xb6\x06\x9c\xf7\xa8\x62\x7f\x5d\xcb\x48\xd6\x89\x0d\x34\xde\x51\x13\x81\x63\x15\x13\xcd\xaf\x7a\xd4\xaf\x86\x09\x5e\x25\x6a\x9d\x81\xa8\xa1\xb6\xfc\x30\x65\x62\x75\x01\x9b\x95\xf7\xb7\x7c\x17\xc0\xb5\x48\xd0\x88\x92\xb4\x94\x45\xe3\x81\x43\xd7\x78\xba", 167); *(uint32_t*)0x1000054c = 0xa7; *(uint32_t*)0x10000550 = 0x10000300; memcpy((void*)0x10000300, "\x04\x40\x07\x6f\xd2\xf8\xb6\x40\x40\xb3\x80\x08\x7d\x2a\x5c\xab\x89\xfc\x98\xdf\xdf\xb1\x3e\x3c\xfe\x53\x0d\x18\xdc\x89\xf1\x8b\xba\xb2\x18\x9b\x04\x6c\xc1\xfd\x86\x2f\xc0\x7c\x58\xf4\xf0\x9e\xd3\x64\x14\x1f\x76\x5a\x72\xf0", 56); *(uint32_t*)0x10000554 = 0x38; *(uint32_t*)0x10000558 = 0x10000340; memcpy((void*)0x10000340, "\xa9\x06\x1f\xb6\xbd\x05\xbc\x02\xe5\x79\x81\x17\x04\xf0\xbf\x74\x92\xea\xcb\xc4\xd1\x51\x31\xc6\x61\x4e\xc9\x16\x2c\x22\x42\x0e\x80\xef\xdf\xa2\x5a\x98\xd2\x9e\x9e\xd2\x19\x1a\x86\xe0\xb0\xa5\x59\x07\x91\xa2\x23\x1f\xe3\x0b\xc0\x05\xcf\x55\xc0\xce\xbd\x00\x68\x73\xd9\xa3\xb9\x4f\x03\xdf\xe9\xc1\xc8\x86\x64\x2a\x40\xb7\x6c\x02\x1a\x46\x5a\xa1\xe2\xf1\xae\xe0\xfb\x48\x7c\xcf\xda\x40\x58\xb2\x64\xe5\x26\x2f\x2e\xdc\x7a\x0e\xd5\xa5\xdc\x94\xe5\xc3\x1c\x22\x22\x11\xb1\xe2\x31\x68\x97\x37\x89\xf5\xed\x5d\x8d\x17\x28\xfe\x2e\x5e\x46\x94\x19\x7a\x74\x9b\x35\x05\xbd\x76\x02\xfb\x41\x3a\xa3\xc2\xec\x48\xe2\x04\x52\x70\x4b\x84\xc6\xd9\x9f\x98\x6f\xcf\x64\xd1\x09\x79\x4c\x97\xf3\x14\x45\xc1\x35\x24\xa9\xe6\xde\x83\x20\x33\xc0\x51\x4e\x10\x72\xa6\x8c\x99\x41\xa1\xa3\xee\x4a\xce\xe7\x1e\x05\x9d\x81\x29\xb7\x98\x3c\x85\xb2\x22\xff\xcd\x1f\xa3\xba\x67\x0d\x75\x6f\xa1\xbd\xc5\x3c\xcc\xac\xba\x3b\x6d\xe4\xd2\x4e\x31\x6f\xe0\xc6\xa2", 232); *(uint32_t*)0x1000055c = 0xe8; *(uint32_t*)0x10000560 = 0x10000440; memcpy((void*)0x10000440, "\xb8\xaf\xd9\x01\x4e\xe3\xd8\xa8\x3a\xb8\xc8\xea\xa6\x4c\xdb\x5f\x0e\x70\xfc\x6e\x3a\xdf\x08\xba\x67\x5c\x68\x52\x81\x9d\x8b\x03\xd1\x90\x39\x24\x5b\x60\x7b\x2e\xf3\x81\xd2\xa1\x9f\xbe\x62\x9b\x8d\xa6\x42\x1e\x5a\x05\x71\x9d\xe0\x0b\x33\x6c\x28\x05\x54\x19\x79\xea\x17\xbd\x12\x99\xfb\x16\x9c\xf4\x1e\x0b\x21\xb6\xfb\x47\x7a\x6e\xcd\x4d\xb5\x56\x25\x51\x71\x05\xb3\xe5\xd4\x89\xe7\x05\xf4\xc3\x73\xba\x43\x4c\xe6\xb2\x40\x48\x75\x76\x51\xbe\x81\xce\xa4\xba\x53\xf7\x3f\x74\x6b\x58\x4b\x32\x50\xc1\x0e\x44\x17\x7f\x25\xa8\x0d\xa6\x2f\xe6\xec\x08\x01\x56\x9a\x5f\xdc\xd0\x21\xe1\x07\xd6\x18\x77\x27\x07\xf7\x72\x48\x6c\x5c\x33\x43\xa0\xdf\x31\xff\x28\xde\xd9\x80\x06\x9c\x30\xf6\xa0\x8a\x48\x08\x0d\xc2\x03\xeb\x3c\x34\x56\x43\x2a\x4d\xd9\x24\x9f\x50\xf1\x80\x13\x8b\xab\x15\x9c\x5b\xf3\xdb\xef\xf5\xeb\xec\x6d\xe3\xe7\x82\xfb\x47\xe8\xf0\x90\xb7\xe9\x61\xd4\xd6", 215); *(uint32_t*)0x10000564 = 0xd7; *(uint32_t*)0x1000160c = 5; *(uint32_t*)0x10001610 = 0x10001500; *(uint32_t*)0x10001500 = 0x60; *(uint32_t*)0x10001504 = 0xffff; *(uint32_t*)0x10001508 = 3; *(uint32_t*)0x1000150c = r[2]; *(uint32_t*)0x10001510 = -1; *(uint32_t*)0x10001514 = r[3]; *(uint32_t*)0x10001518 = 0; *(uint16_t*)0x1000151c = 0x10; *(uint32_t*)0x10001520 = 0; *(uint32_t*)0x10001524 = 0; *(uint32_t*)0x10001528 = -1; *(uint32_t*)0x1000152c = -1; *(uint32_t*)0x10001530 = 0; *(uint32_t*)0x10001534 = -1; *(uint32_t*)0x10001538 = -1; *(uint32_t*)0x1000153c = -1; *(uint32_t*)0x10001540 = 0; *(uint32_t*)0x10001544 = 0; *(uint32_t*)0x10001548 = 0; *(uint32_t*)0x1000154c = -1; *(uint32_t*)0x10001550 = -1; *(uint32_t*)0x10001554 = 0; *(uint32_t*)0x10001558 = -1; *(uint32_t*)0x1000155c = 0; *(uint32_t*)0x10001560 = 0x60; *(uint32_t*)0x10001564 = 0xffff; *(uint32_t*)0x10001568 = 3; *(uint32_t*)0x1000156c = 0; *(uint32_t*)0x10001570 = 0; *(uint32_t*)0x10001574 = 0; *(uint32_t*)0x10001578 = -1; *(uint16_t*)0x1000157c = 0x10; *(uint32_t*)0x10001580 = 0; *(uint32_t*)0x10001584 = -1; *(uint32_t*)0x10001588 = 0; *(uint32_t*)0x1000158c = -1; *(uint32_t*)0x10001590 = -1; *(uint32_t*)0x10001594 = -1; *(uint32_t*)0x10001598 = -1; *(uint32_t*)0x1000159c = 0; *(uint32_t*)0x100015a0 = 0; *(uint32_t*)0x100015a4 = 0; *(uint32_t*)0x100015a8 = 0; *(uint32_t*)0x100015ac = 0; *(uint32_t*)0x100015b0 = -1; *(uint32_t*)0x100015b4 = 0; *(uint32_t*)0x100015b8 = 0; *(uint32_t*)0x100015bc = 0; *(uint32_t*)0x100015c0 = 0x30; *(uint32_t*)0x100015c4 = 0xffff; *(uint32_t*)0x100015c8 = 1; *(uint32_t*)0x100015cc = r[0]; *(uint32_t*)0x100015d0 = -1; *(uint32_t*)0x100015d4 = r[0]; *(uint32_t*)0x100015d8 = r[0]; *(uint32_t*)0x100015dc = r[0]; *(uint32_t*)0x100015e0 = r[0]; *(uint32_t*)0x100015e4 = r[0]; *(uint32_t*)0x100015e8 = 0xffffff9c; *(uint32_t*)0x100015ec = -1; *(uint32_t*)0x10001614 = 0xf0; *(uint32_t*)0x10001618 = 0x20080; syscall(SYS_sendmsg, (intptr_t)r[1], 0x10001600, 0xc); break; case 10: memcpy((void*)0x10000080, "\x0f\x0f\xb6\x9b\x09\x75\x79\xbf\x2e\xf0\x0f\xc7\x0f\xc4\xe3\x15\x06\x50\x13\x7f\x0f\x2f\x06\xc4\xe3\xf9\x63\x26\x00\xc4\xe1\x17\x5c\x1f\x67\x26\x0f\x72\xd1\x0d\x66\x9d\x0f\x71\xd6\x00\xd9\xe9", 48); syz_execute_func(0x10000080); break; } } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); setup_fault(); for (procid = 0; procid < 2; procid++) { if (fork() == 0) { use_temporary_dir(); do_sandbox_none(); } } sleep(1000000); return 0; } :197:13: error: unused function 'csum_inet_init' [-Werror,-Wunused-function] static void csum_inet_init(struct csum_inet* csum) ^ :202:13: error: unused function 'csum_inet_update' [-Werror,-Wunused-function] static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) ^ :215:17: error: unused function 'csum_inet_digest' [-Werror,-Wunused-function] static uint16_t csum_inet_digest(struct csum_inet* csum) ^ 3 errors generated. compiler invocation: clang [-o /tmp/syz-executor640904619 -DGOOS_freebsd=1 -DGOARCH_386=1 -DHOSTGOOS_freebsd=1 -x c - -m32 -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -static -lc++ -Wno-overflow] --- FAIL: TestGenerate/freebsd/386/9 (1.16s) csource_test.go:118: opts: {Threaded:true Collide:false Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:setuid Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Fault:false FaultCall:0 FaultNth:0}} program: r0 = kqueue() (fail_nth: 1) fcntl$setflags(r0, 0x2, 0x0) read(r0, &(0x7f0000000000)=""/57, 0x39) setsockopt$inet6_MCAST_LEAVE_GROUP(0xffffffffffffffff, 0x29, 0x51, &(0x7f0000000040)={0x4, {{0x1c, 0x1c, 0x3, 0x75, @empty, 0xdf52}}}, 0x80) fchmod(0xffffffffffffff9c, 0x80) sendto(0xffffffffffffffff, &(0x7f00000000c0)="f0da4f00d39f1b4de86997bbdb3642450da90dcb26fb91c90f629a8580f5f8e881e0469647607522dc805eb5953ea8ad5a75762736cc9f085952176a0744e839592e0687f16d3e", 0x47, 0x20188, 0x0, 0x0) r1 = accept$unix(0xffffffffffffff9c, 0x0, &(0x7f0000000140)) r2 = getppid() fhstatfs(&(0x7f0000000580)={{[0x4eecdb2d, 0x1]}, {0x100, 0x0, "35e5cf9585f49451ade1873fb93826b9"}}, &(0x7f00000005c0)={0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, [], 0x0, 0x0}) sendmsg$unix(r1, &(0x7f0000001600)={&(0x7f0000000180)=@file={0xa, 0x1, './file0\x00'}, 0xa, &(0x7f0000000540)=[{&(0x7f00000001c0)="6bca7e1c896c8d761e48bc4178d227d4cb149ce2bb7d220b8e3e2e9b91deb21446621bf63ff2cbafd4eb9bcf8a7a26bc51c3734e185d756053476d04b0cb4adf6290c5f17e2600256db3eb864c7d3e66a5bb274ddf980ddb34efccffbcfe5531ecf61f2b53689e295f91d655a694569d71732f", 0x73}, {&(0x7f0000000240)="d332313be24143da4f255aab51123847fa7632f17cf3ee7431c84243b3ee924d67b53776df412e0c9e81dd63a89e0f393bca1795193b56851b889cda6d366453d3aace82c4b8eef7afdd8e8c7a5a29770f5c3c56e76f6a40e8fed28a9a4c35321e5bb413d7a2e7e6b6069cf7a8627f5dcb48d6890d34de511381631513cdaf7ad4af86095e256a9d81a8a1b6fc30656275019b95f7b77c17c0b548d08892b49445e38143d778ba", 0xa7}, {&(0x7f0000000300)="0440076fd2f8b64040b380087d2a5cab89fc98dfdfb13e3cfe530d18dc89f18bbab2189b046cc1fd862fc07c58f4f09ed364141f765a72f0", 0x38}, {&(0x7f0000000340)="a9061fb6bd05bc02e579811704f0bf7492eacbc4d15131c6614ec9162c22420e80efdfa25a98d29e9ed2191a86e0b0a5590791a2231fe30bc005cf55c0cebd006873d9a3b94f03dfe9c1c886642a40b76c021a465aa1e2f1aee0fb487ccfda4058b264e5262f2edc7a0ed5a5dc94e5c31c222211b1e23168973789f5ed5d8d1728fe2e5e4694197a749b3505bd7602fb413aa3c2ec48e20452704b84c6d99f986fcf64d109794c97f31445c13524a9e6de832033c0514e1072a68c9941a1a3ee4acee71e059d8129b7983c85b222ffcd1fa3ba670d756fa1bdc53cccacba3b6de4d24e316fe0c6a2", 0xe8}, {&(0x7f0000000440)="b8afd9014ee3d8a83ab8c8eaa64cdb5f0e70fc6e3adf08ba675c6852819d8b03d19039245b607b2ef381d2a19fbe629b8da6421e5a05719de00b336c2805541979ea17bd1299fb169cf41e0b21b6fb477a6ecd4db55625517105b3e5d489e705f4c373ba434ce6b24048757651be81cea4ba53f73f746b584b3250c10e44177f25a80da62fe6ec0801569a5fdcd021e107d618772707f772486c5c3343a0df31ff28ded980069c30f6a08a48080dc203eb3c3456432a4dd9249f50f180138bab159c5bf3dbeff5ebec6de3e782fb47e8f090b7e961d4d6", 0xd7}], 0x5, &(0x7f0000001500)=[@cred={0x60, 0xffff, 0x3, r2, 0xffffffffffffffff, r3, 0x0, 0x10, [0x0, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xffffffffffffffff]}, @cred={0x60, 0xffff, 0x3, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0x10, [0x0, 0xffffffffffffffff, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffffffffffff]}, @rights={0x30, 0xffff, 0x1, [r0, 0xffffffffffffffff, r0, r0, r0, r0, r0, 0xffffffffffffff9c, 0xffffffffffffffff]}], 0xf0, 0x20080}, 0xc) syz_emit_ethernet(0x7e, &(0x7f0000000000)={@broadcast, @broadcast, [], {@ipv4={0x800, {{0x11, 0x4, 0x0, 0x9, 0x70, 0x65, 0xfff, 0x1, 0x45, 0x0, @empty, @empty, {[@rr={0x7, 0x27, 0x42, [@broadcast, @remote={0xac, 0x14, 0x0}, @local={0xac, 0x14, 0x0}, @multicast1, @remote={0xac, 0x14, 0x0}, @multicast2, @multicast1, @loopback, @broadcast]}, @generic={0x88, 0x6, "4e65f765"}]}}, @generic="28a61f895fbbf527b3987a02bb0dbc5f2d9e8fc684889186b7e0347c358ba58238965531ac7b77908372d8c3"}}}}) syz_execute_func(&(0x7f0000000080)="0f0fb69b097579bf2ef00fc70fc4e3150650137f0f2f06c4e3f9632600c4e1175c1f67260f72d10d669d0f71d600d9e9") syz_extract_tcp_res(&(0x7f00000000c0), 0x4, 0x0) csource_test.go:119: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void __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); if (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 BITMASK(bf_off,bf_len) (((1ull << (bf_len)) - 1) << (bf_off)) #define STORE_BY_BITMASK(type,htobe,addr,val,bf_off,bf_len) *(type*)(addr) = htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len)))) struct csum_inet { uint32_t acc; }; static void csum_inet_init(struct csum_inet* csum) { csum->acc = 0; } static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) { if (length == 0) return; size_t i = 0; for (; i < length - 1; i += 2) csum->acc += *(uint16_t*)&data[i]; if (length & 1) csum->acc += le16toh((uint16_t)data[length - 1]); while (csum->acc > 0xffff) csum->acc = (csum->acc & 0xffff) + (csum->acc >> 16); } static uint16_t csum_inet_digest(struct csum_inet* csum) { return ~csum->acc; } static void sandbox_common() { struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 8 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 0; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); } static void loop(); static int wait_for_loop(int pid) { if (pid < 0) exit(1); int status = 0; while (waitpid(-1, &status, WUNTRACED) != pid) { } return WEXITSTATUS(status); } static int do_sandbox_setuid(void) { int pid = fork(); if (pid != 0) return wait_for_loop(pid); sandbox_common(); char pwbuf[1024]; struct passwd *pw, pwres; if (getpwnam_r("nobody", &pwres, pwbuf, sizeof(pwbuf), &pw) != 0 || !pw) exit(1); if (setgroups(0, NULL)) exit(1); if (setgid(pw->pw_gid)) exit(1); if (setuid(pw->pw_uid)) exit(1); loop(); exit(1); } static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 13; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); event_timedwait(&th->done, 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: inject_fault(1); res = syscall(SYS_kqueue); if (res != -1) r[0] = res; break; case 1: syscall(SYS_fcntl, (intptr_t)r[0], 2, 0); break; case 2: syscall(SYS_read, (intptr_t)r[0], 0x10000000, 0x39); break; case 3: *(uint32_t*)0x10000040 = 4; *(uint8_t*)0x10000044 = 0x1c; *(uint8_t*)0x10000045 = 0x1c; *(uint16_t*)0x10000046 = htobe16(0x4e23); *(uint32_t*)0x10000048 = 0x75; memset((void*)0x1000004c, 0, 16); *(uint32_t*)0x1000005c = 0xdf52; memset((void*)0x10000060, 0, 96); syscall(SYS_setsockopt, -1, 0x29, 0x51, 0x10000040, 0x80); break; case 4: syscall(SYS_fchmod, 0xffffff9c, 0x80); break; case 5: memcpy((void*)0x100000c0, "\xf0\xda\x4f\x00\xd3\x9f\x1b\x4d\xe8\x69\x97\xbb\xdb\x36\x42\x45\x0d\xa9\x0d\xcb\x26\xfb\x91\xc9\x0f\x62\x9a\x85\x80\xf5\xf8\xe8\x81\xe0\x46\x96\x47\x60\x75\x22\xdc\x80\x5e\xb5\x95\x3e\xa8\xad\x5a\x75\x76\x27\x36\xcc\x9f\x08\x59\x52\x17\x6a\x07\x44\xe8\x39\x59\x2e\x06\x87\xf1\x6d\x3e", 71); syscall(SYS_sendto, -1, 0x100000c0, 0x47, 0x20188, 0, 0); break; case 6: *(uint32_t*)0x10000140 = 0; res = syscall(SYS_accept, 0xffffff9c, 0, 0x10000140); if (res != -1) r[1] = res; break; case 7: res = syscall(SYS_getppid); if (res != -1) r[2] = res; break; case 8: *(uint32_t*)0x10000580 = 0x4eecdb2d; *(uint32_t*)0x10000584 = 1; *(uint16_t*)0x10000588 = 0x100; *(uint16_t*)0x1000058a = 0; memcpy((void*)0x1000058c, "\x35\xe5\xcf\x95\x85\xf4\x94\x51\xad\xe1\x87\x3f\xb9\x38\x26\xb9", 16); res = syscall(SYS_fhstatfs, 0x10000580, 0x100005c0); if (res != -1) r[3] = *(uint32_t*)0x1000067c; break; case 9: *(uint32_t*)0x10001600 = 0x10000180; *(uint8_t*)0x10000180 = 0xa; *(uint8_t*)0x10000181 = 1; memcpy((void*)0x10000182, "./file0\000", 8); *(uint32_t*)0x10001604 = 0xa; *(uint32_t*)0x10001608 = 0x10000540; *(uint32_t*)0x10000540 = 0x100001c0; memcpy((void*)0x100001c0, "\x6b\xca\x7e\x1c\x89\x6c\x8d\x76\x1e\x48\xbc\x41\x78\xd2\x27\xd4\xcb\x14\x9c\xe2\xbb\x7d\x22\x0b\x8e\x3e\x2e\x9b\x91\xde\xb2\x14\x46\x62\x1b\xf6\x3f\xf2\xcb\xaf\xd4\xeb\x9b\xcf\x8a\x7a\x26\xbc\x51\xc3\x73\x4e\x18\x5d\x75\x60\x53\x47\x6d\x04\xb0\xcb\x4a\xdf\x62\x90\xc5\xf1\x7e\x26\x00\x25\x6d\xb3\xeb\x86\x4c\x7d\x3e\x66\xa5\xbb\x27\x4d\xdf\x98\x0d\xdb\x34\xef\xcc\xff\xbc\xfe\x55\x31\xec\xf6\x1f\x2b\x53\x68\x9e\x29\x5f\x91\xd6\x55\xa6\x94\x56\x9d\x71\x73\x2f", 115); *(uint32_t*)0x10000544 = 0x73; *(uint32_t*)0x10000548 = 0x10000240; memcpy((void*)0x10000240, "\xd3\x32\x31\x3b\xe2\x41\x43\xda\x4f\x25\x5a\xab\x51\x12\x38\x47\xfa\x76\x32\xf1\x7c\xf3\xee\x74\x31\xc8\x42\x43\xb3\xee\x92\x4d\x67\xb5\x37\x76\xdf\x41\x2e\x0c\x9e\x81\xdd\x63\xa8\x9e\x0f\x39\x3b\xca\x17\x95\x19\x3b\x56\x85\x1b\x88\x9c\xda\x6d\x36\x64\x53\xd3\xaa\xce\x82\xc4\xb8\xee\xf7\xaf\xdd\x8e\x8c\x7a\x5a\x29\x77\x0f\x5c\x3c\x56\xe7\x6f\x6a\x40\xe8\xfe\xd2\x8a\x9a\x4c\x35\x32\x1e\x5b\xb4\x13\xd7\xa2\xe7\xe6\xb6\x06\x9c\xf7\xa8\x62\x7f\x5d\xcb\x48\xd6\x89\x0d\x34\xde\x51\x13\x81\x63\x15\x13\xcd\xaf\x7a\xd4\xaf\x86\x09\x5e\x25\x6a\x9d\x81\xa8\xa1\xb6\xfc\x30\x65\x62\x75\x01\x9b\x95\xf7\xb7\x7c\x17\xc0\xb5\x48\xd0\x88\x92\xb4\x94\x45\xe3\x81\x43\xd7\x78\xba", 167); *(uint32_t*)0x1000054c = 0xa7; *(uint32_t*)0x10000550 = 0x10000300; memcpy((void*)0x10000300, "\x04\x40\x07\x6f\xd2\xf8\xb6\x40\x40\xb3\x80\x08\x7d\x2a\x5c\xab\x89\xfc\x98\xdf\xdf\xb1\x3e\x3c\xfe\x53\x0d\x18\xdc\x89\xf1\x8b\xba\xb2\x18\x9b\x04\x6c\xc1\xfd\x86\x2f\xc0\x7c\x58\xf4\xf0\x9e\xd3\x64\x14\x1f\x76\x5a\x72\xf0", 56); *(uint32_t*)0x10000554 = 0x38; *(uint32_t*)0x10000558 = 0x10000340; memcpy((void*)0x10000340, "\xa9\x06\x1f\xb6\xbd\x05\xbc\x02\xe5\x79\x81\x17\x04\xf0\xbf\x74\x92\xea\xcb\xc4\xd1\x51\x31\xc6\x61\x4e\xc9\x16\x2c\x22\x42\x0e\x80\xef\xdf\xa2\x5a\x98\xd2\x9e\x9e\xd2\x19\x1a\x86\xe0\xb0\xa5\x59\x07\x91\xa2\x23\x1f\xe3\x0b\xc0\x05\xcf\x55\xc0\xce\xbd\x00\x68\x73\xd9\xa3\xb9\x4f\x03\xdf\xe9\xc1\xc8\x86\x64\x2a\x40\xb7\x6c\x02\x1a\x46\x5a\xa1\xe2\xf1\xae\xe0\xfb\x48\x7c\xcf\xda\x40\x58\xb2\x64\xe5\x26\x2f\x2e\xdc\x7a\x0e\xd5\xa5\xdc\x94\xe5\xc3\x1c\x22\x22\x11\xb1\xe2\x31\x68\x97\x37\x89\xf5\xed\x5d\x8d\x17\x28\xfe\x2e\x5e\x46\x94\x19\x7a\x74\x9b\x35\x05\xbd\x76\x02\xfb\x41\x3a\xa3\xc2\xec\x48\xe2\x04\x52\x70\x4b\x84\xc6\xd9\x9f\x98\x6f\xcf\x64\xd1\x09\x79\x4c\x97\xf3\x14\x45\xc1\x35\x24\xa9\xe6\xde\x83\x20\x33\xc0\x51\x4e\x10\x72\xa6\x8c\x99\x41\xa1\xa3\xee\x4a\xce\xe7\x1e\x05\x9d\x81\x29\xb7\x98\x3c\x85\xb2\x22\xff\xcd\x1f\xa3\xba\x67\x0d\x75\x6f\xa1\xbd\xc5\x3c\xcc\xac\xba\x3b\x6d\xe4\xd2\x4e\x31\x6f\xe0\xc6\xa2", 232); *(uint32_t*)0x1000055c = 0xe8; *(uint32_t*)0x10000560 = 0x10000440; memcpy((void*)0x10000440, "\xb8\xaf\xd9\x01\x4e\xe3\xd8\xa8\x3a\xb8\xc8\xea\xa6\x4c\xdb\x5f\x0e\x70\xfc\x6e\x3a\xdf\x08\xba\x67\x5c\x68\x52\x81\x9d\x8b\x03\xd1\x90\x39\x24\x5b\x60\x7b\x2e\xf3\x81\xd2\xa1\x9f\xbe\x62\x9b\x8d\xa6\x42\x1e\x5a\x05\x71\x9d\xe0\x0b\x33\x6c\x28\x05\x54\x19\x79\xea\x17\xbd\x12\x99\xfb\x16\x9c\xf4\x1e\x0b\x21\xb6\xfb\x47\x7a\x6e\xcd\x4d\xb5\x56\x25\x51\x71\x05\xb3\xe5\xd4\x89\xe7\x05\xf4\xc3\x73\xba\x43\x4c\xe6\xb2\x40\x48\x75\x76\x51\xbe\x81\xce\xa4\xba\x53\xf7\x3f\x74\x6b\x58\x4b\x32\x50\xc1\x0e\x44\x17\x7f\x25\xa8\x0d\xa6\x2f\xe6\xec\x08\x01\x56\x9a\x5f\xdc\xd0\x21\xe1\x07\xd6\x18\x77\x27\x07\xf7\x72\x48\x6c\x5c\x33\x43\xa0\xdf\x31\xff\x28\xde\xd9\x80\x06\x9c\x30\xf6\xa0\x8a\x48\x08\x0d\xc2\x03\xeb\x3c\x34\x56\x43\x2a\x4d\xd9\x24\x9f\x50\xf1\x80\x13\x8b\xab\x15\x9c\x5b\xf3\xdb\xef\xf5\xeb\xec\x6d\xe3\xe7\x82\xfb\x47\xe8\xf0\x90\xb7\xe9\x61\xd4\xd6", 215); *(uint32_t*)0x10000564 = 0xd7; *(uint32_t*)0x1000160c = 5; *(uint32_t*)0x10001610 = 0x10001500; *(uint32_t*)0x10001500 = 0x60; *(uint32_t*)0x10001504 = 0xffff; *(uint32_t*)0x10001508 = 3; *(uint32_t*)0x1000150c = r[2]; *(uint32_t*)0x10001510 = -1; *(uint32_t*)0x10001514 = r[3]; *(uint32_t*)0x10001518 = 0; *(uint16_t*)0x1000151c = 0x10; *(uint32_t*)0x10001520 = 0; *(uint32_t*)0x10001524 = 0; *(uint32_t*)0x10001528 = -1; *(uint32_t*)0x1000152c = -1; *(uint32_t*)0x10001530 = 0; *(uint32_t*)0x10001534 = -1; *(uint32_t*)0x10001538 = -1; *(uint32_t*)0x1000153c = -1; *(uint32_t*)0x10001540 = 0; *(uint32_t*)0x10001544 = 0; *(uint32_t*)0x10001548 = 0; *(uint32_t*)0x1000154c = -1; *(uint32_t*)0x10001550 = -1; *(uint32_t*)0x10001554 = 0; *(uint32_t*)0x10001558 = -1; *(uint32_t*)0x1000155c = 0; *(uint32_t*)0x10001560 = 0x60; *(uint32_t*)0x10001564 = 0xffff; *(uint32_t*)0x10001568 = 3; *(uint32_t*)0x1000156c = 0; *(uint32_t*)0x10001570 = 0; *(uint32_t*)0x10001574 = 0; *(uint32_t*)0x10001578 = -1; *(uint16_t*)0x1000157c = 0x10; *(uint32_t*)0x10001580 = 0; *(uint32_t*)0x10001584 = -1; *(uint32_t*)0x10001588 = 0; *(uint32_t*)0x1000158c = -1; *(uint32_t*)0x10001590 = -1; *(uint32_t*)0x10001594 = -1; *(uint32_t*)0x10001598 = -1; *(uint32_t*)0x1000159c = 0; *(uint32_t*)0x100015a0 = 0; *(uint32_t*)0x100015a4 = 0; *(uint32_t*)0x100015a8 = 0; *(uint32_t*)0x100015ac = 0; *(uint32_t*)0x100015b0 = -1; *(uint32_t*)0x100015b4 = 0; *(uint32_t*)0x100015b8 = 0; *(uint32_t*)0x100015bc = 0; *(uint32_t*)0x100015c0 = 0x30; *(uint32_t*)0x100015c4 = 0xffff; *(uint32_t*)0x100015c8 = 1; *(uint32_t*)0x100015cc = r[0]; *(uint32_t*)0x100015d0 = -1; *(uint32_t*)0x100015d4 = r[0]; *(uint32_t*)0x100015d8 = r[0]; *(uint32_t*)0x100015dc = r[0]; *(uint32_t*)0x100015e0 = r[0]; *(uint32_t*)0x100015e4 = r[0]; *(uint32_t*)0x100015e8 = 0xffffff9c; *(uint32_t*)0x100015ec = -1; *(uint32_t*)0x10001614 = 0xf0; *(uint32_t*)0x10001618 = 0x20080; syscall(SYS_sendmsg, (intptr_t)r[1], 0x10001600, 0xc); break; case 10: memcpy((void*)0x10000080, "\x0f\x0f\xb6\x9b\x09\x75\x79\xbf\x2e\xf0\x0f\xc7\x0f\xc4\xe3\x15\x06\x50\x13\x7f\x0f\x2f\x06\xc4\xe3\xf9\x63\x26\x00\xc4\xe1\x17\x5c\x1f\x67\x26\x0f\x72\xd1\x0d\x66\x9d\x0f\x71\xd6\x00\xd9\xe9", 48); syz_execute_func(0x10000080); break; } } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); setup_fault(); use_temporary_dir(); do_sandbox_setuid(); return 0; } :195:13: error: unused function 'csum_inet_init' [-Werror,-Wunused-function] static void csum_inet_init(struct csum_inet* csum) ^ :200:13: error: unused function 'csum_inet_update' [-Werror,-Wunused-function] static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) ^ :213:17: error: unused function 'csum_inet_digest' [-Werror,-Wunused-function] static uint16_t csum_inet_digest(struct csum_inet* csum) ^ 3 errors generated. compiler invocation: clang [-o /tmp/syz-executor623691791 -DGOOS_freebsd=1 -DGOARCH_386=1 -DHOSTGOOS_freebsd=1 -x c - -m32 -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -static -lc++ -Wno-overflow] --- FAIL: TestGenerate/freebsd/386/6 (1.20s) csource_test.go:116: --- FAIL: TestGenerate/freebsd/386/3 (1.21s) csource_test.go:116: --- FAIL: TestGenerate/freebsd/386/4 (1.21s) csource_test.go:116: --- FAIL: TestGenerate/freebsd/386/7 (1.33s) csource_test.go:116: FAIL FAIL github.com/google/syzkaller/pkg/csource 9.981s ok github.com/google/syzkaller/pkg/db (cached) ? github.com/google/syzkaller/pkg/debugtracer [no test files] ok github.com/google/syzkaller/pkg/email (cached) ? github.com/google/syzkaller/pkg/gce [no test files] ? github.com/google/syzkaller/pkg/gcs [no test files] ? github.com/google/syzkaller/pkg/hash [no test files] ok github.com/google/syzkaller/pkg/host 1.204s ? github.com/google/syzkaller/pkg/html [no test files] ok github.com/google/syzkaller/pkg/ifuzz (cached) ? 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] ok github.com/google/syzkaller/pkg/instance 1.145s ok github.com/google/syzkaller/pkg/ipc 4.656s ? github.com/google/syzkaller/pkg/ipc/ipcconfig [no test files] ? github.com/google/syzkaller/pkg/kcidb [no test files] ok github.com/google/syzkaller/pkg/kconfig 0.059s ok github.com/google/syzkaller/pkg/kd (cached) ok github.com/google/syzkaller/pkg/log (cached) ok github.com/google/syzkaller/pkg/mgrconfig (cached) ok github.com/google/syzkaller/pkg/osutil (cached) ok github.com/google/syzkaller/pkg/report 5.430s ok github.com/google/syzkaller/pkg/repro (cached) ? github.com/google/syzkaller/pkg/rpctype [no test files] ok github.com/google/syzkaller/pkg/runtest 53.267s ok github.com/google/syzkaller/pkg/serializer (cached) ? github.com/google/syzkaller/pkg/signal [no test files] ok github.com/google/syzkaller/pkg/symbolizer 0.341s ok github.com/google/syzkaller/pkg/tool (cached) ok github.com/google/syzkaller/pkg/vcs 12.615s ok github.com/google/syzkaller/prog (cached) ok github.com/google/syzkaller/prog/test (cached) ? github.com/google/syzkaller/sys [no test files] ? github.com/google/syzkaller/sys/akaros [no test files] ? github.com/google/syzkaller/sys/akaros/gen [no test files] ? github.com/google/syzkaller/sys/darwin [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 [no test files] ? github.com/google/syzkaller/sys/fuchsia/fidlgen [no test files] ? github.com/google/syzkaller/sys/fuchsia/gen [no test files] ? github.com/google/syzkaller/sys/fuchsia/layout [no test files] ok github.com/google/syzkaller/sys/linux (cached) ? github.com/google/syzkaller/sys/linux/gen [no test files] ? github.com/google/syzkaller/sys/netbsd [no test files] ? github.com/google/syzkaller/sys/netbsd/gen [no test files] ok github.com/google/syzkaller/sys/openbsd (cached) ? github.com/google/syzkaller/sys/openbsd/gen [no test files] ? github.com/google/syzkaller/sys/syz-extract [no test files] ? github.com/google/syzkaller/sys/syz-sysgen [no test files] ? github.com/google/syzkaller/sys/targets [no test files] ? github.com/google/syzkaller/sys/test [no test files] ? github.com/google/syzkaller/sys/test/gen [no test files] ? github.com/google/syzkaller/sys/trusty [no test files] ? github.com/google/syzkaller/sys/trusty/gen [no test files] ? github.com/google/syzkaller/sys/windows [no test files] ? github.com/google/syzkaller/sys/windows/gen [no test files] ok github.com/google/syzkaller/syz-ci (cached) ok github.com/google/syzkaller/syz-fuzzer (cached) ok github.com/google/syzkaller/syz-hub (cached) ok github.com/google/syzkaller/syz-hub/state (cached) ok github.com/google/syzkaller/syz-manager 1.109s ? github.com/google/syzkaller/syz-runner [no test files] ok github.com/google/syzkaller/syz-verifier 0.124s ? 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-cover [no test files] ? github.com/google/syzkaller/tools/syz-crush [no test files] ? github.com/google/syzkaller/tools/syz-db [no test files] ? github.com/google/syzkaller/tools/syz-execprog [no test files] ? github.com/google/syzkaller/tools/syz-expand [no test files] ? github.com/google/syzkaller/tools/syz-fmt [no test files] ? github.com/google/syzkaller/tools/syz-hubtool [no test files] ? github.com/google/syzkaller/tools/syz-kcidb [no test files] ok github.com/google/syzkaller/tools/syz-kconf (cached) ok github.com/google/syzkaller/tools/syz-linter 2.106s ? 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-reporter [no test files] ? github.com/google/syzkaller/tools/syz-repro [no test files] ? github.com/google/syzkaller/tools/syz-reprolist [no test files] ? github.com/google/syzkaller/tools/syz-runtest [no test files] ? github.com/google/syzkaller/tools/syz-showprio [no test files] ? github.com/google/syzkaller/tools/syz-stress [no test files] ? github.com/google/syzkaller/tools/syz-symbolize [no test files] ? github.com/google/syzkaller/tools/syz-testbuild [no test files] ? github.com/google/syzkaller/tools/syz-trace2syz [no test files] ok github.com/google/syzkaller/tools/syz-trace2syz/parser (cached) ok github.com/google/syzkaller/tools/syz-trace2syz/proggen (cached) ? github.com/google/syzkaller/tools/syz-tty [no test files] ? github.com/google/syzkaller/tools/syz-upgrade [no test files] ? github.com/google/syzkaller/tools/syz-usbgen [no test files] ok github.com/google/syzkaller/vm (cached) ? github.com/google/syzkaller/vm/adb [no test files] ? github.com/google/syzkaller/vm/bhyve [no test files] ? github.com/google/syzkaller/vm/gce [no test files] ? github.com/google/syzkaller/vm/gvisor [no test files] ok github.com/google/syzkaller/vm/isolated (cached) ? github.com/google/syzkaller/vm/kvm [no test files] ? github.com/google/syzkaller/vm/odroid [no test files] ? github.com/google/syzkaller/vm/qemu [no test files] ok github.com/google/syzkaller/vm/vmimpl (cached) ? github.com/google/syzkaller/vm/vmm [no test files] ? github.com/google/syzkaller/vm/vmware [no test files] FAIL