// https://syzkaller.appspot.com/bug?id=3c6370447a4c2f892914935ddf604adfcce5b92e // 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)) { } // mkdirat arguments: [ // fd: fd_dir (resource) // path: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 30 00} (length 0x8) // } // mode: open_mode = 0x0 (8 bytes) // ] memcpy((void*)0x200000000100, "./file0\000", 8); syscall(__NR_mkdirat, /*fd=*/0xffffff9c, /*path=*/0x200000000100ul, /*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 09 7b 00 00 08 00 39 50 32 // 30 30 30 2e 4c} (length 0x15) // } // } // } // size: bytesize = 0x15 (8 bytes) // ] memcpy((void*)0x200000000080, "\x15\x00\x00\x00\x65\xff\xff\x09\x7b\x00\x00\x08\x00\x39\x50\x32\x30" "\x30\x30\x2e\x4c", 21); 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*)0x2000000001c0 = 0x18; *(uint32_t*)0x2000000001c4 = 0; *(uint64_t*)0x2000000001c8 = 0; *(uint64_t*)0x2000000001d0 = 0; syscall(__NR_write, /*fd=*/r[2], /*arg=*/0x2000000001c0ul, /*len=*/0x18ul); // write$FUSE_NOTIFY_RETRIEVE arguments: [ // fd: fd_fuse (resource) // arg: ptr[in, fuse_notify[FUSE_NOTIFY_RETRIEVE, // fuse_notify_retrieve_out]] { // fuse_notify[FUSE_NOTIFY_RETRIEVE, fuse_notify_retrieve_out] { // len: len = 0x14c (4 bytes) // err: const = 0x5 (4 bytes) // unique: const = 0x0 (8 bytes) // payload: fuse_notify_retrieve_out { // notify_unique: const = 0x0 (8 bytes) // nodeid: int64 = 0x0 (8 bytes) // offset: int64 = 0x0 (8 bytes) // size: int32 = 0x0 (4 bytes) // padding: const = 0x0 (4 bytes) // } // } // } // len: bytesize = 0x137 (8 bytes) // ] *(uint32_t*)0x2000000000c0 = 0x14c; *(uint32_t*)0x2000000000c4 = 5; *(uint64_t*)0x2000000000c8 = 0; *(uint64_t*)0x2000000000d0 = 0; *(uint64_t*)0x2000000000d8 = 0; *(uint64_t*)0x2000000000e0 = 0; *(uint32_t*)0x2000000000e8 = 0; *(uint32_t*)0x2000000000ec = 0; syscall(__NR_write, /*fd=*/r[2], /*arg=*/0x2000000000c0ul, /*len=*/0x137ul); // 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[in, p9_options_fd] { // p9_options_fd { // trans: buffer: {74 72 61 6e 73 3d 66 64 2c} (length 0x9) // rfdno: fs_opt["rfdno", fmt[hex, rfd9p]] { // name: buffer: {72 66 64 6e 6f} (length 0x5) // eq: const = 0x3d (1 bytes) // val: rfd9p (resource) // } // comma0: const = 0x2c (1 bytes) // wfdno: fs_opt["wfdno", fmt[hex, fd]] { // name: buffer: {77 66 64 6e 6f} (length 0x5) // eq: const = 0x3d (1 bytes) // val: fd (resource) // } // comma1: const = 0x2c (1 bytes) // opts: fs_options[p9_options] { // elems: array[fs_opt_elem[p9_options]] { // fs_opt_elem[p9_options] { // elem: union p9_options { // posixacl: buffer: {70 6f 73 69 78 61 63 6c} (length 0x8) // } // comma: const = 0x2c (1 bytes) // } // } // common: array[fs_opt_elem[fs_options_common]] { // } // null: const = 0x0 (1 bytes) // } // } // } // ] memcpy((void*)0x200000000040, "./file0\000", 8); memcpy((void*)0x200000000b80, "9p\000", 3); memcpy((void*)0x200000000100, "trans=fd,", 9); memcpy((void*)0x200000000109, "rfdno", 5); *(uint8_t*)0x20000000010e = 0x3d; sprintf((char*)0x20000000010f, "0x%016llx", (long long)r[0]); *(uint8_t*)0x200000000121 = 0x2c; memcpy((void*)0x200000000122, "wfdno", 5); *(uint8_t*)0x200000000127 = 0x3d; sprintf((char*)0x200000000128, "0x%016llx", (long long)r[2]); *(uint8_t*)0x20000000013a = 0x2c; memcpy((void*)0x20000000013b, "posixacl", 8); *(uint8_t*)0x200000000143 = 0x2c; *(uint8_t*)0x200000000144 = 0; syscall(__NR_mount, /*src=*/0ul, /*dst=*/0x200000000040ul, /*type=*/0x200000000b80ul, /*flags=*/0ul, /*opts=*/0x200000000100ul); return 0; }