ok github.com/google/syzkaller/dashboard/app (cached) ? github.com/google/syzkaller/dashboard/dashapi [no test files] ? github.com/google/syzkaller/executor [no test files] ok github.com/google/syzkaller/pkg/ast 2.685s ok github.com/google/syzkaller/pkg/bisect 57.455s ok github.com/google/syzkaller/pkg/build 1.924s ? github.com/google/syzkaller/pkg/cmdprof [no test files] ok github.com/google/syzkaller/pkg/compiler 9.676s ok github.com/google/syzkaller/pkg/config (cached) ? github.com/google/syzkaller/pkg/cover [no test files] --- FAIL: TestGenerate (8.79s) --- FAIL: TestGenerate/freebsd/386 (1.13s) csource_test.go:66: seed=1596031218697308268 --- FAIL: TestGenerate/freebsd/386/11 (1.34s) csource_test.go:122: opts: {Threaded:true Collide:false Repeat:true RepeatTimes:0 Procs:0 Sandbox:none Fault:false FaultCall:0 FaultNth:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false UseTmpDir:true HandleSegv:true Repro:false Trace:false} program: truncate(&(0x7f0000000000)='./file0\x00', 0x0) socket$inet(0x2, 0x4, 0x81) freebsd10_pipe(&(0x7f0000000040)={0xffffffffffffffff, 0xffffffffffffffff}) freebsd11_mknodat(r0, &(0x7f0000000080)='./file0\x00', 0x40, 0x4) chflags(&(0x7f00000000c0)='./file0\x00', 0x110212) shm_rename(&(0x7f0000000100)='./file0\x00', &(0x7f0000000140)='./file0\x00', 0x6) r1 = dup2(0xffffffffffffffff, 0xffffffffffffff9c) ioctl$DIOCCHANGEADDR(r1, 0xc4704437, &(0x7f0000000180)="9d61632459f011108aca181da4cc8372b78dcda5") freebsd10_pipe(&(0x7f00000001c0)={0xffffffffffffffff}) ioctl$DIOCRTSTADDRS(r2, 0xc4504449, &(0x7f0000000280)={{"35c4df515ed9a9eeb69a52635d8fb8b651cf3959fa233503474d880170ac5a6eff8983b1abf33d2a2b68b48ac3e04d9f1576976e9a209ea4eb9df0492cb60fff25f705b225e60541430774024ed9a77956cc1ee1aa49852856dde798fff57cf85b44f611e4f6a2f9b1c9174957164e7e83b5fc152fe9eefb9291fcb5bb6dcc4f34bb9253bfdfb685e0ce6fd9f9912321e7c96afa1e73b2c849cef730dbc0dcb0d1aa86b810f58658d45cb384719b5017a8b44b55d621a397f539190392a7fcc5a545c7c9759cd3be711ec91aa7c1f0590321d839500e0a006b8ff5e7fae19d3fd881b52e0dcb79b92936e60ce9a714631a5a0f7c122ae53b27afa90ffdeffa1850c6b3bd711555053e459627c80b681c3c8b8816c0913e772b05a80ff7556c80e860e2463db4d5ae7dd11af5a15c83a65cf7795c975d8b827e5b62d02ad55572623a90bf8ad0e8ce52d6d099427a4abfe84198b64dc26231c847d038302b7fe558aac4f2a7e9274c8a9c3be263e2565d825f379d55a35bf41d89e8c3fe9ff76429e1dad1d7c284412bd36144e55626f135fbe65858a2c9d1326f57b04eab1301a08bd6d608b894e716fbc4cbb89a8d96afa8ed326970ad2dcd746a445837156b87983ebc5fe55540ee3435a20062291fd827525fb5fdea7a33080acd0524ab2d6bf81fb753bdbc7662695c878d22e4cc3776a15e64750cf4654e25609b0d6bbf0e367df50f143e7ada5121ad9edc7da9686bb864d2786a684d2a84e2b027a26084c6d5f5afd89bd25e1c6dad0674bd0f2b34da34c6f4d54e80c9a44675b5fae40a80506a6da8e7569b9bff2f539d8de340087c5885bf052d3861ccc4ca85c38083c793f78ff7b018cb1bab2ec7e9e1d1b59203bf15ddec6e99139eac8fbd5055e60611e39193cd875cd213aba34b3e0ddbc05074f1756770de1c1c8efbf4554be83bae0b3f5ee30cd9a771a689f52469cebf6c801f8de0eac5fe93c3c13593e9daa5bad1280b695ef7e5bdc15ba6b6992183ae6da64de1e8d1eae9f110cdb25edb6a7b123f6c83cb48a3e1045f284593f7d6f23e2a068506445a9938486ad3b676be2fb154ebcde15119d296fceb2413745a8c5417b2ac34b4f355b3549aa223ef2f342e00a637db8616442ca3a180a5825dff2603bad906625404678fa3b39591e162e7ff40adfe8566d68eed8a19153f19fc629452e30f0645aafc1f4eb5dea9f3c6ed6ddbc44473cf8995d033a2ff0c0cdd5388ce6edb1e732aa383346aca3297d84174ea8c6a3fb4083f091263ac4c6062a8401d164be2bfa23e81f9bda1486c7fda45da44ba46afb55f0946b43e8d80f1fccea290ac53aadfa2d109db7d1493b1146947d96b8701e1f6a61892164912430f7583ff87e7dfa8bc61520bdf7afb5485302a8e0dbc332fce4736bee859c1c3d4b5083eb53aa0532fb07229e6", "fbf6bfee9c01092652d2d600835f64f0982102189a56bb5d2acd1157abacb317", 0x100, 0x1}, &(0x7f0000000200)="4b418fea2cea206ae391e44a504fceeb9da11453e3c0303b6fbfdc928a7470eb0c3240c75c0c35134caac7719b5849274bbc0f0b76d2cdbd6127f348d99cf71d4962579966d743126ef7b139bc729327c6e2018d2c24a1cdf88b213117404495ff0ccb9e3549390c33e4fa7ef504f76d2c9dcad0502773b1e6e2ee", 0xffffffff, 0x7, 0x20, 0x200, 0x0, 0x7, 0x887f, 0x7ff}) syz_extract_tcp_res(&(0x7f0000000000)={0x41424344, 0x41424344}, 0x4, 0x40) syz_emit_ethernet(0x1cf, &(0x7f0000000040)={@local, @empty, [], {@ipv4={0x800, {{0x24, 0x4, 0x1, 0x7, 0x1c1, 0x66, 0xc7c, 0x40, 0x2e, 0x0, @multicast2, @loopback, {[@end, @rr={0x7, 0xb, 0x9, [@multicast2, @multicast2]}, @ssrr={0x89, 0x7, 0x7f, [@local={0xac, 0x14, 0x0}]}, @noop, @rr={0x7, 0xb, 0x1f, [@local={0xac, 0x14, 0x0}, @empty]}, @lsrr={0x83, 0xb, 0x0, [@multicast2, @empty]}, @end, @lsrr={0x83, 0xf, 0x96, [@loopback, @multicast2, @multicast2]}, @rr={0x7, 0x7, 0x0, [@multicast2]}, @timestamp={0x44, 0x38, 0x2, 0x1, 0x7, [{[@empty], 0x2}, {[@local={0xac, 0x14, 0x0}], 0x1f}, {[@multicast1]}, {[], 0x7}, {[], 0x3ff}, {[], 0x3b6}, {[@loopback], 0xfffffbaf}, {[@loopback], 0x400}]}]}}, @tcp={{0x0, 0x1, r3, 0x41424344, 0x0, 0x0, 0x10, 0x8, 0x8001, 0x0, 0x6, {[@eol, @mss={0x2, 0x4, 0xf13}, @sack={0x5, 0x26, [0x3f, 0x6, 0x8, 0x6, 0x8, 0x8, 0x20, 0x8001, 0xfffffff7]}]}}, {"b98eed1bfb3a0d46c541a8521fa4b5204051e21cdf38cb7077db0f2716039ba5c24569c23b4e18e60152f08a56a0b813624230b57b8c73001a7c09ee6b29ab9ca31248ef28d1de0bdc63247483e051e8c72811f9b42122dce1b13657a99a08d79564f00961f546b59c7c01946e8cd5fe4805c87dbb5ccafbfde18a4b99d30697cac445428a4a0fd5b46b187199c34a93b2bd706b470cf0c69df60a28dc68bc426008965b0dfd74a4aa29b6b79918ecc678419ac3ff8f7e2545b5e208b72951d814f693693b7b0e40523664f396347631f0f198a0ead9b8a93cae36e74909180a2370fe72fede65b747ad92b54671a125f1"}}}}}}) syz_execute_func(&(0x7f0000000240)="c4c1ed14a559ab32ebd0d53664666766660f38f66b0fc4c261beedc4e201baef0f18d1c4e201a8a8e1400000c4e169e5b14d41b9a0dee90f38ca23") syz_extract_tcp_res(&(0x7f0000000280), 0x4df9f115, 0x2) csource_test.go:123: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static __thread int skip_segv; static __thread jmp_buf segv_env; static void segv_handler(int sig, siginfo_t* info, void* ctx) { uintptr_t addr = (uintptr_t)info->si_addr; const uintptr_t prog_start = 1 << 20; const uintptr_t prog_end = 100 << 20; if (__atomic_load_n(&skip_segv, __ATOMIC_RELAXED) && (addr < prog_start || addr > prog_end)) { _longjmp(segv_env, 1); } exit(sig); } static void install_segv_handler(void) { struct sigaction sa; memset(&sa, 0, sizeof(sa)); sa.sa_sigaction = segv_handler; sa.sa_flags = SA_NODEFER | SA_SIGINFO; sigaction(SIGSEGV, &sa, NULL); sigaction(SIGBUS, &sa, NULL); } #define NONFAILING(...) { __atomic_fetch_add(&skip_segv, 1, __ATOMIC_SEQ_CST); if (_setjmp(segv_env) == 0) { __VA_ARGS__; } __atomic_fetch_sub(&skip_segv, 1, __ATOMIC_SEQ_CST); } static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void remove_dir(const char* dir) { DIR* dp; struct dirent* ep; dp = opendir(dir); if (dp == NULL) exit(1); while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } if (unlink(filename)) exit(1); } closedir(dp); if (rmdir(dir)) exit(1); } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i; for (i = 0; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { pthread_mutex_t mu; pthread_cond_t cv; int state; } event_t; static void event_init(event_t* ev) { if (pthread_mutex_init(&ev->mu, 0)) exit(1); if (pthread_cond_init(&ev->cv, 0)) exit(1); ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { pthread_mutex_lock(&ev->mu); if (ev->state) exit(1); ev->state = 1; pthread_mutex_unlock(&ev->mu); pthread_cond_broadcast(&ev->cv); } static void event_wait(event_t* ev) { pthread_mutex_lock(&ev->mu); while (!ev->state) pthread_cond_wait(&ev->cv, &ev->mu); pthread_mutex_unlock(&ev->mu); } static int event_isset(event_t* ev) { pthread_mutex_lock(&ev->mu); int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; pthread_mutex_lock(&ev->mu); for (;;) { if (ev->state) break; uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); now = current_time_ms(); if (now - start > timeout) break; } int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } #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; for (i = 0; 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) { volatile long p[8] = {0}; (void)p; ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 14; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); event_timedwait(&th->done, 45); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); #define WAIT_FLAGS 0 static void loop(void) { int iter; for (iter = 0;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5 * 1000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x41424344}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: NONFAILING(memcpy((void*)0x10000000, "./file0\000", 8)); syscall(SYS_truncate, 0x10000000, 0); break; case 1: syscall(SYS_socket, 2, 4, 0x81); break; case 2: res = syscall(SYS_freebsd10_pipe, 0x10000040); if (res != -1) NONFAILING(r[0] = *(uint32_t*)0x10000044); break; case 3: NONFAILING(memcpy((void*)0x10000080, "./file0\000", 8)); syscall(SYS_freebsd11_mknodat, (intptr_t)r[0], 0x10000080, 0x40, 4); break; case 4: NONFAILING(memcpy((void*)0x100000c0, "./file0\000", 8)); syscall(SYS_chflags, 0x100000c0, 0x110212); break; case 5: NONFAILING(memcpy((void*)0x10000100, "./file0\000", 8)); NONFAILING(memcpy((void*)0x10000140, "./file0\000", 8)); syscall(SYS_shm_rename, 0x10000100, 0x10000140, 6); break; case 6: res = syscall(SYS_dup2, -1, 0xffffff9c); if (res != -1) r[1] = res; break; case 7: NONFAILING(memcpy((void*)0x10000180, "\x9d\x61\x63\x24\x59\xf0\x11\x10\x8a\xca\x18\x1d\xa4\xcc\x83\x72\xb7\x8d\xcd\xa5", 20)); syscall(SYS_ioctl, (intptr_t)r[1], 0xc4704437, 0x10000180); break; case 8: res = syscall(SYS_freebsd10_pipe, 0x100001c0); if (res != -1) NONFAILING(r[2] = *(uint32_t*)0x100001c0); break; case 9: NONFAILING(memcpy((void*)0x10000280, "\x35\xc4\xdf\x51\x5e\xd9\xa9\xee\xb6\x9a\x52\x63\x5d\x8f\xb8\xb6\x51\xcf\x39\x59\xfa\x23\x35\x03\x47\x4d\x88\x01\x70\xac\x5a\x6e\xff\x89\x83\xb1\xab\xf3\x3d\x2a\x2b\x68\xb4\x8a\xc3\xe0\x4d\x9f\x15\x76\x97\x6e\x9a\x20\x9e\xa4\xeb\x9d\xf0\x49\x2c\xb6\x0f\xff\x25\xf7\x05\xb2\x25\xe6\x05\x41\x43\x07\x74\x02\x4e\xd9\xa7\x79\x56\xcc\x1e\xe1\xaa\x49\x85\x28\x56\xdd\xe7\x98\xff\xf5\x7c\xf8\x5b\x44\xf6\x11\xe4\xf6\xa2\xf9\xb1\xc9\x17\x49\x57\x16\x4e\x7e\x83\xb5\xfc\x15\x2f\xe9\xee\xfb\x92\x91\xfc\xb5\xbb\x6d\xcc\x4f\x34\xbb\x92\x53\xbf\xdf\xb6\x85\xe0\xce\x6f\xd9\xf9\x91\x23\x21\xe7\xc9\x6a\xfa\x1e\x73\xb2\xc8\x49\xce\xf7\x30\xdb\xc0\xdc\xb0\xd1\xaa\x86\xb8\x10\xf5\x86\x58\xd4\x5c\xb3\x84\x71\x9b\x50\x17\xa8\xb4\x4b\x55\xd6\x21\xa3\x97\xf5\x39\x19\x03\x92\xa7\xfc\xc5\xa5\x45\xc7\xc9\x75\x9c\xd3\xbe\x71\x1e\xc9\x1a\xa7\xc1\xf0\x59\x03\x21\xd8\x39\x50\x0e\x0a\x00\x6b\x8f\xf5\xe7\xfa\xe1\x9d\x3f\xd8\x81\xb5\x2e\x0d\xcb\x79\xb9\x29\x36\xe6\x0c\xe9\xa7\x14\x63\x1a\x5a\x0f\x7c\x12\x2a\xe5\x3b\x27\xaf\xa9\x0f\xfd\xef\xfa\x18\x50\xc6\xb3\xbd\x71\x15\x55\x05\x3e\x45\x96\x27\xc8\x0b\x68\x1c\x3c\x8b\x88\x16\xc0\x91\x3e\x77\x2b\x05\xa8\x0f\xf7\x55\x6c\x80\xe8\x60\xe2\x46\x3d\xb4\xd5\xae\x7d\xd1\x1a\xf5\xa1\x5c\x83\xa6\x5c\xf7\x79\x5c\x97\x5d\x8b\x82\x7e\x5b\x62\xd0\x2a\xd5\x55\x72\x62\x3a\x90\xbf\x8a\xd0\xe8\xce\x52\xd6\xd0\x99\x42\x7a\x4a\xbf\xe8\x41\x98\xb6\x4d\xc2\x62\x31\xc8\x47\xd0\x38\x30\x2b\x7f\xe5\x58\xaa\xc4\xf2\xa7\xe9\x27\x4c\x8a\x9c\x3b\xe2\x63\xe2\x56\x5d\x82\x5f\x37\x9d\x55\xa3\x5b\xf4\x1d\x89\xe8\xc3\xfe\x9f\xf7\x64\x29\xe1\xda\xd1\xd7\xc2\x84\x41\x2b\xd3\x61\x44\xe5\x56\x26\xf1\x35\xfb\xe6\x58\x58\xa2\xc9\xd1\x32\x6f\x57\xb0\x4e\xab\x13\x01\xa0\x8b\xd6\xd6\x08\xb8\x94\xe7\x16\xfb\xc4\xcb\xb8\x9a\x8d\x96\xaf\xa8\xed\x32\x69\x70\xad\x2d\xcd\x74\x6a\x44\x58\x37\x15\x6b\x87\x98\x3e\xbc\x5f\xe5\x55\x40\xee\x34\x35\xa2\x00\x62\x29\x1f\xd8\x27\x52\x5f\xb5\xfd\xea\x7a\x33\x08\x0a\xcd\x05\x24\xab\x2d\x6b\xf8\x1f\xb7\x53\xbd\xbc\x76\x62\x69\x5c\x87\x8d\x22\xe4\xcc\x37\x76\xa1\x5e\x64\x75\x0c\xf4\x65\x4e\x25\x60\x9b\x0d\x6b\xbf\x0e\x36\x7d\xf5\x0f\x14\x3e\x7a\xda\x51\x21\xad\x9e\xdc\x7d\xa9\x68\x6b\xb8\x64\xd2\x78\x6a\x68\x4d\x2a\x84\xe2\xb0\x27\xa2\x60\x84\xc6\xd5\xf5\xaf\xd8\x9b\xd2\x5e\x1c\x6d\xad\x06\x74\xbd\x0f\x2b\x34\xda\x34\xc6\xf4\xd5\x4e\x80\xc9\xa4\x46\x75\xb5\xfa\xe4\x0a\x80\x50\x6a\x6d\xa8\xe7\x56\x9b\x9b\xff\x2f\x53\x9d\x8d\xe3\x40\x08\x7c\x58\x85\xbf\x05\x2d\x38\x61\xcc\xc4\xca\x85\xc3\x80\x83\xc7\x93\xf7\x8f\xf7\xb0\x18\xcb\x1b\xab\x2e\xc7\xe9\xe1\xd1\xb5\x92\x03\xbf\x15\xdd\xec\x6e\x99\x13\x9e\xac\x8f\xbd\x50\x55\xe6\x06\x11\xe3\x91\x93\xcd\x87\x5c\xd2\x13\xab\xa3\x4b\x3e\x0d\xdb\xc0\x50\x74\xf1\x75\x67\x70\xde\x1c\x1c\x8e\xfb\xf4\x55\x4b\xe8\x3b\xae\x0b\x3f\x5e\xe3\x0c\xd9\xa7\x71\xa6\x89\xf5\x24\x69\xce\xbf\x6c\x80\x1f\x8d\xe0\xea\xc5\xfe\x93\xc3\xc1\x35\x93\xe9\xda\xa5\xba\xd1\x28\x0b\x69\x5e\xf7\xe5\xbd\xc1\x5b\xa6\xb6\x99\x21\x83\xae\x6d\xa6\x4d\xe1\xe8\xd1\xea\xe9\xf1\x10\xcd\xb2\x5e\xdb\x6a\x7b\x12\x3f\x6c\x83\xcb\x48\xa3\xe1\x04\x5f\x28\x45\x93\xf7\xd6\xf2\x3e\x2a\x06\x85\x06\x44\x5a\x99\x38\x48\x6a\xd3\xb6\x76\xbe\x2f\xb1\x54\xeb\xcd\xe1\x51\x19\xd2\x96\xfc\xeb\x24\x13\x74\x5a\x8c\x54\x17\xb2\xac\x34\xb4\xf3\x55\xb3\x54\x9a\xa2\x23\xef\x2f\x34\x2e\x00\xa6\x37\xdb\x86\x16\x44\x2c\xa3\xa1\x80\xa5\x82\x5d\xff\x26\x03\xba\xd9\x06\x62\x54\x04\x67\x8f\xa3\xb3\x95\x91\xe1\x62\xe7\xff\x40\xad\xfe\x85\x66\xd6\x8e\xed\x8a\x19\x15\x3f\x19\xfc\x62\x94\x52\xe3\x0f\x06\x45\xaa\xfc\x1f\x4e\xb5\xde\xa9\xf3\xc6\xed\x6d\xdb\xc4\x44\x73\xcf\x89\x95\xd0\x33\xa2\xff\x0c\x0c\xdd\x53\x88\xce\x6e\xdb\x1e\x73\x2a\xa3\x83\x34\x6a\xca\x32\x97\xd8\x41\x74\xea\x8c\x6a\x3f\xb4\x08\x3f\x09\x12\x63\xac\x4c\x60\x62\xa8\x40\x1d\x16\x4b\xe2\xbf\xa2\x3e\x81\xf9\xbd\xa1\x48\x6c\x7f\xda\x45\xda\x44\xba\x46\xaf\xb5\x5f\x09\x46\xb4\x3e\x8d\x80\xf1\xfc\xce\xa2\x90\xac\x53\xaa\xdf\xa2\xd1\x09\xdb\x7d\x14\x93\xb1\x14\x69\x47\xd9\x6b\x87\x01\xe1\xf6\xa6\x18\x92\x16\x49\x12\x43\x0f\x75\x83\xff\x87\xe7\xdf\xa8\xbc\x61\x52\x0b\xdf\x7a\xfb\x54\x85\x30\x2a\x8e\x0d\xbc\x33\x2f\xce\x47\x36\xbe\xe8\x59\xc1\xc3\xd4\xb5\x08\x3e\xb5\x3a\xa0\x53\x2f\xb0\x72\x29\xe6", 1024)); NONFAILING(memcpy((void*)0x10000680, "\xfb\xf6\xbf\xee\x9c\x01\x09\x26\x52\xd2\xd6\x00\x83\x5f\x64\xf0\x98\x21\x02\x18\x9a\x56\xbb\x5d\x2a\xcd\x11\x57\xab\xac\xb3\x17", 32)); NONFAILING(*(uint32_t*)0x100006a0 = 0x100); NONFAILING(*(uint8_t*)0x100006a4 = 1); NONFAILING(*(uint32_t*)0x100006a8 = 0x10000200); NONFAILING(memcpy((void*)0x10000200, "\x4b\x41\x8f\xea\x2c\xea\x20\x6a\xe3\x91\xe4\x4a\x50\x4f\xce\xeb\x9d\xa1\x14\x53\xe3\xc0\x30\x3b\x6f\xbf\xdc\x92\x8a\x74\x70\xeb\x0c\x32\x40\xc7\x5c\x0c\x35\x13\x4c\xaa\xc7\x71\x9b\x58\x49\x27\x4b\xbc\x0f\x0b\x76\xd2\xcd\xbd\x61\x27\xf3\x48\xd9\x9c\xf7\x1d\x49\x62\x57\x99\x66\xd7\x43\x12\x6e\xf7\xb1\x39\xbc\x72\x93\x27\xc6\xe2\x01\x8d\x2c\x24\xa1\xcd\xf8\x8b\x21\x31\x17\x40\x44\x95\xff\x0c\xcb\x9e\x35\x49\x39\x0c\x33\xe4\xfa\x7e\xf5\x04\xf7\x6d\x2c\x9d\xca\xd0\x50\x27\x73\xb1\xe6\xe2\xee", 123)); NONFAILING(*(uint64_t*)0x100006ac = 0xffffffff); NONFAILING(*(uint64_t*)0x100006b4 = 7); NONFAILING(*(uint64_t*)0x100006bc = 0x20); NONFAILING(*(uint64_t*)0x100006c4 = 0x200); NONFAILING(*(uint64_t*)0x100006cc = 0); NONFAILING(*(uint64_t*)0x100006d4 = 7); NONFAILING(*(uint64_t*)0x100006dc = 0x887f); NONFAILING(*(uint32_t*)0x100006e4 = 0x7ff); syscall(SYS_ioctl, (intptr_t)r[2], 0xc4504449, 0x10000280); break; case 10: if (res != -1) NONFAILING(r[3] = *(uint32_t*)0x10000004); break; case 11: NONFAILING(*(uint8_t*)0x10000040 = 0xaa); NONFAILING(*(uint8_t*)0x10000041 = 0xaa); NONFAILING(*(uint8_t*)0x10000042 = 0xaa); NONFAILING(*(uint8_t*)0x10000043 = 0xaa); NONFAILING(*(uint8_t*)0x10000044 = 0xaa); NONFAILING(*(uint8_t*)0x10000045 = 0xaa); NONFAILING(*(uint8_t*)0x10000046 = 0); NONFAILING(*(uint8_t*)0x10000047 = 0); NONFAILING(*(uint8_t*)0x10000048 = 0); NONFAILING(*(uint8_t*)0x10000049 = 0); NONFAILING(*(uint8_t*)0x1000004a = 0); NONFAILING(*(uint8_t*)0x1000004b = 0); NONFAILING(*(uint16_t*)0x1000004c = htobe16(0x800)); NONFAILING(STORE_BY_BITMASK(uint8_t, , 0x1000004e, 0x24, 0, 4)); NONFAILING(STORE_BY_BITMASK(uint8_t, , 0x1000004e, 4, 4, 4)); NONFAILING(STORE_BY_BITMASK(uint8_t, , 0x1000004f, 1, 0, 2)); NONFAILING(STORE_BY_BITMASK(uint8_t, , 0x1000004f, 7, 2, 6)); NONFAILING(*(uint16_t*)0x10000050 = htobe16(0x1c1)); NONFAILING(*(uint16_t*)0x10000052 = htobe16(0x66)); NONFAILING(*(uint16_t*)0x10000054 = htobe16(0xc7c)); NONFAILING(*(uint8_t*)0x10000056 = 0x40); NONFAILING(*(uint8_t*)0x10000057 = 0x2e); NONFAILING(*(uint16_t*)0x10000058 = htobe16(0)); NONFAILING(*(uint32_t*)0x1000005a = htobe32(0xe0000002)); NONFAILING(*(uint32_t*)0x1000005e = htobe32(0x7f000001)); NONFAILING(*(uint8_t*)0x10000062 = 0); NONFAILING(*(uint8_t*)0x10000063 = 7); NONFAILING(*(uint8_t*)0x10000064 = 0xb); NONFAILING(*(uint8_t*)0x10000065 = 9); NONFAILING(*(uint32_t*)0x10000066 = htobe32(0xe0000002)); NONFAILING(*(uint32_t*)0x1000006a = htobe32(0xe0000002)); NONFAILING(*(uint8_t*)0x1000006e = 0x89); NONFAILING(*(uint8_t*)0x1000006f = 7); NONFAILING(*(uint8_t*)0x10000070 = 0x7f); NONFAILING(*(uint8_t*)0x10000071 = 0xac); NONFAILING(*(uint8_t*)0x10000072 = 0x14); NONFAILING(*(uint8_t*)0x10000073 = 0); NONFAILING(*(uint8_t*)0x10000074 = 0xaa); NONFAILING(*(uint8_t*)0x10000075 = 1); NONFAILING(*(uint8_t*)0x10000076 = 7); NONFAILING(*(uint8_t*)0x10000077 = 0xb); NONFAILING(*(uint8_t*)0x10000078 = 0x1f); NONFAILING(*(uint8_t*)0x10000079 = 0xac); NONFAILING(*(uint8_t*)0x1000007a = 0x14); NONFAILING(*(uint8_t*)0x1000007b = 0); NONFAILING(*(uint8_t*)0x1000007c = 0xaa); NONFAILING(*(uint32_t*)0x1000007d = htobe32(0)); NONFAILING(*(uint8_t*)0x10000081 = 0x83); NONFAILING(*(uint8_t*)0x10000082 = 0xb); NONFAILING(*(uint8_t*)0x10000083 = 0); NONFAILING(*(uint32_t*)0x10000084 = htobe32(0xe0000002)); NONFAILING(*(uint32_t*)0x10000088 = htobe32(0)); NONFAILING(*(uint8_t*)0x1000008c = 0); NONFAILING(*(uint8_t*)0x1000008d = 0x83); NONFAILING(*(uint8_t*)0x1000008e = 0xf); NONFAILING(*(uint8_t*)0x1000008f = 0x96); NONFAILING(*(uint32_t*)0x10000090 = htobe32(0x7f000001)); NONFAILING(*(uint32_t*)0x10000094 = htobe32(0xe0000002)); NONFAILING(*(uint32_t*)0x10000098 = htobe32(0xe0000002)); NONFAILING(*(uint8_t*)0x1000009c = 7); NONFAILING(*(uint8_t*)0x1000009d = 7); NONFAILING(*(uint8_t*)0x1000009e = 0); NONFAILING(*(uint32_t*)0x1000009f = htobe32(0xe0000002)); NONFAILING(*(uint8_t*)0x100000a3 = 0x44); NONFAILING(*(uint8_t*)0x100000a4 = 0x38); NONFAILING(*(uint8_t*)0x100000a5 = 2); NONFAILING(STORE_BY_BITMASK(uint8_t, , 0x100000a6, 1, 0, 4)); NONFAILING(STORE_BY_BITMASK(uint8_t, , 0x100000a6, 7, 4, 4)); NONFAILING(*(uint32_t*)0x100000a7 = htobe32(0)); NONFAILING(*(uint32_t*)0x100000ab = htobe32(2)); NONFAILING(*(uint8_t*)0x100000af = 0xac); NONFAILING(*(uint8_t*)0x100000b0 = 0x14); NONFAILING(*(uint8_t*)0x100000b1 = 0); NONFAILING(*(uint8_t*)0x100000b2 = 0xaa); NONFAILING(*(uint32_t*)0x100000b3 = htobe32(0x1f)); NONFAILING(*(uint32_t*)0x100000b7 = htobe32(0xe0000001)); NONFAILING(*(uint32_t*)0x100000bb = htobe32(0)); NONFAILING(*(uint32_t*)0x100000bf = htobe32(7)); NONFAILING(*(uint32_t*)0x100000c3 = htobe32(0x3ff)); NONFAILING(*(uint32_t*)0x100000c7 = htobe32(0x3b6)); NONFAILING(*(uint32_t*)0x100000cb = htobe32(0x7f000001)); NONFAILING(*(uint32_t*)0x100000cf = htobe32(0xfffffbaf)); NONFAILING(*(uint32_t*)0x100000d3 = htobe32(0x7f000001)); NONFAILING(*(uint32_t*)0x100000d7 = htobe32(0x400)); NONFAILING(*(uint16_t*)0x100000de = htobe16(0x4e20)); NONFAILING(*(uint16_t*)0x100000e0 = htobe16(0x4e21)); NONFAILING(*(uint32_t*)0x100000e2 = r[3]); NONFAILING(*(uint32_t*)0x100000e6 = 0x41424344); NONFAILING(STORE_BY_BITMASK(uint8_t, , 0x100000ea, 0, 0, 1)); NONFAILING(STORE_BY_BITMASK(uint8_t, , 0x100000ea, 0, 1, 3)); NONFAILING(STORE_BY_BITMASK(uint8_t, , 0x100000ea, 0x10, 4, 4)); NONFAILING(*(uint8_t*)0x100000eb = 8); NONFAILING(*(uint16_t*)0x100000ec = htobe16(0x8001)); NONFAILING(*(uint16_t*)0x100000ee = htobe16(0)); NONFAILING(*(uint16_t*)0x100000f0 = htobe16(6)); NONFAILING(*(uint8_t*)0x100000f2 = 0); NONFAILING(*(uint8_t*)0x100000f3 = 2); NONFAILING(*(uint8_t*)0x100000f4 = 4); NONFAILING(*(uint16_t*)0x100000f5 = htobe16(0xf13)); NONFAILING(*(uint8_t*)0x100000f7 = 5); NONFAILING(*(uint8_t*)0x100000f8 = 0x26); NONFAILING(*(uint32_t*)0x100000f9 = htobe32(0x3f)); NONFAILING(*(uint32_t*)0x100000fd = htobe32(6)); NONFAILING(*(uint32_t*)0x10000101 = htobe32(8)); NONFAILING(*(uint32_t*)0x10000105 = htobe32(6)); NONFAILING(*(uint32_t*)0x10000109 = htobe32(8)); NONFAILING(*(uint32_t*)0x1000010d = htobe32(8)); NONFAILING(*(uint32_t*)0x10000111 = htobe32(0x20)); NONFAILING(*(uint32_t*)0x10000115 = htobe32(0x8001)); NONFAILING(*(uint32_t*)0x10000119 = htobe32(0xfffffff7)); NONFAILING(memcpy((void*)0x1000011e, "\xb9\x8e\xed\x1b\xfb\x3a\x0d\x46\xc5\x41\xa8\x52\x1f\xa4\xb5\x20\x40\x51\xe2\x1c\xdf\x38\xcb\x70\x77\xdb\x0f\x27\x16\x03\x9b\xa5\xc2\x45\x69\xc2\x3b\x4e\x18\xe6\x01\x52\xf0\x8a\x56\xa0\xb8\x13\x62\x42\x30\xb5\x7b\x8c\x73\x00\x1a\x7c\x09\xee\x6b\x29\xab\x9c\xa3\x12\x48\xef\x28\xd1\xde\x0b\xdc\x63\x24\x74\x83\xe0\x51\xe8\xc7\x28\x11\xf9\xb4\x21\x22\xdc\xe1\xb1\x36\x57\xa9\x9a\x08\xd7\x95\x64\xf0\x09\x61\xf5\x46\xb5\x9c\x7c\x01\x94\x6e\x8c\xd5\xfe\x48\x05\xc8\x7d\xbb\x5c\xca\xfb\xfd\xe1\x8a\x4b\x99\xd3\x06\x97\xca\xc4\x45\x42\x8a\x4a\x0f\xd5\xb4\x6b\x18\x71\x99\xc3\x4a\x93\xb2\xbd\x70\x6b\x47\x0c\xf0\xc6\x9d\xf6\x0a\x28\xdc\x68\xbc\x42\x60\x08\x96\x5b\x0d\xfd\x74\xa4\xaa\x29\xb6\xb7\x99\x18\xec\xc6\x78\x41\x9a\xc3\xff\x8f\x7e\x25\x45\xb5\xe2\x08\xb7\x29\x51\xd8\x14\xf6\x93\x69\x3b\x7b\x0e\x40\x52\x36\x64\xf3\x96\x34\x76\x31\xf0\xf1\x98\xa0\xea\xd9\xb8\xa9\x3c\xae\x36\xe7\x49\x09\x18\x0a\x23\x70\xfe\x72\xfe\xde\x65\xb7\x47\xad\x92\xb5\x46\x71\xa1\x25\xf1", 241)); struct csum_inet csum_1; csum_inet_init(&csum_1); NONFAILING(csum_inet_update(&csum_1, (const uint8_t*)0x1000005a, 4)); NONFAILING(csum_inet_update(&csum_1, (const uint8_t*)0x1000005e, 4)); uint16_t csum_1_chunk_2 = 0x600; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_2, 2); uint16_t csum_1_chunk_3 = 0x3101; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_3, 2); NONFAILING(csum_inet_update(&csum_1, (const uint8_t*)0x100000de, 305)); NONFAILING(*(uint16_t*)0x100000ee = csum_inet_digest(&csum_1)); struct csum_inet csum_2; csum_inet_init(&csum_2); NONFAILING(csum_inet_update(&csum_2, (const uint8_t*)0x1000004e, 144)); NONFAILING(*(uint16_t*)0x10000058 = csum_inet_digest(&csum_2)); break; case 12: NONFAILING(memcpy((void*)0x10000240, "\xc4\xc1\xed\x14\xa5\x59\xab\x32\xeb\xd0\xd5\x36\x64\x66\x67\x66\x66\x0f\x38\xf6\x6b\x0f\xc4\xc2\x61\xbe\xed\xc4\xe2\x01\xba\xef\x0f\x18\xd1\xc4\xe2\x01\xa8\xa8\xe1\x40\x00\x00\xc4\xe1\x69\xe5\xb1\x4d\x41\xb9\xa0\xde\xe9\x0f\x38\xca\x23", 59)); NONFAILING(syz_execute_func(0x10000240)); break; case 13: break; } } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); install_segv_handler(); use_temporary_dir(); do_sandbox_none(); return 0; } :381:11: error: use of undeclared identifier 'SYS_shm_rename' syscall(SYS_shm_rename, 0x10000100, 0x10000140, 6); ^ 1 error generated. compiler invocation: clang [-o /tmp/syz-executor013258119 -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 (1.49s) csource_test.go:122: opts: {Threaded:false Collide:false Repeat:true RepeatTimes:0 Procs:0 Sandbox:none Fault:false FaultCall:0 FaultNth:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false UseTmpDir:true HandleSegv:false Repro:false Trace:false} program: truncate(&(0x7f0000000000)='./file0\x00', 0x0) socket$inet(0x2, 0x4, 0x81) freebsd10_pipe(&(0x7f0000000040)={0xffffffffffffffff, 0xffffffffffffffff}) freebsd11_mknodat(r0, &(0x7f0000000080)='./file0\x00', 0x40, 0x4) chflags(&(0x7f00000000c0)='./file0\x00', 0x110212) shm_rename(&(0x7f0000000100)='./file0\x00', &(0x7f0000000140)='./file0\x00', 0x6) r1 = dup2(0xffffffffffffffff, 0xffffffffffffff9c) ioctl$DIOCCHANGEADDR(r1, 0xc4704437, &(0x7f0000000180)="9d61632459f011108aca181da4cc8372b78dcda5") freebsd10_pipe(&(0x7f00000001c0)={0xffffffffffffffff}) ioctl$DIOCRTSTADDRS(r2, 0xc4504449, &(0x7f0000000280)={{"35c4df515ed9a9eeb69a52635d8fb8b651cf3959fa233503474d880170ac5a6eff8983b1abf33d2a2b68b48ac3e04d9f1576976e9a209ea4eb9df0492cb60fff25f705b225e60541430774024ed9a77956cc1ee1aa49852856dde798fff57cf85b44f611e4f6a2f9b1c9174957164e7e83b5fc152fe9eefb9291fcb5bb6dcc4f34bb9253bfdfb685e0ce6fd9f9912321e7c96afa1e73b2c849cef730dbc0dcb0d1aa86b810f58658d45cb384719b5017a8b44b55d621a397f539190392a7fcc5a545c7c9759cd3be711ec91aa7c1f0590321d839500e0a006b8ff5e7fae19d3fd881b52e0dcb79b92936e60ce9a714631a5a0f7c122ae53b27afa90ffdeffa1850c6b3bd711555053e459627c80b681c3c8b8816c0913e772b05a80ff7556c80e860e2463db4d5ae7dd11af5a15c83a65cf7795c975d8b827e5b62d02ad55572623a90bf8ad0e8ce52d6d099427a4abfe84198b64dc26231c847d038302b7fe558aac4f2a7e9274c8a9c3be263e2565d825f379d55a35bf41d89e8c3fe9ff76429e1dad1d7c284412bd36144e55626f135fbe65858a2c9d1326f57b04eab1301a08bd6d608b894e716fbc4cbb89a8d96afa8ed326970ad2dcd746a445837156b87983ebc5fe55540ee3435a20062291fd827525fb5fdea7a33080acd0524ab2d6bf81fb753bdbc7662695c878d22e4cc3776a15e64750cf4654e25609b0d6bbf0e367df50f143e7ada5121ad9edc7da9686bb864d2786a684d2a84e2b027a26084c6d5f5afd89bd25e1c6dad0674bd0f2b34da34c6f4d54e80c9a44675b5fae40a80506a6da8e7569b9bff2f539d8de340087c5885bf052d3861ccc4ca85c38083c793f78ff7b018cb1bab2ec7e9e1d1b59203bf15ddec6e99139eac8fbd5055e60611e39193cd875cd213aba34b3e0ddbc05074f1756770de1c1c8efbf4554be83bae0b3f5ee30cd9a771a689f52469cebf6c801f8de0eac5fe93c3c13593e9daa5bad1280b695ef7e5bdc15ba6b6992183ae6da64de1e8d1eae9f110cdb25edb6a7b123f6c83cb48a3e1045f284593f7d6f23e2a068506445a9938486ad3b676be2fb154ebcde15119d296fceb2413745a8c5417b2ac34b4f355b3549aa223ef2f342e00a637db8616442ca3a180a5825dff2603bad906625404678fa3b39591e162e7ff40adfe8566d68eed8a19153f19fc629452e30f0645aafc1f4eb5dea9f3c6ed6ddbc44473cf8995d033a2ff0c0cdd5388ce6edb1e732aa383346aca3297d84174ea8c6a3fb4083f091263ac4c6062a8401d164be2bfa23e81f9bda1486c7fda45da44ba46afb55f0946b43e8d80f1fccea290ac53aadfa2d109db7d1493b1146947d96b8701e1f6a61892164912430f7583ff87e7dfa8bc61520bdf7afb5485302a8e0dbc332fce4736bee859c1c3d4b5083eb53aa0532fb07229e6", "fbf6bfee9c01092652d2d600835f64f0982102189a56bb5d2acd1157abacb317", 0x100, 0x1}, &(0x7f0000000200)="4b418fea2cea206ae391e44a504fceeb9da11453e3c0303b6fbfdc928a7470eb0c3240c75c0c35134caac7719b5849274bbc0f0b76d2cdbd6127f348d99cf71d4962579966d743126ef7b139bc729327c6e2018d2c24a1cdf88b213117404495ff0ccb9e3549390c33e4fa7ef504f76d2c9dcad0502773b1e6e2ee", 0xffffffff, 0x7, 0x20, 0x200, 0x0, 0x7, 0x887f, 0x7ff}) syz_extract_tcp_res(&(0x7f0000000000)={0x41424344, 0x41424344}, 0x4, 0x40) syz_emit_ethernet(0x1cf, &(0x7f0000000040)={@local, @empty, [], {@ipv4={0x800, {{0x24, 0x4, 0x1, 0x7, 0x1c1, 0x66, 0xc7c, 0x40, 0x2e, 0x0, @multicast2, @loopback, {[@end, @rr={0x7, 0xb, 0x9, [@multicast2, @multicast2]}, @ssrr={0x89, 0x7, 0x7f, [@local={0xac, 0x14, 0x0}]}, @noop, @rr={0x7, 0xb, 0x1f, [@local={0xac, 0x14, 0x0}, @empty]}, @lsrr={0x83, 0xb, 0x0, [@multicast2, @empty]}, @end, @lsrr={0x83, 0xf, 0x96, [@loopback, @multicast2, @multicast2]}, @rr={0x7, 0x7, 0x0, [@multicast2]}, @timestamp={0x44, 0x38, 0x2, 0x1, 0x7, [{[@empty], 0x2}, {[@local={0xac, 0x14, 0x0}], 0x1f}, {[@multicast1]}, {[], 0x7}, {[], 0x3ff}, {[], 0x3b6}, {[@loopback], 0xfffffbaf}, {[@loopback], 0x400}]}]}}, @tcp={{0x0, 0x1, r3, 0x41424344, 0x0, 0x0, 0x10, 0x8, 0x8001, 0x0, 0x6, {[@eol, @mss={0x2, 0x4, 0xf13}, @sack={0x5, 0x26, [0x3f, 0x6, 0x8, 0x6, 0x8, 0x8, 0x20, 0x8001, 0xfffffff7]}]}}, {"b98eed1bfb3a0d46c541a8521fa4b5204051e21cdf38cb7077db0f2716039ba5c24569c23b4e18e60152f08a56a0b813624230b57b8c73001a7c09ee6b29ab9ca31248ef28d1de0bdc63247483e051e8c72811f9b42122dce1b13657a99a08d79564f00961f546b59c7c01946e8cd5fe4805c87dbb5ccafbfde18a4b99d30697cac445428a4a0fd5b46b187199c34a93b2bd706b470cf0c69df60a28dc68bc426008965b0dfd74a4aa29b6b79918ecc678419ac3ff8f7e2545b5e208b72951d814f693693b7b0e40523664f396347631f0f198a0ead9b8a93cae36e74909180a2370fe72fede65b747ad92b54671a125f1"}}}}}}) syz_execute_func(&(0x7f0000000240)="c4c1ed14a559ab32ebd0d53664666766660f38f66b0fc4c261beedc4e201baef0f18d1c4e201a8a8e1400000c4e169e5b14d41b9a0dee90f38ca23") syz_extract_tcp_res(&(0x7f0000000280), 0x4df9f115, 0x2) csource_test.go:123: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void remove_dir(const char* dir) { DIR* dp; struct dirent* ep; dp = opendir(dir); if (dp == NULL) exit(1); while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } if (unlink(filename)) exit(1); } closedir(dp); if (rmdir(dir)) exit(1); } #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; for (i = 0; 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) { volatile long p[8] = {0}; (void)p; ((void (*)(void))(text))(); return 0; } static void execute_one(void); #define WAIT_FLAGS 0 static void loop(void) { int iter; for (iter = 0;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5 * 1000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x41424344}; void execute_one(void) { intptr_t res = 0; memcpy((void*)0x10000000, "./file0\000", 8); syscall(SYS_truncate, 0x10000000, 0); syscall(SYS_socket, 2, 4, 0x81); res = syscall(SYS_freebsd10_pipe, 0x10000040); if (res != -1) r[0] = *(uint32_t*)0x10000044; memcpy((void*)0x10000080, "./file0\000", 8); syscall(SYS_freebsd11_mknodat, (intptr_t)r[0], 0x10000080, 0x40, 4); memcpy((void*)0x100000c0, "./file0\000", 8); syscall(SYS_chflags, 0x100000c0, 0x110212); memcpy((void*)0x10000100, "./file0\000", 8); memcpy((void*)0x10000140, "./file0\000", 8); syscall(SYS_shm_rename, 0x10000100, 0x10000140, 6); res = syscall(SYS_dup2, -1, 0xffffff9c); if (res != -1) r[1] = res; memcpy((void*)0x10000180, "\x9d\x61\x63\x24\x59\xf0\x11\x10\x8a\xca\x18\x1d\xa4\xcc\x83\x72\xb7\x8d\xcd\xa5", 20); syscall(SYS_ioctl, (intptr_t)r[1], 0xc4704437, 0x10000180); res = syscall(SYS_freebsd10_pipe, 0x100001c0); if (res != -1) r[2] = *(uint32_t*)0x100001c0; memcpy((void*)0x10000280, "\x35\xc4\xdf\x51\x5e\xd9\xa9\xee\xb6\x9a\x52\x63\x5d\x8f\xb8\xb6\x51\xcf\x39\x59\xfa\x23\x35\x03\x47\x4d\x88\x01\x70\xac\x5a\x6e\xff\x89\x83\xb1\xab\xf3\x3d\x2a\x2b\x68\xb4\x8a\xc3\xe0\x4d\x9f\x15\x76\x97\x6e\x9a\x20\x9e\xa4\xeb\x9d\xf0\x49\x2c\xb6\x0f\xff\x25\xf7\x05\xb2\x25\xe6\x05\x41\x43\x07\x74\x02\x4e\xd9\xa7\x79\x56\xcc\x1e\xe1\xaa\x49\x85\x28\x56\xdd\xe7\x98\xff\xf5\x7c\xf8\x5b\x44\xf6\x11\xe4\xf6\xa2\xf9\xb1\xc9\x17\x49\x57\x16\x4e\x7e\x83\xb5\xfc\x15\x2f\xe9\xee\xfb\x92\x91\xfc\xb5\xbb\x6d\xcc\x4f\x34\xbb\x92\x53\xbf\xdf\xb6\x85\xe0\xce\x6f\xd9\xf9\x91\x23\x21\xe7\xc9\x6a\xfa\x1e\x73\xb2\xc8\x49\xce\xf7\x30\xdb\xc0\xdc\xb0\xd1\xaa\x86\xb8\x10\xf5\x86\x58\xd4\x5c\xb3\x84\x71\x9b\x50\x17\xa8\xb4\x4b\x55\xd6\x21\xa3\x97\xf5\x39\x19\x03\x92\xa7\xfc\xc5\xa5\x45\xc7\xc9\x75\x9c\xd3\xbe\x71\x1e\xc9\x1a\xa7\xc1\xf0\x59\x03\x21\xd8\x39\x50\x0e\x0a\x00\x6b\x8f\xf5\xe7\xfa\xe1\x9d\x3f\xd8\x81\xb5\x2e\x0d\xcb\x79\xb9\x29\x36\xe6\x0c\xe9\xa7\x14\x63\x1a\x5a\x0f\x7c\x12\x2a\xe5\x3b\x27\xaf\xa9\x0f\xfd\xef\xfa\x18\x50\xc6\xb3\xbd\x71\x15\x55\x05\x3e\x45\x96\x27\xc8\x0b\x68\x1c\x3c\x8b\x88\x16\xc0\x91\x3e\x77\x2b\x05\xa8\x0f\xf7\x55\x6c\x80\xe8\x60\xe2\x46\x3d\xb4\xd5\xae\x7d\xd1\x1a\xf5\xa1\x5c\x83\xa6\x5c\xf7\x79\x5c\x97\x5d\x8b\x82\x7e\x5b\x62\xd0\x2a\xd5\x55\x72\x62\x3a\x90\xbf\x8a\xd0\xe8\xce\x52\xd6\xd0\x99\x42\x7a\x4a\xbf\xe8\x41\x98\xb6\x4d\xc2\x62\x31\xc8\x47\xd0\x38\x30\x2b\x7f\xe5\x58\xaa\xc4\xf2\xa7\xe9\x27\x4c\x8a\x9c\x3b\xe2\x63\xe2\x56\x5d\x82\x5f\x37\x9d\x55\xa3\x5b\xf4\x1d\x89\xe8\xc3\xfe\x9f\xf7\x64\x29\xe1\xda\xd1\xd7\xc2\x84\x41\x2b\xd3\x61\x44\xe5\x56\x26\xf1\x35\xfb\xe6\x58\x58\xa2\xc9\xd1\x32\x6f\x57\xb0\x4e\xab\x13\x01\xa0\x8b\xd6\xd6\x08\xb8\x94\xe7\x16\xfb\xc4\xcb\xb8\x9a\x8d\x96\xaf\xa8\xed\x32\x69\x70\xad\x2d\xcd\x74\x6a\x44\x58\x37\x15\x6b\x87\x98\x3e\xbc\x5f\xe5\x55\x40\xee\x34\x35\xa2\x00\x62\x29\x1f\xd8\x27\x52\x5f\xb5\xfd\xea\x7a\x33\x08\x0a\xcd\x05\x24\xab\x2d\x6b\xf8\x1f\xb7\x53\xbd\xbc\x76\x62\x69\x5c\x87\x8d\x22\xe4\xcc\x37\x76\xa1\x5e\x64\x75\x0c\xf4\x65\x4e\x25\x60\x9b\x0d\x6b\xbf\x0e\x36\x7d\xf5\x0f\x14\x3e\x7a\xda\x51\x21\xad\x9e\xdc\x7d\xa9\x68\x6b\xb8\x64\xd2\x78\x6a\x68\x4d\x2a\x84\xe2\xb0\x27\xa2\x60\x84\xc6\xd5\xf5\xaf\xd8\x9b\xd2\x5e\x1c\x6d\xad\x06\x74\xbd\x0f\x2b\x34\xda\x34\xc6\xf4\xd5\x4e\x80\xc9\xa4\x46\x75\xb5\xfa\xe4\x0a\x80\x50\x6a\x6d\xa8\xe7\x56\x9b\x9b\xff\x2f\x53\x9d\x8d\xe3\x40\x08\x7c\x58\x85\xbf\x05\x2d\x38\x61\xcc\xc4\xca\x85\xc3\x80\x83\xc7\x93\xf7\x8f\xf7\xb0\x18\xcb\x1b\xab\x2e\xc7\xe9\xe1\xd1\xb5\x92\x03\xbf\x15\xdd\xec\x6e\x99\x13\x9e\xac\x8f\xbd\x50\x55\xe6\x06\x11\xe3\x91\x93\xcd\x87\x5c\xd2\x13\xab\xa3\x4b\x3e\x0d\xdb\xc0\x50\x74\xf1\x75\x67\x70\xde\x1c\x1c\x8e\xfb\xf4\x55\x4b\xe8\x3b\xae\x0b\x3f\x5e\xe3\x0c\xd9\xa7\x71\xa6\x89\xf5\x24\x69\xce\xbf\x6c\x80\x1f\x8d\xe0\xea\xc5\xfe\x93\xc3\xc1\x35\x93\xe9\xda\xa5\xba\xd1\x28\x0b\x69\x5e\xf7\xe5\xbd\xc1\x5b\xa6\xb6\x99\x21\x83\xae\x6d\xa6\x4d\xe1\xe8\xd1\xea\xe9\xf1\x10\xcd\xb2\x5e\xdb\x6a\x7b\x12\x3f\x6c\x83\xcb\x48\xa3\xe1\x04\x5f\x28\x45\x93\xf7\xd6\xf2\x3e\x2a\x06\x85\x06\x44\x5a\x99\x38\x48\x6a\xd3\xb6\x76\xbe\x2f\xb1\x54\xeb\xcd\xe1\x51\x19\xd2\x96\xfc\xeb\x24\x13\x74\x5a\x8c\x54\x17\xb2\xac\x34\xb4\xf3\x55\xb3\x54\x9a\xa2\x23\xef\x2f\x34\x2e\x00\xa6\x37\xdb\x86\x16\x44\x2c\xa3\xa1\x80\xa5\x82\x5d\xff\x26\x03\xba\xd9\x06\x62\x54\x04\x67\x8f\xa3\xb3\x95\x91\xe1\x62\xe7\xff\x40\xad\xfe\x85\x66\xd6\x8e\xed\x8a\x19\x15\x3f\x19\xfc\x62\x94\x52\xe3\x0f\x06\x45\xaa\xfc\x1f\x4e\xb5\xde\xa9\xf3\xc6\xed\x6d\xdb\xc4\x44\x73\xcf\x89\x95\xd0\x33\xa2\xff\x0c\x0c\xdd\x53\x88\xce\x6e\xdb\x1e\x73\x2a\xa3\x83\x34\x6a\xca\x32\x97\xd8\x41\x74\xea\x8c\x6a\x3f\xb4\x08\x3f\x09\x12\x63\xac\x4c\x60\x62\xa8\x40\x1d\x16\x4b\xe2\xbf\xa2\x3e\x81\xf9\xbd\xa1\x48\x6c\x7f\xda\x45\xda\x44\xba\x46\xaf\xb5\x5f\x09\x46\xb4\x3e\x8d\x80\xf1\xfc\xce\xa2\x90\xac\x53\xaa\xdf\xa2\xd1\x09\xdb\x7d\x14\x93\xb1\x14\x69\x47\xd9\x6b\x87\x01\xe1\xf6\xa6\x18\x92\x16\x49\x12\x43\x0f\x75\x83\xff\x87\xe7\xdf\xa8\xbc\x61\x52\x0b\xdf\x7a\xfb\x54\x85\x30\x2a\x8e\x0d\xbc\x33\x2f\xce\x47\x36\xbe\xe8\x59\xc1\xc3\xd4\xb5\x08\x3e\xb5\x3a\xa0\x53\x2f\xb0\x72\x29\xe6", 1024); memcpy((void*)0x10000680, "\xfb\xf6\xbf\xee\x9c\x01\x09\x26\x52\xd2\xd6\x00\x83\x5f\x64\xf0\x98\x21\x02\x18\x9a\x56\xbb\x5d\x2a\xcd\x11\x57\xab\xac\xb3\x17", 32); *(uint32_t*)0x100006a0 = 0x100; *(uint8_t*)0x100006a4 = 1; *(uint32_t*)0x100006a8 = 0x10000200; memcpy((void*)0x10000200, "\x4b\x41\x8f\xea\x2c\xea\x20\x6a\xe3\x91\xe4\x4a\x50\x4f\xce\xeb\x9d\xa1\x14\x53\xe3\xc0\x30\x3b\x6f\xbf\xdc\x92\x8a\x74\x70\xeb\x0c\x32\x40\xc7\x5c\x0c\x35\x13\x4c\xaa\xc7\x71\x9b\x58\x49\x27\x4b\xbc\x0f\x0b\x76\xd2\xcd\xbd\x61\x27\xf3\x48\xd9\x9c\xf7\x1d\x49\x62\x57\x99\x66\xd7\x43\x12\x6e\xf7\xb1\x39\xbc\x72\x93\x27\xc6\xe2\x01\x8d\x2c\x24\xa1\xcd\xf8\x8b\x21\x31\x17\x40\x44\x95\xff\x0c\xcb\x9e\x35\x49\x39\x0c\x33\xe4\xfa\x7e\xf5\x04\xf7\x6d\x2c\x9d\xca\xd0\x50\x27\x73\xb1\xe6\xe2\xee", 123); *(uint64_t*)0x100006ac = 0xffffffff; *(uint64_t*)0x100006b4 = 7; *(uint64_t*)0x100006bc = 0x20; *(uint64_t*)0x100006c4 = 0x200; *(uint64_t*)0x100006cc = 0; *(uint64_t*)0x100006d4 = 7; *(uint64_t*)0x100006dc = 0x887f; *(uint32_t*)0x100006e4 = 0x7ff; syscall(SYS_ioctl, (intptr_t)r[2], 0xc4504449, 0x10000280); if (res != -1) r[3] = *(uint32_t*)0x10000004; *(uint8_t*)0x10000040 = 0xaa; *(uint8_t*)0x10000041 = 0xaa; *(uint8_t*)0x10000042 = 0xaa; *(uint8_t*)0x10000043 = 0xaa; *(uint8_t*)0x10000044 = 0xaa; *(uint8_t*)0x10000045 = 0xaa; *(uint8_t*)0x10000046 = 0; *(uint8_t*)0x10000047 = 0; *(uint8_t*)0x10000048 = 0; *(uint8_t*)0x10000049 = 0; *(uint8_t*)0x1000004a = 0; *(uint8_t*)0x1000004b = 0; *(uint16_t*)0x1000004c = htobe16(0x800); STORE_BY_BITMASK(uint8_t, , 0x1000004e, 0x24, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x1000004e, 4, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x1000004f, 1, 0, 2); STORE_BY_BITMASK(uint8_t, , 0x1000004f, 7, 2, 6); *(uint16_t*)0x10000050 = htobe16(0x1c1); *(uint16_t*)0x10000052 = htobe16(0x66); *(uint16_t*)0x10000054 = htobe16(0xc7c); *(uint8_t*)0x10000056 = 0x40; *(uint8_t*)0x10000057 = 0x2e; *(uint16_t*)0x10000058 = htobe16(0); *(uint32_t*)0x1000005a = htobe32(0xe0000002); *(uint32_t*)0x1000005e = htobe32(0x7f000001); *(uint8_t*)0x10000062 = 0; *(uint8_t*)0x10000063 = 7; *(uint8_t*)0x10000064 = 0xb; *(uint8_t*)0x10000065 = 9; *(uint32_t*)0x10000066 = htobe32(0xe0000002); *(uint32_t*)0x1000006a = htobe32(0xe0000002); *(uint8_t*)0x1000006e = 0x89; *(uint8_t*)0x1000006f = 7; *(uint8_t*)0x10000070 = 0x7f; *(uint8_t*)0x10000071 = 0xac; *(uint8_t*)0x10000072 = 0x14; *(uint8_t*)0x10000073 = 0; *(uint8_t*)0x10000074 = 0xaa; *(uint8_t*)0x10000075 = 1; *(uint8_t*)0x10000076 = 7; *(uint8_t*)0x10000077 = 0xb; *(uint8_t*)0x10000078 = 0x1f; *(uint8_t*)0x10000079 = 0xac; *(uint8_t*)0x1000007a = 0x14; *(uint8_t*)0x1000007b = 0; *(uint8_t*)0x1000007c = 0xaa; *(uint32_t*)0x1000007d = htobe32(0); *(uint8_t*)0x10000081 = 0x83; *(uint8_t*)0x10000082 = 0xb; *(uint8_t*)0x10000083 = 0; *(uint32_t*)0x10000084 = htobe32(0xe0000002); *(uint32_t*)0x10000088 = htobe32(0); *(uint8_t*)0x1000008c = 0; *(uint8_t*)0x1000008d = 0x83; *(uint8_t*)0x1000008e = 0xf; *(uint8_t*)0x1000008f = 0x96; *(uint32_t*)0x10000090 = htobe32(0x7f000001); *(uint32_t*)0x10000094 = htobe32(0xe0000002); *(uint32_t*)0x10000098 = htobe32(0xe0000002); *(uint8_t*)0x1000009c = 7; *(uint8_t*)0x1000009d = 7; *(uint8_t*)0x1000009e = 0; *(uint32_t*)0x1000009f = htobe32(0xe0000002); *(uint8_t*)0x100000a3 = 0x44; *(uint8_t*)0x100000a4 = 0x38; *(uint8_t*)0x100000a5 = 2; STORE_BY_BITMASK(uint8_t, , 0x100000a6, 1, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x100000a6, 7, 4, 4); *(uint32_t*)0x100000a7 = htobe32(0); *(uint32_t*)0x100000ab = htobe32(2); *(uint8_t*)0x100000af = 0xac; *(uint8_t*)0x100000b0 = 0x14; *(uint8_t*)0x100000b1 = 0; *(uint8_t*)0x100000b2 = 0xaa; *(uint32_t*)0x100000b3 = htobe32(0x1f); *(uint32_t*)0x100000b7 = htobe32(0xe0000001); *(uint32_t*)0x100000bb = htobe32(0); *(uint32_t*)0x100000bf = htobe32(7); *(uint32_t*)0x100000c3 = htobe32(0x3ff); *(uint32_t*)0x100000c7 = htobe32(0x3b6); *(uint32_t*)0x100000cb = htobe32(0x7f000001); *(uint32_t*)0x100000cf = htobe32(0xfffffbaf); *(uint32_t*)0x100000d3 = htobe32(0x7f000001); *(uint32_t*)0x100000d7 = htobe32(0x400); *(uint16_t*)0x100000de = htobe16(0x4e20); *(uint16_t*)0x100000e0 = htobe16(0x4e21); *(uint32_t*)0x100000e2 = r[3]; *(uint32_t*)0x100000e6 = 0x41424344; STORE_BY_BITMASK(uint8_t, , 0x100000ea, 0, 0, 1); STORE_BY_BITMASK(uint8_t, , 0x100000ea, 0, 1, 3); STORE_BY_BITMASK(uint8_t, , 0x100000ea, 0x10, 4, 4); *(uint8_t*)0x100000eb = 8; *(uint16_t*)0x100000ec = htobe16(0x8001); *(uint16_t*)0x100000ee = htobe16(0); *(uint16_t*)0x100000f0 = htobe16(6); *(uint8_t*)0x100000f2 = 0; *(uint8_t*)0x100000f3 = 2; *(uint8_t*)0x100000f4 = 4; *(uint16_t*)0x100000f5 = htobe16(0xf13); *(uint8_t*)0x100000f7 = 5; *(uint8_t*)0x100000f8 = 0x26; *(uint32_t*)0x100000f9 = htobe32(0x3f); *(uint32_t*)0x100000fd = htobe32(6); *(uint32_t*)0x10000101 = htobe32(8); *(uint32_t*)0x10000105 = htobe32(6); *(uint32_t*)0x10000109 = htobe32(8); *(uint32_t*)0x1000010d = htobe32(8); *(uint32_t*)0x10000111 = htobe32(0x20); *(uint32_t*)0x10000115 = htobe32(0x8001); *(uint32_t*)0x10000119 = htobe32(0xfffffff7); memcpy((void*)0x1000011e, "\xb9\x8e\xed\x1b\xfb\x3a\x0d\x46\xc5\x41\xa8\x52\x1f\xa4\xb5\x20\x40\x51\xe2\x1c\xdf\x38\xcb\x70\x77\xdb\x0f\x27\x16\x03\x9b\xa5\xc2\x45\x69\xc2\x3b\x4e\x18\xe6\x01\x52\xf0\x8a\x56\xa0\xb8\x13\x62\x42\x30\xb5\x7b\x8c\x73\x00\x1a\x7c\x09\xee\x6b\x29\xab\x9c\xa3\x12\x48\xef\x28\xd1\xde\x0b\xdc\x63\x24\x74\x83\xe0\x51\xe8\xc7\x28\x11\xf9\xb4\x21\x22\xdc\xe1\xb1\x36\x57\xa9\x9a\x08\xd7\x95\x64\xf0\x09\x61\xf5\x46\xb5\x9c\x7c\x01\x94\x6e\x8c\xd5\xfe\x48\x05\xc8\x7d\xbb\x5c\xca\xfb\xfd\xe1\x8a\x4b\x99\xd3\x06\x97\xca\xc4\x45\x42\x8a\x4a\x0f\xd5\xb4\x6b\x18\x71\x99\xc3\x4a\x93\xb2\xbd\x70\x6b\x47\x0c\xf0\xc6\x9d\xf6\x0a\x28\xdc\x68\xbc\x42\x60\x08\x96\x5b\x0d\xfd\x74\xa4\xaa\x29\xb6\xb7\x99\x18\xec\xc6\x78\x41\x9a\xc3\xff\x8f\x7e\x25\x45\xb5\xe2\x08\xb7\x29\x51\xd8\x14\xf6\x93\x69\x3b\x7b\x0e\x40\x52\x36\x64\xf3\x96\x34\x76\x31\xf0\xf1\x98\xa0\xea\xd9\xb8\xa9\x3c\xae\x36\xe7\x49\x09\x18\x0a\x23\x70\xfe\x72\xfe\xde\x65\xb7\x47\xad\x92\xb5\x46\x71\xa1\x25\xf1", 241); struct csum_inet csum_1; csum_inet_init(&csum_1); csum_inet_update(&csum_1, (const uint8_t*)0x1000005a, 4); csum_inet_update(&csum_1, (const uint8_t*)0x1000005e, 4); uint16_t csum_1_chunk_2 = 0x600; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_2, 2); uint16_t csum_1_chunk_3 = 0x3101; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_3, 2); csum_inet_update(&csum_1, (const uint8_t*)0x100000de, 305); *(uint16_t*)0x100000ee = csum_inet_digest(&csum_1); struct csum_inet csum_2; csum_inet_init(&csum_2); csum_inet_update(&csum_2, (const uint8_t*)0x1000004e, 144); *(uint16_t*)0x10000058 = csum_inet_digest(&csum_2); memcpy((void*)0x10000240, "\xc4\xc1\xed\x14\xa5\x59\xab\x32\xeb\xd0\xd5\x36\x64\x66\x67\x66\x66\x0f\x38\xf6\x6b\x0f\xc4\xc2\x61\xbe\xed\xc4\xe2\x01\xba\xef\x0f\x18\xd1\xc4\xe2\x01\xa8\xa8\xe1\x40\x00\x00\xc4\xe1\x69\xe5\xb1\x4d\x41\xb9\xa0\xde\xe9\x0f\x38\xca\x23", 59); syz_execute_func(0x10000240); } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); use_temporary_dir(); do_sandbox_none(); return 0; } :202:10: error: use of undeclared identifier 'SYS_shm_rename' syscall(SYS_shm_rename, 0x10000100, 0x10000140, 6); ^ 1 error generated. compiler invocation: clang [-o /tmp/syz-executor690533690 -DGOOS_freebsd=1 -DGOARCH_386=1 -DHOSTGOOS_freebsd=1 -x c - -m32 -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -static -lc++ -Wno-overflow] --- FAIL: TestGenerate/freebsd/386/14 (1.39s) csource_test.go:122: opts: {Threaded:true Collide:true Repeat:true RepeatTimes:0 Procs:2 Sandbox:none Fault:false FaultCall:0 FaultNth:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false UseTmpDir:true HandleSegv:false Repro:true Trace:false} program: truncate(&(0x7f0000000000)='./file0\x00', 0x0) socket$inet(0x2, 0x4, 0x81) freebsd10_pipe(&(0x7f0000000040)={0xffffffffffffffff, 0xffffffffffffffff}) freebsd11_mknodat(r0, &(0x7f0000000080)='./file0\x00', 0x40, 0x4) chflags(&(0x7f00000000c0)='./file0\x00', 0x110212) shm_rename(&(0x7f0000000100)='./file0\x00', &(0x7f0000000140)='./file0\x00', 0x6) r1 = dup2(0xffffffffffffffff, 0xffffffffffffff9c) ioctl$DIOCCHANGEADDR(r1, 0xc4704437, &(0x7f0000000180)="9d61632459f011108aca181da4cc8372b78dcda5") freebsd10_pipe(&(0x7f00000001c0)={0xffffffffffffffff}) ioctl$DIOCRTSTADDRS(r2, 0xc4504449, &(0x7f0000000280)={{"35c4df515ed9a9eeb69a52635d8fb8b651cf3959fa233503474d880170ac5a6eff8983b1abf33d2a2b68b48ac3e04d9f1576976e9a209ea4eb9df0492cb60fff25f705b225e60541430774024ed9a77956cc1ee1aa49852856dde798fff57cf85b44f611e4f6a2f9b1c9174957164e7e83b5fc152fe9eefb9291fcb5bb6dcc4f34bb9253bfdfb685e0ce6fd9f9912321e7c96afa1e73b2c849cef730dbc0dcb0d1aa86b810f58658d45cb384719b5017a8b44b55d621a397f539190392a7fcc5a545c7c9759cd3be711ec91aa7c1f0590321d839500e0a006b8ff5e7fae19d3fd881b52e0dcb79b92936e60ce9a714631a5a0f7c122ae53b27afa90ffdeffa1850c6b3bd711555053e459627c80b681c3c8b8816c0913e772b05a80ff7556c80e860e2463db4d5ae7dd11af5a15c83a65cf7795c975d8b827e5b62d02ad55572623a90bf8ad0e8ce52d6d099427a4abfe84198b64dc26231c847d038302b7fe558aac4f2a7e9274c8a9c3be263e2565d825f379d55a35bf41d89e8c3fe9ff76429e1dad1d7c284412bd36144e55626f135fbe65858a2c9d1326f57b04eab1301a08bd6d608b894e716fbc4cbb89a8d96afa8ed326970ad2dcd746a445837156b87983ebc5fe55540ee3435a20062291fd827525fb5fdea7a33080acd0524ab2d6bf81fb753bdbc7662695c878d22e4cc3776a15e64750cf4654e25609b0d6bbf0e367df50f143e7ada5121ad9edc7da9686bb864d2786a684d2a84e2b027a26084c6d5f5afd89bd25e1c6dad0674bd0f2b34da34c6f4d54e80c9a44675b5fae40a80506a6da8e7569b9bff2f539d8de340087c5885bf052d3861ccc4ca85c38083c793f78ff7b018cb1bab2ec7e9e1d1b59203bf15ddec6e99139eac8fbd5055e60611e39193cd875cd213aba34b3e0ddbc05074f1756770de1c1c8efbf4554be83bae0b3f5ee30cd9a771a689f52469cebf6c801f8de0eac5fe93c3c13593e9daa5bad1280b695ef7e5bdc15ba6b6992183ae6da64de1e8d1eae9f110cdb25edb6a7b123f6c83cb48a3e1045f284593f7d6f23e2a068506445a9938486ad3b676be2fb154ebcde15119d296fceb2413745a8c5417b2ac34b4f355b3549aa223ef2f342e00a637db8616442ca3a180a5825dff2603bad906625404678fa3b39591e162e7ff40adfe8566d68eed8a19153f19fc629452e30f0645aafc1f4eb5dea9f3c6ed6ddbc44473cf8995d033a2ff0c0cdd5388ce6edb1e732aa383346aca3297d84174ea8c6a3fb4083f091263ac4c6062a8401d164be2bfa23e81f9bda1486c7fda45da44ba46afb55f0946b43e8d80f1fccea290ac53aadfa2d109db7d1493b1146947d96b8701e1f6a61892164912430f7583ff87e7dfa8bc61520bdf7afb5485302a8e0dbc332fce4736bee859c1c3d4b5083eb53aa0532fb07229e6", "fbf6bfee9c01092652d2d600835f64f0982102189a56bb5d2acd1157abacb317", 0x100, 0x1}, &(0x7f0000000200)="4b418fea2cea206ae391e44a504fceeb9da11453e3c0303b6fbfdc928a7470eb0c3240c75c0c35134caac7719b5849274bbc0f0b76d2cdbd6127f348d99cf71d4962579966d743126ef7b139bc729327c6e2018d2c24a1cdf88b213117404495ff0ccb9e3549390c33e4fa7ef504f76d2c9dcad0502773b1e6e2ee", 0xffffffff, 0x7, 0x20, 0x200, 0x0, 0x7, 0x887f, 0x7ff}) syz_extract_tcp_res(&(0x7f0000000000)={0x41424344, 0x41424344}, 0x4, 0x40) syz_emit_ethernet(0x1cf, &(0x7f0000000040)={@local, @empty, [], {@ipv4={0x800, {{0x24, 0x4, 0x1, 0x7, 0x1c1, 0x66, 0xc7c, 0x40, 0x2e, 0x0, @multicast2, @loopback, {[@end, @rr={0x7, 0xb, 0x9, [@multicast2, @multicast2]}, @ssrr={0x89, 0x7, 0x7f, [@local={0xac, 0x14, 0x0}]}, @noop, @rr={0x7, 0xb, 0x1f, [@local={0xac, 0x14, 0x0}, @empty]}, @lsrr={0x83, 0xb, 0x0, [@multicast2, @empty]}, @end, @lsrr={0x83, 0xf, 0x96, [@loopback, @multicast2, @multicast2]}, @rr={0x7, 0x7, 0x0, [@multicast2]}, @timestamp={0x44, 0x38, 0x2, 0x1, 0x7, [{[@empty], 0x2}, {[@local={0xac, 0x14, 0x0}], 0x1f}, {[@multicast1]}, {[], 0x7}, {[], 0x3ff}, {[], 0x3b6}, {[@loopback], 0xfffffbaf}, {[@loopback], 0x400}]}]}}, @tcp={{0x0, 0x1, r3, 0x41424344, 0x0, 0x0, 0x10, 0x8, 0x8001, 0x0, 0x6, {[@eol, @mss={0x2, 0x4, 0xf13}, @sack={0x5, 0x26, [0x3f, 0x6, 0x8, 0x6, 0x8, 0x8, 0x20, 0x8001, 0xfffffff7]}]}}, {"b98eed1bfb3a0d46c541a8521fa4b5204051e21cdf38cb7077db0f2716039ba5c24569c23b4e18e60152f08a56a0b813624230b57b8c73001a7c09ee6b29ab9ca31248ef28d1de0bdc63247483e051e8c72811f9b42122dce1b13657a99a08d79564f00961f546b59c7c01946e8cd5fe4805c87dbb5ccafbfde18a4b99d30697cac445428a4a0fd5b46b187199c34a93b2bd706b470cf0c69df60a28dc68bc426008965b0dfd74a4aa29b6b79918ecc678419ac3ff8f7e2545b5e208b72951d814f693693b7b0e40523664f396347631f0f198a0ead9b8a93cae36e74909180a2370fe72fede65b747ad92b54671a125f1"}}}}}}) syz_execute_func(&(0x7f0000000240)="c4c1ed14a559ab32ebd0d53664666766660f38f66b0fc4c261beedc4e201baef0f18d1c4e201a8a8e1400000c4e169e5b14d41b9a0dee90f38ca23") syz_extract_tcp_res(&(0x7f0000000280), 0x4df9f115, 0x2) csource_test.go:123: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static unsigned long long procid; static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void remove_dir(const char* dir) { DIR* dp; struct dirent* ep; dp = opendir(dir); if (dp == NULL) exit(1); while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } if (unlink(filename)) exit(1); } closedir(dp); if (rmdir(dir)) exit(1); } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i; for (i = 0; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { pthread_mutex_t mu; pthread_cond_t cv; int state; } event_t; static void event_init(event_t* ev) { if (pthread_mutex_init(&ev->mu, 0)) exit(1); if (pthread_cond_init(&ev->cv, 0)) exit(1); ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { pthread_mutex_lock(&ev->mu); if (ev->state) exit(1); ev->state = 1; pthread_mutex_unlock(&ev->mu); pthread_cond_broadcast(&ev->cv); } static void event_wait(event_t* ev) { pthread_mutex_lock(&ev->mu); while (!ev->state) pthread_cond_wait(&ev->cv, &ev->mu); pthread_mutex_unlock(&ev->mu); } static int event_isset(event_t* ev) { pthread_mutex_lock(&ev->mu); int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; pthread_mutex_lock(&ev->mu); for (;;) { if (ev->state) break; uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); now = current_time_ms(); if (now - start > timeout) break; } int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } #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; for (i = 0; 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) { volatile long p[8] = {0}; (void)p; ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } int i, call, thread; int collide = 0; again: for (call = 0; call < 14; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (collide && (call % 2) == 0) break; event_timedwait(&th->done, 45); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); if (!collide) { collide = 1; goto again; } } static void execute_one(void); #define WAIT_FLAGS 0 static void loop(void) { int iter; for (iter = 0;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5 * 1000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x41424344}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: memcpy((void*)0x10000000, "./file0\000", 8); syscall(SYS_truncate, 0x10000000, 0); break; case 1: syscall(SYS_socket, 2, 4, 0x81); break; case 2: res = syscall(SYS_freebsd10_pipe, 0x10000040); if (res != -1) r[0] = *(uint32_t*)0x10000044; break; case 3: memcpy((void*)0x10000080, "./file0\000", 8); syscall(SYS_freebsd11_mknodat, (intptr_t)r[0], 0x10000080, 0x40, 4); break; case 4: memcpy((void*)0x100000c0, "./file0\000", 8); syscall(SYS_chflags, 0x100000c0, 0x110212); break; case 5: memcpy((void*)0x10000100, "./file0\000", 8); memcpy((void*)0x10000140, "./file0\000", 8); syscall(SYS_shm_rename, 0x10000100, 0x10000140, 6); break; case 6: res = syscall(SYS_dup2, -1, 0xffffff9c); if (res != -1) r[1] = res; break; case 7: memcpy((void*)0x10000180, "\x9d\x61\x63\x24\x59\xf0\x11\x10\x8a\xca\x18\x1d\xa4\xcc\x83\x72\xb7\x8d\xcd\xa5", 20); syscall(SYS_ioctl, (intptr_t)r[1], 0xc4704437, 0x10000180); break; case 8: res = syscall(SYS_freebsd10_pipe, 0x100001c0); if (res != -1) r[2] = *(uint32_t*)0x100001c0; break; case 9: memcpy((void*)0x10000280, "\x35\xc4\xdf\x51\x5e\xd9\xa9\xee\xb6\x9a\x52\x63\x5d\x8f\xb8\xb6\x51\xcf\x39\x59\xfa\x23\x35\x03\x47\x4d\x88\x01\x70\xac\x5a\x6e\xff\x89\x83\xb1\xab\xf3\x3d\x2a\x2b\x68\xb4\x8a\xc3\xe0\x4d\x9f\x15\x76\x97\x6e\x9a\x20\x9e\xa4\xeb\x9d\xf0\x49\x2c\xb6\x0f\xff\x25\xf7\x05\xb2\x25\xe6\x05\x41\x43\x07\x74\x02\x4e\xd9\xa7\x79\x56\xcc\x1e\xe1\xaa\x49\x85\x28\x56\xdd\xe7\x98\xff\xf5\x7c\xf8\x5b\x44\xf6\x11\xe4\xf6\xa2\xf9\xb1\xc9\x17\x49\x57\x16\x4e\x7e\x83\xb5\xfc\x15\x2f\xe9\xee\xfb\x92\x91\xfc\xb5\xbb\x6d\xcc\x4f\x34\xbb\x92\x53\xbf\xdf\xb6\x85\xe0\xce\x6f\xd9\xf9\x91\x23\x21\xe7\xc9\x6a\xfa\x1e\x73\xb2\xc8\x49\xce\xf7\x30\xdb\xc0\xdc\xb0\xd1\xaa\x86\xb8\x10\xf5\x86\x58\xd4\x5c\xb3\x84\x71\x9b\x50\x17\xa8\xb4\x4b\x55\xd6\x21\xa3\x97\xf5\x39\x19\x03\x92\xa7\xfc\xc5\xa5\x45\xc7\xc9\x75\x9c\xd3\xbe\x71\x1e\xc9\x1a\xa7\xc1\xf0\x59\x03\x21\xd8\x39\x50\x0e\x0a\x00\x6b\x8f\xf5\xe7\xfa\xe1\x9d\x3f\xd8\x81\xb5\x2e\x0d\xcb\x79\xb9\x29\x36\xe6\x0c\xe9\xa7\x14\x63\x1a\x5a\x0f\x7c\x12\x2a\xe5\x3b\x27\xaf\xa9\x0f\xfd\xef\xfa\x18\x50\xc6\xb3\xbd\x71\x15\x55\x05\x3e\x45\x96\x27\xc8\x0b\x68\x1c\x3c\x8b\x88\x16\xc0\x91\x3e\x77\x2b\x05\xa8\x0f\xf7\x55\x6c\x80\xe8\x60\xe2\x46\x3d\xb4\xd5\xae\x7d\xd1\x1a\xf5\xa1\x5c\x83\xa6\x5c\xf7\x79\x5c\x97\x5d\x8b\x82\x7e\x5b\x62\xd0\x2a\xd5\x55\x72\x62\x3a\x90\xbf\x8a\xd0\xe8\xce\x52\xd6\xd0\x99\x42\x7a\x4a\xbf\xe8\x41\x98\xb6\x4d\xc2\x62\x31\xc8\x47\xd0\x38\x30\x2b\x7f\xe5\x58\xaa\xc4\xf2\xa7\xe9\x27\x4c\x8a\x9c\x3b\xe2\x63\xe2\x56\x5d\x82\x5f\x37\x9d\x55\xa3\x5b\xf4\x1d\x89\xe8\xc3\xfe\x9f\xf7\x64\x29\xe1\xda\xd1\xd7\xc2\x84\x41\x2b\xd3\x61\x44\xe5\x56\x26\xf1\x35\xfb\xe6\x58\x58\xa2\xc9\xd1\x32\x6f\x57\xb0\x4e\xab\x13\x01\xa0\x8b\xd6\xd6\x08\xb8\x94\xe7\x16\xfb\xc4\xcb\xb8\x9a\x8d\x96\xaf\xa8\xed\x32\x69\x70\xad\x2d\xcd\x74\x6a\x44\x58\x37\x15\x6b\x87\x98\x3e\xbc\x5f\xe5\x55\x40\xee\x34\x35\xa2\x00\x62\x29\x1f\xd8\x27\x52\x5f\xb5\xfd\xea\x7a\x33\x08\x0a\xcd\x05\x24\xab\x2d\x6b\xf8\x1f\xb7\x53\xbd\xbc\x76\x62\x69\x5c\x87\x8d\x22\xe4\xcc\x37\x76\xa1\x5e\x64\x75\x0c\xf4\x65\x4e\x25\x60\x9b\x0d\x6b\xbf\x0e\x36\x7d\xf5\x0f\x14\x3e\x7a\xda\x51\x21\xad\x9e\xdc\x7d\xa9\x68\x6b\xb8\x64\xd2\x78\x6a\x68\x4d\x2a\x84\xe2\xb0\x27\xa2\x60\x84\xc6\xd5\xf5\xaf\xd8\x9b\xd2\x5e\x1c\x6d\xad\x06\x74\xbd\x0f\x2b\x34\xda\x34\xc6\xf4\xd5\x4e\x80\xc9\xa4\x46\x75\xb5\xfa\xe4\x0a\x80\x50\x6a\x6d\xa8\xe7\x56\x9b\x9b\xff\x2f\x53\x9d\x8d\xe3\x40\x08\x7c\x58\x85\xbf\x05\x2d\x38\x61\xcc\xc4\xca\x85\xc3\x80\x83\xc7\x93\xf7\x8f\xf7\xb0\x18\xcb\x1b\xab\x2e\xc7\xe9\xe1\xd1\xb5\x92\x03\xbf\x15\xdd\xec\x6e\x99\x13\x9e\xac\x8f\xbd\x50\x55\xe6\x06\x11\xe3\x91\x93\xcd\x87\x5c\xd2\x13\xab\xa3\x4b\x3e\x0d\xdb\xc0\x50\x74\xf1\x75\x67\x70\xde\x1c\x1c\x8e\xfb\xf4\x55\x4b\xe8\x3b\xae\x0b\x3f\x5e\xe3\x0c\xd9\xa7\x71\xa6\x89\xf5\x24\x69\xce\xbf\x6c\x80\x1f\x8d\xe0\xea\xc5\xfe\x93\xc3\xc1\x35\x93\xe9\xda\xa5\xba\xd1\x28\x0b\x69\x5e\xf7\xe5\xbd\xc1\x5b\xa6\xb6\x99\x21\x83\xae\x6d\xa6\x4d\xe1\xe8\xd1\xea\xe9\xf1\x10\xcd\xb2\x5e\xdb\x6a\x7b\x12\x3f\x6c\x83\xcb\x48\xa3\xe1\x04\x5f\x28\x45\x93\xf7\xd6\xf2\x3e\x2a\x06\x85\x06\x44\x5a\x99\x38\x48\x6a\xd3\xb6\x76\xbe\x2f\xb1\x54\xeb\xcd\xe1\x51\x19\xd2\x96\xfc\xeb\x24\x13\x74\x5a\x8c\x54\x17\xb2\xac\x34\xb4\xf3\x55\xb3\x54\x9a\xa2\x23\xef\x2f\x34\x2e\x00\xa6\x37\xdb\x86\x16\x44\x2c\xa3\xa1\x80\xa5\x82\x5d\xff\x26\x03\xba\xd9\x06\x62\x54\x04\x67\x8f\xa3\xb3\x95\x91\xe1\x62\xe7\xff\x40\xad\xfe\x85\x66\xd6\x8e\xed\x8a\x19\x15\x3f\x19\xfc\x62\x94\x52\xe3\x0f\x06\x45\xaa\xfc\x1f\x4e\xb5\xde\xa9\xf3\xc6\xed\x6d\xdb\xc4\x44\x73\xcf\x89\x95\xd0\x33\xa2\xff\x0c\x0c\xdd\x53\x88\xce\x6e\xdb\x1e\x73\x2a\xa3\x83\x34\x6a\xca\x32\x97\xd8\x41\x74\xea\x8c\x6a\x3f\xb4\x08\x3f\x09\x12\x63\xac\x4c\x60\x62\xa8\x40\x1d\x16\x4b\xe2\xbf\xa2\x3e\x81\xf9\xbd\xa1\x48\x6c\x7f\xda\x45\xda\x44\xba\x46\xaf\xb5\x5f\x09\x46\xb4\x3e\x8d\x80\xf1\xfc\xce\xa2\x90\xac\x53\xaa\xdf\xa2\xd1\x09\xdb\x7d\x14\x93\xb1\x14\x69\x47\xd9\x6b\x87\x01\xe1\xf6\xa6\x18\x92\x16\x49\x12\x43\x0f\x75\x83\xff\x87\xe7\xdf\xa8\xbc\x61\x52\x0b\xdf\x7a\xfb\x54\x85\x30\x2a\x8e\x0d\xbc\x33\x2f\xce\x47\x36\xbe\xe8\x59\xc1\xc3\xd4\xb5\x08\x3e\xb5\x3a\xa0\x53\x2f\xb0\x72\x29\xe6", 1024); memcpy((void*)0x10000680, "\xfb\xf6\xbf\xee\x9c\x01\x09\x26\x52\xd2\xd6\x00\x83\x5f\x64\xf0\x98\x21\x02\x18\x9a\x56\xbb\x5d\x2a\xcd\x11\x57\xab\xac\xb3\x17", 32); *(uint32_t*)0x100006a0 = 0x100; *(uint8_t*)0x100006a4 = 1; *(uint32_t*)0x100006a8 = 0x10000200; memcpy((void*)0x10000200, "\x4b\x41\x8f\xea\x2c\xea\x20\x6a\xe3\x91\xe4\x4a\x50\x4f\xce\xeb\x9d\xa1\x14\x53\xe3\xc0\x30\x3b\x6f\xbf\xdc\x92\x8a\x74\x70\xeb\x0c\x32\x40\xc7\x5c\x0c\x35\x13\x4c\xaa\xc7\x71\x9b\x58\x49\x27\x4b\xbc\x0f\x0b\x76\xd2\xcd\xbd\x61\x27\xf3\x48\xd9\x9c\xf7\x1d\x49\x62\x57\x99\x66\xd7\x43\x12\x6e\xf7\xb1\x39\xbc\x72\x93\x27\xc6\xe2\x01\x8d\x2c\x24\xa1\xcd\xf8\x8b\x21\x31\x17\x40\x44\x95\xff\x0c\xcb\x9e\x35\x49\x39\x0c\x33\xe4\xfa\x7e\xf5\x04\xf7\x6d\x2c\x9d\xca\xd0\x50\x27\x73\xb1\xe6\xe2\xee", 123); *(uint64_t*)0x100006ac = 0xffffffff; *(uint64_t*)0x100006b4 = 7; *(uint64_t*)0x100006bc = 0x20; *(uint64_t*)0x100006c4 = 0x200; *(uint64_t*)0x100006cc = 0; *(uint64_t*)0x100006d4 = 7; *(uint64_t*)0x100006dc = 0x887f; *(uint32_t*)0x100006e4 = 0x7ff; syscall(SYS_ioctl, (intptr_t)r[2], 0xc4504449, 0x10000280); break; case 10: if (res != -1) r[3] = *(uint32_t*)0x10000004; break; case 11: *(uint8_t*)0x10000040 = 0xaa; *(uint8_t*)0x10000041 = 0xaa; *(uint8_t*)0x10000042 = 0xaa; *(uint8_t*)0x10000043 = 0xaa; *(uint8_t*)0x10000044 = 0xaa; *(uint8_t*)0x10000045 = 0xaa; *(uint8_t*)0x10000046 = 0; *(uint8_t*)0x10000047 = 0; *(uint8_t*)0x10000048 = 0; *(uint8_t*)0x10000049 = 0; *(uint8_t*)0x1000004a = 0; *(uint8_t*)0x1000004b = 0; *(uint16_t*)0x1000004c = htobe16(0x800); STORE_BY_BITMASK(uint8_t, , 0x1000004e, 0x24, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x1000004e, 4, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x1000004f, 1, 0, 2); STORE_BY_BITMASK(uint8_t, , 0x1000004f, 7, 2, 6); *(uint16_t*)0x10000050 = htobe16(0x1c1); *(uint16_t*)0x10000052 = htobe16(0x66); *(uint16_t*)0x10000054 = htobe16(0xc7c); *(uint8_t*)0x10000056 = 0x40; *(uint8_t*)0x10000057 = 0x2e; *(uint16_t*)0x10000058 = htobe16(0); *(uint32_t*)0x1000005a = htobe32(0xe0000002); *(uint32_t*)0x1000005e = htobe32(0x7f000001); *(uint8_t*)0x10000062 = 0; *(uint8_t*)0x10000063 = 7; *(uint8_t*)0x10000064 = 0xb; *(uint8_t*)0x10000065 = 9; *(uint32_t*)0x10000066 = htobe32(0xe0000002); *(uint32_t*)0x1000006a = htobe32(0xe0000002); *(uint8_t*)0x1000006e = 0x89; *(uint8_t*)0x1000006f = 7; *(uint8_t*)0x10000070 = 0x7f; *(uint8_t*)0x10000071 = 0xac; *(uint8_t*)0x10000072 = 0x14; *(uint8_t*)0x10000073 = 0 + procid*1; *(uint8_t*)0x10000074 = 0xaa; *(uint8_t*)0x10000075 = 1; *(uint8_t*)0x10000076 = 7; *(uint8_t*)0x10000077 = 0xb; *(uint8_t*)0x10000078 = 0x1f; *(uint8_t*)0x10000079 = 0xac; *(uint8_t*)0x1000007a = 0x14; *(uint8_t*)0x1000007b = 0 + procid*1; *(uint8_t*)0x1000007c = 0xaa; *(uint32_t*)0x1000007d = htobe32(0); *(uint8_t*)0x10000081 = 0x83; *(uint8_t*)0x10000082 = 0xb; *(uint8_t*)0x10000083 = 0; *(uint32_t*)0x10000084 = htobe32(0xe0000002); *(uint32_t*)0x10000088 = htobe32(0); *(uint8_t*)0x1000008c = 0; *(uint8_t*)0x1000008d = 0x83; *(uint8_t*)0x1000008e = 0xf; *(uint8_t*)0x1000008f = 0x96; *(uint32_t*)0x10000090 = htobe32(0x7f000001); *(uint32_t*)0x10000094 = htobe32(0xe0000002); *(uint32_t*)0x10000098 = htobe32(0xe0000002); *(uint8_t*)0x1000009c = 7; *(uint8_t*)0x1000009d = 7; *(uint8_t*)0x1000009e = 0; *(uint32_t*)0x1000009f = htobe32(0xe0000002); *(uint8_t*)0x100000a3 = 0x44; *(uint8_t*)0x100000a4 = 0x38; *(uint8_t*)0x100000a5 = 2; STORE_BY_BITMASK(uint8_t, , 0x100000a6, 1, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x100000a6, 7, 4, 4); *(uint32_t*)0x100000a7 = htobe32(0); *(uint32_t*)0x100000ab = htobe32(2); *(uint8_t*)0x100000af = 0xac; *(uint8_t*)0x100000b0 = 0x14; *(uint8_t*)0x100000b1 = 0 + procid*1; *(uint8_t*)0x100000b2 = 0xaa; *(uint32_t*)0x100000b3 = htobe32(0x1f); *(uint32_t*)0x100000b7 = htobe32(0xe0000001); *(uint32_t*)0x100000bb = htobe32(0); *(uint32_t*)0x100000bf = htobe32(7); *(uint32_t*)0x100000c3 = htobe32(0x3ff); *(uint32_t*)0x100000c7 = htobe32(0x3b6); *(uint32_t*)0x100000cb = htobe32(0x7f000001); *(uint32_t*)0x100000cf = htobe32(0xfffffbaf); *(uint32_t*)0x100000d3 = htobe32(0x7f000001); *(uint32_t*)0x100000d7 = htobe32(0x400); *(uint16_t*)0x100000de = htobe16(0x4e20 + procid*4); *(uint16_t*)0x100000e0 = htobe16(0x4e21 + procid*4); *(uint32_t*)0x100000e2 = r[3]; *(uint32_t*)0x100000e6 = 0x41424344; STORE_BY_BITMASK(uint8_t, , 0x100000ea, 0, 0, 1); STORE_BY_BITMASK(uint8_t, , 0x100000ea, 0, 1, 3); STORE_BY_BITMASK(uint8_t, , 0x100000ea, 0x10, 4, 4); *(uint8_t*)0x100000eb = 8; *(uint16_t*)0x100000ec = htobe16(0x8001); *(uint16_t*)0x100000ee = htobe16(0); *(uint16_t*)0x100000f0 = htobe16(6); *(uint8_t*)0x100000f2 = 0; *(uint8_t*)0x100000f3 = 2; *(uint8_t*)0x100000f4 = 4; *(uint16_t*)0x100000f5 = htobe16(0xf13); *(uint8_t*)0x100000f7 = 5; *(uint8_t*)0x100000f8 = 0x26; *(uint32_t*)0x100000f9 = htobe32(0x3f); *(uint32_t*)0x100000fd = htobe32(6); *(uint32_t*)0x10000101 = htobe32(8); *(uint32_t*)0x10000105 = htobe32(6); *(uint32_t*)0x10000109 = htobe32(8); *(uint32_t*)0x1000010d = htobe32(8); *(uint32_t*)0x10000111 = htobe32(0x20); *(uint32_t*)0x10000115 = htobe32(0x8001); *(uint32_t*)0x10000119 = htobe32(0xfffffff7); memcpy((void*)0x1000011e, "\xb9\x8e\xed\x1b\xfb\x3a\x0d\x46\xc5\x41\xa8\x52\x1f\xa4\xb5\x20\x40\x51\xe2\x1c\xdf\x38\xcb\x70\x77\xdb\x0f\x27\x16\x03\x9b\xa5\xc2\x45\x69\xc2\x3b\x4e\x18\xe6\x01\x52\xf0\x8a\x56\xa0\xb8\x13\x62\x42\x30\xb5\x7b\x8c\x73\x00\x1a\x7c\x09\xee\x6b\x29\xab\x9c\xa3\x12\x48\xef\x28\xd1\xde\x0b\xdc\x63\x24\x74\x83\xe0\x51\xe8\xc7\x28\x11\xf9\xb4\x21\x22\xdc\xe1\xb1\x36\x57\xa9\x9a\x08\xd7\x95\x64\xf0\x09\x61\xf5\x46\xb5\x9c\x7c\x01\x94\x6e\x8c\xd5\xfe\x48\x05\xc8\x7d\xbb\x5c\xca\xfb\xfd\xe1\x8a\x4b\x99\xd3\x06\x97\xca\xc4\x45\x42\x8a\x4a\x0f\xd5\xb4\x6b\x18\x71\x99\xc3\x4a\x93\xb2\xbd\x70\x6b\x47\x0c\xf0\xc6\x9d\xf6\x0a\x28\xdc\x68\xbc\x42\x60\x08\x96\x5b\x0d\xfd\x74\xa4\xaa\x29\xb6\xb7\x99\x18\xec\xc6\x78\x41\x9a\xc3\xff\x8f\x7e\x25\x45\xb5\xe2\x08\xb7\x29\x51\xd8\x14\xf6\x93\x69\x3b\x7b\x0e\x40\x52\x36\x64\xf3\x96\x34\x76\x31\xf0\xf1\x98\xa0\xea\xd9\xb8\xa9\x3c\xae\x36\xe7\x49\x09\x18\x0a\x23\x70\xfe\x72\xfe\xde\x65\xb7\x47\xad\x92\xb5\x46\x71\xa1\x25\xf1", 241); struct csum_inet csum_1; csum_inet_init(&csum_1); csum_inet_update(&csum_1, (const uint8_t*)0x1000005a, 4); csum_inet_update(&csum_1, (const uint8_t*)0x1000005e, 4); uint16_t csum_1_chunk_2 = 0x600; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_2, 2); uint16_t csum_1_chunk_3 = 0x3101; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_3, 2); csum_inet_update(&csum_1, (const uint8_t*)0x100000de, 305); *(uint16_t*)0x100000ee = csum_inet_digest(&csum_1); struct csum_inet csum_2; csum_inet_init(&csum_2); csum_inet_update(&csum_2, (const uint8_t*)0x1000004e, 144); *(uint16_t*)0x10000058 = csum_inet_digest(&csum_2); break; case 12: memcpy((void*)0x10000240, "\xc4\xc1\xed\x14\xa5\x59\xab\x32\xeb\xd0\xd5\x36\x64\x66\x67\x66\x66\x0f\x38\xf6\x6b\x0f\xc4\xc2\x61\xbe\xed\xc4\xe2\x01\xba\xef\x0f\x18\xd1\xc4\xe2\x01\xa8\xa8\xe1\x40\x00\x00\xc4\xe1\x69\xe5\xb1\x4d\x41\xb9\xa0\xde\xe9\x0f\x38\xca\x23", 59); syz_execute_func(0x10000240); break; case 13: break; } } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); for (procid = 0; procid < 2; procid++) { if (fork() == 0) { use_temporary_dir(); do_sandbox_none(); } } sleep(1000000); return 0; } :366:11: error: use of undeclared identifier 'SYS_shm_rename' syscall(SYS_shm_rename, 0x10000100, 0x10000140, 6); ^ 1 error generated. compiler invocation: clang [-o /tmp/syz-executor046430545 -DGOOS_freebsd=1 -DGOARCH_386=1 -DHOSTGOOS_freebsd=1 -x c - -m32 -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -static -lc++ -Wno-overflow] --- FAIL: TestGenerate/freebsd/386/10 (1.56s) csource_test.go:122: opts: {Threaded:true Collide:false Repeat:true RepeatTimes:0 Procs:0 Sandbox:none Fault:false FaultCall:0 FaultNth:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false UseTmpDir:false HandleSegv:false Repro:false Trace:false} program: truncate(&(0x7f0000000000)='./file0\x00', 0x0) socket$inet(0x2, 0x4, 0x81) freebsd10_pipe(&(0x7f0000000040)={0xffffffffffffffff, 0xffffffffffffffff}) freebsd11_mknodat(r0, &(0x7f0000000080)='./file0\x00', 0x40, 0x4) chflags(&(0x7f00000000c0)='./file0\x00', 0x110212) shm_rename(&(0x7f0000000100)='./file0\x00', &(0x7f0000000140)='./file0\x00', 0x6) r1 = dup2(0xffffffffffffffff, 0xffffffffffffff9c) ioctl$DIOCCHANGEADDR(r1, 0xc4704437, &(0x7f0000000180)="9d61632459f011108aca181da4cc8372b78dcda5") freebsd10_pipe(&(0x7f00000001c0)={0xffffffffffffffff}) ioctl$DIOCRTSTADDRS(r2, 0xc4504449, &(0x7f0000000280)={{"35c4df515ed9a9eeb69a52635d8fb8b651cf3959fa233503474d880170ac5a6eff8983b1abf33d2a2b68b48ac3e04d9f1576976e9a209ea4eb9df0492cb60fff25f705b225e60541430774024ed9a77956cc1ee1aa49852856dde798fff57cf85b44f611e4f6a2f9b1c9174957164e7e83b5fc152fe9eefb9291fcb5bb6dcc4f34bb9253bfdfb685e0ce6fd9f9912321e7c96afa1e73b2c849cef730dbc0dcb0d1aa86b810f58658d45cb384719b5017a8b44b55d621a397f539190392a7fcc5a545c7c9759cd3be711ec91aa7c1f0590321d839500e0a006b8ff5e7fae19d3fd881b52e0dcb79b92936e60ce9a714631a5a0f7c122ae53b27afa90ffdeffa1850c6b3bd711555053e459627c80b681c3c8b8816c0913e772b05a80ff7556c80e860e2463db4d5ae7dd11af5a15c83a65cf7795c975d8b827e5b62d02ad55572623a90bf8ad0e8ce52d6d099427a4abfe84198b64dc26231c847d038302b7fe558aac4f2a7e9274c8a9c3be263e2565d825f379d55a35bf41d89e8c3fe9ff76429e1dad1d7c284412bd36144e55626f135fbe65858a2c9d1326f57b04eab1301a08bd6d608b894e716fbc4cbb89a8d96afa8ed326970ad2dcd746a445837156b87983ebc5fe55540ee3435a20062291fd827525fb5fdea7a33080acd0524ab2d6bf81fb753bdbc7662695c878d22e4cc3776a15e64750cf4654e25609b0d6bbf0e367df50f143e7ada5121ad9edc7da9686bb864d2786a684d2a84e2b027a26084c6d5f5afd89bd25e1c6dad0674bd0f2b34da34c6f4d54e80c9a44675b5fae40a80506a6da8e7569b9bff2f539d8de340087c5885bf052d3861ccc4ca85c38083c793f78ff7b018cb1bab2ec7e9e1d1b59203bf15ddec6e99139eac8fbd5055e60611e39193cd875cd213aba34b3e0ddbc05074f1756770de1c1c8efbf4554be83bae0b3f5ee30cd9a771a689f52469cebf6c801f8de0eac5fe93c3c13593e9daa5bad1280b695ef7e5bdc15ba6b6992183ae6da64de1e8d1eae9f110cdb25edb6a7b123f6c83cb48a3e1045f284593f7d6f23e2a068506445a9938486ad3b676be2fb154ebcde15119d296fceb2413745a8c5417b2ac34b4f355b3549aa223ef2f342e00a637db8616442ca3a180a5825dff2603bad906625404678fa3b39591e162e7ff40adfe8566d68eed8a19153f19fc629452e30f0645aafc1f4eb5dea9f3c6ed6ddbc44473cf8995d033a2ff0c0cdd5388ce6edb1e732aa383346aca3297d84174ea8c6a3fb4083f091263ac4c6062a8401d164be2bfa23e81f9bda1486c7fda45da44ba46afb55f0946b43e8d80f1fccea290ac53aadfa2d109db7d1493b1146947d96b8701e1f6a61892164912430f7583ff87e7dfa8bc61520bdf7afb5485302a8e0dbc332fce4736bee859c1c3d4b5083eb53aa0532fb07229e6", "fbf6bfee9c01092652d2d600835f64f0982102189a56bb5d2acd1157abacb317", 0x100, 0x1}, &(0x7f0000000200)="4b418fea2cea206ae391e44a504fceeb9da11453e3c0303b6fbfdc928a7470eb0c3240c75c0c35134caac7719b5849274bbc0f0b76d2cdbd6127f348d99cf71d4962579966d743126ef7b139bc729327c6e2018d2c24a1cdf88b213117404495ff0ccb9e3549390c33e4fa7ef504f76d2c9dcad0502773b1e6e2ee", 0xffffffff, 0x7, 0x20, 0x200, 0x0, 0x7, 0x887f, 0x7ff}) syz_extract_tcp_res(&(0x7f0000000000)={0x41424344, 0x41424344}, 0x4, 0x40) syz_emit_ethernet(0x1cf, &(0x7f0000000040)={@local, @empty, [], {@ipv4={0x800, {{0x24, 0x4, 0x1, 0x7, 0x1c1, 0x66, 0xc7c, 0x40, 0x2e, 0x0, @multicast2, @loopback, {[@end, @rr={0x7, 0xb, 0x9, [@multicast2, @multicast2]}, @ssrr={0x89, 0x7, 0x7f, [@local={0xac, 0x14, 0x0}]}, @noop, @rr={0x7, 0xb, 0x1f, [@local={0xac, 0x14, 0x0}, @empty]}, @lsrr={0x83, 0xb, 0x0, [@multicast2, @empty]}, @end, @lsrr={0x83, 0xf, 0x96, [@loopback, @multicast2, @multicast2]}, @rr={0x7, 0x7, 0x0, [@multicast2]}, @timestamp={0x44, 0x38, 0x2, 0x1, 0x7, [{[@empty], 0x2}, {[@local={0xac, 0x14, 0x0}], 0x1f}, {[@multicast1]}, {[], 0x7}, {[], 0x3ff}, {[], 0x3b6}, {[@loopback], 0xfffffbaf}, {[@loopback], 0x400}]}]}}, @tcp={{0x0, 0x1, r3, 0x41424344, 0x0, 0x0, 0x10, 0x8, 0x8001, 0x0, 0x6, {[@eol, @mss={0x2, 0x4, 0xf13}, @sack={0x5, 0x26, [0x3f, 0x6, 0x8, 0x6, 0x8, 0x8, 0x20, 0x8001, 0xfffffff7]}]}}, {"b98eed1bfb3a0d46c541a8521fa4b5204051e21cdf38cb7077db0f2716039ba5c24569c23b4e18e60152f08a56a0b813624230b57b8c73001a7c09ee6b29ab9ca31248ef28d1de0bdc63247483e051e8c72811f9b42122dce1b13657a99a08d79564f00961f546b59c7c01946e8cd5fe4805c87dbb5ccafbfde18a4b99d30697cac445428a4a0fd5b46b187199c34a93b2bd706b470cf0c69df60a28dc68bc426008965b0dfd74a4aa29b6b79918ecc678419ac3ff8f7e2545b5e208b72951d814f693693b7b0e40523664f396347631f0f198a0ead9b8a93cae36e74909180a2370fe72fede65b747ad92b54671a125f1"}}}}}}) syz_execute_func(&(0x7f0000000240)="c4c1ed14a559ab32ebd0d53664666766660f38f66b0fc4c261beedc4e201baef0f18d1c4e201a8a8e1400000c4e169e5b14d41b9a0dee90f38ca23") syz_extract_tcp_res(&(0x7f0000000280), 0x4df9f115, 0x2) csource_test.go:123: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i; for (i = 0; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { pthread_mutex_t mu; pthread_cond_t cv; int state; } event_t; static void event_init(event_t* ev) { if (pthread_mutex_init(&ev->mu, 0)) exit(1); if (pthread_cond_init(&ev->cv, 0)) exit(1); ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { pthread_mutex_lock(&ev->mu); if (ev->state) exit(1); ev->state = 1; pthread_mutex_unlock(&ev->mu); pthread_cond_broadcast(&ev->cv); } static void event_wait(event_t* ev) { pthread_mutex_lock(&ev->mu); while (!ev->state) pthread_cond_wait(&ev->cv, &ev->mu); pthread_mutex_unlock(&ev->mu); } static int event_isset(event_t* ev) { pthread_mutex_lock(&ev->mu); int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; pthread_mutex_lock(&ev->mu); for (;;) { if (ev->state) break; uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); now = current_time_ms(); if (now - start > timeout) break; } int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } #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; for (i = 0; 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) { volatile long p[8] = {0}; (void)p; ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 14; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); event_timedwait(&th->done, 45); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); #define WAIT_FLAGS 0 static void loop(void) { int iter; for (iter = 0;; iter++) { int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5 * 1000) continue; kill_and_wait(pid, &status); break; } } } uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x41424344}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: memcpy((void*)0x10000000, "./file0\000", 8); syscall(SYS_truncate, 0x10000000, 0); break; case 1: syscall(SYS_socket, 2, 4, 0x81); break; case 2: res = syscall(SYS_freebsd10_pipe, 0x10000040); if (res != -1) r[0] = *(uint32_t*)0x10000044; break; case 3: memcpy((void*)0x10000080, "./file0\000", 8); syscall(SYS_freebsd11_mknodat, (intptr_t)r[0], 0x10000080, 0x40, 4); break; case 4: memcpy((void*)0x100000c0, "./file0\000", 8); syscall(SYS_chflags, 0x100000c0, 0x110212); break; case 5: memcpy((void*)0x10000100, "./file0\000", 8); memcpy((void*)0x10000140, "./file0\000", 8); syscall(SYS_shm_rename, 0x10000100, 0x10000140, 6); break; case 6: res = syscall(SYS_dup2, -1, 0xffffff9c); if (res != -1) r[1] = res; break; case 7: memcpy((void*)0x10000180, "\x9d\x61\x63\x24\x59\xf0\x11\x10\x8a\xca\x18\x1d\xa4\xcc\x83\x72\xb7\x8d\xcd\xa5", 20); syscall(SYS_ioctl, (intptr_t)r[1], 0xc4704437, 0x10000180); break; case 8: res = syscall(SYS_freebsd10_pipe, 0x100001c0); if (res != -1) r[2] = *(uint32_t*)0x100001c0; break; case 9: memcpy((void*)0x10000280, "\x35\xc4\xdf\x51\x5e\xd9\xa9\xee\xb6\x9a\x52\x63\x5d\x8f\xb8\xb6\x51\xcf\x39\x59\xfa\x23\x35\x03\x47\x4d\x88\x01\x70\xac\x5a\x6e\xff\x89\x83\xb1\xab\xf3\x3d\x2a\x2b\x68\xb4\x8a\xc3\xe0\x4d\x9f\x15\x76\x97\x6e\x9a\x20\x9e\xa4\xeb\x9d\xf0\x49\x2c\xb6\x0f\xff\x25\xf7\x05\xb2\x25\xe6\x05\x41\x43\x07\x74\x02\x4e\xd9\xa7\x79\x56\xcc\x1e\xe1\xaa\x49\x85\x28\x56\xdd\xe7\x98\xff\xf5\x7c\xf8\x5b\x44\xf6\x11\xe4\xf6\xa2\xf9\xb1\xc9\x17\x49\x57\x16\x4e\x7e\x83\xb5\xfc\x15\x2f\xe9\xee\xfb\x92\x91\xfc\xb5\xbb\x6d\xcc\x4f\x34\xbb\x92\x53\xbf\xdf\xb6\x85\xe0\xce\x6f\xd9\xf9\x91\x23\x21\xe7\xc9\x6a\xfa\x1e\x73\xb2\xc8\x49\xce\xf7\x30\xdb\xc0\xdc\xb0\xd1\xaa\x86\xb8\x10\xf5\x86\x58\xd4\x5c\xb3\x84\x71\x9b\x50\x17\xa8\xb4\x4b\x55\xd6\x21\xa3\x97\xf5\x39\x19\x03\x92\xa7\xfc\xc5\xa5\x45\xc7\xc9\x75\x9c\xd3\xbe\x71\x1e\xc9\x1a\xa7\xc1\xf0\x59\x03\x21\xd8\x39\x50\x0e\x0a\x00\x6b\x8f\xf5\xe7\xfa\xe1\x9d\x3f\xd8\x81\xb5\x2e\x0d\xcb\x79\xb9\x29\x36\xe6\x0c\xe9\xa7\x14\x63\x1a\x5a\x0f\x7c\x12\x2a\xe5\x3b\x27\xaf\xa9\x0f\xfd\xef\xfa\x18\x50\xc6\xb3\xbd\x71\x15\x55\x05\x3e\x45\x96\x27\xc8\x0b\x68\x1c\x3c\x8b\x88\x16\xc0\x91\x3e\x77\x2b\x05\xa8\x0f\xf7\x55\x6c\x80\xe8\x60\xe2\x46\x3d\xb4\xd5\xae\x7d\xd1\x1a\xf5\xa1\x5c\x83\xa6\x5c\xf7\x79\x5c\x97\x5d\x8b\x82\x7e\x5b\x62\xd0\x2a\xd5\x55\x72\x62\x3a\x90\xbf\x8a\xd0\xe8\xce\x52\xd6\xd0\x99\x42\x7a\x4a\xbf\xe8\x41\x98\xb6\x4d\xc2\x62\x31\xc8\x47\xd0\x38\x30\x2b\x7f\xe5\x58\xaa\xc4\xf2\xa7\xe9\x27\x4c\x8a\x9c\x3b\xe2\x63\xe2\x56\x5d\x82\x5f\x37\x9d\x55\xa3\x5b\xf4\x1d\x89\xe8\xc3\xfe\x9f\xf7\x64\x29\xe1\xda\xd1\xd7\xc2\x84\x41\x2b\xd3\x61\x44\xe5\x56\x26\xf1\x35\xfb\xe6\x58\x58\xa2\xc9\xd1\x32\x6f\x57\xb0\x4e\xab\x13\x01\xa0\x8b\xd6\xd6\x08\xb8\x94\xe7\x16\xfb\xc4\xcb\xb8\x9a\x8d\x96\xaf\xa8\xed\x32\x69\x70\xad\x2d\xcd\x74\x6a\x44\x58\x37\x15\x6b\x87\x98\x3e\xbc\x5f\xe5\x55\x40\xee\x34\x35\xa2\x00\x62\x29\x1f\xd8\x27\x52\x5f\xb5\xfd\xea\x7a\x33\x08\x0a\xcd\x05\x24\xab\x2d\x6b\xf8\x1f\xb7\x53\xbd\xbc\x76\x62\x69\x5c\x87\x8d\x22\xe4\xcc\x37\x76\xa1\x5e\x64\x75\x0c\xf4\x65\x4e\x25\x60\x9b\x0d\x6b\xbf\x0e\x36\x7d\xf5\x0f\x14\x3e\x7a\xda\x51\x21\xad\x9e\xdc\x7d\xa9\x68\x6b\xb8\x64\xd2\x78\x6a\x68\x4d\x2a\x84\xe2\xb0\x27\xa2\x60\x84\xc6\xd5\xf5\xaf\xd8\x9b\xd2\x5e\x1c\x6d\xad\x06\x74\xbd\x0f\x2b\x34\xda\x34\xc6\xf4\xd5\x4e\x80\xc9\xa4\x46\x75\xb5\xfa\xe4\x0a\x80\x50\x6a\x6d\xa8\xe7\x56\x9b\x9b\xff\x2f\x53\x9d\x8d\xe3\x40\x08\x7c\x58\x85\xbf\x05\x2d\x38\x61\xcc\xc4\xca\x85\xc3\x80\x83\xc7\x93\xf7\x8f\xf7\xb0\x18\xcb\x1b\xab\x2e\xc7\xe9\xe1\xd1\xb5\x92\x03\xbf\x15\xdd\xec\x6e\x99\x13\x9e\xac\x8f\xbd\x50\x55\xe6\x06\x11\xe3\x91\x93\xcd\x87\x5c\xd2\x13\xab\xa3\x4b\x3e\x0d\xdb\xc0\x50\x74\xf1\x75\x67\x70\xde\x1c\x1c\x8e\xfb\xf4\x55\x4b\xe8\x3b\xae\x0b\x3f\x5e\xe3\x0c\xd9\xa7\x71\xa6\x89\xf5\x24\x69\xce\xbf\x6c\x80\x1f\x8d\xe0\xea\xc5\xfe\x93\xc3\xc1\x35\x93\xe9\xda\xa5\xba\xd1\x28\x0b\x69\x5e\xf7\xe5\xbd\xc1\x5b\xa6\xb6\x99\x21\x83\xae\x6d\xa6\x4d\xe1\xe8\xd1\xea\xe9\xf1\x10\xcd\xb2\x5e\xdb\x6a\x7b\x12\x3f\x6c\x83\xcb\x48\xa3\xe1\x04\x5f\x28\x45\x93\xf7\xd6\xf2\x3e\x2a\x06\x85\x06\x44\x5a\x99\x38\x48\x6a\xd3\xb6\x76\xbe\x2f\xb1\x54\xeb\xcd\xe1\x51\x19\xd2\x96\xfc\xeb\x24\x13\x74\x5a\x8c\x54\x17\xb2\xac\x34\xb4\xf3\x55\xb3\x54\x9a\xa2\x23\xef\x2f\x34\x2e\x00\xa6\x37\xdb\x86\x16\x44\x2c\xa3\xa1\x80\xa5\x82\x5d\xff\x26\x03\xba\xd9\x06\x62\x54\x04\x67\x8f\xa3\xb3\x95\x91\xe1\x62\xe7\xff\x40\xad\xfe\x85\x66\xd6\x8e\xed\x8a\x19\x15\x3f\x19\xfc\x62\x94\x52\xe3\x0f\x06\x45\xaa\xfc\x1f\x4e\xb5\xde\xa9\xf3\xc6\xed\x6d\xdb\xc4\x44\x73\xcf\x89\x95\xd0\x33\xa2\xff\x0c\x0c\xdd\x53\x88\xce\x6e\xdb\x1e\x73\x2a\xa3\x83\x34\x6a\xca\x32\x97\xd8\x41\x74\xea\x8c\x6a\x3f\xb4\x08\x3f\x09\x12\x63\xac\x4c\x60\x62\xa8\x40\x1d\x16\x4b\xe2\xbf\xa2\x3e\x81\xf9\xbd\xa1\x48\x6c\x7f\xda\x45\xda\x44\xba\x46\xaf\xb5\x5f\x09\x46\xb4\x3e\x8d\x80\xf1\xfc\xce\xa2\x90\xac\x53\xaa\xdf\xa2\xd1\x09\xdb\x7d\x14\x93\xb1\x14\x69\x47\xd9\x6b\x87\x01\xe1\xf6\xa6\x18\x92\x16\x49\x12\x43\x0f\x75\x83\xff\x87\xe7\xdf\xa8\xbc\x61\x52\x0b\xdf\x7a\xfb\x54\x85\x30\x2a\x8e\x0d\xbc\x33\x2f\xce\x47\x36\xbe\xe8\x59\xc1\xc3\xd4\xb5\x08\x3e\xb5\x3a\xa0\x53\x2f\xb0\x72\x29\xe6", 1024); memcpy((void*)0x10000680, "\xfb\xf6\xbf\xee\x9c\x01\x09\x26\x52\xd2\xd6\x00\x83\x5f\x64\xf0\x98\x21\x02\x18\x9a\x56\xbb\x5d\x2a\xcd\x11\x57\xab\xac\xb3\x17", 32); *(uint32_t*)0x100006a0 = 0x100; *(uint8_t*)0x100006a4 = 1; *(uint32_t*)0x100006a8 = 0x10000200; memcpy((void*)0x10000200, "\x4b\x41\x8f\xea\x2c\xea\x20\x6a\xe3\x91\xe4\x4a\x50\x4f\xce\xeb\x9d\xa1\x14\x53\xe3\xc0\x30\x3b\x6f\xbf\xdc\x92\x8a\x74\x70\xeb\x0c\x32\x40\xc7\x5c\x0c\x35\x13\x4c\xaa\xc7\x71\x9b\x58\x49\x27\x4b\xbc\x0f\x0b\x76\xd2\xcd\xbd\x61\x27\xf3\x48\xd9\x9c\xf7\x1d\x49\x62\x57\x99\x66\xd7\x43\x12\x6e\xf7\xb1\x39\xbc\x72\x93\x27\xc6\xe2\x01\x8d\x2c\x24\xa1\xcd\xf8\x8b\x21\x31\x17\x40\x44\x95\xff\x0c\xcb\x9e\x35\x49\x39\x0c\x33\xe4\xfa\x7e\xf5\x04\xf7\x6d\x2c\x9d\xca\xd0\x50\x27\x73\xb1\xe6\xe2\xee", 123); *(uint64_t*)0x100006ac = 0xffffffff; *(uint64_t*)0x100006b4 = 7; *(uint64_t*)0x100006bc = 0x20; *(uint64_t*)0x100006c4 = 0x200; *(uint64_t*)0x100006cc = 0; *(uint64_t*)0x100006d4 = 7; *(uint64_t*)0x100006dc = 0x887f; *(uint32_t*)0x100006e4 = 0x7ff; syscall(SYS_ioctl, (intptr_t)r[2], 0xc4504449, 0x10000280); break; case 10: if (res != -1) r[3] = *(uint32_t*)0x10000004; break; case 11: *(uint8_t*)0x10000040 = 0xaa; *(uint8_t*)0x10000041 = 0xaa; *(uint8_t*)0x10000042 = 0xaa; *(uint8_t*)0x10000043 = 0xaa; *(uint8_t*)0x10000044 = 0xaa; *(uint8_t*)0x10000045 = 0xaa; *(uint8_t*)0x10000046 = 0; *(uint8_t*)0x10000047 = 0; *(uint8_t*)0x10000048 = 0; *(uint8_t*)0x10000049 = 0; *(uint8_t*)0x1000004a = 0; *(uint8_t*)0x1000004b = 0; *(uint16_t*)0x1000004c = htobe16(0x800); STORE_BY_BITMASK(uint8_t, , 0x1000004e, 0x24, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x1000004e, 4, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x1000004f, 1, 0, 2); STORE_BY_BITMASK(uint8_t, , 0x1000004f, 7, 2, 6); *(uint16_t*)0x10000050 = htobe16(0x1c1); *(uint16_t*)0x10000052 = htobe16(0x66); *(uint16_t*)0x10000054 = htobe16(0xc7c); *(uint8_t*)0x10000056 = 0x40; *(uint8_t*)0x10000057 = 0x2e; *(uint16_t*)0x10000058 = htobe16(0); *(uint32_t*)0x1000005a = htobe32(0xe0000002); *(uint32_t*)0x1000005e = htobe32(0x7f000001); *(uint8_t*)0x10000062 = 0; *(uint8_t*)0x10000063 = 7; *(uint8_t*)0x10000064 = 0xb; *(uint8_t*)0x10000065 = 9; *(uint32_t*)0x10000066 = htobe32(0xe0000002); *(uint32_t*)0x1000006a = htobe32(0xe0000002); *(uint8_t*)0x1000006e = 0x89; *(uint8_t*)0x1000006f = 7; *(uint8_t*)0x10000070 = 0x7f; *(uint8_t*)0x10000071 = 0xac; *(uint8_t*)0x10000072 = 0x14; *(uint8_t*)0x10000073 = 0; *(uint8_t*)0x10000074 = 0xaa; *(uint8_t*)0x10000075 = 1; *(uint8_t*)0x10000076 = 7; *(uint8_t*)0x10000077 = 0xb; *(uint8_t*)0x10000078 = 0x1f; *(uint8_t*)0x10000079 = 0xac; *(uint8_t*)0x1000007a = 0x14; *(uint8_t*)0x1000007b = 0; *(uint8_t*)0x1000007c = 0xaa; *(uint32_t*)0x1000007d = htobe32(0); *(uint8_t*)0x10000081 = 0x83; *(uint8_t*)0x10000082 = 0xb; *(uint8_t*)0x10000083 = 0; *(uint32_t*)0x10000084 = htobe32(0xe0000002); *(uint32_t*)0x10000088 = htobe32(0); *(uint8_t*)0x1000008c = 0; *(uint8_t*)0x1000008d = 0x83; *(uint8_t*)0x1000008e = 0xf; *(uint8_t*)0x1000008f = 0x96; *(uint32_t*)0x10000090 = htobe32(0x7f000001); *(uint32_t*)0x10000094 = htobe32(0xe0000002); *(uint32_t*)0x10000098 = htobe32(0xe0000002); *(uint8_t*)0x1000009c = 7; *(uint8_t*)0x1000009d = 7; *(uint8_t*)0x1000009e = 0; *(uint32_t*)0x1000009f = htobe32(0xe0000002); *(uint8_t*)0x100000a3 = 0x44; *(uint8_t*)0x100000a4 = 0x38; *(uint8_t*)0x100000a5 = 2; STORE_BY_BITMASK(uint8_t, , 0x100000a6, 1, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x100000a6, 7, 4, 4); *(uint32_t*)0x100000a7 = htobe32(0); *(uint32_t*)0x100000ab = htobe32(2); *(uint8_t*)0x100000af = 0xac; *(uint8_t*)0x100000b0 = 0x14; *(uint8_t*)0x100000b1 = 0; *(uint8_t*)0x100000b2 = 0xaa; *(uint32_t*)0x100000b3 = htobe32(0x1f); *(uint32_t*)0x100000b7 = htobe32(0xe0000001); *(uint32_t*)0x100000bb = htobe32(0); *(uint32_t*)0x100000bf = htobe32(7); *(uint32_t*)0x100000c3 = htobe32(0x3ff); *(uint32_t*)0x100000c7 = htobe32(0x3b6); *(uint32_t*)0x100000cb = htobe32(0x7f000001); *(uint32_t*)0x100000cf = htobe32(0xfffffbaf); *(uint32_t*)0x100000d3 = htobe32(0x7f000001); *(uint32_t*)0x100000d7 = htobe32(0x400); *(uint16_t*)0x100000de = htobe16(0x4e20); *(uint16_t*)0x100000e0 = htobe16(0x4e21); *(uint32_t*)0x100000e2 = r[3]; *(uint32_t*)0x100000e6 = 0x41424344; STORE_BY_BITMASK(uint8_t, , 0x100000ea, 0, 0, 1); STORE_BY_BITMASK(uint8_t, , 0x100000ea, 0, 1, 3); STORE_BY_BITMASK(uint8_t, , 0x100000ea, 0x10, 4, 4); *(uint8_t*)0x100000eb = 8; *(uint16_t*)0x100000ec = htobe16(0x8001); *(uint16_t*)0x100000ee = htobe16(0); *(uint16_t*)0x100000f0 = htobe16(6); *(uint8_t*)0x100000f2 = 0; *(uint8_t*)0x100000f3 = 2; *(uint8_t*)0x100000f4 = 4; *(uint16_t*)0x100000f5 = htobe16(0xf13); *(uint8_t*)0x100000f7 = 5; *(uint8_t*)0x100000f8 = 0x26; *(uint32_t*)0x100000f9 = htobe32(0x3f); *(uint32_t*)0x100000fd = htobe32(6); *(uint32_t*)0x10000101 = htobe32(8); *(uint32_t*)0x10000105 = htobe32(6); *(uint32_t*)0x10000109 = htobe32(8); *(uint32_t*)0x1000010d = htobe32(8); *(uint32_t*)0x10000111 = htobe32(0x20); *(uint32_t*)0x10000115 = htobe32(0x8001); *(uint32_t*)0x10000119 = htobe32(0xfffffff7); memcpy((void*)0x1000011e, "\xb9\x8e\xed\x1b\xfb\x3a\x0d\x46\xc5\x41\xa8\x52\x1f\xa4\xb5\x20\x40\x51\xe2\x1c\xdf\x38\xcb\x70\x77\xdb\x0f\x27\x16\x03\x9b\xa5\xc2\x45\x69\xc2\x3b\x4e\x18\xe6\x01\x52\xf0\x8a\x56\xa0\xb8\x13\x62\x42\x30\xb5\x7b\x8c\x73\x00\x1a\x7c\x09\xee\x6b\x29\xab\x9c\xa3\x12\x48\xef\x28\xd1\xde\x0b\xdc\x63\x24\x74\x83\xe0\x51\xe8\xc7\x28\x11\xf9\xb4\x21\x22\xdc\xe1\xb1\x36\x57\xa9\x9a\x08\xd7\x95\x64\xf0\x09\x61\xf5\x46\xb5\x9c\x7c\x01\x94\x6e\x8c\xd5\xfe\x48\x05\xc8\x7d\xbb\x5c\xca\xfb\xfd\xe1\x8a\x4b\x99\xd3\x06\x97\xca\xc4\x45\x42\x8a\x4a\x0f\xd5\xb4\x6b\x18\x71\x99\xc3\x4a\x93\xb2\xbd\x70\x6b\x47\x0c\xf0\xc6\x9d\xf6\x0a\x28\xdc\x68\xbc\x42\x60\x08\x96\x5b\x0d\xfd\x74\xa4\xaa\x29\xb6\xb7\x99\x18\xec\xc6\x78\x41\x9a\xc3\xff\x8f\x7e\x25\x45\xb5\xe2\x08\xb7\x29\x51\xd8\x14\xf6\x93\x69\x3b\x7b\x0e\x40\x52\x36\x64\xf3\x96\x34\x76\x31\xf0\xf1\x98\xa0\xea\xd9\xb8\xa9\x3c\xae\x36\xe7\x49\x09\x18\x0a\x23\x70\xfe\x72\xfe\xde\x65\xb7\x47\xad\x92\xb5\x46\x71\xa1\x25\xf1", 241); struct csum_inet csum_1; csum_inet_init(&csum_1); csum_inet_update(&csum_1, (const uint8_t*)0x1000005a, 4); csum_inet_update(&csum_1, (const uint8_t*)0x1000005e, 4); uint16_t csum_1_chunk_2 = 0x600; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_2, 2); uint16_t csum_1_chunk_3 = 0x3101; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_3, 2); csum_inet_update(&csum_1, (const uint8_t*)0x100000de, 305); *(uint16_t*)0x100000ee = csum_inet_digest(&csum_1); struct csum_inet csum_2; csum_inet_init(&csum_2); csum_inet_update(&csum_2, (const uint8_t*)0x1000004e, 144); *(uint16_t*)0x10000058 = csum_inet_digest(&csum_2); break; case 12: memcpy((void*)0x10000240, "\xc4\xc1\xed\x14\xa5\x59\xab\x32\xeb\xd0\xd5\x36\x64\x66\x67\x66\x66\x0f\x38\xf6\x6b\x0f\xc4\xc2\x61\xbe\xed\xc4\xe2\x01\xba\xef\x0f\x18\xd1\xc4\xe2\x01\xa8\xa8\xe1\x40\x00\x00\xc4\xe1\x69\xe5\xb1\x4d\x41\xb9\xa0\xde\xe9\x0f\x38\xca\x23", 59); syz_execute_func(0x10000240); break; case 13: break; } } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); do_sandbox_none(); return 0; } :306:11: error: use of undeclared identifier 'SYS_shm_rename' syscall(SYS_shm_rename, 0x10000100, 0x10000140, 6); ^ 1 error generated. compiler invocation: clang [-o /tmp/syz-executor761169166 -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/3 (1.48s) csource_test.go:122: opts: {Threaded:true Collide:false Repeat:false RepeatTimes:0 Procs:0 Sandbox:none Fault:false FaultCall:0 FaultNth:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false UseTmpDir:true HandleSegv:false Repro:false Trace:false} program: truncate(&(0x7f0000000000)='./file0\x00', 0x0) socket$inet(0x2, 0x4, 0x81) freebsd10_pipe(&(0x7f0000000040)={0xffffffffffffffff, 0xffffffffffffffff}) freebsd11_mknodat(r0, &(0x7f0000000080)='./file0\x00', 0x40, 0x4) chflags(&(0x7f00000000c0)='./file0\x00', 0x110212) shm_rename(&(0x7f0000000100)='./file0\x00', &(0x7f0000000140)='./file0\x00', 0x6) r1 = dup2(0xffffffffffffffff, 0xffffffffffffff9c) ioctl$DIOCCHANGEADDR(r1, 0xc4704437, &(0x7f0000000180)="9d61632459f011108aca181da4cc8372b78dcda5") freebsd10_pipe(&(0x7f00000001c0)={0xffffffffffffffff}) ioctl$DIOCRTSTADDRS(r2, 0xc4504449, &(0x7f0000000280)={{"35c4df515ed9a9eeb69a52635d8fb8b651cf3959fa233503474d880170ac5a6eff8983b1abf33d2a2b68b48ac3e04d9f1576976e9a209ea4eb9df0492cb60fff25f705b225e60541430774024ed9a77956cc1ee1aa49852856dde798fff57cf85b44f611e4f6a2f9b1c9174957164e7e83b5fc152fe9eefb9291fcb5bb6dcc4f34bb9253bfdfb685e0ce6fd9f9912321e7c96afa1e73b2c849cef730dbc0dcb0d1aa86b810f58658d45cb384719b5017a8b44b55d621a397f539190392a7fcc5a545c7c9759cd3be711ec91aa7c1f0590321d839500e0a006b8ff5e7fae19d3fd881b52e0dcb79b92936e60ce9a714631a5a0f7c122ae53b27afa90ffdeffa1850c6b3bd711555053e459627c80b681c3c8b8816c0913e772b05a80ff7556c80e860e2463db4d5ae7dd11af5a15c83a65cf7795c975d8b827e5b62d02ad55572623a90bf8ad0e8ce52d6d099427a4abfe84198b64dc26231c847d038302b7fe558aac4f2a7e9274c8a9c3be263e2565d825f379d55a35bf41d89e8c3fe9ff76429e1dad1d7c284412bd36144e55626f135fbe65858a2c9d1326f57b04eab1301a08bd6d608b894e716fbc4cbb89a8d96afa8ed326970ad2dcd746a445837156b87983ebc5fe55540ee3435a20062291fd827525fb5fdea7a33080acd0524ab2d6bf81fb753bdbc7662695c878d22e4cc3776a15e64750cf4654e25609b0d6bbf0e367df50f143e7ada5121ad9edc7da9686bb864d2786a684d2a84e2b027a26084c6d5f5afd89bd25e1c6dad0674bd0f2b34da34c6f4d54e80c9a44675b5fae40a80506a6da8e7569b9bff2f539d8de340087c5885bf052d3861ccc4ca85c38083c793f78ff7b018cb1bab2ec7e9e1d1b59203bf15ddec6e99139eac8fbd5055e60611e39193cd875cd213aba34b3e0ddbc05074f1756770de1c1c8efbf4554be83bae0b3f5ee30cd9a771a689f52469cebf6c801f8de0eac5fe93c3c13593e9daa5bad1280b695ef7e5bdc15ba6b6992183ae6da64de1e8d1eae9f110cdb25edb6a7b123f6c83cb48a3e1045f284593f7d6f23e2a068506445a9938486ad3b676be2fb154ebcde15119d296fceb2413745a8c5417b2ac34b4f355b3549aa223ef2f342e00a637db8616442ca3a180a5825dff2603bad906625404678fa3b39591e162e7ff40adfe8566d68eed8a19153f19fc629452e30f0645aafc1f4eb5dea9f3c6ed6ddbc44473cf8995d033a2ff0c0cdd5388ce6edb1e732aa383346aca3297d84174ea8c6a3fb4083f091263ac4c6062a8401d164be2bfa23e81f9bda1486c7fda45da44ba46afb55f0946b43e8d80f1fccea290ac53aadfa2d109db7d1493b1146947d96b8701e1f6a61892164912430f7583ff87e7dfa8bc61520bdf7afb5485302a8e0dbc332fce4736bee859c1c3d4b5083eb53aa0532fb07229e6", "fbf6bfee9c01092652d2d600835f64f0982102189a56bb5d2acd1157abacb317", 0x100, 0x1}, &(0x7f0000000200)="4b418fea2cea206ae391e44a504fceeb9da11453e3c0303b6fbfdc928a7470eb0c3240c75c0c35134caac7719b5849274bbc0f0b76d2cdbd6127f348d99cf71d4962579966d743126ef7b139bc729327c6e2018d2c24a1cdf88b213117404495ff0ccb9e3549390c33e4fa7ef504f76d2c9dcad0502773b1e6e2ee", 0xffffffff, 0x7, 0x20, 0x200, 0x0, 0x7, 0x887f, 0x7ff}) syz_extract_tcp_res(&(0x7f0000000000)={0x41424344, 0x41424344}, 0x4, 0x40) syz_emit_ethernet(0x1cf, &(0x7f0000000040)={@local, @empty, [], {@ipv4={0x800, {{0x24, 0x4, 0x1, 0x7, 0x1c1, 0x66, 0xc7c, 0x40, 0x2e, 0x0, @multicast2, @loopback, {[@end, @rr={0x7, 0xb, 0x9, [@multicast2, @multicast2]}, @ssrr={0x89, 0x7, 0x7f, [@local={0xac, 0x14, 0x0}]}, @noop, @rr={0x7, 0xb, 0x1f, [@local={0xac, 0x14, 0x0}, @empty]}, @lsrr={0x83, 0xb, 0x0, [@multicast2, @empty]}, @end, @lsrr={0x83, 0xf, 0x96, [@loopback, @multicast2, @multicast2]}, @rr={0x7, 0x7, 0x0, [@multicast2]}, @timestamp={0x44, 0x38, 0x2, 0x1, 0x7, [{[@empty], 0x2}, {[@local={0xac, 0x14, 0x0}], 0x1f}, {[@multicast1]}, {[], 0x7}, {[], 0x3ff}, {[], 0x3b6}, {[@loopback], 0xfffffbaf}, {[@loopback], 0x400}]}]}}, @tcp={{0x0, 0x1, r3, 0x41424344, 0x0, 0x0, 0x10, 0x8, 0x8001, 0x0, 0x6, {[@eol, @mss={0x2, 0x4, 0xf13}, @sack={0x5, 0x26, [0x3f, 0x6, 0x8, 0x6, 0x8, 0x8, 0x20, 0x8001, 0xfffffff7]}]}}, {"b98eed1bfb3a0d46c541a8521fa4b5204051e21cdf38cb7077db0f2716039ba5c24569c23b4e18e60152f08a56a0b813624230b57b8c73001a7c09ee6b29ab9ca31248ef28d1de0bdc63247483e051e8c72811f9b42122dce1b13657a99a08d79564f00961f546b59c7c01946e8cd5fe4805c87dbb5ccafbfde18a4b99d30697cac445428a4a0fd5b46b187199c34a93b2bd706b470cf0c69df60a28dc68bc426008965b0dfd74a4aa29b6b79918ecc678419ac3ff8f7e2545b5e208b72951d814f693693b7b0e40523664f396347631f0f198a0ead9b8a93cae36e74909180a2370fe72fede65b747ad92b54671a125f1"}}}}}}) syz_execute_func(&(0x7f0000000240)="c4c1ed14a559ab32ebd0d53664666766660f38f66b0fc4c261beedc4e201baef0f18d1c4e201a8a8e1400000c4e169e5b14d41b9a0dee90f38ca23") syz_extract_tcp_res(&(0x7f0000000280), 0x4df9f115, 0x2) csource_test.go:123: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include 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 thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i; for (i = 0; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { pthread_mutex_t mu; pthread_cond_t cv; int state; } event_t; static void event_init(event_t* ev) { if (pthread_mutex_init(&ev->mu, 0)) exit(1); if (pthread_cond_init(&ev->cv, 0)) exit(1); ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { pthread_mutex_lock(&ev->mu); if (ev->state) exit(1); ev->state = 1; pthread_mutex_unlock(&ev->mu); pthread_cond_broadcast(&ev->cv); } static void event_wait(event_t* ev) { pthread_mutex_lock(&ev->mu); while (!ev->state) pthread_cond_wait(&ev->cv, &ev->mu); pthread_mutex_unlock(&ev->mu); } static int event_isset(event_t* ev) { pthread_mutex_lock(&ev->mu); int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; pthread_mutex_lock(&ev->mu); for (;;) { if (ev->state) break; uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); now = current_time_ms(); if (now - start > timeout) break; } int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } #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; for (i = 0; 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) { volatile long p[8] = {0}; (void)p; ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void loop(void) { int i, call, thread; for (call = 0; call < 14; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); event_timedwait(&th->done, 45); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x41424344}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: memcpy((void*)0x10000000, "./file0\000", 8); syscall(SYS_truncate, 0x10000000, 0); break; case 1: syscall(SYS_socket, 2, 4, 0x81); break; case 2: res = syscall(SYS_freebsd10_pipe, 0x10000040); if (res != -1) r[0] = *(uint32_t*)0x10000044; break; case 3: memcpy((void*)0x10000080, "./file0\000", 8); syscall(SYS_freebsd11_mknodat, (intptr_t)r[0], 0x10000080, 0x40, 4); break; case 4: memcpy((void*)0x100000c0, "./file0\000", 8); syscall(SYS_chflags, 0x100000c0, 0x110212); break; case 5: memcpy((void*)0x10000100, "./file0\000", 8); memcpy((void*)0x10000140, "./file0\000", 8); syscall(SYS_shm_rename, 0x10000100, 0x10000140, 6); break; case 6: res = syscall(SYS_dup2, -1, 0xffffff9c); if (res != -1) r[1] = res; break; case 7: memcpy((void*)0x10000180, "\x9d\x61\x63\x24\x59\xf0\x11\x10\x8a\xca\x18\x1d\xa4\xcc\x83\x72\xb7\x8d\xcd\xa5", 20); syscall(SYS_ioctl, (intptr_t)r[1], 0xc4704437, 0x10000180); break; case 8: res = syscall(SYS_freebsd10_pipe, 0x100001c0); if (res != -1) r[2] = *(uint32_t*)0x100001c0; break; case 9: memcpy((void*)0x10000280, "\x35\xc4\xdf\x51\x5e\xd9\xa9\xee\xb6\x9a\x52\x63\x5d\x8f\xb8\xb6\x51\xcf\x39\x59\xfa\x23\x35\x03\x47\x4d\x88\x01\x70\xac\x5a\x6e\xff\x89\x83\xb1\xab\xf3\x3d\x2a\x2b\x68\xb4\x8a\xc3\xe0\x4d\x9f\x15\x76\x97\x6e\x9a\x20\x9e\xa4\xeb\x9d\xf0\x49\x2c\xb6\x0f\xff\x25\xf7\x05\xb2\x25\xe6\x05\x41\x43\x07\x74\x02\x4e\xd9\xa7\x79\x56\xcc\x1e\xe1\xaa\x49\x85\x28\x56\xdd\xe7\x98\xff\xf5\x7c\xf8\x5b\x44\xf6\x11\xe4\xf6\xa2\xf9\xb1\xc9\x17\x49\x57\x16\x4e\x7e\x83\xb5\xfc\x15\x2f\xe9\xee\xfb\x92\x91\xfc\xb5\xbb\x6d\xcc\x4f\x34\xbb\x92\x53\xbf\xdf\xb6\x85\xe0\xce\x6f\xd9\xf9\x91\x23\x21\xe7\xc9\x6a\xfa\x1e\x73\xb2\xc8\x49\xce\xf7\x30\xdb\xc0\xdc\xb0\xd1\xaa\x86\xb8\x10\xf5\x86\x58\xd4\x5c\xb3\x84\x71\x9b\x50\x17\xa8\xb4\x4b\x55\xd6\x21\xa3\x97\xf5\x39\x19\x03\x92\xa7\xfc\xc5\xa5\x45\xc7\xc9\x75\x9c\xd3\xbe\x71\x1e\xc9\x1a\xa7\xc1\xf0\x59\x03\x21\xd8\x39\x50\x0e\x0a\x00\x6b\x8f\xf5\xe7\xfa\xe1\x9d\x3f\xd8\x81\xb5\x2e\x0d\xcb\x79\xb9\x29\x36\xe6\x0c\xe9\xa7\x14\x63\x1a\x5a\x0f\x7c\x12\x2a\xe5\x3b\x27\xaf\xa9\x0f\xfd\xef\xfa\x18\x50\xc6\xb3\xbd\x71\x15\x55\x05\x3e\x45\x96\x27\xc8\x0b\x68\x1c\x3c\x8b\x88\x16\xc0\x91\x3e\x77\x2b\x05\xa8\x0f\xf7\x55\x6c\x80\xe8\x60\xe2\x46\x3d\xb4\xd5\xae\x7d\xd1\x1a\xf5\xa1\x5c\x83\xa6\x5c\xf7\x79\x5c\x97\x5d\x8b\x82\x7e\x5b\x62\xd0\x2a\xd5\x55\x72\x62\x3a\x90\xbf\x8a\xd0\xe8\xce\x52\xd6\xd0\x99\x42\x7a\x4a\xbf\xe8\x41\x98\xb6\x4d\xc2\x62\x31\xc8\x47\xd0\x38\x30\x2b\x7f\xe5\x58\xaa\xc4\xf2\xa7\xe9\x27\x4c\x8a\x9c\x3b\xe2\x63\xe2\x56\x5d\x82\x5f\x37\x9d\x55\xa3\x5b\xf4\x1d\x89\xe8\xc3\xfe\x9f\xf7\x64\x29\xe1\xda\xd1\xd7\xc2\x84\x41\x2b\xd3\x61\x44\xe5\x56\x26\xf1\x35\xfb\xe6\x58\x58\xa2\xc9\xd1\x32\x6f\x57\xb0\x4e\xab\x13\x01\xa0\x8b\xd6\xd6\x08\xb8\x94\xe7\x16\xfb\xc4\xcb\xb8\x9a\x8d\x96\xaf\xa8\xed\x32\x69\x70\xad\x2d\xcd\x74\x6a\x44\x58\x37\x15\x6b\x87\x98\x3e\xbc\x5f\xe5\x55\x40\xee\x34\x35\xa2\x00\x62\x29\x1f\xd8\x27\x52\x5f\xb5\xfd\xea\x7a\x33\x08\x0a\xcd\x05\x24\xab\x2d\x6b\xf8\x1f\xb7\x53\xbd\xbc\x76\x62\x69\x5c\x87\x8d\x22\xe4\xcc\x37\x76\xa1\x5e\x64\x75\x0c\xf4\x65\x4e\x25\x60\x9b\x0d\x6b\xbf\x0e\x36\x7d\xf5\x0f\x14\x3e\x7a\xda\x51\x21\xad\x9e\xdc\x7d\xa9\x68\x6b\xb8\x64\xd2\x78\x6a\x68\x4d\x2a\x84\xe2\xb0\x27\xa2\x60\x84\xc6\xd5\xf5\xaf\xd8\x9b\xd2\x5e\x1c\x6d\xad\x06\x74\xbd\x0f\x2b\x34\xda\x34\xc6\xf4\xd5\x4e\x80\xc9\xa4\x46\x75\xb5\xfa\xe4\x0a\x80\x50\x6a\x6d\xa8\xe7\x56\x9b\x9b\xff\x2f\x53\x9d\x8d\xe3\x40\x08\x7c\x58\x85\xbf\x05\x2d\x38\x61\xcc\xc4\xca\x85\xc3\x80\x83\xc7\x93\xf7\x8f\xf7\xb0\x18\xcb\x1b\xab\x2e\xc7\xe9\xe1\xd1\xb5\x92\x03\xbf\x15\xdd\xec\x6e\x99\x13\x9e\xac\x8f\xbd\x50\x55\xe6\x06\x11\xe3\x91\x93\xcd\x87\x5c\xd2\x13\xab\xa3\x4b\x3e\x0d\xdb\xc0\x50\x74\xf1\x75\x67\x70\xde\x1c\x1c\x8e\xfb\xf4\x55\x4b\xe8\x3b\xae\x0b\x3f\x5e\xe3\x0c\xd9\xa7\x71\xa6\x89\xf5\x24\x69\xce\xbf\x6c\x80\x1f\x8d\xe0\xea\xc5\xfe\x93\xc3\xc1\x35\x93\xe9\xda\xa5\xba\xd1\x28\x0b\x69\x5e\xf7\xe5\xbd\xc1\x5b\xa6\xb6\x99\x21\x83\xae\x6d\xa6\x4d\xe1\xe8\xd1\xea\xe9\xf1\x10\xcd\xb2\x5e\xdb\x6a\x7b\x12\x3f\x6c\x83\xcb\x48\xa3\xe1\x04\x5f\x28\x45\x93\xf7\xd6\xf2\x3e\x2a\x06\x85\x06\x44\x5a\x99\x38\x48\x6a\xd3\xb6\x76\xbe\x2f\xb1\x54\xeb\xcd\xe1\x51\x19\xd2\x96\xfc\xeb\x24\x13\x74\x5a\x8c\x54\x17\xb2\xac\x34\xb4\xf3\x55\xb3\x54\x9a\xa2\x23\xef\x2f\x34\x2e\x00\xa6\x37\xdb\x86\x16\x44\x2c\xa3\xa1\x80\xa5\x82\x5d\xff\x26\x03\xba\xd9\x06\x62\x54\x04\x67\x8f\xa3\xb3\x95\x91\xe1\x62\xe7\xff\x40\xad\xfe\x85\x66\xd6\x8e\xed\x8a\x19\x15\x3f\x19\xfc\x62\x94\x52\xe3\x0f\x06\x45\xaa\xfc\x1f\x4e\xb5\xde\xa9\xf3\xc6\xed\x6d\xdb\xc4\x44\x73\xcf\x89\x95\xd0\x33\xa2\xff\x0c\x0c\xdd\x53\x88\xce\x6e\xdb\x1e\x73\x2a\xa3\x83\x34\x6a\xca\x32\x97\xd8\x41\x74\xea\x8c\x6a\x3f\xb4\x08\x3f\x09\x12\x63\xac\x4c\x60\x62\xa8\x40\x1d\x16\x4b\xe2\xbf\xa2\x3e\x81\xf9\xbd\xa1\x48\x6c\x7f\xda\x45\xda\x44\xba\x46\xaf\xb5\x5f\x09\x46\xb4\x3e\x8d\x80\xf1\xfc\xce\xa2\x90\xac\x53\xaa\xdf\xa2\xd1\x09\xdb\x7d\x14\x93\xb1\x14\x69\x47\xd9\x6b\x87\x01\xe1\xf6\xa6\x18\x92\x16\x49\x12\x43\x0f\x75\x83\xff\x87\xe7\xdf\xa8\xbc\x61\x52\x0b\xdf\x7a\xfb\x54\x85\x30\x2a\x8e\x0d\xbc\x33\x2f\xce\x47\x36\xbe\xe8\x59\xc1\xc3\xd4\xb5\x08\x3e\xb5\x3a\xa0\x53\x2f\xb0\x72\x29\xe6", 1024); memcpy((void*)0x10000680, "\xfb\xf6\xbf\xee\x9c\x01\x09\x26\x52\xd2\xd6\x00\x83\x5f\x64\xf0\x98\x21\x02\x18\x9a\x56\xbb\x5d\x2a\xcd\x11\x57\xab\xac\xb3\x17", 32); *(uint32_t*)0x100006a0 = 0x100; *(uint8_t*)0x100006a4 = 1; *(uint32_t*)0x100006a8 = 0x10000200; memcpy((void*)0x10000200, "\x4b\x41\x8f\xea\x2c\xea\x20\x6a\xe3\x91\xe4\x4a\x50\x4f\xce\xeb\x9d\xa1\x14\x53\xe3\xc0\x30\x3b\x6f\xbf\xdc\x92\x8a\x74\x70\xeb\x0c\x32\x40\xc7\x5c\x0c\x35\x13\x4c\xaa\xc7\x71\x9b\x58\x49\x27\x4b\xbc\x0f\x0b\x76\xd2\xcd\xbd\x61\x27\xf3\x48\xd9\x9c\xf7\x1d\x49\x62\x57\x99\x66\xd7\x43\x12\x6e\xf7\xb1\x39\xbc\x72\x93\x27\xc6\xe2\x01\x8d\x2c\x24\xa1\xcd\xf8\x8b\x21\x31\x17\x40\x44\x95\xff\x0c\xcb\x9e\x35\x49\x39\x0c\x33\xe4\xfa\x7e\xf5\x04\xf7\x6d\x2c\x9d\xca\xd0\x50\x27\x73\xb1\xe6\xe2\xee", 123); *(uint64_t*)0x100006ac = 0xffffffff; *(uint64_t*)0x100006b4 = 7; *(uint64_t*)0x100006bc = 0x20; *(uint64_t*)0x100006c4 = 0x200; *(uint64_t*)0x100006cc = 0; *(uint64_t*)0x100006d4 = 7; *(uint64_t*)0x100006dc = 0x887f; *(uint32_t*)0x100006e4 = 0x7ff; syscall(SYS_ioctl, (intptr_t)r[2], 0xc4504449, 0x10000280); break; case 10: if (res != -1) r[3] = *(uint32_t*)0x10000004; break; case 11: *(uint8_t*)0x10000040 = 0xaa; *(uint8_t*)0x10000041 = 0xaa; *(uint8_t*)0x10000042 = 0xaa; *(uint8_t*)0x10000043 = 0xaa; *(uint8_t*)0x10000044 = 0xaa; *(uint8_t*)0x10000045 = 0xaa; *(uint8_t*)0x10000046 = 0; *(uint8_t*)0x10000047 = 0; *(uint8_t*)0x10000048 = 0; *(uint8_t*)0x10000049 = 0; *(uint8_t*)0x1000004a = 0; *(uint8_t*)0x1000004b = 0; *(uint16_t*)0x1000004c = htobe16(0x800); STORE_BY_BITMASK(uint8_t, , 0x1000004e, 0x24, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x1000004e, 4, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x1000004f, 1, 0, 2); STORE_BY_BITMASK(uint8_t, , 0x1000004f, 7, 2, 6); *(uint16_t*)0x10000050 = htobe16(0x1c1); *(uint16_t*)0x10000052 = htobe16(0x66); *(uint16_t*)0x10000054 = htobe16(0xc7c); *(uint8_t*)0x10000056 = 0x40; *(uint8_t*)0x10000057 = 0x2e; *(uint16_t*)0x10000058 = htobe16(0); *(uint32_t*)0x1000005a = htobe32(0xe0000002); *(uint32_t*)0x1000005e = htobe32(0x7f000001); *(uint8_t*)0x10000062 = 0; *(uint8_t*)0x10000063 = 7; *(uint8_t*)0x10000064 = 0xb; *(uint8_t*)0x10000065 = 9; *(uint32_t*)0x10000066 = htobe32(0xe0000002); *(uint32_t*)0x1000006a = htobe32(0xe0000002); *(uint8_t*)0x1000006e = 0x89; *(uint8_t*)0x1000006f = 7; *(uint8_t*)0x10000070 = 0x7f; *(uint8_t*)0x10000071 = 0xac; *(uint8_t*)0x10000072 = 0x14; *(uint8_t*)0x10000073 = 0; *(uint8_t*)0x10000074 = 0xaa; *(uint8_t*)0x10000075 = 1; *(uint8_t*)0x10000076 = 7; *(uint8_t*)0x10000077 = 0xb; *(uint8_t*)0x10000078 = 0x1f; *(uint8_t*)0x10000079 = 0xac; *(uint8_t*)0x1000007a = 0x14; *(uint8_t*)0x1000007b = 0; *(uint8_t*)0x1000007c = 0xaa; *(uint32_t*)0x1000007d = htobe32(0); *(uint8_t*)0x10000081 = 0x83; *(uint8_t*)0x10000082 = 0xb; *(uint8_t*)0x10000083 = 0; *(uint32_t*)0x10000084 = htobe32(0xe0000002); *(uint32_t*)0x10000088 = htobe32(0); *(uint8_t*)0x1000008c = 0; *(uint8_t*)0x1000008d = 0x83; *(uint8_t*)0x1000008e = 0xf; *(uint8_t*)0x1000008f = 0x96; *(uint32_t*)0x10000090 = htobe32(0x7f000001); *(uint32_t*)0x10000094 = htobe32(0xe0000002); *(uint32_t*)0x10000098 = htobe32(0xe0000002); *(uint8_t*)0x1000009c = 7; *(uint8_t*)0x1000009d = 7; *(uint8_t*)0x1000009e = 0; *(uint32_t*)0x1000009f = htobe32(0xe0000002); *(uint8_t*)0x100000a3 = 0x44; *(uint8_t*)0x100000a4 = 0x38; *(uint8_t*)0x100000a5 = 2; STORE_BY_BITMASK(uint8_t, , 0x100000a6, 1, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x100000a6, 7, 4, 4); *(uint32_t*)0x100000a7 = htobe32(0); *(uint32_t*)0x100000ab = htobe32(2); *(uint8_t*)0x100000af = 0xac; *(uint8_t*)0x100000b0 = 0x14; *(uint8_t*)0x100000b1 = 0; *(uint8_t*)0x100000b2 = 0xaa; *(uint32_t*)0x100000b3 = htobe32(0x1f); *(uint32_t*)0x100000b7 = htobe32(0xe0000001); *(uint32_t*)0x100000bb = htobe32(0); *(uint32_t*)0x100000bf = htobe32(7); *(uint32_t*)0x100000c3 = htobe32(0x3ff); *(uint32_t*)0x100000c7 = htobe32(0x3b6); *(uint32_t*)0x100000cb = htobe32(0x7f000001); *(uint32_t*)0x100000cf = htobe32(0xfffffbaf); *(uint32_t*)0x100000d3 = htobe32(0x7f000001); *(uint32_t*)0x100000d7 = htobe32(0x400); *(uint16_t*)0x100000de = htobe16(0x4e20); *(uint16_t*)0x100000e0 = htobe16(0x4e21); *(uint32_t*)0x100000e2 = r[3]; *(uint32_t*)0x100000e6 = 0x41424344; STORE_BY_BITMASK(uint8_t, , 0x100000ea, 0, 0, 1); STORE_BY_BITMASK(uint8_t, , 0x100000ea, 0, 1, 3); STORE_BY_BITMASK(uint8_t, , 0x100000ea, 0x10, 4, 4); *(uint8_t*)0x100000eb = 8; *(uint16_t*)0x100000ec = htobe16(0x8001); *(uint16_t*)0x100000ee = htobe16(0); *(uint16_t*)0x100000f0 = htobe16(6); *(uint8_t*)0x100000f2 = 0; *(uint8_t*)0x100000f3 = 2; *(uint8_t*)0x100000f4 = 4; *(uint16_t*)0x100000f5 = htobe16(0xf13); *(uint8_t*)0x100000f7 = 5; *(uint8_t*)0x100000f8 = 0x26; *(uint32_t*)0x100000f9 = htobe32(0x3f); *(uint32_t*)0x100000fd = htobe32(6); *(uint32_t*)0x10000101 = htobe32(8); *(uint32_t*)0x10000105 = htobe32(6); *(uint32_t*)0x10000109 = htobe32(8); *(uint32_t*)0x1000010d = htobe32(8); *(uint32_t*)0x10000111 = htobe32(0x20); *(uint32_t*)0x10000115 = htobe32(0x8001); *(uint32_t*)0x10000119 = htobe32(0xfffffff7); memcpy((void*)0x1000011e, "\xb9\x8e\xed\x1b\xfb\x3a\x0d\x46\xc5\x41\xa8\x52\x1f\xa4\xb5\x20\x40\x51\xe2\x1c\xdf\x38\xcb\x70\x77\xdb\x0f\x27\x16\x03\x9b\xa5\xc2\x45\x69\xc2\x3b\x4e\x18\xe6\x01\x52\xf0\x8a\x56\xa0\xb8\x13\x62\x42\x30\xb5\x7b\x8c\x73\x00\x1a\x7c\x09\xee\x6b\x29\xab\x9c\xa3\x12\x48\xef\x28\xd1\xde\x0b\xdc\x63\x24\x74\x83\xe0\x51\xe8\xc7\x28\x11\xf9\xb4\x21\x22\xdc\xe1\xb1\x36\x57\xa9\x9a\x08\xd7\x95\x64\xf0\x09\x61\xf5\x46\xb5\x9c\x7c\x01\x94\x6e\x8c\xd5\xfe\x48\x05\xc8\x7d\xbb\x5c\xca\xfb\xfd\xe1\x8a\x4b\x99\xd3\x06\x97\xca\xc4\x45\x42\x8a\x4a\x0f\xd5\xb4\x6b\x18\x71\x99\xc3\x4a\x93\xb2\xbd\x70\x6b\x47\x0c\xf0\xc6\x9d\xf6\x0a\x28\xdc\x68\xbc\x42\x60\x08\x96\x5b\x0d\xfd\x74\xa4\xaa\x29\xb6\xb7\x99\x18\xec\xc6\x78\x41\x9a\xc3\xff\x8f\x7e\x25\x45\xb5\xe2\x08\xb7\x29\x51\xd8\x14\xf6\x93\x69\x3b\x7b\x0e\x40\x52\x36\x64\xf3\x96\x34\x76\x31\xf0\xf1\x98\xa0\xea\xd9\xb8\xa9\x3c\xae\x36\xe7\x49\x09\x18\x0a\x23\x70\xfe\x72\xfe\xde\x65\xb7\x47\xad\x92\xb5\x46\x71\xa1\x25\xf1", 241); struct csum_inet csum_1; csum_inet_init(&csum_1); csum_inet_update(&csum_1, (const uint8_t*)0x1000005a, 4); csum_inet_update(&csum_1, (const uint8_t*)0x1000005e, 4); uint16_t csum_1_chunk_2 = 0x600; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_2, 2); uint16_t csum_1_chunk_3 = 0x3101; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_3, 2); csum_inet_update(&csum_1, (const uint8_t*)0x100000de, 305); *(uint16_t*)0x100000ee = csum_inet_digest(&csum_1); struct csum_inet csum_2; csum_inet_init(&csum_2); csum_inet_update(&csum_2, (const uint8_t*)0x1000004e, 144); *(uint16_t*)0x10000058 = csum_inet_digest(&csum_2); break; case 12: memcpy((void*)0x10000240, "\xc4\xc1\xed\x14\xa5\x59\xab\x32\xeb\xd0\xd5\x36\x64\x66\x67\x66\x66\x0f\x38\xf6\x6b\x0f\xc4\xc2\x61\xbe\xed\xc4\xe2\x01\xba\xef\x0f\x18\xd1\xc4\xe2\x01\xa8\xa8\xe1\x40\x00\x00\xc4\xe1\x69\xe5\xb1\x4d\x41\xb9\xa0\xde\xe9\x0f\x38\xca\x23", 59); syz_execute_func(0x10000240); break; case 13: break; } } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); use_temporary_dir(); do_sandbox_none(); return 0; } :279:11: error: use of undeclared identifier 'SYS_shm_rename' syscall(SYS_shm_rename, 0x10000100, 0x10000140, 6); ^ 1 error generated. compiler invocation: clang [-o /tmp/syz-executor009796732 -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.55s) csource_test.go:122: opts: {Threaded:true Collide:false Repeat:true RepeatTimes:0 Procs:0 Sandbox:none Fault:false FaultCall:0 FaultNth:0 Leak:false NetInjection:true NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false UseTmpDir:true HandleSegv:false Repro:false Trace:false} program: truncate(&(0x7f0000000000)='./file0\x00', 0x0) socket$inet(0x2, 0x4, 0x81) freebsd10_pipe(&(0x7f0000000040)={0xffffffffffffffff, 0xffffffffffffffff}) freebsd11_mknodat(r0, &(0x7f0000000080)='./file0\x00', 0x40, 0x4) chflags(&(0x7f00000000c0)='./file0\x00', 0x110212) shm_rename(&(0x7f0000000100)='./file0\x00', &(0x7f0000000140)='./file0\x00', 0x6) r1 = dup2(0xffffffffffffffff, 0xffffffffffffff9c) ioctl$DIOCCHANGEADDR(r1, 0xc4704437, &(0x7f0000000180)="9d61632459f011108aca181da4cc8372b78dcda5") freebsd10_pipe(&(0x7f00000001c0)={0xffffffffffffffff}) ioctl$DIOCRTSTADDRS(r2, 0xc4504449, &(0x7f0000000280)={{"35c4df515ed9a9eeb69a52635d8fb8b651cf3959fa233503474d880170ac5a6eff8983b1abf33d2a2b68b48ac3e04d9f1576976e9a209ea4eb9df0492cb60fff25f705b225e60541430774024ed9a77956cc1ee1aa49852856dde798fff57cf85b44f611e4f6a2f9b1c9174957164e7e83b5fc152fe9eefb9291fcb5bb6dcc4f34bb9253bfdfb685e0ce6fd9f9912321e7c96afa1e73b2c849cef730dbc0dcb0d1aa86b810f58658d45cb384719b5017a8b44b55d621a397f539190392a7fcc5a545c7c9759cd3be711ec91aa7c1f0590321d839500e0a006b8ff5e7fae19d3fd881b52e0dcb79b92936e60ce9a714631a5a0f7c122ae53b27afa90ffdeffa1850c6b3bd711555053e459627c80b681c3c8b8816c0913e772b05a80ff7556c80e860e2463db4d5ae7dd11af5a15c83a65cf7795c975d8b827e5b62d02ad55572623a90bf8ad0e8ce52d6d099427a4abfe84198b64dc26231c847d038302b7fe558aac4f2a7e9274c8a9c3be263e2565d825f379d55a35bf41d89e8c3fe9ff76429e1dad1d7c284412bd36144e55626f135fbe65858a2c9d1326f57b04eab1301a08bd6d608b894e716fbc4cbb89a8d96afa8ed326970ad2dcd746a445837156b87983ebc5fe55540ee3435a20062291fd827525fb5fdea7a33080acd0524ab2d6bf81fb753bdbc7662695c878d22e4cc3776a15e64750cf4654e25609b0d6bbf0e367df50f143e7ada5121ad9edc7da9686bb864d2786a684d2a84e2b027a26084c6d5f5afd89bd25e1c6dad0674bd0f2b34da34c6f4d54e80c9a44675b5fae40a80506a6da8e7569b9bff2f539d8de340087c5885bf052d3861ccc4ca85c38083c793f78ff7b018cb1bab2ec7e9e1d1b59203bf15ddec6e99139eac8fbd5055e60611e39193cd875cd213aba34b3e0ddbc05074f1756770de1c1c8efbf4554be83bae0b3f5ee30cd9a771a689f52469cebf6c801f8de0eac5fe93c3c13593e9daa5bad1280b695ef7e5bdc15ba6b6992183ae6da64de1e8d1eae9f110cdb25edb6a7b123f6c83cb48a3e1045f284593f7d6f23e2a068506445a9938486ad3b676be2fb154ebcde15119d296fceb2413745a8c5417b2ac34b4f355b3549aa223ef2f342e00a637db8616442ca3a180a5825dff2603bad906625404678fa3b39591e162e7ff40adfe8566d68eed8a19153f19fc629452e30f0645aafc1f4eb5dea9f3c6ed6ddbc44473cf8995d033a2ff0c0cdd5388ce6edb1e732aa383346aca3297d84174ea8c6a3fb4083f091263ac4c6062a8401d164be2bfa23e81f9bda1486c7fda45da44ba46afb55f0946b43e8d80f1fccea290ac53aadfa2d109db7d1493b1146947d96b8701e1f6a61892164912430f7583ff87e7dfa8bc61520bdf7afb5485302a8e0dbc332fce4736bee859c1c3d4b5083eb53aa0532fb07229e6", "fbf6bfee9c01092652d2d600835f64f0982102189a56bb5d2acd1157abacb317", 0x100, 0x1}, &(0x7f0000000200)="4b418fea2cea206ae391e44a504fceeb9da11453e3c0303b6fbfdc928a7470eb0c3240c75c0c35134caac7719b5849274bbc0f0b76d2cdbd6127f348d99cf71d4962579966d743126ef7b139bc729327c6e2018d2c24a1cdf88b213117404495ff0ccb9e3549390c33e4fa7ef504f76d2c9dcad0502773b1e6e2ee", 0xffffffff, 0x7, 0x20, 0x200, 0x0, 0x7, 0x887f, 0x7ff}) syz_extract_tcp_res(&(0x7f0000000000)={0x41424344, 0x41424344}, 0x4, 0x40) syz_emit_ethernet(0x1cf, &(0x7f0000000040)={@local, @empty, [], {@ipv4={0x800, {{0x24, 0x4, 0x1, 0x7, 0x1c1, 0x66, 0xc7c, 0x40, 0x2e, 0x0, @multicast2, @loopback, {[@end, @rr={0x7, 0xb, 0x9, [@multicast2, @multicast2]}, @ssrr={0x89, 0x7, 0x7f, [@local={0xac, 0x14, 0x0}]}, @noop, @rr={0x7, 0xb, 0x1f, [@local={0xac, 0x14, 0x0}, @empty]}, @lsrr={0x83, 0xb, 0x0, [@multicast2, @empty]}, @end, @lsrr={0x83, 0xf, 0x96, [@loopback, @multicast2, @multicast2]}, @rr={0x7, 0x7, 0x0, [@multicast2]}, @timestamp={0x44, 0x38, 0x2, 0x1, 0x7, [{[@empty], 0x2}, {[@local={0xac, 0x14, 0x0}], 0x1f}, {[@multicast1]}, {[], 0x7}, {[], 0x3ff}, {[], 0x3b6}, {[@loopback], 0xfffffbaf}, {[@loopback], 0x400}]}]}}, @tcp={{0x0, 0x1, r3, 0x41424344, 0x0, 0x0, 0x10, 0x8, 0x8001, 0x0, 0x6, {[@eol, @mss={0x2, 0x4, 0xf13}, @sack={0x5, 0x26, [0x3f, 0x6, 0x8, 0x6, 0x8, 0x8, 0x20, 0x8001, 0xfffffff7]}]}}, {"b98eed1bfb3a0d46c541a8521fa4b5204051e21cdf38cb7077db0f2716039ba5c24569c23b4e18e60152f08a56a0b813624230b57b8c73001a7c09ee6b29ab9ca31248ef28d1de0bdc63247483e051e8c72811f9b42122dce1b13657a99a08d79564f00961f546b59c7c01946e8cd5fe4805c87dbb5ccafbfde18a4b99d30697cac445428a4a0fd5b46b187199c34a93b2bd706b470cf0c69df60a28dc68bc426008965b0dfd74a4aa29b6b79918ecc678419ac3ff8f7e2545b5e208b72951d814f693693b7b0e40523664f396347631f0f198a0ead9b8a93cae36e74909180a2370fe72fede65b747ad92b54671a125f1"}}}}}}) syz_execute_func(&(0x7f0000000240)="c4c1ed14a559ab32ebd0d53664666766660f38f66b0fc4c261beedc4e201baef0f18d1c4e201a8a8e1400000c4e169e5b14d41b9a0dee90f38ca23") syz_extract_tcp_res(&(0x7f0000000280), 0x4df9f115, 0x2) csource_test.go:123: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static unsigned long long procid; static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void remove_dir(const char* dir) { DIR* dp; struct dirent* ep; dp = opendir(dir); if (dp == NULL) exit(1); while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } if (unlink(filename)) exit(1); } closedir(dp); if (rmdir(dir)) exit(1); } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i; for (i = 0; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { pthread_mutex_t mu; pthread_cond_t cv; int state; } event_t; static void event_init(event_t* ev) { if (pthread_mutex_init(&ev->mu, 0)) exit(1); if (pthread_cond_init(&ev->cv, 0)) exit(1); ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { pthread_mutex_lock(&ev->mu); if (ev->state) exit(1); ev->state = 1; pthread_mutex_unlock(&ev->mu); pthread_cond_broadcast(&ev->cv); } static void event_wait(event_t* ev) { pthread_mutex_lock(&ev->mu); while (!ev->state) pthread_cond_wait(&ev->cv, &ev->mu); pthread_mutex_unlock(&ev->mu); } static int event_isset(event_t* ev) { pthread_mutex_lock(&ev->mu); int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; pthread_mutex_lock(&ev->mu); for (;;) { if (ev->state) break; uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); now = current_time_ms(); if (now - start > timeout) break; } int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } #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; for (i = 0; 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 int tunfd = -1; #define MAX_TUN 4 #define TUN_IFACE "tap%d" #define TUN_DEVICE "/dev/tap%d" #define LOCAL_MAC "aa:aa:aa:aa:aa:aa" #define REMOTE_MAC "aa:aa:aa:aa:aa:bb" #define LOCAL_IPV4 "172.20.%d.170" #define REMOTE_IPV4 "172.20.%d.187" #define LOCAL_IPV6 "fe80::%02hxaa" #define REMOTE_IPV6 "fe80::%02hxbb" static void vsnprintf_check(char* str, size_t size, const char* format, va_list args) { int rv; rv = vsnprintf(str, size, format, args); if (rv < 0) exit(1); if ((size_t)rv >= size) exit(1); } static void snprintf_check(char* str, size_t size, const char* format, ...) { va_list args; va_start(args, format); vsnprintf_check(str, size, format, args); va_end(args); } #define COMMAND_MAX_LEN 128 #define PATH_PREFIX "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin " #define PATH_PREFIX_LEN (sizeof(PATH_PREFIX) - 1) static void execute_command(bool panic, const char* format, ...) { va_list args; char command[PATH_PREFIX_LEN + COMMAND_MAX_LEN]; int rv; va_start(args, format); memcpy(command, PATH_PREFIX, PATH_PREFIX_LEN); vsnprintf_check(command + PATH_PREFIX_LEN, COMMAND_MAX_LEN, format, args); va_end(args); rv = system(command); if (rv) { if (panic) exit(1); } } static void initialize_tun(int tun_id) { if (tun_id < 0 || tun_id >= MAX_TUN) { exit(1); } char tun_device[sizeof(TUN_DEVICE)]; snprintf_check(tun_device, sizeof(tun_device), TUN_DEVICE, tun_id); char tun_iface[sizeof(TUN_IFACE)]; snprintf_check(tun_iface, sizeof(tun_iface), TUN_IFACE, tun_id); execute_command(0, "ifconfig %s destroy", tun_device); tunfd = open(tun_device, O_RDWR | O_NONBLOCK); if ((tunfd < 0) && (errno == ENOENT)) { execute_command(0, "kldload -q if_tap"); tunfd = open(tun_device, O_RDWR | O_NONBLOCK); } if (tunfd == -1) { printf("tun: can't open %s: errno=%d\n", tun_device, errno); return; } const int kTunFd = 240; if (dup2(tunfd, kTunFd) < 0) exit(1); close(tunfd); tunfd = kTunFd; char local_mac[sizeof(LOCAL_MAC)]; snprintf_check(local_mac, sizeof(local_mac), LOCAL_MAC); execute_command(1, "ifconfig %s ether %s", tun_iface, local_mac); char local_ipv4[sizeof(LOCAL_IPV4)]; snprintf_check(local_ipv4, sizeof(local_ipv4), LOCAL_IPV4, tun_id); execute_command(1, "ifconfig %s inet %s netmask 255.255.255.0", tun_iface, local_ipv4); char remote_mac[sizeof(REMOTE_MAC)]; char remote_ipv4[sizeof(REMOTE_IPV4)]; snprintf_check(remote_mac, sizeof(remote_mac), REMOTE_MAC); snprintf_check(remote_ipv4, sizeof(remote_ipv4), REMOTE_IPV4, tun_id); execute_command(0, "arp -s %s %s", remote_ipv4, remote_mac); char local_ipv6[sizeof(LOCAL_IPV6)]; snprintf_check(local_ipv6, sizeof(local_ipv6), LOCAL_IPV6, tun_id); execute_command(1, "ifconfig %s inet6 %s", tun_iface, local_ipv6); char remote_ipv6[sizeof(REMOTE_IPV6)]; snprintf_check(remote_ipv6, sizeof(remote_ipv6), REMOTE_IPV6, tun_id); execute_command(0, "ndp -s %s%%%s %s", remote_ipv6, tun_iface, remote_mac); } static long syz_emit_ethernet(volatile long a0, volatile long a1) { if (tunfd < 0) return (uintptr_t)-1; size_t length = a0; const char* data = (char*)a1; return write(tunfd, data, length); } static int read_tun(char* data, int size) { if (tunfd < 0) return -1; int rv = read(tunfd, data, size); if (rv < 0) { if (errno == EAGAIN) return -1; exit(1); } return rv; } struct tcp_resources { uint32_t seq; uint32_t ack; }; static long syz_extract_tcp_res(volatile long a0, volatile long a1, volatile long a2) { if (tunfd < 0) return (uintptr_t)-1; char data[1000]; int rv = read_tun(&data[0], sizeof(data)); if (rv == -1) return (uintptr_t)-1; size_t length = rv; struct tcphdr* tcphdr; if (length < sizeof(struct ether_header)) return (uintptr_t)-1; struct ether_header* ethhdr = (struct ether_header*)&data[0]; if (ethhdr->ether_type == htons(ETHERTYPE_IP)) { if (length < sizeof(struct ether_header) + sizeof(struct ip)) return (uintptr_t)-1; struct ip* iphdr = (struct ip*)&data[sizeof(struct ether_header)]; if (iphdr->ip_p != IPPROTO_TCP) return (uintptr_t)-1; if (length < sizeof(struct ether_header) + iphdr->ip_hl * 4 + sizeof(struct tcphdr)) return (uintptr_t)-1; tcphdr = (struct tcphdr*)&data[sizeof(struct ether_header) + iphdr->ip_hl * 4]; } else { if (length < sizeof(struct ether_header) + sizeof(struct ip6_hdr)) return (uintptr_t)-1; struct ip6_hdr* ipv6hdr = (struct ip6_hdr*)&data[sizeof(struct ether_header)]; if (ipv6hdr->ip6_nxt != IPPROTO_TCP) return (uintptr_t)-1; if (length < sizeof(struct ether_header) + sizeof(struct ip6_hdr) + sizeof(struct tcphdr)) return (uintptr_t)-1; tcphdr = (struct tcphdr*)&data[sizeof(struct ether_header) + sizeof(struct ip6_hdr)]; } struct tcp_resources* res = (struct tcp_resources*)a0; res->seq = htonl(ntohl(tcphdr->th_seq) + (uint32_t)a1); res->ack = htonl(ntohl(tcphdr->th_ack) + (uint32_t)a2); return 0; } static void sandbox_common() { if (setsid() == -1) exit(1); struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 8 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 0; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); } static void loop(); static int do_sandbox_none(void) { sandbox_common(); initialize_tun(procid); loop(); return 0; } static long syz_execute_func(volatile long text) { volatile long p[8] = {0}; (void)p; ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 14; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); event_timedwait(&th->done, 45); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); #define WAIT_FLAGS 0 static void loop(void) { int iter; for (iter = 0;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5 * 1000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x41424344}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: memcpy((void*)0x10000000, "./file0\000", 8); syscall(SYS_truncate, 0x10000000, 0); break; case 1: syscall(SYS_socket, 2, 4, 0x81); break; case 2: res = syscall(SYS_freebsd10_pipe, 0x10000040); if (res != -1) r[0] = *(uint32_t*)0x10000044; break; case 3: memcpy((void*)0x10000080, "./file0\000", 8); syscall(SYS_freebsd11_mknodat, (intptr_t)r[0], 0x10000080, 0x40, 4); break; case 4: memcpy((void*)0x100000c0, "./file0\000", 8); syscall(SYS_chflags, 0x100000c0, 0x110212); break; case 5: memcpy((void*)0x10000100, "./file0\000", 8); memcpy((void*)0x10000140, "./file0\000", 8); syscall(SYS_shm_rename, 0x10000100, 0x10000140, 6); break; case 6: res = syscall(SYS_dup2, -1, 0xffffff9c); if (res != -1) r[1] = res; break; case 7: memcpy((void*)0x10000180, "\x9d\x61\x63\x24\x59\xf0\x11\x10\x8a\xca\x18\x1d\xa4\xcc\x83\x72\xb7\x8d\xcd\xa5", 20); syscall(SYS_ioctl, (intptr_t)r[1], 0xc4704437, 0x10000180); break; case 8: res = syscall(SYS_freebsd10_pipe, 0x100001c0); if (res != -1) r[2] = *(uint32_t*)0x100001c0; break; case 9: memcpy((void*)0x10000280, "\x35\xc4\xdf\x51\x5e\xd9\xa9\xee\xb6\x9a\x52\x63\x5d\x8f\xb8\xb6\x51\xcf\x39\x59\xfa\x23\x35\x03\x47\x4d\x88\x01\x70\xac\x5a\x6e\xff\x89\x83\xb1\xab\xf3\x3d\x2a\x2b\x68\xb4\x8a\xc3\xe0\x4d\x9f\x15\x76\x97\x6e\x9a\x20\x9e\xa4\xeb\x9d\xf0\x49\x2c\xb6\x0f\xff\x25\xf7\x05\xb2\x25\xe6\x05\x41\x43\x07\x74\x02\x4e\xd9\xa7\x79\x56\xcc\x1e\xe1\xaa\x49\x85\x28\x56\xdd\xe7\x98\xff\xf5\x7c\xf8\x5b\x44\xf6\x11\xe4\xf6\xa2\xf9\xb1\xc9\x17\x49\x57\x16\x4e\x7e\x83\xb5\xfc\x15\x2f\xe9\xee\xfb\x92\x91\xfc\xb5\xbb\x6d\xcc\x4f\x34\xbb\x92\x53\xbf\xdf\xb6\x85\xe0\xce\x6f\xd9\xf9\x91\x23\x21\xe7\xc9\x6a\xfa\x1e\x73\xb2\xc8\x49\xce\xf7\x30\xdb\xc0\xdc\xb0\xd1\xaa\x86\xb8\x10\xf5\x86\x58\xd4\x5c\xb3\x84\x71\x9b\x50\x17\xa8\xb4\x4b\x55\xd6\x21\xa3\x97\xf5\x39\x19\x03\x92\xa7\xfc\xc5\xa5\x45\xc7\xc9\x75\x9c\xd3\xbe\x71\x1e\xc9\x1a\xa7\xc1\xf0\x59\x03\x21\xd8\x39\x50\x0e\x0a\x00\x6b\x8f\xf5\xe7\xfa\xe1\x9d\x3f\xd8\x81\xb5\x2e\x0d\xcb\x79\xb9\x29\x36\xe6\x0c\xe9\xa7\x14\x63\x1a\x5a\x0f\x7c\x12\x2a\xe5\x3b\x27\xaf\xa9\x0f\xfd\xef\xfa\x18\x50\xc6\xb3\xbd\x71\x15\x55\x05\x3e\x45\x96\x27\xc8\x0b\x68\x1c\x3c\x8b\x88\x16\xc0\x91\x3e\x77\x2b\x05\xa8\x0f\xf7\x55\x6c\x80\xe8\x60\xe2\x46\x3d\xb4\xd5\xae\x7d\xd1\x1a\xf5\xa1\x5c\x83\xa6\x5c\xf7\x79\x5c\x97\x5d\x8b\x82\x7e\x5b\x62\xd0\x2a\xd5\x55\x72\x62\x3a\x90\xbf\x8a\xd0\xe8\xce\x52\xd6\xd0\x99\x42\x7a\x4a\xbf\xe8\x41\x98\xb6\x4d\xc2\x62\x31\xc8\x47\xd0\x38\x30\x2b\x7f\xe5\x58\xaa\xc4\xf2\xa7\xe9\x27\x4c\x8a\x9c\x3b\xe2\x63\xe2\x56\x5d\x82\x5f\x37\x9d\x55\xa3\x5b\xf4\x1d\x89\xe8\xc3\xfe\x9f\xf7\x64\x29\xe1\xda\xd1\xd7\xc2\x84\x41\x2b\xd3\x61\x44\xe5\x56\x26\xf1\x35\xfb\xe6\x58\x58\xa2\xc9\xd1\x32\x6f\x57\xb0\x4e\xab\x13\x01\xa0\x8b\xd6\xd6\x08\xb8\x94\xe7\x16\xfb\xc4\xcb\xb8\x9a\x8d\x96\xaf\xa8\xed\x32\x69\x70\xad\x2d\xcd\x74\x6a\x44\x58\x37\x15\x6b\x87\x98\x3e\xbc\x5f\xe5\x55\x40\xee\x34\x35\xa2\x00\x62\x29\x1f\xd8\x27\x52\x5f\xb5\xfd\xea\x7a\x33\x08\x0a\xcd\x05\x24\xab\x2d\x6b\xf8\x1f\xb7\x53\xbd\xbc\x76\x62\x69\x5c\x87\x8d\x22\xe4\xcc\x37\x76\xa1\x5e\x64\x75\x0c\xf4\x65\x4e\x25\x60\x9b\x0d\x6b\xbf\x0e\x36\x7d\xf5\x0f\x14\x3e\x7a\xda\x51\x21\xad\x9e\xdc\x7d\xa9\x68\x6b\xb8\x64\xd2\x78\x6a\x68\x4d\x2a\x84\xe2\xb0\x27\xa2\x60\x84\xc6\xd5\xf5\xaf\xd8\x9b\xd2\x5e\x1c\x6d\xad\x06\x74\xbd\x0f\x2b\x34\xda\x34\xc6\xf4\xd5\x4e\x80\xc9\xa4\x46\x75\xb5\xfa\xe4\x0a\x80\x50\x6a\x6d\xa8\xe7\x56\x9b\x9b\xff\x2f\x53\x9d\x8d\xe3\x40\x08\x7c\x58\x85\xbf\x05\x2d\x38\x61\xcc\xc4\xca\x85\xc3\x80\x83\xc7\x93\xf7\x8f\xf7\xb0\x18\xcb\x1b\xab\x2e\xc7\xe9\xe1\xd1\xb5\x92\x03\xbf\x15\xdd\xec\x6e\x99\x13\x9e\xac\x8f\xbd\x50\x55\xe6\x06\x11\xe3\x91\x93\xcd\x87\x5c\xd2\x13\xab\xa3\x4b\x3e\x0d\xdb\xc0\x50\x74\xf1\x75\x67\x70\xde\x1c\x1c\x8e\xfb\xf4\x55\x4b\xe8\x3b\xae\x0b\x3f\x5e\xe3\x0c\xd9\xa7\x71\xa6\x89\xf5\x24\x69\xce\xbf\x6c\x80\x1f\x8d\xe0\xea\xc5\xfe\x93\xc3\xc1\x35\x93\xe9\xda\xa5\xba\xd1\x28\x0b\x69\x5e\xf7\xe5\xbd\xc1\x5b\xa6\xb6\x99\x21\x83\xae\x6d\xa6\x4d\xe1\xe8\xd1\xea\xe9\xf1\x10\xcd\xb2\x5e\xdb\x6a\x7b\x12\x3f\x6c\x83\xcb\x48\xa3\xe1\x04\x5f\x28\x45\x93\xf7\xd6\xf2\x3e\x2a\x06\x85\x06\x44\x5a\x99\x38\x48\x6a\xd3\xb6\x76\xbe\x2f\xb1\x54\xeb\xcd\xe1\x51\x19\xd2\x96\xfc\xeb\x24\x13\x74\x5a\x8c\x54\x17\xb2\xac\x34\xb4\xf3\x55\xb3\x54\x9a\xa2\x23\xef\x2f\x34\x2e\x00\xa6\x37\xdb\x86\x16\x44\x2c\xa3\xa1\x80\xa5\x82\x5d\xff\x26\x03\xba\xd9\x06\x62\x54\x04\x67\x8f\xa3\xb3\x95\x91\xe1\x62\xe7\xff\x40\xad\xfe\x85\x66\xd6\x8e\xed\x8a\x19\x15\x3f\x19\xfc\x62\x94\x52\xe3\x0f\x06\x45\xaa\xfc\x1f\x4e\xb5\xde\xa9\xf3\xc6\xed\x6d\xdb\xc4\x44\x73\xcf\x89\x95\xd0\x33\xa2\xff\x0c\x0c\xdd\x53\x88\xce\x6e\xdb\x1e\x73\x2a\xa3\x83\x34\x6a\xca\x32\x97\xd8\x41\x74\xea\x8c\x6a\x3f\xb4\x08\x3f\x09\x12\x63\xac\x4c\x60\x62\xa8\x40\x1d\x16\x4b\xe2\xbf\xa2\x3e\x81\xf9\xbd\xa1\x48\x6c\x7f\xda\x45\xda\x44\xba\x46\xaf\xb5\x5f\x09\x46\xb4\x3e\x8d\x80\xf1\xfc\xce\xa2\x90\xac\x53\xaa\xdf\xa2\xd1\x09\xdb\x7d\x14\x93\xb1\x14\x69\x47\xd9\x6b\x87\x01\xe1\xf6\xa6\x18\x92\x16\x49\x12\x43\x0f\x75\x83\xff\x87\xe7\xdf\xa8\xbc\x61\x52\x0b\xdf\x7a\xfb\x54\x85\x30\x2a\x8e\x0d\xbc\x33\x2f\xce\x47\x36\xbe\xe8\x59\xc1\xc3\xd4\xb5\x08\x3e\xb5\x3a\xa0\x53\x2f\xb0\x72\x29\xe6", 1024); memcpy((void*)0x10000680, "\xfb\xf6\xbf\xee\x9c\x01\x09\x26\x52\xd2\xd6\x00\x83\x5f\x64\xf0\x98\x21\x02\x18\x9a\x56\xbb\x5d\x2a\xcd\x11\x57\xab\xac\xb3\x17", 32); *(uint32_t*)0x100006a0 = 0x100; *(uint8_t*)0x100006a4 = 1; *(uint32_t*)0x100006a8 = 0x10000200; memcpy((void*)0x10000200, "\x4b\x41\x8f\xea\x2c\xea\x20\x6a\xe3\x91\xe4\x4a\x50\x4f\xce\xeb\x9d\xa1\x14\x53\xe3\xc0\x30\x3b\x6f\xbf\xdc\x92\x8a\x74\x70\xeb\x0c\x32\x40\xc7\x5c\x0c\x35\x13\x4c\xaa\xc7\x71\x9b\x58\x49\x27\x4b\xbc\x0f\x0b\x76\xd2\xcd\xbd\x61\x27\xf3\x48\xd9\x9c\xf7\x1d\x49\x62\x57\x99\x66\xd7\x43\x12\x6e\xf7\xb1\x39\xbc\x72\x93\x27\xc6\xe2\x01\x8d\x2c\x24\xa1\xcd\xf8\x8b\x21\x31\x17\x40\x44\x95\xff\x0c\xcb\x9e\x35\x49\x39\x0c\x33\xe4\xfa\x7e\xf5\x04\xf7\x6d\x2c\x9d\xca\xd0\x50\x27\x73\xb1\xe6\xe2\xee", 123); *(uint64_t*)0x100006ac = 0xffffffff; *(uint64_t*)0x100006b4 = 7; *(uint64_t*)0x100006bc = 0x20; *(uint64_t*)0x100006c4 = 0x200; *(uint64_t*)0x100006cc = 0; *(uint64_t*)0x100006d4 = 7; *(uint64_t*)0x100006dc = 0x887f; *(uint32_t*)0x100006e4 = 0x7ff; syscall(SYS_ioctl, (intptr_t)r[2], 0xc4504449, 0x10000280); break; case 10: res = -1; res = syz_extract_tcp_res(0x10000000, 4, 0x40); if (res != -1) r[3] = *(uint32_t*)0x10000004; break; case 11: *(uint8_t*)0x10000040 = 0xaa; *(uint8_t*)0x10000041 = 0xaa; *(uint8_t*)0x10000042 = 0xaa; *(uint8_t*)0x10000043 = 0xaa; *(uint8_t*)0x10000044 = 0xaa; *(uint8_t*)0x10000045 = 0xaa; *(uint8_t*)0x10000046 = 0; *(uint8_t*)0x10000047 = 0; *(uint8_t*)0x10000048 = 0; *(uint8_t*)0x10000049 = 0; *(uint8_t*)0x1000004a = 0; *(uint8_t*)0x1000004b = 0; *(uint16_t*)0x1000004c = htobe16(0x800); STORE_BY_BITMASK(uint8_t, , 0x1000004e, 0x24, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x1000004e, 4, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x1000004f, 1, 0, 2); STORE_BY_BITMASK(uint8_t, , 0x1000004f, 7, 2, 6); *(uint16_t*)0x10000050 = htobe16(0x1c1); *(uint16_t*)0x10000052 = htobe16(0x66); *(uint16_t*)0x10000054 = htobe16(0xc7c); *(uint8_t*)0x10000056 = 0x40; *(uint8_t*)0x10000057 = 0x2e; *(uint16_t*)0x10000058 = htobe16(0); *(uint32_t*)0x1000005a = htobe32(0xe0000002); *(uint32_t*)0x1000005e = htobe32(0x7f000001); *(uint8_t*)0x10000062 = 0; *(uint8_t*)0x10000063 = 7; *(uint8_t*)0x10000064 = 0xb; *(uint8_t*)0x10000065 = 9; *(uint32_t*)0x10000066 = htobe32(0xe0000002); *(uint32_t*)0x1000006a = htobe32(0xe0000002); *(uint8_t*)0x1000006e = 0x89; *(uint8_t*)0x1000006f = 7; *(uint8_t*)0x10000070 = 0x7f; *(uint8_t*)0x10000071 = 0xac; *(uint8_t*)0x10000072 = 0x14; *(uint8_t*)0x10000073 = 0; *(uint8_t*)0x10000074 = 0xaa; *(uint8_t*)0x10000075 = 1; *(uint8_t*)0x10000076 = 7; *(uint8_t*)0x10000077 = 0xb; *(uint8_t*)0x10000078 = 0x1f; *(uint8_t*)0x10000079 = 0xac; *(uint8_t*)0x1000007a = 0x14; *(uint8_t*)0x1000007b = 0; *(uint8_t*)0x1000007c = 0xaa; *(uint32_t*)0x1000007d = htobe32(0); *(uint8_t*)0x10000081 = 0x83; *(uint8_t*)0x10000082 = 0xb; *(uint8_t*)0x10000083 = 0; *(uint32_t*)0x10000084 = htobe32(0xe0000002); *(uint32_t*)0x10000088 = htobe32(0); *(uint8_t*)0x1000008c = 0; *(uint8_t*)0x1000008d = 0x83; *(uint8_t*)0x1000008e = 0xf; *(uint8_t*)0x1000008f = 0x96; *(uint32_t*)0x10000090 = htobe32(0x7f000001); *(uint32_t*)0x10000094 = htobe32(0xe0000002); *(uint32_t*)0x10000098 = htobe32(0xe0000002); *(uint8_t*)0x1000009c = 7; *(uint8_t*)0x1000009d = 7; *(uint8_t*)0x1000009e = 0; *(uint32_t*)0x1000009f = htobe32(0xe0000002); *(uint8_t*)0x100000a3 = 0x44; *(uint8_t*)0x100000a4 = 0x38; *(uint8_t*)0x100000a5 = 2; STORE_BY_BITMASK(uint8_t, , 0x100000a6, 1, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x100000a6, 7, 4, 4); *(uint32_t*)0x100000a7 = htobe32(0); *(uint32_t*)0x100000ab = htobe32(2); *(uint8_t*)0x100000af = 0xac; *(uint8_t*)0x100000b0 = 0x14; *(uint8_t*)0x100000b1 = 0; *(uint8_t*)0x100000b2 = 0xaa; *(uint32_t*)0x100000b3 = htobe32(0x1f); *(uint32_t*)0x100000b7 = htobe32(0xe0000001); *(uint32_t*)0x100000bb = htobe32(0); *(uint32_t*)0x100000bf = htobe32(7); *(uint32_t*)0x100000c3 = htobe32(0x3ff); *(uint32_t*)0x100000c7 = htobe32(0x3b6); *(uint32_t*)0x100000cb = htobe32(0x7f000001); *(uint32_t*)0x100000cf = htobe32(0xfffffbaf); *(uint32_t*)0x100000d3 = htobe32(0x7f000001); *(uint32_t*)0x100000d7 = htobe32(0x400); *(uint16_t*)0x100000de = htobe16(0x4e20); *(uint16_t*)0x100000e0 = htobe16(0x4e21); *(uint32_t*)0x100000e2 = r[3]; *(uint32_t*)0x100000e6 = 0x41424344; STORE_BY_BITMASK(uint8_t, , 0x100000ea, 0, 0, 1); STORE_BY_BITMASK(uint8_t, , 0x100000ea, 0, 1, 3); STORE_BY_BITMASK(uint8_t, , 0x100000ea, 0x10, 4, 4); *(uint8_t*)0x100000eb = 8; *(uint16_t*)0x100000ec = htobe16(0x8001); *(uint16_t*)0x100000ee = htobe16(0); *(uint16_t*)0x100000f0 = htobe16(6); *(uint8_t*)0x100000f2 = 0; *(uint8_t*)0x100000f3 = 2; *(uint8_t*)0x100000f4 = 4; *(uint16_t*)0x100000f5 = htobe16(0xf13); *(uint8_t*)0x100000f7 = 5; *(uint8_t*)0x100000f8 = 0x26; *(uint32_t*)0x100000f9 = htobe32(0x3f); *(uint32_t*)0x100000fd = htobe32(6); *(uint32_t*)0x10000101 = htobe32(8); *(uint32_t*)0x10000105 = htobe32(6); *(uint32_t*)0x10000109 = htobe32(8); *(uint32_t*)0x1000010d = htobe32(8); *(uint32_t*)0x10000111 = htobe32(0x20); *(uint32_t*)0x10000115 = htobe32(0x8001); *(uint32_t*)0x10000119 = htobe32(0xfffffff7); memcpy((void*)0x1000011e, "\xb9\x8e\xed\x1b\xfb\x3a\x0d\x46\xc5\x41\xa8\x52\x1f\xa4\xb5\x20\x40\x51\xe2\x1c\xdf\x38\xcb\x70\x77\xdb\x0f\x27\x16\x03\x9b\xa5\xc2\x45\x69\xc2\x3b\x4e\x18\xe6\x01\x52\xf0\x8a\x56\xa0\xb8\x13\x62\x42\x30\xb5\x7b\x8c\x73\x00\x1a\x7c\x09\xee\x6b\x29\xab\x9c\xa3\x12\x48\xef\x28\xd1\xde\x0b\xdc\x63\x24\x74\x83\xe0\x51\xe8\xc7\x28\x11\xf9\xb4\x21\x22\xdc\xe1\xb1\x36\x57\xa9\x9a\x08\xd7\x95\x64\xf0\x09\x61\xf5\x46\xb5\x9c\x7c\x01\x94\x6e\x8c\xd5\xfe\x48\x05\xc8\x7d\xbb\x5c\xca\xfb\xfd\xe1\x8a\x4b\x99\xd3\x06\x97\xca\xc4\x45\x42\x8a\x4a\x0f\xd5\xb4\x6b\x18\x71\x99\xc3\x4a\x93\xb2\xbd\x70\x6b\x47\x0c\xf0\xc6\x9d\xf6\x0a\x28\xdc\x68\xbc\x42\x60\x08\x96\x5b\x0d\xfd\x74\xa4\xaa\x29\xb6\xb7\x99\x18\xec\xc6\x78\x41\x9a\xc3\xff\x8f\x7e\x25\x45\xb5\xe2\x08\xb7\x29\x51\xd8\x14\xf6\x93\x69\x3b\x7b\x0e\x40\x52\x36\x64\xf3\x96\x34\x76\x31\xf0\xf1\x98\xa0\xea\xd9\xb8\xa9\x3c\xae\x36\xe7\x49\x09\x18\x0a\x23\x70\xfe\x72\xfe\xde\x65\xb7\x47\xad\x92\xb5\x46\x71\xa1\x25\xf1", 241); struct csum_inet csum_1; csum_inet_init(&csum_1); csum_inet_update(&csum_1, (const uint8_t*)0x1000005a, 4); csum_inet_update(&csum_1, (const uint8_t*)0x1000005e, 4); uint16_t csum_1_chunk_2 = 0x600; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_2, 2); uint16_t csum_1_chunk_3 = 0x3101; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_3, 2); csum_inet_update(&csum_1, (const uint8_t*)0x100000de, 305); *(uint16_t*)0x100000ee = csum_inet_digest(&csum_1); struct csum_inet csum_2; csum_inet_init(&csum_2); csum_inet_update(&csum_2, (const uint8_t*)0x1000004e, 144); *(uint16_t*)0x10000058 = csum_inet_digest(&csum_2); syz_emit_ethernet(0x1cf, 0x10000040); break; case 12: memcpy((void*)0x10000240, "\xc4\xc1\xed\x14\xa5\x59\xab\x32\xeb\xd0\xd5\x36\x64\x66\x67\x66\x66\x0f\x38\xf6\x6b\x0f\xc4\xc2\x61\xbe\xed\xc4\xe2\x01\xba\xef\x0f\x18\xd1\xc4\xe2\x01\xa8\xa8\xe1\x40\x00\x00\xc4\xe1\x69\xe5\xb1\x4d\x41\xb9\xa0\xde\xe9\x0f\x38\xca\x23", 59); syz_execute_func(0x10000240); break; case 13: syz_extract_tcp_res(0x10000280, 0x4df9f115, 2); break; } } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); use_temporary_dir(); do_sandbox_none(); return 0; } :528:11: error: use of undeclared identifier 'SYS_shm_rename' syscall(SYS_shm_rename, 0x10000100, 0x10000140, 6); ^ 1 error generated. compiler invocation: clang [-o /tmp/syz-executor666892053 -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.68s) csource_test.go:122: opts: {Threaded:true Collide:false Repeat:true RepeatTimes:0 Procs:0 Sandbox:none Fault:false FaultCall:0 FaultNth:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false UseTmpDir:true HandleSegv:false Repro:false Trace:true} program: truncate(&(0x7f0000000000)='./file0\x00', 0x0) socket$inet(0x2, 0x4, 0x81) freebsd10_pipe(&(0x7f0000000040)={0xffffffffffffffff, 0xffffffffffffffff}) freebsd11_mknodat(r0, &(0x7f0000000080)='./file0\x00', 0x40, 0x4) chflags(&(0x7f00000000c0)='./file0\x00', 0x110212) shm_rename(&(0x7f0000000100)='./file0\x00', &(0x7f0000000140)='./file0\x00', 0x6) r1 = dup2(0xffffffffffffffff, 0xffffffffffffff9c) ioctl$DIOCCHANGEADDR(r1, 0xc4704437, &(0x7f0000000180)="9d61632459f011108aca181da4cc8372b78dcda5") freebsd10_pipe(&(0x7f00000001c0)={0xffffffffffffffff}) ioctl$DIOCRTSTADDRS(r2, 0xc4504449, &(0x7f0000000280)={{"35c4df515ed9a9eeb69a52635d8fb8b651cf3959fa233503474d880170ac5a6eff8983b1abf33d2a2b68b48ac3e04d9f1576976e9a209ea4eb9df0492cb60fff25f705b225e60541430774024ed9a77956cc1ee1aa49852856dde798fff57cf85b44f611e4f6a2f9b1c9174957164e7e83b5fc152fe9eefb9291fcb5bb6dcc4f34bb9253bfdfb685e0ce6fd9f9912321e7c96afa1e73b2c849cef730dbc0dcb0d1aa86b810f58658d45cb384719b5017a8b44b55d621a397f539190392a7fcc5a545c7c9759cd3be711ec91aa7c1f0590321d839500e0a006b8ff5e7fae19d3fd881b52e0dcb79b92936e60ce9a714631a5a0f7c122ae53b27afa90ffdeffa1850c6b3bd711555053e459627c80b681c3c8b8816c0913e772b05a80ff7556c80e860e2463db4d5ae7dd11af5a15c83a65cf7795c975d8b827e5b62d02ad55572623a90bf8ad0e8ce52d6d099427a4abfe84198b64dc26231c847d038302b7fe558aac4f2a7e9274c8a9c3be263e2565d825f379d55a35bf41d89e8c3fe9ff76429e1dad1d7c284412bd36144e55626f135fbe65858a2c9d1326f57b04eab1301a08bd6d608b894e716fbc4cbb89a8d96afa8ed326970ad2dcd746a445837156b87983ebc5fe55540ee3435a20062291fd827525fb5fdea7a33080acd0524ab2d6bf81fb753bdbc7662695c878d22e4cc3776a15e64750cf4654e25609b0d6bbf0e367df50f143e7ada5121ad9edc7da9686bb864d2786a684d2a84e2b027a26084c6d5f5afd89bd25e1c6dad0674bd0f2b34da34c6f4d54e80c9a44675b5fae40a80506a6da8e7569b9bff2f539d8de340087c5885bf052d3861ccc4ca85c38083c793f78ff7b018cb1bab2ec7e9e1d1b59203bf15ddec6e99139eac8fbd5055e60611e39193cd875cd213aba34b3e0ddbc05074f1756770de1c1c8efbf4554be83bae0b3f5ee30cd9a771a689f52469cebf6c801f8de0eac5fe93c3c13593e9daa5bad1280b695ef7e5bdc15ba6b6992183ae6da64de1e8d1eae9f110cdb25edb6a7b123f6c83cb48a3e1045f284593f7d6f23e2a068506445a9938486ad3b676be2fb154ebcde15119d296fceb2413745a8c5417b2ac34b4f355b3549aa223ef2f342e00a637db8616442ca3a180a5825dff2603bad906625404678fa3b39591e162e7ff40adfe8566d68eed8a19153f19fc629452e30f0645aafc1f4eb5dea9f3c6ed6ddbc44473cf8995d033a2ff0c0cdd5388ce6edb1e732aa383346aca3297d84174ea8c6a3fb4083f091263ac4c6062a8401d164be2bfa23e81f9bda1486c7fda45da44ba46afb55f0946b43e8d80f1fccea290ac53aadfa2d109db7d1493b1146947d96b8701e1f6a61892164912430f7583ff87e7dfa8bc61520bdf7afb5485302a8e0dbc332fce4736bee859c1c3d4b5083eb53aa0532fb07229e6", "fbf6bfee9c01092652d2d600835f64f0982102189a56bb5d2acd1157abacb317", 0x100, 0x1}, &(0x7f0000000200)="4b418fea2cea206ae391e44a504fceeb9da11453e3c0303b6fbfdc928a7470eb0c3240c75c0c35134caac7719b5849274bbc0f0b76d2cdbd6127f348d99cf71d4962579966d743126ef7b139bc729327c6e2018d2c24a1cdf88b213117404495ff0ccb9e3549390c33e4fa7ef504f76d2c9dcad0502773b1e6e2ee", 0xffffffff, 0x7, 0x20, 0x200, 0x0, 0x7, 0x887f, 0x7ff}) syz_extract_tcp_res(&(0x7f0000000000)={0x41424344, 0x41424344}, 0x4, 0x40) syz_emit_ethernet(0x1cf, &(0x7f0000000040)={@local, @empty, [], {@ipv4={0x800, {{0x24, 0x4, 0x1, 0x7, 0x1c1, 0x66, 0xc7c, 0x40, 0x2e, 0x0, @multicast2, @loopback, {[@end, @rr={0x7, 0xb, 0x9, [@multicast2, @multicast2]}, @ssrr={0x89, 0x7, 0x7f, [@local={0xac, 0x14, 0x0}]}, @noop, @rr={0x7, 0xb, 0x1f, [@local={0xac, 0x14, 0x0}, @empty]}, @lsrr={0x83, 0xb, 0x0, [@multicast2, @empty]}, @end, @lsrr={0x83, 0xf, 0x96, [@loopback, @multicast2, @multicast2]}, @rr={0x7, 0x7, 0x0, [@multicast2]}, @timestamp={0x44, 0x38, 0x2, 0x1, 0x7, [{[@empty], 0x2}, {[@local={0xac, 0x14, 0x0}], 0x1f}, {[@multicast1]}, {[], 0x7}, {[], 0x3ff}, {[], 0x3b6}, {[@loopback], 0xfffffbaf}, {[@loopback], 0x400}]}]}}, @tcp={{0x0, 0x1, r3, 0x41424344, 0x0, 0x0, 0x10, 0x8, 0x8001, 0x0, 0x6, {[@eol, @mss={0x2, 0x4, 0xf13}, @sack={0x5, 0x26, [0x3f, 0x6, 0x8, 0x6, 0x8, 0x8, 0x20, 0x8001, 0xfffffff7]}]}}, {"b98eed1bfb3a0d46c541a8521fa4b5204051e21cdf38cb7077db0f2716039ba5c24569c23b4e18e60152f08a56a0b813624230b57b8c73001a7c09ee6b29ab9ca31248ef28d1de0bdc63247483e051e8c72811f9b42122dce1b13657a99a08d79564f00961f546b59c7c01946e8cd5fe4805c87dbb5ccafbfde18a4b99d30697cac445428a4a0fd5b46b187199c34a93b2bd706b470cf0c69df60a28dc68bc426008965b0dfd74a4aa29b6b79918ecc678419ac3ff8f7e2545b5e208b72951d814f693693b7b0e40523664f396347631f0f198a0ead9b8a93cae36e74909180a2370fe72fede65b747ad92b54671a125f1"}}}}}}) syz_execute_func(&(0x7f0000000240)="c4c1ed14a559ab32ebd0d53664666766660f38f66b0fc4c261beedc4e201baef0f18d1c4e201a8a8e1400000c4e169e5b14d41b9a0dee90f38ca23") syz_extract_tcp_res(&(0x7f0000000280), 0x4df9f115, 0x2) csource_test.go:123: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void remove_dir(const char* dir) { DIR* dp; struct dirent* ep; dp = opendir(dir); if (dp == NULL) exit(1); while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } if (unlink(filename)) exit(1); } closedir(dp); if (rmdir(dir)) exit(1); } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i; for (i = 0; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { pthread_mutex_t mu; pthread_cond_t cv; int state; } event_t; static void event_init(event_t* ev) { if (pthread_mutex_init(&ev->mu, 0)) exit(1); if (pthread_cond_init(&ev->cv, 0)) exit(1); ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { pthread_mutex_lock(&ev->mu); if (ev->state) exit(1); ev->state = 1; pthread_mutex_unlock(&ev->mu); pthread_cond_broadcast(&ev->cv); } static void event_wait(event_t* ev) { pthread_mutex_lock(&ev->mu); while (!ev->state) pthread_cond_wait(&ev->cv, &ev->mu); pthread_mutex_unlock(&ev->mu); } static int event_isset(event_t* ev) { pthread_mutex_lock(&ev->mu); int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; pthread_mutex_lock(&ev->mu); for (;;) { if (ev->state) break; uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); now = current_time_ms(); if (now - start > timeout) break; } int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } #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; for (i = 0; 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) { volatile long p[8] = {0}; (void)p; ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { fprintf(stderr, "### start\n"); int i, call, thread; for (call = 0; call < 14; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); event_timedwait(&th->done, 45); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); #define WAIT_FLAGS 0 static void loop(void) { int iter; for (iter = 0;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5 * 1000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x41424344}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: memcpy((void*)0x10000000, "./file0\000", 8); res = syscall(SYS_truncate, 0x10000000, 0); fprintf(stderr, "### call=0 errno=%u\n", res == -1 ? errno : 0); break; case 1: res = syscall(SYS_socket, 2, 4, 0x81); fprintf(stderr, "### call=1 errno=%u\n", res == -1 ? errno : 0); break; case 2: res = syscall(SYS_freebsd10_pipe, 0x10000040); fprintf(stderr, "### call=2 errno=%u\n", res == -1 ? errno : 0); if (res != -1) r[0] = *(uint32_t*)0x10000044; break; case 3: memcpy((void*)0x10000080, "./file0\000", 8); res = syscall(SYS_freebsd11_mknodat, (intptr_t)r[0], 0x10000080, 0x40, 4); fprintf(stderr, "### call=3 errno=%u\n", res == -1 ? errno : 0); break; case 4: memcpy((void*)0x100000c0, "./file0\000", 8); res = syscall(SYS_chflags, 0x100000c0, 0x110212); fprintf(stderr, "### call=4 errno=%u\n", res == -1 ? errno : 0); break; case 5: memcpy((void*)0x10000100, "./file0\000", 8); memcpy((void*)0x10000140, "./file0\000", 8); res = syscall(SYS_shm_rename, 0x10000100, 0x10000140, 6); fprintf(stderr, "### call=5 errno=%u\n", res == -1 ? errno : 0); break; case 6: res = syscall(SYS_dup2, -1, 0xffffff9c); fprintf(stderr, "### call=6 errno=%u\n", res == -1 ? errno : 0); if (res != -1) r[1] = res; break; case 7: memcpy((void*)0x10000180, "\x9d\x61\x63\x24\x59\xf0\x11\x10\x8a\xca\x18\x1d\xa4\xcc\x83\x72\xb7\x8d\xcd\xa5", 20); res = syscall(SYS_ioctl, (intptr_t)r[1], 0xc4704437, 0x10000180); fprintf(stderr, "### call=7 errno=%u\n", res == -1 ? errno : 0); break; case 8: res = syscall(SYS_freebsd10_pipe, 0x100001c0); fprintf(stderr, "### call=8 errno=%u\n", res == -1 ? errno : 0); if (res != -1) r[2] = *(uint32_t*)0x100001c0; break; case 9: memcpy((void*)0x10000280, "\x35\xc4\xdf\x51\x5e\xd9\xa9\xee\xb6\x9a\x52\x63\x5d\x8f\xb8\xb6\x51\xcf\x39\x59\xfa\x23\x35\x03\x47\x4d\x88\x01\x70\xac\x5a\x6e\xff\x89\x83\xb1\xab\xf3\x3d\x2a\x2b\x68\xb4\x8a\xc3\xe0\x4d\x9f\x15\x76\x97\x6e\x9a\x20\x9e\xa4\xeb\x9d\xf0\x49\x2c\xb6\x0f\xff\x25\xf7\x05\xb2\x25\xe6\x05\x41\x43\x07\x74\x02\x4e\xd9\xa7\x79\x56\xcc\x1e\xe1\xaa\x49\x85\x28\x56\xdd\xe7\x98\xff\xf5\x7c\xf8\x5b\x44\xf6\x11\xe4\xf6\xa2\xf9\xb1\xc9\x17\x49\x57\x16\x4e\x7e\x83\xb5\xfc\x15\x2f\xe9\xee\xfb\x92\x91\xfc\xb5\xbb\x6d\xcc\x4f\x34\xbb\x92\x53\xbf\xdf\xb6\x85\xe0\xce\x6f\xd9\xf9\x91\x23\x21\xe7\xc9\x6a\xfa\x1e\x73\xb2\xc8\x49\xce\xf7\x30\xdb\xc0\xdc\xb0\xd1\xaa\x86\xb8\x10\xf5\x86\x58\xd4\x5c\xb3\x84\x71\x9b\x50\x17\xa8\xb4\x4b\x55\xd6\x21\xa3\x97\xf5\x39\x19\x03\x92\xa7\xfc\xc5\xa5\x45\xc7\xc9\x75\x9c\xd3\xbe\x71\x1e\xc9\x1a\xa7\xc1\xf0\x59\x03\x21\xd8\x39\x50\x0e\x0a\x00\x6b\x8f\xf5\xe7\xfa\xe1\x9d\x3f\xd8\x81\xb5\x2e\x0d\xcb\x79\xb9\x29\x36\xe6\x0c\xe9\xa7\x14\x63\x1a\x5a\x0f\x7c\x12\x2a\xe5\x3b\x27\xaf\xa9\x0f\xfd\xef\xfa\x18\x50\xc6\xb3\xbd\x71\x15\x55\x05\x3e\x45\x96\x27\xc8\x0b\x68\x1c\x3c\x8b\x88\x16\xc0\x91\x3e\x77\x2b\x05\xa8\x0f\xf7\x55\x6c\x80\xe8\x60\xe2\x46\x3d\xb4\xd5\xae\x7d\xd1\x1a\xf5\xa1\x5c\x83\xa6\x5c\xf7\x79\x5c\x97\x5d\x8b\x82\x7e\x5b\x62\xd0\x2a\xd5\x55\x72\x62\x3a\x90\xbf\x8a\xd0\xe8\xce\x52\xd6\xd0\x99\x42\x7a\x4a\xbf\xe8\x41\x98\xb6\x4d\xc2\x62\x31\xc8\x47\xd0\x38\x30\x2b\x7f\xe5\x58\xaa\xc4\xf2\xa7\xe9\x27\x4c\x8a\x9c\x3b\xe2\x63\xe2\x56\x5d\x82\x5f\x37\x9d\x55\xa3\x5b\xf4\x1d\x89\xe8\xc3\xfe\x9f\xf7\x64\x29\xe1\xda\xd1\xd7\xc2\x84\x41\x2b\xd3\x61\x44\xe5\x56\x26\xf1\x35\xfb\xe6\x58\x58\xa2\xc9\xd1\x32\x6f\x57\xb0\x4e\xab\x13\x01\xa0\x8b\xd6\xd6\x08\xb8\x94\xe7\x16\xfb\xc4\xcb\xb8\x9a\x8d\x96\xaf\xa8\xed\x32\x69\x70\xad\x2d\xcd\x74\x6a\x44\x58\x37\x15\x6b\x87\x98\x3e\xbc\x5f\xe5\x55\x40\xee\x34\x35\xa2\x00\x62\x29\x1f\xd8\x27\x52\x5f\xb5\xfd\xea\x7a\x33\x08\x0a\xcd\x05\x24\xab\x2d\x6b\xf8\x1f\xb7\x53\xbd\xbc\x76\x62\x69\x5c\x87\x8d\x22\xe4\xcc\x37\x76\xa1\x5e\x64\x75\x0c\xf4\x65\x4e\x25\x60\x9b\x0d\x6b\xbf\x0e\x36\x7d\xf5\x0f\x14\x3e\x7a\xda\x51\x21\xad\x9e\xdc\x7d\xa9\x68\x6b\xb8\x64\xd2\x78\x6a\x68\x4d\x2a\x84\xe2\xb0\x27\xa2\x60\x84\xc6\xd5\xf5\xaf\xd8\x9b\xd2\x5e\x1c\x6d\xad\x06\x74\xbd\x0f\x2b\x34\xda\x34\xc6\xf4\xd5\x4e\x80\xc9\xa4\x46\x75\xb5\xfa\xe4\x0a\x80\x50\x6a\x6d\xa8\xe7\x56\x9b\x9b\xff\x2f\x53\x9d\x8d\xe3\x40\x08\x7c\x58\x85\xbf\x05\x2d\x38\x61\xcc\xc4\xca\x85\xc3\x80\x83\xc7\x93\xf7\x8f\xf7\xb0\x18\xcb\x1b\xab\x2e\xc7\xe9\xe1\xd1\xb5\x92\x03\xbf\x15\xdd\xec\x6e\x99\x13\x9e\xac\x8f\xbd\x50\x55\xe6\x06\x11\xe3\x91\x93\xcd\x87\x5c\xd2\x13\xab\xa3\x4b\x3e\x0d\xdb\xc0\x50\x74\xf1\x75\x67\x70\xde\x1c\x1c\x8e\xfb\xf4\x55\x4b\xe8\x3b\xae\x0b\x3f\x5e\xe3\x0c\xd9\xa7\x71\xa6\x89\xf5\x24\x69\xce\xbf\x6c\x80\x1f\x8d\xe0\xea\xc5\xfe\x93\xc3\xc1\x35\x93\xe9\xda\xa5\xba\xd1\x28\x0b\x69\x5e\xf7\xe5\xbd\xc1\x5b\xa6\xb6\x99\x21\x83\xae\x6d\xa6\x4d\xe1\xe8\xd1\xea\xe9\xf1\x10\xcd\xb2\x5e\xdb\x6a\x7b\x12\x3f\x6c\x83\xcb\x48\xa3\xe1\x04\x5f\x28\x45\x93\xf7\xd6\xf2\x3e\x2a\x06\x85\x06\x44\x5a\x99\x38\x48\x6a\xd3\xb6\x76\xbe\x2f\xb1\x54\xeb\xcd\xe1\x51\x19\xd2\x96\xfc\xeb\x24\x13\x74\x5a\x8c\x54\x17\xb2\xac\x34\xb4\xf3\x55\xb3\x54\x9a\xa2\x23\xef\x2f\x34\x2e\x00\xa6\x37\xdb\x86\x16\x44\x2c\xa3\xa1\x80\xa5\x82\x5d\xff\x26\x03\xba\xd9\x06\x62\x54\x04\x67\x8f\xa3\xb3\x95\x91\xe1\x62\xe7\xff\x40\xad\xfe\x85\x66\xd6\x8e\xed\x8a\x19\x15\x3f\x19\xfc\x62\x94\x52\xe3\x0f\x06\x45\xaa\xfc\x1f\x4e\xb5\xde\xa9\xf3\xc6\xed\x6d\xdb\xc4\x44\x73\xcf\x89\x95\xd0\x33\xa2\xff\x0c\x0c\xdd\x53\x88\xce\x6e\xdb\x1e\x73\x2a\xa3\x83\x34\x6a\xca\x32\x97\xd8\x41\x74\xea\x8c\x6a\x3f\xb4\x08\x3f\x09\x12\x63\xac\x4c\x60\x62\xa8\x40\x1d\x16\x4b\xe2\xbf\xa2\x3e\x81\xf9\xbd\xa1\x48\x6c\x7f\xda\x45\xda\x44\xba\x46\xaf\xb5\x5f\x09\x46\xb4\x3e\x8d\x80\xf1\xfc\xce\xa2\x90\xac\x53\xaa\xdf\xa2\xd1\x09\xdb\x7d\x14\x93\xb1\x14\x69\x47\xd9\x6b\x87\x01\xe1\xf6\xa6\x18\x92\x16\x49\x12\x43\x0f\x75\x83\xff\x87\xe7\xdf\xa8\xbc\x61\x52\x0b\xdf\x7a\xfb\x54\x85\x30\x2a\x8e\x0d\xbc\x33\x2f\xce\x47\x36\xbe\xe8\x59\xc1\xc3\xd4\xb5\x08\x3e\xb5\x3a\xa0\x53\x2f\xb0\x72\x29\xe6", 1024); memcpy((void*)0x10000680, "\xfb\xf6\xbf\xee\x9c\x01\x09\x26\x52\xd2\xd6\x00\x83\x5f\x64\xf0\x98\x21\x02\x18\x9a\x56\xbb\x5d\x2a\xcd\x11\x57\xab\xac\xb3\x17", 32); *(uint32_t*)0x100006a0 = 0x100; *(uint8_t*)0x100006a4 = 1; *(uint32_t*)0x100006a8 = 0x10000200; memcpy((void*)0x10000200, "\x4b\x41\x8f\xea\x2c\xea\x20\x6a\xe3\x91\xe4\x4a\x50\x4f\xce\xeb\x9d\xa1\x14\x53\xe3\xc0\x30\x3b\x6f\xbf\xdc\x92\x8a\x74\x70\xeb\x0c\x32\x40\xc7\x5c\x0c\x35\x13\x4c\xaa\xc7\x71\x9b\x58\x49\x27\x4b\xbc\x0f\x0b\x76\xd2\xcd\xbd\x61\x27\xf3\x48\xd9\x9c\xf7\x1d\x49\x62\x57\x99\x66\xd7\x43\x12\x6e\xf7\xb1\x39\xbc\x72\x93\x27\xc6\xe2\x01\x8d\x2c\x24\xa1\xcd\xf8\x8b\x21\x31\x17\x40\x44\x95\xff\x0c\xcb\x9e\x35\x49\x39\x0c\x33\xe4\xfa\x7e\xf5\x04\xf7\x6d\x2c\x9d\xca\xd0\x50\x27\x73\xb1\xe6\xe2\xee", 123); *(uint64_t*)0x100006ac = 0xffffffff; *(uint64_t*)0x100006b4 = 7; *(uint64_t*)0x100006bc = 0x20; *(uint64_t*)0x100006c4 = 0x200; *(uint64_t*)0x100006cc = 0; *(uint64_t*)0x100006d4 = 7; *(uint64_t*)0x100006dc = 0x887f; *(uint32_t*)0x100006e4 = 0x7ff; res = syscall(SYS_ioctl, (intptr_t)r[2], 0xc4504449, 0x10000280); fprintf(stderr, "### call=9 errno=%u\n", res == -1 ? errno : 0); break; case 10: (void)res; if (res != -1) r[3] = *(uint32_t*)0x10000004; break; case 11: *(uint8_t*)0x10000040 = 0xaa; *(uint8_t*)0x10000041 = 0xaa; *(uint8_t*)0x10000042 = 0xaa; *(uint8_t*)0x10000043 = 0xaa; *(uint8_t*)0x10000044 = 0xaa; *(uint8_t*)0x10000045 = 0xaa; *(uint8_t*)0x10000046 = 0; *(uint8_t*)0x10000047 = 0; *(uint8_t*)0x10000048 = 0; *(uint8_t*)0x10000049 = 0; *(uint8_t*)0x1000004a = 0; *(uint8_t*)0x1000004b = 0; *(uint16_t*)0x1000004c = htobe16(0x800); STORE_BY_BITMASK(uint8_t, , 0x1000004e, 0x24, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x1000004e, 4, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x1000004f, 1, 0, 2); STORE_BY_BITMASK(uint8_t, , 0x1000004f, 7, 2, 6); *(uint16_t*)0x10000050 = htobe16(0x1c1); *(uint16_t*)0x10000052 = htobe16(0x66); *(uint16_t*)0x10000054 = htobe16(0xc7c); *(uint8_t*)0x10000056 = 0x40; *(uint8_t*)0x10000057 = 0x2e; *(uint16_t*)0x10000058 = htobe16(0); *(uint32_t*)0x1000005a = htobe32(0xe0000002); *(uint32_t*)0x1000005e = htobe32(0x7f000001); *(uint8_t*)0x10000062 = 0; *(uint8_t*)0x10000063 = 7; *(uint8_t*)0x10000064 = 0xb; *(uint8_t*)0x10000065 = 9; *(uint32_t*)0x10000066 = htobe32(0xe0000002); *(uint32_t*)0x1000006a = htobe32(0xe0000002); *(uint8_t*)0x1000006e = 0x89; *(uint8_t*)0x1000006f = 7; *(uint8_t*)0x10000070 = 0x7f; *(uint8_t*)0x10000071 = 0xac; *(uint8_t*)0x10000072 = 0x14; *(uint8_t*)0x10000073 = 0; *(uint8_t*)0x10000074 = 0xaa; *(uint8_t*)0x10000075 = 1; *(uint8_t*)0x10000076 = 7; *(uint8_t*)0x10000077 = 0xb; *(uint8_t*)0x10000078 = 0x1f; *(uint8_t*)0x10000079 = 0xac; *(uint8_t*)0x1000007a = 0x14; *(uint8_t*)0x1000007b = 0; *(uint8_t*)0x1000007c = 0xaa; *(uint32_t*)0x1000007d = htobe32(0); *(uint8_t*)0x10000081 = 0x83; *(uint8_t*)0x10000082 = 0xb; *(uint8_t*)0x10000083 = 0; *(uint32_t*)0x10000084 = htobe32(0xe0000002); *(uint32_t*)0x10000088 = htobe32(0); *(uint8_t*)0x1000008c = 0; *(uint8_t*)0x1000008d = 0x83; *(uint8_t*)0x1000008e = 0xf; *(uint8_t*)0x1000008f = 0x96; *(uint32_t*)0x10000090 = htobe32(0x7f000001); *(uint32_t*)0x10000094 = htobe32(0xe0000002); *(uint32_t*)0x10000098 = htobe32(0xe0000002); *(uint8_t*)0x1000009c = 7; *(uint8_t*)0x1000009d = 7; *(uint8_t*)0x1000009e = 0; *(uint32_t*)0x1000009f = htobe32(0xe0000002); *(uint8_t*)0x100000a3 = 0x44; *(uint8_t*)0x100000a4 = 0x38; *(uint8_t*)0x100000a5 = 2; STORE_BY_BITMASK(uint8_t, , 0x100000a6, 1, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x100000a6, 7, 4, 4); *(uint32_t*)0x100000a7 = htobe32(0); *(uint32_t*)0x100000ab = htobe32(2); *(uint8_t*)0x100000af = 0xac; *(uint8_t*)0x100000b0 = 0x14; *(uint8_t*)0x100000b1 = 0; *(uint8_t*)0x100000b2 = 0xaa; *(uint32_t*)0x100000b3 = htobe32(0x1f); *(uint32_t*)0x100000b7 = htobe32(0xe0000001); *(uint32_t*)0x100000bb = htobe32(0); *(uint32_t*)0x100000bf = htobe32(7); *(uint32_t*)0x100000c3 = htobe32(0x3ff); *(uint32_t*)0x100000c7 = htobe32(0x3b6); *(uint32_t*)0x100000cb = htobe32(0x7f000001); *(uint32_t*)0x100000cf = htobe32(0xfffffbaf); *(uint32_t*)0x100000d3 = htobe32(0x7f000001); *(uint32_t*)0x100000d7 = htobe32(0x400); *(uint16_t*)0x100000de = htobe16(0x4e20); *(uint16_t*)0x100000e0 = htobe16(0x4e21); *(uint32_t*)0x100000e2 = r[3]; *(uint32_t*)0x100000e6 = 0x41424344; STORE_BY_BITMASK(uint8_t, , 0x100000ea, 0, 0, 1); STORE_BY_BITMASK(uint8_t, , 0x100000ea, 0, 1, 3); STORE_BY_BITMASK(uint8_t, , 0x100000ea, 0x10, 4, 4); *(uint8_t*)0x100000eb = 8; *(uint16_t*)0x100000ec = htobe16(0x8001); *(uint16_t*)0x100000ee = htobe16(0); *(uint16_t*)0x100000f0 = htobe16(6); *(uint8_t*)0x100000f2 = 0; *(uint8_t*)0x100000f3 = 2; *(uint8_t*)0x100000f4 = 4; *(uint16_t*)0x100000f5 = htobe16(0xf13); *(uint8_t*)0x100000f7 = 5; *(uint8_t*)0x100000f8 = 0x26; *(uint32_t*)0x100000f9 = htobe32(0x3f); *(uint32_t*)0x100000fd = htobe32(6); *(uint32_t*)0x10000101 = htobe32(8); *(uint32_t*)0x10000105 = htobe32(6); *(uint32_t*)0x10000109 = htobe32(8); *(uint32_t*)0x1000010d = htobe32(8); *(uint32_t*)0x10000111 = htobe32(0x20); *(uint32_t*)0x10000115 = htobe32(0x8001); *(uint32_t*)0x10000119 = htobe32(0xfffffff7); memcpy((void*)0x1000011e, "\xb9\x8e\xed\x1b\xfb\x3a\x0d\x46\xc5\x41\xa8\x52\x1f\xa4\xb5\x20\x40\x51\xe2\x1c\xdf\x38\xcb\x70\x77\xdb\x0f\x27\x16\x03\x9b\xa5\xc2\x45\x69\xc2\x3b\x4e\x18\xe6\x01\x52\xf0\x8a\x56\xa0\xb8\x13\x62\x42\x30\xb5\x7b\x8c\x73\x00\x1a\x7c\x09\xee\x6b\x29\xab\x9c\xa3\x12\x48\xef\x28\xd1\xde\x0b\xdc\x63\x24\x74\x83\xe0\x51\xe8\xc7\x28\x11\xf9\xb4\x21\x22\xdc\xe1\xb1\x36\x57\xa9\x9a\x08\xd7\x95\x64\xf0\x09\x61\xf5\x46\xb5\x9c\x7c\x01\x94\x6e\x8c\xd5\xfe\x48\x05\xc8\x7d\xbb\x5c\xca\xfb\xfd\xe1\x8a\x4b\x99\xd3\x06\x97\xca\xc4\x45\x42\x8a\x4a\x0f\xd5\xb4\x6b\x18\x71\x99\xc3\x4a\x93\xb2\xbd\x70\x6b\x47\x0c\xf0\xc6\x9d\xf6\x0a\x28\xdc\x68\xbc\x42\x60\x08\x96\x5b\x0d\xfd\x74\xa4\xaa\x29\xb6\xb7\x99\x18\xec\xc6\x78\x41\x9a\xc3\xff\x8f\x7e\x25\x45\xb5\xe2\x08\xb7\x29\x51\xd8\x14\xf6\x93\x69\x3b\x7b\x0e\x40\x52\x36\x64\xf3\x96\x34\x76\x31\xf0\xf1\x98\xa0\xea\xd9\xb8\xa9\x3c\xae\x36\xe7\x49\x09\x18\x0a\x23\x70\xfe\x72\xfe\xde\x65\xb7\x47\xad\x92\xb5\x46\x71\xa1\x25\xf1", 241); struct csum_inet csum_1; csum_inet_init(&csum_1); csum_inet_update(&csum_1, (const uint8_t*)0x1000005a, 4); csum_inet_update(&csum_1, (const uint8_t*)0x1000005e, 4); uint16_t csum_1_chunk_2 = 0x600; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_2, 2); uint16_t csum_1_chunk_3 = 0x3101; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_3, 2); csum_inet_update(&csum_1, (const uint8_t*)0x100000de, 305); *(uint16_t*)0x100000ee = csum_inet_digest(&csum_1); struct csum_inet csum_2; csum_inet_init(&csum_2); csum_inet_update(&csum_2, (const uint8_t*)0x1000004e, 144); *(uint16_t*)0x10000058 = csum_inet_digest(&csum_2); (void)res; break; case 12: memcpy((void*)0x10000240, "\xc4\xc1\xed\x14\xa5\x59\xab\x32\xeb\xd0\xd5\x36\x64\x66\x67\x66\x66\x0f\x38\xf6\x6b\x0f\xc4\xc2\x61\xbe\xed\xc4\xe2\x01\xba\xef\x0f\x18\xd1\xc4\xe2\x01\xa8\xa8\xe1\x40\x00\x00\xc4\xe1\x69\xe5\xb1\x4d\x41\xb9\xa0\xde\xe9\x0f\x38\xca\x23", 59); res = -1; errno = EFAULT; res = syz_execute_func(0x10000240); fprintf(stderr, "### call=12 errno=%u\n", res == -1 ? errno : 0); break; case 13: (void)res; break; } } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); use_temporary_dir(); do_sandbox_none(); return 0; } :360:17: error: use of undeclared identifier 'SYS_shm_rename' res = syscall(SYS_shm_rename, 0x10000100, 0x10000140, 6); ^ 1 error generated. compiler invocation: clang [-o /tmp/syz-executor971448747 -DGOOS_freebsd=1 -DGOARCH_386=1 -DHOSTGOOS_freebsd=1 -x c - -m32 -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -static -lc++ -Wno-overflow] --- FAIL: TestGenerate/freebsd/386/12 (1.70s) csource_test.go:122: opts: {Threaded:true Collide:false Repeat:true RepeatTimes:0 Procs:0 Sandbox:none Fault:false FaultCall:0 FaultNth:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false UseTmpDir:true HandleSegv:false Repro:true Trace:false} program: truncate(&(0x7f0000000000)='./file0\x00', 0x0) socket$inet(0x2, 0x4, 0x81) freebsd10_pipe(&(0x7f0000000040)={0xffffffffffffffff, 0xffffffffffffffff}) freebsd11_mknodat(r0, &(0x7f0000000080)='./file0\x00', 0x40, 0x4) chflags(&(0x7f00000000c0)='./file0\x00', 0x110212) shm_rename(&(0x7f0000000100)='./file0\x00', &(0x7f0000000140)='./file0\x00', 0x6) r1 = dup2(0xffffffffffffffff, 0xffffffffffffff9c) ioctl$DIOCCHANGEADDR(r1, 0xc4704437, &(0x7f0000000180)="9d61632459f011108aca181da4cc8372b78dcda5") freebsd10_pipe(&(0x7f00000001c0)={0xffffffffffffffff}) ioctl$DIOCRTSTADDRS(r2, 0xc4504449, &(0x7f0000000280)={{"35c4df515ed9a9eeb69a52635d8fb8b651cf3959fa233503474d880170ac5a6eff8983b1abf33d2a2b68b48ac3e04d9f1576976e9a209ea4eb9df0492cb60fff25f705b225e60541430774024ed9a77956cc1ee1aa49852856dde798fff57cf85b44f611e4f6a2f9b1c9174957164e7e83b5fc152fe9eefb9291fcb5bb6dcc4f34bb9253bfdfb685e0ce6fd9f9912321e7c96afa1e73b2c849cef730dbc0dcb0d1aa86b810f58658d45cb384719b5017a8b44b55d621a397f539190392a7fcc5a545c7c9759cd3be711ec91aa7c1f0590321d839500e0a006b8ff5e7fae19d3fd881b52e0dcb79b92936e60ce9a714631a5a0f7c122ae53b27afa90ffdeffa1850c6b3bd711555053e459627c80b681c3c8b8816c0913e772b05a80ff7556c80e860e2463db4d5ae7dd11af5a15c83a65cf7795c975d8b827e5b62d02ad55572623a90bf8ad0e8ce52d6d099427a4abfe84198b64dc26231c847d038302b7fe558aac4f2a7e9274c8a9c3be263e2565d825f379d55a35bf41d89e8c3fe9ff76429e1dad1d7c284412bd36144e55626f135fbe65858a2c9d1326f57b04eab1301a08bd6d608b894e716fbc4cbb89a8d96afa8ed326970ad2dcd746a445837156b87983ebc5fe55540ee3435a20062291fd827525fb5fdea7a33080acd0524ab2d6bf81fb753bdbc7662695c878d22e4cc3776a15e64750cf4654e25609b0d6bbf0e367df50f143e7ada5121ad9edc7da9686bb864d2786a684d2a84e2b027a26084c6d5f5afd89bd25e1c6dad0674bd0f2b34da34c6f4d54e80c9a44675b5fae40a80506a6da8e7569b9bff2f539d8de340087c5885bf052d3861ccc4ca85c38083c793f78ff7b018cb1bab2ec7e9e1d1b59203bf15ddec6e99139eac8fbd5055e60611e39193cd875cd213aba34b3e0ddbc05074f1756770de1c1c8efbf4554be83bae0b3f5ee30cd9a771a689f52469cebf6c801f8de0eac5fe93c3c13593e9daa5bad1280b695ef7e5bdc15ba6b6992183ae6da64de1e8d1eae9f110cdb25edb6a7b123f6c83cb48a3e1045f284593f7d6f23e2a068506445a9938486ad3b676be2fb154ebcde15119d296fceb2413745a8c5417b2ac34b4f355b3549aa223ef2f342e00a637db8616442ca3a180a5825dff2603bad906625404678fa3b39591e162e7ff40adfe8566d68eed8a19153f19fc629452e30f0645aafc1f4eb5dea9f3c6ed6ddbc44473cf8995d033a2ff0c0cdd5388ce6edb1e732aa383346aca3297d84174ea8c6a3fb4083f091263ac4c6062a8401d164be2bfa23e81f9bda1486c7fda45da44ba46afb55f0946b43e8d80f1fccea290ac53aadfa2d109db7d1493b1146947d96b8701e1f6a61892164912430f7583ff87e7dfa8bc61520bdf7afb5485302a8e0dbc332fce4736bee859c1c3d4b5083eb53aa0532fb07229e6", "fbf6bfee9c01092652d2d600835f64f0982102189a56bb5d2acd1157abacb317", 0x100, 0x1}, &(0x7f0000000200)="4b418fea2cea206ae391e44a504fceeb9da11453e3c0303b6fbfdc928a7470eb0c3240c75c0c35134caac7719b5849274bbc0f0b76d2cdbd6127f348d99cf71d4962579966d743126ef7b139bc729327c6e2018d2c24a1cdf88b213117404495ff0ccb9e3549390c33e4fa7ef504f76d2c9dcad0502773b1e6e2ee", 0xffffffff, 0x7, 0x20, 0x200, 0x0, 0x7, 0x887f, 0x7ff}) syz_extract_tcp_res(&(0x7f0000000000)={0x41424344, 0x41424344}, 0x4, 0x40) syz_emit_ethernet(0x1cf, &(0x7f0000000040)={@local, @empty, [], {@ipv4={0x800, {{0x24, 0x4, 0x1, 0x7, 0x1c1, 0x66, 0xc7c, 0x40, 0x2e, 0x0, @multicast2, @loopback, {[@end, @rr={0x7, 0xb, 0x9, [@multicast2, @multicast2]}, @ssrr={0x89, 0x7, 0x7f, [@local={0xac, 0x14, 0x0}]}, @noop, @rr={0x7, 0xb, 0x1f, [@local={0xac, 0x14, 0x0}, @empty]}, @lsrr={0x83, 0xb, 0x0, [@multicast2, @empty]}, @end, @lsrr={0x83, 0xf, 0x96, [@loopback, @multicast2, @multicast2]}, @rr={0x7, 0x7, 0x0, [@multicast2]}, @timestamp={0x44, 0x38, 0x2, 0x1, 0x7, [{[@empty], 0x2}, {[@local={0xac, 0x14, 0x0}], 0x1f}, {[@multicast1]}, {[], 0x7}, {[], 0x3ff}, {[], 0x3b6}, {[@loopback], 0xfffffbaf}, {[@loopback], 0x400}]}]}}, @tcp={{0x0, 0x1, r3, 0x41424344, 0x0, 0x0, 0x10, 0x8, 0x8001, 0x0, 0x6, {[@eol, @mss={0x2, 0x4, 0xf13}, @sack={0x5, 0x26, [0x3f, 0x6, 0x8, 0x6, 0x8, 0x8, 0x20, 0x8001, 0xfffffff7]}]}}, {"b98eed1bfb3a0d46c541a8521fa4b5204051e21cdf38cb7077db0f2716039ba5c24569c23b4e18e60152f08a56a0b813624230b57b8c73001a7c09ee6b29ab9ca31248ef28d1de0bdc63247483e051e8c72811f9b42122dce1b13657a99a08d79564f00961f546b59c7c01946e8cd5fe4805c87dbb5ccafbfde18a4b99d30697cac445428a4a0fd5b46b187199c34a93b2bd706b470cf0c69df60a28dc68bc426008965b0dfd74a4aa29b6b79918ecc678419ac3ff8f7e2545b5e208b72951d814f693693b7b0e40523664f396347631f0f198a0ead9b8a93cae36e74909180a2370fe72fede65b747ad92b54671a125f1"}}}}}}) syz_execute_func(&(0x7f0000000240)="c4c1ed14a559ab32ebd0d53664666766660f38f66b0fc4c261beedc4e201baef0f18d1c4e201a8a8e1400000c4e169e5b14d41b9a0dee90f38ca23") syz_extract_tcp_res(&(0x7f0000000280), 0x4df9f115, 0x2) csource_test.go:123: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void remove_dir(const char* dir) { DIR* dp; struct dirent* ep; dp = opendir(dir); if (dp == NULL) exit(1); while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } if (unlink(filename)) exit(1); } closedir(dp); if (rmdir(dir)) exit(1); } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i; for (i = 0; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { pthread_mutex_t mu; pthread_cond_t cv; int state; } event_t; static void event_init(event_t* ev) { if (pthread_mutex_init(&ev->mu, 0)) exit(1); if (pthread_cond_init(&ev->cv, 0)) exit(1); ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { pthread_mutex_lock(&ev->mu); if (ev->state) exit(1); ev->state = 1; pthread_mutex_unlock(&ev->mu); pthread_cond_broadcast(&ev->cv); } static void event_wait(event_t* ev) { pthread_mutex_lock(&ev->mu); while (!ev->state) pthread_cond_wait(&ev->cv, &ev->mu); pthread_mutex_unlock(&ev->mu); } static int event_isset(event_t* ev) { pthread_mutex_lock(&ev->mu); int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; pthread_mutex_lock(&ev->mu); for (;;) { if (ev->state) break; uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); now = current_time_ms(); if (now - start > timeout) break; } int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } #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; for (i = 0; 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) { volatile long p[8] = {0}; (void)p; ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } int i, call, thread; for (call = 0; call < 14; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); event_timedwait(&th->done, 45); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); #define WAIT_FLAGS 0 static void loop(void) { int iter; for (iter = 0;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5 * 1000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x41424344}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: memcpy((void*)0x10000000, "./file0\000", 8); syscall(SYS_truncate, 0x10000000, 0); break; case 1: syscall(SYS_socket, 2, 4, 0x81); break; case 2: res = syscall(SYS_freebsd10_pipe, 0x10000040); if (res != -1) r[0] = *(uint32_t*)0x10000044; break; case 3: memcpy((void*)0x10000080, "./file0\000", 8); syscall(SYS_freebsd11_mknodat, (intptr_t)r[0], 0x10000080, 0x40, 4); break; case 4: memcpy((void*)0x100000c0, "./file0\000", 8); syscall(SYS_chflags, 0x100000c0, 0x110212); break; case 5: memcpy((void*)0x10000100, "./file0\000", 8); memcpy((void*)0x10000140, "./file0\000", 8); syscall(SYS_shm_rename, 0x10000100, 0x10000140, 6); break; case 6: res = syscall(SYS_dup2, -1, 0xffffff9c); if (res != -1) r[1] = res; break; case 7: memcpy((void*)0x10000180, "\x9d\x61\x63\x24\x59\xf0\x11\x10\x8a\xca\x18\x1d\xa4\xcc\x83\x72\xb7\x8d\xcd\xa5", 20); syscall(SYS_ioctl, (intptr_t)r[1], 0xc4704437, 0x10000180); break; case 8: res = syscall(SYS_freebsd10_pipe, 0x100001c0); if (res != -1) r[2] = *(uint32_t*)0x100001c0; break; case 9: memcpy((void*)0x10000280, "\x35\xc4\xdf\x51\x5e\xd9\xa9\xee\xb6\x9a\x52\x63\x5d\x8f\xb8\xb6\x51\xcf\x39\x59\xfa\x23\x35\x03\x47\x4d\x88\x01\x70\xac\x5a\x6e\xff\x89\x83\xb1\xab\xf3\x3d\x2a\x2b\x68\xb4\x8a\xc3\xe0\x4d\x9f\x15\x76\x97\x6e\x9a\x20\x9e\xa4\xeb\x9d\xf0\x49\x2c\xb6\x0f\xff\x25\xf7\x05\xb2\x25\xe6\x05\x41\x43\x07\x74\x02\x4e\xd9\xa7\x79\x56\xcc\x1e\xe1\xaa\x49\x85\x28\x56\xdd\xe7\x98\xff\xf5\x7c\xf8\x5b\x44\xf6\x11\xe4\xf6\xa2\xf9\xb1\xc9\x17\x49\x57\x16\x4e\x7e\x83\xb5\xfc\x15\x2f\xe9\xee\xfb\x92\x91\xfc\xb5\xbb\x6d\xcc\x4f\x34\xbb\x92\x53\xbf\xdf\xb6\x85\xe0\xce\x6f\xd9\xf9\x91\x23\x21\xe7\xc9\x6a\xfa\x1e\x73\xb2\xc8\x49\xce\xf7\x30\xdb\xc0\xdc\xb0\xd1\xaa\x86\xb8\x10\xf5\x86\x58\xd4\x5c\xb3\x84\x71\x9b\x50\x17\xa8\xb4\x4b\x55\xd6\x21\xa3\x97\xf5\x39\x19\x03\x92\xa7\xfc\xc5\xa5\x45\xc7\xc9\x75\x9c\xd3\xbe\x71\x1e\xc9\x1a\xa7\xc1\xf0\x59\x03\x21\xd8\x39\x50\x0e\x0a\x00\x6b\x8f\xf5\xe7\xfa\xe1\x9d\x3f\xd8\x81\xb5\x2e\x0d\xcb\x79\xb9\x29\x36\xe6\x0c\xe9\xa7\x14\x63\x1a\x5a\x0f\x7c\x12\x2a\xe5\x3b\x27\xaf\xa9\x0f\xfd\xef\xfa\x18\x50\xc6\xb3\xbd\x71\x15\x55\x05\x3e\x45\x96\x27\xc8\x0b\x68\x1c\x3c\x8b\x88\x16\xc0\x91\x3e\x77\x2b\x05\xa8\x0f\xf7\x55\x6c\x80\xe8\x60\xe2\x46\x3d\xb4\xd5\xae\x7d\xd1\x1a\xf5\xa1\x5c\x83\xa6\x5c\xf7\x79\x5c\x97\x5d\x8b\x82\x7e\x5b\x62\xd0\x2a\xd5\x55\x72\x62\x3a\x90\xbf\x8a\xd0\xe8\xce\x52\xd6\xd0\x99\x42\x7a\x4a\xbf\xe8\x41\x98\xb6\x4d\xc2\x62\x31\xc8\x47\xd0\x38\x30\x2b\x7f\xe5\x58\xaa\xc4\xf2\xa7\xe9\x27\x4c\x8a\x9c\x3b\xe2\x63\xe2\x56\x5d\x82\x5f\x37\x9d\x55\xa3\x5b\xf4\x1d\x89\xe8\xc3\xfe\x9f\xf7\x64\x29\xe1\xda\xd1\xd7\xc2\x84\x41\x2b\xd3\x61\x44\xe5\x56\x26\xf1\x35\xfb\xe6\x58\x58\xa2\xc9\xd1\x32\x6f\x57\xb0\x4e\xab\x13\x01\xa0\x8b\xd6\xd6\x08\xb8\x94\xe7\x16\xfb\xc4\xcb\xb8\x9a\x8d\x96\xaf\xa8\xed\x32\x69\x70\xad\x2d\xcd\x74\x6a\x44\x58\x37\x15\x6b\x87\x98\x3e\xbc\x5f\xe5\x55\x40\xee\x34\x35\xa2\x00\x62\x29\x1f\xd8\x27\x52\x5f\xb5\xfd\xea\x7a\x33\x08\x0a\xcd\x05\x24\xab\x2d\x6b\xf8\x1f\xb7\x53\xbd\xbc\x76\x62\x69\x5c\x87\x8d\x22\xe4\xcc\x37\x76\xa1\x5e\x64\x75\x0c\xf4\x65\x4e\x25\x60\x9b\x0d\x6b\xbf\x0e\x36\x7d\xf5\x0f\x14\x3e\x7a\xda\x51\x21\xad\x9e\xdc\x7d\xa9\x68\x6b\xb8\x64\xd2\x78\x6a\x68\x4d\x2a\x84\xe2\xb0\x27\xa2\x60\x84\xc6\xd5\xf5\xaf\xd8\x9b\xd2\x5e\x1c\x6d\xad\x06\x74\xbd\x0f\x2b\x34\xda\x34\xc6\xf4\xd5\x4e\x80\xc9\xa4\x46\x75\xb5\xfa\xe4\x0a\x80\x50\x6a\x6d\xa8\xe7\x56\x9b\x9b\xff\x2f\x53\x9d\x8d\xe3\x40\x08\x7c\x58\x85\xbf\x05\x2d\x38\x61\xcc\xc4\xca\x85\xc3\x80\x83\xc7\x93\xf7\x8f\xf7\xb0\x18\xcb\x1b\xab\x2e\xc7\xe9\xe1\xd1\xb5\x92\x03\xbf\x15\xdd\xec\x6e\x99\x13\x9e\xac\x8f\xbd\x50\x55\xe6\x06\x11\xe3\x91\x93\xcd\x87\x5c\xd2\x13\xab\xa3\x4b\x3e\x0d\xdb\xc0\x50\x74\xf1\x75\x67\x70\xde\x1c\x1c\x8e\xfb\xf4\x55\x4b\xe8\x3b\xae\x0b\x3f\x5e\xe3\x0c\xd9\xa7\x71\xa6\x89\xf5\x24\x69\xce\xbf\x6c\x80\x1f\x8d\xe0\xea\xc5\xfe\x93\xc3\xc1\x35\x93\xe9\xda\xa5\xba\xd1\x28\x0b\x69\x5e\xf7\xe5\xbd\xc1\x5b\xa6\xb6\x99\x21\x83\xae\x6d\xa6\x4d\xe1\xe8\xd1\xea\xe9\xf1\x10\xcd\xb2\x5e\xdb\x6a\x7b\x12\x3f\x6c\x83\xcb\x48\xa3\xe1\x04\x5f\x28\x45\x93\xf7\xd6\xf2\x3e\x2a\x06\x85\x06\x44\x5a\x99\x38\x48\x6a\xd3\xb6\x76\xbe\x2f\xb1\x54\xeb\xcd\xe1\x51\x19\xd2\x96\xfc\xeb\x24\x13\x74\x5a\x8c\x54\x17\xb2\xac\x34\xb4\xf3\x55\xb3\x54\x9a\xa2\x23\xef\x2f\x34\x2e\x00\xa6\x37\xdb\x86\x16\x44\x2c\xa3\xa1\x80\xa5\x82\x5d\xff\x26\x03\xba\xd9\x06\x62\x54\x04\x67\x8f\xa3\xb3\x95\x91\xe1\x62\xe7\xff\x40\xad\xfe\x85\x66\xd6\x8e\xed\x8a\x19\x15\x3f\x19\xfc\x62\x94\x52\xe3\x0f\x06\x45\xaa\xfc\x1f\x4e\xb5\xde\xa9\xf3\xc6\xed\x6d\xdb\xc4\x44\x73\xcf\x89\x95\xd0\x33\xa2\xff\x0c\x0c\xdd\x53\x88\xce\x6e\xdb\x1e\x73\x2a\xa3\x83\x34\x6a\xca\x32\x97\xd8\x41\x74\xea\x8c\x6a\x3f\xb4\x08\x3f\x09\x12\x63\xac\x4c\x60\x62\xa8\x40\x1d\x16\x4b\xe2\xbf\xa2\x3e\x81\xf9\xbd\xa1\x48\x6c\x7f\xda\x45\xda\x44\xba\x46\xaf\xb5\x5f\x09\x46\xb4\x3e\x8d\x80\xf1\xfc\xce\xa2\x90\xac\x53\xaa\xdf\xa2\xd1\x09\xdb\x7d\x14\x93\xb1\x14\x69\x47\xd9\x6b\x87\x01\xe1\xf6\xa6\x18\x92\x16\x49\x12\x43\x0f\x75\x83\xff\x87\xe7\xdf\xa8\xbc\x61\x52\x0b\xdf\x7a\xfb\x54\x85\x30\x2a\x8e\x0d\xbc\x33\x2f\xce\x47\x36\xbe\xe8\x59\xc1\xc3\xd4\xb5\x08\x3e\xb5\x3a\xa0\x53\x2f\xb0\x72\x29\xe6", 1024); memcpy((void*)0x10000680, "\xfb\xf6\xbf\xee\x9c\x01\x09\x26\x52\xd2\xd6\x00\x83\x5f\x64\xf0\x98\x21\x02\x18\x9a\x56\xbb\x5d\x2a\xcd\x11\x57\xab\xac\xb3\x17", 32); *(uint32_t*)0x100006a0 = 0x100; *(uint8_t*)0x100006a4 = 1; *(uint32_t*)0x100006a8 = 0x10000200; memcpy((void*)0x10000200, "\x4b\x41\x8f\xea\x2c\xea\x20\x6a\xe3\x91\xe4\x4a\x50\x4f\xce\xeb\x9d\xa1\x14\x53\xe3\xc0\x30\x3b\x6f\xbf\xdc\x92\x8a\x74\x70\xeb\x0c\x32\x40\xc7\x5c\x0c\x35\x13\x4c\xaa\xc7\x71\x9b\x58\x49\x27\x4b\xbc\x0f\x0b\x76\xd2\xcd\xbd\x61\x27\xf3\x48\xd9\x9c\xf7\x1d\x49\x62\x57\x99\x66\xd7\x43\x12\x6e\xf7\xb1\x39\xbc\x72\x93\x27\xc6\xe2\x01\x8d\x2c\x24\xa1\xcd\xf8\x8b\x21\x31\x17\x40\x44\x95\xff\x0c\xcb\x9e\x35\x49\x39\x0c\x33\xe4\xfa\x7e\xf5\x04\xf7\x6d\x2c\x9d\xca\xd0\x50\x27\x73\xb1\xe6\xe2\xee", 123); *(uint64_t*)0x100006ac = 0xffffffff; *(uint64_t*)0x100006b4 = 7; *(uint64_t*)0x100006bc = 0x20; *(uint64_t*)0x100006c4 = 0x200; *(uint64_t*)0x100006cc = 0; *(uint64_t*)0x100006d4 = 7; *(uint64_t*)0x100006dc = 0x887f; *(uint32_t*)0x100006e4 = 0x7ff; syscall(SYS_ioctl, (intptr_t)r[2], 0xc4504449, 0x10000280); break; case 10: if (res != -1) r[3] = *(uint32_t*)0x10000004; break; case 11: *(uint8_t*)0x10000040 = 0xaa; *(uint8_t*)0x10000041 = 0xaa; *(uint8_t*)0x10000042 = 0xaa; *(uint8_t*)0x10000043 = 0xaa; *(uint8_t*)0x10000044 = 0xaa; *(uint8_t*)0x10000045 = 0xaa; *(uint8_t*)0x10000046 = 0; *(uint8_t*)0x10000047 = 0; *(uint8_t*)0x10000048 = 0; *(uint8_t*)0x10000049 = 0; *(uint8_t*)0x1000004a = 0; *(uint8_t*)0x1000004b = 0; *(uint16_t*)0x1000004c = htobe16(0x800); STORE_BY_BITMASK(uint8_t, , 0x1000004e, 0x24, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x1000004e, 4, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x1000004f, 1, 0, 2); STORE_BY_BITMASK(uint8_t, , 0x1000004f, 7, 2, 6); *(uint16_t*)0x10000050 = htobe16(0x1c1); *(uint16_t*)0x10000052 = htobe16(0x66); *(uint16_t*)0x10000054 = htobe16(0xc7c); *(uint8_t*)0x10000056 = 0x40; *(uint8_t*)0x10000057 = 0x2e; *(uint16_t*)0x10000058 = htobe16(0); *(uint32_t*)0x1000005a = htobe32(0xe0000002); *(uint32_t*)0x1000005e = htobe32(0x7f000001); *(uint8_t*)0x10000062 = 0; *(uint8_t*)0x10000063 = 7; *(uint8_t*)0x10000064 = 0xb; *(uint8_t*)0x10000065 = 9; *(uint32_t*)0x10000066 = htobe32(0xe0000002); *(uint32_t*)0x1000006a = htobe32(0xe0000002); *(uint8_t*)0x1000006e = 0x89; *(uint8_t*)0x1000006f = 7; *(uint8_t*)0x10000070 = 0x7f; *(uint8_t*)0x10000071 = 0xac; *(uint8_t*)0x10000072 = 0x14; *(uint8_t*)0x10000073 = 0; *(uint8_t*)0x10000074 = 0xaa; *(uint8_t*)0x10000075 = 1; *(uint8_t*)0x10000076 = 7; *(uint8_t*)0x10000077 = 0xb; *(uint8_t*)0x10000078 = 0x1f; *(uint8_t*)0x10000079 = 0xac; *(uint8_t*)0x1000007a = 0x14; *(uint8_t*)0x1000007b = 0; *(uint8_t*)0x1000007c = 0xaa; *(uint32_t*)0x1000007d = htobe32(0); *(uint8_t*)0x10000081 = 0x83; *(uint8_t*)0x10000082 = 0xb; *(uint8_t*)0x10000083 = 0; *(uint32_t*)0x10000084 = htobe32(0xe0000002); *(uint32_t*)0x10000088 = htobe32(0); *(uint8_t*)0x1000008c = 0; *(uint8_t*)0x1000008d = 0x83; *(uint8_t*)0x1000008e = 0xf; *(uint8_t*)0x1000008f = 0x96; *(uint32_t*)0x10000090 = htobe32(0x7f000001); *(uint32_t*)0x10000094 = htobe32(0xe0000002); *(uint32_t*)0x10000098 = htobe32(0xe0000002); *(uint8_t*)0x1000009c = 7; *(uint8_t*)0x1000009d = 7; *(uint8_t*)0x1000009e = 0; *(uint32_t*)0x1000009f = htobe32(0xe0000002); *(uint8_t*)0x100000a3 = 0x44; *(uint8_t*)0x100000a4 = 0x38; *(uint8_t*)0x100000a5 = 2; STORE_BY_BITMASK(uint8_t, , 0x100000a6, 1, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x100000a6, 7, 4, 4); *(uint32_t*)0x100000a7 = htobe32(0); *(uint32_t*)0x100000ab = htobe32(2); *(uint8_t*)0x100000af = 0xac; *(uint8_t*)0x100000b0 = 0x14; *(uint8_t*)0x100000b1 = 0; *(uint8_t*)0x100000b2 = 0xaa; *(uint32_t*)0x100000b3 = htobe32(0x1f); *(uint32_t*)0x100000b7 = htobe32(0xe0000001); *(uint32_t*)0x100000bb = htobe32(0); *(uint32_t*)0x100000bf = htobe32(7); *(uint32_t*)0x100000c3 = htobe32(0x3ff); *(uint32_t*)0x100000c7 = htobe32(0x3b6); *(uint32_t*)0x100000cb = htobe32(0x7f000001); *(uint32_t*)0x100000cf = htobe32(0xfffffbaf); *(uint32_t*)0x100000d3 = htobe32(0x7f000001); *(uint32_t*)0x100000d7 = htobe32(0x400); *(uint16_t*)0x100000de = htobe16(0x4e20); *(uint16_t*)0x100000e0 = htobe16(0x4e21); *(uint32_t*)0x100000e2 = r[3]; *(uint32_t*)0x100000e6 = 0x41424344; STORE_BY_BITMASK(uint8_t, , 0x100000ea, 0, 0, 1); STORE_BY_BITMASK(uint8_t, , 0x100000ea, 0, 1, 3); STORE_BY_BITMASK(uint8_t, , 0x100000ea, 0x10, 4, 4); *(uint8_t*)0x100000eb = 8; *(uint16_t*)0x100000ec = htobe16(0x8001); *(uint16_t*)0x100000ee = htobe16(0); *(uint16_t*)0x100000f0 = htobe16(6); *(uint8_t*)0x100000f2 = 0; *(uint8_t*)0x100000f3 = 2; *(uint8_t*)0x100000f4 = 4; *(uint16_t*)0x100000f5 = htobe16(0xf13); *(uint8_t*)0x100000f7 = 5; *(uint8_t*)0x100000f8 = 0x26; *(uint32_t*)0x100000f9 = htobe32(0x3f); *(uint32_t*)0x100000fd = htobe32(6); *(uint32_t*)0x10000101 = htobe32(8); *(uint32_t*)0x10000105 = htobe32(6); *(uint32_t*)0x10000109 = htobe32(8); *(uint32_t*)0x1000010d = htobe32(8); *(uint32_t*)0x10000111 = htobe32(0x20); *(uint32_t*)0x10000115 = htobe32(0x8001); *(uint32_t*)0x10000119 = htobe32(0xfffffff7); memcpy((void*)0x1000011e, "\xb9\x8e\xed\x1b\xfb\x3a\x0d\x46\xc5\x41\xa8\x52\x1f\xa4\xb5\x20\x40\x51\xe2\x1c\xdf\x38\xcb\x70\x77\xdb\x0f\x27\x16\x03\x9b\xa5\xc2\x45\x69\xc2\x3b\x4e\x18\xe6\x01\x52\xf0\x8a\x56\xa0\xb8\x13\x62\x42\x30\xb5\x7b\x8c\x73\x00\x1a\x7c\x09\xee\x6b\x29\xab\x9c\xa3\x12\x48\xef\x28\xd1\xde\x0b\xdc\x63\x24\x74\x83\xe0\x51\xe8\xc7\x28\x11\xf9\xb4\x21\x22\xdc\xe1\xb1\x36\x57\xa9\x9a\x08\xd7\x95\x64\xf0\x09\x61\xf5\x46\xb5\x9c\x7c\x01\x94\x6e\x8c\xd5\xfe\x48\x05\xc8\x7d\xbb\x5c\xca\xfb\xfd\xe1\x8a\x4b\x99\xd3\x06\x97\xca\xc4\x45\x42\x8a\x4a\x0f\xd5\xb4\x6b\x18\x71\x99\xc3\x4a\x93\xb2\xbd\x70\x6b\x47\x0c\xf0\xc6\x9d\xf6\x0a\x28\xdc\x68\xbc\x42\x60\x08\x96\x5b\x0d\xfd\x74\xa4\xaa\x29\xb6\xb7\x99\x18\xec\xc6\x78\x41\x9a\xc3\xff\x8f\x7e\x25\x45\xb5\xe2\x08\xb7\x29\x51\xd8\x14\xf6\x93\x69\x3b\x7b\x0e\x40\x52\x36\x64\xf3\x96\x34\x76\x31\xf0\xf1\x98\xa0\xea\xd9\xb8\xa9\x3c\xae\x36\xe7\x49\x09\x18\x0a\x23\x70\xfe\x72\xfe\xde\x65\xb7\x47\xad\x92\xb5\x46\x71\xa1\x25\xf1", 241); struct csum_inet csum_1; csum_inet_init(&csum_1); csum_inet_update(&csum_1, (const uint8_t*)0x1000005a, 4); csum_inet_update(&csum_1, (const uint8_t*)0x1000005e, 4); uint16_t csum_1_chunk_2 = 0x600; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_2, 2); uint16_t csum_1_chunk_3 = 0x3101; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_3, 2); csum_inet_update(&csum_1, (const uint8_t*)0x100000de, 305); *(uint16_t*)0x100000ee = csum_inet_digest(&csum_1); struct csum_inet csum_2; csum_inet_init(&csum_2); csum_inet_update(&csum_2, (const uint8_t*)0x1000004e, 144); *(uint16_t*)0x10000058 = csum_inet_digest(&csum_2); break; case 12: memcpy((void*)0x10000240, "\xc4\xc1\xed\x14\xa5\x59\xab\x32\xeb\xd0\xd5\x36\x64\x66\x67\x66\x66\x0f\x38\xf6\x6b\x0f\xc4\xc2\x61\xbe\xed\xc4\xe2\x01\xba\xef\x0f\x18\xd1\xc4\xe2\x01\xa8\xa8\xe1\x40\x00\x00\xc4\xe1\x69\xe5\xb1\x4d\x41\xb9\xa0\xde\xe9\x0f\x38\xca\x23", 59); syz_execute_func(0x10000240); break; case 13: break; } } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); use_temporary_dir(); do_sandbox_none(); return 0; } :356:11: error: use of undeclared identifier 'SYS_shm_rename' syscall(SYS_shm_rename, 0x10000100, 0x10000140, 6); ^ 1 error generated. compiler invocation: clang [-o /tmp/syz-executor109970288 -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/1 (1.75s) csource_test.go:122: opts: {Threaded:true Collide:false Repeat:true RepeatTimes:0 Procs:0 Sandbox:none Fault:false FaultCall:0 FaultNth:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false UseTmpDir:true HandleSegv:false Repro:false Trace:false} program: truncate(&(0x7f0000000000)='./file0\x00', 0x0) socket$inet(0x2, 0x4, 0x81) freebsd10_pipe(&(0x7f0000000040)={0xffffffffffffffff, 0xffffffffffffffff}) freebsd11_mknodat(r0, &(0x7f0000000080)='./file0\x00', 0x40, 0x4) chflags(&(0x7f00000000c0)='./file0\x00', 0x110212) shm_rename(&(0x7f0000000100)='./file0\x00', &(0x7f0000000140)='./file0\x00', 0x6) r1 = dup2(0xffffffffffffffff, 0xffffffffffffff9c) ioctl$DIOCCHANGEADDR(r1, 0xc4704437, &(0x7f0000000180)="9d61632459f011108aca181da4cc8372b78dcda5") freebsd10_pipe(&(0x7f00000001c0)={0xffffffffffffffff}) ioctl$DIOCRTSTADDRS(r2, 0xc4504449, &(0x7f0000000280)={{"35c4df515ed9a9eeb69a52635d8fb8b651cf3959fa233503474d880170ac5a6eff8983b1abf33d2a2b68b48ac3e04d9f1576976e9a209ea4eb9df0492cb60fff25f705b225e60541430774024ed9a77956cc1ee1aa49852856dde798fff57cf85b44f611e4f6a2f9b1c9174957164e7e83b5fc152fe9eefb9291fcb5bb6dcc4f34bb9253bfdfb685e0ce6fd9f9912321e7c96afa1e73b2c849cef730dbc0dcb0d1aa86b810f58658d45cb384719b5017a8b44b55d621a397f539190392a7fcc5a545c7c9759cd3be711ec91aa7c1f0590321d839500e0a006b8ff5e7fae19d3fd881b52e0dcb79b92936e60ce9a714631a5a0f7c122ae53b27afa90ffdeffa1850c6b3bd711555053e459627c80b681c3c8b8816c0913e772b05a80ff7556c80e860e2463db4d5ae7dd11af5a15c83a65cf7795c975d8b827e5b62d02ad55572623a90bf8ad0e8ce52d6d099427a4abfe84198b64dc26231c847d038302b7fe558aac4f2a7e9274c8a9c3be263e2565d825f379d55a35bf41d89e8c3fe9ff76429e1dad1d7c284412bd36144e55626f135fbe65858a2c9d1326f57b04eab1301a08bd6d608b894e716fbc4cbb89a8d96afa8ed326970ad2dcd746a445837156b87983ebc5fe55540ee3435a20062291fd827525fb5fdea7a33080acd0524ab2d6bf81fb753bdbc7662695c878d22e4cc3776a15e64750cf4654e25609b0d6bbf0e367df50f143e7ada5121ad9edc7da9686bb864d2786a684d2a84e2b027a26084c6d5f5afd89bd25e1c6dad0674bd0f2b34da34c6f4d54e80c9a44675b5fae40a80506a6da8e7569b9bff2f539d8de340087c5885bf052d3861ccc4ca85c38083c793f78ff7b018cb1bab2ec7e9e1d1b59203bf15ddec6e99139eac8fbd5055e60611e39193cd875cd213aba34b3e0ddbc05074f1756770de1c1c8efbf4554be83bae0b3f5ee30cd9a771a689f52469cebf6c801f8de0eac5fe93c3c13593e9daa5bad1280b695ef7e5bdc15ba6b6992183ae6da64de1e8d1eae9f110cdb25edb6a7b123f6c83cb48a3e1045f284593f7d6f23e2a068506445a9938486ad3b676be2fb154ebcde15119d296fceb2413745a8c5417b2ac34b4f355b3549aa223ef2f342e00a637db8616442ca3a180a5825dff2603bad906625404678fa3b39591e162e7ff40adfe8566d68eed8a19153f19fc629452e30f0645aafc1f4eb5dea9f3c6ed6ddbc44473cf8995d033a2ff0c0cdd5388ce6edb1e732aa383346aca3297d84174ea8c6a3fb4083f091263ac4c6062a8401d164be2bfa23e81f9bda1486c7fda45da44ba46afb55f0946b43e8d80f1fccea290ac53aadfa2d109db7d1493b1146947d96b8701e1f6a61892164912430f7583ff87e7dfa8bc61520bdf7afb5485302a8e0dbc332fce4736bee859c1c3d4b5083eb53aa0532fb07229e6", "fbf6bfee9c01092652d2d600835f64f0982102189a56bb5d2acd1157abacb317", 0x100, 0x1}, &(0x7f0000000200)="4b418fea2cea206ae391e44a504fceeb9da11453e3c0303b6fbfdc928a7470eb0c3240c75c0c35134caac7719b5849274bbc0f0b76d2cdbd6127f348d99cf71d4962579966d743126ef7b139bc729327c6e2018d2c24a1cdf88b213117404495ff0ccb9e3549390c33e4fa7ef504f76d2c9dcad0502773b1e6e2ee", 0xffffffff, 0x7, 0x20, 0x200, 0x0, 0x7, 0x887f, 0x7ff}) syz_extract_tcp_res(&(0x7f0000000000)={0x41424344, 0x41424344}, 0x4, 0x40) syz_emit_ethernet(0x1cf, &(0x7f0000000040)={@local, @empty, [], {@ipv4={0x800, {{0x24, 0x4, 0x1, 0x7, 0x1c1, 0x66, 0xc7c, 0x40, 0x2e, 0x0, @multicast2, @loopback, {[@end, @rr={0x7, 0xb, 0x9, [@multicast2, @multicast2]}, @ssrr={0x89, 0x7, 0x7f, [@local={0xac, 0x14, 0x0}]}, @noop, @rr={0x7, 0xb, 0x1f, [@local={0xac, 0x14, 0x0}, @empty]}, @lsrr={0x83, 0xb, 0x0, [@multicast2, @empty]}, @end, @lsrr={0x83, 0xf, 0x96, [@loopback, @multicast2, @multicast2]}, @rr={0x7, 0x7, 0x0, [@multicast2]}, @timestamp={0x44, 0x38, 0x2, 0x1, 0x7, [{[@empty], 0x2}, {[@local={0xac, 0x14, 0x0}], 0x1f}, {[@multicast1]}, {[], 0x7}, {[], 0x3ff}, {[], 0x3b6}, {[@loopback], 0xfffffbaf}, {[@loopback], 0x400}]}]}}, @tcp={{0x0, 0x1, r3, 0x41424344, 0x0, 0x0, 0x10, 0x8, 0x8001, 0x0, 0x6, {[@eol, @mss={0x2, 0x4, 0xf13}, @sack={0x5, 0x26, [0x3f, 0x6, 0x8, 0x6, 0x8, 0x8, 0x20, 0x8001, 0xfffffff7]}]}}, {"b98eed1bfb3a0d46c541a8521fa4b5204051e21cdf38cb7077db0f2716039ba5c24569c23b4e18e60152f08a56a0b813624230b57b8c73001a7c09ee6b29ab9ca31248ef28d1de0bdc63247483e051e8c72811f9b42122dce1b13657a99a08d79564f00961f546b59c7c01946e8cd5fe4805c87dbb5ccafbfde18a4b99d30697cac445428a4a0fd5b46b187199c34a93b2bd706b470cf0c69df60a28dc68bc426008965b0dfd74a4aa29b6b79918ecc678419ac3ff8f7e2545b5e208b72951d814f693693b7b0e40523664f396347631f0f198a0ead9b8a93cae36e74909180a2370fe72fede65b747ad92b54671a125f1"}}}}}}) syz_execute_func(&(0x7f0000000240)="c4c1ed14a559ab32ebd0d53664666766660f38f66b0fc4c261beedc4e201baef0f18d1c4e201a8a8e1400000c4e169e5b14d41b9a0dee90f38ca23") syz_extract_tcp_res(&(0x7f0000000280), 0x4df9f115, 0x2) csource_test.go:123: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void remove_dir(const char* dir) { DIR* dp; struct dirent* ep; dp = opendir(dir); if (dp == NULL) exit(1); while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } if (unlink(filename)) exit(1); } closedir(dp); if (rmdir(dir)) exit(1); } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i; for (i = 0; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { pthread_mutex_t mu; pthread_cond_t cv; int state; } event_t; static void event_init(event_t* ev) { if (pthread_mutex_init(&ev->mu, 0)) exit(1); if (pthread_cond_init(&ev->cv, 0)) exit(1); ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { pthread_mutex_lock(&ev->mu); if (ev->state) exit(1); ev->state = 1; pthread_mutex_unlock(&ev->mu); pthread_cond_broadcast(&ev->cv); } static void event_wait(event_t* ev) { pthread_mutex_lock(&ev->mu); while (!ev->state) pthread_cond_wait(&ev->cv, &ev->mu); pthread_mutex_unlock(&ev->mu); } static int event_isset(event_t* ev) { pthread_mutex_lock(&ev->mu); int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; pthread_mutex_lock(&ev->mu); for (;;) { if (ev->state) break; uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); now = current_time_ms(); if (now - start > timeout) break; } int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } #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; for (i = 0; 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) { volatile long p[8] = {0}; (void)p; ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 14; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); event_timedwait(&th->done, 45); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); #define WAIT_FLAGS 0 static void loop(void) { int iter; for (iter = 0;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5 * 1000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x41424344}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: memcpy((void*)0x10000000, "./file0\000", 8); syscall(SYS_truncate, 0x10000000, 0); break; case 1: syscall(SYS_socket, 2, 4, 0x81); break; case 2: res = syscall(SYS_freebsd10_pipe, 0x10000040); if (res != -1) r[0] = *(uint32_t*)0x10000044; break; case 3: memcpy((void*)0x10000080, "./file0\000", 8); syscall(SYS_freebsd11_mknodat, (intptr_t)r[0], 0x10000080, 0x40, 4); break; case 4: memcpy((void*)0x100000c0, "./file0\000", 8); syscall(SYS_chflags, 0x100000c0, 0x110212); break; case 5: memcpy((void*)0x10000100, "./file0\000", 8); memcpy((void*)0x10000140, "./file0\000", 8); syscall(SYS_shm_rename, 0x10000100, 0x10000140, 6); break; case 6: res = syscall(SYS_dup2, -1, 0xffffff9c); if (res != -1) r[1] = res; break; case 7: memcpy((void*)0x10000180, "\x9d\x61\x63\x24\x59\xf0\x11\x10\x8a\xca\x18\x1d\xa4\xcc\x83\x72\xb7\x8d\xcd\xa5", 20); syscall(SYS_ioctl, (intptr_t)r[1], 0xc4704437, 0x10000180); break; case 8: res = syscall(SYS_freebsd10_pipe, 0x100001c0); if (res != -1) r[2] = *(uint32_t*)0x100001c0; break; case 9: memcpy((void*)0x10000280, "\x35\xc4\xdf\x51\x5e\xd9\xa9\xee\xb6\x9a\x52\x63\x5d\x8f\xb8\xb6\x51\xcf\x39\x59\xfa\x23\x35\x03\x47\x4d\x88\x01\x70\xac\x5a\x6e\xff\x89\x83\xb1\xab\xf3\x3d\x2a\x2b\x68\xb4\x8a\xc3\xe0\x4d\x9f\x15\x76\x97\x6e\x9a\x20\x9e\xa4\xeb\x9d\xf0\x49\x2c\xb6\x0f\xff\x25\xf7\x05\xb2\x25\xe6\x05\x41\x43\x07\x74\x02\x4e\xd9\xa7\x79\x56\xcc\x1e\xe1\xaa\x49\x85\x28\x56\xdd\xe7\x98\xff\xf5\x7c\xf8\x5b\x44\xf6\x11\xe4\xf6\xa2\xf9\xb1\xc9\x17\x49\x57\x16\x4e\x7e\x83\xb5\xfc\x15\x2f\xe9\xee\xfb\x92\x91\xfc\xb5\xbb\x6d\xcc\x4f\x34\xbb\x92\x53\xbf\xdf\xb6\x85\xe0\xce\x6f\xd9\xf9\x91\x23\x21\xe7\xc9\x6a\xfa\x1e\x73\xb2\xc8\x49\xce\xf7\x30\xdb\xc0\xdc\xb0\xd1\xaa\x86\xb8\x10\xf5\x86\x58\xd4\x5c\xb3\x84\x71\x9b\x50\x17\xa8\xb4\x4b\x55\xd6\x21\xa3\x97\xf5\x39\x19\x03\x92\xa7\xfc\xc5\xa5\x45\xc7\xc9\x75\x9c\xd3\xbe\x71\x1e\xc9\x1a\xa7\xc1\xf0\x59\x03\x21\xd8\x39\x50\x0e\x0a\x00\x6b\x8f\xf5\xe7\xfa\xe1\x9d\x3f\xd8\x81\xb5\x2e\x0d\xcb\x79\xb9\x29\x36\xe6\x0c\xe9\xa7\x14\x63\x1a\x5a\x0f\x7c\x12\x2a\xe5\x3b\x27\xaf\xa9\x0f\xfd\xef\xfa\x18\x50\xc6\xb3\xbd\x71\x15\x55\x05\x3e\x45\x96\x27\xc8\x0b\x68\x1c\x3c\x8b\x88\x16\xc0\x91\x3e\x77\x2b\x05\xa8\x0f\xf7\x55\x6c\x80\xe8\x60\xe2\x46\x3d\xb4\xd5\xae\x7d\xd1\x1a\xf5\xa1\x5c\x83\xa6\x5c\xf7\x79\x5c\x97\x5d\x8b\x82\x7e\x5b\x62\xd0\x2a\xd5\x55\x72\x62\x3a\x90\xbf\x8a\xd0\xe8\xce\x52\xd6\xd0\x99\x42\x7a\x4a\xbf\xe8\x41\x98\xb6\x4d\xc2\x62\x31\xc8\x47\xd0\x38\x30\x2b\x7f\xe5\x58\xaa\xc4\xf2\xa7\xe9\x27\x4c\x8a\x9c\x3b\xe2\x63\xe2\x56\x5d\x82\x5f\x37\x9d\x55\xa3\x5b\xf4\x1d\x89\xe8\xc3\xfe\x9f\xf7\x64\x29\xe1\xda\xd1\xd7\xc2\x84\x41\x2b\xd3\x61\x44\xe5\x56\x26\xf1\x35\xfb\xe6\x58\x58\xa2\xc9\xd1\x32\x6f\x57\xb0\x4e\xab\x13\x01\xa0\x8b\xd6\xd6\x08\xb8\x94\xe7\x16\xfb\xc4\xcb\xb8\x9a\x8d\x96\xaf\xa8\xed\x32\x69\x70\xad\x2d\xcd\x74\x6a\x44\x58\x37\x15\x6b\x87\x98\x3e\xbc\x5f\xe5\x55\x40\xee\x34\x35\xa2\x00\x62\x29\x1f\xd8\x27\x52\x5f\xb5\xfd\xea\x7a\x33\x08\x0a\xcd\x05\x24\xab\x2d\x6b\xf8\x1f\xb7\x53\xbd\xbc\x76\x62\x69\x5c\x87\x8d\x22\xe4\xcc\x37\x76\xa1\x5e\x64\x75\x0c\xf4\x65\x4e\x25\x60\x9b\x0d\x6b\xbf\x0e\x36\x7d\xf5\x0f\x14\x3e\x7a\xda\x51\x21\xad\x9e\xdc\x7d\xa9\x68\x6b\xb8\x64\xd2\x78\x6a\x68\x4d\x2a\x84\xe2\xb0\x27\xa2\x60\x84\xc6\xd5\xf5\xaf\xd8\x9b\xd2\x5e\x1c\x6d\xad\x06\x74\xbd\x0f\x2b\x34\xda\x34\xc6\xf4\xd5\x4e\x80\xc9\xa4\x46\x75\xb5\xfa\xe4\x0a\x80\x50\x6a\x6d\xa8\xe7\x56\x9b\x9b\xff\x2f\x53\x9d\x8d\xe3\x40\x08\x7c\x58\x85\xbf\x05\x2d\x38\x61\xcc\xc4\xca\x85\xc3\x80\x83\xc7\x93\xf7\x8f\xf7\xb0\x18\xcb\x1b\xab\x2e\xc7\xe9\xe1\xd1\xb5\x92\x03\xbf\x15\xdd\xec\x6e\x99\x13\x9e\xac\x8f\xbd\x50\x55\xe6\x06\x11\xe3\x91\x93\xcd\x87\x5c\xd2\x13\xab\xa3\x4b\x3e\x0d\xdb\xc0\x50\x74\xf1\x75\x67\x70\xde\x1c\x1c\x8e\xfb\xf4\x55\x4b\xe8\x3b\xae\x0b\x3f\x5e\xe3\x0c\xd9\xa7\x71\xa6\x89\xf5\x24\x69\xce\xbf\x6c\x80\x1f\x8d\xe0\xea\xc5\xfe\x93\xc3\xc1\x35\x93\xe9\xda\xa5\xba\xd1\x28\x0b\x69\x5e\xf7\xe5\xbd\xc1\x5b\xa6\xb6\x99\x21\x83\xae\x6d\xa6\x4d\xe1\xe8\xd1\xea\xe9\xf1\x10\xcd\xb2\x5e\xdb\x6a\x7b\x12\x3f\x6c\x83\xcb\x48\xa3\xe1\x04\x5f\x28\x45\x93\xf7\xd6\xf2\x3e\x2a\x06\x85\x06\x44\x5a\x99\x38\x48\x6a\xd3\xb6\x76\xbe\x2f\xb1\x54\xeb\xcd\xe1\x51\x19\xd2\x96\xfc\xeb\x24\x13\x74\x5a\x8c\x54\x17\xb2\xac\x34\xb4\xf3\x55\xb3\x54\x9a\xa2\x23\xef\x2f\x34\x2e\x00\xa6\x37\xdb\x86\x16\x44\x2c\xa3\xa1\x80\xa5\x82\x5d\xff\x26\x03\xba\xd9\x06\x62\x54\x04\x67\x8f\xa3\xb3\x95\x91\xe1\x62\xe7\xff\x40\xad\xfe\x85\x66\xd6\x8e\xed\x8a\x19\x15\x3f\x19\xfc\x62\x94\x52\xe3\x0f\x06\x45\xaa\xfc\x1f\x4e\xb5\xde\xa9\xf3\xc6\xed\x6d\xdb\xc4\x44\x73\xcf\x89\x95\xd0\x33\xa2\xff\x0c\x0c\xdd\x53\x88\xce\x6e\xdb\x1e\x73\x2a\xa3\x83\x34\x6a\xca\x32\x97\xd8\x41\x74\xea\x8c\x6a\x3f\xb4\x08\x3f\x09\x12\x63\xac\x4c\x60\x62\xa8\x40\x1d\x16\x4b\xe2\xbf\xa2\x3e\x81\xf9\xbd\xa1\x48\x6c\x7f\xda\x45\xda\x44\xba\x46\xaf\xb5\x5f\x09\x46\xb4\x3e\x8d\x80\xf1\xfc\xce\xa2\x90\xac\x53\xaa\xdf\xa2\xd1\x09\xdb\x7d\x14\x93\xb1\x14\x69\x47\xd9\x6b\x87\x01\xe1\xf6\xa6\x18\x92\x16\x49\x12\x43\x0f\x75\x83\xff\x87\xe7\xdf\xa8\xbc\x61\x52\x0b\xdf\x7a\xfb\x54\x85\x30\x2a\x8e\x0d\xbc\x33\x2f\xce\x47\x36\xbe\xe8\x59\xc1\xc3\xd4\xb5\x08\x3e\xb5\x3a\xa0\x53\x2f\xb0\x72\x29\xe6", 1024); memcpy((void*)0x10000680, "\xfb\xf6\xbf\xee\x9c\x01\x09\x26\x52\xd2\xd6\x00\x83\x5f\x64\xf0\x98\x21\x02\x18\x9a\x56\xbb\x5d\x2a\xcd\x11\x57\xab\xac\xb3\x17", 32); *(uint32_t*)0x100006a0 = 0x100; *(uint8_t*)0x100006a4 = 1; *(uint32_t*)0x100006a8 = 0x10000200; memcpy((void*)0x10000200, "\x4b\x41\x8f\xea\x2c\xea\x20\x6a\xe3\x91\xe4\x4a\x50\x4f\xce\xeb\x9d\xa1\x14\x53\xe3\xc0\x30\x3b\x6f\xbf\xdc\x92\x8a\x74\x70\xeb\x0c\x32\x40\xc7\x5c\x0c\x35\x13\x4c\xaa\xc7\x71\x9b\x58\x49\x27\x4b\xbc\x0f\x0b\x76\xd2\xcd\xbd\x61\x27\xf3\x48\xd9\x9c\xf7\x1d\x49\x62\x57\x99\x66\xd7\x43\x12\x6e\xf7\xb1\x39\xbc\x72\x93\x27\xc6\xe2\x01\x8d\x2c\x24\xa1\xcd\xf8\x8b\x21\x31\x17\x40\x44\x95\xff\x0c\xcb\x9e\x35\x49\x39\x0c\x33\xe4\xfa\x7e\xf5\x04\xf7\x6d\x2c\x9d\xca\xd0\x50\x27\x73\xb1\xe6\xe2\xee", 123); *(uint64_t*)0x100006ac = 0xffffffff; *(uint64_t*)0x100006b4 = 7; *(uint64_t*)0x100006bc = 0x20; *(uint64_t*)0x100006c4 = 0x200; *(uint64_t*)0x100006cc = 0; *(uint64_t*)0x100006d4 = 7; *(uint64_t*)0x100006dc = 0x887f; *(uint32_t*)0x100006e4 = 0x7ff; syscall(SYS_ioctl, (intptr_t)r[2], 0xc4504449, 0x10000280); break; case 10: if (res != -1) r[3] = *(uint32_t*)0x10000004; break; case 11: *(uint8_t*)0x10000040 = 0xaa; *(uint8_t*)0x10000041 = 0xaa; *(uint8_t*)0x10000042 = 0xaa; *(uint8_t*)0x10000043 = 0xaa; *(uint8_t*)0x10000044 = 0xaa; *(uint8_t*)0x10000045 = 0xaa; *(uint8_t*)0x10000046 = 0; *(uint8_t*)0x10000047 = 0; *(uint8_t*)0x10000048 = 0; *(uint8_t*)0x10000049 = 0; *(uint8_t*)0x1000004a = 0; *(uint8_t*)0x1000004b = 0; *(uint16_t*)0x1000004c = htobe16(0x800); STORE_BY_BITMASK(uint8_t, , 0x1000004e, 0x24, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x1000004e, 4, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x1000004f, 1, 0, 2); STORE_BY_BITMASK(uint8_t, , 0x1000004f, 7, 2, 6); *(uint16_t*)0x10000050 = htobe16(0x1c1); *(uint16_t*)0x10000052 = htobe16(0x66); *(uint16_t*)0x10000054 = htobe16(0xc7c); *(uint8_t*)0x10000056 = 0x40; *(uint8_t*)0x10000057 = 0x2e; *(uint16_t*)0x10000058 = htobe16(0); *(uint32_t*)0x1000005a = htobe32(0xe0000002); *(uint32_t*)0x1000005e = htobe32(0x7f000001); *(uint8_t*)0x10000062 = 0; *(uint8_t*)0x10000063 = 7; *(uint8_t*)0x10000064 = 0xb; *(uint8_t*)0x10000065 = 9; *(uint32_t*)0x10000066 = htobe32(0xe0000002); *(uint32_t*)0x1000006a = htobe32(0xe0000002); *(uint8_t*)0x1000006e = 0x89; *(uint8_t*)0x1000006f = 7; *(uint8_t*)0x10000070 = 0x7f; *(uint8_t*)0x10000071 = 0xac; *(uint8_t*)0x10000072 = 0x14; *(uint8_t*)0x10000073 = 0; *(uint8_t*)0x10000074 = 0xaa; *(uint8_t*)0x10000075 = 1; *(uint8_t*)0x10000076 = 7; *(uint8_t*)0x10000077 = 0xb; *(uint8_t*)0x10000078 = 0x1f; *(uint8_t*)0x10000079 = 0xac; *(uint8_t*)0x1000007a = 0x14; *(uint8_t*)0x1000007b = 0; *(uint8_t*)0x1000007c = 0xaa; *(uint32_t*)0x1000007d = htobe32(0); *(uint8_t*)0x10000081 = 0x83; *(uint8_t*)0x10000082 = 0xb; *(uint8_t*)0x10000083 = 0; *(uint32_t*)0x10000084 = htobe32(0xe0000002); *(uint32_t*)0x10000088 = htobe32(0); *(uint8_t*)0x1000008c = 0; *(uint8_t*)0x1000008d = 0x83; *(uint8_t*)0x1000008e = 0xf; *(uint8_t*)0x1000008f = 0x96; *(uint32_t*)0x10000090 = htobe32(0x7f000001); *(uint32_t*)0x10000094 = htobe32(0xe0000002); *(uint32_t*)0x10000098 = htobe32(0xe0000002); *(uint8_t*)0x1000009c = 7; *(uint8_t*)0x1000009d = 7; *(uint8_t*)0x1000009e = 0; *(uint32_t*)0x1000009f = htobe32(0xe0000002); *(uint8_t*)0x100000a3 = 0x44; *(uint8_t*)0x100000a4 = 0x38; *(uint8_t*)0x100000a5 = 2; STORE_BY_BITMASK(uint8_t, , 0x100000a6, 1, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x100000a6, 7, 4, 4); *(uint32_t*)0x100000a7 = htobe32(0); *(uint32_t*)0x100000ab = htobe32(2); *(uint8_t*)0x100000af = 0xac; *(uint8_t*)0x100000b0 = 0x14; *(uint8_t*)0x100000b1 = 0; *(uint8_t*)0x100000b2 = 0xaa; *(uint32_t*)0x100000b3 = htobe32(0x1f); *(uint32_t*)0x100000b7 = htobe32(0xe0000001); *(uint32_t*)0x100000bb = htobe32(0); *(uint32_t*)0x100000bf = htobe32(7); *(uint32_t*)0x100000c3 = htobe32(0x3ff); *(uint32_t*)0x100000c7 = htobe32(0x3b6); *(uint32_t*)0x100000cb = htobe32(0x7f000001); *(uint32_t*)0x100000cf = htobe32(0xfffffbaf); *(uint32_t*)0x100000d3 = htobe32(0x7f000001); *(uint32_t*)0x100000d7 = htobe32(0x400); *(uint16_t*)0x100000de = htobe16(0x4e20); *(uint16_t*)0x100000e0 = htobe16(0x4e21); *(uint32_t*)0x100000e2 = r[3]; *(uint32_t*)0x100000e6 = 0x41424344; STORE_BY_BITMASK(uint8_t, , 0x100000ea, 0, 0, 1); STORE_BY_BITMASK(uint8_t, , 0x100000ea, 0, 1, 3); STORE_BY_BITMASK(uint8_t, , 0x100000ea, 0x10, 4, 4); *(uint8_t*)0x100000eb = 8; *(uint16_t*)0x100000ec = htobe16(0x8001); *(uint16_t*)0x100000ee = htobe16(0); *(uint16_t*)0x100000f0 = htobe16(6); *(uint8_t*)0x100000f2 = 0; *(uint8_t*)0x100000f3 = 2; *(uint8_t*)0x100000f4 = 4; *(uint16_t*)0x100000f5 = htobe16(0xf13); *(uint8_t*)0x100000f7 = 5; *(uint8_t*)0x100000f8 = 0x26; *(uint32_t*)0x100000f9 = htobe32(0x3f); *(uint32_t*)0x100000fd = htobe32(6); *(uint32_t*)0x10000101 = htobe32(8); *(uint32_t*)0x10000105 = htobe32(6); *(uint32_t*)0x10000109 = htobe32(8); *(uint32_t*)0x1000010d = htobe32(8); *(uint32_t*)0x10000111 = htobe32(0x20); *(uint32_t*)0x10000115 = htobe32(0x8001); *(uint32_t*)0x10000119 = htobe32(0xfffffff7); memcpy((void*)0x1000011e, "\xb9\x8e\xed\x1b\xfb\x3a\x0d\x46\xc5\x41\xa8\x52\x1f\xa4\xb5\x20\x40\x51\xe2\x1c\xdf\x38\xcb\x70\x77\xdb\x0f\x27\x16\x03\x9b\xa5\xc2\x45\x69\xc2\x3b\x4e\x18\xe6\x01\x52\xf0\x8a\x56\xa0\xb8\x13\x62\x42\x30\xb5\x7b\x8c\x73\x00\x1a\x7c\x09\xee\x6b\x29\xab\x9c\xa3\x12\x48\xef\x28\xd1\xde\x0b\xdc\x63\x24\x74\x83\xe0\x51\xe8\xc7\x28\x11\xf9\xb4\x21\x22\xdc\xe1\xb1\x36\x57\xa9\x9a\x08\xd7\x95\x64\xf0\x09\x61\xf5\x46\xb5\x9c\x7c\x01\x94\x6e\x8c\xd5\xfe\x48\x05\xc8\x7d\xbb\x5c\xca\xfb\xfd\xe1\x8a\x4b\x99\xd3\x06\x97\xca\xc4\x45\x42\x8a\x4a\x0f\xd5\xb4\x6b\x18\x71\x99\xc3\x4a\x93\xb2\xbd\x70\x6b\x47\x0c\xf0\xc6\x9d\xf6\x0a\x28\xdc\x68\xbc\x42\x60\x08\x96\x5b\x0d\xfd\x74\xa4\xaa\x29\xb6\xb7\x99\x18\xec\xc6\x78\x41\x9a\xc3\xff\x8f\x7e\x25\x45\xb5\xe2\x08\xb7\x29\x51\xd8\x14\xf6\x93\x69\x3b\x7b\x0e\x40\x52\x36\x64\xf3\x96\x34\x76\x31\xf0\xf1\x98\xa0\xea\xd9\xb8\xa9\x3c\xae\x36\xe7\x49\x09\x18\x0a\x23\x70\xfe\x72\xfe\xde\x65\xb7\x47\xad\x92\xb5\x46\x71\xa1\x25\xf1", 241); struct csum_inet csum_1; csum_inet_init(&csum_1); csum_inet_update(&csum_1, (const uint8_t*)0x1000005a, 4); csum_inet_update(&csum_1, (const uint8_t*)0x1000005e, 4); uint16_t csum_1_chunk_2 = 0x600; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_2, 2); uint16_t csum_1_chunk_3 = 0x3101; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_3, 2); csum_inet_update(&csum_1, (const uint8_t*)0x100000de, 305); *(uint16_t*)0x100000ee = csum_inet_digest(&csum_1); struct csum_inet csum_2; csum_inet_init(&csum_2); csum_inet_update(&csum_2, (const uint8_t*)0x1000004e, 144); *(uint16_t*)0x10000058 = csum_inet_digest(&csum_2); break; case 12: memcpy((void*)0x10000240, "\xc4\xc1\xed\x14\xa5\x59\xab\x32\xeb\xd0\xd5\x36\x64\x66\x67\x66\x66\x0f\x38\xf6\x6b\x0f\xc4\xc2\x61\xbe\xed\xc4\xe2\x01\xba\xef\x0f\x18\xd1\xc4\xe2\x01\xa8\xa8\xe1\x40\x00\x00\xc4\xe1\x69\xe5\xb1\x4d\x41\xb9\xa0\xde\xe9\x0f\x38\xca\x23", 59); syz_execute_func(0x10000240); break; case 13: break; } } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); use_temporary_dir(); do_sandbox_none(); return 0; } :354:11: error: use of undeclared identifier 'SYS_shm_rename' syscall(SYS_shm_rename, 0x10000100, 0x10000140, 6); ^ 1 error generated. compiler invocation: clang [-o /tmp/syz-executor304883727 -DGOOS_freebsd=1 -DGOARCH_386=1 -DHOSTGOOS_freebsd=1 -x c - -m32 -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -static -lc++ -Wno-overflow] --- FAIL: TestGenerate/freebsd/386/4 (1.69s) csource_test.go:122: opts: {Threaded:true Collide:false Repeat:true RepeatTimes:10 Procs:0 Sandbox:none Fault:false FaultCall:0 FaultNth:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false UseTmpDir:true HandleSegv:false Repro:false Trace:false} program: truncate(&(0x7f0000000000)='./file0\x00', 0x0) socket$inet(0x2, 0x4, 0x81) freebsd10_pipe(&(0x7f0000000040)={0xffffffffffffffff, 0xffffffffffffffff}) freebsd11_mknodat(r0, &(0x7f0000000080)='./file0\x00', 0x40, 0x4) chflags(&(0x7f00000000c0)='./file0\x00', 0x110212) shm_rename(&(0x7f0000000100)='./file0\x00', &(0x7f0000000140)='./file0\x00', 0x6) r1 = dup2(0xffffffffffffffff, 0xffffffffffffff9c) ioctl$DIOCCHANGEADDR(r1, 0xc4704437, &(0x7f0000000180)="9d61632459f011108aca181da4cc8372b78dcda5") freebsd10_pipe(&(0x7f00000001c0)={0xffffffffffffffff}) ioctl$DIOCRTSTADDRS(r2, 0xc4504449, &(0x7f0000000280)={{"35c4df515ed9a9eeb69a52635d8fb8b651cf3959fa233503474d880170ac5a6eff8983b1abf33d2a2b68b48ac3e04d9f1576976e9a209ea4eb9df0492cb60fff25f705b225e60541430774024ed9a77956cc1ee1aa49852856dde798fff57cf85b44f611e4f6a2f9b1c9174957164e7e83b5fc152fe9eefb9291fcb5bb6dcc4f34bb9253bfdfb685e0ce6fd9f9912321e7c96afa1e73b2c849cef730dbc0dcb0d1aa86b810f58658d45cb384719b5017a8b44b55d621a397f539190392a7fcc5a545c7c9759cd3be711ec91aa7c1f0590321d839500e0a006b8ff5e7fae19d3fd881b52e0dcb79b92936e60ce9a714631a5a0f7c122ae53b27afa90ffdeffa1850c6b3bd711555053e459627c80b681c3c8b8816c0913e772b05a80ff7556c80e860e2463db4d5ae7dd11af5a15c83a65cf7795c975d8b827e5b62d02ad55572623a90bf8ad0e8ce52d6d099427a4abfe84198b64dc26231c847d038302b7fe558aac4f2a7e9274c8a9c3be263e2565d825f379d55a35bf41d89e8c3fe9ff76429e1dad1d7c284412bd36144e55626f135fbe65858a2c9d1326f57b04eab1301a08bd6d608b894e716fbc4cbb89a8d96afa8ed326970ad2dcd746a445837156b87983ebc5fe55540ee3435a20062291fd827525fb5fdea7a33080acd0524ab2d6bf81fb753bdbc7662695c878d22e4cc3776a15e64750cf4654e25609b0d6bbf0e367df50f143e7ada5121ad9edc7da9686bb864d2786a684d2a84e2b027a26084c6d5f5afd89bd25e1c6dad0674bd0f2b34da34c6f4d54e80c9a44675b5fae40a80506a6da8e7569b9bff2f539d8de340087c5885bf052d3861ccc4ca85c38083c793f78ff7b018cb1bab2ec7e9e1d1b59203bf15ddec6e99139eac8fbd5055e60611e39193cd875cd213aba34b3e0ddbc05074f1756770de1c1c8efbf4554be83bae0b3f5ee30cd9a771a689f52469cebf6c801f8de0eac5fe93c3c13593e9daa5bad1280b695ef7e5bdc15ba6b6992183ae6da64de1e8d1eae9f110cdb25edb6a7b123f6c83cb48a3e1045f284593f7d6f23e2a068506445a9938486ad3b676be2fb154ebcde15119d296fceb2413745a8c5417b2ac34b4f355b3549aa223ef2f342e00a637db8616442ca3a180a5825dff2603bad906625404678fa3b39591e162e7ff40adfe8566d68eed8a19153f19fc629452e30f0645aafc1f4eb5dea9f3c6ed6ddbc44473cf8995d033a2ff0c0cdd5388ce6edb1e732aa383346aca3297d84174ea8c6a3fb4083f091263ac4c6062a8401d164be2bfa23e81f9bda1486c7fda45da44ba46afb55f0946b43e8d80f1fccea290ac53aadfa2d109db7d1493b1146947d96b8701e1f6a61892164912430f7583ff87e7dfa8bc61520bdf7afb5485302a8e0dbc332fce4736bee859c1c3d4b5083eb53aa0532fb07229e6", "fbf6bfee9c01092652d2d600835f64f0982102189a56bb5d2acd1157abacb317", 0x100, 0x1}, &(0x7f0000000200)="4b418fea2cea206ae391e44a504fceeb9da11453e3c0303b6fbfdc928a7470eb0c3240c75c0c35134caac7719b5849274bbc0f0b76d2cdbd6127f348d99cf71d4962579966d743126ef7b139bc729327c6e2018d2c24a1cdf88b213117404495ff0ccb9e3549390c33e4fa7ef504f76d2c9dcad0502773b1e6e2ee", 0xffffffff, 0x7, 0x20, 0x200, 0x0, 0x7, 0x887f, 0x7ff}) syz_extract_tcp_res(&(0x7f0000000000)={0x41424344, 0x41424344}, 0x4, 0x40) syz_emit_ethernet(0x1cf, &(0x7f0000000040)={@local, @empty, [], {@ipv4={0x800, {{0x24, 0x4, 0x1, 0x7, 0x1c1, 0x66, 0xc7c, 0x40, 0x2e, 0x0, @multicast2, @loopback, {[@end, @rr={0x7, 0xb, 0x9, [@multicast2, @multicast2]}, @ssrr={0x89, 0x7, 0x7f, [@local={0xac, 0x14, 0x0}]}, @noop, @rr={0x7, 0xb, 0x1f, [@local={0xac, 0x14, 0x0}, @empty]}, @lsrr={0x83, 0xb, 0x0, [@multicast2, @empty]}, @end, @lsrr={0x83, 0xf, 0x96, [@loopback, @multicast2, @multicast2]}, @rr={0x7, 0x7, 0x0, [@multicast2]}, @timestamp={0x44, 0x38, 0x2, 0x1, 0x7, [{[@empty], 0x2}, {[@local={0xac, 0x14, 0x0}], 0x1f}, {[@multicast1]}, {[], 0x7}, {[], 0x3ff}, {[], 0x3b6}, {[@loopback], 0xfffffbaf}, {[@loopback], 0x400}]}]}}, @tcp={{0x0, 0x1, r3, 0x41424344, 0x0, 0x0, 0x10, 0x8, 0x8001, 0x0, 0x6, {[@eol, @mss={0x2, 0x4, 0xf13}, @sack={0x5, 0x26, [0x3f, 0x6, 0x8, 0x6, 0x8, 0x8, 0x20, 0x8001, 0xfffffff7]}]}}, {"b98eed1bfb3a0d46c541a8521fa4b5204051e21cdf38cb7077db0f2716039ba5c24569c23b4e18e60152f08a56a0b813624230b57b8c73001a7c09ee6b29ab9ca31248ef28d1de0bdc63247483e051e8c72811f9b42122dce1b13657a99a08d79564f00961f546b59c7c01946e8cd5fe4805c87dbb5ccafbfde18a4b99d30697cac445428a4a0fd5b46b187199c34a93b2bd706b470cf0c69df60a28dc68bc426008965b0dfd74a4aa29b6b79918ecc678419ac3ff8f7e2545b5e208b72951d814f693693b7b0e40523664f396347631f0f198a0ead9b8a93cae36e74909180a2370fe72fede65b747ad92b54671a125f1"}}}}}}) syz_execute_func(&(0x7f0000000240)="c4c1ed14a559ab32ebd0d53664666766660f38f66b0fc4c261beedc4e201baef0f18d1c4e201a8a8e1400000c4e169e5b14d41b9a0dee90f38ca23") syz_extract_tcp_res(&(0x7f0000000280), 0x4df9f115, 0x2) csource_test.go:123: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void remove_dir(const char* dir) { DIR* dp; struct dirent* ep; dp = opendir(dir); if (dp == NULL) exit(1); while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } if (unlink(filename)) exit(1); } closedir(dp); if (rmdir(dir)) exit(1); } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i; for (i = 0; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { pthread_mutex_t mu; pthread_cond_t cv; int state; } event_t; static void event_init(event_t* ev) { if (pthread_mutex_init(&ev->mu, 0)) exit(1); if (pthread_cond_init(&ev->cv, 0)) exit(1); ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { pthread_mutex_lock(&ev->mu); if (ev->state) exit(1); ev->state = 1; pthread_mutex_unlock(&ev->mu); pthread_cond_broadcast(&ev->cv); } static void event_wait(event_t* ev) { pthread_mutex_lock(&ev->mu); while (!ev->state) pthread_cond_wait(&ev->cv, &ev->mu); pthread_mutex_unlock(&ev->mu); } static int event_isset(event_t* ev) { pthread_mutex_lock(&ev->mu); int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; pthread_mutex_lock(&ev->mu); for (;;) { if (ev->state) break; uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); now = current_time_ms(); if (now - start > timeout) break; } int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } #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; for (i = 0; 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) { volatile long p[8] = {0}; (void)p; ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 14; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); event_timedwait(&th->done, 45); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); #define WAIT_FLAGS 0 static void loop(void) { int iter; for (iter = 0; iter < 10; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5 * 1000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x41424344}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: memcpy((void*)0x10000000, "./file0\000", 8); syscall(SYS_truncate, 0x10000000, 0); break; case 1: syscall(SYS_socket, 2, 4, 0x81); break; case 2: res = syscall(SYS_freebsd10_pipe, 0x10000040); if (res != -1) r[0] = *(uint32_t*)0x10000044; break; case 3: memcpy((void*)0x10000080, "./file0\000", 8); syscall(SYS_freebsd11_mknodat, (intptr_t)r[0], 0x10000080, 0x40, 4); break; case 4: memcpy((void*)0x100000c0, "./file0\000", 8); syscall(SYS_chflags, 0x100000c0, 0x110212); break; case 5: memcpy((void*)0x10000100, "./file0\000", 8); memcpy((void*)0x10000140, "./file0\000", 8); syscall(SYS_shm_rename, 0x10000100, 0x10000140, 6); break; case 6: res = syscall(SYS_dup2, -1, 0xffffff9c); if (res != -1) r[1] = res; break; case 7: memcpy((void*)0x10000180, "\x9d\x61\x63\x24\x59\xf0\x11\x10\x8a\xca\x18\x1d\xa4\xcc\x83\x72\xb7\x8d\xcd\xa5", 20); syscall(SYS_ioctl, (intptr_t)r[1], 0xc4704437, 0x10000180); break; case 8: res = syscall(SYS_freebsd10_pipe, 0x100001c0); if (res != -1) r[2] = *(uint32_t*)0x100001c0; break; case 9: memcpy((void*)0x10000280, "\x35\xc4\xdf\x51\x5e\xd9\xa9\xee\xb6\x9a\x52\x63\x5d\x8f\xb8\xb6\x51\xcf\x39\x59\xfa\x23\x35\x03\x47\x4d\x88\x01\x70\xac\x5a\x6e\xff\x89\x83\xb1\xab\xf3\x3d\x2a\x2b\x68\xb4\x8a\xc3\xe0\x4d\x9f\x15\x76\x97\x6e\x9a\x20\x9e\xa4\xeb\x9d\xf0\x49\x2c\xb6\x0f\xff\x25\xf7\x05\xb2\x25\xe6\x05\x41\x43\x07\x74\x02\x4e\xd9\xa7\x79\x56\xcc\x1e\xe1\xaa\x49\x85\x28\x56\xdd\xe7\x98\xff\xf5\x7c\xf8\x5b\x44\xf6\x11\xe4\xf6\xa2\xf9\xb1\xc9\x17\x49\x57\x16\x4e\x7e\x83\xb5\xfc\x15\x2f\xe9\xee\xfb\x92\x91\xfc\xb5\xbb\x6d\xcc\x4f\x34\xbb\x92\x53\xbf\xdf\xb6\x85\xe0\xce\x6f\xd9\xf9\x91\x23\x21\xe7\xc9\x6a\xfa\x1e\x73\xb2\xc8\x49\xce\xf7\x30\xdb\xc0\xdc\xb0\xd1\xaa\x86\xb8\x10\xf5\x86\x58\xd4\x5c\xb3\x84\x71\x9b\x50\x17\xa8\xb4\x4b\x55\xd6\x21\xa3\x97\xf5\x39\x19\x03\x92\xa7\xfc\xc5\xa5\x45\xc7\xc9\x75\x9c\xd3\xbe\x71\x1e\xc9\x1a\xa7\xc1\xf0\x59\x03\x21\xd8\x39\x50\x0e\x0a\x00\x6b\x8f\xf5\xe7\xfa\xe1\x9d\x3f\xd8\x81\xb5\x2e\x0d\xcb\x79\xb9\x29\x36\xe6\x0c\xe9\xa7\x14\x63\x1a\x5a\x0f\x7c\x12\x2a\xe5\x3b\x27\xaf\xa9\x0f\xfd\xef\xfa\x18\x50\xc6\xb3\xbd\x71\x15\x55\x05\x3e\x45\x96\x27\xc8\x0b\x68\x1c\x3c\x8b\x88\x16\xc0\x91\x3e\x77\x2b\x05\xa8\x0f\xf7\x55\x6c\x80\xe8\x60\xe2\x46\x3d\xb4\xd5\xae\x7d\xd1\x1a\xf5\xa1\x5c\x83\xa6\x5c\xf7\x79\x5c\x97\x5d\x8b\x82\x7e\x5b\x62\xd0\x2a\xd5\x55\x72\x62\x3a\x90\xbf\x8a\xd0\xe8\xce\x52\xd6\xd0\x99\x42\x7a\x4a\xbf\xe8\x41\x98\xb6\x4d\xc2\x62\x31\xc8\x47\xd0\x38\x30\x2b\x7f\xe5\x58\xaa\xc4\xf2\xa7\xe9\x27\x4c\x8a\x9c\x3b\xe2\x63\xe2\x56\x5d\x82\x5f\x37\x9d\x55\xa3\x5b\xf4\x1d\x89\xe8\xc3\xfe\x9f\xf7\x64\x29\xe1\xda\xd1\xd7\xc2\x84\x41\x2b\xd3\x61\x44\xe5\x56\x26\xf1\x35\xfb\xe6\x58\x58\xa2\xc9\xd1\x32\x6f\x57\xb0\x4e\xab\x13\x01\xa0\x8b\xd6\xd6\x08\xb8\x94\xe7\x16\xfb\xc4\xcb\xb8\x9a\x8d\x96\xaf\xa8\xed\x32\x69\x70\xad\x2d\xcd\x74\x6a\x44\x58\x37\x15\x6b\x87\x98\x3e\xbc\x5f\xe5\x55\x40\xee\x34\x35\xa2\x00\x62\x29\x1f\xd8\x27\x52\x5f\xb5\xfd\xea\x7a\x33\x08\x0a\xcd\x05\x24\xab\x2d\x6b\xf8\x1f\xb7\x53\xbd\xbc\x76\x62\x69\x5c\x87\x8d\x22\xe4\xcc\x37\x76\xa1\x5e\x64\x75\x0c\xf4\x65\x4e\x25\x60\x9b\x0d\x6b\xbf\x0e\x36\x7d\xf5\x0f\x14\x3e\x7a\xda\x51\x21\xad\x9e\xdc\x7d\xa9\x68\x6b\xb8\x64\xd2\x78\x6a\x68\x4d\x2a\x84\xe2\xb0\x27\xa2\x60\x84\xc6\xd5\xf5\xaf\xd8\x9b\xd2\x5e\x1c\x6d\xad\x06\x74\xbd\x0f\x2b\x34\xda\x34\xc6\xf4\xd5\x4e\x80\xc9\xa4\x46\x75\xb5\xfa\xe4\x0a\x80\x50\x6a\x6d\xa8\xe7\x56\x9b\x9b\xff\x2f\x53\x9d\x8d\xe3\x40\x08\x7c\x58\x85\xbf\x05\x2d\x38\x61\xcc\xc4\xca\x85\xc3\x80\x83\xc7\x93\xf7\x8f\xf7\xb0\x18\xcb\x1b\xab\x2e\xc7\xe9\xe1\xd1\xb5\x92\x03\xbf\x15\xdd\xec\x6e\x99\x13\x9e\xac\x8f\xbd\x50\x55\xe6\x06\x11\xe3\x91\x93\xcd\x87\x5c\xd2\x13\xab\xa3\x4b\x3e\x0d\xdb\xc0\x50\x74\xf1\x75\x67\x70\xde\x1c\x1c\x8e\xfb\xf4\x55\x4b\xe8\x3b\xae\x0b\x3f\x5e\xe3\x0c\xd9\xa7\x71\xa6\x89\xf5\x24\x69\xce\xbf\x6c\x80\x1f\x8d\xe0\xea\xc5\xfe\x93\xc3\xc1\x35\x93\xe9\xda\xa5\xba\xd1\x28\x0b\x69\x5e\xf7\xe5\xbd\xc1\x5b\xa6\xb6\x99\x21\x83\xae\x6d\xa6\x4d\xe1\xe8\xd1\xea\xe9\xf1\x10\xcd\xb2\x5e\xdb\x6a\x7b\x12\x3f\x6c\x83\xcb\x48\xa3\xe1\x04\x5f\x28\x45\x93\xf7\xd6\xf2\x3e\x2a\x06\x85\x06\x44\x5a\x99\x38\x48\x6a\xd3\xb6\x76\xbe\x2f\xb1\x54\xeb\xcd\xe1\x51\x19\xd2\x96\xfc\xeb\x24\x13\x74\x5a\x8c\x54\x17\xb2\xac\x34\xb4\xf3\x55\xb3\x54\x9a\xa2\x23\xef\x2f\x34\x2e\x00\xa6\x37\xdb\x86\x16\x44\x2c\xa3\xa1\x80\xa5\x82\x5d\xff\x26\x03\xba\xd9\x06\x62\x54\x04\x67\x8f\xa3\xb3\x95\x91\xe1\x62\xe7\xff\x40\xad\xfe\x85\x66\xd6\x8e\xed\x8a\x19\x15\x3f\x19\xfc\x62\x94\x52\xe3\x0f\x06\x45\xaa\xfc\x1f\x4e\xb5\xde\xa9\xf3\xc6\xed\x6d\xdb\xc4\x44\x73\xcf\x89\x95\xd0\x33\xa2\xff\x0c\x0c\xdd\x53\x88\xce\x6e\xdb\x1e\x73\x2a\xa3\x83\x34\x6a\xca\x32\x97\xd8\x41\x74\xea\x8c\x6a\x3f\xb4\x08\x3f\x09\x12\x63\xac\x4c\x60\x62\xa8\x40\x1d\x16\x4b\xe2\xbf\xa2\x3e\x81\xf9\xbd\xa1\x48\x6c\x7f\xda\x45\xda\x44\xba\x46\xaf\xb5\x5f\x09\x46\xb4\x3e\x8d\x80\xf1\xfc\xce\xa2\x90\xac\x53\xaa\xdf\xa2\xd1\x09\xdb\x7d\x14\x93\xb1\x14\x69\x47\xd9\x6b\x87\x01\xe1\xf6\xa6\x18\x92\x16\x49\x12\x43\x0f\x75\x83\xff\x87\xe7\xdf\xa8\xbc\x61\x52\x0b\xdf\x7a\xfb\x54\x85\x30\x2a\x8e\x0d\xbc\x33\x2f\xce\x47\x36\xbe\xe8\x59\xc1\xc3\xd4\xb5\x08\x3e\xb5\x3a\xa0\x53\x2f\xb0\x72\x29\xe6", 1024); memcpy((void*)0x10000680, "\xfb\xf6\xbf\xee\x9c\x01\x09\x26\x52\xd2\xd6\x00\x83\x5f\x64\xf0\x98\x21\x02\x18\x9a\x56\xbb\x5d\x2a\xcd\x11\x57\xab\xac\xb3\x17", 32); *(uint32_t*)0x100006a0 = 0x100; *(uint8_t*)0x100006a4 = 1; *(uint32_t*)0x100006a8 = 0x10000200; memcpy((void*)0x10000200, "\x4b\x41\x8f\xea\x2c\xea\x20\x6a\xe3\x91\xe4\x4a\x50\x4f\xce\xeb\x9d\xa1\x14\x53\xe3\xc0\x30\x3b\x6f\xbf\xdc\x92\x8a\x74\x70\xeb\x0c\x32\x40\xc7\x5c\x0c\x35\x13\x4c\xaa\xc7\x71\x9b\x58\x49\x27\x4b\xbc\x0f\x0b\x76\xd2\xcd\xbd\x61\x27\xf3\x48\xd9\x9c\xf7\x1d\x49\x62\x57\x99\x66\xd7\x43\x12\x6e\xf7\xb1\x39\xbc\x72\x93\x27\xc6\xe2\x01\x8d\x2c\x24\xa1\xcd\xf8\x8b\x21\x31\x17\x40\x44\x95\xff\x0c\xcb\x9e\x35\x49\x39\x0c\x33\xe4\xfa\x7e\xf5\x04\xf7\x6d\x2c\x9d\xca\xd0\x50\x27\x73\xb1\xe6\xe2\xee", 123); *(uint64_t*)0x100006ac = 0xffffffff; *(uint64_t*)0x100006b4 = 7; *(uint64_t*)0x100006bc = 0x20; *(uint64_t*)0x100006c4 = 0x200; *(uint64_t*)0x100006cc = 0; *(uint64_t*)0x100006d4 = 7; *(uint64_t*)0x100006dc = 0x887f; *(uint32_t*)0x100006e4 = 0x7ff; syscall(SYS_ioctl, (intptr_t)r[2], 0xc4504449, 0x10000280); break; case 10: if (res != -1) r[3] = *(uint32_t*)0x10000004; break; case 11: *(uint8_t*)0x10000040 = 0xaa; *(uint8_t*)0x10000041 = 0xaa; *(uint8_t*)0x10000042 = 0xaa; *(uint8_t*)0x10000043 = 0xaa; *(uint8_t*)0x10000044 = 0xaa; *(uint8_t*)0x10000045 = 0xaa; *(uint8_t*)0x10000046 = 0; *(uint8_t*)0x10000047 = 0; *(uint8_t*)0x10000048 = 0; *(uint8_t*)0x10000049 = 0; *(uint8_t*)0x1000004a = 0; *(uint8_t*)0x1000004b = 0; *(uint16_t*)0x1000004c = htobe16(0x800); STORE_BY_BITMASK(uint8_t, , 0x1000004e, 0x24, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x1000004e, 4, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x1000004f, 1, 0, 2); STORE_BY_BITMASK(uint8_t, , 0x1000004f, 7, 2, 6); *(uint16_t*)0x10000050 = htobe16(0x1c1); *(uint16_t*)0x10000052 = htobe16(0x66); *(uint16_t*)0x10000054 = htobe16(0xc7c); *(uint8_t*)0x10000056 = 0x40; *(uint8_t*)0x10000057 = 0x2e; *(uint16_t*)0x10000058 = htobe16(0); *(uint32_t*)0x1000005a = htobe32(0xe0000002); *(uint32_t*)0x1000005e = htobe32(0x7f000001); *(uint8_t*)0x10000062 = 0; *(uint8_t*)0x10000063 = 7; *(uint8_t*)0x10000064 = 0xb; *(uint8_t*)0x10000065 = 9; *(uint32_t*)0x10000066 = htobe32(0xe0000002); *(uint32_t*)0x1000006a = htobe32(0xe0000002); *(uint8_t*)0x1000006e = 0x89; *(uint8_t*)0x1000006f = 7; *(uint8_t*)0x10000070 = 0x7f; *(uint8_t*)0x10000071 = 0xac; *(uint8_t*)0x10000072 = 0x14; *(uint8_t*)0x10000073 = 0; *(uint8_t*)0x10000074 = 0xaa; *(uint8_t*)0x10000075 = 1; *(uint8_t*)0x10000076 = 7; *(uint8_t*)0x10000077 = 0xb; *(uint8_t*)0x10000078 = 0x1f; *(uint8_t*)0x10000079 = 0xac; *(uint8_t*)0x1000007a = 0x14; *(uint8_t*)0x1000007b = 0; *(uint8_t*)0x1000007c = 0xaa; *(uint32_t*)0x1000007d = htobe32(0); *(uint8_t*)0x10000081 = 0x83; *(uint8_t*)0x10000082 = 0xb; *(uint8_t*)0x10000083 = 0; *(uint32_t*)0x10000084 = htobe32(0xe0000002); *(uint32_t*)0x10000088 = htobe32(0); *(uint8_t*)0x1000008c = 0; *(uint8_t*)0x1000008d = 0x83; *(uint8_t*)0x1000008e = 0xf; *(uint8_t*)0x1000008f = 0x96; *(uint32_t*)0x10000090 = htobe32(0x7f000001); *(uint32_t*)0x10000094 = htobe32(0xe0000002); *(uint32_t*)0x10000098 = htobe32(0xe0000002); *(uint8_t*)0x1000009c = 7; *(uint8_t*)0x1000009d = 7; *(uint8_t*)0x1000009e = 0; *(uint32_t*)0x1000009f = htobe32(0xe0000002); *(uint8_t*)0x100000a3 = 0x44; *(uint8_t*)0x100000a4 = 0x38; *(uint8_t*)0x100000a5 = 2; STORE_BY_BITMASK(uint8_t, , 0x100000a6, 1, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x100000a6, 7, 4, 4); *(uint32_t*)0x100000a7 = htobe32(0); *(uint32_t*)0x100000ab = htobe32(2); *(uint8_t*)0x100000af = 0xac; *(uint8_t*)0x100000b0 = 0x14; *(uint8_t*)0x100000b1 = 0; *(uint8_t*)0x100000b2 = 0xaa; *(uint32_t*)0x100000b3 = htobe32(0x1f); *(uint32_t*)0x100000b7 = htobe32(0xe0000001); *(uint32_t*)0x100000bb = htobe32(0); *(uint32_t*)0x100000bf = htobe32(7); *(uint32_t*)0x100000c3 = htobe32(0x3ff); *(uint32_t*)0x100000c7 = htobe32(0x3b6); *(uint32_t*)0x100000cb = htobe32(0x7f000001); *(uint32_t*)0x100000cf = htobe32(0xfffffbaf); *(uint32_t*)0x100000d3 = htobe32(0x7f000001); *(uint32_t*)0x100000d7 = htobe32(0x400); *(uint16_t*)0x100000de = htobe16(0x4e20); *(uint16_t*)0x100000e0 = htobe16(0x4e21); *(uint32_t*)0x100000e2 = r[3]; *(uint32_t*)0x100000e6 = 0x41424344; STORE_BY_BITMASK(uint8_t, , 0x100000ea, 0, 0, 1); STORE_BY_BITMASK(uint8_t, , 0x100000ea, 0, 1, 3); STORE_BY_BITMASK(uint8_t, , 0x100000ea, 0x10, 4, 4); *(uint8_t*)0x100000eb = 8; *(uint16_t*)0x100000ec = htobe16(0x8001); *(uint16_t*)0x100000ee = htobe16(0); *(uint16_t*)0x100000f0 = htobe16(6); *(uint8_t*)0x100000f2 = 0; *(uint8_t*)0x100000f3 = 2; *(uint8_t*)0x100000f4 = 4; *(uint16_t*)0x100000f5 = htobe16(0xf13); *(uint8_t*)0x100000f7 = 5; *(uint8_t*)0x100000f8 = 0x26; *(uint32_t*)0x100000f9 = htobe32(0x3f); *(uint32_t*)0x100000fd = htobe32(6); *(uint32_t*)0x10000101 = htobe32(8); *(uint32_t*)0x10000105 = htobe32(6); *(uint32_t*)0x10000109 = htobe32(8); *(uint32_t*)0x1000010d = htobe32(8); *(uint32_t*)0x10000111 = htobe32(0x20); *(uint32_t*)0x10000115 = htobe32(0x8001); *(uint32_t*)0x10000119 = htobe32(0xfffffff7); memcpy((void*)0x1000011e, "\xb9\x8e\xed\x1b\xfb\x3a\x0d\x46\xc5\x41\xa8\x52\x1f\xa4\xb5\x20\x40\x51\xe2\x1c\xdf\x38\xcb\x70\x77\xdb\x0f\x27\x16\x03\x9b\xa5\xc2\x45\x69\xc2\x3b\x4e\x18\xe6\x01\x52\xf0\x8a\x56\xa0\xb8\x13\x62\x42\x30\xb5\x7b\x8c\x73\x00\x1a\x7c\x09\xee\x6b\x29\xab\x9c\xa3\x12\x48\xef\x28\xd1\xde\x0b\xdc\x63\x24\x74\x83\xe0\x51\xe8\xc7\x28\x11\xf9\xb4\x21\x22\xdc\xe1\xb1\x36\x57\xa9\x9a\x08\xd7\x95\x64\xf0\x09\x61\xf5\x46\xb5\x9c\x7c\x01\x94\x6e\x8c\xd5\xfe\x48\x05\xc8\x7d\xbb\x5c\xca\xfb\xfd\xe1\x8a\x4b\x99\xd3\x06\x97\xca\xc4\x45\x42\x8a\x4a\x0f\xd5\xb4\x6b\x18\x71\x99\xc3\x4a\x93\xb2\xbd\x70\x6b\x47\x0c\xf0\xc6\x9d\xf6\x0a\x28\xdc\x68\xbc\x42\x60\x08\x96\x5b\x0d\xfd\x74\xa4\xaa\x29\xb6\xb7\x99\x18\xec\xc6\x78\x41\x9a\xc3\xff\x8f\x7e\x25\x45\xb5\xe2\x08\xb7\x29\x51\xd8\x14\xf6\x93\x69\x3b\x7b\x0e\x40\x52\x36\x64\xf3\x96\x34\x76\x31\xf0\xf1\x98\xa0\xea\xd9\xb8\xa9\x3c\xae\x36\xe7\x49\x09\x18\x0a\x23\x70\xfe\x72\xfe\xde\x65\xb7\x47\xad\x92\xb5\x46\x71\xa1\x25\xf1", 241); struct csum_inet csum_1; csum_inet_init(&csum_1); csum_inet_update(&csum_1, (const uint8_t*)0x1000005a, 4); csum_inet_update(&csum_1, (const uint8_t*)0x1000005e, 4); uint16_t csum_1_chunk_2 = 0x600; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_2, 2); uint16_t csum_1_chunk_3 = 0x3101; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_3, 2); csum_inet_update(&csum_1, (const uint8_t*)0x100000de, 305); *(uint16_t*)0x100000ee = csum_inet_digest(&csum_1); struct csum_inet csum_2; csum_inet_init(&csum_2); csum_inet_update(&csum_2, (const uint8_t*)0x1000004e, 144); *(uint16_t*)0x10000058 = csum_inet_digest(&csum_2); break; case 12: memcpy((void*)0x10000240, "\xc4\xc1\xed\x14\xa5\x59\xab\x32\xeb\xd0\xd5\x36\x64\x66\x67\x66\x66\x0f\x38\xf6\x6b\x0f\xc4\xc2\x61\xbe\xed\xc4\xe2\x01\xba\xef\x0f\x18\xd1\xc4\xe2\x01\xa8\xa8\xe1\x40\x00\x00\xc4\xe1\x69\xe5\xb1\x4d\x41\xb9\xa0\xde\xe9\x0f\x38\xca\x23", 59); syz_execute_func(0x10000240); break; case 13: break; } } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); use_temporary_dir(); do_sandbox_none(); return 0; } :354:11: error: use of undeclared identifier 'SYS_shm_rename' syscall(SYS_shm_rename, 0x10000100, 0x10000140, 6); ^ 1 error generated. compiler invocation: clang [-o /tmp/syz-executor062362658 -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.72s) csource_test.go:120: --- FAIL: TestGenerate/freebsd/386/6 (1.13s) csource_test.go:120: --- FAIL: TestGenerate/freebsd/386/2 (1.30s) csource_test.go:120: --- FAIL: TestGenerate/freebsd/386/8 (1.47s) csource_test.go:120: --- FAIL: TestGenerate/freebsd/386/7 (1.48s) csource_test.go:120: FAIL FAIL github.com/google/syzkaller/pkg/csource 16.968s ok github.com/google/syzkaller/pkg/db (cached) ok github.com/google/syzkaller/pkg/email (cached) ? github.com/google/syzkaller/pkg/gce [no test files] ? github.com/google/syzkaller/pkg/gcs [no test files] ? github.com/google/syzkaller/pkg/hash [no test files] ok github.com/google/syzkaller/pkg/host 1.966s ? github.com/google/syzkaller/pkg/html [no test files] ok github.com/google/syzkaller/pkg/ifuzz (cached) ? github.com/google/syzkaller/pkg/ifuzz/gen [no test files] ? github.com/google/syzkaller/pkg/ifuzz/generated [no test files] ok github.com/google/syzkaller/pkg/instance 4.870s ok github.com/google/syzkaller/pkg/ipc 10.311s ? github.com/google/syzkaller/pkg/ipc/ipcconfig [no test files] ok github.com/google/syzkaller/pkg/kd (cached) ok github.com/google/syzkaller/pkg/log (cached) ok github.com/google/syzkaller/pkg/mgrconfig 0.121s ok github.com/google/syzkaller/pkg/osutil (cached) ok github.com/google/syzkaller/pkg/report 8.169s ok github.com/google/syzkaller/pkg/repro 2.238s ? github.com/google/syzkaller/pkg/rpctype [no test files] --- FAIL: Test (1.39s) --- FAIL: Test/64 (40.27s) run.go:67: align0 C : OK run.go:67: align0 /repeat C : BROKEN (non-forking loop) run.go:67: align0 /thr C : OK run.go:67: align0 /thr/repeat C : BROKEN (non-forking loop) run.go:67: align0 none : OK run.go:67: align0 none C : OK run.go:67: align0 none/repeat : OK run.go:67: align0 none/repeat C : BROKEN (non-forking loop) run.go:67: align0 none/thr : OK run.go:67: align0 none/thr C : OK run.go:67: align0 none/thr/repeat : OK run.go:67: align0 none/thr/repeat C : BROKEN (non-forking loop) run.go:67: align0_be C : SKIP (excluded by constraints) run.go:67: align0_be /repeat C : BROKEN (non-forking loop) run.go:67: align0_be /thr C : SKIP (excluded by constraints) run.go:67: align0_be /thr/repeat C : BROKEN (non-forking loop) run.go:67: align0_be none : SKIP (excluded by constraints) run.go:67: align0_be none C : SKIP (excluded by constraints) run.go:67: align0_be none/repeat : SKIP (excluded by constraints) run.go:67: align0_be none/repeat C : BROKEN (non-forking loop) run.go:67: align0_be none/thr : SKIP (excluded by constraints) run.go:67: align0_be none/thr C : SKIP (excluded by constraints) run.go:67: align0_be none/thr/repeat : SKIP (excluded by constraints) run.go:67: align0_be none/thr/repeat C : BROKEN (non-forking loop) run.go:67: bf C : OK run.go:67: bf /repeat C : BROKEN (non-forking loop) run.go:67: bf /thr C : OK run.go:67: bf /thr/repeat C : BROKEN (non-forking loop) run.go:67: bf none : OK run.go:67: bf none C : OK run.go:67: bf none/repeat : OK run.go:67: bf none/repeat C : BROKEN (non-forking loop) run.go:67: bf none/thr : OK run.go:67: bf none/thr C : OK run.go:67: bf none/thr/repeat : OK run.go:67: bf none/thr/repeat C : BROKEN (non-forking loop) run.go:67: bf2 C : OK run.go:67: bf2 /repeat C : BROKEN (non-forking loop) run.go:67: bf2 /thr C : OK run.go:67: bf2 /thr/repeat C : BROKEN (non-forking loop) run.go:67: bf2 none : OK run.go:67: bf2 none C : OK run.go:67: bf2 none/repeat : OK run.go:67: bf2 none/repeat C : BROKEN (non-forking loop) run.go:67: bf2 none/thr : OK run.go:67: bf2 none/thr C : OK run.go:67: bf2 none/thr/repeat : OK run.go:67: bf2 none/thr/repeat C : BROKEN (non-forking loop) run.go:67: bf2_be C : SKIP (excluded by constraints) run.go:67: bf2_be /repeat C : BROKEN (non-forking loop) run.go:67: bf2_be /thr C : SKIP (excluded by constraints) run.go:67: bf2_be /thr/repeat C : BROKEN (non-forking loop) run.go:67: bf2_be none : SKIP (excluded by constraints) run.go:67: bf2_be none C : SKIP (excluded by constraints) run.go:67: bf2_be none/repeat : SKIP (excluded by constraints) run.go:67: bf2_be none/repeat C : BROKEN (non-forking loop) run.go:67: bf2_be none/thr : SKIP (excluded by constraints) run.go:67: bf2_be none/thr C : SKIP (excluded by constraints) run.go:67: bf2_be none/thr/repeat : SKIP (excluded by constraints) run.go:67: bf2_be none/thr/repeat C : BROKEN (non-forking loop) run.go:67: bf_be C : SKIP (excluded by constraints) run.go:67: bf_be /repeat C : BROKEN (non-forking loop) run.go:67: bf_be /thr C : SKIP (excluded by constraints) run.go:67: bf_be /thr/repeat C : BROKEN (non-forking loop) run.go:67: bf_be none : SKIP (excluded by constraints) run.go:67: bf_be none C : SKIP (excluded by constraints) run.go:67: bf_be none/repeat : SKIP (excluded by constraints) run.go:67: bf_be none/repeat C : BROKEN (non-forking loop) run.go:67: bf_be none/thr : SKIP (excluded by constraints) run.go:67: bf_be none/thr C : SKIP (excluded by constraints) run.go:67: bf_be none/thr/repeat : SKIP (excluded by constraints) run.go:67: bf_be none/thr/repeat C : BROKEN (non-forking loop) run.go:67: errno C : OK run.go:67: errno /repeat C : BROKEN (non-forking loop) run.go:67: errno /thr C : OK run.go:67: errno /thr/repeat C : BROKEN (non-forking loop) run.go:67: errno none : OK run.go:67: errno none C : OK run.go:67: errno none/repeat : OK run.go:67: errno none/repeat C : BROKEN (non-forking loop) run.go:67: errno none/thr : OK run.go:67: errno none/thr C : OK run.go:67: errno none/thr/repeat : OK run.go:67: errno none/thr/repeat C : BROKEN (non-forking loop) run.go:67: exit0 C : OK run.go:67: exit0 /repeat C : BROKEN (non-forking loop) run.go:67: exit0 /thr C : OK run.go:67: exit0 /thr/repeat C : BROKEN (non-forking loop) run.go:67: exit0 none : OK run.go:67: exit0 none C : OK run.go:67: exit0 none/repeat : OK run.go:67: exit0 none/repeat C : BROKEN (non-forking loop) run.go:67: exit0 none/thr : OK run.go:67: exit0 none/thr C : OK run.go:67: exit0 none/thr/repeat : OK run.go:67: exit0 none/thr/repeat C : BROKEN (non-forking loop) run.go:67: exit1 C : OK run.go:67: exit1 /repeat C : BROKEN (non-forking loop) run.go:67: exit1 /thr C : OK run.go:67: exit1 /thr/repeat C : BROKEN (non-forking loop) run.go:67: exit1 none : OK run.go:67: exit1 none C : OK run.go:67: exit1 none/repeat : OK run.go:67: exit1 none/repeat C : BROKEN (non-forking loop) run.go:67: exit1 none/thr : OK run.go:67: exit1 none/thr C : OK run.go:67: exit1 none/thr/repeat : OK run.go:67: exit1 none/thr/repeat C : BROKEN (non-forking loop) run.go:67: fmt C : OK run.go:67: fmt /repeat C : BROKEN (non-forking loop) run.go:67: fmt /thr C : OK run.go:67: fmt /thr/repeat C : BROKEN (non-forking loop) run.go:67: fmt none : OK run.go:67: fmt none C : OK run.go:67: fmt none/repeat : OK run.go:67: fmt none/repeat C : BROKEN (non-forking loop) run.go:67: fmt none/thr : OK run.go:67: fmt none/thr C : OK run.go:67: fmt none/thr/repeat : OK run.go:67: fmt none/thr/repeat C : BROKEN (non-forking loop) run.go:67: nla C : OK run.go:67: nla /repeat C : BROKEN (non-forking loop) run.go:67: nla /thr C : OK run.go:67: nla /thr/repeat C : BROKEN (non-forking loop) run.go:67: nla none : OK run.go:67: nla none C : OK run.go:67: nla none/repeat : OK run.go:67: nla none/repeat C : BROKEN (non-forking loop) run.go:67: nla none/thr : OK run.go:67: nla none/thr C : OK run.go:67: nla none/thr/repeat : OK run.go:67: nla none/thr/repeat C : BROKEN (non-forking loop) run.go:67: nonfailing C : FAIL: run 0: call 0 is not finished ### start run.go:67: nonfailing /repeat C : BROKEN (non-forking loop) run.go:67: nonfailing /thr C : FAIL: run 0: call 0 is not executed ### start run.go:67: nonfailing /thr/repeat C : BROKEN (non-forking loop) run.go:67: nonfailing none : FAIL: run 0: call 0 is not executed run.go:67: nonfailing none C : FAIL: run 0: call 0 is not finished ### start run.go:67: nonfailing none/repeat : FAIL: run 0: call 0 is not executed run.go:67: nonfailing none/repeat C : BROKEN (non-forking loop) run.go:67: nonfailing none/thr : FAIL: run 0: call 0 is not executed run.go:67: nonfailing none/thr C : FAIL: run 0: call 0 is not executed ### start run.go:67: nonfailing none/thr/repeat : FAIL: run 0: call 0 is not executed run.go:67: nonfailing none/thr/repeat C : BROKEN (non-forking loop) run.go:67: strings C : OK run.go:67: strings /repeat C : BROKEN (non-forking loop) run.go:67: strings /thr C : OK run.go:67: strings /thr/repeat C : BROKEN (non-forking loop) run.go:67: strings none : OK run.go:67: strings none C : OK run.go:67: strings none/repeat : OK run.go:67: strings none/repeat C : BROKEN (non-forking loop) run.go:67: strings none/thr : OK run.go:67: strings none/thr C : OK run.go:67: strings none/thr/repeat : OK run.go:67: strings none/thr/repeat C : BROKEN (non-forking loop) run.go:67: test C : OK run.go:67: test /repeat C : BROKEN (non-forking loop) run.go:67: test /thr C : OK run.go:67: test /thr/repeat C : BROKEN (non-forking loop) run.go:67: test none : OK run.go:67: test none C : OK run.go:67: test none/repeat : OK run.go:67: test none/repeat C : BROKEN (non-forking loop) run.go:67: test none/thr : OK run.go:67: test none/thr C : OK run.go:67: test none/thr/repeat : OK run.go:67: test none/thr/repeat C : BROKEN (non-forking loop) run.go:67: zero_args C : OK run.go:67: zero_args /repeat C : BROKEN (non-forking loop) run.go:67: zero_args /thr C : OK run.go:67: zero_args /thr/repeat C : BROKEN (non-forking loop) run.go:67: zero_args none : OK run.go:67: zero_args none C : OK run.go:67: zero_args none/repeat : OK run.go:67: zero_args none/repeat C : BROKEN (non-forking loop) run.go:67: zero_args none/thr : OK run.go:67: zero_args none/thr C : OK run.go:67: zero_args none/thr/repeat : OK run.go:67: zero_args none/thr/repeat C : BROKEN (non-forking loop) run.go:67: ok: 88, broken: 60, skip: 24, fail: 8 run_test.go:95: tests failed FAIL FAIL github.com/google/syzkaller/pkg/runtest 41.924s ok github.com/google/syzkaller/pkg/serializer (cached) ? github.com/google/syzkaller/pkg/signal [no test files] ok github.com/google/syzkaller/pkg/symbolizer (cached) ok github.com/google/syzkaller/pkg/vcs (cached) ok github.com/google/syzkaller/prog 14.338s ok github.com/google/syzkaller/prog/test (cached) ? github.com/google/syzkaller/sys [no test files] ? github.com/google/syzkaller/sys/akaros [no test files] ? github.com/google/syzkaller/sys/akaros/gen [no test files] ? github.com/google/syzkaller/sys/freebsd [no test files] ? github.com/google/syzkaller/sys/freebsd/gen [no test files] ? github.com/google/syzkaller/sys/fuchsia [no test files] ? github.com/google/syzkaller/sys/fuchsia/fidlgen [no test files] ? github.com/google/syzkaller/sys/fuchsia/gen [no test files] ? github.com/google/syzkaller/sys/fuchsia/layout [no test files] ok github.com/google/syzkaller/sys/linux 0.215s ? 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 1.753s ok github.com/google/syzkaller/syz-fuzzer 0.827s ok github.com/google/syzkaller/syz-hub 0.063s ok github.com/google/syzkaller/syz-hub/state (cached) ? github.com/google/syzkaller/syz-manager [no test files] ? github.com/google/syzkaller/tools/syz-benchcmp [no test files] ? github.com/google/syzkaller/tools/syz-bisect [no test files] ? github.com/google/syzkaller/tools/syz-check [no test files] ? github.com/google/syzkaller/tools/syz-cover [no test files] ? github.com/google/syzkaller/tools/syz-crush [no test files] ? github.com/google/syzkaller/tools/syz-db [no test files] ? github.com/google/syzkaller/tools/syz-execprog [no test files] ? github.com/google/syzkaller/tools/syz-expand [no test files] ? github.com/google/syzkaller/tools/syz-fmt [no test files] ? github.com/google/syzkaller/tools/syz-imagegen [no test files] ok github.com/google/syzkaller/tools/syz-linter (cached) ? github.com/google/syzkaller/tools/syz-make [no test files] ? github.com/google/syzkaller/tools/syz-mutate [no test files] ? github.com/google/syzkaller/tools/syz-prog2c [no test files] ? github.com/google/syzkaller/tools/syz-reporter [no test files] ? github.com/google/syzkaller/tools/syz-repro [no test files] ? github.com/google/syzkaller/tools/syz-reprolist [no test files] ? github.com/google/syzkaller/tools/syz-runtest [no test files] ? github.com/google/syzkaller/tools/syz-showprio [no test files] ? github.com/google/syzkaller/tools/syz-stress [no test files] ? github.com/google/syzkaller/tools/syz-symbolize [no test files] ? github.com/google/syzkaller/tools/syz-testbuild [no test files] ? github.com/google/syzkaller/tools/syz-trace2syz [no test files] ok github.com/google/syzkaller/tools/syz-trace2syz/parser 0.049s ok github.com/google/syzkaller/tools/syz-trace2syz/proggen 0.378s ? 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 11.272s ? github.com/google/syzkaller/vm/adb [no test files] ? github.com/google/syzkaller/vm/bhyve [no test files] ? github.com/google/syzkaller/vm/gce [no test files] ? github.com/google/syzkaller/vm/gvisor [no test files] ok github.com/google/syzkaller/vm/isolated (cached) ? github.com/google/syzkaller/vm/kvm [no test files] ? github.com/google/syzkaller/vm/odroid [no test files] ? github.com/google/syzkaller/vm/qemu [no test files] ok github.com/google/syzkaller/vm/vmimpl (cached) ? github.com/google/syzkaller/vm/vmm [no test files] FAIL