// https://syzkaller.appspot.com/bug?id=05466b4385dd6748e67acb5a85bda7da86f86bb7 // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include uint64_t r[3] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*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=*/0x200001000000ul, /*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)) { } // mkdir arguments: [ // path: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 30 00} (length 0x8) // } // mode: open_mode = 0x0 (8 bytes) // ] memcpy((void*)0x200000000040, "./file0\000", 8); syscall(__NR_mkdir, /*path=*/0x200000000040ul, /*mode=*/0ul); // pipe2$9p arguments: [ // pipefd: ptr[out, pipe_9p] { // pipe_9p { // rfd: rfd9p (resource) // wfd: wfd9p (resource) // } // } // flags: pipe_flags = 0x0 (8 bytes) // ] res = syscall(__NR_pipe2, /*pipefd=*/0x200000000240ul, /*flags=*/0ul); if (res != -1) { r[0] = *(uint32_t*)0x200000000240; r[1] = *(uint32_t*)0x200000000244; } // write$P9_RVERSION arguments: [ // fd: wfd9p (resource) // data: ptr[inout, array[ANYUNION]] { // array[ANYUNION] { // union ANYUNION { // ANYBLOB: buffer: {15 00 00 00 65 ff ff 00 10 00 00 08 00 39 50 32 // 30 30 30} (length 0x13) // } // } // } // size: bytesize = 0x15 (8 bytes) // ] memcpy((void*)0x200000000080, "\x15\x00\x00\x00\x65\xff\xff\x00\x10\x00\x00\x08\x00\x39\x50\x32\x30" "\x30\x30", 19); syscall(__NR_write, /*fd=*/r[1], /*data=*/0x200000000080ul, /*size=*/0x15ul); // dup arguments: [ // oldfd: fd (resource) // ] // returns fd res = syscall(__NR_dup, /*oldfd=*/r[1]); if (res != -1) r[2] = res; // write$FUSE_BMAP arguments: [ // fd: fd_fuse (resource) // arg: ptr[in, fuse_out_t[fuse_unique, fuse_bmap_out]] { // fuse_out_t[fuse_unique, fuse_bmap_out] { // len: len = 0x18 (4 bytes) // err: fuse_errors = 0x0 (4 bytes) // unique: fuse_unique (resource) // payload: fuse_bmap_out { // block: int64 = 0x0 (8 bytes) // } // } // } // len: bytesize = 0x18 (8 bytes) // ] *(uint32_t*)0x200000000100 = 0x18; *(uint32_t*)0x200000000104 = 0; *(uint64_t*)0x200000000108 = 0; *(uint64_t*)0x200000000110 = 0; syscall(__NR_write, /*fd=*/r[2], /*arg=*/0x200000000100ul, /*len=*/0x18ul); // mount$9p_fd arguments: [ // src: const = 0x0 (8 bytes) // dst: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 30 00} (length 0x8) // } // type: ptr[in, buffer] { // buffer: {39 70 00} (length 0x3) // } // flags: mount_flags = 0x0 (8 bytes) // opts: ptr[inout, array[ANYUNION]] { // array[ANYUNION] { // union ANYUNION { // ANYBLOB: buffer: {74 72 61 6e 73 3d 66 64 2c 72 66 64 6e 6f 3d} // (length 0xf) // } // union ANYUNION { // ANYRESHEX: ANYRES64 (resource) // } // union ANYUNION { // ANYBLOB: buffer: {2c 77 66 64 6e 6f 3d} (length 0x7) // } // union ANYUNION { // ANYRESHEX: ANYRES64 (resource) // } // } // } // ] memcpy((void*)0x2000000025c0, "./file0\000", 8); memcpy((void*)0x2000000000c0, "9p\000", 3); memcpy((void*)0x200000000280, "trans=fd,rfdno=", 15); sprintf((char*)0x20000000028f, "0x%016llx", (long long)r[0]); memcpy((void*)0x2000000002a1, ",wfdno=", 7); sprintf((char*)0x2000000002a8, "0x%016llx", (long long)r[1]); syscall(__NR_mount, /*src=*/0ul, /*dst=*/0x2000000025c0ul, /*type=*/0x2000000000c0ul, /*flags=*/0ul, /*opts=*/0x200000000280ul); return 0; }