// https://syzkaller.appspot.com/bug?id=153f3e347f00518b90064a34e8d8dcefdaba2e8f // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include uint64_t r[6] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*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=*/0x200001000000ul, /*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)) { } // mkdir arguments: [ // path: ptr[in, buffer] { // buffer: {2e 2f 63 6f 6e 66 69 67 00} (length 0x9) // } // mode: open_mode = 0x1ff (8 bytes) // ] memcpy((void*)0x200000000000, "./config\000", 9); syscall( __NR_mkdir, /*path=*/0x200000000000ul, /*mode=S_IXOTH|S_IWOTH|S_IROTH|S_IXGRP|S_IWGRP|S_IRGRP|S_IXUSR|S_IWUSR|0x100*/ 0x1fful); // mount arguments: [ // src: nil // dst: ptr[in, buffer] { // buffer: {2e 2f 63 6f 6e 66 69 67 00} (length 0x9) // } // type: ptr[in, buffer] { // buffer: {63 6f 6e 66 69 67 66 73 00} (length 0x9) // } // flags: mount_flags = 0x0 (8 bytes) // data: nil // ] memcpy((void*)0x200000000000, "./config\000", 9); memcpy((void*)0x200000000080, "configfs\000", 9); syscall(__NR_mount, /*src=*/0ul, /*dst=*/0x200000000000ul, /*type=*/0x200000000080ul, /*flags=*/0ul, /*data=*/0ul); // mkdirat arguments: [ // fd: fd_dir (resource) // path: ptr[in, buffer] { // buffer: {2e 2f 63 6f 6e 66 69 67 2f 6e 76 6d 65 74 2f 73 75 62 73 79 // 73 74 65 6d 73 2f 74 65 73 74 00} (length 0x1f) // } // mode: open_mode = 0x1ff (8 bytes) // ] memcpy((void*)0x2000000000c0, "./config/nvmet/subsystems/test\000", 31); syscall( __NR_mkdirat, /*fd=*/0xffffff9c, /*path=*/0x2000000000c0ul, /*mode=S_IXOTH|S_IWOTH|S_IROTH|S_IXGRP|S_IWGRP|S_IRGRP|S_IXUSR|S_IWUSR|0x100*/ 0x1fful); // openat arguments: [ // fd: fd_dir (resource) // file: ptr[in, buffer] { // buffer: {2e 2f 63 6f 6e 66 69 67 2f 6e 76 6d 65 74 2f 73 75 62 73 79 // 73 74 65 6d 73 2f 74 65 73 74 2f 61 74 74 72 5f 61 6c 6c 6f 77 5f 61 // 6e 79 5f 68 6f 73 74 00} (length 0x33) // } // flags: open_flags = 0x2 (4 bytes) // mode: open_mode = 0x0 (2 bytes) // ] // returns fd memcpy((void*)0x200000000100, "./config/nvmet/subsystems/test/attr_allow_any_host\000", 51); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000100ul, /*flags=O_RDWR*/ 2, /*mode=*/0); if (res != -1) r[0] = res; // write arguments: [ // fd: fd (resource) // buf: ptr[in, buffer] { // buffer: {31 0a 00} (length 0x3) // } // count: len = 0x2 (8 bytes) // ] memcpy((void*)0x200000000140, "1\n\000", 3); syscall(__NR_write, /*fd=*/r[0], /*buf=*/0x200000000140ul, /*count=*/2ul); // mkdirat arguments: [ // fd: fd_dir (resource) // path: ptr[in, buffer] { // buffer: {2e 2f 63 6f 6e 66 69 67 2f 6e 76 6d 65 74 2f 70 6f 72 74 73 // 2f 31 00} (length 0x17) // } // mode: open_mode = 0x1ff (8 bytes) // ] memcpy((void*)0x200000000180, "./config/nvmet/ports/1\000", 23); syscall( __NR_mkdirat, /*fd=*/0xffffff9c, /*path=*/0x200000000180ul, /*mode=S_IXOTH|S_IWOTH|S_IROTH|S_IXGRP|S_IWGRP|S_IRGRP|S_IXUSR|S_IWUSR|0x100*/ 0x1fful); // openat arguments: [ // fd: fd_dir (resource) // file: ptr[in, buffer] { // buffer: {2e 2f 63 6f 6e 66 69 67 2f 6e 76 6d 65 74 2f 70 6f 72 74 73 // 2f 31 2f 61 64 64 72 5f 74 72 74 79 70 65 00} (length 0x23) // } // flags: open_flags = 0x2 (4 bytes) // mode: open_mode = 0x0 (2 bytes) // ] // returns fd memcpy((void*)0x2000000001c0, "./config/nvmet/ports/1/addr_trtype\000", 35); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x2000000001c0ul, /*flags=O_RDWR*/ 2, /*mode=*/0); if (res != -1) r[1] = res; // write arguments: [ // fd: fd (resource) // buf: ptr[in, buffer] { // buffer: {74 63 70 00} (length 0x4) // } // count: len = 0x4 (8 bytes) // ] memcpy((void*)0x200000000200, "tcp\000", 4); syscall(__NR_write, /*fd=*/r[1], /*buf=*/0x200000000200ul, /*count=*/4ul); // openat arguments: [ // fd: fd_dir (resource) // file: ptr[in, buffer] { // buffer: {2e 2f 63 6f 6e 66 69 67 2f 6e 76 6d 65 74 2f 70 6f 72 74 73 // 2f 31 2f 61 64 64 72 5f 61 64 72 66 61 6d 00} (length 0x23) // } // flags: open_flags = 0x2 (4 bytes) // mode: open_mode = 0x0 (2 bytes) // ] // returns fd memcpy((void*)0x200000000240, "./config/nvmet/ports/1/addr_adrfam\000", 35); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000240ul, /*flags=O_RDWR*/ 2, /*mode=*/0); if (res != -1) r[2] = res; // write arguments: [ // fd: fd (resource) // buf: ptr[in, buffer] { // buffer: {69 70 76 34 00} (length 0x5) // } // count: len = 0x5 (8 bytes) // ] memcpy((void*)0x200000000280, "ipv4\000", 5); syscall(__NR_write, /*fd=*/r[2], /*buf=*/0x200000000280ul, /*count=*/5ul); // openat arguments: [ // fd: fd_dir (resource) // file: ptr[in, buffer] { // buffer: {2e 2f 63 6f 6e 66 69 67 2f 6e 76 6d 65 74 2f 70 6f 72 74 73 // 2f 31 2f 61 64 64 72 5f 74 72 61 64 64 72 00} (length 0x23) // } // flags: open_flags = 0x2 (4 bytes) // mode: open_mode = 0x0 (2 bytes) // ] // returns fd memcpy((void*)0x2000000003c0, "./config/nvmet/ports/1/addr_traddr\000", 35); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x2000000003c0ul, /*flags=O_RDWR*/ 2, /*mode=*/0); if (res != -1) r[3] = res; // write arguments: [ // fd: fd (resource) // buf: ptr[in, buffer] { // buffer: {31 32 37 2e 30 2e 30 2e 31 00} (length 0xa) // } // count: len = 0xa (8 bytes) // ] memcpy((void*)0x200000000300, "127.0.0.1\000", 10); syscall(__NR_write, /*fd=*/r[3], /*buf=*/0x200000000300ul, /*count=*/0xaul); // openat arguments: [ // fd: fd_dir (resource) // file: ptr[in, buffer] { // buffer: {2e 2f 63 6f 6e 66 69 67 2f 6e 76 6d 65 74 2f 70 6f 72 74 73 // 2f 31 2f 61 64 64 72 5f 74 72 73 76 63 69 64 00} (length 0x24) // } // flags: open_flags = 0x2 (4 bytes) // mode: open_mode = 0x0 (2 bytes) // ] // returns fd memcpy((void*)0x200000000340, "./config/nvmet/ports/1/addr_trsvcid\000", 36); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000340ul, /*flags=O_RDWR*/ 2, /*mode=*/0); if (res != -1) r[4] = res; // write arguments: [ // fd: fd (resource) // buf: ptr[in, buffer] { // buffer: {34 34 32 30 00} (length 0x5) // } // count: len = 0x5 (8 bytes) // ] memcpy((void*)0x200000000380, "4420\000", 5); syscall(__NR_write, /*fd=*/r[4], /*buf=*/0x200000000380ul, /*count=*/5ul); // close arguments: [ // fd: fd (resource) // ] syscall(__NR_close, /*fd=*/r[4]); // symlinkat arguments: [ // old: ptr[in, buffer] { // buffer: {2e 2f 63 6f 6e 66 69 67 2f 6e 76 6d 65 74 2f 73 75 62 73 79 // 73 74 65 6d 73 2f 74 65 73 74 00} (length 0x1f) // } // newfd: fd_dir (resource) // new: ptr[in, buffer] { // buffer: {2e 2f 63 6f 6e 66 69 67 2f 6e 76 6d 65 74 2f 70 6f 72 74 73 // 2f 31 2f 73 75 62 73 79 73 74 65 6d 73 2f 74 65 73 74 00} (length // 0x27) // } // ] memcpy((void*)0x2000000003c0, "./config/nvmet/subsystems/test\000", 31); memcpy((void*)0x200000000400, "./config/nvmet/ports/1/subsystems/test\000", 39); syscall(__NR_symlinkat, /*old=*/0x2000000003c0ul, /*newfd=*/0xffffff9c, /*new=*/0x200000000400ul); // openat$nvme_fabrics arguments: [ // fd: const = 0xffffffffffffff9c (8 bytes) // file: ptr[in, buffer] { // buffer: {2f 64 65 76 2f 6e 76 6d 65 2d 66 61 62 72 69 63 73 00} // (length 0x12) // } // flags: open_flags = 0x2 (4 bytes) // mode: const = 0x0 (2 bytes) // ] // returns fd memcpy((void*)0x200000000440, "/dev/nvme-fabrics\000", 18); res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x200000000440ul, /*flags=O_RDWR*/ 2, /*mode=*/0); if (res != -1) r[5] = res; // write arguments: [ // fd: fd (resource) // buf: ptr[in, buffer] { // buffer: {74 72 61 6e 73 70 6f 72 74 3d 74 63 70 2c 74 72 61 64 64 72 // 3d 31 32 37 2e 30 2e 30 2e 31 2c 74 72 73 76 63 69 64 3d 34 34 32 30 // 2c 6e 71 6e 3d 74 65 73 74 00} (length 0x35) // } // count: len = 0x36 (8 bytes) // ] memcpy((void*)0x200000000480, "transport=tcp,traddr=127.0.0.1,trsvcid=4420,nqn=test\000", 53); syscall(__NR_write, /*fd=*/r[5], /*buf=*/0x200000000480ul, /*count=*/0x36ul); // close arguments: [ // fd: fd (resource) // ] syscall(__NR_close, /*fd=*/r[5]); // nanosleep arguments: [ // req: ptr[in, timespec] { // timespec { // sec: time_sec (resource) // nsec: time_nsec (resource) // } // } // rem: nil // ] *(uint64_t*)0x200000000500 = 0; *(uint64_t*)0x200000000508 = 0x1dcd6500; syscall(__NR_nanosleep, /*req=*/0x200000000500ul, /*rem=*/0ul); // unlinkat arguments: [ // fd: fd_dir (resource) // path: ptr[in, buffer] { // buffer: {2e 2f 63 6f 6e 66 69 67 2f 6e 76 6d 65 74 2f 70 6f 72 74 73 // 2f 31 2f 73 75 62 73 79 73 74 65 6d 73 2f 74 65 73 74 00} (length // 0x27) // } // flags: unlinkat_flags = 0x0 (8 bytes) // ] memcpy((void*)0x200000000400, "./config/nvmet/ports/1/subsystems/test\000", 39); syscall(__NR_unlinkat, /*fd=*/0xffffff9c, /*path=*/0x200000000400ul, /*flags=*/0ul); return 0; }