// https://syzkaller.appspot.com/bug?id=85fb9ce5c7bd3f31a84a8d55a745959e39836bda // 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 #include #define BITMASK(bf_off, bf_len) (((1ull << (bf_len)) - 1) << (bf_off)) #define STORE_BY_BITMASK(type, htobe, addr, val, bf_off, bf_len) \ *(type*)(addr) = \ htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | \ (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len)))) static long syz_kvm_setup_cpu(volatile long a0, volatile long a1, volatile long a2, volatile long a3, volatile long a4, volatile long a5, volatile long a6, volatile long a7) { return 0; } #ifndef __NR_ioctl #define __NR_ioctl 54 #endif #ifndef __NR_mmap #define __NR_mmap 192 #endif #ifndef __NR_openat #define __NR_openat 295 #endif #ifndef __NR_perf_event_open #define __NR_perf_event_open 336 #endif #ifndef __NR_write #define __NR_write 4 #endif #undef __NR_mmap #define __NR_mmap __NR_mmap2 uint64_t r[3] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0); intptr_t res = 0; memcpy((void*)0x20000200, "/dev/kvm\000", 9); res = syscall(__NR_openat, 0xffffff9c, 0x20000200, 0, 0); if (res != -1) r[0] = res; res = syscall(__NR_ioctl, (intptr_t)r[0], 0xae01, 0); if (res != -1) r[1] = res; *(uint32_t*)0x20000280 = 0x20; *(uint32_t*)0x20000284 = 0x200000c0; memcpy((void*)0x200000c0, "\xb9\x80\x00\x00\xc0\x0f\x32\x35\x01\x00\x00\x00\x0f\x30\x9a\x09\x00" "\x00\x00\x65\x00\x66\x0f\x38\x82\xaf\x72\x4d\x00\x00\x2e\xd8\xdd\xc7" "\x44\x24\x00\x8f\xc4\xbd\x87\xc7\x44\x24\x02\xc4\x3a\x72\x7f\xc7\x44" "\x24\x06\x00\x00\x00\x00\x0f\x01\x14\x24\xf3\x0f\x09\x0f\x01\x3a\x36" "\x0f\x06\xc4\xc1\x8d\x72\xd6\x83\x66\xba\xa1\x00\xed", 81); *(uint32_t*)0x20000288 = 0x51; syz_kvm_setup_cpu(-1, -1, 0x20032000, 0x20000280, 1, 0, 0, 0); res = syscall(__NR_ioctl, (intptr_t)r[1], 0xae41, 0); if (res != -1) r[2] = res; *(uint32_t*)0x20bf7000 = 0; *(uint32_t*)0x20bf7004 = 0; *(uint64_t*)0x20bf7008 = 0; *(uint64_t*)0x20bf7010 = 0x2000; *(uint32_t*)0x20bf7018 = 0x20000000; syscall(__NR_ioctl, (intptr_t)r[1], 0x4020ae46, 0x20bf7000); *(uint64_t*)0x200002c0 = 0; *(uint64_t*)0x200002c8 = 0; *(uint64_t*)0x200002d0 = 0x40000004; *(uint64_t*)0x200002d8 = 0; *(uint64_t*)0x200002e0 = 1; *(uint64_t*)0x200002e8 = 0; *(uint64_t*)0x200002f0 = 0x400000004cb; *(uint64_t*)0x200002f8 = 0; *(uint64_t*)0x20000300 = 0; *(uint64_t*)0x20000308 = 0; *(uint64_t*)0x20000310 = 0; *(uint64_t*)0x20000318 = 0; *(uint64_t*)0x20000320 = 0; *(uint64_t*)0x20000328 = 0; *(uint64_t*)0x20000330 = 0; *(uint64_t*)0x20000338 = 0; *(uint64_t*)0x20000340 = 0; *(uint64_t*)0x20000348 = 0; syscall(__NR_ioctl, (intptr_t)r[2], 0x4090ae82, 0x200002c0); syscall(__NR_ioctl, (intptr_t)r[2], 0xae80, 0); *(uint32_t*)0x20000000 = 0; *(uint32_t*)0x20000004 = 0x70; *(uint8_t*)0x20000008 = 0; *(uint8_t*)0x20000009 = 0; *(uint8_t*)0x2000000a = 0; *(uint8_t*)0x2000000b = 0; *(uint32_t*)0x2000000c = 0; *(uint64_t*)0x20000010 = 0; *(uint64_t*)0x20000018 = 0; *(uint64_t*)0x20000020 = 0; STORE_BY_BITMASK(uint64_t, , 0x20000028, 0, 0, 1); STORE_BY_BITMASK(uint64_t, , 0x20000028, 0, 1, 1); STORE_BY_BITMASK(uint64_t, , 0x20000028, 0, 2, 1); STORE_BY_BITMASK(uint64_t, , 0x20000028, 0, 3, 1); STORE_BY_BITMASK(uint64_t, , 0x20000028, 0, 4, 1); STORE_BY_BITMASK(uint64_t, , 0x20000028, 0, 5, 1); STORE_BY_BITMASK(uint64_t, , 0x20000028, 0, 6, 1); STORE_BY_BITMASK(uint64_t, , 0x20000028, 0, 7, 1); STORE_BY_BITMASK(uint64_t, , 0x20000028, 9, 8, 1); STORE_BY_BITMASK(uint64_t, , 0x20000028, 0, 9, 1); STORE_BY_BITMASK(uint64_t, , 0x20000028, 0, 10, 1); STORE_BY_BITMASK(uint64_t, , 0x20000028, 0, 11, 1); STORE_BY_BITMASK(uint64_t, , 0x20000028, 0, 12, 1); STORE_BY_BITMASK(uint64_t, , 0x20000028, 0, 13, 1); STORE_BY_BITMASK(uint64_t, , 0x20000028, 1, 14, 1); STORE_BY_BITMASK(uint64_t, , 0x20000028, 0, 15, 2); STORE_BY_BITMASK(uint64_t, , 0x20000028, 0, 17, 1); STORE_BY_BITMASK(uint64_t, , 0x20000028, 0, 18, 1); STORE_BY_BITMASK(uint64_t, , 0x20000028, 0, 19, 1); STORE_BY_BITMASK(uint64_t, , 0x20000028, 0, 20, 1); STORE_BY_BITMASK(uint64_t, , 0x20000028, 0, 21, 1); STORE_BY_BITMASK(uint64_t, , 0x20000028, 0, 22, 1); STORE_BY_BITMASK(uint64_t, , 0x20000028, 0, 23, 1); STORE_BY_BITMASK(uint64_t, , 0x20000028, 0, 24, 1); STORE_BY_BITMASK(uint64_t, , 0x20000028, 0, 25, 1); STORE_BY_BITMASK(uint64_t, , 0x20000028, 0, 26, 1); STORE_BY_BITMASK(uint64_t, , 0x20000028, 0, 27, 1); STORE_BY_BITMASK(uint64_t, , 0x20000028, 0, 28, 1); STORE_BY_BITMASK(uint64_t, , 0x20000028, 0, 29, 35); *(uint32_t*)0x20000030 = 0; *(uint32_t*)0x20000034 = 2; *(uint64_t*)0x20000038 = 0; *(uint64_t*)0x20000040 = 0; *(uint64_t*)0x20000048 = 0; *(uint64_t*)0x20000050 = 0; *(uint32_t*)0x20000058 = 0; *(uint32_t*)0x2000005c = 0; *(uint64_t*)0x20000060 = 0; *(uint32_t*)0x20000068 = 0; *(uint16_t*)0x2000006c = 7; *(uint16_t*)0x2000006e = 0; syscall(__NR_perf_event_open, 0x20000000, 0, 0, -1, 0); *(uint32_t*)0x200000c0 = 7; *(uint8_t*)0x200000c4 = 0x1b; *(uint16_t*)0x200000c5 = 0; syscall(__NR_write, -1, 0x200000c0, 7); *(uint32_t*)0x20000000 = 0x14; *(uint8_t*)0x20000004 = 0x11; *(uint16_t*)0x20000005 = 0; *(uint8_t*)0x20000007 = 0; *(uint32_t*)0x20000008 = 0; *(uint64_t*)0x2000000c = 0; syscall(__NR_write, -1, 0x20000000, 0x14); *(uint32_t*)0x20000080 = 0; *(uint32_t*)0x20000084 = 0; *(uint64_t*)0x20000088 = 0; *(uint64_t*)0x20000090 = 0x2000; *(uint32_t*)0x20000098 = 0x20044000; syscall(__NR_ioctl, -1, 0x4020ae46, 0x20000080); syscall(__NR_ioctl, (intptr_t)r[2], 0xae80, 0); return 0; }