// 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; memcpy((void*)0x20000000, "/dev/pf\000", 8); res = syscall(SYS_openat, 0xffffffffffffff9cul, 0x20000000ul, 2ul, 0ul); if (res != -1) r[0] = res; *(uint64_t*)0x200000c0 = 0; *(uint32_t*)0x200000c8 = 0xa; *(uint64_t*)0x200000d0 = 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 = 0x20000900; memcpy( (void*)0x20000900, "\x8c\x28\x0c\xb7\xa6\x23\x44\xf9\x47\x39\xe4\x4b\xe9\xc1\x8a\x8a\xaf\x49" "\xb9\x06\xe1\x71\xbf\xde\x04\x1e\x9d\x04\x75\x5e\xdc\xe0\x35\xab\xed\x8c" "\xfc\xc6\xb6\x15\x87\x06\x17\xb3\x09\x9c\xb2\x57\x1e\xb9\x95\x1d\x95\x36" "\x2e\xe8\x3b\xf0\x52\x8c\x52\xdd\xcf\xa2\x36\x39\xe9\xcd\x85\xb8\x08\xd7" "\x88\x8a\x64\xae\x33\xd3\x63\x6c\xa9\x6c\x56\x84\x7a\x52\xc8\x82\xc0\x88" "\x88\x6a\x1f\x75\x47\x2c\xcd\x35\xe8\x7f\x8e\xb3\x44\xc9\x6f\x5c\xba\x1b" "\xc6\xce\xf0\xa0\x30\x09\x8f\x01\x91\x2e\xd0\xd3\xca\x24\xc9\x49\x19\x18" "\x80\xa1\x93\x2e\x30\x11\x94\x0c\xbd\x50\xb6\xf2\xd3\xb9\xfd\x8f\xdb\x45" "\xcc\x0c\xe2\x48\x04\xae\x37\x16\x2e\x62\xc9\x27\xd3\x00\x3b\xa1\x0b\x88" "\xd2\xa5\x7b\x3f\xdd\x3d\x09\x2c\xdf\xc9\x69\x36\x8a\xf5\xff\xaa\x45\x17" "\x24\x55\x67\x61\x28\xd3\x0d\xb5\x54\x09\x26\x70\xed\xe8\x69\x8c\x2c\x79" "\x65\xbd\xd2\xa6\xb4\x95\x89\x19\xf1\x46\x3f\x96\x07\x4b\x9e\xa6\x21\xae" "\xd9\x33\x47\x8f\x0a\x2b\x74\xdc\xc4\x00\x96\x7a\xff\x3d\x90\xed\x7a\x49" "\xb5\xa4\x78\xb4\xda\x78\xc6\x11\x10\x6b\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00", 256); *(uint64_t*)0x20000618 = 0x100; *(uint64_t*)0x20000620 = 0; *(uint64_t*)0x20000628 = 0; *(uint64_t*)0x200000d8 = 3; *(uint64_t*)0x200000e0 = 0; *(uint64_t*)0x200000e8 = 0xd0; *(uint32_t*)0x200000f0 = 1; syscall(SYS_sendmsg, -1, 0x200000c0ul, 4ul); syscall(SYS_ioctl, r[0], 0xcbe04404ul, 0x20000040ul); } int main(void) { syscall(SYS_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x1012ul, -1, 0ul); loop(); return 0; }