// https://syzkaller.appspot.com/bug?id=e532820da72d5563b7e64be12ec5f4263cd76318 // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #ifndef __NR_ioctl #define __NR_ioctl 29 #endif #ifndef __NR_mmap #define __NR_mmap 222 #endif #ifndef __NR_openat #define __NR_openat 56 #endif uint64_t r[2] = {0xffffffffffffffff, 0x0}; int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x20000000ul, /*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=*/0x21000000ul, /*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*)0x20000000, "/dev/iommu\000", 11); res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x20000000ul, /*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*)0x20000100 = 0xc; *(uint32_t*)0x20000104 = 0; res = syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x3b81, /*arg=*/0x20000100ul); if (res != -1) r[1] = *(uint32_t*)0x20000108; // ioctl$IOMMU_TEST_OP_ADD_RESERVED arguments: [ // fd: fd_iommufd (resource) // cmd: const = 0x3ba0 (4 bytes) // arg: ptr[in, iommu_test_cmd$add_reserved] { // iommu_test_cmd$add_reserved { // size: len = 0x48 (4 bytes) // op: const = 0x1 (4 bytes) // id: ioas_handle (resource) // __reserved: const = 0x0 (4 bytes) // start: int64 = 0x1000005 (8 bytes) // length: int64 = 0xffffffffffefffff (8 bytes) // pad = 0x0 (40 bytes) // } // } // ] *(uint32_t*)0x20000040 = 0x48; *(uint32_t*)0x20000044 = 1; *(uint32_t*)0x20000048 = r[1]; *(uint32_t*)0x2000004c = 0; *(uint64_t*)0x20000050 = 0x1000005; *(uint64_t*)0x20000058 = 0xffffffffffefffff; syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x3ba0, /*arg=*/0x20000040ul); // 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*)0x200003c0 = 0x48; *(uint32_t*)0x200003c4 = 2; *(uint32_t*)0x200003c8 = r[1]; *(uint32_t*)0x200003cc = 0; *(uint32_t*)0x200003dc = 0; syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x3ba0, /*arg=*/0x200003c0ul); // ioctl$IOMMU_IOAS_MAP$PAGES arguments: [ // fd: fd_iommufd (resource) // cmd: const = 0x3b85 (4 bytes) // arg: ptr[in, iommu_ioas_map$PAGES] { // iommu_ioas_map$PAGES { // size: len = 0x28 (4 bytes) // flags: iommufd_ioas_map_flags = 0x2 (4 bytes) // ioas_id: ioas_handle (resource) // __reserved: const = 0x0 (4 bytes) // user_va: VMA[0x3000] // length: len = 0x3000 (8 bytes) // iova: int64 = 0x80 (8 bytes) // } // } // ] *(uint32_t*)0x20001340 = 0x28; *(uint32_t*)0x20001344 = 2; *(uint32_t*)0x20001348 = r[1]; *(uint32_t*)0x2000134c = 0; *(uint64_t*)0x20001350 = 0x203bd000; *(uint64_t*)0x20001358 = 0x3000; *(uint64_t*)0x20001360 = 0x80; syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x3b85, /*arg=*/0x20001340ul); return 0; }