// https://syzkaller.appspot.com/bug?id=a12a0d53e98be4a617f1e02e8ae91dc4a31525f8 // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #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(); const char* program_name; void child() { execute_one(); exit(0); } 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) { execl(program_name, program_name, "child", NULL); exit(1); } 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; memcpy((void*)0x20000080, "/net/ipifc/0/err\000", 17); res = syscall(SYS_openat, 0xffffffffffffff9cul, 0x20000080ul, 0x11ul, 3ul, 0ul); if (res != -1) r[0] = res; syscall(SYS_close, r[0]); memcpy((void*)0x20000200, "/dev/.empty\000", 12); syscall(SYS_openat, 0xffffffffffffff9cul, 0x20000200ul, 0xcul, 3ul, 0ul); memcpy((void*)0x20000240, "\x19\x4b\xb9\x08\x66\x17\x37\xe9\x25\x97\x96\xd2\xd0\x11\xf9\xd6\xea" "\x9f\xe0\x26\x68\xb7\x60\xd1\xaa\xdf\x8d\xd5\x7d\x17\x21\x4d\x7b\xf2" "\xaf\x3d\x47\x4e\xde\xca\x85\x9d\x56\x74\x13\x7d\x6c\xd7\x5b\x04\x1e" "\x09\x6c\x34\xea\x25\xc5\xad\x50\x5e\x5c\x89\x37\x21\xc3\xf4\x28\x8b" "\xff\xa6\x6a\x83\xb0\x1a\x06\x6d\xf8\xd6\x25\xd9\x5c\xfb\xb5\x0b\x05" "\x44\x9e\xec\xf5\xfd\x31\x9b\x70\xe6\x4d\xb2\xa9\xde\x04\x48\xb4\x1d" "\xc3\x9e\xfd\x45\xd6\x10\x77\x99\x57\x0f\x56\x37\x0b\x6a\x80\xc9\x69" "\x94\xc4\x29\xad\xef\xf8\x1f\x9f\xd8\x8f\xa6\x1e\xd4\xdb\xe0\xf3\xb3" "\x68\x82\x7a\x26\x15\x2b\xa9\x9d\x4f\xc6\x92\x07\x67\xe4\x1a\x60\x23" "\x8b\x4d\xa5\x29\xdd\x83\x59\x32\xa6\x18\xb5\x96\x9b\x66\x54\xdf\x98" "\x6b\xb4\x69\x0b\xa5\xa1\x70\x06\x52\xad\x8f\x0d\x0b\x9e\x7a\xf5\xe5" "\x4d\x99\xd4\x95\x0b\x32\x34\xa5\xfa\x11\x1c\x4d\x05\x34\xee\xb9\x29" "\x6a\xd9\x8c\x33\x2c\x86\x1c\x39\xa2\xe1\x28\xd6\x8b\x2f\xe2\xdf\x98" "\x5c\x9b\x12\x5f\xdc\x6f\x93\x89\xcb\xe2\x89\x35\x36\x4f\x4a\x80\xd6" "\x87\x62\xc0\xe2\x83\x15\x41\x17\x98\x6e\x9f\x40\x35\x71\x85\xfb\x47" "\xbb\x47\x80\xb7\xcb\x4d\x0e\x1d\x61\x3f\xd0\x94\xdb\x9f\x5f\x49\xe8" "\xbc\xb2\x4a\xaf\x22\x94\x6d\x1e\x30\x79\x80\x1c\xc1\xe5\x0e\xed\xa0" "\x22\x38\xab\x98\x09\x79\xf3\xb9\xf5\xf0\x5a\xcb\x15\x4a\xb0\x66\xd2" "\x99\x84\x40\x35\x1b\x18\x38\xdb\x87\x23\x2e\x71\xcc\xa6\x83\xc5\x97" "\x6c\xce\xba\xfb\x4d\x5d\x44\x1e\x1d\x4c\x33\xe9\xd6\x4c\x44\x94\x8d" "\xd2\x41\xcd\xee\xf9\x38\xc6\xc8\x39\x54\x43\x79\xd3\xb4\x25\x0b\xa1" "\x20\x0d\x89\x60\xac\xde\xec\xcf\x4c\x47\x52\x4b\x1b\x37\x25\x00\xea" "\x38\xb2\x05\x65\x82\x03\x8c\x32", 382); syscall(SYS_write, r[0], 0x20000240ul, 0xfffffe6eul); } int main(int argc, char** argv) { syscall(SYS_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x32ul, -1, 0ul); program_name = argv[0]; if (argc == 2 && strcmp(argv[1], "child") == 0) child(); loop(); return 0; }