// https://syzkaller.appspot.com/bug?id=929ef63f3a9f95782ec201ed37884e7ab47ed77f // 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 #include #ifndef __NR_memfd_create #define __NR_memfd_create 279 #endif #ifndef __NR_mmap #define __NR_mmap 222 #endif #ifndef __NR_mprotect #define __NR_mprotect 226 #endif #ifndef __NR_openat #define __NR_openat 56 #endif #ifndef __NR_quotactl #define __NR_quotactl 60 #endif #ifndef __NR_renameat2 #define __NR_renameat2 276 #endif #ifndef __NR_write #define __NR_write 64 #endif static unsigned long long procid; static __thread int clone_ongoing; static __thread int skip_segv; static __thread jmp_buf segv_env; static void segv_handler(int sig, siginfo_t* info, void* ctx) { if (__atomic_load_n(&clone_ongoing, __ATOMIC_RELAXED) != 0) { exit(sig); } uintptr_t addr = (uintptr_t)info->si_addr; const uintptr_t prog_start = 1 << 20; const uintptr_t prog_end = 100 << 20; int skip = __atomic_load_n(&skip_segv, __ATOMIC_RELAXED) != 0; int valid = addr < prog_start || addr > prog_end; if (skip && valid) { _longjmp(segv_env, 1); } exit(sig); } static void install_segv_handler(void) { struct sigaction sa; memset(&sa, 0, sizeof(sa)); sa.sa_handler = SIG_IGN; syscall(SYS_rt_sigaction, 0x20, &sa, NULL, 8); syscall(SYS_rt_sigaction, 0x21, &sa, NULL, 8); memset(&sa, 0, sizeof(sa)); sa.sa_sigaction = segv_handler; sa.sa_flags = SA_NODEFER | SA_SIGINFO; sigaction(SIGSEGV, &sa, NULL); sigaction(SIGBUS, &sa, NULL); } #define NONFAILING(...) \ ({ \ int ok = 1; \ __atomic_fetch_add(&skip_segv, 1, __ATOMIC_SEQ_CST); \ if (_setjmp(segv_env) == 0) { \ __VA_ARGS__; \ } else \ ok = 0; \ __atomic_fetch_sub(&skip_segv, 1, __ATOMIC_SEQ_CST); \ ok; \ }) //% 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[2] = {0xffffffffffffffff, 0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x20000000ul, /*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=*/0x21000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); const char* reason; (void)reason; install_segv_handler(); 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 30 00} (length 0x8) // } // flags: mount_flags = 0xa00008 (8 bytes) // opts: ptr[in, fs_options[ext4_options]] { // fs_options[ext4_options] { // elems: array[fs_opt_elem[ext4_options]] { // } // common: array[fs_opt_elem[fs_options_common]] { // } // null: const = 0x0 (1 bytes) // } // } // chdir: int8 = 0x1 (1 bytes) // size: len = 0x7c8 (8 bytes) // img: ptr[in, buffer] { // buffer: (compressed buffer with length 0x7c8) // } // ] // returns fd_dir NONFAILING(memcpy((void*)0x200004c0, "ext4\000", 5)); NONFAILING(memcpy((void*)0x20000300, "./file0\000", 8)); NONFAILING(*(uint8_t*)0x20000000 = 0); NONFAILING(memcpy( (void*)0x20001280, "\x78\x9c\xec\xdd\xcf\x6b\x1b\x57\x1e\x00\xf0\xef\xc8\x3f\xe3\x64\xd7\x5e" "\x58\xd8\xcd\x9e\x0c\x0b\xbb\x86\x10\x79\x9d\xf5\x26\xbb\x10\xd8\x94\x1e" "\x4a\xa1\x81\x40\x7b\x4e\x62\x64\xc5\xa4\x96\xad\x60\xc9\x21\x36\x86\x24" "\x94\x42\x2f\x3d\xb4\xf4\x50\x68\x2e\x39\x37\x6d\x7a\xcb\xa1\x97\xfe\xb8" "\xb6\x97\xfe\x0d\x3d\x94\x84\xb4\x75\x42\x53\x7a\x28\x2e\x23\x8d\x12\xf9" "\x87\x1c\x3b\xb1\xe4\x34\xfe\x7c\x60\xac\xf7\x66\x46\x7a\xef\x3b\x6f\xe6" "\xcd\xf3\xcc\x20\x05\xb0\x67\x0d\xa7\x7f\x72\x11\x07\x23\x7a\xd2\xe4\x60" "\x36\x3f\x89\x6c\x46\x74\x47\x9c\xa8\xaf\xf7\x60\x79\xa9\x90\x4e\x49\xac" "\xac\xbc\xfa\x43\x52\x5b\xe7\xfe\xf2\x52\x21\x9a\xde\x93\xda\x9f\x65\xfe" "\x1a\x11\x5f\xbc\x19\x71\x28\xb7\xbe\xdc\xca\xc2\xe2\xf4\x44\xa9\x54\x9c" "\xcb\xf2\xa3\xd5\x99\x0b\xa3\x95\x85\xc5\xc3\xe7\x67\x26\xa6\x8a\x53\xc5" "\xd9\xa3\x63\xe3\xe3\x47\x8e\xfd\xe7\xd8\xd1\x9d\x8b\xf5\xa7\xaf\x17\x0f" "\xdc\x79\xe7\xa5\x7f\x7e\x7c\xe2\x97\x37\xfe\x72\xf3\xed\x2f\x93\x38\x11" "\x07\xb2\x65\xcd\x71\xec\x94\xe1\x18\xce\xb6\x49\x4f\xba\x09\x57\x79\x71" "\xa7\x0b\xdb\x65\xc9\x6e\x57\x80\x27\x92\x1e\x9a\x5d\xf5\xa3\x3c\x0e\xc6" "\x60\x74\x6d\xd2\x92\xff\xef\x68\xcd\x00\x80\x76\xb9\x1c\x11\x2b\x00\xc0" "\x1e\x93\x38\xff\x03\xc0\x1e\xd3\xb8\x0e\x70\x7f\x79\xa9\xd0\x98\xa2\x7e" "\x3f\xe7\xca\xe3\xae\x1d\x1c\x6f\xf7\xc5\x89\x0e\xb8\xfb\x42\x44\xf4\xd7" "\xe3\x6f\xdc\xdf\xac\x2f\xe9\xae\xdf\xb3\xfb\xa6\xbf\x76\x1f\x74\xe0\x7e" "\x52\xbb\x47\xd2\x90\x44\xc4\xd0\x0e\x94\x3f\x1c\x11\xd7\x6e\x9d\xbe\x91" "\x4e\xd1\xa6\xfb\x90\x00\x1b\xb9\x72\x35\x22\xce\x0e\x0d\xaf\xed\xff\xd3" "\x1e\x6e\xed\x33\x0b\xdb\xf5\xaf\x2d\xac\x33\xdc\x48\x7c\x5a\x7f\xd1\xff" "\x41\xe7\x7c\x96\x8e\x7f\xfe\xbb\x7e\xfc\x17\x91\xcb\x8e\xff\xfe\xda\xdf" "\xb5\xe3\x9f\xbe\xe6\x63\xf7\x29\xac\xfd\x8c\xf5\xc7\x7f\xee\xf6\xaa\x6c" "\xcf\x0e\x14\xda\x24\x1d\xff\x1d\x6f\x7a\xb6\xed\x41\x53\xfc\x99\xa1\xae" "\x2c\xf7\x87\xda\x98\xaf\x27\x39\x77\xbe\x54\x4c\xfb\xb6\x3f\x46\xc4\x48" "\xf4\xf4\xa5\xf9\xb1\x4d\xca\x18\xb9\xf7\xeb\xbd\x56\xcb\x9a\xc7\x7f\x3f" "\xbe\xfb\xfa\x87\x69\xf9\xe9\xeb\xa3\x35\x72\xb7\xbb\xfb\x56\xbf\x67\x72" "\xa2\x3a\xf1\x34\x31\x37\xbb\x7b\x35\xe2\x6f\xdd\x1b\xc5\x9f\x3c\x6c\xff" "\xa4\xc5\xf8\xf7\xd4\x16\xcb\x78\xf9\x7f\x6f\x7d\xd0\x6a\x59\x1a\x7f\x1a" "\x6f\x63\x5a\x1f\x7f\x7b\xad\x5c\x8f\xf8\xc7\x86\xed\xff\xe8\x39\xa8\x64" "\xd3\xe7\x13\x47\x6b\xbb\xc3\x68\x63\xa7\xd8\x60\xff\xfc\xe4\xdb\xf7\x07" "\x5a\x95\xdf\xdc\xfe\xd7\x6e\xa5\x25\x2d\x15\x1a\xff\x0b\x74\x42\xda\xfe" "\x03\x9b\xc7\x3f\x94\x34\x3f\xaf\x59\xd9\x7e\x19\x5f\x5d\x1f\xfc\xbc\xd5" "\xb2\xd5\xf1\x9f\xbe\x91\x96\xbf\x3a\xfe\x8d\xf7\xff\xde\xe4\xb5\x5a\xba" "\x37\x9b\x77\x69\xa2\x5a\x9d\x1b\x8b\xe8\x4d\x5e\x59\x3f\xff\xc8\xa3\xf7" "\x36\xf2\x8d\xf5\xd3\xf8\x47\xfe\xbe\x2a\xfe\xac\x05\x73\x9b\xee\xff\xe9" "\x4a\x67\xb3\xf4\xca\x63\x1e\x7e\xec\xbe\xf3\xfd\x47\x4f\x1e\x7f\x7b\xa5" "\xf1\x4f\xa6\xed\x9f\x64\x41\x3c\xb6\xfd\xb7\x9f\xb8\xf9\x60\xba\xab\x55" "\xf9\x5b\x6b\xff\xf1\x5a\x6a\x24\x9b\xb3\xbe\xff\xeb\x5e\xf7\xb9\x5b\xad" "\xe0\x53\x6d\x3c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\xd8\xa2\x5c\x44\x1c\x88\x24\x97\x7f\x98\xce\xe5\xf2" "\xf9\xfa\x6f\x78\xff\x39\x06\x72\xa5\x72\xa5\x7a\xe8\x5c\x79\x7e\x76\x32" "\x6a\xbf\x95\x3d\x14\x3d\xb9\xc6\x57\x5d\x0e\x36\x7d\x1f\xea\x58\xf6\x7d" "\xf8\x8d\xfc\x91\x35\xf9\x7f\x47\xc4\x9f\x22\xe2\xbd\xbe\x7d\xb5\x7c\xbe" "\x50\x2e\x4d\xee\x76\xf0\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\x90\xd9\xdf\xe2\xf7\xff\x53\xdf\xf5\xed\x76\xed\x00\x80\xb6\xe9\xdf" "\xed\x0a\x00\x00\x1d\xb7\xad\xf3\xbf\xc1\x02\x00\x3c\x17\x5a\x9c\xd2\x7b" "\x37\x9e\xbd\xaf\xad\x75\x01\x00\x3a\xa3\x76\xfe\x4f\xba\x77\xbb\x1a\x00" "\x40\x07\xb9\xa4\x0f\x00\x7b\x8f\xf3\x3f\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\x6d\x76\xea\xe4\xc9\x74\x5a\xf9\x79\x79\xa9" "\x90\xe6\x27\x2f\x2e\xcc\x4f\x97\x2f\x1e\x9e\x2c\x56\xa6\xf3\x33\xf3\x85" "\x7c\xa1\x3c\x77\x21\x3f\x55\x2e\x4f\x95\x8a\xf9\x42\x79\xa6\xe5\x07\x5d" "\xa9\xbf\x94\xca\xe5\x0b\xe3\x31\x3b\x7f\x69\xb4\x5a\xac\x54\x47\x2b\x0b" "\x8b\x67\x66\xca\xf3\xb3\xd5\x33\xe7\x67\x26\xa6\x8a\x67\x8a\x3d\x1d\x8b" "\x0c\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\xb6\xae\xb2\xb0" "\x38\x3d\x51\x2a\x15\xe7\x24\x36\x4f\x5c\x7e\x26\xaa\x71\x35\x6b\xb6\xdd" "\xde\x1a\xcf\x53\xe2\x6c\xb6\x4d\x9f\x95\xfa\x6c\x23\xd1\x17\x11\xed\x2a" "\xa2\xb9\x97\xd8\xd7\xf9\x8e\x09\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\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\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\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\xe0" "\x77\xe2\xb7\x00\x00\x00\xff\xff\x9a\x04\x1d\x69", 1992)); NONFAILING(syz_mount_image( /*fs=*/0x200004c0, /*dir=*/0x20000300, /*flags=MS_I_VERSION|MS_RELATIME|MS_NOEXEC*/ 0xa00008, /*opts=*/0x20000000, /*chdir=*/1, /*size=*/0x7c8, /*img=*/0x20001280)); // openat arguments: [ // fd: fd_dir (resource) // file: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 31 00} (length 0x8) // } // flags: open_flags = 0x101042 (4 bytes) // mode: open_mode = 0x4 (2 bytes) // ] // returns fd NONFAILING(memcpy((void*)0x20000140, "./file1\000", 8)); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x20000140ul, /*flags=O_SYNC|O_CREAT|O_RDWR*/ 0x101042, /*mode=S_IROTH*/ 4); if (res != -1) r[0] = res; // quotactl$Q_QUOTAON arguments: [ // cmd: quota_cmd_quota_on = 0xffffffff80000201 (8 bytes) // special: ptr[in, blockdev_filename] { // union blockdev_filename { // loop: loop_filename { // prefix: buffer: {2f 64 65 76 2f 6c 6f 6f 70} (length 0x9) // id: proc = 0x0 (1 bytes) // z: const = 0x0 (1 bytes) // } // } // } // id: uid (resource) // addr: nil // ] NONFAILING(memcpy((void*)0x20000180, "/dev/loop", 9)); NONFAILING(*(uint8_t*)0x20000189 = 0x30); NONFAILING(*(uint8_t*)0x2000018a = 0); syscall(__NR_quotactl, /*cmd=Q_QUOTAON_GRP*/ 0xffffffff80000201ul, /*special=*/0x20000180ul, /*id=*/0, /*addr=*/0ul); // mprotect arguments: [ // addr: VMA[0x3000] // len: len = 0x3000 (8 bytes) // prot: mmap_prot = 0x9 (8 bytes) // ] syscall(__NR_mprotect, /*addr=*/0x20000000ul, /*len=*/0x3000ul, /*prot=PROT_SEM|PROT_READ*/ 9ul); // openat$cgroup_ro arguments: [ // fd: fd_cgroup (resource) // file: ptr[in, buffer] { // buffer: {68 75 67 65 74 6c 62 2e 31 47 42 2e 75 73 61 67 65 5f 69 6e // 5f 62 79 74 65 73 00} (length 0x1b) // } // flags: const = 0x275a (4 bytes) // mode: const = 0x0 (2 bytes) // ] // returns fd NONFAILING(memcpy((void*)0x20000180, "hugetlb.1GB.usage_in_bytes\000", 27)); res = syscall(__NR_openat, /*fd=*/(intptr_t)-1, /*file=*/0x20000180ul, /*flags=*/0x275a, /*mode=*/0); if (res != -1) r[1] = res; // mmap arguments: [ // addr: VMA[0xb36000] // len: len = 0xb36000 (8 bytes) // prot: mmap_prot = 0xa (8 bytes) // flags: mmap_flags = 0x28011 (8 bytes) // fd: fd (resource) // offset: intptr = 0x0 (8 bytes) // ] syscall(__NR_mmap, /*addr=*/0x20000000ul, /*len=*/0xb36000ul, /*prot=PROT_SEM|PROT_WRITE*/ 0xaul, /*flags=MAP_STACK|MAP_POPULATE|MAP_FIXED|MAP_SHARED*/ 0x28011ul, /*fd=*/r[1], /*offset=*/0ul); // write$FUSE_INIT arguments: [ // fd: fd_fuse (resource) // arg: ptr[in, fuse_out_t[fuse_unique, fuse_init_out]] { // fuse_out_t[fuse_unique, fuse_init_out] { // len: len = 0x50 (4 bytes) // err: fuse_errors = 0xfffffffffffffffe (4 bytes) // unique: fuse_unique (resource) // payload: fuse_init_out { // major: const = 0x7 (4 bytes) // minor: const = 0x29 (4 bytes) // max_readahead: int32 = 0x0 (4 bytes) // flags: fuse_init_flags = 0x14c0348 (4 bytes) // max_background: int16 = 0x3800 (2 bytes) // congestion_threshold: int16 = 0x1 (2 bytes) // max_write: int32 = 0xffeffffe (4 bytes) // time_gran: int32 = 0xec (4 bytes) // max_pages: const = 0x0 (2 bytes) // map_alignment: const = 0x0 (2 bytes) // flags2: fuse_init_flags2 = 0x0 (4 bytes) // max_stack_depth: int32 = 0x7fffffff (4 bytes) // unused: buffer: {00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // 00 00 00 00 00 00 00 00} (length 0x18) // } // } // } // len: bytesize = 0x50 (8 bytes) // ] NONFAILING(*(uint32_t*)0x20000440 = 0x50); NONFAILING(*(uint32_t*)0x20000444 = 0xfffffffe); NONFAILING(*(uint64_t*)0x20000448 = 0); NONFAILING(*(uint32_t*)0x20000450 = 7); NONFAILING(*(uint32_t*)0x20000454 = 0x29); NONFAILING(*(uint32_t*)0x20000458 = 0); NONFAILING(*(uint32_t*)0x2000045c = 0x14c0348); NONFAILING(*(uint16_t*)0x20000460 = 0x3800); NONFAILING(*(uint16_t*)0x20000462 = 1); NONFAILING(*(uint32_t*)0x20000464 = 0xffeffffe); NONFAILING(*(uint32_t*)0x20000468 = 0xec); NONFAILING(*(uint16_t*)0x2000046c = 0); NONFAILING(*(uint16_t*)0x2000046e = 0); NONFAILING(*(uint32_t*)0x20000470 = 0); NONFAILING(*(uint32_t*)0x20000474 = 0x7fffffff); NONFAILING(memset((void*)0x20000478, 0, 24)); syscall(__NR_write, /*fd=*/r[0], /*arg=*/0x20000440ul, /*len=*/0x50ul); // renameat2 arguments: [ // oldfd: fd_dir (resource) // old: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 31 00} (length 0x8) // } // newfd: fd_dir (resource) // new: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 30 2f 66 69 6c 65 33 00} (length 0xe) // } // flags: renameat2_flags = 0x0 (8 bytes) // ] NONFAILING(memcpy((void*)0x20000400, "./file1\000", 8)); NONFAILING(memcpy((void*)0x20000440, "./file0/file3\000", 14)); syscall(__NR_renameat2, /*oldfd=*/0xffffff9c, /*old=*/0x20000400ul, /*newfd=*/0xffffff9c, /*new=*/0x20000440ul, /*flags=*/0ul); return 0; }