// https://syzkaller.appspot.com/bug?id=e193a2613e93f192b792ca90f7a94651f0fd71c0 // 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; memcpy((void*)0x200000c0, "/dev/pf\000", 8); res = syscall(SYS_openat, 0xffffffffffffff9cul, 0x200000c0ul, 0x18189ul, 0ul); if (res != -1) r[0] = res; memcpy( (void*)0x20000100, "\xd7\x5c\x46\xe7\xa8\x0b\xc9\xe4\xf4\x6a\xdb\xc9\x95\xe9\xa5\x83\x6a\x7b" "\x48\xab\xe4\x3d\x5b\xf2\x50\xc1\x96\x0a\xd2\x9c\x87\x21\x5a\xe2\x63\x32" "\x47\x4d\xea\x1e\x35\x24\x2e\x6a\x18\x50\xfe\xa9\x08\xcc\x45\x67\xc8\xad" "\x50\x0e\x85\xc5\x67\x49\x9e\xe4\xfc\xaf\xcb\xd1\xb6\x6f\xdc\x21\xad\xb5" "\xad\xd4\x6e\xd4\x91\x31\x2b\xe8\x19\xa0\x49\x80\xfd\xd0\x7b\x41\xe6\x06" "\x98\xb9\xb2\x24\x23\x40\xe1\x0f\xc2\x91\xbd\x8a\x16\xe9\x50\xce\xdc\x28" "\x71\x57\xb5\xa0\xed\x00\xde\x0d\xa5\x4e\x97\x9b\xea\x8c\xf0\x87\x80\x52" "\xcc\x63\xb7\x5a\x6c\x5a\xa9\x67\x85\x15\x75\x20\x83\x48\xed\xe6\x02\xb3" "\x36\x6b\x5c\xd6\x78\x60\x9c\x12\xb0\xe0\xb6\xac\xf9\xd9\x7b\x54\xd1\x80" "\x1c\x05\xaa\xa1\xe8\x5b\x55\x7f\xd1\xd3\x64\x18\xce\xcf\x3f\x10\x41\x5a" "\x90\x39\x33\xa9\x63\x12\x1b\x86\x71\xfd\xeb\xf2\x7f\x81\xf5\x01\x93\x30" "\xe1\xe3\xd0\x5a\x69\xad\x7b\x9b\xa0\x31\xf5\xac\x6d\xfe\x6b\x89\x1b\x2a" "\x1d\x0b\x74\xe1\xb4\x4f\xa8\xf0\xb6\x39\x92\x73\xf0\x5d\x23\xc1\x7e\x01" "\x70\x96\x02\xd5\xb7\xd1\x81\x5c\x87\x3b\x27\xc6", 246); syscall(SYS_ioctl, r[0], 0xc0e04412ul, 0x20000100ul); } int main(void) { syscall(SYS_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x1012ul, -1, 0ul); loop(); return 0; }