// https://syzkaller.appspot.com/bug?id=39db5889c098f50312f103309ba80b2c56b9b6e4 // 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_pwrite64 #define __NR_pwrite64 68 #endif #ifndef __NR_quotactl #define __NR_quotactl 60 #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[3] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x20000000ul, /*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=*/0x21000000ul, /*len=*/0x1000, /*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 32 00} (length 0x5) // } // dir: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 30 00} (length 0x8) // } // flags: mount_flags = 0x8 (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 { // user_xattr: buffer: {75 73 65 72 5f 78 61 74 74 72} (length // 0xa) // } // comma: const = 0x2c (1 bytes) // } // } // common: array[fs_opt_elem[fs_options_common]] { // } // null: const = 0x0 (1 bytes) // } // } // chdir: int8 = 0x45 (1 bytes) // size: len = 0x47c (8 bytes) // img: ptr[in, buffer] { // buffer: (compressed buffer with length 0x47c) // } // ] // returns fd_dir NONFAILING(memcpy((void*)0x20000040, "ext2\000", 5)); NONFAILING(memcpy((void*)0x20000240, "./file0\000", 8)); NONFAILING(memcpy((void*)0x20000500, "user_xattr", 10)); NONFAILING(*(uint8_t*)0x2000050a = 0x2c); NONFAILING(*(uint8_t*)0x2000050b = 0); NONFAILING(memcpy( (void*)0x20000fc0, "\x78\x9c\xec\xdc\xcf\x6f\x14\x55\x1c\x00\xf0\xef\x4c\x7f\xf0\xdb\x56\xc4" "\x1f\x20\x60\x15\x8d\xc4\x1f\x2d\xad\x80\x1c\xbc\x68\x34\xf1\xa0\x89\x46" "\x0f\x10\x4f\xb5\x2d\x04\x29\xd4\xd0\x92\xd8\x86\x68\xf5\x80\x47\x43\xe2" "\xdd\x78\x34\xf1\x2f\xf0\xa4\x17\x13\x3d\x99\x78\xd5\xbb\x21\x21\x84\x0b" "\x88\x31\x59\x33\xbb\x33\xb0\xdd\xce\xd6\x02\x5b\xa6\x61\x3f\x9f\x64\xe0" "\xbd\x79\xb3\xfb\xde\x77\xdf\xbc\xe1\xcd\xbc\x5d\x02\xe8\x5a\x43\xd9\x1f" "\x49\xc4\xd6\x88\xf8\x23\x22\x06\x1a\xd9\xa5\x07\x0c\x35\xfe\xba\x7e\xf5" "\xfc\xc4\xdf\x57\xcf\x4f\x24\x51\xab\xbd\x77\x25\xa9\x1f\x77\xed\xea\xf9" "\x89\xe2\xd0\xe2\x75\x5b\x1a\x99\x5a\x2d\xcf\x6f\x28\xa9\xf7\xc2\x07\x11" "\xe3\xd3\xd3\x53\x67\xf3\xfc\xc8\xdc\xe9\x8f\x47\x66\xe7\x17\x5e\x3c\x79" "\x7a\xfc\xc4\xd4\x89\xa9\x33\x63\x47\x8e\x1c\x7c\x69\x4f\xff\xe1\xb1\x43" "\x1d\x89\x33\x8b\xeb\xda\xae\x4f\x67\x76\xef\x7c\xf3\xd8\xc5\xb7\x27\x8e" "\x5e\xfc\xf0\x97\xef\xb3\xf6\x6e\xcd\xcb\x9b\xe3\xe8\x94\xa1\xc6\xa7\x5b" "\xea\x99\x4e\x57\x56\xb1\x6d\x4d\xe9\xa4\xb7\xc2\x86\x70\x5b\xfe\x8d\x88" "\xac\xbb\xfa\xea\xe3\x7f\x20\x7a\x62\xd3\xcd\xb2\x81\x78\xe3\x8b\x4a\x1b" "\x07\xac\xa9\x5a\xad\x56\xdb\x70\xa5\x6d\xf1\x62\x0d\xb8\x8f\x25\x51\x75" "\x0b\x80\x6a\x14\xff\xd0\x67\xf7\xbf\xc5\x76\xaf\xe6\x1e\xeb\xc1\xe5\x57" "\x1b\x37\x40\x59\xdc\xd7\xf3\xad\x51\xd2\x1b\x69\x44\x6c\xcc\xef\x8d\xb6" "\xad\x51\xfd\x43\x11\x71\x74\xf1\xc6\x37\xd9\x16\x6b\xf4\x1c\x02\x00\xa0" "\xd9\x8f\xd9\xfc\xe7\x85\xb2\xf9\x5f\x1a\x8f\x34\x1d\xf7\x40\xbe\x86\x32" "\x18\x11\x0f\x46\xc4\xf6\x88\x78\x28\x22\x76\x44\xc4\xc3\x11\xf5\x63\x1f" "\x8d\x88\xc7\x6e\xb3\xfe\xd6\x15\x92\xe5\xf3\x9f\xf4\xd2\x1d\x05\xb6\x4a" "\xd9\xfc\xef\x95\x7c\x6d\x6b\xe9\xfc\x2f\x2d\x0e\x19\xec\xc9\x73\xdb\xea" "\xf1\xf7\x25\xc7\x4f\x4e\x4f\x1d\xc8\x3f\x93\xfd\xd1\xb7\x21\xcb\x8f\xae" "\x50\xc7\x4f\xaf\xff\xfe\x55\xbb\xb2\xe6\xf9\x5f\xb6\x65\xf5\x17\x73\xc1" "\xbc\x1d\x97\x7a\x5b\x16\xd0\x26\xc7\xe7\xc6\xef\x26\xe6\x66\x97\x3f\x8f" "\xd8\xd5\x5b\x16\x7f\x12\xc5\x32\x4e\x12\x11\x3b\x23\x62\xd7\x1d\xd6\x71" "\xf2\xb9\xef\x76\xb7\x2b\x6b\x89\x3f\xfb\x98\x5b\xe2\x5f\x41\x07\xd6\x99" "\x6a\xdf\x46\x3c\xdb\xe8\xff\xc5\x68\x89\xbf\x90\xb4\x5d\x9f\x1c\x7d\xf9" "\xf0\xd8\xa1\x91\x8d\x31\x3d\x75\x60\xa4\x38\x2b\x96\xfb\xf5\xb7\x0b\xef" "\x2c\xdf\xdb\x78\xff\xff\xef\xff\xb5\x95\xf5\xff\xe6\xd2\xf3\xbf\xd1\xbe" "\xbe\x88\xc1\x64\x63\xc4\xec\xfc\xc2\xa9\xfa\x7a\xed\xec\x6a\xde\x75\xc9" "\x0a\x72\x5c\xf8\xf3\xcb\xb6\xf7\x34\xb7\xe2\xef\x8d\xdb\x39\xff\xfb\x93" "\xf7\xeb\xe9\xfe\x7c\xdf\x27\xe3\x73\x73\x67\x47\x23\xfa\x93\xb7\x96\xef" "\x1f\xbb\xf5\xda\x22\x5f\x1c\x9f\xc5\xbf\x7f\x5f\xf9\xf8\xdf\xde\x14\xcd" "\xe3\x11\x91\x9d\xc4\x7b\x22\x62\x6f\x44\x3c\x91\xb7\xfd\xc9\x88\x78\x2a" "\x22\xf6\x95\x05\x77\x23\xbf\xc9\x7e\xed\xe9\x8f\xda\xad\x04\x97\xf7\xff" "\xa6\x36\xab\xe6\x9d\x97\xc5\x3f\xb9\x42\xff\x67\x97\xbc\x2c\x75\xab\xff" "\x5b\x4f\x84\xc5\x92\xa2\xa5\x89\x9e\x53\x3f\xff\x50\x52\xf5\xb1\x7f\x56" "\x7d\xfd\x3b\x58\x4f\xed\xcf\xf7\xd4\xaf\x7f\xef\xae\x1c\xd7\x0a\xcd\x29" "\x0b\x02\x00\x00\x00\xee\x6b\x69\xfd\x3b\xf0\x49\x3a\x7c\x33\x9d\xa6\xc3" "\xc3\x8d\xef\xf0\xef\x88\xcd\xe9\xf4\xcc\xec\xdc\xf3\xc7\x67\xce\x9d\x99" "\x6c\x7c\x57\x7e\x30\xfa\xd2\xe2\x49\xd7\x40\xd3\xf3\xd0\xd1\xfc\xd9\x70" "\x91\x1f\x6b\xc9\x0f\xe5\xcf\x8d\xbf\xee\xd9\x54\xcf\x0f\x4f\xcc\x4c\x4f" "\x56\x1d\x3c\x74\xb9\x2d\x6d\xc6\x7f\xe6\xaf\x9e\xaa\x5b\x07\xac\x39\xbf" "\xd7\x82\xee\x65\xfc\x43\xf7\x32\xfe\xa1\x7b\x19\xff\xd0\xbd\x8c\x7f\xe8" "\x5e\x65\xe3\xff\xb3\x0a\xda\x01\xdc\x7b\xf5\xf1\x9f\x56\xdd\x0a\xa0\x0a" "\xf5\xf1\x7f\x6e\x6f\xd5\xcd\x00\x2a\xe0\xfe\x1f\xba\x97\xf1\x0f\x5d\xa9" "\xed\x6f\xe3\xd3\xf6\x45\x12\x12\xf3\x0b\x91\xae\x8b\x66\xac\xb7\x44\x2c" "\x46\x74\xee\x0d\x63\x7e\xe1\x54\xef\xaa\xff\x33\x8b\x3b\x4b\x24\x51\x5a" "\xb4\xf2\x75\x23\xb9\x57\x17\x28\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x80\xbb\xf4\x5f\x00\x00\x00\xff\xff\x64\x6e\xe4\xc7", 1148)); res = -1; NONFAILING(res = syz_mount_image(/*fs=*/0x20000040, /*dir=*/0x20000240, /*flags=MS_NOEXEC*/ 8, /*opts=*/0x20000500, /*chdir=*/0x45, /*size=*/0x47c, /*img=*/0x20000fc0)); 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 = 0x1 (8 bytes) // ] syscall(__NR_mprotect, /*addr=*/0x20000000ul, /*len=*/0x3000ul, /*prot=PROT_READ*/ 1ul); // openat$cgroup_ro arguments: [ // fd: fd_cgroup (resource) // file: ptr[in, buffer] { // buffer: {6d 65 6d 6f 72 79 2e 63 75 72 72 65 6e 74 00} (length 0xf) // } // flags: const = 0x275a (4 bytes) // mode: const = 0x0 (2 bytes) // ] // returns fd NONFAILING(memcpy((void*)0x20000180, "memory.current\000", 15)); 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 (4 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=*/0xb36000, /*prot=PROT_SEM|PROT_WRITE*/ 0xaul, /*flags=MAP_STACK|MAP_POPULATE|MAP_FIXED|MAP_SHARED*/ 0x28011ul, /*fd=*/r[1], /*offset=*/0ul); // syz_mount_image$hfs arguments: [ // fs: ptr[in, buffer] { // buffer: {68 66 73 00} (length 0x4) // } // dir: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 31 00} (length 0x8) // } // flags: mount_flags = 0x80001 (8 bytes) // opts: ptr[inout, array[ANYUNION]] { // array[ANYUNION] { // union ANYUNION { // ANYRES32: ANYRES32 (resource) // } // } // } // chdir: int8 = 0x1 (1 bytes) // size: len = 0x30c (8 bytes) // img: ptr[in, buffer] { // buffer: (compressed buffer with length 0x30c) // } // ] // returns fd_dir NONFAILING(memcpy((void*)0x20000040, "hfs\000", 4)); NONFAILING(memcpy((void*)0x20000000, "./file1\000", 8)); NONFAILING(*(uint32_t*)0x20000440 = r[0]); NONFAILING(memcpy( (void*)0x20000100, "\x78\x9c\xec\xdd\x3f\x6f\x13\x49\x18\xc7\xf1\xdf\xac\xed\xc4\xb9\x44\x39" "\x5f\x92\xd3\x49\xd7\xdc\x29\x77\x91\xee\x9a\xe8\x72\x50\x20\x1a\x10\x72" "\x4b\x4f\x85\x80\xd8\x91\x22\xac\x20\x92\x20\x01\x0d\x26\xa2\x44\xbc\x00" "\x7a\xde\x02\x2f\x82\x06\xc4\x1b\x00\x1a\x2a\x3a\x9a\x74\x8b\x66\x76\x76" "\xbd\xb6\xc7\xeb\x18\xc5\xd9\x24\x7c\x3f\x52\xa2\xdd\xd9\x99\x9d\x67\xd8" "\x7f\xcf\xac\x44\x56\x00\x7e\x58\xd7\x9a\x1f\x5e\x5d\xf8\x6c\x7f\x8c\x54" "\x51\x45\xd2\x65\x29\x92\x54\x97\xaa\x92\x7e\xd5\x6f\xf5\x07\x3b\xfb\xdb" "\xfb\x9d\x76\xab\x68\x47\x15\xd7\xc2\xfe\x18\x25\x2d\xcd\x50\x9d\xcd\x9d" "\x76\xa8\xa9\x6d\xe7\x5a\x78\x0d\xbb\x56\xd5\x42\xbe\x0c\xd3\x11\xc7\xf1" "\xd5\x8f\x65\x07\x81\xd2\xb9\xab\x3f\x20\x92\x66\xfd\x75\xe8\xb6\xd7\x4f" "\x38\xae\xe3\xe2\x07\x37\x9b\xae\x77\xa5\x3f\x4a\x0c\xa7\x14\xf9\x03\x6c" "\x0e\x75\xa8\x87\x5a\x2c\x31\x1c\x00\xc0\x29\xe0\x9f\xff\x91\x7f\x4c\x2c" "\xb8\x22\xa3\x28\x92\xd6\xfc\x63\xff\x4c\x3f\xff\x07\x1d\x96\x1d\xc0\xf1" "\xba\xd8\x19\x2a\x8a\x0b\x1b\xe4\x9e\xff\x2e\xbb\x8b\x8d\x3d\xbe\x3f\xbb" "\x4d\xbd\xf9\x9e\x9b\xc2\xd9\xed\x51\x3a\x4b\x3c\x4a\x30\xb5\x81\xf5\x19" "\x25\x67\x56\x5f\x82\x69\xc2\xb3\xca\x4f\x71\xc2\xc7\x12\xcd\x6d\x6d\x57" "\xb5\xbe\xf9\x54\xad\x48\x07\xba\xe2\xe5\x1a\xac\xb8\xdf\xad\xe4\xd4\x4d" "\x8d\x89\x76\x35\x30\x37\x1d\xc5\x66\x8c\x23\xf7\x56\xd3\xf5\x9f\x92\xd1" "\xd8\x8c\x72\x6e\x70\x73\x1a\xd2\xd6\x76\xa7\xed\x32\xcf\x40\xfc\xcb\xa1" "\x4e\x27\xf9\xd7\x9e\x94\x79\x63\xde\x99\x9b\xa6\xae\x97\x6a\x65\xf9\x5f" "\x35\xfe\x6a\x0f\x93\x3b\x52\x8d\x81\x23\x15\xd5\x6c\xfc\xff\x8d\xde\xe3" "\xbc\x6b\x65\x6b\xd9\x21\x9b\x64\x9c\x51\x5f\x95\x5f\x5c\x27\xbf\xfb\x1e" "\xbc\x31\xa3\xac\x87\x67\x24\xf9\x7d\xa6\x2f\x08\xba\x59\x04\x81\x38\x0f" "\xd2\x05\xd7\xf7\x92\xfa\x5f\x2b\x24\xa3\xdb\x08\x75\x60\x7a\x3b\x5f\x0e" "\xb5\x6a\x64\x6b\xc3\x6d\x5d\x5f\x2b\x7d\xad\x2a\xfe\x4c\x58\xdf\xbc\xd7" "\x29\x7c\x95\x32\x1d\xe9\x10\xcd\x0b\x73\xc3\xac\xea\x8b\x5e\xab\x99\xcb" "\xff\x23\x1b\xdf\x9a\x72\x57\x66\xd1\xad\xde\xb8\x9a\xfe\xcc\x48\xc6\x33" "\x13\xae\x59\x75\x35\x1b\x43\x4f\x8e\x6e\xb6\xf4\x67\x16\x81\x37\x3b\xf1" "\xd8\x20\x4d\xf8\xb6\xec\xb9\xee\xe8\x92\x16\xf7\x1e\x3d\xbe\x5b\xe9\x74" "\xda\xbb\x76\xe1\x76\x60\xe1\xfe\xc2\xae\xf1\x25\xb5\x67\x52\xb0\xce\xf4" "\x17\x2a\x2a\xa8\xa3\x6e\xaf\xc4\x3d\x3c\x9e\xc4\xf1\x51\xf7\x1c\x4f\x33" "\xf8\x7f\xbf\xa3\xd5\xcc\xc8\x4d\xf6\xfe\x91\x95\xd8\xcb\x27\xd4\xdc\x5e" "\x65\x59\x49\x74\xd2\x87\xe9\xfc\x2d\x54\x15\xda\xd4\x7c\xab\xa2\x13\x72" "\xaa\x0b\x69\xea\x32\x61\xf3\x7a\x70\x93\x4d\xb4\x46\xb4\x9a\xca\x3d\x0a" "\xa7\xcc\x9e\x49\x0f\xba\x2f\x18\x4a\x62\x71\xce\xd9\xbc\xcb\x24\xf3\x3f" "\x97\xc9\xfb\xac\xce\xdd\x67\xec\xaf\x46\x41\x9e\x1e\x98\x64\x76\xfb\xd6" "\x72\x7b\xdc\xc8\x66\x70\xfd\xa9\xe0\x52\x28\x77\x19\x33\x37\x98\x1f\x3d" "\x83\xcb\xf5\xf8\xff\x88\x39\xa3\x9b\x73\xfd\xf5\x8f\xf4\x77\xae\xd0\xa8" "\xb0\xc7\x86\x8b\xf3\xdc\x30\x4d\xbd\xd7\x2d\xde\xff\x03\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9c\x35\x27\xf1\x3f\x16\xca\x1e" "\x23\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x67\xdd\xd1\xbf\xff\x3b\xd7\xfb\x52\x53\xe8\x6f\xc4\xbb\xef\xff\x36\xc6" "\x7e\xff\xb7\xef\x03\xc0\xfe\x43\x51\x7c\xff\x17\x28\xc7\xb7\x00\x00\x00" "\xff\xff\x76\x15\x7d\x1e", 780)); NONFAILING(syz_mount_image(/*fs=*/0x20000040, /*dir=*/0x20000000, /*flags=MS_SLAVE|MS_RDONLY*/ 0x80001, /*opts=*/0x20000440, /*chdir=*/1, /*size=*/0x30c, /*img=*/0x20000100)); // openat arguments: [ // fd: fd_dir (resource) // file: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 31 00} (length 0x8) // } // flags: open_flags = 0x42 (4 bytes) // mode: open_mode = 0x0 (2 bytes) // ] // returns fd NONFAILING(memcpy((void*)0x20000040, "./file1\000", 8)); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x20000040ul, /*flags=O_CREAT|O_RDWR*/ 0x42, /*mode=*/0); if (res != -1) r[2] = res; // pwrite64 arguments: [ // fd: fd (resource) // buf: ptr[in, buffer] { // buffer: {32} (length 0x1) // } // count: len = 0x1 (8 bytes) // pos: intptr = 0x8080c61 (8 bytes) // ] NONFAILING(memset((void*)0x20000140, 50, 1)); syscall(__NR_pwrite64, /*fd=*/r[2], /*buf=*/0x20000140ul, /*count=*/1ul, /*pos=*/0x8080c61ul); return 0; }