// https://syzkaller.appspot.com/bug?id=412d1fafbff729589891e2457ee6b36de44ae0b7 // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include uint64_t r[5] = {0xffffffffffffffff, 0x0, 0x0, 0x0, 0x0}; 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$iommufd arguments: [ // fd: const = 0xffffffffffffff9c (8 bytes) // file: ptr[in, buffer] { // buffer: {2f 64 65 76 2f 69 6f 6d 6d 75 00} (length 0xb) // } // flags: open_flags = 0x0 (4 bytes) // mode: const = 0x0 (2 bytes) // ] // returns fd_iommufd memcpy((void*)0x200000000000, "/dev/iommu\000", 11); res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x200000000000ul, /*flags=*/0, /*mode=*/0); if (res != -1) r[0] = res; // ioctl$IOMMU_IOAS_ALLOC arguments: [ // fd: fd_iommufd (resource) // cmd: const = 0x3b81 (4 bytes) // arg: ptr[in, iommu_ioas_alloc] { // iommu_ioas_alloc { // size: len = 0xc (4 bytes) // flags: const = 0x0 (4 bytes) // out_ioas_id: ioas_handle (resource) // } // } // ] *(uint32_t*)0x200000000340 = 0xc; *(uint32_t*)0x200000000344 = 0; res = syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x3b81, /*arg=*/0x200000000340ul); if (res != -1) r[1] = *(uint32_t*)0x200000000348; // ioctl$IOMMU_TEST_OP_MOCK_DOMAIN_FLAGS arguments: [ // fd: fd_iommufd (resource) // cmd: const = 0x3ba0 (4 bytes) // arg: ptr[in, iommu_test_cmd$mock_domain_flags] { // iommu_test_cmd$mock_domain_flags { // size: len = 0x48 (4 bytes) // op: const = 0x2 (4 bytes) // id: ioas_handle (resource) // __reserved: const = 0x0 (4 bytes) // out_stdev_id: selftest_device_handle (resource) // out_hwpt_id: hwpt_handle (resource) // out_idev_id: device_handle (resource) // dev_flags: iommu_test_cmd_mock_domain_flags = 0x0 (4 bytes) // pad = 0x0 (40 bytes) // } // } // ] *(uint32_t*)0x200000000200 = 0x48; *(uint32_t*)0x200000000204 = 2; *(uint32_t*)0x200000000208 = r[1]; *(uint32_t*)0x20000000020c = 0; *(uint32_t*)0x20000000021c = 0; res = syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x3ba0, /*arg=*/0x200000000200ul); if (res != -1) r[2] = *(uint32_t*)0x200000000218; // ioctl$IOMMU_IOAS_ALLOC arguments: [ // fd: fd_iommufd (resource) // cmd: const = 0x3b81 (4 bytes) // arg: ptr[in, iommu_ioas_alloc] { // iommu_ioas_alloc { // size: len = 0xc (4 bytes) // flags: const = 0x0 (4 bytes) // out_ioas_id: ioas_handle (resource) // } // } // ] *(uint32_t*)0x2000000000c0 = 0xc; *(uint32_t*)0x2000000000c4 = 0; res = syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x3b81, /*arg=*/0x2000000000c0ul); if (res != -1) r[3] = *(uint32_t*)0x2000000000c8; // ioctl$IOMMU_HWPT_ALLOC$TEST arguments: [ // fd: fd_iommufd (resource) // cmd: const = 0x3b89 (4 bytes) // arg: ptr[in, iommu_hwpt_alloc[IOMMU_HWPT_DATA_SELFTEST, // iommu_hwpt_selftest]] { // iommu_hwpt_alloc[IOMMU_HWPT_DATA_SELFTEST, iommu_hwpt_selftest] { // size: len = 0x18 (4 bytes) // flags: iommufd_hwpt_alloc_flags = 0x3 (4 bytes) // dev_id: device_handle (resource) // pt_id: ioas_handle (resource) // out_hwpt_id: hwpt_handle (resource) // __reserved: const = 0x0 (4 bytes) // data_type: const = 0xdead (4 bytes) // data_len: len = 0x4 (4 bytes) // uptr: ptr[in, iommu_hwpt_selftest] { // iommu_hwpt_selftest { // iotlb: const = 0xbadbeef (4 bytes) // } // } // } // } // ] *(uint32_t*)0x2000000002c0 = 0x18; *(uint32_t*)0x2000000002c4 = 3; *(uint32_t*)0x2000000002c8 = r[2]; *(uint32_t*)0x2000000002cc = r[3]; *(uint32_t*)0x2000000002d4 = 0; *(uint32_t*)0x2000000002d8 = 0xdead; *(uint32_t*)0x2000000002dc = 4; *(uint64_t*)0x2000000002e0 = 0x200000000280; *(uint32_t*)0x200000000280 = 0xbadbeef; res = syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x3b89, /*arg=*/0x2000000002c0ul); if (res != -1) r[4] = *(uint32_t*)0x2000000002d0; // ioctl$IOMMU_HWPT_GET_DIRTY_BITMAP arguments: [ // fd: fd_iommufd (resource) // cmd: const = 0x3b8c (4 bytes) // arg: ptr[in, iommu_hwpt_get_dirty_bitmap] { // iommu_hwpt_get_dirty_bitmap { // size: len = 0x30 (4 bytes) // hwpt_id: hwpt_handle (resource) // flags: iommufd_hwpt_get_dirty_bitmap_flags = 0x0 (4 bytes) // __reserved: const = 0x0 (4 bytes) // iova: int64 = 0x0 (8 bytes) // length: int64 = 0x0 (8 bytes) // page_size: int64 = 0x8000000000000000 (8 bytes) // data: nil // } // } // ] *(uint32_t*)0x200000000300 = 0x30; *(uint32_t*)0x200000000304 = r[4]; *(uint32_t*)0x200000000308 = 0; *(uint32_t*)0x20000000030c = 0; *(uint64_t*)0x200000000310 = 0; *(uint64_t*)0x200000000318 = 0; *(uint64_t*)0x200000000320 = 0x8000000000000000; *(uint64_t*)0x200000000328 = 0; syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x3b8c, /*arg=*/0x200000000300ul); return 0; }