// https://syzkaller.appspot.com/bug?id=2e6369478a5579583d31214c08098d9908598b45 // 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_mmap #define __NR_mmap 222 #endif #ifndef __NR_openat #define __NR_openat 56 #endif #ifndef __NR_write #define __NR_write 64 #endif uint64_t r[2] = {0xffffffffffffffff, 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)) { } // openat$md_new_array arguments: [ // fd: const = 0xffffffffffffff9c (8 bytes) // file: ptr[in, buffer] { // buffer: {2f 73 79 73 2f 6d 6f 64 75 6c 65 2f 6d 64 5f 6d 6f 64 2f 70 // 61 72 61 6d 65 74 65 72 73 2f 6e 65 77 5f 61 72 72 61 79 00} (length // 0x28) // } // flags: const = 0x1 (4 bytes) // mode: const = 0x0 (2 bytes) // ] // returns fd_md_new_array memcpy((void*)0x20000080, "/sys/module/md_mod/parameters/new_array\000", 40); res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x20000080ul, /*flags=*/1, /*mode=*/0); if (res != -1) r[0] = res; // write$md_new_array arguments: [ // fd: fd_md_new_array (resource) // buf: ptr[in, md_array_name] { // md_array_name { // prefix: buffer: {6d 64} (length 0x2) // unit: union md_unit { // num: proc = 0x0 (1 bytes) // } // } // } // len: bytesize = 0x3 (8 bytes) // ] memcpy((void*)0x200000c0, "md", 2); *(uint8_t*)0x200000c2 = 0x30; syscall(__NR_write, /*fd=*/r[0], /*buf=*/0x200000c0ul, /*len=*/3ul); // openat$md arguments: [ // fd: const = 0xffffffffffffff9c (8 bytes) // file: ptr[in, md_dev_node] { // md_dev_node { // prefix: buffer: {2f 64 65 76 2f 6d 64} (length 0x7) // unit: union md_unit { // num: proc = 0x0 (1 bytes) // } // z: const = 0x0 (1 bytes) // } // } // flags: md_open_flags = 0x2 (4 bytes) // mode: const = 0x0 (2 bytes) // ] // returns fd_md memcpy((void*)0x20000100, "/dev/md", 7); *(uint8_t*)0x20000107 = 0x30; *(uint8_t*)0x20000108 = 0; res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x20000100ul, /*flags=O_RDWR*/ 2, /*mode=*/0); if (res != -1) r[1] = 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 = 0xfffffffd (4 bytes) // minor_version: md_minor_versions = 0x2 (4 bytes) // patch_version: const = 0x0 (4 bytes) // ctime: int32 = 0x0 (4 bytes) // level: md_levels = 0xffffffffffffffff (4 bytes) // size: int32 = 0x679 (4 bytes) // nr_disks: const = 0x0 (4 bytes) // raid_disks: int32 = 0x40002 (4 bytes) // md_minor: const = 0x0 (4 bytes) // not_persistent: int32 = 0x0 (4 bytes) // utime: const = 0x0 (4 bytes) // state: md_array_state = 0x103 (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 = 0x0 (4 bytes) // chunk_size: md_chunk_sizes = 0x0 (4 bytes) // } // } // ] *(uint32_t*)0x20000140 = 0xfffffffd; *(uint32_t*)0x20000144 = 2; *(uint32_t*)0x20000148 = 0; *(uint32_t*)0x2000014c = 0; *(uint32_t*)0x20000150 = -1; *(uint32_t*)0x20000154 = 0x679; *(uint32_t*)0x20000158 = 0; *(uint32_t*)0x2000015c = 0x40002; *(uint32_t*)0x20000160 = 0; *(uint32_t*)0x20000164 = 0; *(uint32_t*)0x20000168 = 0; *(uint32_t*)0x2000016c = 0x103; *(uint32_t*)0x20000170 = 0; *(uint32_t*)0x20000174 = 0; *(uint32_t*)0x20000178 = 0; *(uint32_t*)0x2000017c = 0; *(uint32_t*)0x20000180 = 0; *(uint32_t*)0x20000184 = 0; syscall(__NR_ioctl, /*fd=*/r[1], /*cmd=*/0x40480923, /*arg=*/0x20000140ul); // 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 = 0x0 (4 bytes) // dev: md_member_dev { // major: const = 0x1 (4 bytes) // minor: proc = 0x0 (4 bytes) // } // raid_disk: int32 = 0x0 (4 bytes) // state: md_disk_state = 0x6 (4 bytes) // } // } // ] *(uint32_t*)0x200001c0 = 0; *(uint32_t*)0x200001c4 = 1; *(uint32_t*)0x200001c8 = 0; *(uint32_t*)0x200001cc = 0; *(uint32_t*)0x200001d0 = 6; syscall(__NR_ioctl, /*fd=*/r[1], /*cmd=*/0x40140921, /*arg=*/0x200001c0ul); // ioctl$RUN_ARRAY arguments: [ // fd: fd_md (resource) // cmd: const = 0x400c0930 (4 bytes) // arg: nil // ] syscall(__NR_ioctl, /*fd=*/r[1], /*cmd=*/0x400c0930, /*arg=*/0ul); return 0; }