// https://syzkaller.appspot.com/bug?id=bc0db3862666b7039ea3b6159352abc9ff996d1d // 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; } #define __syscall syscall static void execute_one(void); #define WAIT_FLAGS 0 static void loop(void) { int iter; for (iter = 0;; 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 < 5 * 1000) continue; kill_and_wait(pid, &status); break; } } } uint64_t r[1] = {0xffffffffffffffff}; void execute_one(void) { intptr_t res = 0; *(uint64_t*)0x200006c0 = 0x20000300; memcpy((void*)0x20000300, "\x6e\x50\xec\x14\xc1\xab\x52\x05\xf1\x00\x6a\xf2\x5a\x74\x5d\xa2\x47" "\x84\xce\x6e\x38\x18\xf4\xa3\x2d\x96\x7b\x62\x6d\x6b\x7e\x6f\x56\x91" "\x17\xc7\xf7\x9d\xee\x2e\x4f\x86\x5a\x6a\x09\x83\xa0\x1d\xa6\xe9\xa0" "\x2c\x23\x91\x71\x10\x89\x21\x16", 59); *(uint64_t*)0x200006c8 = 0x3b; syscall(SYS_pwritev, -1, 0x200006c0ul, 1ul, 0ul, 0ul); *(uint32_t*)0x200002c0 = 0xc; syscall(SYS_getsockopt, -1, 0xffff, 0x1022, 0x20000100ul, 0x200002c0ul); memcpy((void*)0x20000200, "/dev/pf\000", 8); res = syscall(SYS_openat, 0xffffffffffffff9cul, 0x20000200ul, 2ul, 0ul); if (res != -1) r[0] = res; *(uint32_t*)0x20000240 = 0; syscall(SYS_ioctl, r[0], 0xc1084425ul, 0x20000240ul); } int main(void) { syscall(SYS_mmap, 0x20000000ul, 0x1000000ul, 3ul, 0x1012ul, -1, 0ul, 0ul); loop(); return 0; }