// https://syzkaller.appspot.com/bug?id=f1834e1735946170a8a3a4c85edb978e94bada81 // autogenerated by syzkaller (http://github.com/google/syzkaller) #define _GNU_SOURCE #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 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 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 test(); void loop() { int iter; for (iter = 0;; iter++) { int pid = fork(); if (pid < 0) fail("clone failed"); if (pid == 0) { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setpgrp(); 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; } } } } long r[79]; void test() { memset(r, -1, sizeof(r)); r[0] = syscall(__NR_mmap, 0x20000000ul, 0xfff000ul, 0x3ul, 0x32ul, 0xfffffffffffffffful, 0x0ul); r[1] = syscall(__NR_socket, 0x26ul, 0x5ul, 0x0ul); *(uint16_t*)0x20e1e000 = (uint16_t)0x26; memcpy((void*)0x20e1e002, "\x68\x61\x73\x68\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 14); *(uint32_t*)0x20e1e010 = (uint32_t)0x0; *(uint32_t*)0x20e1e014 = (uint32_t)0x0; memcpy((void*)0x20e1e018, "\x63\x72\x63\x33\x32\x63\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00", 64); r[7] = syscall(__NR_bind, r[1], 0x20e1e000ul, 0x58ul); *(uint16_t*)0x20f3b000 = (uint16_t)0x26; memcpy((void*)0x20f3b002, "\x61\x65\x61\x64\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 14); *(uint32_t*)0x20f3b010 = (uint32_t)0x2; *(uint32_t*)0x20f3b014 = (uint32_t)0x2100; memcpy((void*)0x20f3b018, "\x72\x66\x63\x34\x31\x30\x36\x28\x67\x63\x6d\x28\x61\x65\x73" "\x29\x29\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00", 64); r[13] = syscall(__NR_bind, r[1], 0x20f3b000ul, 0x58ul); r[14] = syscall(__NR_accept, r[1], 0x0ul, 0x0ul); memcpy((void*)0x20890fec, "\x79\x73\x39\x76\xd8\xc3\x0a\x4a\xea\xd9" "\x60\xf2\xbd\x08\xcf\xe6\x27\x85\xce\x10", 20); r[16] = syscall(__NR_setsockopt, r[1], 0x117ul, 0x1ul, 0x20890fecul, 0x14ul); r[17] = syscall(__NR_socket, 0x26ul, 0x5ul, 0x0ul); *(uint16_t*)0x20a65000 = (uint16_t)0x26; memcpy((void*)0x20a65002, "\x61\x65\x61\x64\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 14); *(uint32_t*)0x20a65010 = (uint32_t)0x0; *(uint32_t*)0x20a65014 = (uint32_t)0x0; memcpy((void*)0x20a65018, "\x67\x63\x6d\x28\x73\x65\x72\x70\x65\x6e\x74\x29\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00", 64); r[23] = syscall(__NR_bind, r[17], 0x20a65000ul, 0x58ul); r[24] = syscall(__NR_accept, r[1], 0x0ul, 0x0ul); *(uint64_t*)0x202fefc8 = (uint64_t)0x0; *(uint32_t*)0x202fefd0 = (uint32_t)0x0; *(uint64_t*)0x202fefd8 = (uint64_t)0x20985000; *(uint64_t*)0x202fefe0 = (uint64_t)0x1; *(uint64_t*)0x202fefe8 = (uint64_t)0x20632f70; *(uint64_t*)0x202feff0 = (uint64_t)0x78; *(uint32_t*)0x202feff8 = (uint32_t)0x1; *(uint64_t*)0x20985000 = (uint64_t)0x206fdf9d; *(uint64_t*)0x20985008 = (uint64_t)0xe; memcpy((void*)0x206fdf9d, "\x95\x76\xfb\x56\x78\xf4\xd8\xbb\x1b\x8c\x63\xa2\x29\xd9", 14); *(uint64_t*)0x20632f70 = (uint64_t)0x18; *(uint32_t*)0x20632f78 = (uint32_t)0x117; *(uint32_t*)0x20632f7c = (uint32_t)0x3; *(uint32_t*)0x20632f80 = (uint32_t)0x0; *(uint64_t*)0x20632f88 = (uint64_t)0x18; *(uint32_t*)0x20632f90 = (uint32_t)0x117; *(uint32_t*)0x20632f94 = (uint32_t)0x3; *(uint32_t*)0x20632f98 = (uint32_t)0x0; *(uint64_t*)0x20632fa0 = (uint64_t)0x18; *(uint32_t*)0x20632fa8 = (uint32_t)0x117; *(uint32_t*)0x20632fac = (uint32_t)0x3; *(uint32_t*)0x20632fb0 = (uint32_t)0x1; *(uint64_t*)0x20632fb8 = (uint64_t)0x18; *(uint32_t*)0x20632fc0 = (uint32_t)0x117; *(uint32_t*)0x20632fc4 = (uint32_t)0x4; *(uint32_t*)0x20632fc8 = (uint32_t)0x100000000; *(uint64_t*)0x20632fd0 = (uint64_t)0x18; *(uint32_t*)0x20632fd8 = (uint32_t)0x117; *(uint32_t*)0x20632fdc = (uint32_t)0x4; *(uint32_t*)0x20632fe0 = (uint32_t)0x3; r[55] = syscall(__NR_sendmsg, r[24], 0x202fefc8ul, 0x1ul); *(uint64_t*)0x2094ffc8 = (uint64_t)0x20967000; *(uint32_t*)0x2094ffd0 = (uint32_t)0x27; *(uint64_t*)0x2094ffd8 = (uint64_t)0x20203000; *(uint64_t*)0x2094ffe0 = (uint64_t)0x7; *(uint64_t*)0x2094ffe8 = (uint64_t)0x207dafc6; *(uint64_t*)0x2094fff0 = (uint64_t)0x0; *(uint32_t*)0x2094fff8 = (uint32_t)0x8; *(uint64_t*)0x20203000 = (uint64_t)0x20aa0f41; *(uint64_t*)0x20203008 = (uint64_t)0x0; *(uint64_t*)0x20203010 = (uint64_t)0x20732000; *(uint64_t*)0x20203018 = (uint64_t)0x0; *(uint64_t*)0x20203020 = (uint64_t)0x204c2f17; *(uint64_t*)0x20203028 = (uint64_t)0x0; *(uint64_t*)0x20203030 = (uint64_t)0x205af000; *(uint64_t*)0x20203038 = (uint64_t)0x0; *(uint64_t*)0x20203040 = (uint64_t)0x203d8000; *(uint64_t*)0x20203048 = (uint64_t)0x0; *(uint64_t*)0x20203050 = (uint64_t)0x204ae000; *(uint64_t*)0x20203058 = (uint64_t)0xb6; *(uint64_t*)0x20203060 = (uint64_t)0x20fa1000; *(uint64_t*)0x20203068 = (uint64_t)0x0; r[77] = syscall(__NR_recvmsg, r[24], 0x2094ffc8ul, 0x3ul); r[78] = syscall(__NR_accept, r[1], 0x0ul, 0x0ul); } int main() { int i; for (i = 0; i < 8; i++) { if (fork() == 0) { loop(); return 0; } } sleep(1000000); return 0; }