// 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 #define BITMASK_LEN(type, bf_len) (type)((1ull << (bf_len)) - 1) #define BITMASK_LEN_OFF(type, bf_off, bf_len) \ (type)(BITMASK_LEN(type, (bf_len)) << (bf_off)) #define STORE_BY_BITMASK(type, addr, val, bf_off, bf_len) \ if ((bf_off) == 0 && (bf_len) == 0) { \ *(type*)(addr) = (type)(val); \ } else { \ type new_val = *(type*)(addr); \ new_val &= ~BITMASK_LEN_OFF(type, (bf_off), (bf_len)); \ new_val |= ((type)(val)&BITMASK_LEN(type, (bf_len))) << (bf_off); \ *(type*)(addr) = new_val; \ } uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0); long res = 0; memcpy((void*)0x20000240, "/dev/autofs", 12); res = syscall(__NR_openat, 0xffffffffffffff9c, 0x20000240, 0, 0); if (res != -1) r[0] = res; syscall(__NR_getpid); *(uint64_t*)0x20000280 = 0; *(uint64_t*)0x20000288 = 0; *(uint16_t*)0x20000290 = 0; *(uint16_t*)0x20000292 = 0; *(uint32_t*)0x20000294 = 0; syscall(__NR_ioctl, r[0], 0xc0189436, 0x20000280); memcpy((void*)0x20000480, "/dev/kvm", 9); syscall(__NR_openat, 0xffffffffffffff9c, 0x20000480, 0, 0); syscall(__NR_socket, 2, 1, 0); *(uint32_t*)0x200002c0 = 1; *(uint32_t*)0x200002c4 = 0x70; *(uint8_t*)0x200002c8 = 0; *(uint8_t*)0x200002c9 = 0; *(uint8_t*)0x200002ca = 0; *(uint8_t*)0x200002cb = 0; *(uint32_t*)0x200002cc = 0; *(uint64_t*)0x200002d0 = 0x50d; *(uint64_t*)0x200002d8 = 0; *(uint64_t*)0x200002e0 = 0; STORE_BY_BITMASK(uint64_t, 0x200002e8, 0, 0, 1); STORE_BY_BITMASK(uint64_t, 0x200002e8, 0, 1, 1); STORE_BY_BITMASK(uint64_t, 0x200002e8, 0, 2, 1); STORE_BY_BITMASK(uint64_t, 0x200002e8, 0, 3, 1); STORE_BY_BITMASK(uint64_t, 0x200002e8, 0, 4, 1); STORE_BY_BITMASK(uint64_t, 0x200002e8, 0x44b, 5, 1); STORE_BY_BITMASK(uint64_t, 0x200002e8, 0x40000000, 6, 1); STORE_BY_BITMASK(uint64_t, 0x200002e8, 0, 7, 1); STORE_BY_BITMASK(uint64_t, 0x200002e8, 0, 8, 1); STORE_BY_BITMASK(uint64_t, 0x200002e8, 0, 9, 1); STORE_BY_BITMASK(uint64_t, 0x200002e8, 0, 10, 1); STORE_BY_BITMASK(uint64_t, 0x200002e8, 0, 11, 1); STORE_BY_BITMASK(uint64_t, 0x200002e8, 0, 12, 1); STORE_BY_BITMASK(uint64_t, 0x200002e8, 0, 13, 1); STORE_BY_BITMASK(uint64_t, 0x200002e8, 0, 14, 1); STORE_BY_BITMASK(uint64_t, 0x200002e8, 0, 15, 2); STORE_BY_BITMASK(uint64_t, 0x200002e8, 0, 17, 1); STORE_BY_BITMASK(uint64_t, 0x200002e8, 0, 18, 1); STORE_BY_BITMASK(uint64_t, 0x200002e8, 0, 19, 1); STORE_BY_BITMASK(uint64_t, 0x200002e8, 0, 20, 1); STORE_BY_BITMASK(uint64_t, 0x200002e8, 0, 21, 1); STORE_BY_BITMASK(uint64_t, 0x200002e8, 0, 22, 1); STORE_BY_BITMASK(uint64_t, 0x200002e8, 0, 23, 1); STORE_BY_BITMASK(uint64_t, 0x200002e8, 0, 24, 1); STORE_BY_BITMASK(uint64_t, 0x200002e8, 0, 25, 1); STORE_BY_BITMASK(uint64_t, 0x200002e8, 0, 26, 1); STORE_BY_BITMASK(uint64_t, 0x200002e8, 0, 27, 1); STORE_BY_BITMASK(uint64_t, 0x200002e8, 0, 28, 1); STORE_BY_BITMASK(uint64_t, 0x200002e8, 0, 29, 35); *(uint32_t*)0x200002f0 = 0; *(uint32_t*)0x200002f4 = 0; *(uint64_t*)0x200002f8 = 0x20000000; *(uint64_t*)0x20000300 = 0; *(uint64_t*)0x20000308 = 0; *(uint64_t*)0x20000310 = 0; *(uint32_t*)0x20000318 = 0xfffffffe; *(uint32_t*)0x2000031c = 0; *(uint64_t*)0x20000320 = 0; *(uint32_t*)0x20000328 = 0; *(uint16_t*)0x2000032c = 0; *(uint16_t*)0x2000032e = 0; syscall(__NR_perf_event_open, 0x200002c0, 0, 0, -1, 0); *(uint32_t*)0x20000180 = 0x8000; syscall(__NR_ioctl, -1, 0x4004ae86, 0x20000180); syscall(__NR_ioctl, -1, 0xae80, 0x1d); memcpy((void*)0x20000240, "/dev/autofs", 12); syscall(__NR_openat, 0xffffffffffffff9c, 0x20000240, 0, 0); syscall(__NR_getpid); *(uint32_t*)0x20000400 = 0x18; *(uint8_t*)0x20000404 = 0xf; *(uint16_t*)0x20000405 = 0; *(uint8_t*)0x20000407 = 0x21; *(uint32_t*)0x20000408 = 4; *(uint64_t*)0x2000040c = 0; *(uint32_t*)0x20000414 = 0; syscall(__NR_write, -1, 0x20000400, 0x18); memcpy((void*)0x20000480, "/dev/kvm", 9); res = syscall(__NR_openat, 0xffffffffffffff9c, 0x20000480, 0, 0); if (res != -1) r[1] = res; syscall(__NR_socketpair, 8, 0x801, 0xe2, 0x20000040); res = syscall(__NR_ioctl, r[1], 0xae01, 0); if (res != -1) r[2] = res; res = syscall(__NR_ioctl, r[2], 0xae41, 0); if (res != -1) r[3] = res; syscall(__NR_ioctl, r[3], 0x4080aebf, 0x200004c0); *(uint32_t*)0x200001c0 = 0; syscall(__NR_setsockopt, -1, 0, 0, 0x200001c0, 4); *(uint64_t*)0x20000200 = 0; *(uint64_t*)0x20000208 = 0; *(uint64_t*)0x20000210 = 0; *(uint64_t*)0x20000218 = 0; *(uint64_t*)0x20000220 = 9; *(uint64_t*)0x20000228 = 0; *(uint64_t*)0x20000230 = 0xff; *(uint64_t*)0x20000238 = 0; *(uint64_t*)0x20000240 = 0; *(uint64_t*)0x20000248 = 0; *(uint64_t*)0x20000250 = 0; *(uint64_t*)0x20000258 = 0; *(uint64_t*)0x20000260 = 0; *(uint64_t*)0x20000268 = 0; *(uint64_t*)0x20000270 = 0; *(uint64_t*)0x20000278 = 0; *(uint64_t*)0x20000280 = 0x1f000; *(uint64_t*)0x20000288 = 1; syscall(__NR_ioctl, -1, 0x4090ae82, 0x20000200); syscall(__NR_ioctl, -1, 0xae41, 0); return 0; }