// https://syzkaller.appspot.com/bug?id=cdf5a424934fa51b76c70b629817b3cca7e91f92 // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #ifndef __NR_ioctl #define __NR_ioctl 29 #endif #ifndef __NR_mknodat #define __NR_mknodat 33 #endif #ifndef __NR_mmap #define __NR_mmap 222 #endif #ifndef __NR_openat #define __NR_openat 56 #endif uint64_t r[1] = {0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x20000000ul, /*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=*/0x21000000ul, /*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)) { } // mknodat$md arguments: [ // dirfd: const = 0xffffffffffffff9c (8 bytes) // file: ptr[in, buffer] { // buffer: {2e 2f 6d 64 30 00} (length 0x6) // } // mode: const = 0x6180 (8 bytes) // dev: proc = 0x0 (4 bytes) // ] memcpy((void*)0x20000180, "./md0\000", 6); syscall(__NR_mknodat, /*dirfd=*/0xffffffffffffff9cul, /*file=*/0x20000180ul, /*mode=*/0x6180ul, /*dev=*/0x900); // openat$md_node arguments: [ // fd: const = 0xffffffffffffff9c (8 bytes) // file: ptr[in, buffer] { // buffer: {2e 2f 6d 64 30 00} (length 0x6) // } // flags: md_open_flags = 0x2 (4 bytes) // mode: const = 0x0 (2 bytes) // ] // returns fd_md memcpy((void*)0x200001c0, "./md0\000", 6); res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x200001c0ul, /*flags=O_RDWR*/ 2, /*mode=*/0); if (res != -1) r[0] = res; // ioctl$SET_ARRAY_INFO arguments: [ // fd: fd_md (resource) // cmd: const = 0x40480923 (4 bytes) // arg: ptr[in, mdu_array_info_t] { // mdu_array_info_t { // major_version: int32 = 0x1 (4 bytes) // minor_version: md_minor_versions = 0x1 (4 bytes) // patch_version: const = 0x0 (4 bytes) // ctime: int32 = 0x40 (4 bytes) // level: md_levels = 0x1 (4 bytes) // size: int32 = 0xb7e (4 bytes) // nr_disks: const = 0x0 (4 bytes) // raid_disks: int32 = 0xffffffff (4 bytes) // md_minor: const = 0x0 (4 bytes) // not_persistent: int32 = 0x1 (4 bytes) // utime: const = 0x0 (4 bytes) // state: md_array_state = 0x20 (4 bytes) // active_disks: const = 0x0 (4 bytes) // working_disks: const = 0x0 (4 bytes) // failed_disks: const = 0x0 (4 bytes) // spare_disks: const = 0x0 (4 bytes) // layout: md_layouts = 0x11 (4 bytes) // chunk_size: md_chunk_sizes = 0x1000 (4 bytes) // } // } // ] *(uint32_t*)0x20000580 = 1; *(uint32_t*)0x20000584 = 1; *(uint32_t*)0x20000588 = 0; *(uint32_t*)0x2000058c = 0x40; *(uint32_t*)0x20000590 = 1; *(uint32_t*)0x20000594 = 0xb7e; *(uint32_t*)0x20000598 = 0; *(uint32_t*)0x2000059c = -1; *(uint32_t*)0x200005a0 = 0; *(uint32_t*)0x200005a4 = 1; *(uint32_t*)0x200005a8 = 0; *(uint32_t*)0x200005ac = 0x20; *(uint32_t*)0x200005b0 = 0; *(uint32_t*)0x200005b4 = 0; *(uint32_t*)0x200005b8 = 0; *(uint32_t*)0x200005bc = 0; *(uint32_t*)0x200005c0 = 0x11; *(uint32_t*)0x200005c4 = 0x1000; syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x40480923, /*arg=*/0x20000580ul); // ioctl$ADD_NEW_DISK arguments: [ // fd: fd_md (resource) // cmd: const = 0x40140921 (4 bytes) // arg: ptr[in, mdu_disk_info_t] { // mdu_disk_info_t { // number: int32 = 0x3 (4 bytes) // dev: md_member_dev { // major: const = 0x1 (4 bytes) // minor: proc = 0x1 (4 bytes) // } // raid_disk: int32 = 0x1 (4 bytes) // state: md_disk_state = 0x6 (4 bytes) // } // } // ] *(uint32_t*)0x20000600 = 3; *(uint32_t*)0x20000604 = 1; *(uint32_t*)0x20000608 = 1; *(uint32_t*)0x2000060c = 1; *(uint32_t*)0x20000610 = 6; syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x40140921, /*arg=*/0x20000600ul); // ioctl$RUN_ARRAY arguments: [ // fd: fd_md (resource) // cmd: const = 0x400c0930 (4 bytes) // arg: nil // ] syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x400c0930, /*arg=*/0ul); return 0; }