// https://syzkaller.appspot.com/bug?id=45d463e3ae38f3c38f2c82f0a8c6a2c1c8ce7457 // 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 unsigned long long procid; 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; 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; } } } #ifndef SYS_mmap #define SYS_mmap 197 #endif #ifndef SYS_sendto #define SYS_sendto 133 #endif #ifndef SYS_socket #define SYS_socket 394 #endif uint64_t r[1] = {0xffffffffffffffff}; void execute_one(void) { intptr_t res = 0; res = syscall(SYS_socket, 0x11, 3, 0); if (res != -1) r[0] = res; memcpy((void*)0x20000180, "\xb1\x00\x05\x04\x60\x00\x00\x00\x00\x00\x08\x00\x01\x01\x00\x00\x00" "\x00\x00\x00\xce\xa1\xfe\xa7\xfe\xf9\x6e\xcf\xc7\x3f\xd3\x35\x7a\xe2" "\x6c\xaa\x04\x16\xfa\x4f\x37\x63\x36\xac\xf0\x0b\x78\x04\xbe\x78\x1e" "\x49\x91\xf7\xc8\xdf\x5f\x88\x2b\x29\x7b\xe1\xaa\x5b\x23\xed\x00\xf4" "\xc8\xb2\xca\x3e\xbb\xc2\x57\x69\x9a\x1f\x13\x2e\x27\xac\xb5\xd6\x02" "\x00\x0d\x7d\x02\x6b\xa8\xaf\x63\xff\x37\x28\x29\x02\xe4\xfd\x89\x72" "\x0f\xd3\x87\x81\xff\x7c\xc5\x3c\x89\x43\x03\xb2\x2f\x31\x0b\x40\x4f" "\x36\xa0\x0f\x90\x00\x6e\xe0\x1b\xe6\x57\xae\xa8\xc5\x00\x00\x00\x02" "\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x31\xd8\x80" "\xe0\x61\x1f\xb1\x3e\xa9\x64\x6d\xc0\x15\x49\x21\x0e\xfe\x33\xfb\xf9" "\xf1\x4a\x5b\x3a\x7a\x14\x87\x11\x4b\x54\xc8\xb7\xe1\x43\xd9\x83\x59" "\x8c\xa4\x06\xb8\x71\xdb\x9e\xb5\xbf\x89\xca\xfb\x93\x16\xeb\x1d\x4e" "\x22\x01\x53\x20\xbb\x82\x88\x07\x51\xfc\x77\x1f\x17\xde\x89\x6a\x04" "\xf5\x5e\xbb\x78\x9f\x87\x89\x17\x98\x9f\x98\xc0\x0d\xae\xc1\x18\x8e" "\xc8\x02\xdc\x33\x94\xbb\x10\xb1\x5f\x50\x58\x07\xd1\x6d\x20\xc7\x63" "\x6f\xdb\x3a\xec\xb2\x3d\xd7\x94\x79\x3d\xc1\xd4\x2e\xe2\xf3\xfa\x83" "\x98\xaa\x00\x7b\x6b\x9b\x27\x00\x00\x00\x00\x00\x00\x00\x00\xf1\x4c" "\x85\x6c\xb8\xdd\x21\xbc\xbe\x10\xe9\x2a\x6e\x6b\xb0\x7a\xdb\x33\xfe" "\x38\x79\xb6\x91\x59\x65\x95\x39\x70\x18\x7c\x7b\xcd\x0d\x52\x16\x66" "\xbc\x9b\x31\xb9\x76\x06\x6c\xca\xf4\x27\xc8\xe3\x7d\x06\x72\xfc\xe8" "\x0f\xaa\xf1\x38\xeb\xa4\x18\x19\x77\x5d\xc8\xa7\xe7\x8e\x3f\x49\x9d" "\x68\x02\x67\xb2\x2d\x2d\x72\x12\x21\xce\x7a\x75\x73\xa8\xee\x22\x3a" "\x32\xab\x27\x1f\x2c\xb3\x9e\x2d\x6d\x3e\xba\x98\x47\x17\xd2", 406); syscall(SYS_sendto, r[0], 0x20000180, 0x467, 0, 0, 0x4af); } int main(void) { syscall(SYS_mmap, 0x20000000, 0x1000000, 3, 0x1012, -1, 0, 0); for (procid = 0; procid < 6; procid++) { if (fork() == 0) { loop(); } } sleep(1000000); return 0; }