// https://syzkaller.appspot.com/bug?id=04c4bbcfcf27e23e543489077d32b401a381d33b // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifndef __NR_memfd_create #define __NR_memfd_create 319 #endif static unsigned long long procid; //% This code is derived from puff.{c,h}, found in the zlib development. The //% original files come with the following copyright notice: //% Copyright (C) 2002-2013 Mark Adler, all rights reserved //% version 2.3, 21 Jan 2013 //% This software is provided 'as-is', without any express or implied //% warranty. In no event will the author be held liable for any damages //% arising from the use of this software. //% Permission is granted to anyone to use this software for any purpose, //% including commercial applications, and to alter it and redistribute it //% freely, subject to the following restrictions: //% 1. The origin of this software must not be misrepresented; you must not //% claim that you wrote the original software. If you use this software //% in a product, an acknowledgment in the product documentation would be //% appreciated but is not required. //% 2. Altered source versions must be plainly marked as such, and must not be //% misrepresented as being the original software. //% 3. This notice may not be removed or altered from any source distribution. //% Mark Adler madler@alumni.caltech.edu //% BEGIN CODE DERIVED FROM puff.{c,h} #define MAXBITS 15 #define MAXLCODES 286 #define MAXDCODES 30 #define MAXCODES (MAXLCODES + MAXDCODES) #define FIXLCODES 288 struct puff_state { unsigned char* out; unsigned long outlen; unsigned long outcnt; const unsigned char* in; unsigned long inlen; unsigned long incnt; int bitbuf; int bitcnt; jmp_buf env; }; static int puff_bits(struct puff_state* s, int need) { long val = s->bitbuf; while (s->bitcnt < need) { if (s->incnt == s->inlen) longjmp(s->env, 1); val |= (long)(s->in[s->incnt++]) << s->bitcnt; s->bitcnt += 8; } s->bitbuf = (int)(val >> need); s->bitcnt -= need; return (int)(val & ((1L << need) - 1)); } static int puff_stored(struct puff_state* s) { s->bitbuf = 0; s->bitcnt = 0; if (s->incnt + 4 > s->inlen) return 2; unsigned len = s->in[s->incnt++]; len |= s->in[s->incnt++] << 8; if (s->in[s->incnt++] != (~len & 0xff) || s->in[s->incnt++] != ((~len >> 8) & 0xff)) return -2; if (s->incnt + len > s->inlen) return 2; if (s->outcnt + len > s->outlen) return 1; for (; len--; s->outcnt++, s->incnt++) { if (s->in[s->incnt]) s->out[s->outcnt] = s->in[s->incnt]; } return 0; } struct puff_huffman { short* count; short* symbol; }; static int puff_decode(struct puff_state* s, const struct puff_huffman* h) { int first = 0; int index = 0; int bitbuf = s->bitbuf; int left = s->bitcnt; int code = first = index = 0; int len = 1; short* next = h->count + 1; while (1) { while (left--) { code |= bitbuf & 1; bitbuf >>= 1; int count = *next++; if (code - count < first) { s->bitbuf = bitbuf; s->bitcnt = (s->bitcnt - len) & 7; return h->symbol[index + (code - first)]; } index += count; first += count; first <<= 1; code <<= 1; len++; } left = (MAXBITS + 1) - len; if (left == 0) break; if (s->incnt == s->inlen) longjmp(s->env, 1); bitbuf = s->in[s->incnt++]; if (left > 8) left = 8; } return -10; } static int puff_construct(struct puff_huffman* h, const short* length, int n) { int len; for (len = 0; len <= MAXBITS; len++) h->count[len] = 0; int symbol; for (symbol = 0; symbol < n; symbol++) (h->count[length[symbol]])++; if (h->count[0] == n) return 0; int left = 1; for (len = 1; len <= MAXBITS; len++) { left <<= 1; left -= h->count[len]; if (left < 0) return left; } short offs[MAXBITS + 1]; offs[1] = 0; for (len = 1; len < MAXBITS; len++) offs[len + 1] = offs[len] + h->count[len]; for (symbol = 0; symbol < n; symbol++) if (length[symbol] != 0) h->symbol[offs[length[symbol]]++] = symbol; return left; } static int puff_codes(struct puff_state* s, const struct puff_huffman* lencode, const struct puff_huffman* distcode) { static const short lens[29] = {3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258}; static const short lext[29] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0}; static const short dists[30] = { 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577}; static const short dext[30] = {0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13}; int symbol; do { symbol = puff_decode(s, lencode); if (symbol < 0) return symbol; if (symbol < 256) { if (s->outcnt == s->outlen) return 1; if (symbol) s->out[s->outcnt] = symbol; s->outcnt++; } else if (symbol > 256) { symbol -= 257; if (symbol >= 29) return -10; int len = lens[symbol] + puff_bits(s, lext[symbol]); symbol = puff_decode(s, distcode); if (symbol < 0) return symbol; unsigned dist = dists[symbol] + puff_bits(s, dext[symbol]); if (dist > s->outcnt) return -11; if (s->outcnt + len > s->outlen) return 1; while (len--) { if (dist <= s->outcnt && s->out[s->outcnt - dist]) s->out[s->outcnt] = s->out[s->outcnt - dist]; s->outcnt++; } } } while (symbol != 256); return 0; } static int puff_fixed(struct puff_state* s) { static int virgin = 1; static short lencnt[MAXBITS + 1], lensym[FIXLCODES]; static short distcnt[MAXBITS + 1], distsym[MAXDCODES]; static struct puff_huffman lencode, distcode; if (virgin) { lencode.count = lencnt; lencode.symbol = lensym; distcode.count = distcnt; distcode.symbol = distsym; short lengths[FIXLCODES]; int symbol; for (symbol = 0; symbol < 144; symbol++) lengths[symbol] = 8; for (; symbol < 256; symbol++) lengths[symbol] = 9; for (; symbol < 280; symbol++) lengths[symbol] = 7; for (; symbol < FIXLCODES; symbol++) lengths[symbol] = 8; puff_construct(&lencode, lengths, FIXLCODES); for (symbol = 0; symbol < MAXDCODES; symbol++) lengths[symbol] = 5; puff_construct(&distcode, lengths, MAXDCODES); virgin = 0; } return puff_codes(s, &lencode, &distcode); } static int puff_dynamic(struct puff_state* s) { static const short order[19] = {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; int nlen = puff_bits(s, 5) + 257; int ndist = puff_bits(s, 5) + 1; int ncode = puff_bits(s, 4) + 4; if (nlen > MAXLCODES || ndist > MAXDCODES) return -3; short lengths[MAXCODES]; int index; for (index = 0; index < ncode; index++) lengths[order[index]] = puff_bits(s, 3); for (; index < 19; index++) lengths[order[index]] = 0; short lencnt[MAXBITS + 1], lensym[MAXLCODES]; struct puff_huffman lencode = {lencnt, lensym}; int err = puff_construct(&lencode, lengths, 19); if (err != 0) return -4; index = 0; while (index < nlen + ndist) { int symbol; int len; symbol = puff_decode(s, &lencode); if (symbol < 0) return symbol; if (symbol < 16) lengths[index++] = symbol; else { len = 0; if (symbol == 16) { if (index == 0) return -5; len = lengths[index - 1]; symbol = 3 + puff_bits(s, 2); } else if (symbol == 17) symbol = 3 + puff_bits(s, 3); else symbol = 11 + puff_bits(s, 7); if (index + symbol > nlen + ndist) return -6; while (symbol--) lengths[index++] = len; } } if (lengths[256] == 0) return -9; err = puff_construct(&lencode, lengths, nlen); if (err && (err < 0 || nlen != lencode.count[0] + lencode.count[1])) return -7; short distcnt[MAXBITS + 1], distsym[MAXDCODES]; struct puff_huffman distcode = {distcnt, distsym}; err = puff_construct(&distcode, lengths + nlen, ndist); if (err && (err < 0 || ndist != distcode.count[0] + distcode.count[1])) return -8; return puff_codes(s, &lencode, &distcode); } static int puff(unsigned char* dest, unsigned long* destlen, const unsigned char* source, unsigned long sourcelen) { struct puff_state s = { .out = dest, .outlen = *destlen, .outcnt = 0, .in = source, .inlen = sourcelen, .incnt = 0, .bitbuf = 0, .bitcnt = 0, }; int err; if (setjmp(s.env) != 0) err = 2; else { int last; do { last = puff_bits(&s, 1); int type = puff_bits(&s, 2); err = type == 0 ? puff_stored(&s) : (type == 1 ? puff_fixed(&s) : (type == 2 ? puff_dynamic(&s) : -1)); if (err != 0) break; } while (!last); } *destlen = s.outcnt; return err; } //% END CODE DERIVED FROM puff.{c,h} #define ZLIB_HEADER_WIDTH 2 static int puff_zlib_to_file(const unsigned char* source, unsigned long sourcelen, int dest_fd) { if (sourcelen < ZLIB_HEADER_WIDTH) return 0; source += ZLIB_HEADER_WIDTH; sourcelen -= ZLIB_HEADER_WIDTH; const unsigned long max_destlen = 132 << 20; void* ret = mmap(0, max_destlen, PROT_WRITE | PROT_READ, MAP_PRIVATE | MAP_ANON, -1, 0); if (ret == MAP_FAILED) return -1; unsigned char* dest = (unsigned char*)ret; unsigned long destlen = max_destlen; int err = puff(dest, &destlen, source, sourcelen); if (err) { munmap(dest, max_destlen); errno = -err; return -1; } if (write(dest_fd, dest, destlen) != (ssize_t)destlen) { munmap(dest, max_destlen); return -1; } return munmap(dest, max_destlen); } static int setup_loop_device(unsigned char* data, unsigned long size, const char* loopname, int* loopfd_p) { int err = 0, loopfd = -1; int memfd = syscall(__NR_memfd_create, "syzkaller", 0); if (memfd == -1) { err = errno; goto error; } if (puff_zlib_to_file(data, size, memfd)) { err = errno; goto error_close_memfd; } loopfd = open(loopname, O_RDWR); if (loopfd == -1) { err = errno; goto error_close_memfd; } if (ioctl(loopfd, LOOP_SET_FD, memfd)) { if (errno != EBUSY) { err = errno; goto error_close_loop; } ioctl(loopfd, LOOP_CLR_FD, 0); usleep(1000); if (ioctl(loopfd, LOOP_SET_FD, memfd)) { err = errno; goto error_close_loop; } } close(memfd); *loopfd_p = loopfd; return 0; error_close_loop: close(loopfd); error_close_memfd: close(memfd); error: errno = err; return -1; } static void reset_loop_device(const char* loopname) { int loopfd = open(loopname, O_RDWR); if (loopfd == -1) { return; } if (ioctl(loopfd, LOOP_CLR_FD, 0)) { } close(loopfd); } static long syz_mount_image(volatile long fsarg, volatile long dir, volatile long flags, volatile long optsarg, volatile long change_dir, volatile unsigned long size, volatile long image) { unsigned char* data = (unsigned char*)image; int res = -1, err = 0, need_loop_device = !!size; char* mount_opts = (char*)optsarg; char* target = (char*)dir; char* fs = (char*)fsarg; char* source = NULL; char loopname[64]; if (need_loop_device) { int loopfd; memset(loopname, 0, sizeof(loopname)); snprintf(loopname, sizeof(loopname), "/dev/loop%llu", procid); if (setup_loop_device(data, size, loopname, &loopfd) == -1) return -1; close(loopfd); source = loopname; } mkdir(target, 0777); char opts[256]; memset(opts, 0, sizeof(opts)); if (strlen(mount_opts) > (sizeof(opts) - 32)) { } strncpy(opts, mount_opts, sizeof(opts) - 32); if (strcmp(fs, "iso9660") == 0) { flags |= MS_RDONLY; } else if (strncmp(fs, "ext", 3) == 0) { bool has_remount_ro = false; char* remount_ro_start = strstr(opts, "errors=remount-ro"); if (remount_ro_start != NULL) { char after = *(remount_ro_start + strlen("errors=remount-ro")); char before = remount_ro_start == opts ? '\0' : *(remount_ro_start - 1); has_remount_ro = ((before == '\0' || before == ',') && (after == '\0' || after == ',')); } if (strstr(opts, "errors=panic") || !has_remount_ro) strcat(opts, ",errors=continue"); } else if (strcmp(fs, "xfs") == 0) { strcat(opts, ",nouuid"); } else if (strncmp(fs, "gfs2", 4) == 0 && (strstr(opts, "errors=panic") || strstr(opts, "debug"))) { strcat(opts, ",errors=withdraw"); } res = mount(source, target, fs, flags, opts); if (res == -1) { err = errno; goto error_clear_loop; } res = open(target, O_RDONLY | O_DIRECTORY); if (res == -1) { err = errno; goto error_clear_loop; } if (change_dir) { res = chdir(target); if (res == -1) { err = errno; } } error_clear_loop: if (need_loop_device) reset_loop_device(loopname); errno = err; return res; } uint64_t r[1] = {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)) { } // syz_mount_image$ext4 arguments: [ // fs: ptr[in, buffer] { // buffer: {65 78 74 34 00} (length 0x5) // } // dir: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 32 00} (length 0x8) // } // flags: mount_flags = 0x404 (8 bytes) // opts: ptr[in, fs_options[ext4_options]] { // fs_options[ext4_options] { // elems: array[fs_opt_elem[ext4_options]] { // fs_opt_elem[ext4_options] { // elem: union ext4_options { // block_validity: buffer: {62 6c 6f 63 6b 5f 76 61 6c 69 64 69 // 74 79} (length 0xe) // } // comma: const = 0x2c (1 bytes) // } // } // common: array[fs_opt_elem[fs_options_common]] { // } // null: const = 0x0 (1 bytes) // } // } // chdir: int8 = 0x1 (1 bytes) // size: len = 0x44e (8 bytes) // img: ptr[in, buffer] { // buffer: (compressed buffer with length 0x44e) // } // ] // returns fd_dir memcpy((void*)0x200000000040, "ext4\000", 5); memcpy((void*)0x2000000001c0, "./file2\000", 8); memcpy((void*)0x200000000000, "block_validity", 14); *(uint8_t*)0x20000000000e = 0x2c; *(uint8_t*)0x20000000000f = 0; memcpy( (void*)0x200000000cc0, "\x78\x9c\xec\xdc\xcb\x6f\x1b\xc5\x1f\x00\xf0\xef\xda\x49\xfb\xeb\xeb\x97" "\x50\x95\x47\x1f\x40\xa0\x45\x54\x3c\x92\x26\x2d\xa5\x07\x0e\x80\x40\xe2" "\x00\x12\x12\x1c\xca\xd1\x24\x69\x55\xea\x36\xa8\x09\x12\xad\x2a\x28\x08" "\x95\x23\xaa\xc4\x1d\x71\x44\xe2\x2f\xe0\x04\x17\x44\x39\x21\x21\x6e\x70" "\x47\x95\x2a\x94\x4b\x0b\x27\xa3\xb5\xd7\x89\xed\xd8\x4e\xed\xda\x71\x8a" "\x3f\x1f\x69\xeb\x99\xdd\x69\x66\xbe\xde\x1d\x7b\x66\x27\x9b\x00\x86\xd6" "\x44\xfa\x4f\x12\xb1\x33\x22\x7e\x8f\x88\xb1\x4a\xb6\xbe\xc0\x44\xe5\xe5" "\xf6\xf2\xe5\xd9\xbf\x97\x2f\xcf\x26\x51\x2a\xbd\xf5\x57\x52\x2e\x77\x6b" "\xf9\xf2\x6c\xb5\xe8\x8b\xd9\xeb\x8e\xec\x67\xc6\x48\x44\xee\xb3\x24\xf6" "\x37\xa9\x77\xf1\xe2\xa5\xb3\x85\x62\x71\xfe\x42\x96\x9f\x5a\x3a\xf7\xfe" "\xd4\xe2\xc5\x4b\xcf\x9e\x39\x57\x38\x3d\x7f\x7a\xfe\xfc\xcc\x89\x13\xc7" "\x8e\x4e\x3f\x7f\x7c\xe6\xb9\x9e\xc4\x99\xc6\x75\x6b\xdf\x47\x0b\x07\xf6" "\xbe\xf6\xce\xb5\x37\x66\x4f\x5e\x7b\xf7\xfa\xb7\x49\x35\xfe\x86\x38\x7a" "\x64\xa2\xdd\xc1\x27\x4a\xa5\x1e\x57\x37\x58\xbb\x6a\xd2\xc9\xc8\x00\x1b" "\x42\x47\xf2\x95\x6e\x1a\xa3\xe5\xfe\x3f\x16\xf9\x58\x3d\x79\x63\xf1\xea" "\xa7\x03\x6d\x1c\xd0\x57\xa5\x52\xa9\xf4\x40\xeb\xc3\x57\x4a\xc0\x7f\x58" "\x12\x83\x6e\x01\x30\x18\xd5\x2f\xfa\x74\xfe\x5b\xdd\x36\x68\xe8\xb1\x29" "\xdc\x7c\xa9\x32\x01\x4a\xe3\xbe\x9d\x6d\x95\x23\x23\x91\xcb\xca\x8c\x36" "\xcc\x6f\x7b\x69\x22\x22\x4e\x5e\xf9\xe7\xab\x74\x8b\xfe\xdc\x87\x00\x00" "\xa8\xf3\x7d\x3a\xfe\x79\xa6\xd9\xf8\x2f\x17\xb5\xf7\x85\xfe\x9f\xad\xa1" "\x8c\x47\xc4\x7d\x11\xb1\x3b\x22\x8e\x47\xc4\x9e\x88\xb8\x3f\xa2\x5c\xf6" "\xc1\x88\x78\xa8\xc3\xfa\x1b\x17\x49\xd6\x8e\x7f\x72\x37\xba\x0a\xec\x0e" "\xa5\xe3\xbf\x17\xb2\xb5\xad\xfa\xf1\x5f\x75\xf4\x17\xe3\xf9\x2c\xb7\xab" "\x1c\xff\x68\x72\xea\x4c\x71\xfe\x48\xe5\x3d\xf9\xed\x50\xc4\xd6\x34\x3f" "\xdd\xa6\x8e\x1f\x5e\xf9\xf5\x8b\x56\xc7\x6a\xc7\x7f\xe9\x96\xd6\x5f\x1d" "\x0b\x66\xed\xb8\x31\xb2\xb5\xfe\xff\xcc\x15\x96\x0a\x77\x13\x73\xad\x9b" "\x9f\x44\xec\x1b\x69\x16\x7f\xb2\xb2\x12\x90\x44\xc4\xde\x88\xd8\xd7\x65" "\x1d\x67\x9e\xfa\xe6\x40\xab\x63\xeb\xc7\xdf\x46\x0f\xd6\x99\x4a\x5f\x47" "\x3c\x59\x39\xff\x57\xa2\x21\xfe\xaa\xa4\xfd\xfa\xe4\xd4\xff\xa2\x38\x7f" "\x64\xaa\x7a\x55\xac\xf5\xf3\x2f\x57\xdf\x6c\x55\x7f\x67\xf1\x8f\xde\x6d" "\xb8\x6b\xa4\xe7\x7f\x7b\xd3\xeb\x7f\x25\xfe\xf1\xa4\x76\xbd\x76\xb1\xf3" "\x3a\xae\xfe\xf1\x79\xcb\x39\x4d\xb7\xd7\xff\x96\xe4\xed\xba\x7d\x1f\x16" "\x96\x96\x2e\x4c\x47\x6c\x49\x5e\xaf\x34\xba\x76\xff\x4c\x43\xb9\x99\xd5" "\xf2\x69\xfc\x87\x0f\x36\xef\xff\xbb\x63\xf5\x9d\xd8\x1f\x11\xe9\x45\xfc" "\x70\x44\x3c\x12\x11\x8f\x66\x6d\x7f\x2c\x22\x1e\x8f\x88\x83\x6d\xe2\xff" "\xe9\xe5\x43\xef\x75\x1f\x7f\x7f\xa5\xf1\xcf\x75\x74\xfe\x57\x13\x5b\xa2" "\x71\x4f\x93\xc4\xc1\x28\xe6\xcf\xfe\xf8\x5d\x5d\xa5\xe3\x9d\xc4\x9f\x9e" "\xff\x63\xe5\xd4\xe1\x6c\xcf\x9d\x7c\xfe\xad\xdb\xae\xae\xaf\x66\x00\x00" "\x00\xb8\xf7\xe4\x22\x62\x67\x24\xb9\xc9\x95\x74\x2e\x37\x39\x59\xf9\x1d" "\xfe\x3d\xb1\x3d\x57\x5c\x58\x5c\x7a\xfa\xd4\xc2\x07\xe7\xe7\x2a\xcf\x08" "\x8c\xc7\x68\xae\x7a\xa7\x6b\xac\xe6\x7e\xe8\x74\x36\xad\xaf\xe6\x67\x1a" "\xf2\x47\xb3\xfb\xc6\x5f\xe6\xb7\x95\xf3\x93\xb3\x0b\xc5\xb9\x41\x07\x0f" "\x43\x6e\x47\x8b\xfe\x9f\xfa\x33\x3f\xe8\xd6\x01\x7d\xd7\xfd\x3a\x5a\xef" "\x17\xa4\x80\x8d\xe5\x79\x4d\x18\x5e\xfa\x3f\x0c\x2f\xfd\x1f\x86\x57\x93" "\xfe\xbf\x6d\x10\xed\x00\x36\x5e\xb3\xef\xff\x8f\x07\xd0\x0e\x60\xe3\x35" "\xf4\x7f\xcb\x7e\x30\x44\xcc\xff\x61\x78\xe9\xff\x30\xbc\xf4\x7f\x18\x4a" "\x8b\xdb\x62\xfd\x87\xe4\x87\x27\x71\xbd\x70\x64\xf7\x26\x68\xc6\xbd\x90" "\x88\xdc\xa6\x68\x86\x44\x9f\x12\x6d\x3f\x36\x16\xfa\xf5\xf7\x30\x01\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7a\xed\xdf\x00\x00\x00\xff\xff" "\xf6\x76\xe7\x6a", 1102); syz_mount_image(/*fs=*/0x200000000040, /*dir=*/0x2000000001c0, /*flags=MS_NODEV|MS_NOATIME*/ 0x404, /*opts=*/0x200000000000, /*chdir=*/1, /*size=*/0x44e, /*img=*/0x200000000cc0); // chdir arguments: [ // dir: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 30 00} (length 0x8) // } // ] memcpy((void*)0x200000000240, "./file0\000", 8); syscall(__NR_chdir, /*dir=*/0x200000000240ul); // openat$dir arguments: [ // fd: const = 0xffffffffffffff9c (8 bytes) // file: ptr[in, buffer] { // buffer: {2e 00} (length 0x2) // } // flags: open_flags = 0x0 (4 bytes) // mode: open_mode = 0x0 (2 bytes) // ] // returns fd_dir memcpy((void*)0x200000000500, ".\000", 2); res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x200000000500ul, /*flags=*/0, /*mode=*/0); if (res != -1) r[0] = res; // lseek arguments: [ // fd: fd (resource) // offset: intptr = 0xfffffffffffffffc (8 bytes) // whence: seek_whence = 0x2 (8 bytes) // ] syscall(__NR_lseek, /*fd=*/r[0], /*offset=*/0xfffffffffffffffcul, /*whence=SEEK_END*/ 2ul); // getdents arguments: [ // fd: fd_dir (resource) // ent: nil // count: len = 0x54 (8 bytes) // ] syscall(__NR_getdents, /*fd=*/r[0], /*ent=*/0ul, /*count=*/0x54ul); return 0; }