// https://syzkaller.appspot.com/bug?id=8f063539d4ecf1faf3132624b57a641e923ee25a // 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(long a0, long a1, 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); } } #ifndef __NR_memfd_create #define __NR_memfd_create 319 #endif uint64_t r[3] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0); long res = 0; *(uint64_t*)0x20000140 = 0; syscall(__NR_setsockopt, -1, 0x28, 2, 0x20000140, 7); memcpy((void*)0x20000100, "/dev/kvm", 9); res = syscall(__NR_openat, 0xffffffffffffff9c, 0x20000100, 0, 0); if (res != -1) r[0] = res; res = syscall(__NR_ioctl, r[0], 0xae01, 0); if (res != -1) r[1] = res; res = syscall(__NR_ioctl, r[1], 0xae41, 0); if (res != -1) r[2] = res; *(uint32_t*)0x20000140 = 0x7b; *(uint32_t*)0x20000144 = 0xbff; *(uint64_t*)0x20000148 = -1; *(uint64_t*)0x20000150 = 0xfffffffffffffffe; *(uint64_t*)0x20000158 = 0; *(uint64_t*)0x20000160 = 0x19; *(uint8_t*)0x20000168 = 0; *(uint8_t*)0x20000169 = 0; *(uint8_t*)0x2000016a = 0; *(uint8_t*)0x2000016b = 0; *(uint8_t*)0x2000016c = 0; *(uint8_t*)0x2000016d = 0; *(uint8_t*)0x2000016e = 0; *(uint8_t*)0x2000016f = 0; *(uint8_t*)0x20000170 = 0; *(uint8_t*)0x20000171 = 0; *(uint8_t*)0x20000172 = 0; *(uint8_t*)0x20000173 = 0; *(uint8_t*)0x20000174 = 0; *(uint8_t*)0x20000175 = 0; *(uint8_t*)0x20000176 = 0; *(uint8_t*)0x20000177 = 0; *(uint8_t*)0x20000178 = 0; *(uint8_t*)0x20000179 = 0; *(uint8_t*)0x2000017a = 0; *(uint8_t*)0x2000017b = 0; *(uint8_t*)0x2000017c = 0; *(uint8_t*)0x2000017d = 0; *(uint8_t*)0x2000017e = 0; *(uint8_t*)0x2000017f = 0; *(uint8_t*)0x20000180 = 0; *(uint8_t*)0x20000181 = 0; *(uint8_t*)0x20000182 = 0; *(uint8_t*)0x20000183 = 0; *(uint8_t*)0x20000184 = 0; *(uint8_t*)0x20000185 = 0; *(uint8_t*)0x20000186 = 0; *(uint8_t*)0x20000187 = 0; *(uint8_t*)0x20000188 = 0; *(uint8_t*)0x20000189 = 0; *(uint8_t*)0x2000018a = 0; *(uint8_t*)0x2000018b = 0; *(uint8_t*)0x2000018c = 0; *(uint8_t*)0x2000018d = 0; *(uint8_t*)0x2000018e = 0; *(uint8_t*)0x2000018f = 0; *(uint8_t*)0x20000190 = 0; *(uint8_t*)0x20000191 = 0; *(uint8_t*)0x20000192 = 0; *(uint8_t*)0x20000193 = 0; *(uint8_t*)0x20000194 = 0; *(uint8_t*)0x20000195 = 0; *(uint8_t*)0x20000196 = 0; *(uint8_t*)0x20000197 = 0; *(uint8_t*)0x20000198 = 0; *(uint8_t*)0x20000199 = 0; *(uint8_t*)0x2000019a = 0; *(uint8_t*)0x2000019b = 0; *(uint8_t*)0x2000019c = 0; *(uint8_t*)0x2000019d = 0; *(uint8_t*)0x2000019e = 0; *(uint8_t*)0x2000019f = 0; *(uint8_t*)0x200001a0 = 0; *(uint8_t*)0x200001a1 = 0; *(uint8_t*)0x200001a2 = 0; *(uint8_t*)0x200001a3 = 0; *(uint8_t*)0x200001a4 = 0; *(uint8_t*)0x200001a5 = 0; *(uint8_t*)0x200001a6 = 0; *(uint8_t*)0x200001a7 = 0; syscall(__NR_ioctl, r[2], 0x4080aebf, 0x20000140); memcpy((void*)0x200002c0, "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x76\x8e" "\x05\xf7\xc1\x55\xad\x7d\xc6\x94\x7c\x57\x3e\x5a\x69\x24\x4e\x76\x38" "\x2c\x0a\xa6\x3d\x57\x5e\xa3\x59\x7f\x8b\x17\x28\x27\x7e\xf7\x6b\x30" "\x54\x4d\x7b\xa9\x2d\xcf\x97\x8f\x1f\x81\xdc\x1b\x7f\x8f\x7b\x34\x51" "\xda\xda\x02\xec\xb4\xf1\xdd\xcc\x8b\x52\x41\xda\x89\x45\x66\x6e\x00" "\x73\xc2\x5a\x62\x87\xc6\x4d\xbe\xa3\x7a", 95); syscall(__NR_memfd_create, 0x200002c0, 0); memcpy((void*)0x20000400, "/dev/input/mouse#", 18); syz_open_dev(0x20000400, 0, 0xc800); syscall(__NR_read, -1, 0x200020c0, 0x1000); *(uint32_t*)0x20000100 = 0x50; *(uint32_t*)0x20000104 = 0; *(uint64_t*)0x20000108 = 1; *(uint32_t*)0x20000110 = 7; *(uint32_t*)0x20000114 = 0x1b; *(uint32_t*)0x20000118 = 0; *(uint32_t*)0x2000011c = 0; *(uint16_t*)0x20000120 = 0; *(uint16_t*)0x20000122 = 0; *(uint32_t*)0x20000124 = 0; *(uint32_t*)0x20000128 = 0; *(uint32_t*)0x2000012c = 0; *(uint32_t*)0x20000130 = 0; *(uint32_t*)0x20000134 = 0; *(uint32_t*)0x20000138 = 0; *(uint32_t*)0x2000013c = 0; *(uint32_t*)0x20000140 = 0; *(uint32_t*)0x20000144 = 0; *(uint32_t*)0x20000148 = 0; *(uint32_t*)0x2000014c = 0; syscall(__NR_write, -1, 0x20000100, 0x50); syscall(__NR_ioctl, -1, 0x6609); syscall(__NR_ioctl, -1, 0, 0x20000280); syscall(__NR_pread64, -1, 0x20002640, 0xfffffede, 0); *(uint64_t*)0x20000000 = 0; syscall(__NR_sendfile, -1, -1, 0x20000000, 0); return 0; }