// https://syzkaller.appspot.com/bug?id=f38fb3fa1f2f32a667805c1a0302254e19d79fb1 // 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[111]; void test() { memset(r, -1, sizeof(r)); r[0] = syscall(__NR_mmap, 0x20000000ul, 0xfff000ul, 0x3ul, 0x32ul, 0xfffffffffffffffful, 0x0ul); r[1] = syscall(__NR_semget, 0x0ul, 0x2ul, 0x4ul); *(uint16_t*)0x20000fd0 = (uint16_t)0x3; *(uint16_t*)0x20000fd2 = (uint16_t)0x8; *(uint16_t*)0x20000fd4 = (uint16_t)0x0; *(uint16_t*)0x20000fd6 = (uint16_t)0x2; *(uint16_t*)0x20000fd8 = (uint16_t)0x2; *(uint16_t*)0x20000fda = (uint16_t)0x1000; *(uint16_t*)0x20000fdc = (uint16_t)0x3; *(uint16_t*)0x20000fde = (uint16_t)0x400; *(uint16_t*)0x20000fe0 = (uint16_t)0x800; *(uint16_t*)0x20000fe2 = (uint16_t)0x4; *(uint16_t*)0x20000fe4 = (uint16_t)0x101; *(uint16_t*)0x20000fe6 = (uint16_t)0x800; *(uint16_t*)0x20000fe8 = (uint16_t)0x4; *(uint16_t*)0x20000fea = (uint16_t)0x1000; *(uint16_t*)0x20000fec = (uint16_t)0x1000; *(uint16_t*)0x20000fee = (uint16_t)0x0; *(uint16_t*)0x20000ff0 = (uint16_t)0x100000001; *(uint16_t*)0x20000ff2 = (uint16_t)0x0; *(uint16_t*)0x20000ff4 = (uint16_t)0x7; *(uint16_t*)0x20000ff6 = (uint16_t)0x7; *(uint16_t*)0x20000ff8 = (uint16_t)0x800; *(uint16_t*)0x20000ffa = (uint16_t)0x1; *(uint16_t*)0x20000ffc = (uint16_t)0x0; *(uint16_t*)0x20000ffe = (uint16_t)0x1800; *(uint64_t*)0x20000ff0 = (uint64_t)0x77359400; *(uint64_t*)0x20000ff8 = (uint64_t)0x0; r[28] = syscall(__NR_semtimedop, r[1], 0x20000fd0ul, 0x8ul, 0x20000ff0ul); r[29] = syscall(__NR_socket, 0x26ul, 0x5ul, 0x0ul); *(uint16_t*)0x203d6000 = (uint16_t)0x26; memcpy((void*)0x203d6002, "\x61\x65\x61\x64\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 14); *(uint32_t*)0x203d6010 = (uint32_t)0x100000000000000; *(uint32_t*)0x203d6014 = (uint32_t)0xf; memcpy((void*)0x203d6018, "\x65\x63\x68\x61\x69\x6e\x69\x76\x28\x72\x66\x63\x34\x31\x30" "\x36\x28\x67\x63\x6d\x28\x61\x65\x73\x29\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", 64); r[35] = syscall(__NR_bind, r[29], 0x203d6000ul, 0x58ul); 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[37] = syscall(__NR_setsockopt, r[29], 0x117ul, 0x1ul, 0x20890fecul, 0x14ul); r[38] = syscall(__NR_accept, r[29], 0x0ul, 0x0ul); r[39] = syscall(__NR_accept, r[29], 0x0ul, 0x0ul); *(uint64_t*)0x20944000 = (uint64_t)0x0; *(uint32_t*)0x20944008 = (uint32_t)0x0; *(uint64_t*)0x20944010 = (uint64_t)0x20a7c000; *(uint64_t*)0x20944018 = (uint64_t)0x8; *(uint64_t*)0x20944020 = (uint64_t)0x20124f00; *(uint64_t*)0x20944028 = (uint64_t)0x60; *(uint32_t*)0x20944030 = (uint32_t)0x800; *(uint64_t*)0x20a7c000 = (uint64_t)0x2073e000; *(uint64_t*)0x20a7c008 = (uint64_t)0xea; *(uint64_t*)0x20a7c010 = (uint64_t)0x202a0f01; *(uint64_t*)0x20a7c018 = (uint64_t)0x0; *(uint64_t*)0x20a7c020 = (uint64_t)0x204b7000; *(uint64_t*)0x20a7c028 = (uint64_t)0x0; *(uint64_t*)0x20a7c030 = (uint64_t)0x20d91000; *(uint64_t*)0x20a7c038 = (uint64_t)0x0; *(uint64_t*)0x20a7c040 = (uint64_t)0x2065b000; *(uint64_t*)0x20a7c048 = (uint64_t)0x0; *(uint64_t*)0x20a7c050 = (uint64_t)0x20deffb8; *(uint64_t*)0x20a7c058 = (uint64_t)0x0; *(uint64_t*)0x20a7c060 = (uint64_t)0x20444000; *(uint64_t*)0x20a7c068 = (uint64_t)0x0; *(uint64_t*)0x20a7c070 = (uint64_t)0x20758000; *(uint64_t*)0x20a7c078 = (uint64_t)0x0; memcpy((void*)0x2073e000, "\x61\xee\xcd\x3a\x05\x4e\x99\x08\x78\x02\x87\xd4\x62\xda\x9b" "\x1a\x0a\x3c\x93\x31\x35\x0a\x66\x89\xab\x44\x5c\x81\x72\x2f" "\x74\x12\xae\x64\x3f\x0f\xdf\xb7\xc6\xdd\x28\xcf\x1b\x75\xec" "\xc3\xa6\x38\xea\xd2\x2f\x5c\x85\x51\x43\x82\x6b\xba\x12\x93" "\x48\x58\xdc\x7e\x39\xe7\xdf\x06\xb1\x09\x2a\x44\x6f\xcb\x34" "\xdb\x51\xbf\x05\x21\x1c\x46\xf0\x2f\xf8\xf1\xa5\xeb\xb2\x20" "\x9f\x61\xaa\x75\x14\x2b\xac\xe7\x5f\xdb\x9e\x1e\xb5\xc4\x5a" "\xc8\x2a\xb9\xa3\x8f\xd5\x65\x6f\x7d\x50\x86\xff\xe0\x57\x50" "\xe3\x01\xee\x8f\x55\x69\x84\x2d\x5f\x5f\xde\x09\x24\xa9\x8d" "\xed\x98\x4d\x05\xe3\x57\xbc\x6c\xf8\x7e\x7b\x32\xfd\x8f\xa5" "\xb7\x56\xaf\x65\xca\x12\xc3\x99\x38\xb6\x4b\xcd\x66\xa1\xda" "\x04\x2d\xfa\x10\x9b\xf2\xab\x99\x35\xde\x23\xd7\xdc\xfa\xfa" "\x72\xea\x3b\x6c\x97\x3c\x71\xe2\xd0\xd8\x6b\xaa\x27\xbb\x6b" "\x9c\x26\xcd\xd1\x3d\x56\xbc\x3a\x5e\x59\x7f\x4b\x08\x71\x12" "\x4a\x9d\x43\x7e\x1c\x94\x87\xf0\xa9\x5c\xfa\x49\xf9\xad\x67" "\xaf\xfd\xcc\xc9\xf0\x8f\x62\x6f\x7b", 234); *(uint64_t*)0x20124f00 = (uint64_t)0x18; *(uint32_t*)0x20124f08 = (uint32_t)0x117; *(uint32_t*)0x20124f0c = (uint32_t)0x3; *(uint32_t*)0x20124f10 = (uint32_t)0x1; *(uint64_t*)0x20124f18 = (uint64_t)0x18; *(uint32_t*)0x20124f20 = (uint32_t)0x117; *(uint32_t*)0x20124f24 = (uint32_t)0x4; *(uint32_t*)0x20124f28 = (uint32_t)0x9; *(uint64_t*)0x20124f30 = (uint64_t)0x18; *(uint32_t*)0x20124f38 = (uint32_t)0x117; *(uint32_t*)0x20124f3c = (uint32_t)0x4; *(uint32_t*)0x20124f40 = (uint32_t)0x0; *(uint64_t*)0x20124f48 = (uint64_t)0x18; *(uint32_t*)0x20124f50 = (uint32_t)0x117; *(uint32_t*)0x20124f54 = (uint32_t)0x4; *(uint32_t*)0x20124f58 = (uint32_t)0x8; r[80] = syscall(__NR_sendmmsg, r[39], 0x20944000ul, 0x1ul, 0x40000ul); r[81] = syscall(__NR_io_setup, 0x3ul, 0x207fc000ul); if (r[81] != -1) r[82] = *(uint64_t*)0x207fc000; *(uint64_t*)0x20bd9fe0 = (uint64_t)0x20617fc0; *(uint64_t*)0x20bd9fe8 = (uint64_t)0x20958fc0; *(uint64_t*)0x20617fc0 = (uint64_t)0x0; *(uint32_t*)0x20617fc8 = (uint32_t)0x0; *(uint32_t*)0x20617fcc = (uint32_t)0x0; *(uint16_t*)0x20617fd0 = (uint16_t)0x4000000000000; *(uint16_t*)0x20617fd2 = (uint16_t)0x1; *(uint32_t*)0x20617fd4 = r[39]; *(uint64_t*)0x20617fd8 = (uint64_t)0x2007d000; *(uint64_t*)0x20617fe0 = (uint64_t)0xad; *(uint64_t*)0x20617fe8 = (uint64_t)0x0; *(uint64_t*)0x20617ff0 = (uint64_t)0x0; *(uint32_t*)0x20617ff8 = (uint32_t)0x0; *(uint32_t*)0x20617ffc = (uint32_t)0xffffffffffffffff; memcpy((void*)0x2007d000, "\xb3\xb0\x39\x96\xff\x05\xab\xb1\xe8\xb1\xc2\x4b\x50\x89\x8d" "\x8f\x9e\xad\x67\x39\x23\xf5\x7e\xea\x9c\x32\x35\x39\xf6\x10" "\x98\xa6\x6e\x70\xe2\x1c\x7f\x41\xb2\x48\x34\x36\x90\xcd\xe4" "\x38\x3c\x53\x8b\x17\x9b\x0f\x5d\xcc\xcf\x6b\xfa\xf8\x03\x1c" "\xb0\x52\xad\x74\xa5\xa8\x3f\xad\xd0\x99\x55\xb1\x67\x6d\x37" "\xe5\xe4\x5d\x50\x69\x7c\xe5\x3a\x58\x8a\xe0\xd5\xe6\xe2\x0d" "\xf6\x1f\xeb\xd6\x65\xb5\x32\xe5\x79\x0c\x28\x39\xd3\xb8\x06" "\x8a\x5d\xeb\x2c\x40\x8f\xc4\x82\xa0\x57\x1c\xd5\x48\xc8\xa8" "\xb9\x04\x89\x61\xcc\xef\x04\x33\xf1\x84\x79\xdd\xd0\x92\x36" "\xd4\x95\xea\xad\xd8\x35\xe6\x4b\x72\x8d\x0f\x8e\x60\xde\x4c" "\x73\xd9\x0e\x62\x66\x41\x0f\xf6\x82\xff\x4b\x33\x8e\x62\xae" "\xd8\x53\xf8\xf9\x0f\x83\x2b\xdc", 173); *(uint64_t*)0x20958fc0 = (uint64_t)0x0; *(uint32_t*)0x20958fc8 = (uint32_t)0x0; *(uint32_t*)0x20958fcc = (uint32_t)0x0; *(uint16_t*)0x20958fd0 = (uint16_t)0x7; *(uint16_t*)0x20958fd2 = (uint16_t)0xca9; *(uint32_t*)0x20958fd4 = (uint32_t)0xffffffffffffffff; *(uint64_t*)0x20958fd8 = (uint64_t)0x202b9000; *(uint64_t*)0x20958fe0 = (uint64_t)0x0; *(uint64_t*)0x20958fe8 = (uint64_t)0x10000; *(uint64_t*)0x20958ff0 = (uint64_t)0x0; *(uint32_t*)0x20958ff8 = (uint32_t)0x0; *(uint32_t*)0x20958ffc = (uint32_t)0xffffffffffffffff; r[110] = syscall(__NR_io_submit, r[82], 0x2ul, 0x20bd9fe0ul); } int main() { int i; for (i = 0; i < 8; i++) { if (fork() == 0) { loop(); return 0; } } sleep(1000000); return 0; }