// https://syzkaller.appspot.com/bug?id=be60456568c2997d90fc217b9ca0285cf2776e25 // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0x1000000, /*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=*/0x1000, /*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)) { } // mkdirat arguments: [ // fd: fd_dir (resource) // path: ptr[in, buffer] { // buffer: {2e 2f 74 72 61 63 69 6e 67 00} (length 0xa) // } // mode: open_mode = 0x1ff (8 bytes) // ] memcpy((void*)0x200000000000, "./tracing\000", 10); syscall( __NR_mkdirat, /*fd=*/0xffffff9c, /*path=*/0x200000000000ul, /*mode=S_IXOTH|S_IWOTH|S_IROTH|S_IXGRP|S_IWGRP|S_IRGRP|S_IXUSR|S_IWUSR|0x100*/ 0x1fful); // mount arguments: [ // src: nil // dst: ptr[in, buffer] { // buffer: {2e 2f 74 72 61 63 69 6e 67 00} (length 0xa) // } // type: ptr[in, buffer] { // buffer: {74 72 61 63 65 66 73 00} (length 0x8) // } // flags: mount_flags = 0x0 (8 bytes) // data: nil // ] memcpy((void*)0x200000000100, "./tracing\000", 10); memcpy((void*)0x200000000200, "tracefs\000", 8); syscall(__NR_mount, /*src=*/0ul, /*dst=*/0x200000000100ul, /*type=*/0x200000000200ul, /*flags=*/0ul, /*data=*/0ul); // openat arguments: [ // fd: fd_dir (resource) // file: ptr[in, buffer] { // buffer: {2e 2f 74 72 61 63 69 6e 67 2f 65 76 65 6e 74 73 2f 6b 76 6d // 2f 6b 76 6d 5f 68 76 5f 73 74 69 6d 65 72 5f 63 6c 65 61 6e 75 70 2f // 74 72 69 67 67 65 72 00} (length 0x33) // } // flags: open_flags = 0x1 (4 bytes) // mode: open_mode = 0x0 (2 bytes) // ] // returns fd memcpy((void*)0x200000000500, "./tracing/events/kvm/kvm_hv_stimer_cleanup/trigger\000", 51); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000500ul, /*flags=O_WRONLY*/ 1, /*mode=*/0); if (res != -1) r[0] = res; // write arguments: [ // fd: fd (resource) // buf: ptr[in, buffer] { // buffer: {73 74 61 63 6b 74 72 61 63 65} (length 0xa) // } // count: len = 0xa (8 bytes) // ] memcpy((void*)0x200000000600, "stacktrace", 10); syscall(__NR_write, /*fd=*/r[0], /*buf=*/0x200000000600ul, /*count=*/0xaul); // 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 = 0x2000 (4 bytes) // mode: const = 0x0 (2 bytes) // ] // returns fd_kvm memcpy((void*)0x200000000200, "/dev/kvm\000", 9); res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x200000000200ul, /*flags=FASYNC*/ 0x2000, /*mode=*/0); if (res != -1) r[1] = 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[1], /*cmd=*/0xae01, /*type=*/0ul); if (res != -1) r[2] = res; // ioctl$KVM_CREATE_VCPU arguments: [ // fd: fd_kvmvm (resource) // cmd: const = 0xae41 (4 bytes) // id: intptr = 0x1 (8 bytes) // ] // returns fd_kvmcpu res = syscall(__NR_ioctl, /*fd=*/r[2], /*cmd=*/0xae41, /*id=*/1ul); if (res != -1) r[3] = res; // ioctl$KVM_SET_MSRS arguments: [ // fd: fd_kvmcpu (resource) // cmd: const = 0x4008ae89 (4 bytes) // arg: ptr[in, kvm_msrs] { // kvm_msrs { // nmsrs: len = 0x1 (4 bytes) // pad: const = 0x0 (4 bytes) // entries: array[kvm_msr_entry] { // kvm_msr_entry { // index: msr_index = 0x40000071 (4 bytes) // reserv: const = 0x0 (4 bytes) // data: int64 = 0x2ff (8 bytes) // } // } // } // } // ] *(uint32_t*)0x2000000001c0 = 1; *(uint32_t*)0x2000000001c4 = 0; *(uint32_t*)0x2000000001c8 = 0x40000071; *(uint32_t*)0x2000000001cc = 0; *(uint64_t*)0x2000000001d0 = 0x2ff; syscall(__NR_ioctl, /*fd=*/r[3], /*cmd=*/0x4008ae89, /*arg=*/0x2000000001c0ul); return 0; }