// https://syzkaller.appspot.com/bug?id=abb6cc54bd2802dfdeb0978f7adf870325b80f92 // autogenerated by syzkaller (http://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include __attribute__((noreturn)) static void doexit(int status) { volatile unsigned i; syscall(__NR_exit_group, status); for (i = 0;; i++) { } } #include #include #include #include #include #include #include #include #include #include const int kFailStatus = 67; const int kRetryStatus = 69; static void fail(const char* msg, ...) { int e = errno; va_list args; va_start(args, msg); vfprintf(stderr, msg, args); va_end(args); fprintf(stderr, " (errno %d)\n", e); doexit((e == ENOMEM || e == EAGAIN) ? kRetryStatus : kFailStatus); } static void exitf(const char* msg, ...) { int e = errno; va_list args; va_start(args, msg); vfprintf(stderr, msg, args); va_end(args); fprintf(stderr, " (errno %d)\n", e); doexit(kRetryStatus); } static __thread int skip_segv; static __thread jmp_buf segv_env; static void segv_handler(int sig, siginfo_t* info, void* uctx) { uintptr_t addr = (uintptr_t)info->si_addr; const uintptr_t prog_start = 1 << 20; const uintptr_t prog_end = 100 << 20; if (__atomic_load_n(&skip_segv, __ATOMIC_RELAXED) && (addr < prog_start || addr > prog_end)) { _longjmp(segv_env, 1); } doexit(sig); for (;;) { } } static void install_segv_handler() { struct sigaction sa; memset(&sa, 0, sizeof(sa)); sa.sa_handler = SIG_IGN; syscall(SYS_rt_sigaction, 0x20, &sa, NULL, 8); syscall(SYS_rt_sigaction, 0x21, &sa, NULL, 8); memset(&sa, 0, sizeof(sa)); sa.sa_sigaction = segv_handler; sa.sa_flags = SA_NODEFER | SA_SIGINFO; sigaction(SIGSEGV, &sa, NULL); sigaction(SIGBUS, &sa, NULL); } #define NONFAILING(...) \ { \ __atomic_fetch_add(&skip_segv, 1, __ATOMIC_SEQ_CST); \ if (_setjmp(segv_env) == 0) { \ __VA_ARGS__; \ } \ __atomic_fetch_sub(&skip_segv, 1, __ATOMIC_SEQ_CST); \ } static uint64_t current_time_ms() { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) fail("clock_gettime failed"); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir() { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) fail("failed to mkdtemp"); if (chmod(tmpdir, 0777)) fail("failed to chmod"); if (chdir(tmpdir)) fail("failed to chdir"); } static void vsnprintf_check(char* str, size_t size, const char* format, va_list args) { int rv; rv = vsnprintf(str, size, format, args); if (rv < 0) fail("tun: snprintf failed"); if ((size_t)rv >= size) fail("tun: string '%s...' doesn't fit into buffer", str); } 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(const char* format, ...) { va_list args; char command[PATH_PREFIX_LEN + COMMAND_MAX_LEN]; int rv; va_start(args, format); memcpy(command, PATH_PREFIX, PATH_PREFIX_LEN); vsnprintf_check(command + PATH_PREFIX_LEN, COMMAND_MAX_LEN, format, args); rv = system(command); if (rv != 0) fail("tun: command \"%s\" failed with code %d", &command[0], rv); va_end(args); } static int tunfd = -1; static int tun_frags_enabled; #define SYZ_TUN_MAX_PACKET_SIZE 1000 #define MAX_PIDS 32 #define ADDR_MAX_LEN 32 #define LOCAL_MAC "aa:aa:aa:aa:aa:%02hx" #define REMOTE_MAC "bb:bb:bb:bb:bb:%02hx" #define LOCAL_IPV4 "172.20.%d.170" #define REMOTE_IPV4 "172.20.%d.187" #define LOCAL_IPV6 "fe80::%02hxaa" #define REMOTE_IPV6 "fe80::%02hxbb" #define IFF_NAPI 0x0010 #define IFF_NAPI_FRAGS 0x0020 static void initialize_tun(uint64_t pid) { if (pid >= MAX_PIDS) fail("tun: no more than %d executors", MAX_PIDS); int id = pid; tunfd = open("/dev/net/tun", O_RDWR | O_NONBLOCK); if (tunfd == -1) { printf( "tun: can't open /dev/net/tun: please enable CONFIG_TUN=y\n"); printf("otherwise fuzzing or reproducing might not work as " "intended\n"); return; } char iface[IFNAMSIZ]; snprintf_check(iface, sizeof(iface), "syz%d", id); struct ifreq ifr; memset(&ifr, 0, sizeof(ifr)); strncpy(ifr.ifr_name, iface, IFNAMSIZ); ifr.ifr_flags = IFF_TAP | IFF_NO_PI | IFF_NAPI | IFF_NAPI_FRAGS; if (ioctl(tunfd, TUNSETIFF, (void*)&ifr) < 0) { ifr.ifr_flags = IFF_TAP | IFF_NO_PI; if (ioctl(tunfd, TUNSETIFF, (void*)&ifr) < 0) fail("tun: ioctl(TUNSETIFF) failed"); } if (ioctl(tunfd, TUNGETIFF, (void*)&ifr) < 0) fail("tun: ioctl(TUNGETIFF) failed"); tun_frags_enabled = (ifr.ifr_flags & IFF_NAPI_FRAGS) != 0; char local_mac[ADDR_MAX_LEN]; snprintf_check(local_mac, sizeof(local_mac), LOCAL_MAC, id); char remote_mac[ADDR_MAX_LEN]; snprintf_check(remote_mac, sizeof(remote_mac), REMOTE_MAC, id); char local_ipv4[ADDR_MAX_LEN]; snprintf_check(local_ipv4, sizeof(local_ipv4), LOCAL_IPV4, id); char remote_ipv4[ADDR_MAX_LEN]; snprintf_check(remote_ipv4, sizeof(remote_ipv4), REMOTE_IPV4, id); char local_ipv6[ADDR_MAX_LEN]; snprintf_check(local_ipv6, sizeof(local_ipv6), LOCAL_IPV6, id); char remote_ipv6[ADDR_MAX_LEN]; snprintf_check(remote_ipv6, sizeof(remote_ipv6), REMOTE_IPV6, id); execute_command("sysctl -w net.ipv6.conf.%s.accept_dad=0", iface); execute_command("sysctl -w net.ipv6.conf.%s.router_solicitations=0", iface); execute_command("ip link set dev %s address %s", iface, local_mac); execute_command("ip addr add %s/24 dev %s", local_ipv4, iface); execute_command("ip -6 addr add %s/120 dev %s", local_ipv6, iface); execute_command("ip neigh add %s lladdr %s dev %s nud permanent", remote_ipv4, remote_mac, iface); execute_command("ip -6 neigh add %s lladdr %s dev %s nud permanent", remote_ipv6, remote_mac, iface); execute_command("ip link set dev %s up", iface); } static void setup_tun(uint64_t pid, bool enable_tun) { if (enable_tun) initialize_tun(pid); } 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; if (errno == EBADFD) return -1; fail("tun: read failed with %d", rv); } return rv; } static void flush_tun() { char data[SYZ_TUN_MAX_PACKET_SIZE]; while (read_tun(&data[0], sizeof(data)) != -1) ; } static uintptr_t syz_open_dev(uintptr_t a0, uintptr_t a1, uintptr_t a2) { if (a0 == 0xc || a0 == 0xb) { char buf[128]; sprintf(buf, "/dev/%s/%d:%d", a0 == 0xc ? "char" : "block", (uint8_t)a1, (uint8_t)a2); return open(buf, O_RDWR, 0); } else { char buf[1024]; char* hash; NONFAILING(strncpy(buf, (char*)a0, sizeof(buf))); buf[sizeof(buf) - 1] = 0; while ((hash = strchr(buf, '#'))) { *hash = '0' + (char)(a1 % 10); a1 /= 10; } return open(buf, a2, 0); } } static void loop(); static void sandbox_common() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setpgrp(); setsid(); 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); unshare(CLONE_NEWNS); unshare(CLONE_NEWIPC); unshare(CLONE_IO); } static int do_sandbox_none(int executor_pid, bool enable_tun) { int pid = fork(); if (pid) return pid; sandbox_common(); setup_tun(executor_pid, enable_tun); loop(); doexit(1); } static void remove_dir(const char* dir) { DIR* dp; struct dirent* ep; int iter = 0; retry: dp = opendir(dir); if (dp == NULL) { if (errno == EMFILE) { exitf("opendir(%s) failed due to NOFILE, exiting"); } exitf("opendir(%s) failed", dir); } 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)) exitf("lstat(%s) failed", filename); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } int i; for (i = 0;; i++) { if (unlink(filename) == 0) break; if (errno == EROFS) { break; } if (errno != EBUSY || i > 100) exitf("unlink(%s) failed", filename); if (umount2(filename, MNT_DETACH)) exitf("umount(%s) failed", filename); } } closedir(dp); int i; for (i = 0;; i++) { if (rmdir(dir) == 0) break; if (i < 100) { if (errno == EROFS) { break; } if (errno == EBUSY) { if (umount2(dir, MNT_DETACH)) exitf("umount(%s) failed", dir); continue; } if (errno == ENOTEMPTY) { if (iter < 100) { iter++; goto retry; } } } exitf("rmdir(%s) failed", dir); } } static void test(); void loop() { int iter; for (iter = 0;; iter++) { char cwdbuf[256]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) fail("failed to mkdir"); int pid = fork(); if (pid < 0) fail("clone failed"); if (pid == 0) { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setpgrp(); if (chdir(cwdbuf)) fail("failed to chdir"); flush_tun(); test(); doexit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { int res = waitpid(-1, &status, __WALL | WNOHANG); if (res == pid) break; usleep(1000); if (current_time_ms() - start > 5 * 1000) { kill(-pid, SIGKILL); kill(pid, SIGKILL); while (waitpid(-1, &status, __WALL) != pid) { } break; } } remove_dir(cwdbuf); } } #ifndef __NR_memfd_create #define __NR_memfd_create 319 #endif #ifndef __NR_userfaultfd #define __NR_userfaultfd 323 #endif long r[81]; void* thr(void* arg) { switch ((long)arg) { case 0: r[0] = syscall(__NR_mmap, 0x20000000ul, 0xfff000ul, 0x3ul, 0x10ul, 0xfffffffffffffffful, 0x0ul); break; case 1: r[1] = syscall(__NR_mmap, 0x20000000ul, 0xfff000ul, 0x3ul, 0x32ul, 0xfffffffffffffffful, 0x0ul); break; case 2: NONFAILING(memcpy((void*)0x2040aff5, "\x2f\x64\x65\x76\x2f\x6c\x6f\x6f\x70\x23\x00", 11)); r[3] = syz_open_dev(0x2040aff5ul, 0x0ul, 0x1ul); break; case 3: NONFAILING(memcpy((void*)0x20909ff8, "\x00\x00\x00\x00\x00\x00\x02\x00", 8)); r[5] = syscall(__NR_memfd_create, 0x20909ff8ul, 0x2ul); break; case 4: NONFAILING(*(uint64_t*)0x200a3ff0 = (uint64_t)0x20c13e00); NONFAILING(*(uint64_t*)0x200a3ff8 = (uint64_t)0x1bb); NONFAILING(memcpy( (void*)0x20c13e00, "\xb5\x10\x7b\x98\x1c\x0d\xed\x89\x94\x42\xee\xc2\xca\xb7\xe2" "\xc9\xe6\xcd\x9a\xee\xb4\x18\xde\xd0\x08\x97\x23\x03\x33\x9e" "\xa7\x48\x1a\xa2\xb3\xd0\x78\x6a\x90\x17\x40\xa8\x6a\xbe\x45" "\x07\x45\x32\x17\xc9\xf6\xa4\xaf\xf9\xf4\x2d\x64\xe9\xdf\xe9" "\x5e\xdc\x99\xab\x6e\x28\xe2\xcf\xb8\x89\xb9\x00\xa9\xd9\x99" "\x14\x0b\x47\x17\xbd\x64\x80\xea\x00\x0f\x7e\x16\x7e\xe7\xbe" "\xc2\xcf\xe3\x16\x73\xa8\x8b\xa1\x60\xa9\xbd\x59\x3e\xb0\xd9" "\x0f\x1e\x0c\x2e\xee\x40\xa1\x42\xa5\x0a\x08\x13\x7a\xe8\x65" "\x8d\xe4\xd1\xa0\x8a\xd6\xd2\x38\x1c\xfd\x97\x30\x02\x09\x06" "\x5a\x18\x01\x69\xb7\x94\x7c\x32\xce\x3f\x3f\xf4\x22\xa7\x65" "\x28\x04\x50\x5a\x06\xa0\x56\x73\x8b\x62\x74\x58\x82\x32\xde" "\x69\xf6\x78\x25\xae\x03\x13\x9e\x7d\x60\xca\x79\xc5\x94\x08" "\xe6\x49\xfa\xc9\x3d\x6b\xab\x13\x11\x2e\x70\xb8\xa5\x2e\x68" "\xad\x63\xba\xc4\xf0\xaa\xba\x1b\x71\x33\x77\x9f\xda\xb0\x6f" "\x09\xe0\x22\xf9\xd6\x05\xe8\x00\x51\xce\x42\x9d\x28\x12\xf6" "\x32\xf6\x58\x58\x28\x93\x3f\x8b\xc1\x5d\x79\x27\xe4\x1b\x1e" "\xbb\x16\xe7\x15\x93\xd9\x2e\xce\x21\xd5\xf0\x42\x54\xc2\xc7" "\x41\x67\xab\xcb\x2f\x27\x76\x13\xbc\x7f\x7c\xdb\x6a\x36\x98" "\xe2\xa8\x79\xfa\xbb\x48\x10\x15\x92\x8f\x06\xd3\x92\x5c\xa8" "\x03\xf5\xcb\x27\x5c\x38\x1c\x3e\x91\xf4\x52\x70\x8e\xc8\x82" "\x7d\x8c\x76\x2c\xb8\x86\xe8\x68\x69\x0d\x1a\x62\x59\x78\xd7" "\xb9\x78\x6f\x21\xa7\xd6\x0f\x27\x3a\x5f\xb5\xc8\xa0\xdd\xdc" "\xaa\x65\x38\x72\x64\xa1\x04\xca\xf8\x2a\x45\x1f\x4e\x83\x92" "\x8a\xa5\xd5\xfa\xa7\x9f\x00\x95\xbf\x9c\xae\x38\x31\x6a\xb8" "\xa2\x73\xdf\x80\xdd\x74\xc0\xc1\xa0\xf8\xda\xa2\x00\x6d\x01" "\xad\xcb\x97\x22\x9d\xeb\x1b\xdf\xdb\x57\xd1\x7a\x98\x41\x5d" "\x1a\xba\x54\x26\x97\xf1\xa9\x2b\x45\xca\x50\x2d\xc8\xb5\x1b" "\xf5\x4b\xa1\x7d\xcc\xa0\xe1\xfe\x5c\x52\x52\x24\x3f\x0c\xf9" "\x7a\xd6\x10\x44\xc5\xef\xb4\x3a\x26\xae\x00\x4b\x06\xbf\xf6" "\x9d\xf7\xed\xf2\x48\xc0\x3c\x11", 443)); r[9] = syscall(__NR_pwritev, r[5], 0x200a3ff0ul, 0x1ul, 0x49ul); break; case 5: r[10] = syscall(__NR_ioctl, r[3], 0x4c00ul, r[5]); break; case 6: NONFAILING(*(uint64_t*)0x200ddff8 = (uint64_t)0x0); r[12] = syscall(__NR_sendfile, r[3], r[5], 0x200ddff8ul, 0x100000001ul); break; case 7: r[13] = syscall(__NR_gettid); break; case 8: NONFAILING(*(uint64_t*)0x206fdf18 = (uint64_t)0x0); NONFAILING(*(uint64_t*)0x206fdf20 = (uint64_t)0x0); NONFAILING(*(uint64_t*)0x206fdf28 = (uint64_t)0x0); NONFAILING(*(uint64_t*)0x206fdf30 = (uint64_t)0xfffffffffffff000); NONFAILING(*(uint64_t*)0x206fdf38 = (uint64_t)0x3ea); NONFAILING(*(uint32_t*)0x206fdf40 = (uint32_t)0x0); NONFAILING(*(uint32_t*)0x206fdf44 = (uint32_t)0x0); NONFAILING(*(uint32_t*)0x206fdf48 = (uint32_t)0x1e); NONFAILING(*(uint32_t*)0x206fdf4c = (uint32_t)0xd); NONFAILING(memcpy((void*)0x206fdf50, "\x32\xb0\x5d\x80\x1e\x66\x49\xb8\x12\xd2\xe6\xb6" "\xcc\x15\x94\x42\xb1\x21\x53\x13\x2c\x9b\xf9\x44" "\xcf\x27\x00\x12\xda\x21\xba\x80\xc0\x40\x39\x77" "\x14\xf7\x7f\xaa\x1e\x8e\xd3\xfc\x72\x09\xd6\x4d" "\x14\xce\xc7\x47\x9b\x05\xca\xe0\xc7\x32\xde\x3a" "\xb6\xcc\x5f\x4b", 64)); NONFAILING(memcpy((void*)0x206fdf90, "\x94\x14\x06\x56\x9a\x73\xd0\x65\x56\xae\xe2\x94" "\x3f\x5e\x94\xc8\x44\xa5\x55\x27\xaf\x84\xfb\x28" "\xf0\x11\x82\x5a\xf6\x09\x10\xe7\x70\x6e\xb4\x78" "\x6b\x3a\x97\x6d\xa7\xb5\x72\x11\xaf\x83\x4e\x7d" "\x98\xb8\x39\x62\x96\x89\xa1\x47\x2f\x55\x78\xb2" "\x99\x8b\xd7\xda", 64)); NONFAILING(memcpy((void*)0x206fdfd0, "\xef\xd5\x59\x22\xa7\xdc\x32\x93\x94\x61\x0a\xfb" "\xac\xd2\x37\xd2\x34\xaf\xb8\x05\xeb\xc3\xb9\x4e" "\x4f\xb9\xd5\x6d\xd0\x3f\x1f\x8b", 32)); NONFAILING(*(uint64_t*)0x206fdff0 = (uint64_t)0x905); NONFAILING(*(uint64_t*)0x206fdff8 = (uint64_t)0x8); r[28] = syscall(__NR_ioctl, r[3], 0x4c04ul, 0x206fdf18ul); break; case 9: r[29] = syscall(__NR_ftruncate, r[3], 0x8ul); break; case 10: r[30] = syscall(__NR_sync_file_range, r[3], 0x7ful, 0x801ul, 0x7ul); break; case 11: NONFAILING(*(uint16_t*)0x20685000 = (uint16_t)0x0); NONFAILING(*(uint16_t*)0x20685002 = (uint16_t)0x0); NONFAILING(*(uint32_t*)0x20685004 = (uint32_t)0x9); NONFAILING(*(uint32_t*)0x20685008 = (uint32_t)0x5); NONFAILING(*(uint32_t*)0x2068500c = (uint32_t)0x0); NONFAILING(*(uint32_t*)0x208daffc = (uint32_t)0x10); r[37] = syscall(__NR_getsockopt, r[5], 0x84ul, 0x22ul, 0x20685000ul, 0x208daffcul); if (r[37] != -1) NONFAILING(r[38] = *(uint32_t*)0x2068500c); break; case 12: NONFAILING(*(uint32_t*)0x2054ff74 = r[38]); NONFAILING(*(uint16_t*)0x2054ff78 = (uint16_t)0xa); NONFAILING(*(uint16_t*)0x2054ff7a = (uint16_t)0x204e); NONFAILING(*(uint32_t*)0x2054ff7c = (uint32_t)0x8); NONFAILING(*(uint8_t*)0x2054ff80 = (uint8_t)0x0); NONFAILING(*(uint8_t*)0x2054ff81 = (uint8_t)0x0); NONFAILING(*(uint8_t*)0x2054ff82 = (uint8_t)0x0); NONFAILING(*(uint8_t*)0x2054ff83 = (uint8_t)0x0); NONFAILING(*(uint8_t*)0x2054ff84 = (uint8_t)0x0); NONFAILING(*(uint8_t*)0x2054ff85 = (uint8_t)0x0); NONFAILING(*(uint8_t*)0x2054ff86 = (uint8_t)0x0); NONFAILING(*(uint8_t*)0x2054ff87 = (uint8_t)0x0); NONFAILING(*(uint8_t*)0x2054ff88 = (uint8_t)0x0); NONFAILING(*(uint8_t*)0x2054ff89 = (uint8_t)0x0); NONFAILING(*(uint8_t*)0x2054ff8a = (uint8_t)0x0); NONFAILING(*(uint8_t*)0x2054ff8b = (uint8_t)0x0); NONFAILING(*(uint8_t*)0x2054ff8c = (uint8_t)0x0); NONFAILING(*(uint8_t*)0x2054ff8d = (uint8_t)0x0); NONFAILING(*(uint8_t*)0x2054ff8e = (uint8_t)0x0); NONFAILING(*(uint8_t*)0x2054ff8f = (uint8_t)0x0); NONFAILING(*(uint32_t*)0x2054ff90 = (uint32_t)0x0); NONFAILING(*(uint64_t*)0x2054ff98 = (uint64_t)0x0); NONFAILING(*(uint64_t*)0x2054ffa0 = (uint64_t)0x0); NONFAILING(*(uint64_t*)0x2054ffa8 = (uint64_t)0x0); NONFAILING(*(uint64_t*)0x2054ffb0 = (uint64_t)0x0); NONFAILING(*(uint64_t*)0x2054ffb8 = (uint64_t)0x0); NONFAILING(*(uint64_t*)0x2054ffc0 = (uint64_t)0x0); NONFAILING(*(uint64_t*)0x2054ffc8 = (uint64_t)0x0); NONFAILING(*(uint64_t*)0x2054ffd0 = (uint64_t)0x0); NONFAILING(*(uint64_t*)0x2054ffd8 = (uint64_t)0x0); NONFAILING(*(uint64_t*)0x2054ffe0 = (uint64_t)0x0); NONFAILING(*(uint64_t*)0x2054ffe8 = (uint64_t)0x0); NONFAILING(*(uint64_t*)0x2054fff0 = (uint64_t)0x0); NONFAILING(*(uint32_t*)0x200e5000 = (uint32_t)0x8c); r[73] = syscall(__NR_getsockopt, r[5], 0x84ul, 0x6ul, 0x2054ff74ul, 0x200e5000ul); break; case 13: r[74] = syscall(__NR_userfaultfd, 0x80000ul); break; case 14: NONFAILING(*(uint32_t*)0x20adf000 = (uint32_t)0x7); r[76] = syscall(__NR_setsockopt, r[5], 0x84ul, 0x20ul, 0x20adf000ul, 0x4ul); break; case 15: NONFAILING(memcpy((void*)0x20e57ff5, "\x2f\x64\x65\x76\x2f\x6c\x6f\x6f\x70\x23\x00", 11)); r[78] = syz_open_dev(0x20e57ff5ul, 0x0ul, 0x4102ul); break; case 16: r[79] = syscall(__NR_mmap, 0x20e5b000ul, 0x1000ul, 0x3ul, 0x2011ul, r[78], 0x0ul); break; case 17: r[80] = syscall(__NR_shmctl, 0x0ul, 0x3ul, 0x20e5b000ul); break; } return 0; } void test() { long i; pthread_t th[36]; memset(r, -1, sizeof(r)); for (i = 0; i < 18; i++) { pthread_create(&th[i], 0, thr, (void*)i); usleep(rand() % 10000); } usleep(rand() % 100000); } int main() { int i; for (i = 0; i < 8; i++) { if (fork() == 0) { install_segv_handler(); use_temporary_dir(); int pid = do_sandbox_none(i, true); int status = 0; while (waitpid(pid, &status, __WALL) != pid) { } return 0; } } sleep(1000000); return 0; }