ok github.com/google/syzkaller/dashboard/app (cached) ? github.com/google/syzkaller/dashboard/dashapi [no test files] ok github.com/google/syzkaller/executor 0.721s ok github.com/google/syzkaller/pkg/ast 1.431s ok github.com/google/syzkaller/pkg/bisect 56.991s ok github.com/google/syzkaller/pkg/build 0.131s ok github.com/google/syzkaller/pkg/compiler 8.076s ok github.com/google/syzkaller/pkg/config (cached) ok github.com/google/syzkaller/pkg/cover (cached) ? github.com/google/syzkaller/pkg/cover/backend [no test files] --- FAIL: TestGenerate (5.51s) --- FAIL: TestGenerate/freebsd/386 (0.82s) csource_test.go:67: seed=1609073636775571601 --- FAIL: TestGenerate/freebsd/386/0 (0.55s) csource_test.go:123: opts: {Threaded:false Collide:false Repeat:true RepeatTimes:0 Procs:0 Sandbox:none Fault:false FaultCall:0 FaultNth:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false VhciInjection:false Wifi:false Sysctl:false UseTmpDir:true HandleSegv:false Repro:false Trace:false} program: fstat(0xffffffffffffff9c, &(0x7f0000000000)) r0 = socket$inet6_icmp_raw(0x1c, 0x3, 0x3a) setsockopt$inet6_tcp_TCP_FUNCTION_BLK(r0, 0x6, 0x2000, &(0x7f0000000100)={'bbr\x00', 0xfff}, 0x24) copy_file_range(0xffffffffffffff9c, &(0x7f0000000140)=0x9, r0, &(0x7f0000000180)=0x3f, 0x4, 0x0) getsockopt$inet_sctp_SCTP_EXPLICIT_EOR(0xffffffffffffffff, 0x84, 0x1b, &(0x7f00000001c0), &(0x7f0000000200)=0x4) getuid() getsockopt$inet_sctp_SCTP_STATUS(0xffffffffffffffff, 0x84, 0x100, &(0x7f0000000240)={0x0, 0x5, 0x2, 0xdd, 0x9, 0x7fff, 0x5, 0x1, {@in6={{0x1c, 0x1c, 0x3, 0x4, @local={0xfe, 0x80, [], 0x0}, 0x10000}}, 0x0, 0x9, 0xfffffff9, 0xdf10, 0x40, 0x8}}, &(0x7f0000000300)=0xac) getsockopt$inet6_sctp_SCTP_PR_ASSOC_STATUS(r0, 0x84, 0x108, &(0x7f0000000340)={r1, 0x9, 0x3, 0x1, 0x1}, &(0x7f0000000380)=0x18) syz_emit_ethernet(0xe3, &(0x7f00000003c0)={@random="558e866ec7c5", @broadcast, [{[{0x88a8, 0x0, 0x0, 0x1}], {0x8100, 0x0, 0x0, 0x4}}], {@ipv4={0x800, {{0xc, 0x4, 0x0, 0x8, 0xcd, 0x68, 0x1, 0x2, 0x1a, 0x0, @multicast2, @rand_addr, {[@ra={0x94, 0x6, 0x10000}, @lsrr={0x83, 0xb, 0x0, [@loopback, @empty]}, @generic={0x88, 0x9, "68b02e9aa55a8b"}]}}, @udp={{0x2, 0x3, 0x8}, {"1727313c0d121aaf942aba95b4aa8f3fab4a3f423c50b9f3207de073cd93e9d4abf4dd1bdea8b9e04ec83b0977c7094eca816b50fc613b6900642ed7c79867dfbfa2ee7e0da3bc0e15225c1f9e123c3983360a7a327e25ef286a9c45d8132c1c2201ecdb70ba3a3299d6680314428360ae3e57dcf3e15138710e151bad4503a78f71aae9accd796586c9b1fcfa620a259cc61014ef"}}}}}}) setgroups(0x1, &(0x7f00000004c0)=[0x0]) syz_emit_ethernet(0x3bf, &(0x7f0000000000)={@empty, @empty, [], {@ipv6={0x86dd, {0x3, 0x6, "082111", 0x389, 0x6c, 0x0, @ipv4={[], [], @multicast2}, @loopback, {[@dstopts={0x5e, 0x36, [], [@generic={0x79, 0x1a, "322539dce6c860eae2e717fe5d919d50f12da8c2790d7b778bd5"}, @ra={0x5, 0x2, 0x7}, @pad1, @padn={0x1, 0x2, [0x0, 0x0]}, @generic={0x8, 0xfa, "e2b0b21d6f96a012b794791a564b791a9b0876cc87a8e8dfcd4246acbd2e576229843f206d42eec2b99d4b6db93ca15f41cc25ada19e338a9780c960421012950307e65dda08893eb2f56402aefba148c2f9558d7a04f9e135247d1a8d04246250452d0f263cf90aa98d569eaa16834ea045e6dabce8906ac9af25efb2e5bcc24b0deabd7319ca606a2e28b658aea5947a43075c1f2ea50cca8dd63e0a876b47f60210b4e8241941fa4caef6cd787410b6900ec117314f6e71f7874ad67417e33cc319d651f35f08d115c91375a2df1629b53a49e6b05edfa0c35eee07f8cbd98fdff7050f5961ec1ce476b81c3852912fbe45193aa055a57fb3"}, @enc_lim={0x4, 0x1, 0xa1}, @padn={0x1, 0x3, [0x0, 0x0, 0x0]}, @pad1, @generic={0x4, 0x7e, "6422a7d87876689ceef99a8621b2ffc64a047f652c39eb4b53e84512a55853993feb36f77364f47b759ba04002b9b194175c2f2237bcb11486a5b8f1f2820497381a8cafa0739ae62382e83c7a2ed1bf16abd0e26754e12c85dc31764c4cae579a163f11e570e8a4dae7894a55d796e1e7663c41c1c3c74e897b7a3f74a3"}, @enc_lim={0x4, 0x1, 0x4}]}], @icmpv6=@ndisc_na={0x88, 0x0, 0x0, 0x33, [], @loopback, [{0x18, 0x1f, "7aa73634e6c60ceb8930c5bc172a27550b256dd38637557a7d83b970fff699ffdefbaa07f0447c8b93f97325462e5116d69981da6536e2687f5321f06984304f9ac34f6594f562862f3408d7b4c5443f15a8a80209bb6b12b9aa87cc0cc07c138e811e6ecded6f5e61e77c35dba8b558258cb7a084638b566318c51376393233a535fd53229c674d82b44771f43ac08dcbcd5ffd65850d7eef8c21b38321d34ef6d1f692cc66c848037cc62d0ca2313ad436b19952df8c0a2ef91ea72b33fc3d62bde2318635397cb595851d393146d95934db891464a974bdf909dcaefd40c35105dd2a939ca02795c290d28346a709666e6566821413fa08d4e6121e"}, {0x5, 0x16, "2e4f2a94c913375e90a89dd2db5208223b2ec7fc3168a4bdcae1797b6d831a4ba9cc91e0e3d11c2ecff44e97dfe6b9b792985a0d2cb083ac59e209795e00930d9ba4c6a1109136acd095fdfe7457f6e27d0aa1bfef5d6d3e9043fbbc4750ca91cd1b4bb6b8c1af78ff401c760d2150994fbe3c5e66e5abbdf14dbfe57971fcddabff8c34a120778e67f38d62e76def1cadb1013d2aab71bc3f3dcdcaa085d1ddb85e52a2f2f5a7a85905155192930f0b"}]}}}}}}) syz_execute_func(&(0x7f00000003c0)="0f01f967660ffdd9c4e111f9dfc4e315025b710b640faef73e0f5bd1c00048c4e37914b4180700000069cf660f132e") syz_extract_tcp_res(&(0x7f0000000400), 0x2, 0x67) csource_test.go:124: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void __attribute__((noinline)) remove_dir(const char* dir) { DIR* dp = opendir(dir); if (dp == NULL) { if (errno == EACCES) { if (rmdir(dir)) exit(1); return; } exit(1); } struct dirent* ep = 0; while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } if (unlink(filename)) exit(1); } closedir(dp); if (rmdir(dir)) exit(1); } #define BITMASK(bf_off,bf_len) (((1ull << (bf_len)) - 1) << (bf_off)) #define STORE_BY_BITMASK(type,htobe,addr,val,bf_off,bf_len) *(type*)(addr) = htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len)))) struct csum_inet { uint32_t acc; }; static void csum_inet_init(struct csum_inet* csum) { csum->acc = 0; } static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) { if (length == 0) return; size_t i = 0; for (; i < length - 1; i += 2) csum->acc += *(uint16_t*)&data[i]; if (length & 1) csum->acc += le16toh((uint16_t)data[length - 1]); while (csum->acc > 0xffff) csum->acc = (csum->acc & 0xffff) + (csum->acc >> 16); } static uint16_t csum_inet_digest(struct csum_inet* csum) { return ~csum->acc; } static void sandbox_common() { if (setsid() == -1) exit(1); struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 8 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 0; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); } static void loop(); static int do_sandbox_none(void) { sandbox_common(); loop(); return 0; } static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } static void execute_one(void); #define WAIT_FLAGS 0 static void loop(void) { int iter = 0; for (;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[2] = {0xffffffffffffffff, 0x0}; void execute_one(void) { intptr_t res = 0; syscall(SYS_fstat, 0xffffff9c, 0x10000000); res = syscall(SYS_socket, 0x1c, 3, 0x3a); if (res != -1) r[0] = res; memcpy((void*)0x10000100, "bbr\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 32); *(uint32_t*)0x10000120 = 0xfff; syscall(SYS_setsockopt, (intptr_t)r[0], 6, 0x2000, 0x10000100, 0x24); *(uint64_t*)0x10000140 = 9; *(uint64_t*)0x10000180 = 0x3f; syscall(SYS_copy_file_range, 0xffffff9c, 0x10000140, (intptr_t)r[0], 0x10000180, 4ull, 0); *(uint32_t*)0x10000200 = 4; syscall(SYS_getsockopt, -1, 0x84, 0x1b, 0x100001c0, 0x10000200); syscall(SYS_getuid); *(uint32_t*)0x10000240 = 0; *(uint32_t*)0x10000244 = 5; *(uint32_t*)0x10000248 = 2; *(uint16_t*)0x1000024c = 0xdd; *(uint16_t*)0x1000024e = 9; *(uint16_t*)0x10000250 = 0x7fff; *(uint16_t*)0x10000252 = 5; *(uint32_t*)0x10000254 = 1; *(uint8_t*)0x10000258 = 0x1c; *(uint8_t*)0x10000259 = 0x1c; *(uint16_t*)0x1000025a = htobe16(0x4e23); *(uint32_t*)0x1000025c = 4; *(uint8_t*)0x10000260 = 0xfe; *(uint8_t*)0x10000261 = 0x80; *(uint8_t*)0x10000262 = 0; *(uint8_t*)0x10000263 = 0; *(uint8_t*)0x10000264 = 0; *(uint8_t*)0x10000265 = 0; *(uint8_t*)0x10000266 = 0; *(uint8_t*)0x10000267 = 0; *(uint8_t*)0x10000268 = 0; *(uint8_t*)0x10000269 = 0; *(uint8_t*)0x1000026a = 0; *(uint8_t*)0x1000026b = 0; *(uint8_t*)0x1000026c = 0; *(uint8_t*)0x1000026d = 0; *(uint8_t*)0x1000026e = 0; *(uint8_t*)0x1000026f = 0xaa; *(uint32_t*)0x10000270 = 0x10000; *(uint64_t*)0x10000274 = 0; *(uint64_t*)0x1000027c = 0; *(uint64_t*)0x10000284 = 0; *(uint64_t*)0x1000028c = 0; *(uint64_t*)0x10000294 = 0; *(uint64_t*)0x1000029c = 0; *(uint64_t*)0x100002a4 = 0; *(uint64_t*)0x100002ac = 0; *(uint64_t*)0x100002b4 = 0; *(uint64_t*)0x100002bc = 0; *(uint64_t*)0x100002c4 = 0; *(uint64_t*)0x100002cc = 0; *(uint32_t*)0x100002d4 = 0; *(uint32_t*)0x100002d8 = 9; *(uint32_t*)0x100002dc = 0xfffffff9; *(uint32_t*)0x100002e0 = 0xdf10; *(uint32_t*)0x100002e4 = 0x40; *(uint32_t*)0x100002e8 = 8; *(uint32_t*)0x10000300 = 0xac; res = syscall(SYS_getsockopt, -1, 0x84, 0x100, 0x10000240, 0x10000300); if (res != -1) r[1] = *(uint32_t*)0x100002d4; *(uint32_t*)0x10000340 = r[1]; *(uint16_t*)0x10000344 = 9; *(uint16_t*)0x10000346 = 3; *(uint64_t*)0x10000348 = 1; *(uint64_t*)0x10000350 = 1; *(uint32_t*)0x10000380 = 0x18; syscall(SYS_getsockopt, (intptr_t)r[0], 0x84, 0x108, 0x10000340, 0x10000380); memcpy((void*)0x100003c0, "\x55\x8e\x86\x6e\xc7\xc5", 6); *(uint8_t*)0x100003c6 = -1; *(uint8_t*)0x100003c7 = -1; *(uint8_t*)0x100003c8 = -1; *(uint8_t*)0x100003c9 = -1; *(uint8_t*)0x100003ca = -1; *(uint8_t*)0x100003cb = -1; *(uint16_t*)0x100003cc = htobe16(0x88a8); STORE_BY_BITMASK(uint16_t, , 0x100003ce, 0, 0, 3); STORE_BY_BITMASK(uint16_t, , 0x100003ce, 0, 3, 1); STORE_BY_BITMASK(uint16_t, , 0x100003ce, 1, 4, 12); *(uint16_t*)0x100003d0 = htobe16(0x8100); STORE_BY_BITMASK(uint16_t, , 0x100003d2, 0, 0, 3); STORE_BY_BITMASK(uint16_t, , 0x100003d2, 0, 3, 1); STORE_BY_BITMASK(uint16_t, , 0x100003d2, 4, 4, 12); *(uint16_t*)0x100003d4 = htobe16(0x800); STORE_BY_BITMASK(uint8_t, , 0x100003d6, 0xc, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x100003d6, 4, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x100003d7, 0, 0, 2); STORE_BY_BITMASK(uint8_t, , 0x100003d7, 8, 2, 6); *(uint16_t*)0x100003d8 = htobe16(0xcd); *(uint16_t*)0x100003da = htobe16(0x68); *(uint16_t*)0x100003dc = htobe16(1); *(uint8_t*)0x100003de = 2; *(uint8_t*)0x100003df = 0x1a; *(uint16_t*)0x100003e0 = htobe16(0); *(uint32_t*)0x100003e2 = htobe32(0xe0000002); *(uint32_t*)0x100003e6 = htobe32(0); *(uint8_t*)0x100003ea = 0x94; *(uint8_t*)0x100003eb = 6; *(uint32_t*)0x100003ec = htobe32(0x10000); *(uint8_t*)0x100003f0 = 0x83; *(uint8_t*)0x100003f1 = 0xb; *(uint8_t*)0x100003f2 = 0; *(uint32_t*)0x100003f3 = htobe32(0x7f000001); *(uint32_t*)0x100003f7 = htobe32(0); *(uint8_t*)0x100003fb = 0x88; *(uint8_t*)0x100003fc = 9; memcpy((void*)0x100003fd, "\x68\xb0\x2e\x9a\xa5\x5a\x8b", 7); *(uint16_t*)0x10000406 = htobe16(0x4e22); *(uint16_t*)0x10000408 = htobe16(0x4e23); *(uint16_t*)0x1000040a = htobe16(8); *(uint16_t*)0x1000040c = htobe16(0); memcpy((void*)0x1000040e, "\x17\x27\x31\x3c\x0d\x12\x1a\xaf\x94\x2a\xba\x95\xb4\xaa\x8f\x3f\xab\x4a\x3f\x42\x3c\x50\xb9\xf3\x20\x7d\xe0\x73\xcd\x93\xe9\xd4\xab\xf4\xdd\x1b\xde\xa8\xb9\xe0\x4e\xc8\x3b\x09\x77\xc7\x09\x4e\xca\x81\x6b\x50\xfc\x61\x3b\x69\x00\x64\x2e\xd7\xc7\x98\x67\xdf\xbf\xa2\xee\x7e\x0d\xa3\xbc\x0e\x15\x22\x5c\x1f\x9e\x12\x3c\x39\x83\x36\x0a\x7a\x32\x7e\x25\xef\x28\x6a\x9c\x45\xd8\x13\x2c\x1c\x22\x01\xec\xdb\x70\xba\x3a\x32\x99\xd6\x68\x03\x14\x42\x83\x60\xae\x3e\x57\xdc\xf3\xe1\x51\x38\x71\x0e\x15\x1b\xad\x45\x03\xa7\x8f\x71\xaa\xe9\xac\xcd\x79\x65\x86\xc9\xb1\xfc\xfa\x62\x0a\x25\x9c\xc6\x10\x14\xef", 149); struct csum_inet csum_1; csum_inet_init(&csum_1); csum_inet_update(&csum_1, (const uint8_t*)0x100003e2, 4); csum_inet_update(&csum_1, (const uint8_t*)0x100003e6, 4); uint16_t csum_1_chunk_2 = 0x1100; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_2, 2); uint16_t csum_1_chunk_3 = 0x800; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_3, 2); csum_inet_update(&csum_1, (const uint8_t*)0x10000406, 8); *(uint16_t*)0x1000040c = csum_inet_digest(&csum_1); struct csum_inet csum_2; csum_inet_init(&csum_2); csum_inet_update(&csum_2, (const uint8_t*)0x100003d6, 48); *(uint16_t*)0x100003e0 = csum_inet_digest(&csum_2); *(uint32_t*)0x100004c0 = 0; syscall(SYS_setgroups, 1, 0x100004c0); *(uint8_t*)0x10000000 = 0; *(uint8_t*)0x10000001 = 0; *(uint8_t*)0x10000002 = 0; *(uint8_t*)0x10000003 = 0; *(uint8_t*)0x10000004 = 0; *(uint8_t*)0x10000005 = 0; *(uint8_t*)0x10000006 = 0; *(uint8_t*)0x10000007 = 0; *(uint8_t*)0x10000008 = 0; *(uint8_t*)0x10000009 = 0; *(uint8_t*)0x1000000a = 0; *(uint8_t*)0x1000000b = 0; *(uint16_t*)0x1000000c = htobe16(0x86dd); STORE_BY_BITMASK(uint8_t, , 0x1000000e, 3, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x1000000e, 6, 4, 4); memcpy((void*)0x1000000f, "\x08\x21\x11", 3); *(uint16_t*)0x10000012 = htobe16(0x389); *(uint8_t*)0x10000014 = 0x6c; *(uint8_t*)0x10000015 = 0; *(uint8_t*)0x10000016 = 0; *(uint8_t*)0x10000017 = 0; *(uint8_t*)0x10000018 = 0; *(uint8_t*)0x10000019 = 0; *(uint8_t*)0x1000001a = 0; *(uint8_t*)0x1000001b = 0; *(uint8_t*)0x1000001c = 0; *(uint8_t*)0x1000001d = 0; *(uint8_t*)0x1000001e = 0; *(uint8_t*)0x1000001f = 0; *(uint8_t*)0x10000020 = -1; *(uint8_t*)0x10000021 = -1; *(uint32_t*)0x10000022 = htobe32(0xe0000002); *(uint64_t*)0x10000026 = htobe64(0); *(uint64_t*)0x1000002e = htobe64(1); *(uint8_t*)0x10000036 = 0x5e; *(uint8_t*)0x10000037 = 0x36; *(uint8_t*)0x10000038 = 0; *(uint8_t*)0x10000039 = 0; *(uint8_t*)0x1000003a = 0; *(uint8_t*)0x1000003b = 0; *(uint8_t*)0x1000003c = 0; *(uint8_t*)0x1000003d = 0; *(uint8_t*)0x1000003e = 0x79; *(uint8_t*)0x1000003f = 0x1a; memcpy((void*)0x10000040, "\x32\x25\x39\xdc\xe6\xc8\x60\xea\xe2\xe7\x17\xfe\x5d\x91\x9d\x50\xf1\x2d\xa8\xc2\x79\x0d\x7b\x77\x8b\xd5", 26); *(uint8_t*)0x1000005a = 5; *(uint8_t*)0x1000005b = 2; *(uint16_t*)0x1000005c = htobe16(7); *(uint8_t*)0x1000005e = 0; *(uint8_t*)0x1000005f = 1; *(uint8_t*)0x10000060 = 0; *(uint8_t*)0x10000061 = 1; *(uint8_t*)0x10000062 = 2; *(uint8_t*)0x10000063 = 0; *(uint8_t*)0x10000064 = 0; *(uint8_t*)0x10000065 = 8; *(uint8_t*)0x10000066 = 0xfa; memcpy((void*)0x10000067, "\xe2\xb0\xb2\x1d\x6f\x96\xa0\x12\xb7\x94\x79\x1a\x56\x4b\x79\x1a\x9b\x08\x76\xcc\x87\xa8\xe8\xdf\xcd\x42\x46\xac\xbd\x2e\x57\x62\x29\x84\x3f\x20\x6d\x42\xee\xc2\xb9\x9d\x4b\x6d\xb9\x3c\xa1\x5f\x41\xcc\x25\xad\xa1\x9e\x33\x8a\x97\x80\xc9\x60\x42\x10\x12\x95\x03\x07\xe6\x5d\xda\x08\x89\x3e\xb2\xf5\x64\x02\xae\xfb\xa1\x48\xc2\xf9\x55\x8d\x7a\x04\xf9\xe1\x35\x24\x7d\x1a\x8d\x04\x24\x62\x50\x45\x2d\x0f\x26\x3c\xf9\x0a\xa9\x8d\x56\x9e\xaa\x16\x83\x4e\xa0\x45\xe6\xda\xbc\xe8\x90\x6a\xc9\xaf\x25\xef\xb2\xe5\xbc\xc2\x4b\x0d\xea\xbd\x73\x19\xca\x60\x6a\x2e\x28\xb6\x58\xae\xa5\x94\x7a\x43\x07\x5c\x1f\x2e\xa5\x0c\xca\x8d\xd6\x3e\x0a\x87\x6b\x47\xf6\x02\x10\xb4\xe8\x24\x19\x41\xfa\x4c\xae\xf6\xcd\x78\x74\x10\xb6\x90\x0e\xc1\x17\x31\x4f\x6e\x71\xf7\x87\x4a\xd6\x74\x17\xe3\x3c\xc3\x19\xd6\x51\xf3\x5f\x08\xd1\x15\xc9\x13\x75\xa2\xdf\x16\x29\xb5\x3a\x49\xe6\xb0\x5e\xdf\xa0\xc3\x5e\xee\x07\xf8\xcb\xd9\x8f\xdf\xf7\x05\x0f\x59\x61\xec\x1c\xe4\x76\xb8\x1c\x38\x52\x91\x2f\xbe\x45\x19\x3a\xa0\x55\xa5\x7f\xb3", 250); *(uint8_t*)0x10000161 = 4; *(uint8_t*)0x10000162 = 1; *(uint8_t*)0x10000163 = 0xa1; *(uint8_t*)0x10000164 = 1; *(uint8_t*)0x10000165 = 3; *(uint8_t*)0x10000166 = 0; *(uint8_t*)0x10000167 = 0; *(uint8_t*)0x10000168 = 0; *(uint8_t*)0x10000169 = 0; *(uint8_t*)0x1000016a = 1; *(uint8_t*)0x1000016b = 0; *(uint8_t*)0x1000016c = 4; *(uint8_t*)0x1000016d = 0x7e; memcpy((void*)0x1000016e, "\x64\x22\xa7\xd8\x78\x76\x68\x9c\xee\xf9\x9a\x86\x21\xb2\xff\xc6\x4a\x04\x7f\x65\x2c\x39\xeb\x4b\x53\xe8\x45\x12\xa5\x58\x53\x99\x3f\xeb\x36\xf7\x73\x64\xf4\x7b\x75\x9b\xa0\x40\x02\xb9\xb1\x94\x17\x5c\x2f\x22\x37\xbc\xb1\x14\x86\xa5\xb8\xf1\xf2\x82\x04\x97\x38\x1a\x8c\xaf\xa0\x73\x9a\xe6\x23\x82\xe8\x3c\x7a\x2e\xd1\xbf\x16\xab\xd0\xe2\x67\x54\xe1\x2c\x85\xdc\x31\x76\x4c\x4c\xae\x57\x9a\x16\x3f\x11\xe5\x70\xe8\xa4\xda\xe7\x89\x4a\x55\xd7\x96\xe1\xe7\x66\x3c\x41\xc1\xc3\xc7\x4e\x89\x7b\x7a\x3f\x74\xa3", 126); *(uint8_t*)0x100001ec = 4; *(uint8_t*)0x100001ed = 1; *(uint8_t*)0x100001ee = 4; *(uint8_t*)0x100001f6 = 0x88; *(uint8_t*)0x100001f7 = 0; *(uint16_t*)0x100001f8 = htobe16(0); *(uint8_t*)0x100001fa = 0x33; *(uint8_t*)0x100001fb = 0; *(uint8_t*)0x100001fc = 0; *(uint8_t*)0x100001fd = 0; *(uint64_t*)0x100001fe = htobe64(0); *(uint64_t*)0x10000206 = htobe64(1); *(uint8_t*)0x1000020e = 0x18; *(uint8_t*)0x1000020f = 0x1f; memcpy((void*)0x10000210, "\x7a\xa7\x36\x34\xe6\xc6\x0c\xeb\x89\x30\xc5\xbc\x17\x2a\x27\x55\x0b\x25\x6d\xd3\x86\x37\x55\x7a\x7d\x83\xb9\x70\xff\xf6\x99\xff\xde\xfb\xaa\x07\xf0\x44\x7c\x8b\x93\xf9\x73\x25\x46\x2e\x51\x16\xd6\x99\x81\xda\x65\x36\xe2\x68\x7f\x53\x21\xf0\x69\x84\x30\x4f\x9a\xc3\x4f\x65\x94\xf5\x62\x86\x2f\x34\x08\xd7\xb4\xc5\x44\x3f\x15\xa8\xa8\x02\x09\xbb\x6b\x12\xb9\xaa\x87\xcc\x0c\xc0\x7c\x13\x8e\x81\x1e\x6e\xcd\xed\x6f\x5e\x61\xe7\x7c\x35\xdb\xa8\xb5\x58\x25\x8c\xb7\xa0\x84\x63\x8b\x56\x63\x18\xc5\x13\x76\x39\x32\x33\xa5\x35\xfd\x53\x22\x9c\x67\x4d\x82\xb4\x47\x71\xf4\x3a\xc0\x8d\xcb\xcd\x5f\xfd\x65\x85\x0d\x7e\xef\x8c\x21\xb3\x83\x21\xd3\x4e\xf6\xd1\xf6\x92\xcc\x66\xc8\x48\x03\x7c\xc6\x2d\x0c\xa2\x31\x3a\xd4\x36\xb1\x99\x52\xdf\x8c\x0a\x2e\xf9\x1e\xa7\x2b\x33\xfc\x3d\x62\xbd\xe2\x31\x86\x35\x39\x7c\xb5\x95\x85\x1d\x39\x31\x46\xd9\x59\x34\xdb\x89\x14\x64\xa9\x74\xbd\xf9\x09\xdc\xae\xfd\x40\xc3\x51\x05\xdd\x2a\x93\x9c\xa0\x27\x95\xc2\x90\xd2\x83\x46\xa7\x09\x66\x6e\x65\x66\x82\x14\x13\xfa\x08\xd4\xe6\x12\x1e", 253); *(uint8_t*)0x1000030d = 5; *(uint8_t*)0x1000030e = 0x16; memcpy((void*)0x1000030f, "\x2e\x4f\x2a\x94\xc9\x13\x37\x5e\x90\xa8\x9d\xd2\xdb\x52\x08\x22\x3b\x2e\xc7\xfc\x31\x68\xa4\xbd\xca\xe1\x79\x7b\x6d\x83\x1a\x4b\xa9\xcc\x91\xe0\xe3\xd1\x1c\x2e\xcf\xf4\x4e\x97\xdf\xe6\xb9\xb7\x92\x98\x5a\x0d\x2c\xb0\x83\xac\x59\xe2\x09\x79\x5e\x00\x93\x0d\x9b\xa4\xc6\xa1\x10\x91\x36\xac\xd0\x95\xfd\xfe\x74\x57\xf6\xe2\x7d\x0a\xa1\xbf\xef\x5d\x6d\x3e\x90\x43\xfb\xbc\x47\x50\xca\x91\xcd\x1b\x4b\xb6\xb8\xc1\xaf\x78\xff\x40\x1c\x76\x0d\x21\x50\x99\x4f\xbe\x3c\x5e\x66\xe5\xab\xbd\xf1\x4d\xbf\xe5\x79\x71\xfc\xdd\xab\xff\x8c\x34\xa1\x20\x77\x8e\x67\xf3\x8d\x62\xe7\x6d\xef\x1c\xad\xb1\x01\x3d\x2a\xab\x71\xbc\x3f\x3d\xcd\xca\xa0\x85\xd1\xdd\xb8\x5e\x52\xa2\xf2\xf5\xa7\xa8\x59\x05\x15\x51\x92\x93\x0f\x0b", 176); struct csum_inet csum_3; csum_inet_init(&csum_3); csum_inet_update(&csum_3, (const uint8_t*)0x10000016, 16); csum_inet_update(&csum_3, (const uint8_t*)0x10000026, 16); uint32_t csum_3_chunk_2 = 0xc9010000; csum_inet_update(&csum_3, (const uint8_t*)&csum_3_chunk_2, 4); uint32_t csum_3_chunk_3 = 0x3a000000; csum_inet_update(&csum_3, (const uint8_t*)&csum_3_chunk_3, 4); csum_inet_update(&csum_3, (const uint8_t*)0x100001f6, 457); *(uint16_t*)0x100001f8 = csum_inet_digest(&csum_3); memcpy((void*)0x100003c0, "\x0f\x01\xf9\x67\x66\x0f\xfd\xd9\xc4\xe1\x11\xf9\xdf\xc4\xe3\x15\x02\x5b\x71\x0b\x64\x0f\xae\xf7\x3e\x0f\x5b\xd1\xc0\x00\x48\xc4\xe3\x79\x14\xb4\x18\x07\x00\x00\x00\x69\xcf\x66\x0f\x13\x2e", 47); syz_execute_func(0x100003c0); } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); use_temporary_dir(); do_sandbox_none(); return 0; } :203:10: error: use of undeclared identifier 'SYS_copy_file_range' syscall(SYS_copy_file_range, 0xffffff9c, 0x10000140, (intptr_t)r[0], 0x10000180, 4ull, 0); ^ 1 error generated. compiler invocation: clang [-o /tmp/syz-executor179370985 -DGOOS_freebsd=1 -DGOARCH_386=1 -DHOSTGOOS_freebsd=1 -x c - -m32 -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -static -lc++ -Wno-overflow] --- FAIL: TestGenerate/freebsd/386/8 (0.68s) csource_test.go:123: opts: {Threaded:true Collide:false Repeat:true RepeatTimes:0 Procs:0 Sandbox:setuid Fault:false FaultCall:0 FaultNth:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false VhciInjection:false Wifi:false Sysctl:false UseTmpDir:true HandleSegv:false Repro:false Trace:false} program: fstat(0xffffffffffffff9c, &(0x7f0000000000)) r0 = socket$inet6_icmp_raw(0x1c, 0x3, 0x3a) setsockopt$inet6_tcp_TCP_FUNCTION_BLK(r0, 0x6, 0x2000, &(0x7f0000000100)={'bbr\x00', 0xfff}, 0x24) copy_file_range(0xffffffffffffff9c, &(0x7f0000000140)=0x9, r0, &(0x7f0000000180)=0x3f, 0x4, 0x0) getsockopt$inet_sctp_SCTP_EXPLICIT_EOR(0xffffffffffffffff, 0x84, 0x1b, &(0x7f00000001c0), &(0x7f0000000200)=0x4) getuid() getsockopt$inet_sctp_SCTP_STATUS(0xffffffffffffffff, 0x84, 0x100, &(0x7f0000000240)={0x0, 0x5, 0x2, 0xdd, 0x9, 0x7fff, 0x5, 0x1, {@in6={{0x1c, 0x1c, 0x3, 0x4, @local={0xfe, 0x80, [], 0x0}, 0x10000}}, 0x0, 0x9, 0xfffffff9, 0xdf10, 0x40, 0x8}}, &(0x7f0000000300)=0xac) getsockopt$inet6_sctp_SCTP_PR_ASSOC_STATUS(r0, 0x84, 0x108, &(0x7f0000000340)={r1, 0x9, 0x3, 0x1, 0x1}, &(0x7f0000000380)=0x18) syz_emit_ethernet(0xe3, &(0x7f00000003c0)={@random="558e866ec7c5", @broadcast, [{[{0x88a8, 0x0, 0x0, 0x1}], {0x8100, 0x0, 0x0, 0x4}}], {@ipv4={0x800, {{0xc, 0x4, 0x0, 0x8, 0xcd, 0x68, 0x1, 0x2, 0x1a, 0x0, @multicast2, @rand_addr, {[@ra={0x94, 0x6, 0x10000}, @lsrr={0x83, 0xb, 0x0, [@loopback, @empty]}, @generic={0x88, 0x9, "68b02e9aa55a8b"}]}}, @udp={{0x2, 0x3, 0x8}, {"1727313c0d121aaf942aba95b4aa8f3fab4a3f423c50b9f3207de073cd93e9d4abf4dd1bdea8b9e04ec83b0977c7094eca816b50fc613b6900642ed7c79867dfbfa2ee7e0da3bc0e15225c1f9e123c3983360a7a327e25ef286a9c45d8132c1c2201ecdb70ba3a3299d6680314428360ae3e57dcf3e15138710e151bad4503a78f71aae9accd796586c9b1fcfa620a259cc61014ef"}}}}}}) setgroups(0x1, &(0x7f00000004c0)=[0x0]) syz_emit_ethernet(0x3bf, &(0x7f0000000000)={@empty, @empty, [], {@ipv6={0x86dd, {0x3, 0x6, "082111", 0x389, 0x6c, 0x0, @ipv4={[], [], @multicast2}, @loopback, {[@dstopts={0x5e, 0x36, [], [@generic={0x79, 0x1a, "322539dce6c860eae2e717fe5d919d50f12da8c2790d7b778bd5"}, @ra={0x5, 0x2, 0x7}, @pad1, @padn={0x1, 0x2, [0x0, 0x0]}, @generic={0x8, 0xfa, "e2b0b21d6f96a012b794791a564b791a9b0876cc87a8e8dfcd4246acbd2e576229843f206d42eec2b99d4b6db93ca15f41cc25ada19e338a9780c960421012950307e65dda08893eb2f56402aefba148c2f9558d7a04f9e135247d1a8d04246250452d0f263cf90aa98d569eaa16834ea045e6dabce8906ac9af25efb2e5bcc24b0deabd7319ca606a2e28b658aea5947a43075c1f2ea50cca8dd63e0a876b47f60210b4e8241941fa4caef6cd787410b6900ec117314f6e71f7874ad67417e33cc319d651f35f08d115c91375a2df1629b53a49e6b05edfa0c35eee07f8cbd98fdff7050f5961ec1ce476b81c3852912fbe45193aa055a57fb3"}, @enc_lim={0x4, 0x1, 0xa1}, @padn={0x1, 0x3, [0x0, 0x0, 0x0]}, @pad1, @generic={0x4, 0x7e, "6422a7d87876689ceef99a8621b2ffc64a047f652c39eb4b53e84512a55853993feb36f77364f47b759ba04002b9b194175c2f2237bcb11486a5b8f1f2820497381a8cafa0739ae62382e83c7a2ed1bf16abd0e26754e12c85dc31764c4cae579a163f11e570e8a4dae7894a55d796e1e7663c41c1c3c74e897b7a3f74a3"}, @enc_lim={0x4, 0x1, 0x4}]}], @icmpv6=@ndisc_na={0x88, 0x0, 0x0, 0x33, [], @loopback, [{0x18, 0x1f, "7aa73634e6c60ceb8930c5bc172a27550b256dd38637557a7d83b970fff699ffdefbaa07f0447c8b93f97325462e5116d69981da6536e2687f5321f06984304f9ac34f6594f562862f3408d7b4c5443f15a8a80209bb6b12b9aa87cc0cc07c138e811e6ecded6f5e61e77c35dba8b558258cb7a084638b566318c51376393233a535fd53229c674d82b44771f43ac08dcbcd5ffd65850d7eef8c21b38321d34ef6d1f692cc66c848037cc62d0ca2313ad436b19952df8c0a2ef91ea72b33fc3d62bde2318635397cb595851d393146d95934db891464a974bdf909dcaefd40c35105dd2a939ca02795c290d28346a709666e6566821413fa08d4e6121e"}, {0x5, 0x16, "2e4f2a94c913375e90a89dd2db5208223b2ec7fc3168a4bdcae1797b6d831a4ba9cc91e0e3d11c2ecff44e97dfe6b9b792985a0d2cb083ac59e209795e00930d9ba4c6a1109136acd095fdfe7457f6e27d0aa1bfef5d6d3e9043fbbc4750ca91cd1b4bb6b8c1af78ff401c760d2150994fbe3c5e66e5abbdf14dbfe57971fcddabff8c34a120778e67f38d62e76def1cadb1013d2aab71bc3f3dcdcaa085d1ddb85e52a2f2f5a7a85905155192930f0b"}]}}}}}}) syz_execute_func(&(0x7f00000003c0)="0f01f967660ffdd9c4e111f9dfc4e315025b710b640faef73e0f5bd1c00048c4e37914b4180700000069cf660f132e") syz_extract_tcp_res(&(0x7f0000000400), 0x2, 0x67) csource_test.go:124: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void __attribute__((noinline)) remove_dir(const char* dir) { DIR* dp = opendir(dir); if (dp == NULL) { if (errno == EACCES) { if (rmdir(dir)) exit(1); return; } exit(1); } struct dirent* ep = 0; while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } if (unlink(filename)) exit(1); } closedir(dp); if (rmdir(dir)) exit(1); } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { pthread_mutex_t mu; pthread_cond_t cv; int state; } event_t; static void event_init(event_t* ev) { if (pthread_mutex_init(&ev->mu, 0)) exit(1); if (pthread_cond_init(&ev->cv, 0)) exit(1); ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { pthread_mutex_lock(&ev->mu); if (ev->state) exit(1); ev->state = 1; pthread_mutex_unlock(&ev->mu); pthread_cond_broadcast(&ev->cv); } static void event_wait(event_t* ev) { pthread_mutex_lock(&ev->mu); while (!ev->state) pthread_cond_wait(&ev->cv, &ev->mu); pthread_mutex_unlock(&ev->mu); } static int event_isset(event_t* ev) { pthread_mutex_lock(&ev->mu); int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; pthread_mutex_lock(&ev->mu); for (;;) { if (ev->state) break; uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); now = current_time_ms(); if (now - start > timeout) break; } int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } #define BITMASK(bf_off,bf_len) (((1ull << (bf_len)) - 1) << (bf_off)) #define STORE_BY_BITMASK(type,htobe,addr,val,bf_off,bf_len) *(type*)(addr) = htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len)))) struct csum_inet { uint32_t acc; }; static void csum_inet_init(struct csum_inet* csum) { csum->acc = 0; } static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) { if (length == 0) return; size_t i = 0; for (; i < length - 1; i += 2) csum->acc += *(uint16_t*)&data[i]; if (length & 1) csum->acc += le16toh((uint16_t)data[length - 1]); while (csum->acc > 0xffff) csum->acc = (csum->acc & 0xffff) + (csum->acc >> 16); } static uint16_t csum_inet_digest(struct csum_inet* csum) { return ~csum->acc; } static void sandbox_common() { struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 8 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 0; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); } static void loop(); static int wait_for_loop(int pid) { if (pid < 0) exit(1); int status = 0; while (waitpid(-1, &status, WUNTRACED) != pid) { } return WEXITSTATUS(status); } static int do_sandbox_setuid(void) { int pid = fork(); if (pid != 0) return wait_for_loop(pid); sandbox_common(); char pwbuf[1024]; struct passwd *pw, pwres; if (getpwnam_r("nobody", &pwres, pwbuf, sizeof(pwbuf), &pw) != 0 || !pw) exit(1); if (setgroups(0, NULL)) exit(1); if (setgid(pw->pw_gid)) exit(1); if (setuid(pw->pw_uid)) exit(1); loop(); exit(1); } static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 13; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); event_timedwait(&th->done, 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 = 0; for (;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[2] = {0xffffffffffffffff, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: syscall(SYS_fstat, 0xffffff9c, 0x10000000); break; case 1: res = syscall(SYS_socket, 0x1c, 3, 0x3a); if (res != -1) r[0] = res; break; case 2: memcpy((void*)0x10000100, "bbr\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 32); *(uint32_t*)0x10000120 = 0xfff; syscall(SYS_setsockopt, (intptr_t)r[0], 6, 0x2000, 0x10000100, 0x24); break; case 3: *(uint64_t*)0x10000140 = 9; *(uint64_t*)0x10000180 = 0x3f; syscall(SYS_copy_file_range, 0xffffff9c, 0x10000140, (intptr_t)r[0], 0x10000180, 4ull, 0); break; case 4: *(uint32_t*)0x10000200 = 4; syscall(SYS_getsockopt, -1, 0x84, 0x1b, 0x100001c0, 0x10000200); break; case 5: syscall(SYS_getuid); break; case 6: *(uint32_t*)0x10000240 = 0; *(uint32_t*)0x10000244 = 5; *(uint32_t*)0x10000248 = 2; *(uint16_t*)0x1000024c = 0xdd; *(uint16_t*)0x1000024e = 9; *(uint16_t*)0x10000250 = 0x7fff; *(uint16_t*)0x10000252 = 5; *(uint32_t*)0x10000254 = 1; *(uint8_t*)0x10000258 = 0x1c; *(uint8_t*)0x10000259 = 0x1c; *(uint16_t*)0x1000025a = htobe16(0x4e23); *(uint32_t*)0x1000025c = 4; *(uint8_t*)0x10000260 = 0xfe; *(uint8_t*)0x10000261 = 0x80; *(uint8_t*)0x10000262 = 0; *(uint8_t*)0x10000263 = 0; *(uint8_t*)0x10000264 = 0; *(uint8_t*)0x10000265 = 0; *(uint8_t*)0x10000266 = 0; *(uint8_t*)0x10000267 = 0; *(uint8_t*)0x10000268 = 0; *(uint8_t*)0x10000269 = 0; *(uint8_t*)0x1000026a = 0; *(uint8_t*)0x1000026b = 0; *(uint8_t*)0x1000026c = 0; *(uint8_t*)0x1000026d = 0; *(uint8_t*)0x1000026e = 0; *(uint8_t*)0x1000026f = 0xaa; *(uint32_t*)0x10000270 = 0x10000; *(uint64_t*)0x10000274 = 0; *(uint64_t*)0x1000027c = 0; *(uint64_t*)0x10000284 = 0; *(uint64_t*)0x1000028c = 0; *(uint64_t*)0x10000294 = 0; *(uint64_t*)0x1000029c = 0; *(uint64_t*)0x100002a4 = 0; *(uint64_t*)0x100002ac = 0; *(uint64_t*)0x100002b4 = 0; *(uint64_t*)0x100002bc = 0; *(uint64_t*)0x100002c4 = 0; *(uint64_t*)0x100002cc = 0; *(uint32_t*)0x100002d4 = 0; *(uint32_t*)0x100002d8 = 9; *(uint32_t*)0x100002dc = 0xfffffff9; *(uint32_t*)0x100002e0 = 0xdf10; *(uint32_t*)0x100002e4 = 0x40; *(uint32_t*)0x100002e8 = 8; *(uint32_t*)0x10000300 = 0xac; res = syscall(SYS_getsockopt, -1, 0x84, 0x100, 0x10000240, 0x10000300); if (res != -1) r[1] = *(uint32_t*)0x100002d4; break; case 7: *(uint32_t*)0x10000340 = r[1]; *(uint16_t*)0x10000344 = 9; *(uint16_t*)0x10000346 = 3; *(uint64_t*)0x10000348 = 1; *(uint64_t*)0x10000350 = 1; *(uint32_t*)0x10000380 = 0x18; syscall(SYS_getsockopt, (intptr_t)r[0], 0x84, 0x108, 0x10000340, 0x10000380); break; case 8: memcpy((void*)0x100003c0, "\x55\x8e\x86\x6e\xc7\xc5", 6); *(uint8_t*)0x100003c6 = -1; *(uint8_t*)0x100003c7 = -1; *(uint8_t*)0x100003c8 = -1; *(uint8_t*)0x100003c9 = -1; *(uint8_t*)0x100003ca = -1; *(uint8_t*)0x100003cb = -1; *(uint16_t*)0x100003cc = htobe16(0x88a8); STORE_BY_BITMASK(uint16_t, , 0x100003ce, 0, 0, 3); STORE_BY_BITMASK(uint16_t, , 0x100003ce, 0, 3, 1); STORE_BY_BITMASK(uint16_t, , 0x100003ce, 1, 4, 12); *(uint16_t*)0x100003d0 = htobe16(0x8100); STORE_BY_BITMASK(uint16_t, , 0x100003d2, 0, 0, 3); STORE_BY_BITMASK(uint16_t, , 0x100003d2, 0, 3, 1); STORE_BY_BITMASK(uint16_t, , 0x100003d2, 4, 4, 12); *(uint16_t*)0x100003d4 = htobe16(0x800); STORE_BY_BITMASK(uint8_t, , 0x100003d6, 0xc, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x100003d6, 4, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x100003d7, 0, 0, 2); STORE_BY_BITMASK(uint8_t, , 0x100003d7, 8, 2, 6); *(uint16_t*)0x100003d8 = htobe16(0xcd); *(uint16_t*)0x100003da = htobe16(0x68); *(uint16_t*)0x100003dc = htobe16(1); *(uint8_t*)0x100003de = 2; *(uint8_t*)0x100003df = 0x1a; *(uint16_t*)0x100003e0 = htobe16(0); *(uint32_t*)0x100003e2 = htobe32(0xe0000002); *(uint32_t*)0x100003e6 = htobe32(0); *(uint8_t*)0x100003ea = 0x94; *(uint8_t*)0x100003eb = 6; *(uint32_t*)0x100003ec = htobe32(0x10000); *(uint8_t*)0x100003f0 = 0x83; *(uint8_t*)0x100003f1 = 0xb; *(uint8_t*)0x100003f2 = 0; *(uint32_t*)0x100003f3 = htobe32(0x7f000001); *(uint32_t*)0x100003f7 = htobe32(0); *(uint8_t*)0x100003fb = 0x88; *(uint8_t*)0x100003fc = 9; memcpy((void*)0x100003fd, "\x68\xb0\x2e\x9a\xa5\x5a\x8b", 7); *(uint16_t*)0x10000406 = htobe16(0x4e22); *(uint16_t*)0x10000408 = htobe16(0x4e23); *(uint16_t*)0x1000040a = htobe16(8); *(uint16_t*)0x1000040c = htobe16(0); memcpy((void*)0x1000040e, "\x17\x27\x31\x3c\x0d\x12\x1a\xaf\x94\x2a\xba\x95\xb4\xaa\x8f\x3f\xab\x4a\x3f\x42\x3c\x50\xb9\xf3\x20\x7d\xe0\x73\xcd\x93\xe9\xd4\xab\xf4\xdd\x1b\xde\xa8\xb9\xe0\x4e\xc8\x3b\x09\x77\xc7\x09\x4e\xca\x81\x6b\x50\xfc\x61\x3b\x69\x00\x64\x2e\xd7\xc7\x98\x67\xdf\xbf\xa2\xee\x7e\x0d\xa3\xbc\x0e\x15\x22\x5c\x1f\x9e\x12\x3c\x39\x83\x36\x0a\x7a\x32\x7e\x25\xef\x28\x6a\x9c\x45\xd8\x13\x2c\x1c\x22\x01\xec\xdb\x70\xba\x3a\x32\x99\xd6\x68\x03\x14\x42\x83\x60\xae\x3e\x57\xdc\xf3\xe1\x51\x38\x71\x0e\x15\x1b\xad\x45\x03\xa7\x8f\x71\xaa\xe9\xac\xcd\x79\x65\x86\xc9\xb1\xfc\xfa\x62\x0a\x25\x9c\xc6\x10\x14\xef", 149); struct csum_inet csum_1; csum_inet_init(&csum_1); csum_inet_update(&csum_1, (const uint8_t*)0x100003e2, 4); csum_inet_update(&csum_1, (const uint8_t*)0x100003e6, 4); uint16_t csum_1_chunk_2 = 0x1100; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_2, 2); uint16_t csum_1_chunk_3 = 0x800; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_3, 2); csum_inet_update(&csum_1, (const uint8_t*)0x10000406, 8); *(uint16_t*)0x1000040c = csum_inet_digest(&csum_1); struct csum_inet csum_2; csum_inet_init(&csum_2); csum_inet_update(&csum_2, (const uint8_t*)0x100003d6, 48); *(uint16_t*)0x100003e0 = csum_inet_digest(&csum_2); break; case 9: *(uint32_t*)0x100004c0 = 0; syscall(SYS_setgroups, 1, 0x100004c0); break; case 10: *(uint8_t*)0x10000000 = 0; *(uint8_t*)0x10000001 = 0; *(uint8_t*)0x10000002 = 0; *(uint8_t*)0x10000003 = 0; *(uint8_t*)0x10000004 = 0; *(uint8_t*)0x10000005 = 0; *(uint8_t*)0x10000006 = 0; *(uint8_t*)0x10000007 = 0; *(uint8_t*)0x10000008 = 0; *(uint8_t*)0x10000009 = 0; *(uint8_t*)0x1000000a = 0; *(uint8_t*)0x1000000b = 0; *(uint16_t*)0x1000000c = htobe16(0x86dd); STORE_BY_BITMASK(uint8_t, , 0x1000000e, 3, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x1000000e, 6, 4, 4); memcpy((void*)0x1000000f, "\x08\x21\x11", 3); *(uint16_t*)0x10000012 = htobe16(0x389); *(uint8_t*)0x10000014 = 0x6c; *(uint8_t*)0x10000015 = 0; *(uint8_t*)0x10000016 = 0; *(uint8_t*)0x10000017 = 0; *(uint8_t*)0x10000018 = 0; *(uint8_t*)0x10000019 = 0; *(uint8_t*)0x1000001a = 0; *(uint8_t*)0x1000001b = 0; *(uint8_t*)0x1000001c = 0; *(uint8_t*)0x1000001d = 0; *(uint8_t*)0x1000001e = 0; *(uint8_t*)0x1000001f = 0; *(uint8_t*)0x10000020 = -1; *(uint8_t*)0x10000021 = -1; *(uint32_t*)0x10000022 = htobe32(0xe0000002); *(uint64_t*)0x10000026 = htobe64(0); *(uint64_t*)0x1000002e = htobe64(1); *(uint8_t*)0x10000036 = 0x5e; *(uint8_t*)0x10000037 = 0x36; *(uint8_t*)0x10000038 = 0; *(uint8_t*)0x10000039 = 0; *(uint8_t*)0x1000003a = 0; *(uint8_t*)0x1000003b = 0; *(uint8_t*)0x1000003c = 0; *(uint8_t*)0x1000003d = 0; *(uint8_t*)0x1000003e = 0x79; *(uint8_t*)0x1000003f = 0x1a; memcpy((void*)0x10000040, "\x32\x25\x39\xdc\xe6\xc8\x60\xea\xe2\xe7\x17\xfe\x5d\x91\x9d\x50\xf1\x2d\xa8\xc2\x79\x0d\x7b\x77\x8b\xd5", 26); *(uint8_t*)0x1000005a = 5; *(uint8_t*)0x1000005b = 2; *(uint16_t*)0x1000005c = htobe16(7); *(uint8_t*)0x1000005e = 0; *(uint8_t*)0x1000005f = 1; *(uint8_t*)0x10000060 = 0; *(uint8_t*)0x10000061 = 1; *(uint8_t*)0x10000062 = 2; *(uint8_t*)0x10000063 = 0; *(uint8_t*)0x10000064 = 0; *(uint8_t*)0x10000065 = 8; *(uint8_t*)0x10000066 = 0xfa; memcpy((void*)0x10000067, "\xe2\xb0\xb2\x1d\x6f\x96\xa0\x12\xb7\x94\x79\x1a\x56\x4b\x79\x1a\x9b\x08\x76\xcc\x87\xa8\xe8\xdf\xcd\x42\x46\xac\xbd\x2e\x57\x62\x29\x84\x3f\x20\x6d\x42\xee\xc2\xb9\x9d\x4b\x6d\xb9\x3c\xa1\x5f\x41\xcc\x25\xad\xa1\x9e\x33\x8a\x97\x80\xc9\x60\x42\x10\x12\x95\x03\x07\xe6\x5d\xda\x08\x89\x3e\xb2\xf5\x64\x02\xae\xfb\xa1\x48\xc2\xf9\x55\x8d\x7a\x04\xf9\xe1\x35\x24\x7d\x1a\x8d\x04\x24\x62\x50\x45\x2d\x0f\x26\x3c\xf9\x0a\xa9\x8d\x56\x9e\xaa\x16\x83\x4e\xa0\x45\xe6\xda\xbc\xe8\x90\x6a\xc9\xaf\x25\xef\xb2\xe5\xbc\xc2\x4b\x0d\xea\xbd\x73\x19\xca\x60\x6a\x2e\x28\xb6\x58\xae\xa5\x94\x7a\x43\x07\x5c\x1f\x2e\xa5\x0c\xca\x8d\xd6\x3e\x0a\x87\x6b\x47\xf6\x02\x10\xb4\xe8\x24\x19\x41\xfa\x4c\xae\xf6\xcd\x78\x74\x10\xb6\x90\x0e\xc1\x17\x31\x4f\x6e\x71\xf7\x87\x4a\xd6\x74\x17\xe3\x3c\xc3\x19\xd6\x51\xf3\x5f\x08\xd1\x15\xc9\x13\x75\xa2\xdf\x16\x29\xb5\x3a\x49\xe6\xb0\x5e\xdf\xa0\xc3\x5e\xee\x07\xf8\xcb\xd9\x8f\xdf\xf7\x05\x0f\x59\x61\xec\x1c\xe4\x76\xb8\x1c\x38\x52\x91\x2f\xbe\x45\x19\x3a\xa0\x55\xa5\x7f\xb3", 250); *(uint8_t*)0x10000161 = 4; *(uint8_t*)0x10000162 = 1; *(uint8_t*)0x10000163 = 0xa1; *(uint8_t*)0x10000164 = 1; *(uint8_t*)0x10000165 = 3; *(uint8_t*)0x10000166 = 0; *(uint8_t*)0x10000167 = 0; *(uint8_t*)0x10000168 = 0; *(uint8_t*)0x10000169 = 0; *(uint8_t*)0x1000016a = 1; *(uint8_t*)0x1000016b = 0; *(uint8_t*)0x1000016c = 4; *(uint8_t*)0x1000016d = 0x7e; memcpy((void*)0x1000016e, "\x64\x22\xa7\xd8\x78\x76\x68\x9c\xee\xf9\x9a\x86\x21\xb2\xff\xc6\x4a\x04\x7f\x65\x2c\x39\xeb\x4b\x53\xe8\x45\x12\xa5\x58\x53\x99\x3f\xeb\x36\xf7\x73\x64\xf4\x7b\x75\x9b\xa0\x40\x02\xb9\xb1\x94\x17\x5c\x2f\x22\x37\xbc\xb1\x14\x86\xa5\xb8\xf1\xf2\x82\x04\x97\x38\x1a\x8c\xaf\xa0\x73\x9a\xe6\x23\x82\xe8\x3c\x7a\x2e\xd1\xbf\x16\xab\xd0\xe2\x67\x54\xe1\x2c\x85\xdc\x31\x76\x4c\x4c\xae\x57\x9a\x16\x3f\x11\xe5\x70\xe8\xa4\xda\xe7\x89\x4a\x55\xd7\x96\xe1\xe7\x66\x3c\x41\xc1\xc3\xc7\x4e\x89\x7b\x7a\x3f\x74\xa3", 126); *(uint8_t*)0x100001ec = 4; *(uint8_t*)0x100001ed = 1; *(uint8_t*)0x100001ee = 4; *(uint8_t*)0x100001f6 = 0x88; *(uint8_t*)0x100001f7 = 0; *(uint16_t*)0x100001f8 = htobe16(0); *(uint8_t*)0x100001fa = 0x33; *(uint8_t*)0x100001fb = 0; *(uint8_t*)0x100001fc = 0; *(uint8_t*)0x100001fd = 0; *(uint64_t*)0x100001fe = htobe64(0); *(uint64_t*)0x10000206 = htobe64(1); *(uint8_t*)0x1000020e = 0x18; *(uint8_t*)0x1000020f = 0x1f; memcpy((void*)0x10000210, "\x7a\xa7\x36\x34\xe6\xc6\x0c\xeb\x89\x30\xc5\xbc\x17\x2a\x27\x55\x0b\x25\x6d\xd3\x86\x37\x55\x7a\x7d\x83\xb9\x70\xff\xf6\x99\xff\xde\xfb\xaa\x07\xf0\x44\x7c\x8b\x93\xf9\x73\x25\x46\x2e\x51\x16\xd6\x99\x81\xda\x65\x36\xe2\x68\x7f\x53\x21\xf0\x69\x84\x30\x4f\x9a\xc3\x4f\x65\x94\xf5\x62\x86\x2f\x34\x08\xd7\xb4\xc5\x44\x3f\x15\xa8\xa8\x02\x09\xbb\x6b\x12\xb9\xaa\x87\xcc\x0c\xc0\x7c\x13\x8e\x81\x1e\x6e\xcd\xed\x6f\x5e\x61\xe7\x7c\x35\xdb\xa8\xb5\x58\x25\x8c\xb7\xa0\x84\x63\x8b\x56\x63\x18\xc5\x13\x76\x39\x32\x33\xa5\x35\xfd\x53\x22\x9c\x67\x4d\x82\xb4\x47\x71\xf4\x3a\xc0\x8d\xcb\xcd\x5f\xfd\x65\x85\x0d\x7e\xef\x8c\x21\xb3\x83\x21\xd3\x4e\xf6\xd1\xf6\x92\xcc\x66\xc8\x48\x03\x7c\xc6\x2d\x0c\xa2\x31\x3a\xd4\x36\xb1\x99\x52\xdf\x8c\x0a\x2e\xf9\x1e\xa7\x2b\x33\xfc\x3d\x62\xbd\xe2\x31\x86\x35\x39\x7c\xb5\x95\x85\x1d\x39\x31\x46\xd9\x59\x34\xdb\x89\x14\x64\xa9\x74\xbd\xf9\x09\xdc\xae\xfd\x40\xc3\x51\x05\xdd\x2a\x93\x9c\xa0\x27\x95\xc2\x90\xd2\x83\x46\xa7\x09\x66\x6e\x65\x66\x82\x14\x13\xfa\x08\xd4\xe6\x12\x1e", 253); *(uint8_t*)0x1000030d = 5; *(uint8_t*)0x1000030e = 0x16; memcpy((void*)0x1000030f, "\x2e\x4f\x2a\x94\xc9\x13\x37\x5e\x90\xa8\x9d\xd2\xdb\x52\x08\x22\x3b\x2e\xc7\xfc\x31\x68\xa4\xbd\xca\xe1\x79\x7b\x6d\x83\x1a\x4b\xa9\xcc\x91\xe0\xe3\xd1\x1c\x2e\xcf\xf4\x4e\x97\xdf\xe6\xb9\xb7\x92\x98\x5a\x0d\x2c\xb0\x83\xac\x59\xe2\x09\x79\x5e\x00\x93\x0d\x9b\xa4\xc6\xa1\x10\x91\x36\xac\xd0\x95\xfd\xfe\x74\x57\xf6\xe2\x7d\x0a\xa1\xbf\xef\x5d\x6d\x3e\x90\x43\xfb\xbc\x47\x50\xca\x91\xcd\x1b\x4b\xb6\xb8\xc1\xaf\x78\xff\x40\x1c\x76\x0d\x21\x50\x99\x4f\xbe\x3c\x5e\x66\xe5\xab\xbd\xf1\x4d\xbf\xe5\x79\x71\xfc\xdd\xab\xff\x8c\x34\xa1\x20\x77\x8e\x67\xf3\x8d\x62\xe7\x6d\xef\x1c\xad\xb1\x01\x3d\x2a\xab\x71\xbc\x3f\x3d\xcd\xca\xa0\x85\xd1\xdd\xb8\x5e\x52\xa2\xf2\xf5\xa7\xa8\x59\x05\x15\x51\x92\x93\x0f\x0b", 176); struct csum_inet csum_3; csum_inet_init(&csum_3); csum_inet_update(&csum_3, (const uint8_t*)0x10000016, 16); csum_inet_update(&csum_3, (const uint8_t*)0x10000026, 16); uint32_t csum_3_chunk_2 = 0xc9010000; csum_inet_update(&csum_3, (const uint8_t*)&csum_3_chunk_2, 4); uint32_t csum_3_chunk_3 = 0x3a000000; csum_inet_update(&csum_3, (const uint8_t*)&csum_3_chunk_3, 4); csum_inet_update(&csum_3, (const uint8_t*)0x100001f6, 457); *(uint16_t*)0x100001f8 = csum_inet_digest(&csum_3); break; case 11: memcpy((void*)0x100003c0, "\x0f\x01\xf9\x67\x66\x0f\xfd\xd9\xc4\xe1\x11\xf9\xdf\xc4\xe3\x15\x02\x5b\x71\x0b\x64\x0f\xae\xf7\x3e\x0f\x5b\xd1\xc0\x00\x48\xc4\xe3\x79\x14\xb4\x18\x07\x00\x00\x00\x69\xcf\x66\x0f\x13\x2e", 47); syz_execute_func(0x100003c0); break; case 12: break; } } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); use_temporary_dir(); do_sandbox_setuid(); return 0; } :371:11: error: use of undeclared identifier 'SYS_copy_file_range' syscall(SYS_copy_file_range, 0xffffff9c, 0x10000140, (intptr_t)r[0], 0x10000180, 4ull, 0); ^ 1 error generated. compiler invocation: clang [-o /tmp/syz-executor851129908 -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.36s) csource_test.go:123: opts: {Threaded:true Collide:false Repeat:true RepeatTimes:0 Procs:0 Sandbox:none Fault:false FaultCall:0 FaultNth:0 Leak:false NetInjection:true NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false VhciInjection:false Wifi:false Sysctl:false UseTmpDir:true HandleSegv:false Repro:false Trace:false} program: fstat(0xffffffffffffff9c, &(0x7f0000000000)) r0 = socket$inet6_icmp_raw(0x1c, 0x3, 0x3a) setsockopt$inet6_tcp_TCP_FUNCTION_BLK(r0, 0x6, 0x2000, &(0x7f0000000100)={'bbr\x00', 0xfff}, 0x24) copy_file_range(0xffffffffffffff9c, &(0x7f0000000140)=0x9, r0, &(0x7f0000000180)=0x3f, 0x4, 0x0) getsockopt$inet_sctp_SCTP_EXPLICIT_EOR(0xffffffffffffffff, 0x84, 0x1b, &(0x7f00000001c0), &(0x7f0000000200)=0x4) getuid() getsockopt$inet_sctp_SCTP_STATUS(0xffffffffffffffff, 0x84, 0x100, &(0x7f0000000240)={0x0, 0x5, 0x2, 0xdd, 0x9, 0x7fff, 0x5, 0x1, {@in6={{0x1c, 0x1c, 0x3, 0x4, @local={0xfe, 0x80, [], 0x0}, 0x10000}}, 0x0, 0x9, 0xfffffff9, 0xdf10, 0x40, 0x8}}, &(0x7f0000000300)=0xac) getsockopt$inet6_sctp_SCTP_PR_ASSOC_STATUS(r0, 0x84, 0x108, &(0x7f0000000340)={r1, 0x9, 0x3, 0x1, 0x1}, &(0x7f0000000380)=0x18) syz_emit_ethernet(0xe3, &(0x7f00000003c0)={@random="558e866ec7c5", @broadcast, [{[{0x88a8, 0x0, 0x0, 0x1}], {0x8100, 0x0, 0x0, 0x4}}], {@ipv4={0x800, {{0xc, 0x4, 0x0, 0x8, 0xcd, 0x68, 0x1, 0x2, 0x1a, 0x0, @multicast2, @rand_addr, {[@ra={0x94, 0x6, 0x10000}, @lsrr={0x83, 0xb, 0x0, [@loopback, @empty]}, @generic={0x88, 0x9, "68b02e9aa55a8b"}]}}, @udp={{0x2, 0x3, 0x8}, {"1727313c0d121aaf942aba95b4aa8f3fab4a3f423c50b9f3207de073cd93e9d4abf4dd1bdea8b9e04ec83b0977c7094eca816b50fc613b6900642ed7c79867dfbfa2ee7e0da3bc0e15225c1f9e123c3983360a7a327e25ef286a9c45d8132c1c2201ecdb70ba3a3299d6680314428360ae3e57dcf3e15138710e151bad4503a78f71aae9accd796586c9b1fcfa620a259cc61014ef"}}}}}}) setgroups(0x1, &(0x7f00000004c0)=[0x0]) syz_emit_ethernet(0x3bf, &(0x7f0000000000)={@empty, @empty, [], {@ipv6={0x86dd, {0x3, 0x6, "082111", 0x389, 0x6c, 0x0, @ipv4={[], [], @multicast2}, @loopback, {[@dstopts={0x5e, 0x36, [], [@generic={0x79, 0x1a, "322539dce6c860eae2e717fe5d919d50f12da8c2790d7b778bd5"}, @ra={0x5, 0x2, 0x7}, @pad1, @padn={0x1, 0x2, [0x0, 0x0]}, @generic={0x8, 0xfa, "e2b0b21d6f96a012b794791a564b791a9b0876cc87a8e8dfcd4246acbd2e576229843f206d42eec2b99d4b6db93ca15f41cc25ada19e338a9780c960421012950307e65dda08893eb2f56402aefba148c2f9558d7a04f9e135247d1a8d04246250452d0f263cf90aa98d569eaa16834ea045e6dabce8906ac9af25efb2e5bcc24b0deabd7319ca606a2e28b658aea5947a43075c1f2ea50cca8dd63e0a876b47f60210b4e8241941fa4caef6cd787410b6900ec117314f6e71f7874ad67417e33cc319d651f35f08d115c91375a2df1629b53a49e6b05edfa0c35eee07f8cbd98fdff7050f5961ec1ce476b81c3852912fbe45193aa055a57fb3"}, @enc_lim={0x4, 0x1, 0xa1}, @padn={0x1, 0x3, [0x0, 0x0, 0x0]}, @pad1, @generic={0x4, 0x7e, "6422a7d87876689ceef99a8621b2ffc64a047f652c39eb4b53e84512a55853993feb36f77364f47b759ba04002b9b194175c2f2237bcb11486a5b8f1f2820497381a8cafa0739ae62382e83c7a2ed1bf16abd0e26754e12c85dc31764c4cae579a163f11e570e8a4dae7894a55d796e1e7663c41c1c3c74e897b7a3f74a3"}, @enc_lim={0x4, 0x1, 0x4}]}], @icmpv6=@ndisc_na={0x88, 0x0, 0x0, 0x33, [], @loopback, [{0x18, 0x1f, "7aa73634e6c60ceb8930c5bc172a27550b256dd38637557a7d83b970fff699ffdefbaa07f0447c8b93f97325462e5116d69981da6536e2687f5321f06984304f9ac34f6594f562862f3408d7b4c5443f15a8a80209bb6b12b9aa87cc0cc07c138e811e6ecded6f5e61e77c35dba8b558258cb7a084638b566318c51376393233a535fd53229c674d82b44771f43ac08dcbcd5ffd65850d7eef8c21b38321d34ef6d1f692cc66c848037cc62d0ca2313ad436b19952df8c0a2ef91ea72b33fc3d62bde2318635397cb595851d393146d95934db891464a974bdf909dcaefd40c35105dd2a939ca02795c290d28346a709666e6566821413fa08d4e6121e"}, {0x5, 0x16, "2e4f2a94c913375e90a89dd2db5208223b2ec7fc3168a4bdcae1797b6d831a4ba9cc91e0e3d11c2ecff44e97dfe6b9b792985a0d2cb083ac59e209795e00930d9ba4c6a1109136acd095fdfe7457f6e27d0aa1bfef5d6d3e9043fbbc4750ca91cd1b4bb6b8c1af78ff401c760d2150994fbe3c5e66e5abbdf14dbfe57971fcddabff8c34a120778e67f38d62e76def1cadb1013d2aab71bc3f3dcdcaa085d1ddb85e52a2f2f5a7a85905155192930f0b"}]}}}}}}) syz_execute_func(&(0x7f00000003c0)="0f01f967660ffdd9c4e111f9dfc4e315025b710b640faef73e0f5bd1c00048c4e37914b4180700000069cf660f132e") syz_extract_tcp_res(&(0x7f0000000400), 0x2, 0x67) csource_test.go:124: 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 __attribute__((noinline)) remove_dir(const char* dir) { DIR* dp = opendir(dir); if (dp == NULL) { if (errno == EACCES) { if (rmdir(dir)) exit(1); return; } exit(1); } struct dirent* ep = 0; while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } if (unlink(filename)) exit(1); } closedir(dp); if (rmdir(dir)) exit(1); } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { pthread_mutex_t mu; pthread_cond_t cv; int state; } event_t; static void event_init(event_t* ev) { if (pthread_mutex_init(&ev->mu, 0)) exit(1); if (pthread_cond_init(&ev->cv, 0)) exit(1); ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { pthread_mutex_lock(&ev->mu); if (ev->state) exit(1); ev->state = 1; pthread_mutex_unlock(&ev->mu); pthread_cond_broadcast(&ev->cv); } static void event_wait(event_t* ev) { pthread_mutex_lock(&ev->mu); while (!ev->state) pthread_cond_wait(&ev->cv, &ev->mu); pthread_mutex_unlock(&ev->mu); } static int event_isset(event_t* ev) { pthread_mutex_lock(&ev->mu); int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; pthread_mutex_lock(&ev->mu); for (;;) { if (ev->state) break; uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); now = current_time_ms(); if (now - start > timeout) break; } int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } #define BITMASK(bf_off,bf_len) (((1ull << (bf_len)) - 1) << (bf_off)) #define STORE_BY_BITMASK(type,htobe,addr,val,bf_off,bf_len) *(type*)(addr) = htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len)))) struct csum_inet { uint32_t acc; }; static void csum_inet_init(struct csum_inet* csum) { csum->acc = 0; } static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) { if (length == 0) return; size_t i = 0; for (; i < length - 1; i += 2) csum->acc += *(uint16_t*)&data[i]; if (length & 1) csum->acc += le16toh((uint16_t)data[length - 1]); while (csum->acc > 0xffff) csum->acc = (csum->acc & 0xffff) + (csum->acc >> 16); } static uint16_t csum_inet_digest(struct csum_inet* csum) { return ~csum->acc; } static 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 = 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; va_start(args, format); char command[PATH_PREFIX_LEN + COMMAND_MAX_LEN]; memcpy(command, PATH_PREFIX, PATH_PREFIX_LEN); vsnprintf_check(command + PATH_PREFIX_LEN, COMMAND_MAX_LEN, format, args); va_end(args); int 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; if (length < sizeof(struct ether_header)) return (uintptr_t)-1; struct ether_header* ethhdr = (struct ether_header*)&data[0]; struct tcphdr* tcphdr = 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() { 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) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 13; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); event_timedwait(&th->done, 45); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); #define WAIT_FLAGS 0 static void loop(void) { int iter = 0; for (;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[2] = {0xffffffffffffffff, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: syscall(SYS_fstat, 0xffffff9c, 0x10000000); break; case 1: res = syscall(SYS_socket, 0x1c, 3, 0x3a); if (res != -1) r[0] = res; break; case 2: memcpy((void*)0x10000100, "bbr\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 32); *(uint32_t*)0x10000120 = 0xfff; syscall(SYS_setsockopt, (intptr_t)r[0], 6, 0x2000, 0x10000100, 0x24); break; case 3: *(uint64_t*)0x10000140 = 9; *(uint64_t*)0x10000180 = 0x3f; syscall(SYS_copy_file_range, 0xffffff9c, 0x10000140, (intptr_t)r[0], 0x10000180, 4ull, 0); break; case 4: *(uint32_t*)0x10000200 = 4; syscall(SYS_getsockopt, -1, 0x84, 0x1b, 0x100001c0, 0x10000200); break; case 5: syscall(SYS_getuid); break; case 6: *(uint32_t*)0x10000240 = 0; *(uint32_t*)0x10000244 = 5; *(uint32_t*)0x10000248 = 2; *(uint16_t*)0x1000024c = 0xdd; *(uint16_t*)0x1000024e = 9; *(uint16_t*)0x10000250 = 0x7fff; *(uint16_t*)0x10000252 = 5; *(uint32_t*)0x10000254 = 1; *(uint8_t*)0x10000258 = 0x1c; *(uint8_t*)0x10000259 = 0x1c; *(uint16_t*)0x1000025a = htobe16(0x4e23); *(uint32_t*)0x1000025c = 4; *(uint8_t*)0x10000260 = 0xfe; *(uint8_t*)0x10000261 = 0x80; *(uint8_t*)0x10000262 = 0; *(uint8_t*)0x10000263 = 0; *(uint8_t*)0x10000264 = 0; *(uint8_t*)0x10000265 = 0; *(uint8_t*)0x10000266 = 0; *(uint8_t*)0x10000267 = 0; *(uint8_t*)0x10000268 = 0; *(uint8_t*)0x10000269 = 0; *(uint8_t*)0x1000026a = 0; *(uint8_t*)0x1000026b = 0; *(uint8_t*)0x1000026c = 0; *(uint8_t*)0x1000026d = 0; *(uint8_t*)0x1000026e = 0; *(uint8_t*)0x1000026f = 0xaa; *(uint32_t*)0x10000270 = 0x10000; *(uint64_t*)0x10000274 = 0; *(uint64_t*)0x1000027c = 0; *(uint64_t*)0x10000284 = 0; *(uint64_t*)0x1000028c = 0; *(uint64_t*)0x10000294 = 0; *(uint64_t*)0x1000029c = 0; *(uint64_t*)0x100002a4 = 0; *(uint64_t*)0x100002ac = 0; *(uint64_t*)0x100002b4 = 0; *(uint64_t*)0x100002bc = 0; *(uint64_t*)0x100002c4 = 0; *(uint64_t*)0x100002cc = 0; *(uint32_t*)0x100002d4 = 0; *(uint32_t*)0x100002d8 = 9; *(uint32_t*)0x100002dc = 0xfffffff9; *(uint32_t*)0x100002e0 = 0xdf10; *(uint32_t*)0x100002e4 = 0x40; *(uint32_t*)0x100002e8 = 8; *(uint32_t*)0x10000300 = 0xac; res = syscall(SYS_getsockopt, -1, 0x84, 0x100, 0x10000240, 0x10000300); if (res != -1) r[1] = *(uint32_t*)0x100002d4; break; case 7: *(uint32_t*)0x10000340 = r[1]; *(uint16_t*)0x10000344 = 9; *(uint16_t*)0x10000346 = 3; *(uint64_t*)0x10000348 = 1; *(uint64_t*)0x10000350 = 1; *(uint32_t*)0x10000380 = 0x18; syscall(SYS_getsockopt, (intptr_t)r[0], 0x84, 0x108, 0x10000340, 0x10000380); break; case 8: memcpy((void*)0x100003c0, "\x55\x8e\x86\x6e\xc7\xc5", 6); *(uint8_t*)0x100003c6 = -1; *(uint8_t*)0x100003c7 = -1; *(uint8_t*)0x100003c8 = -1; *(uint8_t*)0x100003c9 = -1; *(uint8_t*)0x100003ca = -1; *(uint8_t*)0x100003cb = -1; *(uint16_t*)0x100003cc = htobe16(0x88a8); STORE_BY_BITMASK(uint16_t, , 0x100003ce, 0, 0, 3); STORE_BY_BITMASK(uint16_t, , 0x100003ce, 0, 3, 1); STORE_BY_BITMASK(uint16_t, , 0x100003ce, 1, 4, 12); *(uint16_t*)0x100003d0 = htobe16(0x8100); STORE_BY_BITMASK(uint16_t, , 0x100003d2, 0, 0, 3); STORE_BY_BITMASK(uint16_t, , 0x100003d2, 0, 3, 1); STORE_BY_BITMASK(uint16_t, , 0x100003d2, 4, 4, 12); *(uint16_t*)0x100003d4 = htobe16(0x800); STORE_BY_BITMASK(uint8_t, , 0x100003d6, 0xc, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x100003d6, 4, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x100003d7, 0, 0, 2); STORE_BY_BITMASK(uint8_t, , 0x100003d7, 8, 2, 6); *(uint16_t*)0x100003d8 = htobe16(0xcd); *(uint16_t*)0x100003da = htobe16(0x68); *(uint16_t*)0x100003dc = htobe16(1); *(uint8_t*)0x100003de = 2; *(uint8_t*)0x100003df = 0x1a; *(uint16_t*)0x100003e0 = htobe16(0); *(uint32_t*)0x100003e2 = htobe32(0xe0000002); *(uint32_t*)0x100003e6 = htobe32(0); *(uint8_t*)0x100003ea = 0x94; *(uint8_t*)0x100003eb = 6; *(uint32_t*)0x100003ec = htobe32(0x10000); *(uint8_t*)0x100003f0 = 0x83; *(uint8_t*)0x100003f1 = 0xb; *(uint8_t*)0x100003f2 = 0; *(uint32_t*)0x100003f3 = htobe32(0x7f000001); *(uint32_t*)0x100003f7 = htobe32(0); *(uint8_t*)0x100003fb = 0x88; *(uint8_t*)0x100003fc = 9; memcpy((void*)0x100003fd, "\x68\xb0\x2e\x9a\xa5\x5a\x8b", 7); *(uint16_t*)0x10000406 = htobe16(0x4e22); *(uint16_t*)0x10000408 = htobe16(0x4e23); *(uint16_t*)0x1000040a = htobe16(8); *(uint16_t*)0x1000040c = htobe16(0); memcpy((void*)0x1000040e, "\x17\x27\x31\x3c\x0d\x12\x1a\xaf\x94\x2a\xba\x95\xb4\xaa\x8f\x3f\xab\x4a\x3f\x42\x3c\x50\xb9\xf3\x20\x7d\xe0\x73\xcd\x93\xe9\xd4\xab\xf4\xdd\x1b\xde\xa8\xb9\xe0\x4e\xc8\x3b\x09\x77\xc7\x09\x4e\xca\x81\x6b\x50\xfc\x61\x3b\x69\x00\x64\x2e\xd7\xc7\x98\x67\xdf\xbf\xa2\xee\x7e\x0d\xa3\xbc\x0e\x15\x22\x5c\x1f\x9e\x12\x3c\x39\x83\x36\x0a\x7a\x32\x7e\x25\xef\x28\x6a\x9c\x45\xd8\x13\x2c\x1c\x22\x01\xec\xdb\x70\xba\x3a\x32\x99\xd6\x68\x03\x14\x42\x83\x60\xae\x3e\x57\xdc\xf3\xe1\x51\x38\x71\x0e\x15\x1b\xad\x45\x03\xa7\x8f\x71\xaa\xe9\xac\xcd\x79\x65\x86\xc9\xb1\xfc\xfa\x62\x0a\x25\x9c\xc6\x10\x14\xef", 149); struct csum_inet csum_1; csum_inet_init(&csum_1); csum_inet_update(&csum_1, (const uint8_t*)0x100003e2, 4); csum_inet_update(&csum_1, (const uint8_t*)0x100003e6, 4); uint16_t csum_1_chunk_2 = 0x1100; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_2, 2); uint16_t csum_1_chunk_3 = 0x800; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_3, 2); csum_inet_update(&csum_1, (const uint8_t*)0x10000406, 8); *(uint16_t*)0x1000040c = csum_inet_digest(&csum_1); struct csum_inet csum_2; csum_inet_init(&csum_2); csum_inet_update(&csum_2, (const uint8_t*)0x100003d6, 48); *(uint16_t*)0x100003e0 = csum_inet_digest(&csum_2); syz_emit_ethernet(0xe3, 0x100003c0); break; case 9: *(uint32_t*)0x100004c0 = 0; syscall(SYS_setgroups, 1, 0x100004c0); break; case 10: *(uint8_t*)0x10000000 = 0; *(uint8_t*)0x10000001 = 0; *(uint8_t*)0x10000002 = 0; *(uint8_t*)0x10000003 = 0; *(uint8_t*)0x10000004 = 0; *(uint8_t*)0x10000005 = 0; *(uint8_t*)0x10000006 = 0; *(uint8_t*)0x10000007 = 0; *(uint8_t*)0x10000008 = 0; *(uint8_t*)0x10000009 = 0; *(uint8_t*)0x1000000a = 0; *(uint8_t*)0x1000000b = 0; *(uint16_t*)0x1000000c = htobe16(0x86dd); STORE_BY_BITMASK(uint8_t, , 0x1000000e, 3, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x1000000e, 6, 4, 4); memcpy((void*)0x1000000f, "\x08\x21\x11", 3); *(uint16_t*)0x10000012 = htobe16(0x389); *(uint8_t*)0x10000014 = 0x6c; *(uint8_t*)0x10000015 = 0; *(uint8_t*)0x10000016 = 0; *(uint8_t*)0x10000017 = 0; *(uint8_t*)0x10000018 = 0; *(uint8_t*)0x10000019 = 0; *(uint8_t*)0x1000001a = 0; *(uint8_t*)0x1000001b = 0; *(uint8_t*)0x1000001c = 0; *(uint8_t*)0x1000001d = 0; *(uint8_t*)0x1000001e = 0; *(uint8_t*)0x1000001f = 0; *(uint8_t*)0x10000020 = -1; *(uint8_t*)0x10000021 = -1; *(uint32_t*)0x10000022 = htobe32(0xe0000002); *(uint64_t*)0x10000026 = htobe64(0); *(uint64_t*)0x1000002e = htobe64(1); *(uint8_t*)0x10000036 = 0x5e; *(uint8_t*)0x10000037 = 0x36; *(uint8_t*)0x10000038 = 0; *(uint8_t*)0x10000039 = 0; *(uint8_t*)0x1000003a = 0; *(uint8_t*)0x1000003b = 0; *(uint8_t*)0x1000003c = 0; *(uint8_t*)0x1000003d = 0; *(uint8_t*)0x1000003e = 0x79; *(uint8_t*)0x1000003f = 0x1a; memcpy((void*)0x10000040, "\x32\x25\x39\xdc\xe6\xc8\x60\xea\xe2\xe7\x17\xfe\x5d\x91\x9d\x50\xf1\x2d\xa8\xc2\x79\x0d\x7b\x77\x8b\xd5", 26); *(uint8_t*)0x1000005a = 5; *(uint8_t*)0x1000005b = 2; *(uint16_t*)0x1000005c = htobe16(7); *(uint8_t*)0x1000005e = 0; *(uint8_t*)0x1000005f = 1; *(uint8_t*)0x10000060 = 0; *(uint8_t*)0x10000061 = 1; *(uint8_t*)0x10000062 = 2; *(uint8_t*)0x10000063 = 0; *(uint8_t*)0x10000064 = 0; *(uint8_t*)0x10000065 = 8; *(uint8_t*)0x10000066 = 0xfa; memcpy((void*)0x10000067, "\xe2\xb0\xb2\x1d\x6f\x96\xa0\x12\xb7\x94\x79\x1a\x56\x4b\x79\x1a\x9b\x08\x76\xcc\x87\xa8\xe8\xdf\xcd\x42\x46\xac\xbd\x2e\x57\x62\x29\x84\x3f\x20\x6d\x42\xee\xc2\xb9\x9d\x4b\x6d\xb9\x3c\xa1\x5f\x41\xcc\x25\xad\xa1\x9e\x33\x8a\x97\x80\xc9\x60\x42\x10\x12\x95\x03\x07\xe6\x5d\xda\x08\x89\x3e\xb2\xf5\x64\x02\xae\xfb\xa1\x48\xc2\xf9\x55\x8d\x7a\x04\xf9\xe1\x35\x24\x7d\x1a\x8d\x04\x24\x62\x50\x45\x2d\x0f\x26\x3c\xf9\x0a\xa9\x8d\x56\x9e\xaa\x16\x83\x4e\xa0\x45\xe6\xda\xbc\xe8\x90\x6a\xc9\xaf\x25\xef\xb2\xe5\xbc\xc2\x4b\x0d\xea\xbd\x73\x19\xca\x60\x6a\x2e\x28\xb6\x58\xae\xa5\x94\x7a\x43\x07\x5c\x1f\x2e\xa5\x0c\xca\x8d\xd6\x3e\x0a\x87\x6b\x47\xf6\x02\x10\xb4\xe8\x24\x19\x41\xfa\x4c\xae\xf6\xcd\x78\x74\x10\xb6\x90\x0e\xc1\x17\x31\x4f\x6e\x71\xf7\x87\x4a\xd6\x74\x17\xe3\x3c\xc3\x19\xd6\x51\xf3\x5f\x08\xd1\x15\xc9\x13\x75\xa2\xdf\x16\x29\xb5\x3a\x49\xe6\xb0\x5e\xdf\xa0\xc3\x5e\xee\x07\xf8\xcb\xd9\x8f\xdf\xf7\x05\x0f\x59\x61\xec\x1c\xe4\x76\xb8\x1c\x38\x52\x91\x2f\xbe\x45\x19\x3a\xa0\x55\xa5\x7f\xb3", 250); *(uint8_t*)0x10000161 = 4; *(uint8_t*)0x10000162 = 1; *(uint8_t*)0x10000163 = 0xa1; *(uint8_t*)0x10000164 = 1; *(uint8_t*)0x10000165 = 3; *(uint8_t*)0x10000166 = 0; *(uint8_t*)0x10000167 = 0; *(uint8_t*)0x10000168 = 0; *(uint8_t*)0x10000169 = 0; *(uint8_t*)0x1000016a = 1; *(uint8_t*)0x1000016b = 0; *(uint8_t*)0x1000016c = 4; *(uint8_t*)0x1000016d = 0x7e; memcpy((void*)0x1000016e, "\x64\x22\xa7\xd8\x78\x76\x68\x9c\xee\xf9\x9a\x86\x21\xb2\xff\xc6\x4a\x04\x7f\x65\x2c\x39\xeb\x4b\x53\xe8\x45\x12\xa5\x58\x53\x99\x3f\xeb\x36\xf7\x73\x64\xf4\x7b\x75\x9b\xa0\x40\x02\xb9\xb1\x94\x17\x5c\x2f\x22\x37\xbc\xb1\x14\x86\xa5\xb8\xf1\xf2\x82\x04\x97\x38\x1a\x8c\xaf\xa0\x73\x9a\xe6\x23\x82\xe8\x3c\x7a\x2e\xd1\xbf\x16\xab\xd0\xe2\x67\x54\xe1\x2c\x85\xdc\x31\x76\x4c\x4c\xae\x57\x9a\x16\x3f\x11\xe5\x70\xe8\xa4\xda\xe7\x89\x4a\x55\xd7\x96\xe1\xe7\x66\x3c\x41\xc1\xc3\xc7\x4e\x89\x7b\x7a\x3f\x74\xa3", 126); *(uint8_t*)0x100001ec = 4; *(uint8_t*)0x100001ed = 1; *(uint8_t*)0x100001ee = 4; *(uint8_t*)0x100001f6 = 0x88; *(uint8_t*)0x100001f7 = 0; *(uint16_t*)0x100001f8 = htobe16(0); *(uint8_t*)0x100001fa = 0x33; *(uint8_t*)0x100001fb = 0; *(uint8_t*)0x100001fc = 0; *(uint8_t*)0x100001fd = 0; *(uint64_t*)0x100001fe = htobe64(0); *(uint64_t*)0x10000206 = htobe64(1); *(uint8_t*)0x1000020e = 0x18; *(uint8_t*)0x1000020f = 0x1f; memcpy((void*)0x10000210, "\x7a\xa7\x36\x34\xe6\xc6\x0c\xeb\x89\x30\xc5\xbc\x17\x2a\x27\x55\x0b\x25\x6d\xd3\x86\x37\x55\x7a\x7d\x83\xb9\x70\xff\xf6\x99\xff\xde\xfb\xaa\x07\xf0\x44\x7c\x8b\x93\xf9\x73\x25\x46\x2e\x51\x16\xd6\x99\x81\xda\x65\x36\xe2\x68\x7f\x53\x21\xf0\x69\x84\x30\x4f\x9a\xc3\x4f\x65\x94\xf5\x62\x86\x2f\x34\x08\xd7\xb4\xc5\x44\x3f\x15\xa8\xa8\x02\x09\xbb\x6b\x12\xb9\xaa\x87\xcc\x0c\xc0\x7c\x13\x8e\x81\x1e\x6e\xcd\xed\x6f\x5e\x61\xe7\x7c\x35\xdb\xa8\xb5\x58\x25\x8c\xb7\xa0\x84\x63\x8b\x56\x63\x18\xc5\x13\x76\x39\x32\x33\xa5\x35\xfd\x53\x22\x9c\x67\x4d\x82\xb4\x47\x71\xf4\x3a\xc0\x8d\xcb\xcd\x5f\xfd\x65\x85\x0d\x7e\xef\x8c\x21\xb3\x83\x21\xd3\x4e\xf6\xd1\xf6\x92\xcc\x66\xc8\x48\x03\x7c\xc6\x2d\x0c\xa2\x31\x3a\xd4\x36\xb1\x99\x52\xdf\x8c\x0a\x2e\xf9\x1e\xa7\x2b\x33\xfc\x3d\x62\xbd\xe2\x31\x86\x35\x39\x7c\xb5\x95\x85\x1d\x39\x31\x46\xd9\x59\x34\xdb\x89\x14\x64\xa9\x74\xbd\xf9\x09\xdc\xae\xfd\x40\xc3\x51\x05\xdd\x2a\x93\x9c\xa0\x27\x95\xc2\x90\xd2\x83\x46\xa7\x09\x66\x6e\x65\x66\x82\x14\x13\xfa\x08\xd4\xe6\x12\x1e", 253); *(uint8_t*)0x1000030d = 5; *(uint8_t*)0x1000030e = 0x16; memcpy((void*)0x1000030f, "\x2e\x4f\x2a\x94\xc9\x13\x37\x5e\x90\xa8\x9d\xd2\xdb\x52\x08\x22\x3b\x2e\xc7\xfc\x31\x68\xa4\xbd\xca\xe1\x79\x7b\x6d\x83\x1a\x4b\xa9\xcc\x91\xe0\xe3\xd1\x1c\x2e\xcf\xf4\x4e\x97\xdf\xe6\xb9\xb7\x92\x98\x5a\x0d\x2c\xb0\x83\xac\x59\xe2\x09\x79\x5e\x00\x93\x0d\x9b\xa4\xc6\xa1\x10\x91\x36\xac\xd0\x95\xfd\xfe\x74\x57\xf6\xe2\x7d\x0a\xa1\xbf\xef\x5d\x6d\x3e\x90\x43\xfb\xbc\x47\x50\xca\x91\xcd\x1b\x4b\xb6\xb8\xc1\xaf\x78\xff\x40\x1c\x76\x0d\x21\x50\x99\x4f\xbe\x3c\x5e\x66\xe5\xab\xbd\xf1\x4d\xbf\xe5\x79\x71\xfc\xdd\xab\xff\x8c\x34\xa1\x20\x77\x8e\x67\xf3\x8d\x62\xe7\x6d\xef\x1c\xad\xb1\x01\x3d\x2a\xab\x71\xbc\x3f\x3d\xcd\xca\xa0\x85\xd1\xdd\xb8\x5e\x52\xa2\xf2\xf5\xa7\xa8\x59\x05\x15\x51\x92\x93\x0f\x0b", 176); struct csum_inet csum_3; csum_inet_init(&csum_3); csum_inet_update(&csum_3, (const uint8_t*)0x10000016, 16); csum_inet_update(&csum_3, (const uint8_t*)0x10000026, 16); uint32_t csum_3_chunk_2 = 0xc9010000; csum_inet_update(&csum_3, (const uint8_t*)&csum_3_chunk_2, 4); uint32_t csum_3_chunk_3 = 0x3a000000; csum_inet_update(&csum_3, (const uint8_t*)&csum_3_chunk_3, 4); csum_inet_update(&csum_3, (const uint8_t*)0x100001f6, 457); *(uint16_t*)0x100001f8 = csum_inet_digest(&csum_3); syz_emit_ethernet(0x3bf, 0x10000000); break; case 11: memcpy((void*)0x100003c0, "\x0f\x01\xf9\x67\x66\x0f\xfd\xd9\xc4\xe1\x11\xf9\xdf\xc4\xe3\x15\x02\x5b\x71\x0b\x64\x0f\xae\xf7\x3e\x0f\x5b\xd1\xc0\x00\x48\xc4\xe3\x79\x14\xb4\x18\x07\x00\x00\x00\x69\xcf\x66\x0f\x13\x2e", 47); syz_execute_func(0x100003c0); break; case 12: syz_extract_tcp_res(0x10000400, 2, 0x67); break; } } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); use_temporary_dir(); do_sandbox_none(); return 0; } :520:11: error: use of undeclared identifier 'SYS_copy_file_range' syscall(SYS_copy_file_range, 0xffffff9c, 0x10000140, (intptr_t)r[0], 0x10000180, 4ull, 0); ^ 1 error generated. compiler invocation: clang [-o /tmp/syz-executor286764934 -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.65s) csource_test.go:123: opts: {Threaded:true Collide:false Repeat:true RepeatTimes:0 Procs:0 Sandbox:none Fault:false FaultCall:0 FaultNth:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false VhciInjection:false Wifi:false Sysctl:false UseTmpDir:true HandleSegv:false Repro:true Trace:false} program: fstat(0xffffffffffffff9c, &(0x7f0000000000)) r0 = socket$inet6_icmp_raw(0x1c, 0x3, 0x3a) setsockopt$inet6_tcp_TCP_FUNCTION_BLK(r0, 0x6, 0x2000, &(0x7f0000000100)={'bbr\x00', 0xfff}, 0x24) copy_file_range(0xffffffffffffff9c, &(0x7f0000000140)=0x9, r0, &(0x7f0000000180)=0x3f, 0x4, 0x0) getsockopt$inet_sctp_SCTP_EXPLICIT_EOR(0xffffffffffffffff, 0x84, 0x1b, &(0x7f00000001c0), &(0x7f0000000200)=0x4) getuid() getsockopt$inet_sctp_SCTP_STATUS(0xffffffffffffffff, 0x84, 0x100, &(0x7f0000000240)={0x0, 0x5, 0x2, 0xdd, 0x9, 0x7fff, 0x5, 0x1, {@in6={{0x1c, 0x1c, 0x3, 0x4, @local={0xfe, 0x80, [], 0x0}, 0x10000}}, 0x0, 0x9, 0xfffffff9, 0xdf10, 0x40, 0x8}}, &(0x7f0000000300)=0xac) getsockopt$inet6_sctp_SCTP_PR_ASSOC_STATUS(r0, 0x84, 0x108, &(0x7f0000000340)={r1, 0x9, 0x3, 0x1, 0x1}, &(0x7f0000000380)=0x18) syz_emit_ethernet(0xe3, &(0x7f00000003c0)={@random="558e866ec7c5", @broadcast, [{[{0x88a8, 0x0, 0x0, 0x1}], {0x8100, 0x0, 0x0, 0x4}}], {@ipv4={0x800, {{0xc, 0x4, 0x0, 0x8, 0xcd, 0x68, 0x1, 0x2, 0x1a, 0x0, @multicast2, @rand_addr, {[@ra={0x94, 0x6, 0x10000}, @lsrr={0x83, 0xb, 0x0, [@loopback, @empty]}, @generic={0x88, 0x9, "68b02e9aa55a8b"}]}}, @udp={{0x2, 0x3, 0x8}, {"1727313c0d121aaf942aba95b4aa8f3fab4a3f423c50b9f3207de073cd93e9d4abf4dd1bdea8b9e04ec83b0977c7094eca816b50fc613b6900642ed7c79867dfbfa2ee7e0da3bc0e15225c1f9e123c3983360a7a327e25ef286a9c45d8132c1c2201ecdb70ba3a3299d6680314428360ae3e57dcf3e15138710e151bad4503a78f71aae9accd796586c9b1fcfa620a259cc61014ef"}}}}}}) setgroups(0x1, &(0x7f00000004c0)=[0x0]) syz_emit_ethernet(0x3bf, &(0x7f0000000000)={@empty, @empty, [], {@ipv6={0x86dd, {0x3, 0x6, "082111", 0x389, 0x6c, 0x0, @ipv4={[], [], @multicast2}, @loopback, {[@dstopts={0x5e, 0x36, [], [@generic={0x79, 0x1a, "322539dce6c860eae2e717fe5d919d50f12da8c2790d7b778bd5"}, @ra={0x5, 0x2, 0x7}, @pad1, @padn={0x1, 0x2, [0x0, 0x0]}, @generic={0x8, 0xfa, "e2b0b21d6f96a012b794791a564b791a9b0876cc87a8e8dfcd4246acbd2e576229843f206d42eec2b99d4b6db93ca15f41cc25ada19e338a9780c960421012950307e65dda08893eb2f56402aefba148c2f9558d7a04f9e135247d1a8d04246250452d0f263cf90aa98d569eaa16834ea045e6dabce8906ac9af25efb2e5bcc24b0deabd7319ca606a2e28b658aea5947a43075c1f2ea50cca8dd63e0a876b47f60210b4e8241941fa4caef6cd787410b6900ec117314f6e71f7874ad67417e33cc319d651f35f08d115c91375a2df1629b53a49e6b05edfa0c35eee07f8cbd98fdff7050f5961ec1ce476b81c3852912fbe45193aa055a57fb3"}, @enc_lim={0x4, 0x1, 0xa1}, @padn={0x1, 0x3, [0x0, 0x0, 0x0]}, @pad1, @generic={0x4, 0x7e, "6422a7d87876689ceef99a8621b2ffc64a047f652c39eb4b53e84512a55853993feb36f77364f47b759ba04002b9b194175c2f2237bcb11486a5b8f1f2820497381a8cafa0739ae62382e83c7a2ed1bf16abd0e26754e12c85dc31764c4cae579a163f11e570e8a4dae7894a55d796e1e7663c41c1c3c74e897b7a3f74a3"}, @enc_lim={0x4, 0x1, 0x4}]}], @icmpv6=@ndisc_na={0x88, 0x0, 0x0, 0x33, [], @loopback, [{0x18, 0x1f, "7aa73634e6c60ceb8930c5bc172a27550b256dd38637557a7d83b970fff699ffdefbaa07f0447c8b93f97325462e5116d69981da6536e2687f5321f06984304f9ac34f6594f562862f3408d7b4c5443f15a8a80209bb6b12b9aa87cc0cc07c138e811e6ecded6f5e61e77c35dba8b558258cb7a084638b566318c51376393233a535fd53229c674d82b44771f43ac08dcbcd5ffd65850d7eef8c21b38321d34ef6d1f692cc66c848037cc62d0ca2313ad436b19952df8c0a2ef91ea72b33fc3d62bde2318635397cb595851d393146d95934db891464a974bdf909dcaefd40c35105dd2a939ca02795c290d28346a709666e6566821413fa08d4e6121e"}, {0x5, 0x16, "2e4f2a94c913375e90a89dd2db5208223b2ec7fc3168a4bdcae1797b6d831a4ba9cc91e0e3d11c2ecff44e97dfe6b9b792985a0d2cb083ac59e209795e00930d9ba4c6a1109136acd095fdfe7457f6e27d0aa1bfef5d6d3e9043fbbc4750ca91cd1b4bb6b8c1af78ff401c760d2150994fbe3c5e66e5abbdf14dbfe57971fcddabff8c34a120778e67f38d62e76def1cadb1013d2aab71bc3f3dcdcaa085d1ddb85e52a2f2f5a7a85905155192930f0b"}]}}}}}}) syz_execute_func(&(0x7f00000003c0)="0f01f967660ffdd9c4e111f9dfc4e315025b710b640faef73e0f5bd1c00048c4e37914b4180700000069cf660f132e") syz_extract_tcp_res(&(0x7f0000000400), 0x2, 0x67) csource_test.go:124: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void __attribute__((noinline)) remove_dir(const char* dir) { DIR* dp = opendir(dir); if (dp == NULL) { if (errno == EACCES) { if (rmdir(dir)) exit(1); return; } exit(1); } struct dirent* ep = 0; while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } if (unlink(filename)) exit(1); } closedir(dp); if (rmdir(dir)) exit(1); } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { pthread_mutex_t mu; pthread_cond_t cv; int state; } event_t; static void event_init(event_t* ev) { if (pthread_mutex_init(&ev->mu, 0)) exit(1); if (pthread_cond_init(&ev->cv, 0)) exit(1); ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { pthread_mutex_lock(&ev->mu); if (ev->state) exit(1); ev->state = 1; pthread_mutex_unlock(&ev->mu); pthread_cond_broadcast(&ev->cv); } static void event_wait(event_t* ev) { pthread_mutex_lock(&ev->mu); while (!ev->state) pthread_cond_wait(&ev->cv, &ev->mu); pthread_mutex_unlock(&ev->mu); } static int event_isset(event_t* ev) { pthread_mutex_lock(&ev->mu); int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; pthread_mutex_lock(&ev->mu); for (;;) { if (ev->state) break; uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); now = current_time_ms(); if (now - start > timeout) break; } int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } #define BITMASK(bf_off,bf_len) (((1ull << (bf_len)) - 1) << (bf_off)) #define STORE_BY_BITMASK(type,htobe,addr,val,bf_off,bf_len) *(type*)(addr) = htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len)))) struct csum_inet { uint32_t acc; }; static void csum_inet_init(struct csum_inet* csum) { csum->acc = 0; } static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) { if (length == 0) return; size_t i = 0; for (; i < length - 1; i += 2) csum->acc += *(uint16_t*)&data[i]; if (length & 1) csum->acc += le16toh((uint16_t)data[length - 1]); while (csum->acc > 0xffff) csum->acc = (csum->acc & 0xffff) + (csum->acc >> 16); } static uint16_t csum_inet_digest(struct csum_inet* csum) { return ~csum->acc; } static void sandbox_common() { struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 8 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 0; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); } static void loop(); static int do_sandbox_none(void) { sandbox_common(); loop(); return 0; } static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } int i, call, thread; for (call = 0; call < 13; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); event_timedwait(&th->done, 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 = 0; for (;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[2] = {0xffffffffffffffff, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: syscall(SYS_fstat, 0xffffff9c, 0x10000000); break; case 1: res = syscall(SYS_socket, 0x1c, 3, 0x3a); if (res != -1) r[0] = res; break; case 2: memcpy((void*)0x10000100, "bbr\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 32); *(uint32_t*)0x10000120 = 0xfff; syscall(SYS_setsockopt, (intptr_t)r[0], 6, 0x2000, 0x10000100, 0x24); break; case 3: *(uint64_t*)0x10000140 = 9; *(uint64_t*)0x10000180 = 0x3f; syscall(SYS_copy_file_range, 0xffffff9c, 0x10000140, (intptr_t)r[0], 0x10000180, 4ull, 0); break; case 4: *(uint32_t*)0x10000200 = 4; syscall(SYS_getsockopt, -1, 0x84, 0x1b, 0x100001c0, 0x10000200); break; case 5: syscall(SYS_getuid); break; case 6: *(uint32_t*)0x10000240 = 0; *(uint32_t*)0x10000244 = 5; *(uint32_t*)0x10000248 = 2; *(uint16_t*)0x1000024c = 0xdd; *(uint16_t*)0x1000024e = 9; *(uint16_t*)0x10000250 = 0x7fff; *(uint16_t*)0x10000252 = 5; *(uint32_t*)0x10000254 = 1; *(uint8_t*)0x10000258 = 0x1c; *(uint8_t*)0x10000259 = 0x1c; *(uint16_t*)0x1000025a = htobe16(0x4e23); *(uint32_t*)0x1000025c = 4; *(uint8_t*)0x10000260 = 0xfe; *(uint8_t*)0x10000261 = 0x80; *(uint8_t*)0x10000262 = 0; *(uint8_t*)0x10000263 = 0; *(uint8_t*)0x10000264 = 0; *(uint8_t*)0x10000265 = 0; *(uint8_t*)0x10000266 = 0; *(uint8_t*)0x10000267 = 0; *(uint8_t*)0x10000268 = 0; *(uint8_t*)0x10000269 = 0; *(uint8_t*)0x1000026a = 0; *(uint8_t*)0x1000026b = 0; *(uint8_t*)0x1000026c = 0; *(uint8_t*)0x1000026d = 0; *(uint8_t*)0x1000026e = 0; *(uint8_t*)0x1000026f = 0xaa; *(uint32_t*)0x10000270 = 0x10000; *(uint64_t*)0x10000274 = 0; *(uint64_t*)0x1000027c = 0; *(uint64_t*)0x10000284 = 0; *(uint64_t*)0x1000028c = 0; *(uint64_t*)0x10000294 = 0; *(uint64_t*)0x1000029c = 0; *(uint64_t*)0x100002a4 = 0; *(uint64_t*)0x100002ac = 0; *(uint64_t*)0x100002b4 = 0; *(uint64_t*)0x100002bc = 0; *(uint64_t*)0x100002c4 = 0; *(uint64_t*)0x100002cc = 0; *(uint32_t*)0x100002d4 = 0; *(uint32_t*)0x100002d8 = 9; *(uint32_t*)0x100002dc = 0xfffffff9; *(uint32_t*)0x100002e0 = 0xdf10; *(uint32_t*)0x100002e4 = 0x40; *(uint32_t*)0x100002e8 = 8; *(uint32_t*)0x10000300 = 0xac; res = syscall(SYS_getsockopt, -1, 0x84, 0x100, 0x10000240, 0x10000300); if (res != -1) r[1] = *(uint32_t*)0x100002d4; break; case 7: *(uint32_t*)0x10000340 = r[1]; *(uint16_t*)0x10000344 = 9; *(uint16_t*)0x10000346 = 3; *(uint64_t*)0x10000348 = 1; *(uint64_t*)0x10000350 = 1; *(uint32_t*)0x10000380 = 0x18; syscall(SYS_getsockopt, (intptr_t)r[0], 0x84, 0x108, 0x10000340, 0x10000380); break; case 8: memcpy((void*)0x100003c0, "\x55\x8e\x86\x6e\xc7\xc5", 6); *(uint8_t*)0x100003c6 = -1; *(uint8_t*)0x100003c7 = -1; *(uint8_t*)0x100003c8 = -1; *(uint8_t*)0x100003c9 = -1; *(uint8_t*)0x100003ca = -1; *(uint8_t*)0x100003cb = -1; *(uint16_t*)0x100003cc = htobe16(0x88a8); STORE_BY_BITMASK(uint16_t, , 0x100003ce, 0, 0, 3); STORE_BY_BITMASK(uint16_t, , 0x100003ce, 0, 3, 1); STORE_BY_BITMASK(uint16_t, , 0x100003ce, 1, 4, 12); *(uint16_t*)0x100003d0 = htobe16(0x8100); STORE_BY_BITMASK(uint16_t, , 0x100003d2, 0, 0, 3); STORE_BY_BITMASK(uint16_t, , 0x100003d2, 0, 3, 1); STORE_BY_BITMASK(uint16_t, , 0x100003d2, 4, 4, 12); *(uint16_t*)0x100003d4 = htobe16(0x800); STORE_BY_BITMASK(uint8_t, , 0x100003d6, 0xc, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x100003d6, 4, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x100003d7, 0, 0, 2); STORE_BY_BITMASK(uint8_t, , 0x100003d7, 8, 2, 6); *(uint16_t*)0x100003d8 = htobe16(0xcd); *(uint16_t*)0x100003da = htobe16(0x68); *(uint16_t*)0x100003dc = htobe16(1); *(uint8_t*)0x100003de = 2; *(uint8_t*)0x100003df = 0x1a; *(uint16_t*)0x100003e0 = htobe16(0); *(uint32_t*)0x100003e2 = htobe32(0xe0000002); *(uint32_t*)0x100003e6 = htobe32(0); *(uint8_t*)0x100003ea = 0x94; *(uint8_t*)0x100003eb = 6; *(uint32_t*)0x100003ec = htobe32(0x10000); *(uint8_t*)0x100003f0 = 0x83; *(uint8_t*)0x100003f1 = 0xb; *(uint8_t*)0x100003f2 = 0; *(uint32_t*)0x100003f3 = htobe32(0x7f000001); *(uint32_t*)0x100003f7 = htobe32(0); *(uint8_t*)0x100003fb = 0x88; *(uint8_t*)0x100003fc = 9; memcpy((void*)0x100003fd, "\x68\xb0\x2e\x9a\xa5\x5a\x8b", 7); *(uint16_t*)0x10000406 = htobe16(0x4e22); *(uint16_t*)0x10000408 = htobe16(0x4e23); *(uint16_t*)0x1000040a = htobe16(8); *(uint16_t*)0x1000040c = htobe16(0); memcpy((void*)0x1000040e, "\x17\x27\x31\x3c\x0d\x12\x1a\xaf\x94\x2a\xba\x95\xb4\xaa\x8f\x3f\xab\x4a\x3f\x42\x3c\x50\xb9\xf3\x20\x7d\xe0\x73\xcd\x93\xe9\xd4\xab\xf4\xdd\x1b\xde\xa8\xb9\xe0\x4e\xc8\x3b\x09\x77\xc7\x09\x4e\xca\x81\x6b\x50\xfc\x61\x3b\x69\x00\x64\x2e\xd7\xc7\x98\x67\xdf\xbf\xa2\xee\x7e\x0d\xa3\xbc\x0e\x15\x22\x5c\x1f\x9e\x12\x3c\x39\x83\x36\x0a\x7a\x32\x7e\x25\xef\x28\x6a\x9c\x45\xd8\x13\x2c\x1c\x22\x01\xec\xdb\x70\xba\x3a\x32\x99\xd6\x68\x03\x14\x42\x83\x60\xae\x3e\x57\xdc\xf3\xe1\x51\x38\x71\x0e\x15\x1b\xad\x45\x03\xa7\x8f\x71\xaa\xe9\xac\xcd\x79\x65\x86\xc9\xb1\xfc\xfa\x62\x0a\x25\x9c\xc6\x10\x14\xef", 149); struct csum_inet csum_1; csum_inet_init(&csum_1); csum_inet_update(&csum_1, (const uint8_t*)0x100003e2, 4); csum_inet_update(&csum_1, (const uint8_t*)0x100003e6, 4); uint16_t csum_1_chunk_2 = 0x1100; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_2, 2); uint16_t csum_1_chunk_3 = 0x800; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_3, 2); csum_inet_update(&csum_1, (const uint8_t*)0x10000406, 8); *(uint16_t*)0x1000040c = csum_inet_digest(&csum_1); struct csum_inet csum_2; csum_inet_init(&csum_2); csum_inet_update(&csum_2, (const uint8_t*)0x100003d6, 48); *(uint16_t*)0x100003e0 = csum_inet_digest(&csum_2); break; case 9: *(uint32_t*)0x100004c0 = 0; syscall(SYS_setgroups, 1, 0x100004c0); break; case 10: *(uint8_t*)0x10000000 = 0; *(uint8_t*)0x10000001 = 0; *(uint8_t*)0x10000002 = 0; *(uint8_t*)0x10000003 = 0; *(uint8_t*)0x10000004 = 0; *(uint8_t*)0x10000005 = 0; *(uint8_t*)0x10000006 = 0; *(uint8_t*)0x10000007 = 0; *(uint8_t*)0x10000008 = 0; *(uint8_t*)0x10000009 = 0; *(uint8_t*)0x1000000a = 0; *(uint8_t*)0x1000000b = 0; *(uint16_t*)0x1000000c = htobe16(0x86dd); STORE_BY_BITMASK(uint8_t, , 0x1000000e, 3, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x1000000e, 6, 4, 4); memcpy((void*)0x1000000f, "\x08\x21\x11", 3); *(uint16_t*)0x10000012 = htobe16(0x389); *(uint8_t*)0x10000014 = 0x6c; *(uint8_t*)0x10000015 = 0; *(uint8_t*)0x10000016 = 0; *(uint8_t*)0x10000017 = 0; *(uint8_t*)0x10000018 = 0; *(uint8_t*)0x10000019 = 0; *(uint8_t*)0x1000001a = 0; *(uint8_t*)0x1000001b = 0; *(uint8_t*)0x1000001c = 0; *(uint8_t*)0x1000001d = 0; *(uint8_t*)0x1000001e = 0; *(uint8_t*)0x1000001f = 0; *(uint8_t*)0x10000020 = -1; *(uint8_t*)0x10000021 = -1; *(uint32_t*)0x10000022 = htobe32(0xe0000002); *(uint64_t*)0x10000026 = htobe64(0); *(uint64_t*)0x1000002e = htobe64(1); *(uint8_t*)0x10000036 = 0x5e; *(uint8_t*)0x10000037 = 0x36; *(uint8_t*)0x10000038 = 0; *(uint8_t*)0x10000039 = 0; *(uint8_t*)0x1000003a = 0; *(uint8_t*)0x1000003b = 0; *(uint8_t*)0x1000003c = 0; *(uint8_t*)0x1000003d = 0; *(uint8_t*)0x1000003e = 0x79; *(uint8_t*)0x1000003f = 0x1a; memcpy((void*)0x10000040, "\x32\x25\x39\xdc\xe6\xc8\x60\xea\xe2\xe7\x17\xfe\x5d\x91\x9d\x50\xf1\x2d\xa8\xc2\x79\x0d\x7b\x77\x8b\xd5", 26); *(uint8_t*)0x1000005a = 5; *(uint8_t*)0x1000005b = 2; *(uint16_t*)0x1000005c = htobe16(7); *(uint8_t*)0x1000005e = 0; *(uint8_t*)0x1000005f = 1; *(uint8_t*)0x10000060 = 0; *(uint8_t*)0x10000061 = 1; *(uint8_t*)0x10000062 = 2; *(uint8_t*)0x10000063 = 0; *(uint8_t*)0x10000064 = 0; *(uint8_t*)0x10000065 = 8; *(uint8_t*)0x10000066 = 0xfa; memcpy((void*)0x10000067, "\xe2\xb0\xb2\x1d\x6f\x96\xa0\x12\xb7\x94\x79\x1a\x56\x4b\x79\x1a\x9b\x08\x76\xcc\x87\xa8\xe8\xdf\xcd\x42\x46\xac\xbd\x2e\x57\x62\x29\x84\x3f\x20\x6d\x42\xee\xc2\xb9\x9d\x4b\x6d\xb9\x3c\xa1\x5f\x41\xcc\x25\xad\xa1\x9e\x33\x8a\x97\x80\xc9\x60\x42\x10\x12\x95\x03\x07\xe6\x5d\xda\x08\x89\x3e\xb2\xf5\x64\x02\xae\xfb\xa1\x48\xc2\xf9\x55\x8d\x7a\x04\xf9\xe1\x35\x24\x7d\x1a\x8d\x04\x24\x62\x50\x45\x2d\x0f\x26\x3c\xf9\x0a\xa9\x8d\x56\x9e\xaa\x16\x83\x4e\xa0\x45\xe6\xda\xbc\xe8\x90\x6a\xc9\xaf\x25\xef\xb2\xe5\xbc\xc2\x4b\x0d\xea\xbd\x73\x19\xca\x60\x6a\x2e\x28\xb6\x58\xae\xa5\x94\x7a\x43\x07\x5c\x1f\x2e\xa5\x0c\xca\x8d\xd6\x3e\x0a\x87\x6b\x47\xf6\x02\x10\xb4\xe8\x24\x19\x41\xfa\x4c\xae\xf6\xcd\x78\x74\x10\xb6\x90\x0e\xc1\x17\x31\x4f\x6e\x71\xf7\x87\x4a\xd6\x74\x17\xe3\x3c\xc3\x19\xd6\x51\xf3\x5f\x08\xd1\x15\xc9\x13\x75\xa2\xdf\x16\x29\xb5\x3a\x49\xe6\xb0\x5e\xdf\xa0\xc3\x5e\xee\x07\xf8\xcb\xd9\x8f\xdf\xf7\x05\x0f\x59\x61\xec\x1c\xe4\x76\xb8\x1c\x38\x52\x91\x2f\xbe\x45\x19\x3a\xa0\x55\xa5\x7f\xb3", 250); *(uint8_t*)0x10000161 = 4; *(uint8_t*)0x10000162 = 1; *(uint8_t*)0x10000163 = 0xa1; *(uint8_t*)0x10000164 = 1; *(uint8_t*)0x10000165 = 3; *(uint8_t*)0x10000166 = 0; *(uint8_t*)0x10000167 = 0; *(uint8_t*)0x10000168 = 0; *(uint8_t*)0x10000169 = 0; *(uint8_t*)0x1000016a = 1; *(uint8_t*)0x1000016b = 0; *(uint8_t*)0x1000016c = 4; *(uint8_t*)0x1000016d = 0x7e; memcpy((void*)0x1000016e, "\x64\x22\xa7\xd8\x78\x76\x68\x9c\xee\xf9\x9a\x86\x21\xb2\xff\xc6\x4a\x04\x7f\x65\x2c\x39\xeb\x4b\x53\xe8\x45\x12\xa5\x58\x53\x99\x3f\xeb\x36\xf7\x73\x64\xf4\x7b\x75\x9b\xa0\x40\x02\xb9\xb1\x94\x17\x5c\x2f\x22\x37\xbc\xb1\x14\x86\xa5\xb8\xf1\xf2\x82\x04\x97\x38\x1a\x8c\xaf\xa0\x73\x9a\xe6\x23\x82\xe8\x3c\x7a\x2e\xd1\xbf\x16\xab\xd0\xe2\x67\x54\xe1\x2c\x85\xdc\x31\x76\x4c\x4c\xae\x57\x9a\x16\x3f\x11\xe5\x70\xe8\xa4\xda\xe7\x89\x4a\x55\xd7\x96\xe1\xe7\x66\x3c\x41\xc1\xc3\xc7\x4e\x89\x7b\x7a\x3f\x74\xa3", 126); *(uint8_t*)0x100001ec = 4; *(uint8_t*)0x100001ed = 1; *(uint8_t*)0x100001ee = 4; *(uint8_t*)0x100001f6 = 0x88; *(uint8_t*)0x100001f7 = 0; *(uint16_t*)0x100001f8 = htobe16(0); *(uint8_t*)0x100001fa = 0x33; *(uint8_t*)0x100001fb = 0; *(uint8_t*)0x100001fc = 0; *(uint8_t*)0x100001fd = 0; *(uint64_t*)0x100001fe = htobe64(0); *(uint64_t*)0x10000206 = htobe64(1); *(uint8_t*)0x1000020e = 0x18; *(uint8_t*)0x1000020f = 0x1f; memcpy((void*)0x10000210, "\x7a\xa7\x36\x34\xe6\xc6\x0c\xeb\x89\x30\xc5\xbc\x17\x2a\x27\x55\x0b\x25\x6d\xd3\x86\x37\x55\x7a\x7d\x83\xb9\x70\xff\xf6\x99\xff\xde\xfb\xaa\x07\xf0\x44\x7c\x8b\x93\xf9\x73\x25\x46\x2e\x51\x16\xd6\x99\x81\xda\x65\x36\xe2\x68\x7f\x53\x21\xf0\x69\x84\x30\x4f\x9a\xc3\x4f\x65\x94\xf5\x62\x86\x2f\x34\x08\xd7\xb4\xc5\x44\x3f\x15\xa8\xa8\x02\x09\xbb\x6b\x12\xb9\xaa\x87\xcc\x0c\xc0\x7c\x13\x8e\x81\x1e\x6e\xcd\xed\x6f\x5e\x61\xe7\x7c\x35\xdb\xa8\xb5\x58\x25\x8c\xb7\xa0\x84\x63\x8b\x56\x63\x18\xc5\x13\x76\x39\x32\x33\xa5\x35\xfd\x53\x22\x9c\x67\x4d\x82\xb4\x47\x71\xf4\x3a\xc0\x8d\xcb\xcd\x5f\xfd\x65\x85\x0d\x7e\xef\x8c\x21\xb3\x83\x21\xd3\x4e\xf6\xd1\xf6\x92\xcc\x66\xc8\x48\x03\x7c\xc6\x2d\x0c\xa2\x31\x3a\xd4\x36\xb1\x99\x52\xdf\x8c\x0a\x2e\xf9\x1e\xa7\x2b\x33\xfc\x3d\x62\xbd\xe2\x31\x86\x35\x39\x7c\xb5\x95\x85\x1d\x39\x31\x46\xd9\x59\x34\xdb\x89\x14\x64\xa9\x74\xbd\xf9\x09\xdc\xae\xfd\x40\xc3\x51\x05\xdd\x2a\x93\x9c\xa0\x27\x95\xc2\x90\xd2\x83\x46\xa7\x09\x66\x6e\x65\x66\x82\x14\x13\xfa\x08\xd4\xe6\x12\x1e", 253); *(uint8_t*)0x1000030d = 5; *(uint8_t*)0x1000030e = 0x16; memcpy((void*)0x1000030f, "\x2e\x4f\x2a\x94\xc9\x13\x37\x5e\x90\xa8\x9d\xd2\xdb\x52\x08\x22\x3b\x2e\xc7\xfc\x31\x68\xa4\xbd\xca\xe1\x79\x7b\x6d\x83\x1a\x4b\xa9\xcc\x91\xe0\xe3\xd1\x1c\x2e\xcf\xf4\x4e\x97\xdf\xe6\xb9\xb7\x92\x98\x5a\x0d\x2c\xb0\x83\xac\x59\xe2\x09\x79\x5e\x00\x93\x0d\x9b\xa4\xc6\xa1\x10\x91\x36\xac\xd0\x95\xfd\xfe\x74\x57\xf6\xe2\x7d\x0a\xa1\xbf\xef\x5d\x6d\x3e\x90\x43\xfb\xbc\x47\x50\xca\x91\xcd\x1b\x4b\xb6\xb8\xc1\xaf\x78\xff\x40\x1c\x76\x0d\x21\x50\x99\x4f\xbe\x3c\x5e\x66\xe5\xab\xbd\xf1\x4d\xbf\xe5\x79\x71\xfc\xdd\xab\xff\x8c\x34\xa1\x20\x77\x8e\x67\xf3\x8d\x62\xe7\x6d\xef\x1c\xad\xb1\x01\x3d\x2a\xab\x71\xbc\x3f\x3d\xcd\xca\xa0\x85\xd1\xdd\xb8\x5e\x52\xa2\xf2\xf5\xa7\xa8\x59\x05\x15\x51\x92\x93\x0f\x0b", 176); struct csum_inet csum_3; csum_inet_init(&csum_3); csum_inet_update(&csum_3, (const uint8_t*)0x10000016, 16); csum_inet_update(&csum_3, (const uint8_t*)0x10000026, 16); uint32_t csum_3_chunk_2 = 0xc9010000; csum_inet_update(&csum_3, (const uint8_t*)&csum_3_chunk_2, 4); uint32_t csum_3_chunk_3 = 0x3a000000; csum_inet_update(&csum_3, (const uint8_t*)&csum_3_chunk_3, 4); csum_inet_update(&csum_3, (const uint8_t*)0x100001f6, 457); *(uint16_t*)0x100001f8 = csum_inet_digest(&csum_3); break; case 11: memcpy((void*)0x100003c0, "\x0f\x01\xf9\x67\x66\x0f\xfd\xd9\xc4\xe1\x11\xf9\xdf\xc4\xe3\x15\x02\x5b\x71\x0b\x64\x0f\xae\xf7\x3e\x0f\x5b\xd1\xc0\x00\x48\xc4\xe3\x79\x14\xb4\x18\x07\x00\x00\x00\x69\xcf\x66\x0f\x13\x2e", 47); syz_execute_func(0x100003c0); break; case 12: break; } } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); use_temporary_dir(); do_sandbox_none(); return 0; } :350:11: error: use of undeclared identifier 'SYS_copy_file_range' syscall(SYS_copy_file_range, 0xffffff9c, 0x10000140, (intptr_t)r[0], 0x10000180, 4ull, 0); ^ 1 error generated. compiler invocation: clang [-o /tmp/syz-executor930262317 -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 (2.53s) csource_test.go:123: opts: {Threaded:true Collide:true Repeat:true RepeatTimes:0 Procs:2 Sandbox:none Fault:false FaultCall:0 FaultNth:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false VhciInjection:false Wifi:false Sysctl:false UseTmpDir:true HandleSegv:false Repro:true Trace:false} program: fstat(0xffffffffffffff9c, &(0x7f0000000000)) r0 = socket$inet6_icmp_raw(0x1c, 0x3, 0x3a) setsockopt$inet6_tcp_TCP_FUNCTION_BLK(r0, 0x6, 0x2000, &(0x7f0000000100)={'bbr\x00', 0xfff}, 0x24) copy_file_range(0xffffffffffffff9c, &(0x7f0000000140)=0x9, r0, &(0x7f0000000180)=0x3f, 0x4, 0x0) getsockopt$inet_sctp_SCTP_EXPLICIT_EOR(0xffffffffffffffff, 0x84, 0x1b, &(0x7f00000001c0), &(0x7f0000000200)=0x4) getuid() getsockopt$inet_sctp_SCTP_STATUS(0xffffffffffffffff, 0x84, 0x100, &(0x7f0000000240)={0x0, 0x5, 0x2, 0xdd, 0x9, 0x7fff, 0x5, 0x1, {@in6={{0x1c, 0x1c, 0x3, 0x4, @local={0xfe, 0x80, [], 0x0}, 0x10000}}, 0x0, 0x9, 0xfffffff9, 0xdf10, 0x40, 0x8}}, &(0x7f0000000300)=0xac) getsockopt$inet6_sctp_SCTP_PR_ASSOC_STATUS(r0, 0x84, 0x108, &(0x7f0000000340)={r1, 0x9, 0x3, 0x1, 0x1}, &(0x7f0000000380)=0x18) syz_emit_ethernet(0xe3, &(0x7f00000003c0)={@random="558e866ec7c5", @broadcast, [{[{0x88a8, 0x0, 0x0, 0x1}], {0x8100, 0x0, 0x0, 0x4}}], {@ipv4={0x800, {{0xc, 0x4, 0x0, 0x8, 0xcd, 0x68, 0x1, 0x2, 0x1a, 0x0, @multicast2, @rand_addr, {[@ra={0x94, 0x6, 0x10000}, @lsrr={0x83, 0xb, 0x0, [@loopback, @empty]}, @generic={0x88, 0x9, "68b02e9aa55a8b"}]}}, @udp={{0x2, 0x3, 0x8}, {"1727313c0d121aaf942aba95b4aa8f3fab4a3f423c50b9f3207de073cd93e9d4abf4dd1bdea8b9e04ec83b0977c7094eca816b50fc613b6900642ed7c79867dfbfa2ee7e0da3bc0e15225c1f9e123c3983360a7a327e25ef286a9c45d8132c1c2201ecdb70ba3a3299d6680314428360ae3e57dcf3e15138710e151bad4503a78f71aae9accd796586c9b1fcfa620a259cc61014ef"}}}}}}) setgroups(0x1, &(0x7f00000004c0)=[0x0]) syz_emit_ethernet(0x3bf, &(0x7f0000000000)={@empty, @empty, [], {@ipv6={0x86dd, {0x3, 0x6, "082111", 0x389, 0x6c, 0x0, @ipv4={[], [], @multicast2}, @loopback, {[@dstopts={0x5e, 0x36, [], [@generic={0x79, 0x1a, "322539dce6c860eae2e717fe5d919d50f12da8c2790d7b778bd5"}, @ra={0x5, 0x2, 0x7}, @pad1, @padn={0x1, 0x2, [0x0, 0x0]}, @generic={0x8, 0xfa, "e2b0b21d6f96a012b794791a564b791a9b0876cc87a8e8dfcd4246acbd2e576229843f206d42eec2b99d4b6db93ca15f41cc25ada19e338a9780c960421012950307e65dda08893eb2f56402aefba148c2f9558d7a04f9e135247d1a8d04246250452d0f263cf90aa98d569eaa16834ea045e6dabce8906ac9af25efb2e5bcc24b0deabd7319ca606a2e28b658aea5947a43075c1f2ea50cca8dd63e0a876b47f60210b4e8241941fa4caef6cd787410b6900ec117314f6e71f7874ad67417e33cc319d651f35f08d115c91375a2df1629b53a49e6b05edfa0c35eee07f8cbd98fdff7050f5961ec1ce476b81c3852912fbe45193aa055a57fb3"}, @enc_lim={0x4, 0x1, 0xa1}, @padn={0x1, 0x3, [0x0, 0x0, 0x0]}, @pad1, @generic={0x4, 0x7e, "6422a7d87876689ceef99a8621b2ffc64a047f652c39eb4b53e84512a55853993feb36f77364f47b759ba04002b9b194175c2f2237bcb11486a5b8f1f2820497381a8cafa0739ae62382e83c7a2ed1bf16abd0e26754e12c85dc31764c4cae579a163f11e570e8a4dae7894a55d796e1e7663c41c1c3c74e897b7a3f74a3"}, @enc_lim={0x4, 0x1, 0x4}]}], @icmpv6=@ndisc_na={0x88, 0x0, 0x0, 0x33, [], @loopback, [{0x18, 0x1f, "7aa73634e6c60ceb8930c5bc172a27550b256dd38637557a7d83b970fff699ffdefbaa07f0447c8b93f97325462e5116d69981da6536e2687f5321f06984304f9ac34f6594f562862f3408d7b4c5443f15a8a80209bb6b12b9aa87cc0cc07c138e811e6ecded6f5e61e77c35dba8b558258cb7a084638b566318c51376393233a535fd53229c674d82b44771f43ac08dcbcd5ffd65850d7eef8c21b38321d34ef6d1f692cc66c848037cc62d0ca2313ad436b19952df8c0a2ef91ea72b33fc3d62bde2318635397cb595851d393146d95934db891464a974bdf909dcaefd40c35105dd2a939ca02795c290d28346a709666e6566821413fa08d4e6121e"}, {0x5, 0x16, "2e4f2a94c913375e90a89dd2db5208223b2ec7fc3168a4bdcae1797b6d831a4ba9cc91e0e3d11c2ecff44e97dfe6b9b792985a0d2cb083ac59e209795e00930d9ba4c6a1109136acd095fdfe7457f6e27d0aa1bfef5d6d3e9043fbbc4750ca91cd1b4bb6b8c1af78ff401c760d2150994fbe3c5e66e5abbdf14dbfe57971fcddabff8c34a120778e67f38d62e76def1cadb1013d2aab71bc3f3dcdcaa085d1ddb85e52a2f2f5a7a85905155192930f0b"}]}}}}}}) syz_execute_func(&(0x7f00000003c0)="0f01f967660ffdd9c4e111f9dfc4e315025b710b640faef73e0f5bd1c00048c4e37914b4180700000069cf660f132e") syz_extract_tcp_res(&(0x7f0000000400), 0x2, 0x67) csource_test.go:124: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static unsigned long long procid; static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void __attribute__((noinline)) remove_dir(const char* dir) { DIR* dp = opendir(dir); if (dp == NULL) { if (errno == EACCES) { if (rmdir(dir)) exit(1); return; } exit(1); } struct dirent* ep = 0; while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } if (unlink(filename)) exit(1); } closedir(dp); if (rmdir(dir)) exit(1); } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { pthread_mutex_t mu; pthread_cond_t cv; int state; } event_t; static void event_init(event_t* ev) { if (pthread_mutex_init(&ev->mu, 0)) exit(1); if (pthread_cond_init(&ev->cv, 0)) exit(1); ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { pthread_mutex_lock(&ev->mu); if (ev->state) exit(1); ev->state = 1; pthread_mutex_unlock(&ev->mu); pthread_cond_broadcast(&ev->cv); } static void event_wait(event_t* ev) { pthread_mutex_lock(&ev->mu); while (!ev->state) pthread_cond_wait(&ev->cv, &ev->mu); pthread_mutex_unlock(&ev->mu); } static int event_isset(event_t* ev) { pthread_mutex_lock(&ev->mu); int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; pthread_mutex_lock(&ev->mu); for (;;) { if (ev->state) break; uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); now = current_time_ms(); if (now - start > timeout) break; } int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } #define BITMASK(bf_off,bf_len) (((1ull << (bf_len)) - 1) << (bf_off)) #define STORE_BY_BITMASK(type,htobe,addr,val,bf_off,bf_len) *(type*)(addr) = htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len)))) struct csum_inet { uint32_t acc; }; static void csum_inet_init(struct csum_inet* csum) { csum->acc = 0; } static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) { if (length == 0) return; size_t i = 0; for (; i < length - 1; i += 2) csum->acc += *(uint16_t*)&data[i]; if (length & 1) csum->acc += le16toh((uint16_t)data[length - 1]); while (csum->acc > 0xffff) csum->acc = (csum->acc & 0xffff) + (csum->acc >> 16); } static uint16_t csum_inet_digest(struct csum_inet* csum) { return ~csum->acc; } static void sandbox_common() { struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 8 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 0; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); } static void loop(); static int do_sandbox_none(void) { sandbox_common(); loop(); return 0; } static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } int i, call, thread; int collide = 0; again: for (call = 0; call < 13; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (collide && (call % 2) == 0) break; event_timedwait(&th->done, 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 = 0; for (;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[2] = {0xffffffffffffffff, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: syscall(SYS_fstat, 0xffffff9c, 0x10000000); break; case 1: res = syscall(SYS_socket, 0x1c, 3, 0x3a); if (res != -1) r[0] = res; break; case 2: memcpy((void*)0x10000100, "bbr\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 32); *(uint32_t*)0x10000120 = 0xfff; syscall(SYS_setsockopt, (intptr_t)r[0], 6, 0x2000, 0x10000100, 0x24); break; case 3: *(uint64_t*)0x10000140 = 9; *(uint64_t*)0x10000180 = 0x3f; syscall(SYS_copy_file_range, 0xffffff9c, 0x10000140, (intptr_t)r[0], 0x10000180, 4ull, 0); break; case 4: *(uint32_t*)0x10000200 = 4; syscall(SYS_getsockopt, -1, 0x84, 0x1b, 0x100001c0, 0x10000200); break; case 5: syscall(SYS_getuid); break; case 6: *(uint32_t*)0x10000240 = 0; *(uint32_t*)0x10000244 = 5; *(uint32_t*)0x10000248 = 2; *(uint16_t*)0x1000024c = 0xdd; *(uint16_t*)0x1000024e = 9; *(uint16_t*)0x10000250 = 0x7fff; *(uint16_t*)0x10000252 = 5; *(uint32_t*)0x10000254 = 1; *(uint8_t*)0x10000258 = 0x1c; *(uint8_t*)0x10000259 = 0x1c; *(uint16_t*)0x1000025a = htobe16(0x4e23 + procid*4); *(uint32_t*)0x1000025c = 4; *(uint8_t*)0x10000260 = 0xfe; *(uint8_t*)0x10000261 = 0x80; *(uint8_t*)0x10000262 = 0; *(uint8_t*)0x10000263 = 0; *(uint8_t*)0x10000264 = 0; *(uint8_t*)0x10000265 = 0; *(uint8_t*)0x10000266 = 0; *(uint8_t*)0x10000267 = 0; *(uint8_t*)0x10000268 = 0; *(uint8_t*)0x10000269 = 0; *(uint8_t*)0x1000026a = 0; *(uint8_t*)0x1000026b = 0; *(uint8_t*)0x1000026c = 0; *(uint8_t*)0x1000026d = 0; *(uint8_t*)0x1000026e = 0 + procid*1; *(uint8_t*)0x1000026f = 0xaa; *(uint32_t*)0x10000270 = 0x10000; *(uint64_t*)0x10000274 = 0; *(uint64_t*)0x1000027c = 0; *(uint64_t*)0x10000284 = 0; *(uint64_t*)0x1000028c = 0; *(uint64_t*)0x10000294 = 0; *(uint64_t*)0x1000029c = 0; *(uint64_t*)0x100002a4 = 0; *(uint64_t*)0x100002ac = 0; *(uint64_t*)0x100002b4 = 0; *(uint64_t*)0x100002bc = 0; *(uint64_t*)0x100002c4 = 0; *(uint64_t*)0x100002cc = 0; *(uint32_t*)0x100002d4 = 0; *(uint32_t*)0x100002d8 = 9; *(uint32_t*)0x100002dc = 0xfffffff9; *(uint32_t*)0x100002e0 = 0xdf10; *(uint32_t*)0x100002e4 = 0x40; *(uint32_t*)0x100002e8 = 8; *(uint32_t*)0x10000300 = 0xac; res = syscall(SYS_getsockopt, -1, 0x84, 0x100, 0x10000240, 0x10000300); if (res != -1) r[1] = *(uint32_t*)0x100002d4; break; case 7: *(uint32_t*)0x10000340 = r[1]; *(uint16_t*)0x10000344 = 9; *(uint16_t*)0x10000346 = 3; *(uint64_t*)0x10000348 = 1; *(uint64_t*)0x10000350 = 1; *(uint32_t*)0x10000380 = 0x18; syscall(SYS_getsockopt, (intptr_t)r[0], 0x84, 0x108, 0x10000340, 0x10000380); break; case 8: memcpy((void*)0x100003c0, "\x55\x8e\x86\x6e\xc7\xc5", 6); *(uint8_t*)0x100003c6 = -1; *(uint8_t*)0x100003c7 = -1; *(uint8_t*)0x100003c8 = -1; *(uint8_t*)0x100003c9 = -1; *(uint8_t*)0x100003ca = -1; *(uint8_t*)0x100003cb = -1; *(uint16_t*)0x100003cc = htobe16(0x88a8); STORE_BY_BITMASK(uint16_t, , 0x100003ce, 0, 0, 3); STORE_BY_BITMASK(uint16_t, , 0x100003ce, 0, 3, 1); STORE_BY_BITMASK(uint16_t, , 0x100003ce, 1, 4, 12); *(uint16_t*)0x100003d0 = htobe16(0x8100); STORE_BY_BITMASK(uint16_t, , 0x100003d2, 0, 0, 3); STORE_BY_BITMASK(uint16_t, , 0x100003d2, 0, 3, 1); STORE_BY_BITMASK(uint16_t, , 0x100003d2, 4, 4, 12); *(uint16_t*)0x100003d4 = htobe16(0x800); STORE_BY_BITMASK(uint8_t, , 0x100003d6, 0xc, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x100003d6, 4, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x100003d7, 0, 0, 2); STORE_BY_BITMASK(uint8_t, , 0x100003d7, 8, 2, 6); *(uint16_t*)0x100003d8 = htobe16(0xcd); *(uint16_t*)0x100003da = htobe16(0x68); *(uint16_t*)0x100003dc = htobe16(1); *(uint8_t*)0x100003de = 2; *(uint8_t*)0x100003df = 0x1a; *(uint16_t*)0x100003e0 = htobe16(0); *(uint32_t*)0x100003e2 = htobe32(0xe0000002); *(uint32_t*)0x100003e6 = htobe32(0); *(uint8_t*)0x100003ea = 0x94; *(uint8_t*)0x100003eb = 6; *(uint32_t*)0x100003ec = htobe32(0x10000); *(uint8_t*)0x100003f0 = 0x83; *(uint8_t*)0x100003f1 = 0xb; *(uint8_t*)0x100003f2 = 0; *(uint32_t*)0x100003f3 = htobe32(0x7f000001); *(uint32_t*)0x100003f7 = htobe32(0); *(uint8_t*)0x100003fb = 0x88; *(uint8_t*)0x100003fc = 9; memcpy((void*)0x100003fd, "\x68\xb0\x2e\x9a\xa5\x5a\x8b", 7); *(uint16_t*)0x10000406 = htobe16(0x4e22 + procid*4); *(uint16_t*)0x10000408 = htobe16(0x4e23 + procid*4); *(uint16_t*)0x1000040a = htobe16(8); *(uint16_t*)0x1000040c = htobe16(0); memcpy((void*)0x1000040e, "\x17\x27\x31\x3c\x0d\x12\x1a\xaf\x94\x2a\xba\x95\xb4\xaa\x8f\x3f\xab\x4a\x3f\x42\x3c\x50\xb9\xf3\x20\x7d\xe0\x73\xcd\x93\xe9\xd4\xab\xf4\xdd\x1b\xde\xa8\xb9\xe0\x4e\xc8\x3b\x09\x77\xc7\x09\x4e\xca\x81\x6b\x50\xfc\x61\x3b\x69\x00\x64\x2e\xd7\xc7\x98\x67\xdf\xbf\xa2\xee\x7e\x0d\xa3\xbc\x0e\x15\x22\x5c\x1f\x9e\x12\x3c\x39\x83\x36\x0a\x7a\x32\x7e\x25\xef\x28\x6a\x9c\x45\xd8\x13\x2c\x1c\x22\x01\xec\xdb\x70\xba\x3a\x32\x99\xd6\x68\x03\x14\x42\x83\x60\xae\x3e\x57\xdc\xf3\xe1\x51\x38\x71\x0e\x15\x1b\xad\x45\x03\xa7\x8f\x71\xaa\xe9\xac\xcd\x79\x65\x86\xc9\xb1\xfc\xfa\x62\x0a\x25\x9c\xc6\x10\x14\xef", 149); struct csum_inet csum_1; csum_inet_init(&csum_1); csum_inet_update(&csum_1, (const uint8_t*)0x100003e2, 4); csum_inet_update(&csum_1, (const uint8_t*)0x100003e6, 4); uint16_t csum_1_chunk_2 = 0x1100; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_2, 2); uint16_t csum_1_chunk_3 = 0x800; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_3, 2); csum_inet_update(&csum_1, (const uint8_t*)0x10000406, 8); *(uint16_t*)0x1000040c = csum_inet_digest(&csum_1); struct csum_inet csum_2; csum_inet_init(&csum_2); csum_inet_update(&csum_2, (const uint8_t*)0x100003d6, 48); *(uint16_t*)0x100003e0 = csum_inet_digest(&csum_2); break; case 9: *(uint32_t*)0x100004c0 = 0; syscall(SYS_setgroups, 1, 0x100004c0); break; case 10: *(uint8_t*)0x10000000 = 0; *(uint8_t*)0x10000001 = 0; *(uint8_t*)0x10000002 = 0; *(uint8_t*)0x10000003 = 0; *(uint8_t*)0x10000004 = 0; *(uint8_t*)0x10000005 = 0; *(uint8_t*)0x10000006 = 0; *(uint8_t*)0x10000007 = 0; *(uint8_t*)0x10000008 = 0; *(uint8_t*)0x10000009 = 0; *(uint8_t*)0x1000000a = 0; *(uint8_t*)0x1000000b = 0; *(uint16_t*)0x1000000c = htobe16(0x86dd); STORE_BY_BITMASK(uint8_t, , 0x1000000e, 3, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x1000000e, 6, 4, 4); memcpy((void*)0x1000000f, "\x08\x21\x11", 3); *(uint16_t*)0x10000012 = htobe16(0x389); *(uint8_t*)0x10000014 = 0x6c; *(uint8_t*)0x10000015 = 0; *(uint8_t*)0x10000016 = 0; *(uint8_t*)0x10000017 = 0; *(uint8_t*)0x10000018 = 0; *(uint8_t*)0x10000019 = 0; *(uint8_t*)0x1000001a = 0; *(uint8_t*)0x1000001b = 0; *(uint8_t*)0x1000001c = 0; *(uint8_t*)0x1000001d = 0; *(uint8_t*)0x1000001e = 0; *(uint8_t*)0x1000001f = 0; *(uint8_t*)0x10000020 = -1; *(uint8_t*)0x10000021 = -1; *(uint32_t*)0x10000022 = htobe32(0xe0000002); *(uint64_t*)0x10000026 = htobe64(0); *(uint64_t*)0x1000002e = htobe64(1); *(uint8_t*)0x10000036 = 0x5e; *(uint8_t*)0x10000037 = 0x36; *(uint8_t*)0x10000038 = 0; *(uint8_t*)0x10000039 = 0; *(uint8_t*)0x1000003a = 0; *(uint8_t*)0x1000003b = 0; *(uint8_t*)0x1000003c = 0; *(uint8_t*)0x1000003d = 0; *(uint8_t*)0x1000003e = 0x79; *(uint8_t*)0x1000003f = 0x1a; memcpy((void*)0x10000040, "\x32\x25\x39\xdc\xe6\xc8\x60\xea\xe2\xe7\x17\xfe\x5d\x91\x9d\x50\xf1\x2d\xa8\xc2\x79\x0d\x7b\x77\x8b\xd5", 26); *(uint8_t*)0x1000005a = 5; *(uint8_t*)0x1000005b = 2; *(uint16_t*)0x1000005c = htobe16(7); *(uint8_t*)0x1000005e = 0; *(uint8_t*)0x1000005f = 1; *(uint8_t*)0x10000060 = 0; *(uint8_t*)0x10000061 = 1; *(uint8_t*)0x10000062 = 2; *(uint8_t*)0x10000063 = 0; *(uint8_t*)0x10000064 = 0; *(uint8_t*)0x10000065 = 8; *(uint8_t*)0x10000066 = 0xfa; memcpy((void*)0x10000067, "\xe2\xb0\xb2\x1d\x6f\x96\xa0\x12\xb7\x94\x79\x1a\x56\x4b\x79\x1a\x9b\x08\x76\xcc\x87\xa8\xe8\xdf\xcd\x42\x46\xac\xbd\x2e\x57\x62\x29\x84\x3f\x20\x6d\x42\xee\xc2\xb9\x9d\x4b\x6d\xb9\x3c\xa1\x5f\x41\xcc\x25\xad\xa1\x9e\x33\x8a\x97\x80\xc9\x60\x42\x10\x12\x95\x03\x07\xe6\x5d\xda\x08\x89\x3e\xb2\xf5\x64\x02\xae\xfb\xa1\x48\xc2\xf9\x55\x8d\x7a\x04\xf9\xe1\x35\x24\x7d\x1a\x8d\x04\x24\x62\x50\x45\x2d\x0f\x26\x3c\xf9\x0a\xa9\x8d\x56\x9e\xaa\x16\x83\x4e\xa0\x45\xe6\xda\xbc\xe8\x90\x6a\xc9\xaf\x25\xef\xb2\xe5\xbc\xc2\x4b\x0d\xea\xbd\x73\x19\xca\x60\x6a\x2e\x28\xb6\x58\xae\xa5\x94\x7a\x43\x07\x5c\x1f\x2e\xa5\x0c\xca\x8d\xd6\x3e\x0a\x87\x6b\x47\xf6\x02\x10\xb4\xe8\x24\x19\x41\xfa\x4c\xae\xf6\xcd\x78\x74\x10\xb6\x90\x0e\xc1\x17\x31\x4f\x6e\x71\xf7\x87\x4a\xd6\x74\x17\xe3\x3c\xc3\x19\xd6\x51\xf3\x5f\x08\xd1\x15\xc9\x13\x75\xa2\xdf\x16\x29\xb5\x3a\x49\xe6\xb0\x5e\xdf\xa0\xc3\x5e\xee\x07\xf8\xcb\xd9\x8f\xdf\xf7\x05\x0f\x59\x61\xec\x1c\xe4\x76\xb8\x1c\x38\x52\x91\x2f\xbe\x45\x19\x3a\xa0\x55\xa5\x7f\xb3", 250); *(uint8_t*)0x10000161 = 4; *(uint8_t*)0x10000162 = 1; *(uint8_t*)0x10000163 = 0xa1; *(uint8_t*)0x10000164 = 1; *(uint8_t*)0x10000165 = 3; *(uint8_t*)0x10000166 = 0; *(uint8_t*)0x10000167 = 0; *(uint8_t*)0x10000168 = 0; *(uint8_t*)0x10000169 = 0; *(uint8_t*)0x1000016a = 1; *(uint8_t*)0x1000016b = 0; *(uint8_t*)0x1000016c = 4; *(uint8_t*)0x1000016d = 0x7e; memcpy((void*)0x1000016e, "\x64\x22\xa7\xd8\x78\x76\x68\x9c\xee\xf9\x9a\x86\x21\xb2\xff\xc6\x4a\x04\x7f\x65\x2c\x39\xeb\x4b\x53\xe8\x45\x12\xa5\x58\x53\x99\x3f\xeb\x36\xf7\x73\x64\xf4\x7b\x75\x9b\xa0\x40\x02\xb9\xb1\x94\x17\x5c\x2f\x22\x37\xbc\xb1\x14\x86\xa5\xb8\xf1\xf2\x82\x04\x97\x38\x1a\x8c\xaf\xa0\x73\x9a\xe6\x23\x82\xe8\x3c\x7a\x2e\xd1\xbf\x16\xab\xd0\xe2\x67\x54\xe1\x2c\x85\xdc\x31\x76\x4c\x4c\xae\x57\x9a\x16\x3f\x11\xe5\x70\xe8\xa4\xda\xe7\x89\x4a\x55\xd7\x96\xe1\xe7\x66\x3c\x41\xc1\xc3\xc7\x4e\x89\x7b\x7a\x3f\x74\xa3", 126); *(uint8_t*)0x100001ec = 4; *(uint8_t*)0x100001ed = 1; *(uint8_t*)0x100001ee = 4; *(uint8_t*)0x100001f6 = 0x88; *(uint8_t*)0x100001f7 = 0; *(uint16_t*)0x100001f8 = htobe16(0); *(uint8_t*)0x100001fa = 0x33; *(uint8_t*)0x100001fb = 0; *(uint8_t*)0x100001fc = 0; *(uint8_t*)0x100001fd = 0; *(uint64_t*)0x100001fe = htobe64(0); *(uint64_t*)0x10000206 = htobe64(1); *(uint8_t*)0x1000020e = 0x18; *(uint8_t*)0x1000020f = 0x1f; memcpy((void*)0x10000210, "\x7a\xa7\x36\x34\xe6\xc6\x0c\xeb\x89\x30\xc5\xbc\x17\x2a\x27\x55\x0b\x25\x6d\xd3\x86\x37\x55\x7a\x7d\x83\xb9\x70\xff\xf6\x99\xff\xde\xfb\xaa\x07\xf0\x44\x7c\x8b\x93\xf9\x73\x25\x46\x2e\x51\x16\xd6\x99\x81\xda\x65\x36\xe2\x68\x7f\x53\x21\xf0\x69\x84\x30\x4f\x9a\xc3\x4f\x65\x94\xf5\x62\x86\x2f\x34\x08\xd7\xb4\xc5\x44\x3f\x15\xa8\xa8\x02\x09\xbb\x6b\x12\xb9\xaa\x87\xcc\x0c\xc0\x7c\x13\x8e\x81\x1e\x6e\xcd\xed\x6f\x5e\x61\xe7\x7c\x35\xdb\xa8\xb5\x58\x25\x8c\xb7\xa0\x84\x63\x8b\x56\x63\x18\xc5\x13\x76\x39\x32\x33\xa5\x35\xfd\x53\x22\x9c\x67\x4d\x82\xb4\x47\x71\xf4\x3a\xc0\x8d\xcb\xcd\x5f\xfd\x65\x85\x0d\x7e\xef\x8c\x21\xb3\x83\x21\xd3\x4e\xf6\xd1\xf6\x92\xcc\x66\xc8\x48\x03\x7c\xc6\x2d\x0c\xa2\x31\x3a\xd4\x36\xb1\x99\x52\xdf\x8c\x0a\x2e\xf9\x1e\xa7\x2b\x33\xfc\x3d\x62\xbd\xe2\x31\x86\x35\x39\x7c\xb5\x95\x85\x1d\x39\x31\x46\xd9\x59\x34\xdb\x89\x14\x64\xa9\x74\xbd\xf9\x09\xdc\xae\xfd\x40\xc3\x51\x05\xdd\x2a\x93\x9c\xa0\x27\x95\xc2\x90\xd2\x83\x46\xa7\x09\x66\x6e\x65\x66\x82\x14\x13\xfa\x08\xd4\xe6\x12\x1e", 253); *(uint8_t*)0x1000030d = 5; *(uint8_t*)0x1000030e = 0x16; memcpy((void*)0x1000030f, "\x2e\x4f\x2a\x94\xc9\x13\x37\x5e\x90\xa8\x9d\xd2\xdb\x52\x08\x22\x3b\x2e\xc7\xfc\x31\x68\xa4\xbd\xca\xe1\x79\x7b\x6d\x83\x1a\x4b\xa9\xcc\x91\xe0\xe3\xd1\x1c\x2e\xcf\xf4\x4e\x97\xdf\xe6\xb9\xb7\x92\x98\x5a\x0d\x2c\xb0\x83\xac\x59\xe2\x09\x79\x5e\x00\x93\x0d\x9b\xa4\xc6\xa1\x10\x91\x36\xac\xd0\x95\xfd\xfe\x74\x57\xf6\xe2\x7d\x0a\xa1\xbf\xef\x5d\x6d\x3e\x90\x43\xfb\xbc\x47\x50\xca\x91\xcd\x1b\x4b\xb6\xb8\xc1\xaf\x78\xff\x40\x1c\x76\x0d\x21\x50\x99\x4f\xbe\x3c\x5e\x66\xe5\xab\xbd\xf1\x4d\xbf\xe5\x79\x71\xfc\xdd\xab\xff\x8c\x34\xa1\x20\x77\x8e\x67\xf3\x8d\x62\xe7\x6d\xef\x1c\xad\xb1\x01\x3d\x2a\xab\x71\xbc\x3f\x3d\xcd\xca\xa0\x85\xd1\xdd\xb8\x5e\x52\xa2\xf2\xf5\xa7\xa8\x59\x05\x15\x51\x92\x93\x0f\x0b", 176); struct csum_inet csum_3; csum_inet_init(&csum_3); csum_inet_update(&csum_3, (const uint8_t*)0x10000016, 16); csum_inet_update(&csum_3, (const uint8_t*)0x10000026, 16); uint32_t csum_3_chunk_2 = 0xc9010000; csum_inet_update(&csum_3, (const uint8_t*)&csum_3_chunk_2, 4); uint32_t csum_3_chunk_3 = 0x3a000000; csum_inet_update(&csum_3, (const uint8_t*)&csum_3_chunk_3, 4); csum_inet_update(&csum_3, (const uint8_t*)0x100001f6, 457); *(uint16_t*)0x100001f8 = csum_inet_digest(&csum_3); break; case 11: memcpy((void*)0x100003c0, "\x0f\x01\xf9\x67\x66\x0f\xfd\xd9\xc4\xe1\x11\xf9\xdf\xc4\xe3\x15\x02\x5b\x71\x0b\x64\x0f\xae\xf7\x3e\x0f\x5b\xd1\xc0\x00\x48\xc4\xe3\x79\x14\xb4\x18\x07\x00\x00\x00\x69\xcf\x66\x0f\x13\x2e", 47); syz_execute_func(0x100003c0); break; case 12: break; } } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); for (procid = 0; procid < 2; procid++) { if (fork() == 0) { use_temporary_dir(); do_sandbox_none(); } } sleep(1000000); return 0; } :360:11: error: use of undeclared identifier 'SYS_copy_file_range' syscall(SYS_copy_file_range, 0xffffff9c, 0x10000140, (intptr_t)r[0], 0x10000180, 4ull, 0); ^ 1 error generated. compiler invocation: clang [-o /tmp/syz-executor186752168 -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 (2.36s) csource_test.go:123: opts: {Threaded:true Collide:false Repeat:true RepeatTimes:10 Procs:0 Sandbox:none Fault:false FaultCall:0 FaultNth:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false VhciInjection:false Wifi:false Sysctl:false UseTmpDir:true HandleSegv:false Repro:false Trace:false} program: fstat(0xffffffffffffff9c, &(0x7f0000000000)) r0 = socket$inet6_icmp_raw(0x1c, 0x3, 0x3a) setsockopt$inet6_tcp_TCP_FUNCTION_BLK(r0, 0x6, 0x2000, &(0x7f0000000100)={'bbr\x00', 0xfff}, 0x24) copy_file_range(0xffffffffffffff9c, &(0x7f0000000140)=0x9, r0, &(0x7f0000000180)=0x3f, 0x4, 0x0) getsockopt$inet_sctp_SCTP_EXPLICIT_EOR(0xffffffffffffffff, 0x84, 0x1b, &(0x7f00000001c0), &(0x7f0000000200)=0x4) getuid() getsockopt$inet_sctp_SCTP_STATUS(0xffffffffffffffff, 0x84, 0x100, &(0x7f0000000240)={0x0, 0x5, 0x2, 0xdd, 0x9, 0x7fff, 0x5, 0x1, {@in6={{0x1c, 0x1c, 0x3, 0x4, @local={0xfe, 0x80, [], 0x0}, 0x10000}}, 0x0, 0x9, 0xfffffff9, 0xdf10, 0x40, 0x8}}, &(0x7f0000000300)=0xac) getsockopt$inet6_sctp_SCTP_PR_ASSOC_STATUS(r0, 0x84, 0x108, &(0x7f0000000340)={r1, 0x9, 0x3, 0x1, 0x1}, &(0x7f0000000380)=0x18) syz_emit_ethernet(0xe3, &(0x7f00000003c0)={@random="558e866ec7c5", @broadcast, [{[{0x88a8, 0x0, 0x0, 0x1}], {0x8100, 0x0, 0x0, 0x4}}], {@ipv4={0x800, {{0xc, 0x4, 0x0, 0x8, 0xcd, 0x68, 0x1, 0x2, 0x1a, 0x0, @multicast2, @rand_addr, {[@ra={0x94, 0x6, 0x10000}, @lsrr={0x83, 0xb, 0x0, [@loopback, @empty]}, @generic={0x88, 0x9, "68b02e9aa55a8b"}]}}, @udp={{0x2, 0x3, 0x8}, {"1727313c0d121aaf942aba95b4aa8f3fab4a3f423c50b9f3207de073cd93e9d4abf4dd1bdea8b9e04ec83b0977c7094eca816b50fc613b6900642ed7c79867dfbfa2ee7e0da3bc0e15225c1f9e123c3983360a7a327e25ef286a9c45d8132c1c2201ecdb70ba3a3299d6680314428360ae3e57dcf3e15138710e151bad4503a78f71aae9accd796586c9b1fcfa620a259cc61014ef"}}}}}}) setgroups(0x1, &(0x7f00000004c0)=[0x0]) syz_emit_ethernet(0x3bf, &(0x7f0000000000)={@empty, @empty, [], {@ipv6={0x86dd, {0x3, 0x6, "082111", 0x389, 0x6c, 0x0, @ipv4={[], [], @multicast2}, @loopback, {[@dstopts={0x5e, 0x36, [], [@generic={0x79, 0x1a, "322539dce6c860eae2e717fe5d919d50f12da8c2790d7b778bd5"}, @ra={0x5, 0x2, 0x7}, @pad1, @padn={0x1, 0x2, [0x0, 0x0]}, @generic={0x8, 0xfa, "e2b0b21d6f96a012b794791a564b791a9b0876cc87a8e8dfcd4246acbd2e576229843f206d42eec2b99d4b6db93ca15f41cc25ada19e338a9780c960421012950307e65dda08893eb2f56402aefba148c2f9558d7a04f9e135247d1a8d04246250452d0f263cf90aa98d569eaa16834ea045e6dabce8906ac9af25efb2e5bcc24b0deabd7319ca606a2e28b658aea5947a43075c1f2ea50cca8dd63e0a876b47f60210b4e8241941fa4caef6cd787410b6900ec117314f6e71f7874ad67417e33cc319d651f35f08d115c91375a2df1629b53a49e6b05edfa0c35eee07f8cbd98fdff7050f5961ec1ce476b81c3852912fbe45193aa055a57fb3"}, @enc_lim={0x4, 0x1, 0xa1}, @padn={0x1, 0x3, [0x0, 0x0, 0x0]}, @pad1, @generic={0x4, 0x7e, "6422a7d87876689ceef99a8621b2ffc64a047f652c39eb4b53e84512a55853993feb36f77364f47b759ba04002b9b194175c2f2237bcb11486a5b8f1f2820497381a8cafa0739ae62382e83c7a2ed1bf16abd0e26754e12c85dc31764c4cae579a163f11e570e8a4dae7894a55d796e1e7663c41c1c3c74e897b7a3f74a3"}, @enc_lim={0x4, 0x1, 0x4}]}], @icmpv6=@ndisc_na={0x88, 0x0, 0x0, 0x33, [], @loopback, [{0x18, 0x1f, "7aa73634e6c60ceb8930c5bc172a27550b256dd38637557a7d83b970fff699ffdefbaa07f0447c8b93f97325462e5116d69981da6536e2687f5321f06984304f9ac34f6594f562862f3408d7b4c5443f15a8a80209bb6b12b9aa87cc0cc07c138e811e6ecded6f5e61e77c35dba8b558258cb7a084638b566318c51376393233a535fd53229c674d82b44771f43ac08dcbcd5ffd65850d7eef8c21b38321d34ef6d1f692cc66c848037cc62d0ca2313ad436b19952df8c0a2ef91ea72b33fc3d62bde2318635397cb595851d393146d95934db891464a974bdf909dcaefd40c35105dd2a939ca02795c290d28346a709666e6566821413fa08d4e6121e"}, {0x5, 0x16, "2e4f2a94c913375e90a89dd2db5208223b2ec7fc3168a4bdcae1797b6d831a4ba9cc91e0e3d11c2ecff44e97dfe6b9b792985a0d2cb083ac59e209795e00930d9ba4c6a1109136acd095fdfe7457f6e27d0aa1bfef5d6d3e9043fbbc4750ca91cd1b4bb6b8c1af78ff401c760d2150994fbe3c5e66e5abbdf14dbfe57971fcddabff8c34a120778e67f38d62e76def1cadb1013d2aab71bc3f3dcdcaa085d1ddb85e52a2f2f5a7a85905155192930f0b"}]}}}}}}) syz_execute_func(&(0x7f00000003c0)="0f01f967660ffdd9c4e111f9dfc4e315025b710b640faef73e0f5bd1c00048c4e37914b4180700000069cf660f132e") syz_extract_tcp_res(&(0x7f0000000400), 0x2, 0x67) csource_test.go:124: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void __attribute__((noinline)) remove_dir(const char* dir) { DIR* dp = opendir(dir); if (dp == NULL) { if (errno == EACCES) { if (rmdir(dir)) exit(1); return; } exit(1); } struct dirent* ep = 0; while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } if (unlink(filename)) exit(1); } closedir(dp); if (rmdir(dir)) exit(1); } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { pthread_mutex_t mu; pthread_cond_t cv; int state; } event_t; static void event_init(event_t* ev) { if (pthread_mutex_init(&ev->mu, 0)) exit(1); if (pthread_cond_init(&ev->cv, 0)) exit(1); ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { pthread_mutex_lock(&ev->mu); if (ev->state) exit(1); ev->state = 1; pthread_mutex_unlock(&ev->mu); pthread_cond_broadcast(&ev->cv); } static void event_wait(event_t* ev) { pthread_mutex_lock(&ev->mu); while (!ev->state) pthread_cond_wait(&ev->cv, &ev->mu); pthread_mutex_unlock(&ev->mu); } static int event_isset(event_t* ev) { pthread_mutex_lock(&ev->mu); int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; pthread_mutex_lock(&ev->mu); for (;;) { if (ev->state) break; uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); now = current_time_ms(); if (now - start > timeout) break; } int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } #define BITMASK(bf_off,bf_len) (((1ull << (bf_len)) - 1) << (bf_off)) #define STORE_BY_BITMASK(type,htobe,addr,val,bf_off,bf_len) *(type*)(addr) = htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len)))) struct csum_inet { uint32_t acc; }; static void csum_inet_init(struct csum_inet* csum) { csum->acc = 0; } static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) { if (length == 0) return; size_t i = 0; for (; i < length - 1; i += 2) csum->acc += *(uint16_t*)&data[i]; if (length & 1) csum->acc += le16toh((uint16_t)data[length - 1]); while (csum->acc > 0xffff) csum->acc = (csum->acc & 0xffff) + (csum->acc >> 16); } static uint16_t csum_inet_digest(struct csum_inet* csum) { return ~csum->acc; } static void sandbox_common() { struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 8 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 0; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); } static void loop(); static int do_sandbox_none(void) { sandbox_common(); loop(); return 0; } static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 13; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); event_timedwait(&th->done, 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 = 0; for (; 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 < 5000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[2] = {0xffffffffffffffff, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: syscall(SYS_fstat, 0xffffff9c, 0x10000000); break; case 1: res = syscall(SYS_socket, 0x1c, 3, 0x3a); if (res != -1) r[0] = res; break; case 2: memcpy((void*)0x10000100, "bbr\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 32); *(uint32_t*)0x10000120 = 0xfff; syscall(SYS_setsockopt, (intptr_t)r[0], 6, 0x2000, 0x10000100, 0x24); break; case 3: *(uint64_t*)0x10000140 = 9; *(uint64_t*)0x10000180 = 0x3f; syscall(SYS_copy_file_range, 0xffffff9c, 0x10000140, (intptr_t)r[0], 0x10000180, 4ull, 0); break; case 4: *(uint32_t*)0x10000200 = 4; syscall(SYS_getsockopt, -1, 0x84, 0x1b, 0x100001c0, 0x10000200); break; case 5: syscall(SYS_getuid); break; case 6: *(uint32_t*)0x10000240 = 0; *(uint32_t*)0x10000244 = 5; *(uint32_t*)0x10000248 = 2; *(uint16_t*)0x1000024c = 0xdd; *(uint16_t*)0x1000024e = 9; *(uint16_t*)0x10000250 = 0x7fff; *(uint16_t*)0x10000252 = 5; *(uint32_t*)0x10000254 = 1; *(uint8_t*)0x10000258 = 0x1c; *(uint8_t*)0x10000259 = 0x1c; *(uint16_t*)0x1000025a = htobe16(0x4e23); *(uint32_t*)0x1000025c = 4; *(uint8_t*)0x10000260 = 0xfe; *(uint8_t*)0x10000261 = 0x80; *(uint8_t*)0x10000262 = 0; *(uint8_t*)0x10000263 = 0; *(uint8_t*)0x10000264 = 0; *(uint8_t*)0x10000265 = 0; *(uint8_t*)0x10000266 = 0; *(uint8_t*)0x10000267 = 0; *(uint8_t*)0x10000268 = 0; *(uint8_t*)0x10000269 = 0; *(uint8_t*)0x1000026a = 0; *(uint8_t*)0x1000026b = 0; *(uint8_t*)0x1000026c = 0; *(uint8_t*)0x1000026d = 0; *(uint8_t*)0x1000026e = 0; *(uint8_t*)0x1000026f = 0xaa; *(uint32_t*)0x10000270 = 0x10000; *(uint64_t*)0x10000274 = 0; *(uint64_t*)0x1000027c = 0; *(uint64_t*)0x10000284 = 0; *(uint64_t*)0x1000028c = 0; *(uint64_t*)0x10000294 = 0; *(uint64_t*)0x1000029c = 0; *(uint64_t*)0x100002a4 = 0; *(uint64_t*)0x100002ac = 0; *(uint64_t*)0x100002b4 = 0; *(uint64_t*)0x100002bc = 0; *(uint64_t*)0x100002c4 = 0; *(uint64_t*)0x100002cc = 0; *(uint32_t*)0x100002d4 = 0; *(uint32_t*)0x100002d8 = 9; *(uint32_t*)0x100002dc = 0xfffffff9; *(uint32_t*)0x100002e0 = 0xdf10; *(uint32_t*)0x100002e4 = 0x40; *(uint32_t*)0x100002e8 = 8; *(uint32_t*)0x10000300 = 0xac; res = syscall(SYS_getsockopt, -1, 0x84, 0x100, 0x10000240, 0x10000300); if (res != -1) r[1] = *(uint32_t*)0x100002d4; break; case 7: *(uint32_t*)0x10000340 = r[1]; *(uint16_t*)0x10000344 = 9; *(uint16_t*)0x10000346 = 3; *(uint64_t*)0x10000348 = 1; *(uint64_t*)0x10000350 = 1; *(uint32_t*)0x10000380 = 0x18; syscall(SYS_getsockopt, (intptr_t)r[0], 0x84, 0x108, 0x10000340, 0x10000380); break; case 8: memcpy((void*)0x100003c0, "\x55\x8e\x86\x6e\xc7\xc5", 6); *(uint8_t*)0x100003c6 = -1; *(uint8_t*)0x100003c7 = -1; *(uint8_t*)0x100003c8 = -1; *(uint8_t*)0x100003c9 = -1; *(uint8_t*)0x100003ca = -1; *(uint8_t*)0x100003cb = -1; *(uint16_t*)0x100003cc = htobe16(0x88a8); STORE_BY_BITMASK(uint16_t, , 0x100003ce, 0, 0, 3); STORE_BY_BITMASK(uint16_t, , 0x100003ce, 0, 3, 1); STORE_BY_BITMASK(uint16_t, , 0x100003ce, 1, 4, 12); *(uint16_t*)0x100003d0 = htobe16(0x8100); STORE_BY_BITMASK(uint16_t, , 0x100003d2, 0, 0, 3); STORE_BY_BITMASK(uint16_t, , 0x100003d2, 0, 3, 1); STORE_BY_BITMASK(uint16_t, , 0x100003d2, 4, 4, 12); *(uint16_t*)0x100003d4 = htobe16(0x800); STORE_BY_BITMASK(uint8_t, , 0x100003d6, 0xc, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x100003d6, 4, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x100003d7, 0, 0, 2); STORE_BY_BITMASK(uint8_t, , 0x100003d7, 8, 2, 6); *(uint16_t*)0x100003d8 = htobe16(0xcd); *(uint16_t*)0x100003da = htobe16(0x68); *(uint16_t*)0x100003dc = htobe16(1); *(uint8_t*)0x100003de = 2; *(uint8_t*)0x100003df = 0x1a; *(uint16_t*)0x100003e0 = htobe16(0); *(uint32_t*)0x100003e2 = htobe32(0xe0000002); *(uint32_t*)0x100003e6 = htobe32(0); *(uint8_t*)0x100003ea = 0x94; *(uint8_t*)0x100003eb = 6; *(uint32_t*)0x100003ec = htobe32(0x10000); *(uint8_t*)0x100003f0 = 0x83; *(uint8_t*)0x100003f1 = 0xb; *(uint8_t*)0x100003f2 = 0; *(uint32_t*)0x100003f3 = htobe32(0x7f000001); *(uint32_t*)0x100003f7 = htobe32(0); *(uint8_t*)0x100003fb = 0x88; *(uint8_t*)0x100003fc = 9; memcpy((void*)0x100003fd, "\x68\xb0\x2e\x9a\xa5\x5a\x8b", 7); *(uint16_t*)0x10000406 = htobe16(0x4e22); *(uint16_t*)0x10000408 = htobe16(0x4e23); *(uint16_t*)0x1000040a = htobe16(8); *(uint16_t*)0x1000040c = htobe16(0); memcpy((void*)0x1000040e, "\x17\x27\x31\x3c\x0d\x12\x1a\xaf\x94\x2a\xba\x95\xb4\xaa\x8f\x3f\xab\x4a\x3f\x42\x3c\x50\xb9\xf3\x20\x7d\xe0\x73\xcd\x93\xe9\xd4\xab\xf4\xdd\x1b\xde\xa8\xb9\xe0\x4e\xc8\x3b\x09\x77\xc7\x09\x4e\xca\x81\x6b\x50\xfc\x61\x3b\x69\x00\x64\x2e\xd7\xc7\x98\x67\xdf\xbf\xa2\xee\x7e\x0d\xa3\xbc\x0e\x15\x22\x5c\x1f\x9e\x12\x3c\x39\x83\x36\x0a\x7a\x32\x7e\x25\xef\x28\x6a\x9c\x45\xd8\x13\x2c\x1c\x22\x01\xec\xdb\x70\xba\x3a\x32\x99\xd6\x68\x03\x14\x42\x83\x60\xae\x3e\x57\xdc\xf3\xe1\x51\x38\x71\x0e\x15\x1b\xad\x45\x03\xa7\x8f\x71\xaa\xe9\xac\xcd\x79\x65\x86\xc9\xb1\xfc\xfa\x62\x0a\x25\x9c\xc6\x10\x14\xef", 149); struct csum_inet csum_1; csum_inet_init(&csum_1); csum_inet_update(&csum_1, (const uint8_t*)0x100003e2, 4); csum_inet_update(&csum_1, (const uint8_t*)0x100003e6, 4); uint16_t csum_1_chunk_2 = 0x1100; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_2, 2); uint16_t csum_1_chunk_3 = 0x800; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_3, 2); csum_inet_update(&csum_1, (const uint8_t*)0x10000406, 8); *(uint16_t*)0x1000040c = csum_inet_digest(&csum_1); struct csum_inet csum_2; csum_inet_init(&csum_2); csum_inet_update(&csum_2, (const uint8_t*)0x100003d6, 48); *(uint16_t*)0x100003e0 = csum_inet_digest(&csum_2); break; case 9: *(uint32_t*)0x100004c0 = 0; syscall(SYS_setgroups, 1, 0x100004c0); break; case 10: *(uint8_t*)0x10000000 = 0; *(uint8_t*)0x10000001 = 0; *(uint8_t*)0x10000002 = 0; *(uint8_t*)0x10000003 = 0; *(uint8_t*)0x10000004 = 0; *(uint8_t*)0x10000005 = 0; *(uint8_t*)0x10000006 = 0; *(uint8_t*)0x10000007 = 0; *(uint8_t*)0x10000008 = 0; *(uint8_t*)0x10000009 = 0; *(uint8_t*)0x1000000a = 0; *(uint8_t*)0x1000000b = 0; *(uint16_t*)0x1000000c = htobe16(0x86dd); STORE_BY_BITMASK(uint8_t, , 0x1000000e, 3, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x1000000e, 6, 4, 4); memcpy((void*)0x1000000f, "\x08\x21\x11", 3); *(uint16_t*)0x10000012 = htobe16(0x389); *(uint8_t*)0x10000014 = 0x6c; *(uint8_t*)0x10000015 = 0; *(uint8_t*)0x10000016 = 0; *(uint8_t*)0x10000017 = 0; *(uint8_t*)0x10000018 = 0; *(uint8_t*)0x10000019 = 0; *(uint8_t*)0x1000001a = 0; *(uint8_t*)0x1000001b = 0; *(uint8_t*)0x1000001c = 0; *(uint8_t*)0x1000001d = 0; *(uint8_t*)0x1000001e = 0; *(uint8_t*)0x1000001f = 0; *(uint8_t*)0x10000020 = -1; *(uint8_t*)0x10000021 = -1; *(uint32_t*)0x10000022 = htobe32(0xe0000002); *(uint64_t*)0x10000026 = htobe64(0); *(uint64_t*)0x1000002e = htobe64(1); *(uint8_t*)0x10000036 = 0x5e; *(uint8_t*)0x10000037 = 0x36; *(uint8_t*)0x10000038 = 0; *(uint8_t*)0x10000039 = 0; *(uint8_t*)0x1000003a = 0; *(uint8_t*)0x1000003b = 0; *(uint8_t*)0x1000003c = 0; *(uint8_t*)0x1000003d = 0; *(uint8_t*)0x1000003e = 0x79; *(uint8_t*)0x1000003f = 0x1a; memcpy((void*)0x10000040, "\x32\x25\x39\xdc\xe6\xc8\x60\xea\xe2\xe7\x17\xfe\x5d\x91\x9d\x50\xf1\x2d\xa8\xc2\x79\x0d\x7b\x77\x8b\xd5", 26); *(uint8_t*)0x1000005a = 5; *(uint8_t*)0x1000005b = 2; *(uint16_t*)0x1000005c = htobe16(7); *(uint8_t*)0x1000005e = 0; *(uint8_t*)0x1000005f = 1; *(uint8_t*)0x10000060 = 0; *(uint8_t*)0x10000061 = 1; *(uint8_t*)0x10000062 = 2; *(uint8_t*)0x10000063 = 0; *(uint8_t*)0x10000064 = 0; *(uint8_t*)0x10000065 = 8; *(uint8_t*)0x10000066 = 0xfa; memcpy((void*)0x10000067, "\xe2\xb0\xb2\x1d\x6f\x96\xa0\x12\xb7\x94\x79\x1a\x56\x4b\x79\x1a\x9b\x08\x76\xcc\x87\xa8\xe8\xdf\xcd\x42\x46\xac\xbd\x2e\x57\x62\x29\x84\x3f\x20\x6d\x42\xee\xc2\xb9\x9d\x4b\x6d\xb9\x3c\xa1\x5f\x41\xcc\x25\xad\xa1\x9e\x33\x8a\x97\x80\xc9\x60\x42\x10\x12\x95\x03\x07\xe6\x5d\xda\x08\x89\x3e\xb2\xf5\x64\x02\xae\xfb\xa1\x48\xc2\xf9\x55\x8d\x7a\x04\xf9\xe1\x35\x24\x7d\x1a\x8d\x04\x24\x62\x50\x45\x2d\x0f\x26\x3c\xf9\x0a\xa9\x8d\x56\x9e\xaa\x16\x83\x4e\xa0\x45\xe6\xda\xbc\xe8\x90\x6a\xc9\xaf\x25\xef\xb2\xe5\xbc\xc2\x4b\x0d\xea\xbd\x73\x19\xca\x60\x6a\x2e\x28\xb6\x58\xae\xa5\x94\x7a\x43\x07\x5c\x1f\x2e\xa5\x0c\xca\x8d\xd6\x3e\x0a\x87\x6b\x47\xf6\x02\x10\xb4\xe8\x24\x19\x41\xfa\x4c\xae\xf6\xcd\x78\x74\x10\xb6\x90\x0e\xc1\x17\x31\x4f\x6e\x71\xf7\x87\x4a\xd6\x74\x17\xe3\x3c\xc3\x19\xd6\x51\xf3\x5f\x08\xd1\x15\xc9\x13\x75\xa2\xdf\x16\x29\xb5\x3a\x49\xe6\xb0\x5e\xdf\xa0\xc3\x5e\xee\x07\xf8\xcb\xd9\x8f\xdf\xf7\x05\x0f\x59\x61\xec\x1c\xe4\x76\xb8\x1c\x38\x52\x91\x2f\xbe\x45\x19\x3a\xa0\x55\xa5\x7f\xb3", 250); *(uint8_t*)0x10000161 = 4; *(uint8_t*)0x10000162 = 1; *(uint8_t*)0x10000163 = 0xa1; *(uint8_t*)0x10000164 = 1; *(uint8_t*)0x10000165 = 3; *(uint8_t*)0x10000166 = 0; *(uint8_t*)0x10000167 = 0; *(uint8_t*)0x10000168 = 0; *(uint8_t*)0x10000169 = 0; *(uint8_t*)0x1000016a = 1; *(uint8_t*)0x1000016b = 0; *(uint8_t*)0x1000016c = 4; *(uint8_t*)0x1000016d = 0x7e; memcpy((void*)0x1000016e, "\x64\x22\xa7\xd8\x78\x76\x68\x9c\xee\xf9\x9a\x86\x21\xb2\xff\xc6\x4a\x04\x7f\x65\x2c\x39\xeb\x4b\x53\xe8\x45\x12\xa5\x58\x53\x99\x3f\xeb\x36\xf7\x73\x64\xf4\x7b\x75\x9b\xa0\x40\x02\xb9\xb1\x94\x17\x5c\x2f\x22\x37\xbc\xb1\x14\x86\xa5\xb8\xf1\xf2\x82\x04\x97\x38\x1a\x8c\xaf\xa0\x73\x9a\xe6\x23\x82\xe8\x3c\x7a\x2e\xd1\xbf\x16\xab\xd0\xe2\x67\x54\xe1\x2c\x85\xdc\x31\x76\x4c\x4c\xae\x57\x9a\x16\x3f\x11\xe5\x70\xe8\xa4\xda\xe7\x89\x4a\x55\xd7\x96\xe1\xe7\x66\x3c\x41\xc1\xc3\xc7\x4e\x89\x7b\x7a\x3f\x74\xa3", 126); *(uint8_t*)0x100001ec = 4; *(uint8_t*)0x100001ed = 1; *(uint8_t*)0x100001ee = 4; *(uint8_t*)0x100001f6 = 0x88; *(uint8_t*)0x100001f7 = 0; *(uint16_t*)0x100001f8 = htobe16(0); *(uint8_t*)0x100001fa = 0x33; *(uint8_t*)0x100001fb = 0; *(uint8_t*)0x100001fc = 0; *(uint8_t*)0x100001fd = 0; *(uint64_t*)0x100001fe = htobe64(0); *(uint64_t*)0x10000206 = htobe64(1); *(uint8_t*)0x1000020e = 0x18; *(uint8_t*)0x1000020f = 0x1f; memcpy((void*)0x10000210, "\x7a\xa7\x36\x34\xe6\xc6\x0c\xeb\x89\x30\xc5\xbc\x17\x2a\x27\x55\x0b\x25\x6d\xd3\x86\x37\x55\x7a\x7d\x83\xb9\x70\xff\xf6\x99\xff\xde\xfb\xaa\x07\xf0\x44\x7c\x8b\x93\xf9\x73\x25\x46\x2e\x51\x16\xd6\x99\x81\xda\x65\x36\xe2\x68\x7f\x53\x21\xf0\x69\x84\x30\x4f\x9a\xc3\x4f\x65\x94\xf5\x62\x86\x2f\x34\x08\xd7\xb4\xc5\x44\x3f\x15\xa8\xa8\x02\x09\xbb\x6b\x12\xb9\xaa\x87\xcc\x0c\xc0\x7c\x13\x8e\x81\x1e\x6e\xcd\xed\x6f\x5e\x61\xe7\x7c\x35\xdb\xa8\xb5\x58\x25\x8c\xb7\xa0\x84\x63\x8b\x56\x63\x18\xc5\x13\x76\x39\x32\x33\xa5\x35\xfd\x53\x22\x9c\x67\x4d\x82\xb4\x47\x71\xf4\x3a\xc0\x8d\xcb\xcd\x5f\xfd\x65\x85\x0d\x7e\xef\x8c\x21\xb3\x83\x21\xd3\x4e\xf6\xd1\xf6\x92\xcc\x66\xc8\x48\x03\x7c\xc6\x2d\x0c\xa2\x31\x3a\xd4\x36\xb1\x99\x52\xdf\x8c\x0a\x2e\xf9\x1e\xa7\x2b\x33\xfc\x3d\x62\xbd\xe2\x31\x86\x35\x39\x7c\xb5\x95\x85\x1d\x39\x31\x46\xd9\x59\x34\xdb\x89\x14\x64\xa9\x74\xbd\xf9\x09\xdc\xae\xfd\x40\xc3\x51\x05\xdd\x2a\x93\x9c\xa0\x27\x95\xc2\x90\xd2\x83\x46\xa7\x09\x66\x6e\x65\x66\x82\x14\x13\xfa\x08\xd4\xe6\x12\x1e", 253); *(uint8_t*)0x1000030d = 5; *(uint8_t*)0x1000030e = 0x16; memcpy((void*)0x1000030f, "\x2e\x4f\x2a\x94\xc9\x13\x37\x5e\x90\xa8\x9d\xd2\xdb\x52\x08\x22\x3b\x2e\xc7\xfc\x31\x68\xa4\xbd\xca\xe1\x79\x7b\x6d\x83\x1a\x4b\xa9\xcc\x91\xe0\xe3\xd1\x1c\x2e\xcf\xf4\x4e\x97\xdf\xe6\xb9\xb7\x92\x98\x5a\x0d\x2c\xb0\x83\xac\x59\xe2\x09\x79\x5e\x00\x93\x0d\x9b\xa4\xc6\xa1\x10\x91\x36\xac\xd0\x95\xfd\xfe\x74\x57\xf6\xe2\x7d\x0a\xa1\xbf\xef\x5d\x6d\x3e\x90\x43\xfb\xbc\x47\x50\xca\x91\xcd\x1b\x4b\xb6\xb8\xc1\xaf\x78\xff\x40\x1c\x76\x0d\x21\x50\x99\x4f\xbe\x3c\x5e\x66\xe5\xab\xbd\xf1\x4d\xbf\xe5\x79\x71\xfc\xdd\xab\xff\x8c\x34\xa1\x20\x77\x8e\x67\xf3\x8d\x62\xe7\x6d\xef\x1c\xad\xb1\x01\x3d\x2a\xab\x71\xbc\x3f\x3d\xcd\xca\xa0\x85\xd1\xdd\xb8\x5e\x52\xa2\xf2\xf5\xa7\xa8\x59\x05\x15\x51\x92\x93\x0f\x0b", 176); struct csum_inet csum_3; csum_inet_init(&csum_3); csum_inet_update(&csum_3, (const uint8_t*)0x10000016, 16); csum_inet_update(&csum_3, (const uint8_t*)0x10000026, 16); uint32_t csum_3_chunk_2 = 0xc9010000; csum_inet_update(&csum_3, (const uint8_t*)&csum_3_chunk_2, 4); uint32_t csum_3_chunk_3 = 0x3a000000; csum_inet_update(&csum_3, (const uint8_t*)&csum_3_chunk_3, 4); csum_inet_update(&csum_3, (const uint8_t*)0x100001f6, 457); *(uint16_t*)0x100001f8 = csum_inet_digest(&csum_3); break; case 11: memcpy((void*)0x100003c0, "\x0f\x01\xf9\x67\x66\x0f\xfd\xd9\xc4\xe1\x11\xf9\xdf\xc4\xe3\x15\x02\x5b\x71\x0b\x64\x0f\xae\xf7\x3e\x0f\x5b\xd1\xc0\x00\x48\xc4\xe3\x79\x14\xb4\x18\x07\x00\x00\x00\x69\xcf\x66\x0f\x13\x2e", 47); syz_execute_func(0x100003c0); break; case 12: break; } } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); use_temporary_dir(); do_sandbox_none(); return 0; } :348:11: error: use of undeclared identifier 'SYS_copy_file_range' syscall(SYS_copy_file_range, 0xffffff9c, 0x10000140, (intptr_t)r[0], 0x10000180, 4ull, 0); ^ 1 error generated. compiler invocation: clang [-o /tmp/syz-executor487363047 -DGOOS_freebsd=1 -DGOARCH_386=1 -DHOSTGOOS_freebsd=1 -x c - -m32 -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -static -lc++ -Wno-overflow] --- FAIL: TestGenerate/freebsd/386/11 (2.43s) csource_test.go:123: opts: {Threaded:true Collide:false Repeat:true RepeatTimes:0 Procs:0 Sandbox:none Fault:false FaultCall:0 FaultNth:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false VhciInjection:false Wifi:false Sysctl:false UseTmpDir:true HandleSegv:true Repro:false Trace:false} program: fstat(0xffffffffffffff9c, &(0x7f0000000000)) r0 = socket$inet6_icmp_raw(0x1c, 0x3, 0x3a) setsockopt$inet6_tcp_TCP_FUNCTION_BLK(r0, 0x6, 0x2000, &(0x7f0000000100)={'bbr\x00', 0xfff}, 0x24) copy_file_range(0xffffffffffffff9c, &(0x7f0000000140)=0x9, r0, &(0x7f0000000180)=0x3f, 0x4, 0x0) getsockopt$inet_sctp_SCTP_EXPLICIT_EOR(0xffffffffffffffff, 0x84, 0x1b, &(0x7f00000001c0), &(0x7f0000000200)=0x4) getuid() getsockopt$inet_sctp_SCTP_STATUS(0xffffffffffffffff, 0x84, 0x100, &(0x7f0000000240)={0x0, 0x5, 0x2, 0xdd, 0x9, 0x7fff, 0x5, 0x1, {@in6={{0x1c, 0x1c, 0x3, 0x4, @local={0xfe, 0x80, [], 0x0}, 0x10000}}, 0x0, 0x9, 0xfffffff9, 0xdf10, 0x40, 0x8}}, &(0x7f0000000300)=0xac) getsockopt$inet6_sctp_SCTP_PR_ASSOC_STATUS(r0, 0x84, 0x108, &(0x7f0000000340)={r1, 0x9, 0x3, 0x1, 0x1}, &(0x7f0000000380)=0x18) syz_emit_ethernet(0xe3, &(0x7f00000003c0)={@random="558e866ec7c5", @broadcast, [{[{0x88a8, 0x0, 0x0, 0x1}], {0x8100, 0x0, 0x0, 0x4}}], {@ipv4={0x800, {{0xc, 0x4, 0x0, 0x8, 0xcd, 0x68, 0x1, 0x2, 0x1a, 0x0, @multicast2, @rand_addr, {[@ra={0x94, 0x6, 0x10000}, @lsrr={0x83, 0xb, 0x0, [@loopback, @empty]}, @generic={0x88, 0x9, "68b02e9aa55a8b"}]}}, @udp={{0x2, 0x3, 0x8}, {"1727313c0d121aaf942aba95b4aa8f3fab4a3f423c50b9f3207de073cd93e9d4abf4dd1bdea8b9e04ec83b0977c7094eca816b50fc613b6900642ed7c79867dfbfa2ee7e0da3bc0e15225c1f9e123c3983360a7a327e25ef286a9c45d8132c1c2201ecdb70ba3a3299d6680314428360ae3e57dcf3e15138710e151bad4503a78f71aae9accd796586c9b1fcfa620a259cc61014ef"}}}}}}) setgroups(0x1, &(0x7f00000004c0)=[0x0]) syz_emit_ethernet(0x3bf, &(0x7f0000000000)={@empty, @empty, [], {@ipv6={0x86dd, {0x3, 0x6, "082111", 0x389, 0x6c, 0x0, @ipv4={[], [], @multicast2}, @loopback, {[@dstopts={0x5e, 0x36, [], [@generic={0x79, 0x1a, "322539dce6c860eae2e717fe5d919d50f12da8c2790d7b778bd5"}, @ra={0x5, 0x2, 0x7}, @pad1, @padn={0x1, 0x2, [0x0, 0x0]}, @generic={0x8, 0xfa, "e2b0b21d6f96a012b794791a564b791a9b0876cc87a8e8dfcd4246acbd2e576229843f206d42eec2b99d4b6db93ca15f41cc25ada19e338a9780c960421012950307e65dda08893eb2f56402aefba148c2f9558d7a04f9e135247d1a8d04246250452d0f263cf90aa98d569eaa16834ea045e6dabce8906ac9af25efb2e5bcc24b0deabd7319ca606a2e28b658aea5947a43075c1f2ea50cca8dd63e0a876b47f60210b4e8241941fa4caef6cd787410b6900ec117314f6e71f7874ad67417e33cc319d651f35f08d115c91375a2df1629b53a49e6b05edfa0c35eee07f8cbd98fdff7050f5961ec1ce476b81c3852912fbe45193aa055a57fb3"}, @enc_lim={0x4, 0x1, 0xa1}, @padn={0x1, 0x3, [0x0, 0x0, 0x0]}, @pad1, @generic={0x4, 0x7e, "6422a7d87876689ceef99a8621b2ffc64a047f652c39eb4b53e84512a55853993feb36f77364f47b759ba04002b9b194175c2f2237bcb11486a5b8f1f2820497381a8cafa0739ae62382e83c7a2ed1bf16abd0e26754e12c85dc31764c4cae579a163f11e570e8a4dae7894a55d796e1e7663c41c1c3c74e897b7a3f74a3"}, @enc_lim={0x4, 0x1, 0x4}]}], @icmpv6=@ndisc_na={0x88, 0x0, 0x0, 0x33, [], @loopback, [{0x18, 0x1f, "7aa73634e6c60ceb8930c5bc172a27550b256dd38637557a7d83b970fff699ffdefbaa07f0447c8b93f97325462e5116d69981da6536e2687f5321f06984304f9ac34f6594f562862f3408d7b4c5443f15a8a80209bb6b12b9aa87cc0cc07c138e811e6ecded6f5e61e77c35dba8b558258cb7a084638b566318c51376393233a535fd53229c674d82b44771f43ac08dcbcd5ffd65850d7eef8c21b38321d34ef6d1f692cc66c848037cc62d0ca2313ad436b19952df8c0a2ef91ea72b33fc3d62bde2318635397cb595851d393146d95934db891464a974bdf909dcaefd40c35105dd2a939ca02795c290d28346a709666e6566821413fa08d4e6121e"}, {0x5, 0x16, "2e4f2a94c913375e90a89dd2db5208223b2ec7fc3168a4bdcae1797b6d831a4ba9cc91e0e3d11c2ecff44e97dfe6b9b792985a0d2cb083ac59e209795e00930d9ba4c6a1109136acd095fdfe7457f6e27d0aa1bfef5d6d3e9043fbbc4750ca91cd1b4bb6b8c1af78ff401c760d2150994fbe3c5e66e5abbdf14dbfe57971fcddabff8c34a120778e67f38d62e76def1cadb1013d2aab71bc3f3dcdcaa085d1ddb85e52a2f2f5a7a85905155192930f0b"}]}}}}}}) syz_execute_func(&(0x7f00000003c0)="0f01f967660ffdd9c4e111f9dfc4e315025b710b640faef73e0f5bd1c00048c4e37914b4180700000069cf660f132e") syz_extract_tcp_res(&(0x7f0000000400), 0x2, 0x67) csource_test.go:124: 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; int skip = __atomic_load_n(&skip_segv, __ATOMIC_RELAXED) != 0; int valid = addr < prog_start || addr > prog_end; if (sig == SIGBUS) { valid = 1; } if (skip && valid) { _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(...) ({ int ok = 1; __atomic_fetch_add(&skip_segv, 1, __ATOMIC_SEQ_CST); if (_setjmp(segv_env) == 0) { __VA_ARGS__; } else ok = 0; __atomic_fetch_sub(&skip_segv, 1, __ATOMIC_SEQ_CST); ok; }) static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void __attribute__((noinline)) remove_dir(const char* dir) { DIR* dp = opendir(dir); if (dp == NULL) { if (errno == EACCES) { if (rmdir(dir)) exit(1); return; } exit(1); } struct dirent* ep = 0; while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } if (unlink(filename)) exit(1); } closedir(dp); if (rmdir(dir)) exit(1); } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { pthread_mutex_t mu; pthread_cond_t cv; int state; } event_t; static void event_init(event_t* ev) { if (pthread_mutex_init(&ev->mu, 0)) exit(1); if (pthread_cond_init(&ev->cv, 0)) exit(1); ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { pthread_mutex_lock(&ev->mu); if (ev->state) exit(1); ev->state = 1; pthread_mutex_unlock(&ev->mu); pthread_cond_broadcast(&ev->cv); } static void event_wait(event_t* ev) { pthread_mutex_lock(&ev->mu); while (!ev->state) pthread_cond_wait(&ev->cv, &ev->mu); pthread_mutex_unlock(&ev->mu); } static int event_isset(event_t* ev) { pthread_mutex_lock(&ev->mu); int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; pthread_mutex_lock(&ev->mu); for (;;) { if (ev->state) break; uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); now = current_time_ms(); if (now - start > timeout) break; } int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } #define BITMASK(bf_off,bf_len) (((1ull << (bf_len)) - 1) << (bf_off)) #define STORE_BY_BITMASK(type,htobe,addr,val,bf_off,bf_len) *(type*)(addr) = htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len)))) struct csum_inet { uint32_t acc; }; static void csum_inet_init(struct csum_inet* csum) { csum->acc = 0; } static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) { if (length == 0) return; size_t i = 0; for (; i < length - 1; i += 2) csum->acc += *(uint16_t*)&data[i]; if (length & 1) csum->acc += le16toh((uint16_t)data[length - 1]); while (csum->acc > 0xffff) csum->acc = (csum->acc & 0xffff) + (csum->acc >> 16); } static uint16_t csum_inet_digest(struct csum_inet* csum) { return ~csum->acc; } static void sandbox_common() { struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 8 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 0; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); } static void loop(); static int do_sandbox_none(void) { sandbox_common(); loop(); return 0; } static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 13; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); event_timedwait(&th->done, 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 = 0; for (;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[2] = {0xffffffffffffffff, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: syscall(SYS_fstat, 0xffffff9c, 0x10000000); break; case 1: res = syscall(SYS_socket, 0x1c, 3, 0x3a); if (res != -1) r[0] = res; break; case 2: NONFAILING(memcpy((void*)0x10000100, "bbr\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 32)); NONFAILING(*(uint32_t*)0x10000120 = 0xfff); syscall(SYS_setsockopt, (intptr_t)r[0], 6, 0x2000, 0x10000100, 0x24); break; case 3: NONFAILING(*(uint64_t*)0x10000140 = 9); NONFAILING(*(uint64_t*)0x10000180 = 0x3f); syscall(SYS_copy_file_range, 0xffffff9c, 0x10000140, (intptr_t)r[0], 0x10000180, 4ull, 0); break; case 4: NONFAILING(*(uint32_t*)0x10000200 = 4); syscall(SYS_getsockopt, -1, 0x84, 0x1b, 0x100001c0, 0x10000200); break; case 5: syscall(SYS_getuid); break; case 6: NONFAILING(*(uint32_t*)0x10000240 = 0); NONFAILING(*(uint32_t*)0x10000244 = 5); NONFAILING(*(uint32_t*)0x10000248 = 2); NONFAILING(*(uint16_t*)0x1000024c = 0xdd); NONFAILING(*(uint16_t*)0x1000024e = 9); NONFAILING(*(uint16_t*)0x10000250 = 0x7fff); NONFAILING(*(uint16_t*)0x10000252 = 5); NONFAILING(*(uint32_t*)0x10000254 = 1); NONFAILING(*(uint8_t*)0x10000258 = 0x1c); NONFAILING(*(uint8_t*)0x10000259 = 0x1c); NONFAILING(*(uint16_t*)0x1000025a = htobe16(0x4e23)); NONFAILING(*(uint32_t*)0x1000025c = 4); NONFAILING(*(uint8_t*)0x10000260 = 0xfe); NONFAILING(*(uint8_t*)0x10000261 = 0x80); NONFAILING(*(uint8_t*)0x10000262 = 0); NONFAILING(*(uint8_t*)0x10000263 = 0); NONFAILING(*(uint8_t*)0x10000264 = 0); NONFAILING(*(uint8_t*)0x10000265 = 0); NONFAILING(*(uint8_t*)0x10000266 = 0); NONFAILING(*(uint8_t*)0x10000267 = 0); NONFAILING(*(uint8_t*)0x10000268 = 0); NONFAILING(*(uint8_t*)0x10000269 = 0); NONFAILING(*(uint8_t*)0x1000026a = 0); NONFAILING(*(uint8_t*)0x1000026b = 0); NONFAILING(*(uint8_t*)0x1000026c = 0); NONFAILING(*(uint8_t*)0x1000026d = 0); NONFAILING(*(uint8_t*)0x1000026e = 0); NONFAILING(*(uint8_t*)0x1000026f = 0xaa); NONFAILING(*(uint32_t*)0x10000270 = 0x10000); NONFAILING(*(uint64_t*)0x10000274 = 0); NONFAILING(*(uint64_t*)0x1000027c = 0); NONFAILING(*(uint64_t*)0x10000284 = 0); NONFAILING(*(uint64_t*)0x1000028c = 0); NONFAILING(*(uint64_t*)0x10000294 = 0); NONFAILING(*(uint64_t*)0x1000029c = 0); NONFAILING(*(uint64_t*)0x100002a4 = 0); NONFAILING(*(uint64_t*)0x100002ac = 0); NONFAILING(*(uint64_t*)0x100002b4 = 0); NONFAILING(*(uint64_t*)0x100002bc = 0); NONFAILING(*(uint64_t*)0x100002c4 = 0); NONFAILING(*(uint64_t*)0x100002cc = 0); NONFAILING(*(uint32_t*)0x100002d4 = 0); NONFAILING(*(uint32_t*)0x100002d8 = 9); NONFAILING(*(uint32_t*)0x100002dc = 0xfffffff9); NONFAILING(*(uint32_t*)0x100002e0 = 0xdf10); NONFAILING(*(uint32_t*)0x100002e4 = 0x40); NONFAILING(*(uint32_t*)0x100002e8 = 8); NONFAILING(*(uint32_t*)0x10000300 = 0xac); res = syscall(SYS_getsockopt, -1, 0x84, 0x100, 0x10000240, 0x10000300); if (res != -1) NONFAILING(r[1] = *(uint32_t*)0x100002d4); break; case 7: NONFAILING(*(uint32_t*)0x10000340 = r[1]); NONFAILING(*(uint16_t*)0x10000344 = 9); NONFAILING(*(uint16_t*)0x10000346 = 3); NONFAILING(*(uint64_t*)0x10000348 = 1); NONFAILING(*(uint64_t*)0x10000350 = 1); NONFAILING(*(uint32_t*)0x10000380 = 0x18); syscall(SYS_getsockopt, (intptr_t)r[0], 0x84, 0x108, 0x10000340, 0x10000380); break; case 8: NONFAILING(memcpy((void*)0x100003c0, "\x55\x8e\x86\x6e\xc7\xc5", 6)); NONFAILING(*(uint8_t*)0x100003c6 = -1); NONFAILING(*(uint8_t*)0x100003c7 = -1); NONFAILING(*(uint8_t*)0x100003c8 = -1); NONFAILING(*(uint8_t*)0x100003c9 = -1); NONFAILING(*(uint8_t*)0x100003ca = -1); NONFAILING(*(uint8_t*)0x100003cb = -1); NONFAILING(*(uint16_t*)0x100003cc = htobe16(0x88a8)); NONFAILING(STORE_BY_BITMASK(uint16_t, , 0x100003ce, 0, 0, 3)); NONFAILING(STORE_BY_BITMASK(uint16_t, , 0x100003ce, 0, 3, 1)); NONFAILING(STORE_BY_BITMASK(uint16_t, , 0x100003ce, 1, 4, 12)); NONFAILING(*(uint16_t*)0x100003d0 = htobe16(0x8100)); NONFAILING(STORE_BY_BITMASK(uint16_t, , 0x100003d2, 0, 0, 3)); NONFAILING(STORE_BY_BITMASK(uint16_t, , 0x100003d2, 0, 3, 1)); NONFAILING(STORE_BY_BITMASK(uint16_t, , 0x100003d2, 4, 4, 12)); NONFAILING(*(uint16_t*)0x100003d4 = htobe16(0x800)); NONFAILING(STORE_BY_BITMASK(uint8_t, , 0x100003d6, 0xc, 0, 4)); NONFAILING(STORE_BY_BITMASK(uint8_t, , 0x100003d6, 4, 4, 4)); NONFAILING(STORE_BY_BITMASK(uint8_t, , 0x100003d7, 0, 0, 2)); NONFAILING(STORE_BY_BITMASK(uint8_t, , 0x100003d7, 8, 2, 6)); NONFAILING(*(uint16_t*)0x100003d8 = htobe16(0xcd)); NONFAILING(*(uint16_t*)0x100003da = htobe16(0x68)); NONFAILING(*(uint16_t*)0x100003dc = htobe16(1)); NONFAILING(*(uint8_t*)0x100003de = 2); NONFAILING(*(uint8_t*)0x100003df = 0x1a); NONFAILING(*(uint16_t*)0x100003e0 = htobe16(0)); NONFAILING(*(uint32_t*)0x100003e2 = htobe32(0xe0000002)); NONFAILING(*(uint32_t*)0x100003e6 = htobe32(0)); NONFAILING(*(uint8_t*)0x100003ea = 0x94); NONFAILING(*(uint8_t*)0x100003eb = 6); NONFAILING(*(uint32_t*)0x100003ec = htobe32(0x10000)); NONFAILING(*(uint8_t*)0x100003f0 = 0x83); NONFAILING(*(uint8_t*)0x100003f1 = 0xb); NONFAILING(*(uint8_t*)0x100003f2 = 0); NONFAILING(*(uint32_t*)0x100003f3 = htobe32(0x7f000001)); NONFAILING(*(uint32_t*)0x100003f7 = htobe32(0)); NONFAILING(*(uint8_t*)0x100003fb = 0x88); NONFAILING(*(uint8_t*)0x100003fc = 9); NONFAILING(memcpy((void*)0x100003fd, "\x68\xb0\x2e\x9a\xa5\x5a\x8b", 7)); NONFAILING(*(uint16_t*)0x10000406 = htobe16(0x4e22)); NONFAILING(*(uint16_t*)0x10000408 = htobe16(0x4e23)); NONFAILING(*(uint16_t*)0x1000040a = htobe16(8)); NONFAILING(*(uint16_t*)0x1000040c = htobe16(0)); NONFAILING(memcpy((void*)0x1000040e, "\x17\x27\x31\x3c\x0d\x12\x1a\xaf\x94\x2a\xba\x95\xb4\xaa\x8f\x3f\xab\x4a\x3f\x42\x3c\x50\xb9\xf3\x20\x7d\xe0\x73\xcd\x93\xe9\xd4\xab\xf4\xdd\x1b\xde\xa8\xb9\xe0\x4e\xc8\x3b\x09\x77\xc7\x09\x4e\xca\x81\x6b\x50\xfc\x61\x3b\x69\x00\x64\x2e\xd7\xc7\x98\x67\xdf\xbf\xa2\xee\x7e\x0d\xa3\xbc\x0e\x15\x22\x5c\x1f\x9e\x12\x3c\x39\x83\x36\x0a\x7a\x32\x7e\x25\xef\x28\x6a\x9c\x45\xd8\x13\x2c\x1c\x22\x01\xec\xdb\x70\xba\x3a\x32\x99\xd6\x68\x03\x14\x42\x83\x60\xae\x3e\x57\xdc\xf3\xe1\x51\x38\x71\x0e\x15\x1b\xad\x45\x03\xa7\x8f\x71\xaa\xe9\xac\xcd\x79\x65\x86\xc9\xb1\xfc\xfa\x62\x0a\x25\x9c\xc6\x10\x14\xef", 149)); struct csum_inet csum_1; csum_inet_init(&csum_1); NONFAILING(csum_inet_update(&csum_1, (const uint8_t*)0x100003e2, 4)); NONFAILING(csum_inet_update(&csum_1, (const uint8_t*)0x100003e6, 4)); uint16_t csum_1_chunk_2 = 0x1100; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_2, 2); uint16_t csum_1_chunk_3 = 0x800; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_3, 2); NONFAILING(csum_inet_update(&csum_1, (const uint8_t*)0x10000406, 8)); NONFAILING(*(uint16_t*)0x1000040c = csum_inet_digest(&csum_1)); struct csum_inet csum_2; csum_inet_init(&csum_2); NONFAILING(csum_inet_update(&csum_2, (const uint8_t*)0x100003d6, 48)); NONFAILING(*(uint16_t*)0x100003e0 = csum_inet_digest(&csum_2)); break; case 9: NONFAILING(*(uint32_t*)0x100004c0 = 0); syscall(SYS_setgroups, 1, 0x100004c0); break; case 10: NONFAILING(*(uint8_t*)0x10000000 = 0); NONFAILING(*(uint8_t*)0x10000001 = 0); NONFAILING(*(uint8_t*)0x10000002 = 0); NONFAILING(*(uint8_t*)0x10000003 = 0); NONFAILING(*(uint8_t*)0x10000004 = 0); NONFAILING(*(uint8_t*)0x10000005 = 0); NONFAILING(*(uint8_t*)0x10000006 = 0); NONFAILING(*(uint8_t*)0x10000007 = 0); NONFAILING(*(uint8_t*)0x10000008 = 0); NONFAILING(*(uint8_t*)0x10000009 = 0); NONFAILING(*(uint8_t*)0x1000000a = 0); NONFAILING(*(uint8_t*)0x1000000b = 0); NONFAILING(*(uint16_t*)0x1000000c = htobe16(0x86dd)); NONFAILING(STORE_BY_BITMASK(uint8_t, , 0x1000000e, 3, 0, 4)); NONFAILING(STORE_BY_BITMASK(uint8_t, , 0x1000000e, 6, 4, 4)); NONFAILING(memcpy((void*)0x1000000f, "\x08\x21\x11", 3)); NONFAILING(*(uint16_t*)0x10000012 = htobe16(0x389)); NONFAILING(*(uint8_t*)0x10000014 = 0x6c); NONFAILING(*(uint8_t*)0x10000015 = 0); NONFAILING(*(uint8_t*)0x10000016 = 0); NONFAILING(*(uint8_t*)0x10000017 = 0); NONFAILING(*(uint8_t*)0x10000018 = 0); NONFAILING(*(uint8_t*)0x10000019 = 0); NONFAILING(*(uint8_t*)0x1000001a = 0); NONFAILING(*(uint8_t*)0x1000001b = 0); NONFAILING(*(uint8_t*)0x1000001c = 0); NONFAILING(*(uint8_t*)0x1000001d = 0); NONFAILING(*(uint8_t*)0x1000001e = 0); NONFAILING(*(uint8_t*)0x1000001f = 0); NONFAILING(*(uint8_t*)0x10000020 = -1); NONFAILING(*(uint8_t*)0x10000021 = -1); NONFAILING(*(uint32_t*)0x10000022 = htobe32(0xe0000002)); NONFAILING(*(uint64_t*)0x10000026 = htobe64(0)); NONFAILING(*(uint64_t*)0x1000002e = htobe64(1)); NONFAILING(*(uint8_t*)0x10000036 = 0x5e); NONFAILING(*(uint8_t*)0x10000037 = 0x36); NONFAILING(*(uint8_t*)0x10000038 = 0); NONFAILING(*(uint8_t*)0x10000039 = 0); NONFAILING(*(uint8_t*)0x1000003a = 0); NONFAILING(*(uint8_t*)0x1000003b = 0); NONFAILING(*(uint8_t*)0x1000003c = 0); NONFAILING(*(uint8_t*)0x1000003d = 0); NONFAILING(*(uint8_t*)0x1000003e = 0x79); NONFAILING(*(uint8_t*)0x1000003f = 0x1a); NONFAILING(memcpy((void*)0x10000040, "\x32\x25\x39\xdc\xe6\xc8\x60\xea\xe2\xe7\x17\xfe\x5d\x91\x9d\x50\xf1\x2d\xa8\xc2\x79\x0d\x7b\x77\x8b\xd5", 26)); NONFAILING(*(uint8_t*)0x1000005a = 5); NONFAILING(*(uint8_t*)0x1000005b = 2); NONFAILING(*(uint16_t*)0x1000005c = htobe16(7)); NONFAILING(*(uint8_t*)0x1000005e = 0); NONFAILING(*(uint8_t*)0x1000005f = 1); NONFAILING(*(uint8_t*)0x10000060 = 0); NONFAILING(*(uint8_t*)0x10000061 = 1); NONFAILING(*(uint8_t*)0x10000062 = 2); NONFAILING(*(uint8_t*)0x10000063 = 0); NONFAILING(*(uint8_t*)0x10000064 = 0); NONFAILING(*(uint8_t*)0x10000065 = 8); NONFAILING(*(uint8_t*)0x10000066 = 0xfa); NONFAILING(memcpy((void*)0x10000067, "\xe2\xb0\xb2\x1d\x6f\x96\xa0\x12\xb7\x94\x79\x1a\x56\x4b\x79\x1a\x9b\x08\x76\xcc\x87\xa8\xe8\xdf\xcd\x42\x46\xac\xbd\x2e\x57\x62\x29\x84\x3f\x20\x6d\x42\xee\xc2\xb9\x9d\x4b\x6d\xb9\x3c\xa1\x5f\x41\xcc\x25\xad\xa1\x9e\x33\x8a\x97\x80\xc9\x60\x42\x10\x12\x95\x03\x07\xe6\x5d\xda\x08\x89\x3e\xb2\xf5\x64\x02\xae\xfb\xa1\x48\xc2\xf9\x55\x8d\x7a\x04\xf9\xe1\x35\x24\x7d\x1a\x8d\x04\x24\x62\x50\x45\x2d\x0f\x26\x3c\xf9\x0a\xa9\x8d\x56\x9e\xaa\x16\x83\x4e\xa0\x45\xe6\xda\xbc\xe8\x90\x6a\xc9\xaf\x25\xef\xb2\xe5\xbc\xc2\x4b\x0d\xea\xbd\x73\x19\xca\x60\x6a\x2e\x28\xb6\x58\xae\xa5\x94\x7a\x43\x07\x5c\x1f\x2e\xa5\x0c\xca\x8d\xd6\x3e\x0a\x87\x6b\x47\xf6\x02\x10\xb4\xe8\x24\x19\x41\xfa\x4c\xae\xf6\xcd\x78\x74\x10\xb6\x90\x0e\xc1\x17\x31\x4f\x6e\x71\xf7\x87\x4a\xd6\x74\x17\xe3\x3c\xc3\x19\xd6\x51\xf3\x5f\x08\xd1\x15\xc9\x13\x75\xa2\xdf\x16\x29\xb5\x3a\x49\xe6\xb0\x5e\xdf\xa0\xc3\x5e\xee\x07\xf8\xcb\xd9\x8f\xdf\xf7\x05\x0f\x59\x61\xec\x1c\xe4\x76\xb8\x1c\x38\x52\x91\x2f\xbe\x45\x19\x3a\xa0\x55\xa5\x7f\xb3", 250)); NONFAILING(*(uint8_t*)0x10000161 = 4); NONFAILING(*(uint8_t*)0x10000162 = 1); NONFAILING(*(uint8_t*)0x10000163 = 0xa1); NONFAILING(*(uint8_t*)0x10000164 = 1); NONFAILING(*(uint8_t*)0x10000165 = 3); NONFAILING(*(uint8_t*)0x10000166 = 0); NONFAILING(*(uint8_t*)0x10000167 = 0); NONFAILING(*(uint8_t*)0x10000168 = 0); NONFAILING(*(uint8_t*)0x10000169 = 0); NONFAILING(*(uint8_t*)0x1000016a = 1); NONFAILING(*(uint8_t*)0x1000016b = 0); NONFAILING(*(uint8_t*)0x1000016c = 4); NONFAILING(*(uint8_t*)0x1000016d = 0x7e); NONFAILING(memcpy((void*)0x1000016e, "\x64\x22\xa7\xd8\x78\x76\x68\x9c\xee\xf9\x9a\x86\x21\xb2\xff\xc6\x4a\x04\x7f\x65\x2c\x39\xeb\x4b\x53\xe8\x45\x12\xa5\x58\x53\x99\x3f\xeb\x36\xf7\x73\x64\xf4\x7b\x75\x9b\xa0\x40\x02\xb9\xb1\x94\x17\x5c\x2f\x22\x37\xbc\xb1\x14\x86\xa5\xb8\xf1\xf2\x82\x04\x97\x38\x1a\x8c\xaf\xa0\x73\x9a\xe6\x23\x82\xe8\x3c\x7a\x2e\xd1\xbf\x16\xab\xd0\xe2\x67\x54\xe1\x2c\x85\xdc\x31\x76\x4c\x4c\xae\x57\x9a\x16\x3f\x11\xe5\x70\xe8\xa4\xda\xe7\x89\x4a\x55\xd7\x96\xe1\xe7\x66\x3c\x41\xc1\xc3\xc7\x4e\x89\x7b\x7a\x3f\x74\xa3", 126)); NONFAILING(*(uint8_t*)0x100001ec = 4); NONFAILING(*(uint8_t*)0x100001ed = 1); NONFAILING(*(uint8_t*)0x100001ee = 4); NONFAILING(*(uint8_t*)0x100001f6 = 0x88); NONFAILING(*(uint8_t*)0x100001f7 = 0); NONFAILING(*(uint16_t*)0x100001f8 = htobe16(0)); NONFAILING(*(uint8_t*)0x100001fa = 0x33); NONFAILING(*(uint8_t*)0x100001fb = 0); NONFAILING(*(uint8_t*)0x100001fc = 0); NONFAILING(*(uint8_t*)0x100001fd = 0); NONFAILING(*(uint64_t*)0x100001fe = htobe64(0)); NONFAILING(*(uint64_t*)0x10000206 = htobe64(1)); NONFAILING(*(uint8_t*)0x1000020e = 0x18); NONFAILING(*(uint8_t*)0x1000020f = 0x1f); NONFAILING(memcpy((void*)0x10000210, "\x7a\xa7\x36\x34\xe6\xc6\x0c\xeb\x89\x30\xc5\xbc\x17\x2a\x27\x55\x0b\x25\x6d\xd3\x86\x37\x55\x7a\x7d\x83\xb9\x70\xff\xf6\x99\xff\xde\xfb\xaa\x07\xf0\x44\x7c\x8b\x93\xf9\x73\x25\x46\x2e\x51\x16\xd6\x99\x81\xda\x65\x36\xe2\x68\x7f\x53\x21\xf0\x69\x84\x30\x4f\x9a\xc3\x4f\x65\x94\xf5\x62\x86\x2f\x34\x08\xd7\xb4\xc5\x44\x3f\x15\xa8\xa8\x02\x09\xbb\x6b\x12\xb9\xaa\x87\xcc\x0c\xc0\x7c\x13\x8e\x81\x1e\x6e\xcd\xed\x6f\x5e\x61\xe7\x7c\x35\xdb\xa8\xb5\x58\x25\x8c\xb7\xa0\x84\x63\x8b\x56\x63\x18\xc5\x13\x76\x39\x32\x33\xa5\x35\xfd\x53\x22\x9c\x67\x4d\x82\xb4\x47\x71\xf4\x3a\xc0\x8d\xcb\xcd\x5f\xfd\x65\x85\x0d\x7e\xef\x8c\x21\xb3\x83\x21\xd3\x4e\xf6\xd1\xf6\x92\xcc\x66\xc8\x48\x03\x7c\xc6\x2d\x0c\xa2\x31\x3a\xd4\x36\xb1\x99\x52\xdf\x8c\x0a\x2e\xf9\x1e\xa7\x2b\x33\xfc\x3d\x62\xbd\xe2\x31\x86\x35\x39\x7c\xb5\x95\x85\x1d\x39\x31\x46\xd9\x59\x34\xdb\x89\x14\x64\xa9\x74\xbd\xf9\x09\xdc\xae\xfd\x40\xc3\x51\x05\xdd\x2a\x93\x9c\xa0\x27\x95\xc2\x90\xd2\x83\x46\xa7\x09\x66\x6e\x65\x66\x82\x14\x13\xfa\x08\xd4\xe6\x12\x1e", 253)); NONFAILING(*(uint8_t*)0x1000030d = 5); NONFAILING(*(uint8_t*)0x1000030e = 0x16); NONFAILING(memcpy((void*)0x1000030f, "\x2e\x4f\x2a\x94\xc9\x13\x37\x5e\x90\xa8\x9d\xd2\xdb\x52\x08\x22\x3b\x2e\xc7\xfc\x31\x68\xa4\xbd\xca\xe1\x79\x7b\x6d\x83\x1a\x4b\xa9\xcc\x91\xe0\xe3\xd1\x1c\x2e\xcf\xf4\x4e\x97\xdf\xe6\xb9\xb7\x92\x98\x5a\x0d\x2c\xb0\x83\xac\x59\xe2\x09\x79\x5e\x00\x93\x0d\x9b\xa4\xc6\xa1\x10\x91\x36\xac\xd0\x95\xfd\xfe\x74\x57\xf6\xe2\x7d\x0a\xa1\xbf\xef\x5d\x6d\x3e\x90\x43\xfb\xbc\x47\x50\xca\x91\xcd\x1b\x4b\xb6\xb8\xc1\xaf\x78\xff\x40\x1c\x76\x0d\x21\x50\x99\x4f\xbe\x3c\x5e\x66\xe5\xab\xbd\xf1\x4d\xbf\xe5\x79\x71\xfc\xdd\xab\xff\x8c\x34\xa1\x20\x77\x8e\x67\xf3\x8d\x62\xe7\x6d\xef\x1c\xad\xb1\x01\x3d\x2a\xab\x71\xbc\x3f\x3d\xcd\xca\xa0\x85\xd1\xdd\xb8\x5e\x52\xa2\xf2\xf5\xa7\xa8\x59\x05\x15\x51\x92\x93\x0f\x0b", 176)); struct csum_inet csum_3; csum_inet_init(&csum_3); NONFAILING(csum_inet_update(&csum_3, (const uint8_t*)0x10000016, 16)); NONFAILING(csum_inet_update(&csum_3, (const uint8_t*)0x10000026, 16)); uint32_t csum_3_chunk_2 = 0xc9010000; csum_inet_update(&csum_3, (const uint8_t*)&csum_3_chunk_2, 4); uint32_t csum_3_chunk_3 = 0x3a000000; csum_inet_update(&csum_3, (const uint8_t*)&csum_3_chunk_3, 4); NONFAILING(csum_inet_update(&csum_3, (const uint8_t*)0x100001f6, 457)); NONFAILING(*(uint16_t*)0x100001f8 = csum_inet_digest(&csum_3)); break; case 11: NONFAILING(memcpy((void*)0x100003c0, "\x0f\x01\xf9\x67\x66\x0f\xfd\xd9\xc4\xe1\x11\xf9\xdf\xc4\xe3\x15\x02\x5b\x71\x0b\x64\x0f\xae\xf7\x3e\x0f\x5b\xd1\xc0\x00\x48\xc4\xe3\x79\x14\xb4\x18\x07\x00\x00\x00\x69\xcf\x66\x0f\x13\x2e", 47)); NONFAILING(syz_execute_func(0x100003c0)); break; case 12: break; } } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); install_segv_handler(); use_temporary_dir(); do_sandbox_none(); return 0; } :380:11: error: use of undeclared identifier 'SYS_copy_file_range' syscall(SYS_copy_file_range, 0xffffff9c, 0x10000140, (intptr_t)r[0], 0x10000180, 4ull, 0); ^ 1 error generated. compiler invocation: clang [-o /tmp/syz-executor696311322 -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 (2.57s) csource_test.go:123: opts: {Threaded:true Collide:false Repeat:true RepeatTimes:0 Procs:0 Sandbox:none Fault:false FaultCall:0 FaultNth:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false VhciInjection:false Wifi:false Sysctl:false UseTmpDir:true HandleSegv:false Repro:false Trace:true} program: fstat(0xffffffffffffff9c, &(0x7f0000000000)) r0 = socket$inet6_icmp_raw(0x1c, 0x3, 0x3a) setsockopt$inet6_tcp_TCP_FUNCTION_BLK(r0, 0x6, 0x2000, &(0x7f0000000100)={'bbr\x00', 0xfff}, 0x24) copy_file_range(0xffffffffffffff9c, &(0x7f0000000140)=0x9, r0, &(0x7f0000000180)=0x3f, 0x4, 0x0) getsockopt$inet_sctp_SCTP_EXPLICIT_EOR(0xffffffffffffffff, 0x84, 0x1b, &(0x7f00000001c0), &(0x7f0000000200)=0x4) getuid() getsockopt$inet_sctp_SCTP_STATUS(0xffffffffffffffff, 0x84, 0x100, &(0x7f0000000240)={0x0, 0x5, 0x2, 0xdd, 0x9, 0x7fff, 0x5, 0x1, {@in6={{0x1c, 0x1c, 0x3, 0x4, @local={0xfe, 0x80, [], 0x0}, 0x10000}}, 0x0, 0x9, 0xfffffff9, 0xdf10, 0x40, 0x8}}, &(0x7f0000000300)=0xac) getsockopt$inet6_sctp_SCTP_PR_ASSOC_STATUS(r0, 0x84, 0x108, &(0x7f0000000340)={r1, 0x9, 0x3, 0x1, 0x1}, &(0x7f0000000380)=0x18) syz_emit_ethernet(0xe3, &(0x7f00000003c0)={@random="558e866ec7c5", @broadcast, [{[{0x88a8, 0x0, 0x0, 0x1}], {0x8100, 0x0, 0x0, 0x4}}], {@ipv4={0x800, {{0xc, 0x4, 0x0, 0x8, 0xcd, 0x68, 0x1, 0x2, 0x1a, 0x0, @multicast2, @rand_addr, {[@ra={0x94, 0x6, 0x10000}, @lsrr={0x83, 0xb, 0x0, [@loopback, @empty]}, @generic={0x88, 0x9, "68b02e9aa55a8b"}]}}, @udp={{0x2, 0x3, 0x8}, {"1727313c0d121aaf942aba95b4aa8f3fab4a3f423c50b9f3207de073cd93e9d4abf4dd1bdea8b9e04ec83b0977c7094eca816b50fc613b6900642ed7c79867dfbfa2ee7e0da3bc0e15225c1f9e123c3983360a7a327e25ef286a9c45d8132c1c2201ecdb70ba3a3299d6680314428360ae3e57dcf3e15138710e151bad4503a78f71aae9accd796586c9b1fcfa620a259cc61014ef"}}}}}}) setgroups(0x1, &(0x7f00000004c0)=[0x0]) syz_emit_ethernet(0x3bf, &(0x7f0000000000)={@empty, @empty, [], {@ipv6={0x86dd, {0x3, 0x6, "082111", 0x389, 0x6c, 0x0, @ipv4={[], [], @multicast2}, @loopback, {[@dstopts={0x5e, 0x36, [], [@generic={0x79, 0x1a, "322539dce6c860eae2e717fe5d919d50f12da8c2790d7b778bd5"}, @ra={0x5, 0x2, 0x7}, @pad1, @padn={0x1, 0x2, [0x0, 0x0]}, @generic={0x8, 0xfa, "e2b0b21d6f96a012b794791a564b791a9b0876cc87a8e8dfcd4246acbd2e576229843f206d42eec2b99d4b6db93ca15f41cc25ada19e338a9780c960421012950307e65dda08893eb2f56402aefba148c2f9558d7a04f9e135247d1a8d04246250452d0f263cf90aa98d569eaa16834ea045e6dabce8906ac9af25efb2e5bcc24b0deabd7319ca606a2e28b658aea5947a43075c1f2ea50cca8dd63e0a876b47f60210b4e8241941fa4caef6cd787410b6900ec117314f6e71f7874ad67417e33cc319d651f35f08d115c91375a2df1629b53a49e6b05edfa0c35eee07f8cbd98fdff7050f5961ec1ce476b81c3852912fbe45193aa055a57fb3"}, @enc_lim={0x4, 0x1, 0xa1}, @padn={0x1, 0x3, [0x0, 0x0, 0x0]}, @pad1, @generic={0x4, 0x7e, "6422a7d87876689ceef99a8621b2ffc64a047f652c39eb4b53e84512a55853993feb36f77364f47b759ba04002b9b194175c2f2237bcb11486a5b8f1f2820497381a8cafa0739ae62382e83c7a2ed1bf16abd0e26754e12c85dc31764c4cae579a163f11e570e8a4dae7894a55d796e1e7663c41c1c3c74e897b7a3f74a3"}, @enc_lim={0x4, 0x1, 0x4}]}], @icmpv6=@ndisc_na={0x88, 0x0, 0x0, 0x33, [], @loopback, [{0x18, 0x1f, "7aa73634e6c60ceb8930c5bc172a27550b256dd38637557a7d83b970fff699ffdefbaa07f0447c8b93f97325462e5116d69981da6536e2687f5321f06984304f9ac34f6594f562862f3408d7b4c5443f15a8a80209bb6b12b9aa87cc0cc07c138e811e6ecded6f5e61e77c35dba8b558258cb7a084638b566318c51376393233a535fd53229c674d82b44771f43ac08dcbcd5ffd65850d7eef8c21b38321d34ef6d1f692cc66c848037cc62d0ca2313ad436b19952df8c0a2ef91ea72b33fc3d62bde2318635397cb595851d393146d95934db891464a974bdf909dcaefd40c35105dd2a939ca02795c290d28346a709666e6566821413fa08d4e6121e"}, {0x5, 0x16, "2e4f2a94c913375e90a89dd2db5208223b2ec7fc3168a4bdcae1797b6d831a4ba9cc91e0e3d11c2ecff44e97dfe6b9b792985a0d2cb083ac59e209795e00930d9ba4c6a1109136acd095fdfe7457f6e27d0aa1bfef5d6d3e9043fbbc4750ca91cd1b4bb6b8c1af78ff401c760d2150994fbe3c5e66e5abbdf14dbfe57971fcddabff8c34a120778e67f38d62e76def1cadb1013d2aab71bc3f3dcdcaa085d1ddb85e52a2f2f5a7a85905155192930f0b"}]}}}}}}) syz_execute_func(&(0x7f00000003c0)="0f01f967660ffdd9c4e111f9dfc4e315025b710b640faef73e0f5bd1c00048c4e37914b4180700000069cf660f132e") syz_extract_tcp_res(&(0x7f0000000400), 0x2, 0x67) csource_test.go:124: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void __attribute__((noinline)) remove_dir(const char* dir) { DIR* dp = opendir(dir); if (dp == NULL) { if (errno == EACCES) { if (rmdir(dir)) exit(1); return; } exit(1); } struct dirent* ep = 0; while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } if (unlink(filename)) exit(1); } closedir(dp); if (rmdir(dir)) exit(1); } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { pthread_mutex_t mu; pthread_cond_t cv; int state; } event_t; static void event_init(event_t* ev) { if (pthread_mutex_init(&ev->mu, 0)) exit(1); if (pthread_cond_init(&ev->cv, 0)) exit(1); ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { pthread_mutex_lock(&ev->mu); if (ev->state) exit(1); ev->state = 1; pthread_mutex_unlock(&ev->mu); pthread_cond_broadcast(&ev->cv); } static void event_wait(event_t* ev) { pthread_mutex_lock(&ev->mu); while (!ev->state) pthread_cond_wait(&ev->cv, &ev->mu); pthread_mutex_unlock(&ev->mu); } static int event_isset(event_t* ev) { pthread_mutex_lock(&ev->mu); int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; pthread_mutex_lock(&ev->mu); for (;;) { if (ev->state) break; uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); now = current_time_ms(); if (now - start > timeout) break; } int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } #define BITMASK(bf_off,bf_len) (((1ull << (bf_len)) - 1) << (bf_off)) #define STORE_BY_BITMASK(type,htobe,addr,val,bf_off,bf_len) *(type*)(addr) = htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len)))) struct csum_inet { uint32_t acc; }; static void csum_inet_init(struct csum_inet* csum) { csum->acc = 0; } static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) { if (length == 0) return; size_t i = 0; for (; i < length - 1; i += 2) csum->acc += *(uint16_t*)&data[i]; if (length & 1) csum->acc += le16toh((uint16_t)data[length - 1]); while (csum->acc > 0xffff) csum->acc = (csum->acc & 0xffff) + (csum->acc >> 16); } static uint16_t csum_inet_digest(struct csum_inet* csum) { return ~csum->acc; } static void sandbox_common() { struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 8 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 0; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); } static void loop(); static int do_sandbox_none(void) { sandbox_common(); loop(); return 0; } static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { fprintf(stderr, "### start\n"); int i, call, thread; for (call = 0; call < 13; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); event_timedwait(&th->done, 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 = 0; for (;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[2] = {0xffffffffffffffff, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: res = syscall(SYS_fstat, 0xffffff9c, 0x10000000); fprintf(stderr, "### call=0 errno=%u\n", res == -1 ? errno : 0); break; case 1: res = syscall(SYS_socket, 0x1c, 3, 0x3a); fprintf(stderr, "### call=1 errno=%u\n", res == -1 ? errno : 0); if (res != -1) r[0] = res; break; case 2: memcpy((void*)0x10000100, "bbr\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 32); *(uint32_t*)0x10000120 = 0xfff; res = syscall(SYS_setsockopt, (intptr_t)r[0], 6, 0x2000, 0x10000100, 0x24); fprintf(stderr, "### call=2 errno=%u\n", res == -1 ? errno : 0); break; case 3: *(uint64_t*)0x10000140 = 9; *(uint64_t*)0x10000180 = 0x3f; res = syscall(SYS_copy_file_range, 0xffffff9c, 0x10000140, (intptr_t)r[0], 0x10000180, 4ull, 0); fprintf(stderr, "### call=3 errno=%u\n", res == -1 ? errno : 0); break; case 4: *(uint32_t*)0x10000200 = 4; res = syscall(SYS_getsockopt, -1, 0x84, 0x1b, 0x100001c0, 0x10000200); fprintf(stderr, "### call=4 errno=%u\n", res == -1 ? errno : 0); break; case 5: res = syscall(SYS_getuid); fprintf(stderr, "### call=5 errno=%u\n", res == -1 ? errno : 0); break; case 6: *(uint32_t*)0x10000240 = 0; *(uint32_t*)0x10000244 = 5; *(uint32_t*)0x10000248 = 2; *(uint16_t*)0x1000024c = 0xdd; *(uint16_t*)0x1000024e = 9; *(uint16_t*)0x10000250 = 0x7fff; *(uint16_t*)0x10000252 = 5; *(uint32_t*)0x10000254 = 1; *(uint8_t*)0x10000258 = 0x1c; *(uint8_t*)0x10000259 = 0x1c; *(uint16_t*)0x1000025a = htobe16(0x4e23); *(uint32_t*)0x1000025c = 4; *(uint8_t*)0x10000260 = 0xfe; *(uint8_t*)0x10000261 = 0x80; *(uint8_t*)0x10000262 = 0; *(uint8_t*)0x10000263 = 0; *(uint8_t*)0x10000264 = 0; *(uint8_t*)0x10000265 = 0; *(uint8_t*)0x10000266 = 0; *(uint8_t*)0x10000267 = 0; *(uint8_t*)0x10000268 = 0; *(uint8_t*)0x10000269 = 0; *(uint8_t*)0x1000026a = 0; *(uint8_t*)0x1000026b = 0; *(uint8_t*)0x1000026c = 0; *(uint8_t*)0x1000026d = 0; *(uint8_t*)0x1000026e = 0; *(uint8_t*)0x1000026f = 0xaa; *(uint32_t*)0x10000270 = 0x10000; *(uint64_t*)0x10000274 = 0; *(uint64_t*)0x1000027c = 0; *(uint64_t*)0x10000284 = 0; *(uint64_t*)0x1000028c = 0; *(uint64_t*)0x10000294 = 0; *(uint64_t*)0x1000029c = 0; *(uint64_t*)0x100002a4 = 0; *(uint64_t*)0x100002ac = 0; *(uint64_t*)0x100002b4 = 0; *(uint64_t*)0x100002bc = 0; *(uint64_t*)0x100002c4 = 0; *(uint64_t*)0x100002cc = 0; *(uint32_t*)0x100002d4 = 0; *(uint32_t*)0x100002d8 = 9; *(uint32_t*)0x100002dc = 0xfffffff9; *(uint32_t*)0x100002e0 = 0xdf10; *(uint32_t*)0x100002e4 = 0x40; *(uint32_t*)0x100002e8 = 8; *(uint32_t*)0x10000300 = 0xac; res = syscall(SYS_getsockopt, -1, 0x84, 0x100, 0x10000240, 0x10000300); fprintf(stderr, "### call=6 errno=%u\n", res == -1 ? errno : 0); if (res != -1) r[1] = *(uint32_t*)0x100002d4; break; case 7: *(uint32_t*)0x10000340 = r[1]; *(uint16_t*)0x10000344 = 9; *(uint16_t*)0x10000346 = 3; *(uint64_t*)0x10000348 = 1; *(uint64_t*)0x10000350 = 1; *(uint32_t*)0x10000380 = 0x18; res = syscall(SYS_getsockopt, (intptr_t)r[0], 0x84, 0x108, 0x10000340, 0x10000380); fprintf(stderr, "### call=7 errno=%u\n", res == -1 ? errno : 0); break; case 8: memcpy((void*)0x100003c0, "\x55\x8e\x86\x6e\xc7\xc5", 6); *(uint8_t*)0x100003c6 = -1; *(uint8_t*)0x100003c7 = -1; *(uint8_t*)0x100003c8 = -1; *(uint8_t*)0x100003c9 = -1; *(uint8_t*)0x100003ca = -1; *(uint8_t*)0x100003cb = -1; *(uint16_t*)0x100003cc = htobe16(0x88a8); STORE_BY_BITMASK(uint16_t, , 0x100003ce, 0, 0, 3); STORE_BY_BITMASK(uint16_t, , 0x100003ce, 0, 3, 1); STORE_BY_BITMASK(uint16_t, , 0x100003ce, 1, 4, 12); *(uint16_t*)0x100003d0 = htobe16(0x8100); STORE_BY_BITMASK(uint16_t, , 0x100003d2, 0, 0, 3); STORE_BY_BITMASK(uint16_t, , 0x100003d2, 0, 3, 1); STORE_BY_BITMASK(uint16_t, , 0x100003d2, 4, 4, 12); *(uint16_t*)0x100003d4 = htobe16(0x800); STORE_BY_BITMASK(uint8_t, , 0x100003d6, 0xc, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x100003d6, 4, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x100003d7, 0, 0, 2); STORE_BY_BITMASK(uint8_t, , 0x100003d7, 8, 2, 6); *(uint16_t*)0x100003d8 = htobe16(0xcd); *(uint16_t*)0x100003da = htobe16(0x68); *(uint16_t*)0x100003dc = htobe16(1); *(uint8_t*)0x100003de = 2; *(uint8_t*)0x100003df = 0x1a; *(uint16_t*)0x100003e0 = htobe16(0); *(uint32_t*)0x100003e2 = htobe32(0xe0000002); *(uint32_t*)0x100003e6 = htobe32(0); *(uint8_t*)0x100003ea = 0x94; *(uint8_t*)0x100003eb = 6; *(uint32_t*)0x100003ec = htobe32(0x10000); *(uint8_t*)0x100003f0 = 0x83; *(uint8_t*)0x100003f1 = 0xb; *(uint8_t*)0x100003f2 = 0; *(uint32_t*)0x100003f3 = htobe32(0x7f000001); *(uint32_t*)0x100003f7 = htobe32(0); *(uint8_t*)0x100003fb = 0x88; *(uint8_t*)0x100003fc = 9; memcpy((void*)0x100003fd, "\x68\xb0\x2e\x9a\xa5\x5a\x8b", 7); *(uint16_t*)0x10000406 = htobe16(0x4e22); *(uint16_t*)0x10000408 = htobe16(0x4e23); *(uint16_t*)0x1000040a = htobe16(8); *(uint16_t*)0x1000040c = htobe16(0); memcpy((void*)0x1000040e, "\x17\x27\x31\x3c\x0d\x12\x1a\xaf\x94\x2a\xba\x95\xb4\xaa\x8f\x3f\xab\x4a\x3f\x42\x3c\x50\xb9\xf3\x20\x7d\xe0\x73\xcd\x93\xe9\xd4\xab\xf4\xdd\x1b\xde\xa8\xb9\xe0\x4e\xc8\x3b\x09\x77\xc7\x09\x4e\xca\x81\x6b\x50\xfc\x61\x3b\x69\x00\x64\x2e\xd7\xc7\x98\x67\xdf\xbf\xa2\xee\x7e\x0d\xa3\xbc\x0e\x15\x22\x5c\x1f\x9e\x12\x3c\x39\x83\x36\x0a\x7a\x32\x7e\x25\xef\x28\x6a\x9c\x45\xd8\x13\x2c\x1c\x22\x01\xec\xdb\x70\xba\x3a\x32\x99\xd6\x68\x03\x14\x42\x83\x60\xae\x3e\x57\xdc\xf3\xe1\x51\x38\x71\x0e\x15\x1b\xad\x45\x03\xa7\x8f\x71\xaa\xe9\xac\xcd\x79\x65\x86\xc9\xb1\xfc\xfa\x62\x0a\x25\x9c\xc6\x10\x14\xef", 149); struct csum_inet csum_1; csum_inet_init(&csum_1); csum_inet_update(&csum_1, (const uint8_t*)0x100003e2, 4); csum_inet_update(&csum_1, (const uint8_t*)0x100003e6, 4); uint16_t csum_1_chunk_2 = 0x1100; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_2, 2); uint16_t csum_1_chunk_3 = 0x800; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_3, 2); csum_inet_update(&csum_1, (const uint8_t*)0x10000406, 8); *(uint16_t*)0x1000040c = csum_inet_digest(&csum_1); struct csum_inet csum_2; csum_inet_init(&csum_2); csum_inet_update(&csum_2, (const uint8_t*)0x100003d6, 48); *(uint16_t*)0x100003e0 = csum_inet_digest(&csum_2); (void)res; break; case 9: *(uint32_t*)0x100004c0 = 0; res = syscall(SYS_setgroups, 1, 0x100004c0); fprintf(stderr, "### call=9 errno=%u\n", res == -1 ? errno : 0); break; case 10: *(uint8_t*)0x10000000 = 0; *(uint8_t*)0x10000001 = 0; *(uint8_t*)0x10000002 = 0; *(uint8_t*)0x10000003 = 0; *(uint8_t*)0x10000004 = 0; *(uint8_t*)0x10000005 = 0; *(uint8_t*)0x10000006 = 0; *(uint8_t*)0x10000007 = 0; *(uint8_t*)0x10000008 = 0; *(uint8_t*)0x10000009 = 0; *(uint8_t*)0x1000000a = 0; *(uint8_t*)0x1000000b = 0; *(uint16_t*)0x1000000c = htobe16(0x86dd); STORE_BY_BITMASK(uint8_t, , 0x1000000e, 3, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x1000000e, 6, 4, 4); memcpy((void*)0x1000000f, "\x08\x21\x11", 3); *(uint16_t*)0x10000012 = htobe16(0x389); *(uint8_t*)0x10000014 = 0x6c; *(uint8_t*)0x10000015 = 0; *(uint8_t*)0x10000016 = 0; *(uint8_t*)0x10000017 = 0; *(uint8_t*)0x10000018 = 0; *(uint8_t*)0x10000019 = 0; *(uint8_t*)0x1000001a = 0; *(uint8_t*)0x1000001b = 0; *(uint8_t*)0x1000001c = 0; *(uint8_t*)0x1000001d = 0; *(uint8_t*)0x1000001e = 0; *(uint8_t*)0x1000001f = 0; *(uint8_t*)0x10000020 = -1; *(uint8_t*)0x10000021 = -1; *(uint32_t*)0x10000022 = htobe32(0xe0000002); *(uint64_t*)0x10000026 = htobe64(0); *(uint64_t*)0x1000002e = htobe64(1); *(uint8_t*)0x10000036 = 0x5e; *(uint8_t*)0x10000037 = 0x36; *(uint8_t*)0x10000038 = 0; *(uint8_t*)0x10000039 = 0; *(uint8_t*)0x1000003a = 0; *(uint8_t*)0x1000003b = 0; *(uint8_t*)0x1000003c = 0; *(uint8_t*)0x1000003d = 0; *(uint8_t*)0x1000003e = 0x79; *(uint8_t*)0x1000003f = 0x1a; memcpy((void*)0x10000040, "\x32\x25\x39\xdc\xe6\xc8\x60\xea\xe2\xe7\x17\xfe\x5d\x91\x9d\x50\xf1\x2d\xa8\xc2\x79\x0d\x7b\x77\x8b\xd5", 26); *(uint8_t*)0x1000005a = 5; *(uint8_t*)0x1000005b = 2; *(uint16_t*)0x1000005c = htobe16(7); *(uint8_t*)0x1000005e = 0; *(uint8_t*)0x1000005f = 1; *(uint8_t*)0x10000060 = 0; *(uint8_t*)0x10000061 = 1; *(uint8_t*)0x10000062 = 2; *(uint8_t*)0x10000063 = 0; *(uint8_t*)0x10000064 = 0; *(uint8_t*)0x10000065 = 8; *(uint8_t*)0x10000066 = 0xfa; memcpy((void*)0x10000067, "\xe2\xb0\xb2\x1d\x6f\x96\xa0\x12\xb7\x94\x79\x1a\x56\x4b\x79\x1a\x9b\x08\x76\xcc\x87\xa8\xe8\xdf\xcd\x42\x46\xac\xbd\x2e\x57\x62\x29\x84\x3f\x20\x6d\x42\xee\xc2\xb9\x9d\x4b\x6d\xb9\x3c\xa1\x5f\x41\xcc\x25\xad\xa1\x9e\x33\x8a\x97\x80\xc9\x60\x42\x10\x12\x95\x03\x07\xe6\x5d\xda\x08\x89\x3e\xb2\xf5\x64\x02\xae\xfb\xa1\x48\xc2\xf9\x55\x8d\x7a\x04\xf9\xe1\x35\x24\x7d\x1a\x8d\x04\x24\x62\x50\x45\x2d\x0f\x26\x3c\xf9\x0a\xa9\x8d\x56\x9e\xaa\x16\x83\x4e\xa0\x45\xe6\xda\xbc\xe8\x90\x6a\xc9\xaf\x25\xef\xb2\xe5\xbc\xc2\x4b\x0d\xea\xbd\x73\x19\xca\x60\x6a\x2e\x28\xb6\x58\xae\xa5\x94\x7a\x43\x07\x5c\x1f\x2e\xa5\x0c\xca\x8d\xd6\x3e\x0a\x87\x6b\x47\xf6\x02\x10\xb4\xe8\x24\x19\x41\xfa\x4c\xae\xf6\xcd\x78\x74\x10\xb6\x90\x0e\xc1\x17\x31\x4f\x6e\x71\xf7\x87\x4a\xd6\x74\x17\xe3\x3c\xc3\x19\xd6\x51\xf3\x5f\x08\xd1\x15\xc9\x13\x75\xa2\xdf\x16\x29\xb5\x3a\x49\xe6\xb0\x5e\xdf\xa0\xc3\x5e\xee\x07\xf8\xcb\xd9\x8f\xdf\xf7\x05\x0f\x59\x61\xec\x1c\xe4\x76\xb8\x1c\x38\x52\x91\x2f\xbe\x45\x19\x3a\xa0\x55\xa5\x7f\xb3", 250); *(uint8_t*)0x10000161 = 4; *(uint8_t*)0x10000162 = 1; *(uint8_t*)0x10000163 = 0xa1; *(uint8_t*)0x10000164 = 1; *(uint8_t*)0x10000165 = 3; *(uint8_t*)0x10000166 = 0; *(uint8_t*)0x10000167 = 0; *(uint8_t*)0x10000168 = 0; *(uint8_t*)0x10000169 = 0; *(uint8_t*)0x1000016a = 1; *(uint8_t*)0x1000016b = 0; *(uint8_t*)0x1000016c = 4; *(uint8_t*)0x1000016d = 0x7e; memcpy((void*)0x1000016e, "\x64\x22\xa7\xd8\x78\x76\x68\x9c\xee\xf9\x9a\x86\x21\xb2\xff\xc6\x4a\x04\x7f\x65\x2c\x39\xeb\x4b\x53\xe8\x45\x12\xa5\x58\x53\x99\x3f\xeb\x36\xf7\x73\x64\xf4\x7b\x75\x9b\xa0\x40\x02\xb9\xb1\x94\x17\x5c\x2f\x22\x37\xbc\xb1\x14\x86\xa5\xb8\xf1\xf2\x82\x04\x97\x38\x1a\x8c\xaf\xa0\x73\x9a\xe6\x23\x82\xe8\x3c\x7a\x2e\xd1\xbf\x16\xab\xd0\xe2\x67\x54\xe1\x2c\x85\xdc\x31\x76\x4c\x4c\xae\x57\x9a\x16\x3f\x11\xe5\x70\xe8\xa4\xda\xe7\x89\x4a\x55\xd7\x96\xe1\xe7\x66\x3c\x41\xc1\xc3\xc7\x4e\x89\x7b\x7a\x3f\x74\xa3", 126); *(uint8_t*)0x100001ec = 4; *(uint8_t*)0x100001ed = 1; *(uint8_t*)0x100001ee = 4; *(uint8_t*)0x100001f6 = 0x88; *(uint8_t*)0x100001f7 = 0; *(uint16_t*)0x100001f8 = htobe16(0); *(uint8_t*)0x100001fa = 0x33; *(uint8_t*)0x100001fb = 0; *(uint8_t*)0x100001fc = 0; *(uint8_t*)0x100001fd = 0; *(uint64_t*)0x100001fe = htobe64(0); *(uint64_t*)0x10000206 = htobe64(1); *(uint8_t*)0x1000020e = 0x18; *(uint8_t*)0x1000020f = 0x1f; memcpy((void*)0x10000210, "\x7a\xa7\x36\x34\xe6\xc6\x0c\xeb\x89\x30\xc5\xbc\x17\x2a\x27\x55\x0b\x25\x6d\xd3\x86\x37\x55\x7a\x7d\x83\xb9\x70\xff\xf6\x99\xff\xde\xfb\xaa\x07\xf0\x44\x7c\x8b\x93\xf9\x73\x25\x46\x2e\x51\x16\xd6\x99\x81\xda\x65\x36\xe2\x68\x7f\x53\x21\xf0\x69\x84\x30\x4f\x9a\xc3\x4f\x65\x94\xf5\x62\x86\x2f\x34\x08\xd7\xb4\xc5\x44\x3f\x15\xa8\xa8\x02\x09\xbb\x6b\x12\xb9\xaa\x87\xcc\x0c\xc0\x7c\x13\x8e\x81\x1e\x6e\xcd\xed\x6f\x5e\x61\xe7\x7c\x35\xdb\xa8\xb5\x58\x25\x8c\xb7\xa0\x84\x63\x8b\x56\x63\x18\xc5\x13\x76\x39\x32\x33\xa5\x35\xfd\x53\x22\x9c\x67\x4d\x82\xb4\x47\x71\xf4\x3a\xc0\x8d\xcb\xcd\x5f\xfd\x65\x85\x0d\x7e\xef\x8c\x21\xb3\x83\x21\xd3\x4e\xf6\xd1\xf6\x92\xcc\x66\xc8\x48\x03\x7c\xc6\x2d\x0c\xa2\x31\x3a\xd4\x36\xb1\x99\x52\xdf\x8c\x0a\x2e\xf9\x1e\xa7\x2b\x33\xfc\x3d\x62\xbd\xe2\x31\x86\x35\x39\x7c\xb5\x95\x85\x1d\x39\x31\x46\xd9\x59\x34\xdb\x89\x14\x64\xa9\x74\xbd\xf9\x09\xdc\xae\xfd\x40\xc3\x51\x05\xdd\x2a\x93\x9c\xa0\x27\x95\xc2\x90\xd2\x83\x46\xa7\x09\x66\x6e\x65\x66\x82\x14\x13\xfa\x08\xd4\xe6\x12\x1e", 253); *(uint8_t*)0x1000030d = 5; *(uint8_t*)0x1000030e = 0x16; memcpy((void*)0x1000030f, "\x2e\x4f\x2a\x94\xc9\x13\x37\x5e\x90\xa8\x9d\xd2\xdb\x52\x08\x22\x3b\x2e\xc7\xfc\x31\x68\xa4\xbd\xca\xe1\x79\x7b\x6d\x83\x1a\x4b\xa9\xcc\x91\xe0\xe3\xd1\x1c\x2e\xcf\xf4\x4e\x97\xdf\xe6\xb9\xb7\x92\x98\x5a\x0d\x2c\xb0\x83\xac\x59\xe2\x09\x79\x5e\x00\x93\x0d\x9b\xa4\xc6\xa1\x10\x91\x36\xac\xd0\x95\xfd\xfe\x74\x57\xf6\xe2\x7d\x0a\xa1\xbf\xef\x5d\x6d\x3e\x90\x43\xfb\xbc\x47\x50\xca\x91\xcd\x1b\x4b\xb6\xb8\xc1\xaf\x78\xff\x40\x1c\x76\x0d\x21\x50\x99\x4f\xbe\x3c\x5e\x66\xe5\xab\xbd\xf1\x4d\xbf\xe5\x79\x71\xfc\xdd\xab\xff\x8c\x34\xa1\x20\x77\x8e\x67\xf3\x8d\x62\xe7\x6d\xef\x1c\xad\xb1\x01\x3d\x2a\xab\x71\xbc\x3f\x3d\xcd\xca\xa0\x85\xd1\xdd\xb8\x5e\x52\xa2\xf2\xf5\xa7\xa8\x59\x05\x15\x51\x92\x93\x0f\x0b", 176); struct csum_inet csum_3; csum_inet_init(&csum_3); csum_inet_update(&csum_3, (const uint8_t*)0x10000016, 16); csum_inet_update(&csum_3, (const uint8_t*)0x10000026, 16); uint32_t csum_3_chunk_2 = 0xc9010000; csum_inet_update(&csum_3, (const uint8_t*)&csum_3_chunk_2, 4); uint32_t csum_3_chunk_3 = 0x3a000000; csum_inet_update(&csum_3, (const uint8_t*)&csum_3_chunk_3, 4); csum_inet_update(&csum_3, (const uint8_t*)0x100001f6, 457); *(uint16_t*)0x100001f8 = csum_inet_digest(&csum_3); (void)res; break; case 11: memcpy((void*)0x100003c0, "\x0f\x01\xf9\x67\x66\x0f\xfd\xd9\xc4\xe1\x11\xf9\xdf\xc4\xe3\x15\x02\x5b\x71\x0b\x64\x0f\xae\xf7\x3e\x0f\x5b\xd1\xc0\x00\x48\xc4\xe3\x79\x14\xb4\x18\x07\x00\x00\x00\x69\xcf\x66\x0f\x13\x2e", 47); res = -1; errno = EFAULT; res = syz_execute_func(0x100003c0); fprintf(stderr, "### call=11 errno=%u\n", res == -1 ? errno : 0); break; case 12: (void)res; break; } } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); use_temporary_dir(); do_sandbox_none(); return 0; } :352:17: error: use of undeclared identifier 'SYS_copy_file_range' res = syscall(SYS_copy_file_range, 0xffffff9c, 0x10000140, (intptr_t)r[0], 0x10000180, 4ull, 0); ^ 1 error generated. compiler invocation: clang [-o /tmp/syz-executor462060209 -DGOOS_freebsd=1 -DGOARCH_386=1 -DHOSTGOOS_freebsd=1 -x c - -m32 -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -static -lc++ -Wno-overflow] --- FAIL: TestGenerate/freebsd/386/10 (2.67s) csource_test.go:123: opts: {Threaded:true Collide:false Repeat:true RepeatTimes:0 Procs:0 Sandbox:none Fault:false FaultCall:0 FaultNth:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false VhciInjection:false Wifi:false Sysctl:false UseTmpDir:false HandleSegv:false Repro:false Trace:false} program: fstat(0xffffffffffffff9c, &(0x7f0000000000)) r0 = socket$inet6_icmp_raw(0x1c, 0x3, 0x3a) setsockopt$inet6_tcp_TCP_FUNCTION_BLK(r0, 0x6, 0x2000, &(0x7f0000000100)={'bbr\x00', 0xfff}, 0x24) copy_file_range(0xffffffffffffff9c, &(0x7f0000000140)=0x9, r0, &(0x7f0000000180)=0x3f, 0x4, 0x0) getsockopt$inet_sctp_SCTP_EXPLICIT_EOR(0xffffffffffffffff, 0x84, 0x1b, &(0x7f00000001c0), &(0x7f0000000200)=0x4) getuid() getsockopt$inet_sctp_SCTP_STATUS(0xffffffffffffffff, 0x84, 0x100, &(0x7f0000000240)={0x0, 0x5, 0x2, 0xdd, 0x9, 0x7fff, 0x5, 0x1, {@in6={{0x1c, 0x1c, 0x3, 0x4, @local={0xfe, 0x80, [], 0x0}, 0x10000}}, 0x0, 0x9, 0xfffffff9, 0xdf10, 0x40, 0x8}}, &(0x7f0000000300)=0xac) getsockopt$inet6_sctp_SCTP_PR_ASSOC_STATUS(r0, 0x84, 0x108, &(0x7f0000000340)={r1, 0x9, 0x3, 0x1, 0x1}, &(0x7f0000000380)=0x18) syz_emit_ethernet(0xe3, &(0x7f00000003c0)={@random="558e866ec7c5", @broadcast, [{[{0x88a8, 0x0, 0x0, 0x1}], {0x8100, 0x0, 0x0, 0x4}}], {@ipv4={0x800, {{0xc, 0x4, 0x0, 0x8, 0xcd, 0x68, 0x1, 0x2, 0x1a, 0x0, @multicast2, @rand_addr, {[@ra={0x94, 0x6, 0x10000}, @lsrr={0x83, 0xb, 0x0, [@loopback, @empty]}, @generic={0x88, 0x9, "68b02e9aa55a8b"}]}}, @udp={{0x2, 0x3, 0x8}, {"1727313c0d121aaf942aba95b4aa8f3fab4a3f423c50b9f3207de073cd93e9d4abf4dd1bdea8b9e04ec83b0977c7094eca816b50fc613b6900642ed7c79867dfbfa2ee7e0da3bc0e15225c1f9e123c3983360a7a327e25ef286a9c45d8132c1c2201ecdb70ba3a3299d6680314428360ae3e57dcf3e15138710e151bad4503a78f71aae9accd796586c9b1fcfa620a259cc61014ef"}}}}}}) setgroups(0x1, &(0x7f00000004c0)=[0x0]) syz_emit_ethernet(0x3bf, &(0x7f0000000000)={@empty, @empty, [], {@ipv6={0x86dd, {0x3, 0x6, "082111", 0x389, 0x6c, 0x0, @ipv4={[], [], @multicast2}, @loopback, {[@dstopts={0x5e, 0x36, [], [@generic={0x79, 0x1a, "322539dce6c860eae2e717fe5d919d50f12da8c2790d7b778bd5"}, @ra={0x5, 0x2, 0x7}, @pad1, @padn={0x1, 0x2, [0x0, 0x0]}, @generic={0x8, 0xfa, "e2b0b21d6f96a012b794791a564b791a9b0876cc87a8e8dfcd4246acbd2e576229843f206d42eec2b99d4b6db93ca15f41cc25ada19e338a9780c960421012950307e65dda08893eb2f56402aefba148c2f9558d7a04f9e135247d1a8d04246250452d0f263cf90aa98d569eaa16834ea045e6dabce8906ac9af25efb2e5bcc24b0deabd7319ca606a2e28b658aea5947a43075c1f2ea50cca8dd63e0a876b47f60210b4e8241941fa4caef6cd787410b6900ec117314f6e71f7874ad67417e33cc319d651f35f08d115c91375a2df1629b53a49e6b05edfa0c35eee07f8cbd98fdff7050f5961ec1ce476b81c3852912fbe45193aa055a57fb3"}, @enc_lim={0x4, 0x1, 0xa1}, @padn={0x1, 0x3, [0x0, 0x0, 0x0]}, @pad1, @generic={0x4, 0x7e, "6422a7d87876689ceef99a8621b2ffc64a047f652c39eb4b53e84512a55853993feb36f77364f47b759ba04002b9b194175c2f2237bcb11486a5b8f1f2820497381a8cafa0739ae62382e83c7a2ed1bf16abd0e26754e12c85dc31764c4cae579a163f11e570e8a4dae7894a55d796e1e7663c41c1c3c74e897b7a3f74a3"}, @enc_lim={0x4, 0x1, 0x4}]}], @icmpv6=@ndisc_na={0x88, 0x0, 0x0, 0x33, [], @loopback, [{0x18, 0x1f, "7aa73634e6c60ceb8930c5bc172a27550b256dd38637557a7d83b970fff699ffdefbaa07f0447c8b93f97325462e5116d69981da6536e2687f5321f06984304f9ac34f6594f562862f3408d7b4c5443f15a8a80209bb6b12b9aa87cc0cc07c138e811e6ecded6f5e61e77c35dba8b558258cb7a084638b566318c51376393233a535fd53229c674d82b44771f43ac08dcbcd5ffd65850d7eef8c21b38321d34ef6d1f692cc66c848037cc62d0ca2313ad436b19952df8c0a2ef91ea72b33fc3d62bde2318635397cb595851d393146d95934db891464a974bdf909dcaefd40c35105dd2a939ca02795c290d28346a709666e6566821413fa08d4e6121e"}, {0x5, 0x16, "2e4f2a94c913375e90a89dd2db5208223b2ec7fc3168a4bdcae1797b6d831a4ba9cc91e0e3d11c2ecff44e97dfe6b9b792985a0d2cb083ac59e209795e00930d9ba4c6a1109136acd095fdfe7457f6e27d0aa1bfef5d6d3e9043fbbc4750ca91cd1b4bb6b8c1af78ff401c760d2150994fbe3c5e66e5abbdf14dbfe57971fcddabff8c34a120778e67f38d62e76def1cadb1013d2aab71bc3f3dcdcaa085d1ddb85e52a2f2f5a7a85905155192930f0b"}]}}}}}}) syz_execute_func(&(0x7f00000003c0)="0f01f967660ffdd9c4e111f9dfc4e315025b710b640faef73e0f5bd1c00048c4e37914b4180700000069cf660f132e") syz_extract_tcp_res(&(0x7f0000000400), 0x2, 0x67) csource_test.go:124: 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 = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { pthread_mutex_t mu; pthread_cond_t cv; int state; } event_t; static void event_init(event_t* ev) { if (pthread_mutex_init(&ev->mu, 0)) exit(1); if (pthread_cond_init(&ev->cv, 0)) exit(1); ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { pthread_mutex_lock(&ev->mu); if (ev->state) exit(1); ev->state = 1; pthread_mutex_unlock(&ev->mu); pthread_cond_broadcast(&ev->cv); } static void event_wait(event_t* ev) { pthread_mutex_lock(&ev->mu); while (!ev->state) pthread_cond_wait(&ev->cv, &ev->mu); pthread_mutex_unlock(&ev->mu); } static int event_isset(event_t* ev) { pthread_mutex_lock(&ev->mu); int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; pthread_mutex_lock(&ev->mu); for (;;) { if (ev->state) break; uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); now = current_time_ms(); if (now - start > timeout) break; } int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } #define BITMASK(bf_off,bf_len) (((1ull << (bf_len)) - 1) << (bf_off)) #define STORE_BY_BITMASK(type,htobe,addr,val,bf_off,bf_len) *(type*)(addr) = htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len)))) struct csum_inet { uint32_t acc; }; static void csum_inet_init(struct csum_inet* csum) { csum->acc = 0; } static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) { if (length == 0) return; size_t i = 0; for (; i < length - 1; i += 2) csum->acc += *(uint16_t*)&data[i]; if (length & 1) csum->acc += le16toh((uint16_t)data[length - 1]); while (csum->acc > 0xffff) csum->acc = (csum->acc & 0xffff) + (csum->acc >> 16); } static uint16_t csum_inet_digest(struct csum_inet* csum) { return ~csum->acc; } static void sandbox_common() { struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 8 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 0; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); } static void loop(); static int do_sandbox_none(void) { sandbox_common(); loop(); return 0; } static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 13; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); event_timedwait(&th->done, 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 = 0; for (;; iter++) { int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5000) continue; kill_and_wait(pid, &status); break; } } } uint64_t r[2] = {0xffffffffffffffff, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: syscall(SYS_fstat, 0xffffff9c, 0x10000000); break; case 1: res = syscall(SYS_socket, 0x1c, 3, 0x3a); if (res != -1) r[0] = res; break; case 2: memcpy((void*)0x10000100, "bbr\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 32); *(uint32_t*)0x10000120 = 0xfff; syscall(SYS_setsockopt, (intptr_t)r[0], 6, 0x2000, 0x10000100, 0x24); break; case 3: *(uint64_t*)0x10000140 = 9; *(uint64_t*)0x10000180 = 0x3f; syscall(SYS_copy_file_range, 0xffffff9c, 0x10000140, (intptr_t)r[0], 0x10000180, 4ull, 0); break; case 4: *(uint32_t*)0x10000200 = 4; syscall(SYS_getsockopt, -1, 0x84, 0x1b, 0x100001c0, 0x10000200); break; case 5: syscall(SYS_getuid); break; case 6: *(uint32_t*)0x10000240 = 0; *(uint32_t*)0x10000244 = 5; *(uint32_t*)0x10000248 = 2; *(uint16_t*)0x1000024c = 0xdd; *(uint16_t*)0x1000024e = 9; *(uint16_t*)0x10000250 = 0x7fff; *(uint16_t*)0x10000252 = 5; *(uint32_t*)0x10000254 = 1; *(uint8_t*)0x10000258 = 0x1c; *(uint8_t*)0x10000259 = 0x1c; *(uint16_t*)0x1000025a = htobe16(0x4e23); *(uint32_t*)0x1000025c = 4; *(uint8_t*)0x10000260 = 0xfe; *(uint8_t*)0x10000261 = 0x80; *(uint8_t*)0x10000262 = 0; *(uint8_t*)0x10000263 = 0; *(uint8_t*)0x10000264 = 0; *(uint8_t*)0x10000265 = 0; *(uint8_t*)0x10000266 = 0; *(uint8_t*)0x10000267 = 0; *(uint8_t*)0x10000268 = 0; *(uint8_t*)0x10000269 = 0; *(uint8_t*)0x1000026a = 0; *(uint8_t*)0x1000026b = 0; *(uint8_t*)0x1000026c = 0; *(uint8_t*)0x1000026d = 0; *(uint8_t*)0x1000026e = 0; *(uint8_t*)0x1000026f = 0xaa; *(uint32_t*)0x10000270 = 0x10000; *(uint64_t*)0x10000274 = 0; *(uint64_t*)0x1000027c = 0; *(uint64_t*)0x10000284 = 0; *(uint64_t*)0x1000028c = 0; *(uint64_t*)0x10000294 = 0; *(uint64_t*)0x1000029c = 0; *(uint64_t*)0x100002a4 = 0; *(uint64_t*)0x100002ac = 0; *(uint64_t*)0x100002b4 = 0; *(uint64_t*)0x100002bc = 0; *(uint64_t*)0x100002c4 = 0; *(uint64_t*)0x100002cc = 0; *(uint32_t*)0x100002d4 = 0; *(uint32_t*)0x100002d8 = 9; *(uint32_t*)0x100002dc = 0xfffffff9; *(uint32_t*)0x100002e0 = 0xdf10; *(uint32_t*)0x100002e4 = 0x40; *(uint32_t*)0x100002e8 = 8; *(uint32_t*)0x10000300 = 0xac; res = syscall(SYS_getsockopt, -1, 0x84, 0x100, 0x10000240, 0x10000300); if (res != -1) r[1] = *(uint32_t*)0x100002d4; break; case 7: *(uint32_t*)0x10000340 = r[1]; *(uint16_t*)0x10000344 = 9; *(uint16_t*)0x10000346 = 3; *(uint64_t*)0x10000348 = 1; *(uint64_t*)0x10000350 = 1; *(uint32_t*)0x10000380 = 0x18; syscall(SYS_getsockopt, (intptr_t)r[0], 0x84, 0x108, 0x10000340, 0x10000380); break; case 8: memcpy((void*)0x100003c0, "\x55\x8e\x86\x6e\xc7\xc5", 6); *(uint8_t*)0x100003c6 = -1; *(uint8_t*)0x100003c7 = -1; *(uint8_t*)0x100003c8 = -1; *(uint8_t*)0x100003c9 = -1; *(uint8_t*)0x100003ca = -1; *(uint8_t*)0x100003cb = -1; *(uint16_t*)0x100003cc = htobe16(0x88a8); STORE_BY_BITMASK(uint16_t, , 0x100003ce, 0, 0, 3); STORE_BY_BITMASK(uint16_t, , 0x100003ce, 0, 3, 1); STORE_BY_BITMASK(uint16_t, , 0x100003ce, 1, 4, 12); *(uint16_t*)0x100003d0 = htobe16(0x8100); STORE_BY_BITMASK(uint16_t, , 0x100003d2, 0, 0, 3); STORE_BY_BITMASK(uint16_t, , 0x100003d2, 0, 3, 1); STORE_BY_BITMASK(uint16_t, , 0x100003d2, 4, 4, 12); *(uint16_t*)0x100003d4 = htobe16(0x800); STORE_BY_BITMASK(uint8_t, , 0x100003d6, 0xc, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x100003d6, 4, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x100003d7, 0, 0, 2); STORE_BY_BITMASK(uint8_t, , 0x100003d7, 8, 2, 6); *(uint16_t*)0x100003d8 = htobe16(0xcd); *(uint16_t*)0x100003da = htobe16(0x68); *(uint16_t*)0x100003dc = htobe16(1); *(uint8_t*)0x100003de = 2; *(uint8_t*)0x100003df = 0x1a; *(uint16_t*)0x100003e0 = htobe16(0); *(uint32_t*)0x100003e2 = htobe32(0xe0000002); *(uint32_t*)0x100003e6 = htobe32(0); *(uint8_t*)0x100003ea = 0x94; *(uint8_t*)0x100003eb = 6; *(uint32_t*)0x100003ec = htobe32(0x10000); *(uint8_t*)0x100003f0 = 0x83; *(uint8_t*)0x100003f1 = 0xb; *(uint8_t*)0x100003f2 = 0; *(uint32_t*)0x100003f3 = htobe32(0x7f000001); *(uint32_t*)0x100003f7 = htobe32(0); *(uint8_t*)0x100003fb = 0x88; *(uint8_t*)0x100003fc = 9; memcpy((void*)0x100003fd, "\x68\xb0\x2e\x9a\xa5\x5a\x8b", 7); *(uint16_t*)0x10000406 = htobe16(0x4e22); *(uint16_t*)0x10000408 = htobe16(0x4e23); *(uint16_t*)0x1000040a = htobe16(8); *(uint16_t*)0x1000040c = htobe16(0); memcpy((void*)0x1000040e, "\x17\x27\x31\x3c\x0d\x12\x1a\xaf\x94\x2a\xba\x95\xb4\xaa\x8f\x3f\xab\x4a\x3f\x42\x3c\x50\xb9\xf3\x20\x7d\xe0\x73\xcd\x93\xe9\xd4\xab\xf4\xdd\x1b\xde\xa8\xb9\xe0\x4e\xc8\x3b\x09\x77\xc7\x09\x4e\xca\x81\x6b\x50\xfc\x61\x3b\x69\x00\x64\x2e\xd7\xc7\x98\x67\xdf\xbf\xa2\xee\x7e\x0d\xa3\xbc\x0e\x15\x22\x5c\x1f\x9e\x12\x3c\x39\x83\x36\x0a\x7a\x32\x7e\x25\xef\x28\x6a\x9c\x45\xd8\x13\x2c\x1c\x22\x01\xec\xdb\x70\xba\x3a\x32\x99\xd6\x68\x03\x14\x42\x83\x60\xae\x3e\x57\xdc\xf3\xe1\x51\x38\x71\x0e\x15\x1b\xad\x45\x03\xa7\x8f\x71\xaa\xe9\xac\xcd\x79\x65\x86\xc9\xb1\xfc\xfa\x62\x0a\x25\x9c\xc6\x10\x14\xef", 149); struct csum_inet csum_1; csum_inet_init(&csum_1); csum_inet_update(&csum_1, (const uint8_t*)0x100003e2, 4); csum_inet_update(&csum_1, (const uint8_t*)0x100003e6, 4); uint16_t csum_1_chunk_2 = 0x1100; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_2, 2); uint16_t csum_1_chunk_3 = 0x800; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_3, 2); csum_inet_update(&csum_1, (const uint8_t*)0x10000406, 8); *(uint16_t*)0x1000040c = csum_inet_digest(&csum_1); struct csum_inet csum_2; csum_inet_init(&csum_2); csum_inet_update(&csum_2, (const uint8_t*)0x100003d6, 48); *(uint16_t*)0x100003e0 = csum_inet_digest(&csum_2); break; case 9: *(uint32_t*)0x100004c0 = 0; syscall(SYS_setgroups, 1, 0x100004c0); break; case 10: *(uint8_t*)0x10000000 = 0; *(uint8_t*)0x10000001 = 0; *(uint8_t*)0x10000002 = 0; *(uint8_t*)0x10000003 = 0; *(uint8_t*)0x10000004 = 0; *(uint8_t*)0x10000005 = 0; *(uint8_t*)0x10000006 = 0; *(uint8_t*)0x10000007 = 0; *(uint8_t*)0x10000008 = 0; *(uint8_t*)0x10000009 = 0; *(uint8_t*)0x1000000a = 0; *(uint8_t*)0x1000000b = 0; *(uint16_t*)0x1000000c = htobe16(0x86dd); STORE_BY_BITMASK(uint8_t, , 0x1000000e, 3, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x1000000e, 6, 4, 4); memcpy((void*)0x1000000f, "\x08\x21\x11", 3); *(uint16_t*)0x10000012 = htobe16(0x389); *(uint8_t*)0x10000014 = 0x6c; *(uint8_t*)0x10000015 = 0; *(uint8_t*)0x10000016 = 0; *(uint8_t*)0x10000017 = 0; *(uint8_t*)0x10000018 = 0; *(uint8_t*)0x10000019 = 0; *(uint8_t*)0x1000001a = 0; *(uint8_t*)0x1000001b = 0; *(uint8_t*)0x1000001c = 0; *(uint8_t*)0x1000001d = 0; *(uint8_t*)0x1000001e = 0; *(uint8_t*)0x1000001f = 0; *(uint8_t*)0x10000020 = -1; *(uint8_t*)0x10000021 = -1; *(uint32_t*)0x10000022 = htobe32(0xe0000002); *(uint64_t*)0x10000026 = htobe64(0); *(uint64_t*)0x1000002e = htobe64(1); *(uint8_t*)0x10000036 = 0x5e; *(uint8_t*)0x10000037 = 0x36; *(uint8_t*)0x10000038 = 0; *(uint8_t*)0x10000039 = 0; *(uint8_t*)0x1000003a = 0; *(uint8_t*)0x1000003b = 0; *(uint8_t*)0x1000003c = 0; *(uint8_t*)0x1000003d = 0; *(uint8_t*)0x1000003e = 0x79; *(uint8_t*)0x1000003f = 0x1a; memcpy((void*)0x10000040, "\x32\x25\x39\xdc\xe6\xc8\x60\xea\xe2\xe7\x17\xfe\x5d\x91\x9d\x50\xf1\x2d\xa8\xc2\x79\x0d\x7b\x77\x8b\xd5", 26); *(uint8_t*)0x1000005a = 5; *(uint8_t*)0x1000005b = 2; *(uint16_t*)0x1000005c = htobe16(7); *(uint8_t*)0x1000005e = 0; *(uint8_t*)0x1000005f = 1; *(uint8_t*)0x10000060 = 0; *(uint8_t*)0x10000061 = 1; *(uint8_t*)0x10000062 = 2; *(uint8_t*)0x10000063 = 0; *(uint8_t*)0x10000064 = 0; *(uint8_t*)0x10000065 = 8; *(uint8_t*)0x10000066 = 0xfa; memcpy((void*)0x10000067, "\xe2\xb0\xb2\x1d\x6f\x96\xa0\x12\xb7\x94\x79\x1a\x56\x4b\x79\x1a\x9b\x08\x76\xcc\x87\xa8\xe8\xdf\xcd\x42\x46\xac\xbd\x2e\x57\x62\x29\x84\x3f\x20\x6d\x42\xee\xc2\xb9\x9d\x4b\x6d\xb9\x3c\xa1\x5f\x41\xcc\x25\xad\xa1\x9e\x33\x8a\x97\x80\xc9\x60\x42\x10\x12\x95\x03\x07\xe6\x5d\xda\x08\x89\x3e\xb2\xf5\x64\x02\xae\xfb\xa1\x48\xc2\xf9\x55\x8d\x7a\x04\xf9\xe1\x35\x24\x7d\x1a\x8d\x04\x24\x62\x50\x45\x2d\x0f\x26\x3c\xf9\x0a\xa9\x8d\x56\x9e\xaa\x16\x83\x4e\xa0\x45\xe6\xda\xbc\xe8\x90\x6a\xc9\xaf\x25\xef\xb2\xe5\xbc\xc2\x4b\x0d\xea\xbd\x73\x19\xca\x60\x6a\x2e\x28\xb6\x58\xae\xa5\x94\x7a\x43\x07\x5c\x1f\x2e\xa5\x0c\xca\x8d\xd6\x3e\x0a\x87\x6b\x47\xf6\x02\x10\xb4\xe8\x24\x19\x41\xfa\x4c\xae\xf6\xcd\x78\x74\x10\xb6\x90\x0e\xc1\x17\x31\x4f\x6e\x71\xf7\x87\x4a\xd6\x74\x17\xe3\x3c\xc3\x19\xd6\x51\xf3\x5f\x08\xd1\x15\xc9\x13\x75\xa2\xdf\x16\x29\xb5\x3a\x49\xe6\xb0\x5e\xdf\xa0\xc3\x5e\xee\x07\xf8\xcb\xd9\x8f\xdf\xf7\x05\x0f\x59\x61\xec\x1c\xe4\x76\xb8\x1c\x38\x52\x91\x2f\xbe\x45\x19\x3a\xa0\x55\xa5\x7f\xb3", 250); *(uint8_t*)0x10000161 = 4; *(uint8_t*)0x10000162 = 1; *(uint8_t*)0x10000163 = 0xa1; *(uint8_t*)0x10000164 = 1; *(uint8_t*)0x10000165 = 3; *(uint8_t*)0x10000166 = 0; *(uint8_t*)0x10000167 = 0; *(uint8_t*)0x10000168 = 0; *(uint8_t*)0x10000169 = 0; *(uint8_t*)0x1000016a = 1; *(uint8_t*)0x1000016b = 0; *(uint8_t*)0x1000016c = 4; *(uint8_t*)0x1000016d = 0x7e; memcpy((void*)0x1000016e, "\x64\x22\xa7\xd8\x78\x76\x68\x9c\xee\xf9\x9a\x86\x21\xb2\xff\xc6\x4a\x04\x7f\x65\x2c\x39\xeb\x4b\x53\xe8\x45\x12\xa5\x58\x53\x99\x3f\xeb\x36\xf7\x73\x64\xf4\x7b\x75\x9b\xa0\x40\x02\xb9\xb1\x94\x17\x5c\x2f\x22\x37\xbc\xb1\x14\x86\xa5\xb8\xf1\xf2\x82\x04\x97\x38\x1a\x8c\xaf\xa0\x73\x9a\xe6\x23\x82\xe8\x3c\x7a\x2e\xd1\xbf\x16\xab\xd0\xe2\x67\x54\xe1\x2c\x85\xdc\x31\x76\x4c\x4c\xae\x57\x9a\x16\x3f\x11\xe5\x70\xe8\xa4\xda\xe7\x89\x4a\x55\xd7\x96\xe1\xe7\x66\x3c\x41\xc1\xc3\xc7\x4e\x89\x7b\x7a\x3f\x74\xa3", 126); *(uint8_t*)0x100001ec = 4; *(uint8_t*)0x100001ed = 1; *(uint8_t*)0x100001ee = 4; *(uint8_t*)0x100001f6 = 0x88; *(uint8_t*)0x100001f7 = 0; *(uint16_t*)0x100001f8 = htobe16(0); *(uint8_t*)0x100001fa = 0x33; *(uint8_t*)0x100001fb = 0; *(uint8_t*)0x100001fc = 0; *(uint8_t*)0x100001fd = 0; *(uint64_t*)0x100001fe = htobe64(0); *(uint64_t*)0x10000206 = htobe64(1); *(uint8_t*)0x1000020e = 0x18; *(uint8_t*)0x1000020f = 0x1f; memcpy((void*)0x10000210, "\x7a\xa7\x36\x34\xe6\xc6\x0c\xeb\x89\x30\xc5\xbc\x17\x2a\x27\x55\x0b\x25\x6d\xd3\x86\x37\x55\x7a\x7d\x83\xb9\x70\xff\xf6\x99\xff\xde\xfb\xaa\x07\xf0\x44\x7c\x8b\x93\xf9\x73\x25\x46\x2e\x51\x16\xd6\x99\x81\xda\x65\x36\xe2\x68\x7f\x53\x21\xf0\x69\x84\x30\x4f\x9a\xc3\x4f\x65\x94\xf5\x62\x86\x2f\x34\x08\xd7\xb4\xc5\x44\x3f\x15\xa8\xa8\x02\x09\xbb\x6b\x12\xb9\xaa\x87\xcc\x0c\xc0\x7c\x13\x8e\x81\x1e\x6e\xcd\xed\x6f\x5e\x61\xe7\x7c\x35\xdb\xa8\xb5\x58\x25\x8c\xb7\xa0\x84\x63\x8b\x56\x63\x18\xc5\x13\x76\x39\x32\x33\xa5\x35\xfd\x53\x22\x9c\x67\x4d\x82\xb4\x47\x71\xf4\x3a\xc0\x8d\xcb\xcd\x5f\xfd\x65\x85\x0d\x7e\xef\x8c\x21\xb3\x83\x21\xd3\x4e\xf6\xd1\xf6\x92\xcc\x66\xc8\x48\x03\x7c\xc6\x2d\x0c\xa2\x31\x3a\xd4\x36\xb1\x99\x52\xdf\x8c\x0a\x2e\xf9\x1e\xa7\x2b\x33\xfc\x3d\x62\xbd\xe2\x31\x86\x35\x39\x7c\xb5\x95\x85\x1d\x39\x31\x46\xd9\x59\x34\xdb\x89\x14\x64\xa9\x74\xbd\xf9\x09\xdc\xae\xfd\x40\xc3\x51\x05\xdd\x2a\x93\x9c\xa0\x27\x95\xc2\x90\xd2\x83\x46\xa7\x09\x66\x6e\x65\x66\x82\x14\x13\xfa\x08\xd4\xe6\x12\x1e", 253); *(uint8_t*)0x1000030d = 5; *(uint8_t*)0x1000030e = 0x16; memcpy((void*)0x1000030f, "\x2e\x4f\x2a\x94\xc9\x13\x37\x5e\x90\xa8\x9d\xd2\xdb\x52\x08\x22\x3b\x2e\xc7\xfc\x31\x68\xa4\xbd\xca\xe1\x79\x7b\x6d\x83\x1a\x4b\xa9\xcc\x91\xe0\xe3\xd1\x1c\x2e\xcf\xf4\x4e\x97\xdf\xe6\xb9\xb7\x92\x98\x5a\x0d\x2c\xb0\x83\xac\x59\xe2\x09\x79\x5e\x00\x93\x0d\x9b\xa4\xc6\xa1\x10\x91\x36\xac\xd0\x95\xfd\xfe\x74\x57\xf6\xe2\x7d\x0a\xa1\xbf\xef\x5d\x6d\x3e\x90\x43\xfb\xbc\x47\x50\xca\x91\xcd\x1b\x4b\xb6\xb8\xc1\xaf\x78\xff\x40\x1c\x76\x0d\x21\x50\x99\x4f\xbe\x3c\x5e\x66\xe5\xab\xbd\xf1\x4d\xbf\xe5\x79\x71\xfc\xdd\xab\xff\x8c\x34\xa1\x20\x77\x8e\x67\xf3\x8d\x62\xe7\x6d\xef\x1c\xad\xb1\x01\x3d\x2a\xab\x71\xbc\x3f\x3d\xcd\xca\xa0\x85\xd1\xdd\xb8\x5e\x52\xa2\xf2\xf5\xa7\xa8\x59\x05\x15\x51\x92\x93\x0f\x0b", 176); struct csum_inet csum_3; csum_inet_init(&csum_3); csum_inet_update(&csum_3, (const uint8_t*)0x10000016, 16); csum_inet_update(&csum_3, (const uint8_t*)0x10000026, 16); uint32_t csum_3_chunk_2 = 0xc9010000; csum_inet_update(&csum_3, (const uint8_t*)&csum_3_chunk_2, 4); uint32_t csum_3_chunk_3 = 0x3a000000; csum_inet_update(&csum_3, (const uint8_t*)&csum_3_chunk_3, 4); csum_inet_update(&csum_3, (const uint8_t*)0x100001f6, 457); *(uint16_t*)0x100001f8 = csum_inet_digest(&csum_3); break; case 11: memcpy((void*)0x100003c0, "\x0f\x01\xf9\x67\x66\x0f\xfd\xd9\xc4\xe1\x11\xf9\xdf\xc4\xe3\x15\x02\x5b\x71\x0b\x64\x0f\xae\xf7\x3e\x0f\x5b\xd1\xc0\x00\x48\xc4\xe3\x79\x14\xb4\x18\x07\x00\x00\x00\x69\xcf\x66\x0f\x13\x2e", 47); syz_execute_func(0x100003c0); break; case 12: break; } } int main(void) { syscall(SYS_mmap, 0x10000000, 0x1000000, 7, 0x1012, -1, 0); do_sandbox_none(); return 0; } :295:11: error: use of undeclared identifier 'SYS_copy_file_range' syscall(SYS_copy_file_range, 0xffffff9c, 0x10000140, (intptr_t)r[0], 0x10000180, 4ull, 0); ^ 1 error generated. compiler invocation: clang [-o /tmp/syz-executor313227868 -DGOOS_freebsd=1 -DGOARCH_386=1 -DHOSTGOOS_freebsd=1 -x c - -m32 -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -static -lc++ -Wno-overflow] --- FAIL: TestGenerate/freebsd/386/7 (2.83s) csource_test.go:121: --- FAIL: TestGenerate/freebsd/386/6 (2.93s) csource_test.go:121: --- FAIL: TestGenerate/freebsd/386/2 (2.59s) csource_test.go:123: opts: {Threaded:true Collide:true Repeat:true RepeatTimes:0 Procs:0 Sandbox:none Fault:false FaultCall:0 FaultNth:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false VhciInjection:false Wifi:false Sysctl:false UseTmpDir:true HandleSegv:false Repro:false Trace:false} program: fstat(0xffffffffffffff9c, &(0x7f0000000000)) r0 = socket$inet6_icmp_raw(0x1c, 0x3, 0x3a) setsockopt$inet6_tcp_TCP_FUNCTION_BLK(r0, 0x6, 0x2000, &(0x7f0000000100)={'bbr\x00', 0xfff}, 0x24) copy_file_range(0xffffffffffffff9c, &(0x7f0000000140)=0x9, r0, &(0x7f0000000180)=0x3f, 0x4, 0x0) getsockopt$inet_sctp_SCTP_EXPLICIT_EOR(0xffffffffffffffff, 0x84, 0x1b, &(0x7f00000001c0), &(0x7f0000000200)=0x4) getuid() getsockopt$inet_sctp_SCTP_STATUS(0xffffffffffffffff, 0x84, 0x100, &(0x7f0000000240)={0x0, 0x5, 0x2, 0xdd, 0x9, 0x7fff, 0x5, 0x1, {@in6={{0x1c, 0x1c, 0x3, 0x4, @local={0xfe, 0x80, [], 0x0}, 0x10000}}, 0x0, 0x9, 0xfffffff9, 0xdf10, 0x40, 0x8}}, &(0x7f0000000300)=0xac) getsockopt$inet6_sctp_SCTP_PR_ASSOC_STATUS(r0, 0x84, 0x108, &(0x7f0000000340)={r1, 0x9, 0x3, 0x1, 0x1}, &(0x7f0000000380)=0x18) syz_emit_ethernet(0xe3, &(0x7f00000003c0)={@random="558e866ec7c5", @broadcast, [{[{0x88a8, 0x0, 0x0, 0x1}], {0x8100, 0x0, 0x0, 0x4}}], {@ipv4={0x800, {{0xc, 0x4, 0x0, 0x8, 0xcd, 0x68, 0x1, 0x2, 0x1a, 0x0, @multicast2, @rand_addr, {[@ra={0x94, 0x6, 0x10000}, @lsrr={0x83, 0xb, 0x0, [@loopback, @empty]}, @generic={0x88, 0x9, "68b02e9aa55a8b"}]}}, @udp={{0x2, 0x3, 0x8}, {"1727313c0d121aaf942aba95b4aa8f3fab4a3f423c50b9f3207de073cd93e9d4abf4dd1bdea8b9e04ec83b0977c7094eca816b50fc613b6900642ed7c79867dfbfa2ee7e0da3bc0e15225c1f9e123c3983360a7a327e25ef286a9c45d8132c1c2201ecdb70ba3a3299d6680314428360ae3e57dcf3e15138710e151bad4503a78f71aae9accd796586c9b1fcfa620a259cc61014ef"}}}}}}) setgroups(0x1, &(0x7f00000004c0)=[0x0]) syz_emit_ethernet(0x3bf, &(0x7f0000000000)={@empty, @empty, [], {@ipv6={0x86dd, {0x3, 0x6, "082111", 0x389, 0x6c, 0x0, @ipv4={[], [], @multicast2}, @loopback, {[@dstopts={0x5e, 0x36, [], [@generic={0x79, 0x1a, "322539dce6c860eae2e717fe5d919d50f12da8c2790d7b778bd5"}, @ra={0x5, 0x2, 0x7}, @pad1, @padn={0x1, 0x2, [0x0, 0x0]}, @generic={0x8, 0xfa, "e2b0b21d6f96a012b794791a564b791a9b0876cc87a8e8dfcd4246acbd2e576229843f206d42eec2b99d4b6db93ca15f41cc25ada19e338a9780c960421012950307e65dda08893eb2f56402aefba148c2f9558d7a04f9e135247d1a8d04246250452d0f263cf90aa98d569eaa16834ea045e6dabce8906ac9af25efb2e5bcc24b0deabd7319ca606a2e28b658aea5947a43075c1f2ea50cca8dd63e0a876b47f60210b4e8241941fa4caef6cd787410b6900ec117314f6e71f7874ad67417e33cc319d651f35f08d115c91375a2df1629b53a49e6b05edfa0c35eee07f8cbd98fdff7050f5961ec1ce476b81c3852912fbe45193aa055a57fb3"}, @enc_lim={0x4, 0x1, 0xa1}, @padn={0x1, 0x3, [0x0, 0x0, 0x0]}, @pad1, @generic={0x4, 0x7e, "6422a7d87876689ceef99a8621b2ffc64a047f652c39eb4b53e84512a55853993feb36f77364f47b759ba04002b9b194175c2f2237bcb11486a5b8f1f2820497381a8cafa0739ae62382e83c7a2ed1bf16abd0e26754e12c85dc31764c4cae579a163f11e570e8a4dae7894a55d796e1e7663c41c1c3c74e897b7a3f74a3"}, @enc_lim={0x4, 0x1, 0x4}]}], @icmpv6=@ndisc_na={0x88, 0x0, 0x0, 0x33, [], @loopback, [{0x18, 0x1f, "7aa73634e6c60ceb8930c5bc172a27550b256dd38637557a7d83b970fff699ffdefbaa07f0447c8b93f97325462e5116d69981da6536e2687f5321f06984304f9ac34f6594f562862f3408d7b4c5443f15a8a80209bb6b12b9aa87cc0cc07c138e811e6ecded6f5e61e77c35dba8b558258cb7a084638b566318c51376393233a535fd53229c674d82b44771f43ac08dcbcd5ffd65850d7eef8c21b38321d34ef6d1f692cc66c848037cc62d0ca2313ad436b19952df8c0a2ef91ea72b33fc3d62bde2318635397cb595851d393146d95934db891464a974bdf909dcaefd40c35105dd2a939ca02795c290d28346a709666e6566821413fa08d4e6121e"}, {0x5, 0x16, "2e4f2a94c913375e90a89dd2db5208223b2ec7fc3168a4bdcae1797b6d831a4ba9cc91e0e3d11c2ecff44e97dfe6b9b792985a0d2cb083ac59e209795e00930d9ba4c6a1109136acd095fdfe7457f6e27d0aa1bfef5d6d3e9043fbbc4750ca91cd1b4bb6b8c1af78ff401c760d2150994fbe3c5e66e5abbdf14dbfe57971fcddabff8c34a120778e67f38d62e76def1cadb1013d2aab71bc3f3dcdcaa085d1ddb85e52a2f2f5a7a85905155192930f0b"}]}}}}}}) syz_execute_func(&(0x7f00000003c0)="0f01f967660ffdd9c4e111f9dfc4e315025b710b640faef73e0f5bd1c00048c4e37914b4180700000069cf660f132e") syz_extract_tcp_res(&(0x7f0000000400), 0x2, 0x67) csource_test.go:124: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void __attribute__((noinline)) remove_dir(const char* dir) { DIR* dp = opendir(dir); if (dp == NULL) { if (errno == EACCES) { if (rmdir(dir)) exit(1); return; } exit(1); } struct dirent* ep = 0; while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } if (unlink(filename)) exit(1); } closedir(dp); if (rmdir(dir)) exit(1); } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { pthread_mutex_t mu; pthread_cond_t cv; int state; } event_t; static void event_init(event_t* ev) { if (pthread_mutex_init(&ev->mu, 0)) exit(1); if (pthread_cond_init(&ev->cv, 0)) exit(1); ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { pthread_mutex_lock(&ev->mu); if (ev->state) exit(1); ev->state = 1; pthread_mutex_unlock(&ev->mu); pthread_cond_broadcast(&ev->cv); } static void event_wait(event_t* ev) { pthread_mutex_lock(&ev->mu); while (!ev->state) pthread_cond_wait(&ev->cv, &ev->mu); pthread_mutex_unlock(&ev->mu); } static int event_isset(event_t* ev) { pthread_mutex_lock(&ev->mu); int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; pthread_mutex_lock(&ev->mu); for (;;) { if (ev->state) break; uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); now = current_time_ms(); if (now - start > timeout) break; } int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } #define BITMASK(bf_off,bf_len) (((1ull << (bf_len)) - 1) << (bf_off)) #define STORE_BY_BITMASK(type,htobe,addr,val,bf_off,bf_len) *(type*)(addr) = htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len)))) struct csum_inet { uint32_t acc; }; static void csum_inet_init(struct csum_inet* csum) { csum->acc = 0; } static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) { if (length == 0) return; size_t i = 0; for (; i < length - 1; i += 2) csum->acc += *(uint16_t*)&data[i]; if (length & 1) csum->acc += le16toh((uint16_t)data[length - 1]); while (csum->acc > 0xffff) csum->acc = (csum->acc & 0xffff) + (csum->acc >> 16); } static uint16_t csum_inet_digest(struct csum_inet* csum) { return ~csum->acc; } static void sandbox_common() { struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 8 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 0; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); } static void loop(); static int do_sandbox_none(void) { sandbox_common(); loop(); return 0; } static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; int collide = 0; again: for (call = 0; call < 13; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (collide && (call % 2) == 0) break; event_timedwait(&th->done, 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 = 0; for (;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[2] = {0xffffffffffffffff, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: syscall(SYS_fstat, 0xffffff9c, 0x10000000); break; case 1: res = syscall(SYS_socket, 0x1c, 3, 0x3a); if (res != -1) r[0] = res; break; case 2: memcpy((void*)0x10000100, "bbr\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 32); *(uint32_t*)0x10000120 = 0xfff; syscall(SYS_setsockopt, (intptr_t)r[0], 6, 0x2000, 0x10000100, 0x24); break; case 3: *(uint64_t*)0x10000140 = 9; *(uint64_t*)0x10000180 = 0x3f; syscall(SYS_copy_file_range, 0xffffff9c, 0x10000140, (intptr_t)r[0], 0x10000180, 4ull, 0); break; case 4: *(uint32_t*)0x10000200 = 4; syscall(SYS_getsockopt, -1, 0x84, 0x1b, 0x100001c0, 0x10000200); break; case 5: syscall(SYS_getuid); break; case 6: *(uint32_t*)0x10000240 = 0; *(uint32_t*)0x10000244 = 5; *(uint32_t*)0x10000248 = 2; *(uint16_t*)0x1000024c = 0xdd; *(uint16_t*)0x1000024e = 9; *(uint16_t*)0x10000250 = 0x7fff; *(uint16_t*)0x10000252 = 5; *(uint32_t*)0x10000254 = 1; *(uint8_t*)0x10000258 = 0x1c; *(uint8_t*)0x10000259 = 0x1c; *(uint16_t*)0x1000025a = htobe16(0x4e23); *(uint32_t*)0x1000025c = 4; *(uint8_t*)0x10000260 = 0xfe; *(uint8_t*)0x10000261 = 0x80; *(uint8_t*)0x10000262 = 0; *(uint8_t*)0x10000263 = 0; *(uint8_t*)0x10000264 = 0; *(uint8_t*)0x10000265 = 0; *(uint8_t*)0x10000266 = 0; *(uint8_t*)0x10000267 = 0; *(uint8_t*)0x10000268 = 0; *(uint8_t*)0x10000269 = 0; *(uint8_t*)0x1000026a = 0; *(uint8_t*)0x1000026b = 0; *(uint8_t*)0x1000026c = 0; *(uint8_t*)0x1000026d = 0; *(uint8_t*)0x1000026e = 0; *(uint8_t*)0x1000026f = 0xaa; *(uint32_t*)0x10000270 = 0x10000; *(uint64_t*)0x10000274 = 0; *(uint64_t*)0x1000027c = 0; *(uint64_t*)0x10000284 = 0; *(uint64_t*)0x1000028c = 0; *(uint64_t*)0x10000294 = 0; *(uint64_t*)0x1000029c = 0; *(uint64_t*)0x100002a4 = 0; *(uint64_t*)0x100002ac = 0; *(uint64_t*)0x100002b4 = 0; *(uint64_t*)0x100002bc = 0; *(uint64_t*)0x100002c4 = 0; *(uint64_t*)0x100002cc = 0; *(uint32_t*)0x100002d4 = 0; *(uint32_t*)0x100002d8 = 9; *(uint32_t*)0x100002dc = 0xfffffff9; *(uint32_t*)0x100002e0 = 0xdf10; *(uint32_t*)0x100002e4 = 0x40; *(uint32_t*)0x100002e8 = 8; *(uint32_t*)0x10000300 = 0xac; res = syscall(SYS_getsockopt, -1, 0x84, 0x100, 0x10000240, 0x10000300); if (res != -1) r[1] = *(uint32_t*)0x100002d4; break; case 7: *(uint32_t*)0x10000340 = r[1]; *(uint16_t*)0x10000344 = 9; *(uint16_t*)0x10000346 = 3; *(uint64_t*)0x10000348 = 1; *(uint64_t*)0x10000350 = 1; *(uint32_t*)0x10000380 = 0x18; syscall(SYS_getsockopt, (intptr_t)r[0], 0x84, 0x108, 0x10000340, 0x10000380); break; case 8: memcpy((void*)0x100003c0, "\x55\x8e\x86\x6e\xc7\xc5", 6); *(uint8_t*)0x100003c6 = -1; *(uint8_t*)0x100003c7 = -1; *(uint8_t*)0x100003c8 = -1; *(uint8_t*)0x100003c9 = -1; *(uint8_t*)0x100003ca = -1; *(uint8_t*)0x100003cb = -1; *(uint16_t*)0x100003cc = htobe16(0x88a8); STORE_BY_BITMASK(uint16_t, , 0x100003ce, 0, 0, 3); STORE_BY_BITMASK(uint16_t, , 0x100003ce, 0, 3, 1); STORE_BY_BITMASK(uint16_t, , 0x100003ce, 1, 4, 12); *(uint16_t*)0x100003d0 = htobe16(0x8100); STORE_BY_BITMASK(uint16_t, , 0x100003d2, 0, 0, 3); STORE_BY_BITMASK(uint16_t, , 0x100003d2, 0, 3, 1); STORE_BY_BITMASK(uint16_t, , 0x100003d2, 4, 4, 12); *(uint16_t*)0x100003d4 = htobe16(0x800); STORE_BY_BITMASK(uint8_t, , 0x100003d6, 0xc, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x100003d6, 4, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x100003d7, 0, 0, 2); STORE_BY_BITMASK(uint8_t, , 0x100003d7, 8, 2, 6); *(uint16_t*)0x100003d8 = htobe16(0xcd); *(uint16_t*)0x100003da = htobe16(0x68); *(uint16_t*)0x100003dc = htobe16(1); *(uint8_t*)0x100003de = 2; *(uint8_t*)0x100003df = 0x1a; *(uint16_t*)0x100003e0 = htobe16(0); *(uint32_t*)0x100003e2 = htobe32(0xe0000002); *(uint32_t*)0x100003e6 = htobe32(0); *(uint8_t*)0x100003ea = 0x94; *(uint8_t*)0x100003eb = 6; *(uint32_t*)0x100003ec = htobe32(0x10000); *(uint8_t*)0x100003f0 = 0x83; *(uint8_t*)0x100003f1 = 0xb; *(uint8_t*)0x100003f2 = 0; *(uint32_t*)0x100003f3 = htobe32(0x7f000001); *(uint32_t*)0x100003f7 = htobe32(0); *(uint8_t*)0x100003fb = 0x88; *(uint8_t*)0x100003fc = 9; memcpy((void*)0x100003fd, "\x68\xb0\x2e\x9a\xa5\x5a\x8b", 7); *(uint16_t*)0x10000406 = htobe16(0x4e22); *(uint16_t*)0x10000408 = htobe16(0x4e23); *(uint16_t*)0x1000040a = htobe16(8); *(uint16_t*)0x1000040c = htobe16(0); memcpy((void*)0x1000040e, "\x17\x27\x31\x3c\x0d\x12\x1a\xaf\x94\x2a\xba\x95\xb4\xaa\x8f\x3f\xab\x4a\x3f\x42\x3c\x50\xb9\xf3\x20\x7d\xe0\x73\xcd\x93\xe9\xd4\xab\xf4\xdd\x1b\xde\xa8\xb9\xe0\x4e\xc8\x3b\x09\x77\xc7\x09\x4e\xca\x81\x6b\x50\xfc\x61\x3b\x69\x00\x64\x2e\xd7\xc7\x98\x67\xdf\xbf\xa2\xee\x7e\x0d\xa3\xbc\x0e\x15\x22\x5c\x1f\x9e\x12\x3c\x39\x83\x36\x0a\x7a\x32\x7e\x25\xef\x28\x6a\x9c\x45\xd8\x13\x2c\x1c\x22\x01\xec\xdb\x70\xba\x3a\x32\x99\xd6\x68\x03\x14\x42\x83\x60\xae\x3e\x57\xdc\xf3\xe1\x51\x38\x71\x0e\x15\x1b\xad\x45\x03\xa7\x8f\x71\xaa\xe9\xac\xcd\x79\x65\x86\xc9\xb1\xfc\xfa\x62\x0a\x25\x9c\xc6\x10\x14\xef", 149); struct csum_inet csum_1; csum_inet_init(&csum_1); csum_inet_update(&csum_1, (const uint8_t*)0x100003e2, 4); csum_inet_update(&csum_1, (const uint8_t*)0x100003e6, 4); uint16_t csum_1_chunk_2 = 0x1100; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_2, 2); uint16_t csum_1_chunk_3 = 0x800; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_3, 2); csum_inet_update(&csum_1, (const uint8_t*)0x10000406, 8); *(uint16_t*)0x1000040c = csum_inet_digest(&csum_1); struct csum_inet csum_2; csum_inet_init(&csum_2); csum_inet_update(&csum_2, (const uint8_t*)0x100003d6, 48); *(uint16_t*)0x100003e0 = csum_inet_digest(&csum_2); break; case 9: *(uint32_t*)0x100004c0 = 0; syscall(SYS_setgroups, 1, 0x100004c0); break; case 10: *(uint8_t*)0x10000000 = 0; *(uint8_t*)0x10000001 = 0; *(uint8_t*)0x10000002 = 0; *(uint8_t*)0x10000003 = 0; *(uint8_t*)0x10000004 = 0; *(uint8_t*)0x10000005 = 0; *(uint8_t*)0x10000006 = 0; *(uint8_t*)0x10000007 = 0; *(uint8_t*)0x10000008 = 0; *(uint8_t*)0x10000009 = 0; *(uint8_t*)0x1000000a = 0; *(uint8_t*)0x1000000b = 0; *(uint16_t*)0x1000000c = htobe16(0x86dd); STORE_BY_BITMASK(uint8_t, , 0x1000000e, 3, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x1000000e, 6, 4, 4); memcpy((void*)0x1000000f, "\x08\x21\x11", 3); *(uint16_t*)0x10000012 = htobe16(0x389); *(uint8_t*)0x10000014 = 0x6c; *(uint8_t*)0x10000015 = 0; *(uint8_t*)0x10000016 = 0; *(uint8_t*)0x10000017 = 0; *(uint8_t*)0x10000018 = 0; *(uint8_t*)0x10000019 = 0; *(uint8_t*)0x1000001a = 0; *(uint8_t*)0x1000001b = 0; *(uint8_t*)0x1000001c = 0; *(uint8_t*)0x1000001d = 0; *(uint8_t*)0x1000001e = 0; *(uint8_t*)0x1000001f = 0; *(uint8_t*)0x10000020 = -1; *(uint8_t*)0x10000021 = -1; *(uint32_t*)0x10000022 = htobe32(0xe0000002); *(uint64_t*)0x10000026 = htobe64(0); *(uint64_t*)0x1000002e = htobe64(1); *(uint8_t*)0x10000036 = 0x5e; *(uint8_t*)0x10000037 = 0x36; *(uint8_t*)0x10000038 = 0; *(uint8_t*)0x10000039 = 0; *(uint8_t*)0x1000003a = 0; *(uint8_t*)0x1000003b = 0; *(uint8_t*)0x1000003c = 0; *(uint8_t*)0x1000003d = 0; *(uint8_t*)0x1000003e = 0x79; *(uint8_t*)0x1000003f = 0x1a; memcpy((void*)0x10000040, "\x32\x25\x39\xdc\xe6\xc8\x60\xea\xe2\xe7\x17\xfe\x5d\x91\x9d\x50\xf1\x2d\xa8\xc2\x79\x0d\x7b\x77\x8b\xd5", 26); *(uint8_t*)0x1000005a = 5; *(uint8_t*)0x1000005b = 2; *(uint16_t*)0x1000005c = htobe16(7); *(uint8_t*)0x1000005e = 0; *(uint8_t*)0x1000005f = 1; *(uint8_t*)0x10000060 = 0; *(uint8_t*)0x10000061 = 1; *(uint8_t*)0x10000062 = 2; *(uint8_t*)0x10000063 = 0; *(uint8_t*)0x10000064 = 0; *(uint8_t*)0x10000065 = 8; *(uint8_t*)0x10000066 = 0xfa; memcpy((void*)0x10000067, "\xe2\xb0\xb2\x1d\x6f\x96\xa0\x12\xb7\x94\x79\x1a\x56\x4b\x79\x1a\x9b\x08\x76\xcc\x87\xa8\xe8\xdf\xcd\x42\x46\xac\xbd\x2e\x57\x62\x29\x84\x3f\x20\x6d\x42\xee\xc2\xb9\x9d\x4b\x6d\xb9\x3c\xa1\x5f\x41\xcc\x25\xad\xa1\x9e\x33\x8a\x97\x80\xc9\x60\x42\x10\x12\x95\x03\x07\xe6\x5d\xda\x08\x89\x3e\xb2\xf5\x64\x02\xae\xfb\xa1\x48\xc2\xf9\x55\x8d\x7a\x04\xf9\xe1\x35\x24\x7d\x1a\x8d\x04\x24\x62\x50\x45\x2d\x0f\x26\x3c\xf9\x0a\xa9\x8d\x56\x9e\xaa\x16\x83\x4e\xa0\x45\xe6\xda\xbc\xe8\x90\x6a\xc9\xaf\x25\xef\xb2\xe5\xbc\xc2\x4b\x0d\xea\xbd\x73\x19\xca\x60\x6a\x2e\x28\xb6\x58\xae\xa5\x94\x7a\x43\x07\x5c\x1f\x2e\xa5\x0c\xca\x8d\xd6\x3e\x0a\x87\x6b\x47\xf6\x02\x10\xb4\xe8\x24\x19\x41\xfa\x4c\xae\xf6\xcd\x78\x74\x10\xb6\x90\x0e\xc1\x17\x31\x4f\x6e\x71\xf7\x87\x4a\xd6\x74\x17\xe3\x3c\xc3\x19\xd6\x51\xf3\x5f\x08\xd1\x15\xc9\x13\x75\xa2\xdf\x16\x29\xb5\x3a\x49\xe6\xb0\x5e\xdf\xa0\xc3\x5e\xee\x07\xf8\xcb\xd9\x8f\xdf\xf7\x05\x0f\x59\x61\xec\x1c\xe4\x76\xb8\x1c\x38\x52\x91\x2f\xbe\x45\x19\x3a\xa0\x55\xa5\x7f\xb3", 250); *(uint8_t*)0x10000161 = 4; *(uint8_t*)0x10000162 = 1; *(uint8_t*)0x10000163 = 0xa1; *(uint8_t*)0x10000164 = 1; *(uint8_t*)0x10000165 = 3; *(uint8_t*)0x10000166 = 0; *(uint8_t*)0x10000167 = 0; *(uint8_t*)0x10000168 = 0; *(uint8_t*)0x10000169 = 0; *(uint8_t*)0x1000016a = 1; *(uint8_t*)0x1000016b = 0; *(uint8_t*)0x1000016c = 4; *(uint8_t*)0x1000016d = 0x7e; memcpy((void*)0x1000016e, "\x64\x22\xa7\xd8\x78\x76\x68\x9c\xee\xf9\x9a\x86\x21\xb2\xff\xc6\x4a\x04\x7f\x65\x2c\x39\xeb\x4b\x53\xe8\x45\x12\xa5\x58\x53\x99\x3f\xeb\x36\xf7\x73\x64\xf4\x7b\x75\x9b\xa0\x40\x02\xb9\xb1\x94\x17\x5c\x2f\x22\x37\xbc\xb1\x14\x86\xa5\xb8\xf1\xf2\x82\x04\x97\x38\x1a\x8c\xaf\xa0\x73\x9a\xe6\x23\x82\xe8\x3c\x7a\x2e\xd1\xbf\x16\xab\xd0\xe2\x67\x54\xe1\x2c\x85\xdc\x31\x76\x4c\x4c\xae\x57\x9a\x16\x3f\x11\xe5\x70\xe8\xa4\xda\xe7\x89\x4a\x55\xd7\x96\xe1\xe7\x66\x3c\x41\xc1\xc3\xc7\x4e\x89\x7b\x7a\x3f\x74\xa3", 126); *(uint8_t*)0x100001ec = 4; *(uint8_t*)0x100001ed = 1; *(uint8_t*)0x100001ee = 4; *(uint8_t*)0x100001f6 = 0x88; *(uint8_t*)0x100001f7 = 0; *(uint16_t*)0x100001f8 = htobe16(0); *(uint8_t*)0x100001fa = 0x33; *(uint8_t*)0x100001fb = 0; *(uint8_t*)0x100001fc = 0; *(uint8_t*)0x100001fd = 0; *(uint64_t*)0x100001fe = htobe64(0); *(uint64_t*)0x10000206 = htobe64(1); *(uint8_t*)0x1000020e = 0x18; *(uint8_t*)0x1000020f = 0x1f; memcpy((void*)0x10000210, "\x7a\xa7\x36\x34\xe6\xc6\x0c\xeb\x89\x30\xc5\xbc\x17\x2a\x27\x55\x0b\x25\x6d\xd3\x86\x37\x55\x7a\x7d\x83\xb9\x70\xff\xf6\x99\xff\xde\xfb\xaa\x07\xf0\x44\x7c\x8b\x93\xf9\x73\x25\x46\x2e\x51\x16\xd6\x99\x81\xda\x65\x36\xe2\x68\x7f\x53\x21\xf0\x69\x84\x30\x4f\x9a\xc3\x4f\x65\x94\xf5\x62\x86\x2f\x34\x08\xd7\xb4\xc5\x44\x3f\x15\xa8\xa8\x02\x09\xbb\x6b\x12\xb9\xaa\x87\xcc\x0c\xc0\x7c\x13\x8e\x81\x1e\x6e\xcd\xed\x6f\x5e\x61\xe7\x7c\x35\xdb\xa8\xb5\x58\x25\x8c\xb7\xa0\x84\x63\x8b\x56\x63\x18\xc5\x13\x76\x39\x32\x33\xa5\x35\xfd\x53\x22\x9c\x67\x4d\x82\xb4\x47\x71\xf4\x3a\xc0\x8d\xcb\xcd\x5f\xfd\x65\x85\x0d\x7e\xef\x8c\x21\xb3\x83\x21\xd3\x4e\xf6\xd1\xf6\x92\xcc\x66\xc8\x48\x03\x7c\xc6\x2d\x0c\xa2\x31\x3a\xd4\x36\xb1\x99\x52\xdf\x8c\x0a\x2e\xf9\x1e\xa7\x2b\x33\xfc\x3d\x62\xbd\xe2\x31\x86\x35\x39\x7c\xb5\x95\x85\x1d\x39\x31\x46\xd9\x59\x34\xdb\x89\x14\x64\xa9\x74\xbd\xf9\x09\xdc\xae\xfd\x40\xc3\x51\x05\xdd\x2a\x93\x9c\xa0\x27\x95\xc2\x90\xd2\x83\x46\xa7\x09\x66\x6e\x65\x66\x82\x14\x13\xfa\x08\xd4\xe6\x12\x1e", 253); *(uint8_t*)0x1000030d = 5; *(uint8_t*)0x1000030e = 0x16; memcpy((void*)0x1000030f, "\x2e\x4f\x2a\x94\xc9\x13\x37\x5e\x90\xa8\x9d\xd2\xdb\x52\x08\x22\x3b\x2e\xc7\xfc\x31\x68\xa4\xbd\xca\xe1\x79\x7b\x6d\x83\x1a\x4b\xa9\xcc\x91\xe0\xe3\xd1\x1c\x2e\xcf\xf4\x4e\x97\xdf\xe6\xb9\xb7\x92\x98\x5a\x0d\x2c\xb0\x83\xac\x59\xe2\x09\x79\x5e\x00\x93\x0d\x9b\xa4\xc6\xa1\x10\x91\x36\xac\xd0\x95\xfd\xfe\x74\x57\xf6\xe2\x7d\x0a\xa1\xbf\xef\x5d\x6d\x3e\x90\x43\xfb\xbc\x47\x50\xca\x91\xcd\x1b\x4b\xb6\xb8\xc1\xaf\x78\xff\x40\x1c\x76\x0d\x21\x50\x99\x4f\xbe\x3c\x5e\x66\xe5\xab\xbd\xf1\x4d\xbf\xe5\x79\x71\xfc\xdd\xab\xff\x8c\x34\xa1\x20\x77\x8e\x67\xf3\x8d\x62\xe7\x6d\xef\x1c\xad\xb1\x01\x3d\x2a\xab\x71\xbc\x3f\x3d\xcd\xca\xa0\x85\xd1\xdd\xb8\x5e\x52\xa2\xf2\xf5\xa7\xa8\x59\x05\x15\x51\x92\x93\x0f\x0b", 176); struct csum_inet csum_3; csum_inet_init(&csum_3); csum_inet_update(&csum_3, (const uint8_t*)0x10000016, 16); csum_inet_update(&csum_3, (const uint8_t*)0x10000026, 16); uint32_t csum_3_chunk_2 = 0xc9010000; csum_inet_update(&csum_3, (const uint8_t*)&csum_3_chunk_2, 4); uint32_t csum_3_chunk_3 = 0x3a000000; csum_inet_update(&csum_3, (const uint8_t*)&csum_3_chunk_3, 4); csum_inet_update(&csum_3, (const uint8_t*)0x100001f6, 457); *(uint16_t*)0x100001f8 = csum_inet_digest(&csum_3); break; case 11: memcpy((void*)0x100003c0, "\x0f\x01\xf9\x67\x66\x0f\xfd\xd9\xc4\xe1\x11\xf9\xdf\xc4\xe3\x15\x02\x5b\x71\x0b\x64\x0f\xae\xf7\x3e\x0f\x5b\xd1\xc0\x00\x48\xc4\xe3\x79\x14\xb4\x18\x07\x00\x00\x00\x69\xcf\x66\x0f\x13\x2e", 47); syz_execute_func(0x100003c0); break; case 12: 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_copy_file_range' syscall(SYS_copy_file_range, 0xffffff9c, 0x10000140, (intptr_t)r[0], 0x10000180, 4ull, 0); ^ 1 error generated. compiler invocation: clang [-o /tmp/syz-executor960890891 -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 (2.84s) csource_test.go:121: --- FAIL: TestGenerate/freebsd/386/1 (1.83s) csource_test.go:121: --- FAIL: TestGenerate/freebsd/386/3 (2.05s) csource_test.go:121: FAIL FAIL github.com/google/syzkaller/pkg/csource 13.957s ok github.com/google/syzkaller/pkg/db (cached) ? github.com/google/syzkaller/pkg/debugtracer [no test files] ok github.com/google/syzkaller/pkg/email (cached) ? github.com/google/syzkaller/pkg/gce [no test files] ? github.com/google/syzkaller/pkg/gcs [no test files] ? github.com/google/syzkaller/pkg/hash [no test files] ok github.com/google/syzkaller/pkg/host 0.907s ? github.com/google/syzkaller/pkg/html [no test files] ok github.com/google/syzkaller/pkg/ifuzz (cached) ? github.com/google/syzkaller/pkg/ifuzz/iset [no test files] ? github.com/google/syzkaller/pkg/ifuzz/powerpc [no test files] ? github.com/google/syzkaller/pkg/ifuzz/powerpc/generated [no test files] ? github.com/google/syzkaller/pkg/ifuzz/x86 [no test files] ? github.com/google/syzkaller/pkg/ifuzz/x86/gen [no test files] ? github.com/google/syzkaller/pkg/ifuzz/x86/generated [no test files] ok github.com/google/syzkaller/pkg/instance 0.999s ok github.com/google/syzkaller/pkg/ipc 3.509s ? github.com/google/syzkaller/pkg/ipc/ipcconfig [no test files] ? github.com/google/syzkaller/pkg/kcidb [no test files] ok github.com/google/syzkaller/pkg/kconfig 0.051s ok github.com/google/syzkaller/pkg/kd (cached) ok github.com/google/syzkaller/pkg/log (cached) ok github.com/google/syzkaller/pkg/mgrconfig (cached) ok github.com/google/syzkaller/pkg/osutil (cached) ok github.com/google/syzkaller/pkg/report (cached) ok github.com/google/syzkaller/pkg/repro (cached) ? github.com/google/syzkaller/pkg/rpctype [no test files] ok github.com/google/syzkaller/pkg/runtest 64.381s ok github.com/google/syzkaller/pkg/serializer (cached) ? github.com/google/syzkaller/pkg/signal [no test files] ok github.com/google/syzkaller/pkg/symbolizer 0.287s ok github.com/google/syzkaller/pkg/tool (cached) ok github.com/google/syzkaller/pkg/vcs 7.451s ok github.com/google/syzkaller/prog (cached) ok github.com/google/syzkaller/prog/test (cached) ? github.com/google/syzkaller/sys [no test files] ? github.com/google/syzkaller/sys/akaros [no test files] ? github.com/google/syzkaller/sys/akaros/gen [no test files] ? github.com/google/syzkaller/sys/freebsd [no test files] ? github.com/google/syzkaller/sys/freebsd/gen [no test files] ? github.com/google/syzkaller/sys/fuchsia [no test files] ? github.com/google/syzkaller/sys/fuchsia/fidlgen [no test files] ? github.com/google/syzkaller/sys/fuchsia/gen [no test files] ? github.com/google/syzkaller/sys/fuchsia/layout [no test files] ok github.com/google/syzkaller/sys/linux (cached) ? github.com/google/syzkaller/sys/linux/gen [no test files] ? github.com/google/syzkaller/sys/netbsd [no test files] ? github.com/google/syzkaller/sys/netbsd/gen [no test files] ok github.com/google/syzkaller/sys/openbsd (cached) ? github.com/google/syzkaller/sys/openbsd/gen [no test files] ? github.com/google/syzkaller/sys/syz-extract [no test files] ? github.com/google/syzkaller/sys/syz-sysgen [no test files] ? github.com/google/syzkaller/sys/targets [no test files] ? github.com/google/syzkaller/sys/test [no test files] ? github.com/google/syzkaller/sys/test/gen [no test files] ? github.com/google/syzkaller/sys/trusty [no test files] ? github.com/google/syzkaller/sys/trusty/gen [no test files] ? github.com/google/syzkaller/sys/windows [no test files] ? github.com/google/syzkaller/sys/windows/gen [no test files] ok github.com/google/syzkaller/syz-ci (cached) ok github.com/google/syzkaller/syz-fuzzer (cached) ok github.com/google/syzkaller/syz-hub (cached) ok github.com/google/syzkaller/syz-hub/state (cached) ok github.com/google/syzkaller/syz-manager 0.897s ? 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-hubtool [no test files] ? github.com/google/syzkaller/tools/syz-kcidb [no test files] ? github.com/google/syzkaller/tools/syz-kconf [no test files] ok github.com/google/syzkaller/tools/syz-linter 4.623s ? github.com/google/syzkaller/tools/syz-make [no test files] ? github.com/google/syzkaller/tools/syz-minconfig [no test files] ? github.com/google/syzkaller/tools/syz-mutate [no test files] ? github.com/google/syzkaller/tools/syz-prog2c [no test files] ? github.com/google/syzkaller/tools/syz-reporter [no test files] ? github.com/google/syzkaller/tools/syz-repro [no test files] ? github.com/google/syzkaller/tools/syz-reprolist [no test files] ? github.com/google/syzkaller/tools/syz-runtest [no test files] ? github.com/google/syzkaller/tools/syz-showprio [no test files] ? github.com/google/syzkaller/tools/syz-stress [no test files] ? github.com/google/syzkaller/tools/syz-symbolize [no test files] ? github.com/google/syzkaller/tools/syz-testbuild [no test files] ? github.com/google/syzkaller/tools/syz-trace2syz [no test files] ok github.com/google/syzkaller/tools/syz-trace2syz/parser (cached) ok github.com/google/syzkaller/tools/syz-trace2syz/proggen (cached) ? github.com/google/syzkaller/tools/syz-tty [no test files] ? github.com/google/syzkaller/tools/syz-upgrade [no test files] ? github.com/google/syzkaller/tools/syz-usbgen [no test files] ok github.com/google/syzkaller/vm (cached) ? github.com/google/syzkaller/vm/adb [no test files] ? github.com/google/syzkaller/vm/bhyve [no test files] ? github.com/google/syzkaller/vm/gce [no test files] ? github.com/google/syzkaller/vm/gvisor [no test files] ok github.com/google/syzkaller/vm/isolated (cached) ? github.com/google/syzkaller/vm/kvm [no test files] ? github.com/google/syzkaller/vm/odroid [no test files] ? github.com/google/syzkaller/vm/qemu [no test files] ok github.com/google/syzkaller/vm/vmimpl (cached) ? github.com/google/syzkaller/vm/vmm [no test files] ? github.com/google/syzkaller/vm/vmware [no test files] FAIL