// https://syzkaller.appspot.com/bug?id=b6aff64ebd79a1ee5ee7e787ca5b8673ba722226 // 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 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 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[1] = {0xffffffffffffffff}; void execute_one(void) { intptr_t res = 0; *(uint64_t*)0x20000640 = 0x20000900; *(uint32_t*)0x20000900 = -1; *(uint64_t*)0x20000904 = -1; sprintf((char*)0x2000090c, "0x%016llx", (long long)-1); sprintf((char*)0x2000091e, "%023llo", (long long)-1); sprintf((char*)0x20000935, "%020llu", (long long)-1); *(uint64_t*)0x20000949 = -1; *(uint32_t*)0x20000648 = 0xa; *(uint64_t*)0x20000650 = 0x20000600; *(uint64_t*)0x20000600 = 0x20000bc0; memcpy( (void*)0x20000bc0, "\xc5\x3e\x07\xc9\x42\xb7\xc0\x1d\xbe\xa1\xea\x1e\x39\x0e\x85\xa6\x03\x2a" "\x79\x73\x75\xf8\x08\xec\x01\x64\x03\x61\xeb\x87\x4c\x3d\x8d\x48\xd1\x0a" "\x5c\x25\xb1\xff\x26\xd4\x8e\xe8\xd0\x3d\x8c\x5c\xa1\x24\x7c\xc8\x6f\x42" "\x02\xcd\x6c\x47\x95\x2e\x44\xf7\x21\x9d\x76\xfb\x1f\xe1\x3a\x72\xaf\xae" "\x83\x71\x09\xf9\x1c\xf3\xa0\x9b\x58\xb3\x0d\x6d\x3f\x0a\xf7\xa1\x36\x9b" "\x08\x5e\xfa\x5d\xca\xe9\xb2\x53\x62\x19\xfc\x00\x2d\x96\x35\xc9\xfa\x7c" "\x30\x24\x64\xe5\x9a\xef\x0a\xdf\x26\xa0\x8c\xc9\xf6\xfc\x6a\x64\x26\x4d" "\x1d\x66\xa9\x29\xbc\x13\x95\xd6\xef\xee\x78\x4a\x0d\x31\x96\x57\xc6\xb8" "\xa8\x4a\xb5\xe6\xd1\x02\x6a\x15\x02\xf1\x08\x09\x56\xc7\x63\xd3\xe1\x88" "\x84\xff\x30\x2e\x90\x5c\x55\xa2\x95\x78\x5b\x91\xa5\x7a\xbb\x80\x1b\x26" "\x4a\xb8\x9e\x92\x9e\x0f\xf2\xe6\x51\xae\x3c\xa7", 192); *(uint64_t*)0x20000608 = 0xc0; *(uint64_t*)0x20000610 = 0; *(uint64_t*)0x20000618 = 0; *(uint64_t*)0x20000620 = 0; *(uint64_t*)0x20000628 = 0; *(uint64_t*)0x20000658 = 3; *(uint64_t*)0x20000660 = 0; *(uint64_t*)0x20000668 = 0xd0; *(uint32_t*)0x20000670 = 0; syscall(SYS_sendmsg, -1, 0x20000640ul, 4ul); memcpy((void*)0x20000000, "/dev/pf\000", 8); res = syscall(SYS_openat, 0xffffffffffffff9cul, 0x20000000ul, 2ul, 0ul); if (res != -1) r[0] = res; syscall(SYS_ioctl, r[0], 0xcbe04404ul, 0x20000040ul); } int main(void) { syscall(SYS_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x1012ul, -1, 0ul); loop(); return 0; }