// autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include uint64_t r[3] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0x1000000ul, /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/ 7ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x200001000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); const char* reason; (void)reason; intptr_t res = 0; if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } // openat$kvm arguments: [ // fd: const = 0xffffffffffffff9c (8 bytes) // file: ptr[in, buffer] { // buffer: {2f 64 65 76 2f 6b 76 6d 00} (length 0x9) // } // flags: open_flags = 0x0 (4 bytes) // mode: const = 0x0 (2 bytes) // ] // returns fd_kvm memcpy((void*)0x200000000000, "/dev/kvm\000", 9); res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x200000000000ul, /*flags=*/0, /*mode=*/0); if (res != -1) r[0] = res; // ioctl$KVM_CREATE_VM arguments: [ // fd: fd_kvm (resource) // cmd: const = 0xae01 (4 bytes) // type: intptr = 0x0 (8 bytes) // ] // returns fd_kvmvm res = syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0xae01, /*type=*/0ul); if (res != -1) r[1] = res; // ioctl$KVM_CREATE_GUEST_MEMFD arguments: [ // fd: fd_kvmvm (resource) // cmd: const = 0xc040aed4 (4 bytes) // arg: ptr[in, kvm_create_guest_memfd] { // kvm_create_guest_memfd { // size: int64 = 0x200001fe0000 (8 bytes) // flags: int64 = 0x0 (8 bytes) // reserved: buffer: {00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // 00 00 00 00 00 00 00 00 00} (length 0x30) // } // } // ] // returns fd_kvm_guest_memfd *(uint64_t*)0x2000000001c0 = 0x200001fe0000; *(uint64_t*)0x2000000001c8 = 0; memset((void*)0x2000000001d0, 0, 48); res = syscall(__NR_ioctl, /*fd=*/r[1], /*cmd=*/0xc040aed4, /*arg=*/0x2000000001c0ul); if (res != -1) r[2] = res; // ioctl$KVM_SET_USER_MEMORY_REGION2 arguments: [ // fd: fd_kvmvm (resource) // cmd: const = 0x40a0ae49 (4 bytes) // arg: ptr[in, kvm_userspace_memory_region2] { // kvm_userspace_memory_region2 { // slot: kvm_mem_slots = 0x4 (4 bytes) // flags: kvm_mem_region_flags = 0x4 (4 bytes) // paddr: kvm_guest_addrs = 0x80a0000 (8 bytes) // size: len = 0x2000 (8 bytes) // addr: VMA[0x2000] // guest_memfd_offset: int64 = 0x4000 (8 bytes) // guest_memfd: fd_kvm_guest_memfd (resource) // pad1: const = 0x0 (4 bytes) // pad2: buffer: {00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // 00 00} (length 0x70) // } // } // ] *(uint32_t*)0x200000000180 = 4; *(uint32_t*)0x200000000184 = 4; *(uint64_t*)0x200000000188 = 0x80a0000; *(uint64_t*)0x200000000190 = 0x2000; *(uint64_t*)0x200000000198 = 0x200000ffc000; *(uint64_t*)0x2000000001a0 = 0x4000; *(uint32_t*)0x2000000001a8 = r[2]; *(uint32_t*)0x2000000001ac = 0; memset((void*)0x2000000001b0, 0, 112); syscall(__NR_ioctl, /*fd=*/r[1], /*cmd=*/0x40a0ae49, /*arg=*/0x200000000180ul); // ioctl$KVM_SET_USER_MEMORY_REGION2 arguments: [ // fd: fd_kvmvm (resource) // cmd: const = 0x40a0ae49 (4 bytes) // arg: ptr[in, kvm_userspace_memory_region2] { // kvm_userspace_memory_region2 { // slot: kvm_mem_slots = 0x4 (4 bytes) // flags: kvm_mem_region_flags = 0x1 (4 bytes) // paddr: kvm_guest_addrs = 0xffff1000 (8 bytes) // size: len = 0x2000 (8 bytes) // addr: VMA[0x2000] // guest_memfd_offset: int64 = 0x8 (8 bytes) // guest_memfd: fd_kvm_guest_memfd (resource) // pad1: const = 0x0 (4 bytes) // pad2: buffer: {00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // 00 00} (length 0x70) // } // } // ] *(uint32_t*)0x200000000240 = 4; *(uint32_t*)0x200000000244 = 1; *(uint64_t*)0x200000000248 = 0xffff1000; *(uint64_t*)0x200000000250 = 0x2000; *(uint64_t*)0x200000000258 = 0x200000ffc000; *(uint64_t*)0x200000000260 = 8; *(uint32_t*)0x200000000268 = r[2]; *(uint32_t*)0x20000000026c = 0; memset((void*)0x200000000270, 0, 112); syscall(__NR_ioctl, /*fd=*/r[1], /*cmd=*/0x40a0ae49, /*arg=*/0x200000000240ul); return 0; }