// https://syzkaller.appspot.com/bug?id=7b59637eba965da2cae686b9ed97125bf551a1d1 // 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*)0x20000200, "./md0\000", 6); syscall(__NR_mknodat, /*dirfd=*/0xffffffffffffff9cul, /*file=*/0x20000200ul, /*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*)0x20000240, "./md0\000", 6); res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x20000240ul, /*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 = 0x0 (4 bytes) // minor_version: md_minor_versions = 0x5a (4 bytes) // patch_version: const = 0x0 (4 bytes) // ctime: int32 = 0x0 (4 bytes) // level: md_levels = 0x0 (4 bytes) // size: int32 = 0x800 (4 bytes) // nr_disks: const = 0x0 (4 bytes) // raid_disks: int32 = 0xffffffff (4 bytes) // md_minor: const = 0x0 (4 bytes) // not_persistent: int32 = 0x0 (4 bytes) // utime: const = 0x0 (4 bytes) // state: md_array_state = 0x11 (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 = 0x2 (4 bytes) // chunk_size: md_chunk_sizes = 0x6000 (4 bytes) // } // } // ] *(uint32_t*)0x20000280 = 0; *(uint32_t*)0x20000284 = 0x5a; *(uint32_t*)0x20000288 = 0; *(uint32_t*)0x2000028c = 0; *(uint32_t*)0x20000290 = 0; *(uint32_t*)0x20000294 = 0x800; *(uint32_t*)0x20000298 = 0; *(uint32_t*)0x2000029c = -1; *(uint32_t*)0x200002a0 = 0; *(uint32_t*)0x200002a4 = 0; *(uint32_t*)0x200002a8 = 0; *(uint32_t*)0x200002ac = 0x11; *(uint32_t*)0x200002b0 = 0; *(uint32_t*)0x200002b4 = 0; *(uint32_t*)0x200002b8 = 0; *(uint32_t*)0x200002bc = 0; *(uint32_t*)0x200002c0 = 2; *(uint32_t*)0x200002c4 = 0x6000; syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x40480923, /*arg=*/0x20000280ul); // 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 = 0x1 (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*)0x20000340 = 1; *(uint32_t*)0x20000344 = 1; *(uint32_t*)0x20000348 = 1; *(uint32_t*)0x2000034c = 1; *(uint32_t*)0x20000350 = 6; syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x40140921, /*arg=*/0x20000340ul); // 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; }