// https://syzkaller.appspot.com/bug?id=4fd44e65e3eefc00ec5ac7d3d6f86171f7f25a11 // 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 319 #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=*/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; 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 = 0x0 (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 { // noload: buffer: {6e 6f 6c 6f 61 64} (length 0x6) // } // comma: const = 0x2c (1 bytes) // } // fs_opt_elem[ext4_options] { // elem: union ext4_options { // init_itable_val: fs_opt["init_itable", fmt[hex, int32]] { // name: buffer: {69 6e 69 74 5f 69 74 61 62 6c 65} (length // 0xb) eq: const = 0x3d (1 bytes) val: int32 = 0xff (18 bytes) // } // } // comma: const = 0x2c (1 bytes) // } // fs_opt_elem[ext4_options] { // elem: union ext4_options { // resgid: fs_opt["resgid", fmt[hex, gid]] { // name: buffer: {72 65 73 67 69 64} (length 0x6) // eq: const = 0x3d (1 bytes) // val: gid (resource) // } // } // comma: const = 0x2c (1 bytes) // } // } // common: array[fs_opt_elem[fs_options_common]] { // } // null: const = 0x0 (1 bytes) // } // } // chdir: int8 = 0x0 (1 bytes) // size: len = 0x48f (8 bytes) // img: ptr[in, buffer] { // buffer: (compressed buffer with length 0x48f) // } // ] // returns fd_dir NONFAILING(memcpy((void*)0x200000000180, "ext4\000", 5)); NONFAILING(memcpy((void*)0x2000000000c0, "./file0\000", 8)); NONFAILING(memcpy((void*)0x200000000280, "noload", 6)); NONFAILING(*(uint8_t*)0x200000000286 = 0x2c); NONFAILING(memcpy((void*)0x200000000287, "init_itable", 11)); NONFAILING(*(uint8_t*)0x200000000292 = 0x3d); NONFAILING(sprintf((char*)0x200000000293, "0x%016llx", (long long)0xff)); NONFAILING(*(uint8_t*)0x2000000002a5 = 0x2c); NONFAILING(memcpy((void*)0x2000000002a6, "resgid", 6)); NONFAILING(*(uint8_t*)0x2000000002ac = 0x3d); NONFAILING(sprintf((char*)0x2000000002ad, "0x%016llx", (long long)0)); NONFAILING(*(uint8_t*)0x2000000002bf = 0x2c); NONFAILING(*(uint8_t*)0x2000000002c0 = 0); NONFAILING(memcpy( (void*)0x2000000006c0, "\x78\x9c\xec\xdb\xcd\x6b\x5c\xe5\x1a\x00\xf0\xe7\x9c\x7c\xb4\xbd\xfd\x48" "\x6e\x6f\xef\xbd\xb6\x16\x8c\x16\x21\x28\x26\x4d\x5a\xb5\x0b\x37\x8a\x82" "\x48\x45\x41\x17\x15\x57\x31\x99\x96\xd0\x69\x23\x49\x14\x5b\x8a\x4d\x45" "\xea\x46\x90\x82\xae\xc5\xa5\xe8\x5f\xe0\x4e\x14\x51\x57\x82\x5b\xdd\xb8" "\x92\x42\xd1\x6e\xda\xba\x8a\x9c\x33\xe7\xe4\x63\x9a\x49\x9b\x66\x32\xa7" "\x36\xbf\x1f\x4c\xe6\x7d\xe7\xbc\x33\xe7\x79\xce\xd7\xbc\xe7\x7d\x27\x01" "\x6c\x5a\x03\xd9\x9f\x24\x62\x47\x44\xfc\x12\x11\x7d\x8d\xea\xf2\x06\x03" "\x8d\xa7\xeb\x57\xcf\x8d\xdf\xb8\x7a\x6e\x3c\x89\xf9\xf9\x57\xfe\x48\xf2" "\x76\xd7\xae\x9e\x1b\x2f\x9b\x96\xef\xdb\x5e\x54\x06\xd3\x88\xf4\xfd\xa4" "\x58\xc9\x72\x33\x67\xce\x9e\x1c\xab\xd7\x6b\xd3\x45\x7d\x78\xf6\xd4\x9b" "\xc3\x33\x67\xce\x3e\xf6\xf6\xa9\xb1\x13\xb5\x13\xb5\xd3\xa3\x47\x8e\x1c" "\x3e\x34\xf2\xe4\x13\xa3\x8f\xb7\x25\xcf\x2c\xaf\x6b\xfb\xde\x9d\xda\xbf" "\xf7\xf9\xd7\x2e\xbd\x38\x7e\xec\xd2\x1b\x3f\x7c\x99\xc5\xbb\xa3\x58\xbe" "\x34\x8f\x76\x19\xc8\x12\xff\x73\x3e\xd7\xbc\xec\xe1\x76\xaf\xac\x62\x3b" "\x97\x94\x93\xee\x0a\x03\x61\x4d\xba\x22\x22\xdb\x5d\x3d\xf9\xf9\xdf\x17" "\x5d\xb1\xb8\xf3\xfa\xe2\xb9\xf7\x2a\x0d\x0e\xd8\x50\xd9\x77\xd3\x96\xd6" "\x8b\xe7\xe6\x81\x7b\x58\x12\x55\x47\x00\x54\xa3\xfc\xa2\xcf\xee\x7f\xcb" "\x47\x87\xba\x1e\x77\x85\x2b\x4f\x37\x6e\x80\xb2\xbc\xaf\x17\x8f\xc6\x92" "\xee\x48\x8b\x36\x3d\x4d\xf7\xb7\xed\x34\x10\x11\xc7\xe6\xfe\xfa\x34\x7b" "\xc4\x06\x8d\x43\x00\x00\x2c\xf5\xe1\xf8\x27\x47\x7b\x23\xe6\xfb\x6e\x7c" "\xf1\x42\xd6\xf7\xe8\x5b\x58\x92\xc6\xff\xf2\xe7\xdf\xf2\xbf\xbb\x8a\x39" "\x94\xfe\x88\xf8\x77\x44\xec\x8e\x88\xff\x44\xc4\x9e\x88\xf8\x6f\x44\xde" "\xf6\xff\x11\x71\xdf\x3a\xe3\xb9\xb9\xff\x93\x5e\x5e\xe7\x47\xae\x2a\xeb" "\xff\x3d\x55\xcc\x6d\x2d\xef\xff\x95\xbd\xbf\xe8\xef\x2a\x6a\x3b\xf3\xfc" "\x7b\x92\xe3\x93\xf5\xda\xc1\x62\x9b\x0c\x46\xcf\x96\xac\x3e\xb2\xca\x3a" "\xbe\x7e\xf6\xe7\x8f\x5a\x2d\x5b\xda\xff\xcb\x1e\xd9\xfa\xcb\xbe\x60\x11" "\xc7\xe5\xee\xa6\x01\xba\x89\xb1\xd9\xb1\xbc\x53\xda\x06\x57\x2e\x44\xec" "\xeb\x5e\x29\xff\x64\x61\x26\x20\x89\x88\xbd\x11\xb1\x6f\x6d\x1f\xbd\xab" "\x2c\x4c\x3e\xf2\xf9\xfe\x56\x8d\x6e\x9d\xff\x2a\xda\x30\xcf\x34\xff\x59" "\x96\xde\x5c\x96\xff\x5c\x34\xe5\x5f\x4a\x96\xce\x4f\x4e\xde\x34\x3f\x39" "\xbc\x35\xea\xb5\x83\xc3\xe5\x51\x71\x73\x84\x3f\xfe\x74\xf1\xe5\x56\xeb" "\x5f\x57\xfe\x6d\x70\xa5\xd6\x78\x5e\xb2\xff\x9b\x9b\xf4\x27\x8b\x1b\xa3" "\x36\x3d\xb3\xf6\x75\x5c\xfc\xf5\x83\x96\xf7\x34\x77\x78\xfc\xa7\xbd\xc9" "\xab\xf9\x3c\x73\x6f\xf1\xda\x3b\x63\xb3\xb3\xd3\x23\x11\xbd\xc9\xd1\xbc" "\xbe\xec\xf5\xd1\xc5\xf7\x96\xf5\xb2\x7d\x76\xfc\x0f\x1e\x58\xf9\xfc\xdf" "\x5d\xbc\x27\x4b\xfe\xfe\x88\xd8\xbf\x78\x4d\x88\x07\x8a\xd8\x1f\x8c\x88" "\x87\x22\xe2\xc0\x2a\xf9\x7f\xff\x4c\xeb\x65\x65\xfe\x91\x56\xb4\xff\x2f" "\x44\x4c\xac\x78\xfd\x5b\x38\xfe\xb3\xfd\x5f\xcc\xd7\x27\xc9\xf4\xc2\xc4" "\xfd\xed\x17\xba\x4e\x7e\xf7\x55\xab\xf5\xdf\xde\xfe\x3f\x9c\x97\x06\x8b" "\x57\xf2\xeb\xdf\x2d\xac\x14\x4e\x76\x32\x36\x07\xb8\x9e\x6d\x07\x00\x00" "\x00\xff\x14\x69\xfe\x1b\xf8\x24\x1d\x5a\x28\xa7\xe9\xd0\x50\xe3\x37\xfc" "\x7b\xe2\x5f\x69\x7d\x6a\x66\xf6\xd1\xe3\x53\x6f\x9d\x9e\x68\xfc\x56\xbe" "\x3f\x7a\xd2\x72\xa4\xab\xaf\x18\x0f\xad\x4f\xd6\x6b\x23\xc9\x5c\xf1\x89" "\x8d\xf1\xd1\xd1\x62\xac\xb8\x1c\x2f\x3d\x54\x8c\x1b\x7f\xdc\xb5\x2d\xaf" "\x0f\x8d\x4f\xd5\x27\x2a\xce\x1d\x36\xbb\xed\x2d\xce\xff\xcc\xef\x5d\x55" "\x47\x07\x6c\xb0\x6d\x2b\xbe\x3a\xda\xdb\xf1\x40\x80\x0a\x34\xcf\xa3\xa7" "\xcb\xab\xe7\x5f\x0a\x17\x03\xb8\x57\xf9\x7f\x6d\xd8\xbc\x6e\x71\xfe\xa7" "\x9d\x8a\x03\xe8\xbc\xee\x55\xab\xad\xbd\xbe\x01\xb1\x00\x9d\xb5\xd2\x09" "\x7f\xbe\xa9\x6e\x2e\x00\xee\x4d\xee\xff\x61\xf3\x72\xfe\xc3\x26\x95\x7e" "\x53\x75\x04\x40\x85\x7c\xff\xc3\xa6\x74\x07\xff\xce\xdf\x89\xc2\xd6\xe9" "\x99\x6f\xef\xee\x08\x37\xb0\xb0\xd6\x94\xbb\xa3\x83\x11\x46\x94\x85\xb4" "\xf2\x0d\xa5\xb0\x81\x85\x8a\x2f\x4c\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\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\xf2\x77\x00\x00\x00\xff\xff\x54\xbf\xe2\x28", 1167)); res = -1; NONFAILING(res = syz_mount_image(/*fs=*/0x200000000180, /*dir=*/0x2000000000c0, /*flags=*/0, /*opts=*/0x200000000280, /*chdir=*/0, /*size=*/0x48f, /*img=*/0x2000000006c0)); if (res != -1) r[0] = res; // openat arguments: [ // fd: fd_dir (resource) // file: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 30 00} (length 0x8) // } // flags: open_flags = 0x4c8c2bb75bdfc39a (4 bytes) // mode: open_mode = 0x0 (2 bytes) // ] // returns fd NONFAILING(memcpy((void*)0x200000000680, "./file0\000", 8)); res = syscall( __NR_openat, /*fd=*/r[0], /*file=*/0x200000000680ul, /*flags=__O_TMPFILE|O_TRUNC|O_NOFOLLOW|O_NOCTTY|O_NOATIME|O_LARGEFILE|O_EXCL|0x5b99401a*/ 0x5bdfc39a, /*mode=*/0); if (res != -1) r[1] = res; // ioctl$FS_IOC_FSSETXATTR arguments: [ // fd: fd (resource) // cmd: const = 0x401c5820 (4 bytes) // arg: ptr[in, fsxattr] { // fsxattr { // fsx_xflags: int32 = 0x8 (4 bytes) // fsx_extsize: int32 = 0x4 (4 bytes) // fsx_nextents: int32 = 0x0 (4 bytes) // fsx_projid: int32 = 0x6 (4 bytes) // fsx_cowextsize: int32 = 0x4 (4 bytes) // fsx_pad: buffer: {00 00 00 00 00 00 00 00} (length 0x8) // } // } // ] NONFAILING(*(uint32_t*)0x200000000100 = 8); NONFAILING(*(uint32_t*)0x200000000104 = 4); NONFAILING(*(uint32_t*)0x200000000108 = 0); NONFAILING(*(uint32_t*)0x20000000010c = 6); NONFAILING(*(uint32_t*)0x200000000110 = 4); NONFAILING(memset((void*)0x200000000114, 0, 8)); syscall(__NR_ioctl, /*fd=*/r[1], /*cmd=*/0x401c5820, /*arg=*/0x200000000100ul); // quotactl$Q_QUOTAON arguments: [ // cmd: quota_cmd_quota_on = 0xffffffff80000202 (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*)0x200000000180, "/dev/loop", 9)); NONFAILING(*(uint8_t*)0x200000000189 = 0x30); NONFAILING(*(uint8_t*)0x20000000018a = 0); syscall(__NR_quotactl, /*cmd=Q_QUOTAON_PRJ*/ 0xffffffff80000202ul, /*special=*/0x200000000180ul, /*id=*/(intptr_t)-1, /*addr=*/0ul); // mprotect arguments: [ // addr: VMA[0x3000] // len: len = 0x3000 (8 bytes) // prot: mmap_prot = 0x9 (8 bytes) // ] syscall(__NR_mprotect, /*addr=*/0x200000000000ul, /*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*)0x200000000180, "hugetlb.1GB.usage_in_bytes\000", 27)); res = syscall(__NR_openat, /*fd=*/(intptr_t)-1, /*file=*/0x200000000180ul, /*flags=*/0x275a, /*mode=*/0); if (res != -1) r[2] = res; // mmap arguments: [ // addr: VMA[0xb36000] // len: len = 0xb36000 (4 bytes) // prot: mmap_prot = 0xa (8 bytes) // flags: mmap_flags = 0x13 (8 bytes) // fd: fd (resource) // offset: intptr = 0x0 (8 bytes) // ] syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0xb36000, /*prot=PROT_SEM|PROT_WRITE*/ 0xaul, /*flags=MAP_SHARED_VALIDATE|MAP_FIXED*/ 0x13ul, /*fd=*/r[2], /*offset=*/0ul); // syz_mount_image$vfat arguments: [ // fs: ptr[in, buffer] { // buffer: {76 66 61 74 00} (length 0x5) // } // dir: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 30 00} (length 0x8) // } // flags: mount_flags = 0x1004041 (8 bytes) // opts: ptr[inout, array[ANYUNION]] { // array[ANYUNION] { // union ANYUNION { // ANYBLOB: buffer: {66 6c 75 73 68 2c 75 6e 69 5f 78 6c 61 74 65 3d // 31 2c 6e 6f 6e 75 6d 74 61 69 6c 3d 30 2c 72 6f 64 69 72 2c 66 6c // 75 73 68 2c 6e 6f 6e 75 6d 74 61 69 6c 3d 30 2c 75 6e 69 5f 78 6c // 61 74 65 3d 31 2c 6e 6f 6e 75 6d 74 61 69 6c 3d 30 2c 75 6e 69 5f // 78 6c 61 74 65 3d 30 2c 75 74 66 38 3d 31 2c 75 6e 69 5f 78 6c 61 // 74 65 3d 30 2c 75 74 66 38 3d 31 2c 75 6e 69 5f 78 6c 61 74 65 3d // 31 2c 6e 6f 6e 75 6d 74 61 69 6c 3d 30 2c 64 6f 73 31 78 66 6c 6f // 70 70 79 2c 72 6f 64 69 72 2c 75 6e 69 5f 78 6c 61 74 65 3d 31 2c // 71 75 69 65 74 2c 00 dc 5e 6e 02 a2 c7 cc 48 4d 0c} (length 0xbb) // } // } // } // chdir: int8 = 0xf8 (1 bytes) // size: len = 0x2f2 (8 bytes) // img: ptr[in, buffer] { // buffer: (compressed buffer with length 0x2f2) // } // ] // returns fd_dir NONFAILING(memcpy((void*)0x200000000480, "vfat\000", 5)); NONFAILING(memcpy((void*)0x200000000000, "./file0\000", 8)); NONFAILING(memcpy( (void*)0x200000000080, "\x66\x6c\x75\x73\x68\x2c\x75\x6e\x69\x5f\x78\x6c\x61\x74\x65\x3d\x31\x2c" "\x6e\x6f\x6e\x75\x6d\x74\x61\x69\x6c\x3d\x30\x2c\x72\x6f\x64\x69\x72\x2c" "\x66\x6c\x75\x73\x68\x2c\x6e\x6f\x6e\x75\x6d\x74\x61\x69\x6c\x3d\x30\x2c" "\x75\x6e\x69\x5f\x78\x6c\x61\x74\x65\x3d\x31\x2c\x6e\x6f\x6e\x75\x6d\x74" "\x61\x69\x6c\x3d\x30\x2c\x75\x6e\x69\x5f\x78\x6c\x61\x74\x65\x3d\x30\x2c" "\x75\x74\x66\x38\x3d\x31\x2c\x75\x6e\x69\x5f\x78\x6c\x61\x74\x65\x3d\x30" "\x2c\x75\x74\x66\x38\x3d\x31\x2c\x75\x6e\x69\x5f\x78\x6c\x61\x74\x65\x3d" "\x31\x2c\x6e\x6f\x6e\x75\x6d\x74\x61\x69\x6c\x3d\x30\x2c\x64\x6f\x73\x31" "\x78\x66\x6c\x6f\x70\x70\x79\x2c\x72\x6f\x64\x69\x72\x2c\x75\x6e\x69\x5f" "\x78\x6c\x61\x74\x65\x3d\x31\x2c\x71\x75\x69\x65\x74\x2c\x00\xdc\x5e\x6e" "\x02\xa2\xc7\xcc\x48\x4d\x0c", 187)); NONFAILING(memcpy( (void*)0x200000000180, "\x78\x9c\xec\xdd\xcd\x6b\x13\x4d\x1c\xc0\xf1\x5f\xd2\xe6\xad\x7d\xfa\xa4" "\x87\x87\x07\x11\x84\xa1\x82\x28\xd2\xa5\x09\x78\xf3\x60\x91\x16\xc4\x80" "\xd2\x36\x82\x15\x84\xad\x4d\x35\x64\x9b\x94\x26\x14\x22\x62\x7b\x10\xbc" "\x7a\xf6\xd0\x83\x47\x11\x44\xf0\xe6\x45\xc4\x6b\x2f\xfe\x05\xbe\xdd\x7a" "\xe9\xcd\x82\xc5\x91\xcd\xbe\x74\x9b\x6c\xd2\x17\xed\x9b\x7e\x3f\x87\xe6" "\xd7\x9d\xf9\xed\x4c\x76\x77\x9a\x74\xba\x9d\xac\x5e\x7c\x32\x5b\x9a\xa9" "\x1a\xdf\x75\xb7\xb4\xb3\x24\xe7\xde\x2f\x7f\x3a\x35\xfe\xee\x1f\xe7\x7b" "\xa5\x46\x87\x27\x32\x59\xa5\xa2\x22\x72\xeb\xc1\x8b\x81\xb7\xb5\xde\x1b" "\xaf\xff\x7d\x93\x90\x95\xfe\xdb\xab\x6b\xd9\xaf\x2b\x49\x11\xf9\x31\x71" "\x4f\xa2\xaa\x58\x55\x65\xad\xb5\x56\x53\x95\x4a\x2d\x62\x27\x4f\x17\xab" "\x25\x43\xa9\xeb\x56\xc1\xac\x46\xdc\x06\x94\xd9\x28\x37\xa7\xac\x82\x9a" "\xb1\x2a\x73\x73\x75\x65\x96\xa7\xfb\x7a\xe6\xe6\x0b\xd5\xaa\x32\xcb\x75" "\x55\x2a\xd4\x55\xad\xa2\x6a\xf3\x75\x65\xde\x35\x8b\x65\x65\x18\x86\xea" "\xeb\x69\xdb\xe7\xbf\x4a\xbf\x1f\x45\x5b\xca\x22\x9d\x12\xf3\xcf\xd7\xb5" "\x96\x35\xfb\x04\x25\x96\x44\x6b\x1d\x52\x7b\xc9\x0b\x62\xee\x63\xe2\xd7" "\x3a\x8b\xa3\xa4\xe9\xfc\x77\xac\xdb\x72\x71\x74\xed\x67\xcf\x70\x10\xd6" "\x75\xb7\x7f\xfe\xe3\xdb\x9c\x7f\xfc\x79\xd6\xb5\x3d\x88\x3f\x3f\x75\xc6" "\xff\xe2\x61\x77\x07\x07\x6c\xfc\xe6\xe4\xd5\xe1\x5c\x6e\x64\x4c\xa9\xa4" "\xc8\xec\xe3\x85\xfc\x42\xde\x79\x74\xca\x3f\xf6\x4a\x51\x2c\x29\xc8\xf2" "\xd8\xf9\xc9\x0d\xb1\x5f\x23\x5c\x12\xb1\xbf\x8e\x5e\xc9\x8d\x0c\xa9\x86" "\x7e\x39\x33\xbb\xe8\xe6\x2f\x2e\xe4\x9d\x17\x87\xe1\x19\x37\x3f\x23\x69" "\xfb\x7d\x4a\x20\x5f\xbc\xfc\x8c\x93\xaf\xb6\xe6\xc7\xa4\x27\x98\x9f\x95" "\xb4\xfc\x17\x9e\x9f\xf5\xf2\x25\x1a\xc8\x8f\xcb\xd9\xd3\x81\x7c\x43\xd2" "\xf2\xe1\x8e\x54\xc4\x92\x69\xb1\x73\x37\xf3\x1f\x66\x94\xba\x7c\x2d\xd7" "\xd4\x7e\xe0\x5d\x15\x00\x00\x00\x00\x00\x00\x00\x00\xc7\x8c\xa1\x7c\x9b" "\xf3\xf7\x11\xff\x4f\xbd\x29\xc3\x48\x34\xee\xf8\xf0\xcb\x53\xf6\xe6\xc6" "\xfc\x78\x83\x3f\xbf\x3e\x24\x69\xd9\x08\x9f\x9f\x1f\x0a\x9d\xdf\xef\x96" "\x93\xed\x6f\x39\x01\x00\x00\x00\x00\x00\xbf\x51\xb5\x7e\xbf\x64\x5a\x56" "\x61\x7e\x7f\x82\xae\x67\xa9\x0e\x4d\xc4\x44\xc4\x0e\x44\x1e\x0d\xd8\x9d" "\xe9\xb8\xc3\xff\xdd\x1e\xef\xac\xf5\xb8\x88\xb4\x16\x75\x75\x6e\xc2\x0d" "\x12\x62\x07\xa9\x0b\x4e\x7b\x2f\xc7\xdc\x8e\xc9\x7e\x1e\xa8\x3d\x06\x51" "\x11\x09\x6e\x71\xfe\x59\xc3\x7e\xf2\xd6\x2b\xaf\x4e\x4a\xc2\xb2\xa2\xbb" "\xba\x00\x06\xe3\xa1\x47\x3e\x79\xa0\x4f\x59\x76\x52\x59\x92\x7b\xbb\xb0" "\x13\x3b\xbe\xb4\x9a\x83\xc8\x86\xb7\xe5\x44\x68\x1d\x1d\xd9\x7e\x3f\xda" "\xb4\x62\xce\x16\x6f\x60\x6e\xd7\xfa\xa5\x5d\x0d\x87\xb6\x41\xb2\xf9\x40" "\x0d\x7e\x71\xf6\x6b\x75\xf8\xa1\xf1\xcd\x9f\xe2\x03\x00\x00\x00\x70\x8c" "\x04\x7e\x71\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x87\x64\x4f\x8b\x87\x79\xeb\xf6\x6f" "\x2d\x12\xf7\x23\xe2\x9b\x17\x18\x6b\xc5\xba\xff\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x8e\xa0\x9f\x01\x00\x00\xff\xff\x97\x23\xa5\x87", 754)); NONFAILING(syz_mount_image( /*fs=*/0x200000000480, /*dir=*/0x200000000000, /*flags=MS_REC|MS_STRICTATIME|MS_RDONLY|MS_MANDLOCK*/ 0x1004041, /*opts=*/0x200000000080, /*chdir=*/0xf8, /*size=*/0x2f2, /*img=*/0x200000000180)); return 0; }