// https://syzkaller.appspot.com/bug?id=914b8f7fda6f80e47f0b3f52dc4045b0f9e1ab46 // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include static long syz_open_dev(volatile long a0, volatile long a1, volatile long a2) { if (a0 == 0xc || a0 == 0xb) { char buf[128]; sprintf(buf, "/dev/%s/%d:%d", a0 == 0xc ? "char" : "block", (uint8_t)a1, (uint8_t)a2); return open(buf, O_RDWR, 0); } else { char buf[1024]; char* hash; strncpy(buf, (char*)a0, sizeof(buf) - 1); buf[sizeof(buf) - 1] = 0; while ((hash = strchr(buf, '#'))) { *hash = '0' + (char)(a1 % 10); a1 /= 10; } return open(buf, a2, 0); } } uint64_t r[3] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, 0x1ffff000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul); syscall(__NR_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x32ul, -1, 0ul); syscall(__NR_mmap, 0x21000000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul); intptr_t res = 0; memcpy((void*)0x20000200, "/dev/loop#\000", 11); res = -1; res = syz_open_dev(0x20000200, 6, 0); if (res != -1) r[0] = res; memcpy((void*)0x200000c0, "/proc/bus/input/handlers\000", 25); res = syscall(__NR_openat, 0xffffffffffffff9cul, 0x200000c0ul, 0ul, 0ul); if (res != -1) r[1] = res; syscall(__NR_ioctl, r[0], 0x4c00, r[1]); memcpy((void*)0x20000200, "/dev/loop#\000", 11); res = -1; res = syz_open_dev(0x20000200, 6, 0); if (res != -1) r[2] = res; *(uint64_t*)0x20000000 = 0; *(uint64_t*)0x20000008 = 0; *(uint64_t*)0x20000010 = 0; *(uint64_t*)0x20000018 = 0; *(uint64_t*)0x20000020 = -1; *(uint32_t*)0x20000028 = 0; *(uint32_t*)0x2000002c = 0; *(uint32_t*)0x20000030 = 0; *(uint32_t*)0x20000034 = 0; memcpy((void*)0x20000038, "\x33\xc7\x6b\xae\x1f\x0d\x6c\x76\x58\x4c\xc8\xdd\x78\x4e\x60\x05\x20" "\xc9\xd8\xa7\xd5\xe4\x4f\x5e\x96\x59\xe9\x28\x0e\x75\x7a\xec\x0e\x66" "\x04\xc2\x89\x7f\xb2\xae\x72\xf9\xa0\x23\x8d\xee\x40\xdc\x56\x03\x1d" "\x7c\x47\x87\x85\x98\xe6\x92\x05\x52\x82\xcf\x16\xe9", 64); memcpy((void*)0x20000078, "\x80\x38\x46\xa9\x74\x85\x43\x4b\xc5\xfb\xe6\x63\x8e\xd8\xf9\x2b\x85" "\x05\xa8\xae\x50\xf9\xc6\x91\x75\xec\x3b\xde\x55\x31\xa6\x1a\xe7\xa4" "\x86\xff\x1b\x91\x77\x74\x22\xb2\xfd\x5c\xdf\x1b\x16\x3c\x3b\xbc\xc7" "\xcf\x6d\xa7\xa2\x64\x71\x19\xc8\xd9\x4a\xde\x5b\x77", 64); memcpy((void*)0x200000b8, "\x75\x6e\x03\x85\xbd\x34\xb5\x20\x75\x2c\x11\x10\x27\x31\x24\xa5\xbb" "\x8b\x5e\xeb\x48\xae\x14\x02\xe9\x18\x64\xef\x45\x24\x64\xb6", 32); *(uint64_t*)0x200000d8 = 0x80000005; *(uint64_t*)0x200000e0 = 3; syscall(__NR_ioctl, r[2], 0x4c04, 0x20000000ul); syscall(__NR_ioctl, r[2], 0x4c05, 0x20000340ul); return 0; }