// https://syzkaller.appspot.com/bug?id=b3d4ed3e41b3085ce97f4504f4183e3f99115fb2 // 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_memfd_create #define __NR_memfd_create 319 #endif #ifndef __NR_pwritev2 #define __NR_pwritev2 328 #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 void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } 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; } #define FS_IOC_SETFLAGS _IOW('f', 2, long) static void remove_dir(const char* dir) { int iter = 0; DIR* dp = 0; const int umount_flags = MNT_FORCE | UMOUNT_NOFOLLOW; retry: while (umount2(dir, umount_flags) == 0) { } dp = opendir(dir); if (dp == NULL) { if (errno == EMFILE) { exit(1); } exit(1); } struct dirent* ep = 0; while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); while (umount2(filename, umount_flags) == 0) { } struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } int i; for (i = 0;; i++) { if (unlink(filename) == 0) break; if (errno == EPERM) { int fd = open(filename, O_RDONLY); if (fd != -1) { long flags = 0; if (ioctl(fd, FS_IOC_SETFLAGS, &flags) == 0) { } close(fd); continue; } } if (errno == EROFS) { break; } if (errno != EBUSY || i > 100) exit(1); if (umount2(filename, umount_flags)) exit(1); } } closedir(dp); for (int i = 0;; i++) { if (rmdir(dir) == 0) break; if (i < 100) { if (errno == EPERM) { int fd = open(dir, O_RDONLY); if (fd != -1) { long flags = 0; if (ioctl(fd, FS_IOC_SETFLAGS, &flags) == 0) { } close(fd); continue; } } if (errno == EROFS) { break; } if (errno == EBUSY) { if (umount2(dir, umount_flags)) exit(1); continue; } if (errno == ENOTEMPTY) { if (iter < 100) { iter++; goto retry; } } } exit(1); } } 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"); if (symlink("/dev/binderfs", "./binderfs")) { } } static void execute_one(void); #define WAIT_FLAGS __WALL static void loop(void) { int iter = 0; for (;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); reset_loop(); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); 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; } remove_dir(cwdbuf); } } 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 62 75 73 00} (length 0x6) // } // flags: mount_flags = 0x41 (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 = 0x67 (1 bytes) // size: len = 0x52b (8 bytes) // img: ptr[in, buffer] { // buffer: (compressed buffer with length 0x52b) // } // ] // returns fd_dir memcpy((void*)0x2000000000c0, "ext4\000", 5); memcpy((void*)0x2000000001c0, "./bus\000", 6); *(uint8_t*)0x200000000080 = 0; memcpy( (void*)0x200000000a00, "\x78\x9c\xec\xdd\x5f\x6b\x2c\x67\x19\x00\xf0\x67\x36\xbb\xc7\x93\x73\x72" "\x9a\x54\xbd\xd0\x82\xb5\xda\x4a\xce\x41\xcf\x6e\xd2\xd8\x36\x78\x51\x2b" "\x88\x5e\x15\xd4\x7a\x5f\x63\xb2\x09\x21\x9b\x6c\xc8\x6e\xda\x93\x50\x4c" "\x0e\x7e\x00\x41\x44\x05\xaf\xf4\xc6\x1b\xc1\x0f\x20\x48\xc1\x1b\x2f\x45" "\x28\xe8\xb5\xa2\xa2\x88\x9e\xea\x85\x17\xda\x91\xd9\x9d\x4d\x73\x92\xfd" "\xd7\x76\x93\x4d\x93\xdf\x0f\x26\xf3\xbe\x33\xef\xcc\xf3\xbc\x1b\x66\x76" "\x66\x67\x98\x09\xe0\xca\x7a\x22\x22\x5e\x88\x88\xb7\xd2\x34\xbd\x13\x11" "\xd3\xf9\xf4\x42\x3e\xc4\x61\x7b\xc8\xda\xbd\xf9\xe0\xb5\xe5\x6c\x48\x22" "\x4d\x5f\xfa\x47\x12\x49\x3e\xad\xb3\xae\x24\x1f\xdf\xcc\x17\xbb\x1e\x11" "\x5f\xfb\x72\xc4\x37\x93\xd3\x71\x1b\x7b\xfb\x1b\x4b\xb5\x5a\x75\x27\xaf" "\x57\x9a\x9b\xdb\x95\xc6\xde\xfe\xdd\xf5\xcd\xa5\xb5\xea\x5a\x75\x6b\x61" "\x61\xfe\xd9\xc5\xe7\x16\x9f\x59\x9c\x1b\x49\x3f\x6f\x45\xc4\xf3\x5f\xfc" "\xcb\xf7\xbf\xf3\xd3\x2f\x3d\xff\xcb\xcf\xbc\xfa\xc7\x97\xff\x76\xfb\x5b" "\x59\x5a\x53\xf9\xfc\xe3\xfd\x78\x87\x8a\xfd\x66\xb6\xbb\x5e\x6a\x7d\x16" "\xc7\x17\xd8\x79\x97\xc1\x2e\xa2\x62\xab\x87\xb9\xc9\x6e\x2d\x26\x4e\x4d" "\xb9\x7f\xc6\x39\x01\x00\xd0\x5d\x76\x8c\xff\xc1\x88\xf8\x64\x44\xdc\x89" "\xe9\x98\xe8\x7f\x38\x0b\x00\x00\x00\xbc\x0f\xa5\x9f\x9f\x8a\xff\x26\x11" "\x69\x77\xd7\x7a\x4c\x07\x00\x00\x00\xde\x47\x0a\xad\x7b\x60\x93\x42\x39" "\xbf\x17\x60\x2a\x0a\x85\x72\xb9\x7d\x0f\xef\x87\xe3\x46\xa1\x56\x6f\x34" "\x3f\xbd\x5a\xdf\xdd\x5a\x69\xdf\x2b\x3b\x13\xa5\xc2\xea\x7a\xad\x3a\x97" "\xdf\x2b\x3c\x13\xa5\x24\xab\xcf\xb7\xca\x6f\xd7\x9f\x3e\x51\x5f\x88\x88" "\x47\x23\xe2\x7b\xd3\x93\xad\x7a\x79\xb9\x5e\x5b\x19\xf7\x8f\x1f\x00\x00" "\x00\x70\x45\xdc\x3c\x71\xfe\xff\xef\xe9\xf6\xf9\x7f\xc7\xc1\x38\x93\x03" "\x00\x00\x00\x46\x67\x66\xdc\x09\x00\x00\x00\x00\x67\x6e\xd8\xf3\xff\x1b" "\x67\x9c\x07\x00\x00\x00\x70\x76\x5c\xff\x07\x00\x00\x80\x4b\xed\x2b\x2f" "\xbe\x98\x0d\x69\xe7\xfd\xd7\x2b\xaf\xec\xed\x6e\xd4\x5f\xb9\xbb\x52\x6d" "\x6c\x94\x37\x77\x97\xcb\xcb\xf5\x9d\xed\xf2\x5a\xbd\xbe\xd6\x7a\x66\xdf" "\xe6\xa0\xf5\xd5\xea\xf5\xed\xcf\xc6\xd6\xee\xbd\x4a\xb3\xda\x68\x56\x1a" "\x7b\xd7\x63\xb3\xbe\xbb\xd5\x7c\x79\xfd\xa1\x57\x60\x03\x00\x00\x00\xe7" "\xe8\xd1\x8f\xbf\xfe\xfb\x24\x22\x0e\x3f\x37\xd9\x1a\x32\xd7\x86\x5b\x74" "\xc8\x66\xc0\x45\x55\x3c\x2a\x25\xf9\xb8\xcb\x66\xfd\x87\x47\xda\xe3\x3f" "\x9f\x53\x52\xc0\xb9\x98\x18\x77\x02\xc0\xd8\x14\xc7\x9d\x00\x30\x36\xa5" "\x71\x27\x00\x8c\x5d\x32\x60\x7e\xcf\x9b\x77\x7e\x93\x8f\x3f\x31\xda\x7c" "\x00\x00\x80\xd1\x9b\xfd\x68\xef\xeb\xff\x85\xbe\x4b\x1e\xf6\x9f\x0d\x5c" "\x78\x36\x62\xb8\xba\x5c\xff\x87\xab\xab\x75\xfd\x7f\xd8\x3b\x79\x1d\x2c" "\xc0\xa5\x52\x1a\x74\x04\xd0\x77\x9b\x3f\x18\x71\x36\xc0\x38\xbc\xe7\xeb" "\xff\x03\xa5\xe9\x3b\x4a\x08\x00\x00\x18\xb9\xa9\xd6\x90\x14\xca\xc5\x4e" "\xbd\x50\x28\x97\x23\x6e\xb5\x5e\x0b\x50\x4a\x56\xd7\x6b\xd5\xb9\x88\x78" "\x24\x22\x7e\x37\x5d\xfa\x40\x56\x9f\x6f\xb5\x4c\x06\x9e\x33\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6d" "\x69\x9a\x44\x0a\x00\x00\x00\x5c\x6a\x11\x85\xbf\x26\xbf\x6a\x3f\xcb\x7f" "\x76\xfa\xa9\xa9\x93\xbf\x0f\x5c\x4b\xfe\x33\x1d\xf9\x2b\x42\x5f\xfd\xd1" "\x4b\x3f\xb8\xb7\xd4\x6c\xee\xcc\x67\xd3\xff\x79\x34\xbd\xf9\xc3\x7c\xfa" "\xd3\xe3\xf8\x05\x03\x00\x00\x00\xae\x84\x01\x2f\xf0\x7f\x58\xe7\x3c\xbd" "\x73\x1e\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\xa3\xf4\xe6\x83\xd7\x96\x3b\xc3\x79\xc6\xfd\xfb\x17\x22" "\x62\xa6\x5b\xfc\x62\x5c\x6f\x8d\xaf\x47\x29\x22\x6e\xfc\x2b\x89\xe2\xb1" "\xe5\x92\x88\x98\x18\x41\xfc\xc9\xec\xcf\x47\xba\xc5\x4f\xb2\xb4\x8e\x42" "\x76\x8b\x3f\x39\x82\xf8\x87\xf7\xfb\xc6\x8f\xc3\xfc\x53\xe8\x16\xff\xe6" "\x08\xe2\xc3\x55\xf6\x7a\xb6\xff\x79\xa1\xdb\xf6\x57\x88\x27\x5a\xe3\xee" "\xdb\x5f\x31\xe2\xa1\xfa\xbb\xd5\x7b\xff\x17\x47\xfb\xbf\x89\x1e\xdb\xff" "\xad\x21\x63\x3c\xf6\xc6\xcf\x2b\x3d\xe3\xdf\x8f\x78\xac\x78\x2a\xfe\x41" "\x16\xa1\x13\x3f\xe9\x11\xff\xc9\x21\xe3\x7f\xe3\xeb\xfb\xfb\xbd\xe6\xa5" "\x3f\x8e\x98\xed\xfa\xfd\x93\x74\x9a\x64\x7b\xc8\xa8\x34\x37\xb7\x2b\x8d" "\xbd\xfd\xbb\xeb\x9b\x4b\x6b\xd5\xb5\xea\xd6\xc2\xc2\xfc\xb3\x8b\xcf\x2d" "\x3e\xb3\x38\x57\x59\x5d\xaf\x55\xf3\xbf\x5d\x63\x7c\xf7\x63\xbf\x78\xab" "\x5f\xff\x6f\xf4\x88\x3f\x33\xa0\xff\x4f\x9d\x5a\xdb\xb5\xae\x31\xfe\xf7" "\xc6\xbd\x07\x1f\x6a\x17\x4b\xdd\xe2\xdf\x7e\xb2\x4b\xfc\x5f\xff\x24\x6f" "\x71\x3a\x7e\x21\xff\xee\xfb\x54\x5e\xce\xe6\xcf\x76\xca\x87\xed\xf2\x71" "\x8f\xff\xec\xb7\x8f\xf7\xeb\xff\x4a\x8f\xfe\x0f\xfa\xff\xdf\xee\xb5\xd2" "\x13\xee\x7c\xf5\xdb\x7f\x1a\xb2\x29\x00\x70\x0e\x1a\x7b\xfb\x1b\x4b\xb5" "\x5a\x75\xe7\xd2\x16\xb2\xb3\xf4\x21\x1b\x67\x47\x67\x17\x22\x67\x85\xf3" "\x29\x1c\x8c\x74\x85\x69\x9a\xa6\xd9\x36\xf5\x1e\xd6\x93\xc4\x45\xf8\x58" "\x5a\x85\x71\xef\x99\x00\x00\x80\x51\x7b\xfb\xa0\x7f\xdc\x99\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc0\xd5\x75\x1e\x8f\x13" "\x3b\x19\xf3\xf0\xa8\x94\x8c\xe2\x11\xda\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x23\xf1\xff" "\x00\x00\x00\xff\xff\xec\xd7\xd9\x32", 1323); syz_mount_image(/*fs=*/0x2000000000c0, /*dir=*/0x2000000001c0, /*flags=MS_RDONLY|MS_MANDLOCK*/ 0x41, /*opts=*/0x200000000080, /*chdir=*/0x67, /*size=*/0x52b, /*img=*/0x200000000a00); // 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 = 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 { // nodioread_nolock: buffer: {6e 6f 64 69 6f 72 65 61 64 5f 6e 6f // 6c 6f 63 6b} (length 0x10) // } // comma: const = 0x2c (1 bytes) // } // fs_opt_elem[ext4_options] { // elem: union ext4_options { // sb: fs_opt["sb", fmt[hex, int32]] { // name: buffer: {73 62} (length 0x2) // eq: const = 0x3d (1 bytes) // val: int32 = 0x1 (18 bytes) // } // } // comma: const = 0x2c (1 bytes) // } // } // common: array[fs_opt_elem[fs_options_common]] { // } // null: const = 0x0 (1 bytes) // } // } // chdir: int8 = 0x4 (1 bytes) // size: len = 0x523 (8 bytes) // img: ptr[in, buffer] { // buffer: (compressed buffer with length 0x523) // } // ] // returns fd_dir memcpy((void*)0x2000000004c0, "ext4\000", 5); memcpy((void*)0x200000000500, "./file2\000", 8); memcpy((void*)0x200000000080, "nodioread_nolock", 16); *(uint8_t*)0x200000000090 = 0x2c; memcpy((void*)0x200000000091, "sb", 2); *(uint8_t*)0x200000000093 = 0x3d; sprintf((char*)0x200000000094, "0x%016llx", (long long)1); *(uint8_t*)0x2000000000a6 = 0x2c; *(uint8_t*)0x2000000000a7 = 0; memcpy( (void*)0x2000000018c0, "\x78\x9c\xec\xdd\xc1\x6f\x1b\x59\x19\x00\xf0\x6f\x9c\xb8\x49\xb3\xe9\xa6" "\x0b\x7b\x00\x04\x6c\x59\x16\x0a\xaa\xea\x24\xee\x6e\xb4\xea\x85\xf6\x02" "\x42\x55\x25\x44\xc5\x89\x43\x1b\x12\x37\x8a\x62\xd7\x51\xec\x8a\x26\xf4" "\x90\x1e\xb9\x57\xa2\x12\x27\xe0\x3f\xe0\xc6\x01\xa9\x27\x0e\xdc\xb8\xc1" "\x8d\x4b\x39\x20\x15\xa8\x40\x0d\x12\x07\xa3\x19\x4f\x52\x37\xb1\x93\x40" "\x9d\xb8\x89\x7f\x3f\x69\x32\xf3\xde\x4c\xfd\xbd\x17\xf7\xbd\xe7\x79\x91" "\xe7\x05\x30\xb4\x2e\x44\xc4\x66\x44\x9c\x89\x88\x3b\x11\x31\x95\xe7\x27" "\xf9\x16\xd7\xda\x5b\x7a\xdd\xcb\x17\x0f\x17\xb6\x5e\x3c\x5c\x48\xa2\xd5" "\xba\xf5\xf7\x24\x3b\x9f\xe6\x45\xc7\xbf\x49\xbd\x93\xbf\xe6\x78\x44\x7c" "\xff\x3b\x11\x3f\x4a\xf6\xc6\x6d\xac\x6f\xac\xcc\x57\xab\x95\xb5\x3c\x3d" "\xdd\xac\xad\x4e\x37\xd6\x37\x2e\x2f\x17\xf2\x9c\xf2\xdc\xec\xdc\xcc\xa7" "\x57\x3e\x29\xf7\xad\xae\x1f\xd4\x7e\xfd\xfc\xdb\xcb\x37\x7e\xf0\xdb\xdf" "\x7c\xe9\xd9\x1f\x36\xbf\xf9\x93\xb4\x58\x93\x3f\x3d\x97\x9d\xeb\xac\x47" "\x3f\xb5\xab\x5e\x8c\xc9\x8e\xbc\xd1\x88\xb8\x71\x14\xc1\x06\x64\x34\xff" "\xff\xc3\xc9\x93\xb6\xb6\xcf\x44\xc4\x87\x59\xfb\x9f\x8a\x91\xec\xdd\x04" "\x00\x4e\xb3\x56\x6b\x2a\x5a\x53\x9d\x69\x00\xe0\xb4\x4b\xef\xff\x27\x23" "\x29\x94\xf2\xb9\x80\xc9\x28\x14\x4a\xa5\xf6\x1c\xde\xfb\x31\x51\xa8\xd6" "\x1b\xcd\x4b\x53\xf5\xfb\xf7\x16\x23\x9b\xc3\x3a\x1f\xc5\xc2\xdd\xe5\x6a" "\x65\x26\x9f\x2b\x3c\x1f\xc5\x24\x4d\xcf\x66\xc7\xaf\xd2\xe5\xd7\xd2\x8f" "\x2b\x57\x22\xe2\xbd\x88\x78\x3c\x76\x36\x3b\x5f\x5a\xa8\x57\x17\x07\xf9" "\xc1\x07\x00\x86\xd8\x3b\xbb\xc6\xff\x7f\x8d\xb5\xc7\xff\x4e\xc5\x41\x15" "\x0e\x00\x38\x3a\xe3\x83\x2e\x00\x00\x70\xec\x8c\xff\x00\x30\x7c\x8c\xff" "\x00\x30\x7c\xfe\x87\xf1\xdf\xb7\x03\x01\xe0\x94\x70\xff\x0f\x00\xc3\xc7" "\xf8\x0f\x00\xc3\xe7\xc0\xf1\xff\xd1\xf1\x94\x03\x00\x38\x16\xdf\xbb\x79" "\x33\xdd\x5a\x5b\xed\xe7\x5f\x6f\x3f\xa9\xfb\xf2\x62\xa5\xb1\x52\xaa\xdd" "\x5f\x28\x2d\xd4\xd7\x56\x4b\x4b\xf5\xfa\x52\xb5\x52\x5a\x68\xb5\x0e\x7a" "\xbd\x6a\xbd\xbe\x3a\xfb\xf1\x4e\xb2\xb1\xbe\x71\xbb\x56\xbf\x7f\xaf\x79" "\x7b\xb9\x36\xbf\x54\xb9\x5d\xf1\x2c\x01\x00\x18\xbc\xf7\x3e\x78\xfa\xa7" "\x74\xd0\xdf\xbc\x7a\x36\xdb\xa2\x63\x2d\x07\x63\x35\x9c\x6e\x85\x41\x17" "\x00\x18\x98\x91\x41\x17\x00\x18\x18\xdf\xe7\x81\xe1\x75\x88\x7b\x7c\xd3" "\x00\x70\xca\x75\x59\xa2\xb7\x2d\x9f\x20\x48\x7a\x5d\xf0\xc4\xe2\xaf\x70" "\x52\x5d\xfc\xbc\xf9\x7f\x18\x56\x6f\x32\xff\x6f\xee\x00\x4e\xb6\xff\x6f" "\xfe\xff\x5b\x7d\x2f\x07\x70\xfc\x8c\xe1\x30\xbc\x5a\xad\xc4\x9a\xff\x00" "\x30\x64\xcc\xf1\x03\x3d\xff\xfe\x9f\xeb\xf9\x88\x90\x27\xfd\x2f\x0b\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x9c\x14\x93\xd9\x96\x14\x4a\xd9\x5a\xe0\x9b\xe9\xcf" "\x42\xa9\x14\x71\x2e\x22\xce\x47\x31\xb9\xbb\x5c\xad\xcc\x44\xc4\xbb\x11" "\xf1\xc7\xb1\xe2\x58\x9a\x9e\x1d\x74\xa1\x01\x80\x37\x54\xf8\x6b\x92\xaf" "\xff\x75\x71\xea\xa3\xc9\xdd\x67\xcf\x24\xff\x1e\xcb\xf6\x11\xf1\xe3\x9f" "\xdf\xfa\xd9\x83\xf9\x66\x73\x6d\x36\xcd\xff\xc7\x4e\x7e\xf3\x49\x9a\x7f" "\xb6\xb9\x56\x3e\x33\x88\x0a\x00\x00\x9d\xae\xed\xcd\xca\xc6\xef\x72\xbe" "\xef\xb8\x91\x7f\xf9\xe2\xe1\xc2\xf6\x76\x9c\x45\x7c\x7e\xbd\xbd\xb8\x68" "\x1a\x77\x2b\xdf\xda\x67\x46\x63\x34\xdb\x8f\x47\x31\x22\x26\xfe\x99\xe4" "\xe9\xb6\xf4\xf3\xca\x48\x1f\xe2\x6f\x3e\x8a\x88\xcf\x6d\xd7\x7f\x3c\x1e" "\x74\x44\x98\xcc\xe6\x40\xda\x2b\x9f\xee\x8e\x9f\xc6\x3e\xd7\xf7\xf8\x9d" "\xbf\xff\xdd\xf1\x0b\xaf\xd5\xb7\x90\x9d\x4b\xf7\xc5\xec\x77\xf1\xd9\xd8" "\x55\x38\xe0\x40\x4f\xaf\xb7\xfb\xc9\xbc\xed\xa5\x4d\x3c\x6f\x7f\x85\xb8" "\x90\xed\xbb\xb7\xff\xf1\xac\x87\x7a\x73\x69\xff\x97\x36\xd7\xad\x3d\xfd" "\x5f\x61\xa7\xff\x1b\xd9\x13\x3f\xc9\xda\xfc\x85\x9d\xf4\xfe\x25\x79\xfe" "\xf1\xef\xbe\xbb\x27\xb3\x35\xd5\x3e\xf7\x28\xe2\x0b\xa3\xdd\xe2\x27\x3b" "\xf1\x93\xee\xfd\x6f\xf1\xa3\x43\xd6\xf1\xcf\x5f\xfc\xf2\x87\xbd\xce\xb5" "\x7e\x11\x71\xb1\x6b\xfd\xb7\x57\xa4\xae\x65\xdd\xec\x74\xb3\xb6\x3a\xdd" "\x58\xdf\xb8\xbc\x5c\x9b\x5f\xaa\x2c\x55\xee\x95\xcb\x73\xb3\x73\x33\x9f" "\x5e\xf9\xa4\x3c\x9d\xcd\x51\xb7\x7f\xfe\xbe\x5b\x8c\xbf\x5d\xbd\xf4\x6e" "\xaf\xf8\x69\xfd\x27\x7a\xc4\x1f\xdf\xbf\xfe\xf1\xb5\x43\xd6\xff\x97\xff" "\xb9\xf3\xc3\xaf\xec\x13\xff\x1b\x5f\xed\xfe\xfe\xbf\xbf\x4f\xfc\x74\x4c" "\xfc\xfa\x21\xe3\xcf\x4f\x5c\xeb\xb9\x7c\x77\x1a\x7f\xb1\x47\xfd\x0f\x78" "\xff\xe3\xd2\x21\xe3\x3f\xfb\xcb\xc6\xe2\x21\x2f\x05\x00\x8e\x41\x63\x7d" "\x63\x65\xbe\x5a\xad\xac\x1d\x70\x90\x7e\xd6\x3c\xe8\x1a\x07\x87\x3f\x48" "\xef\xed\xdf\x82\x62\x64\x07\xb1\x19\xd1\xaf\x17\xcc\x26\x25\x22\xa2\xeb" "\x35\xe9\x27\xea\xb7\xa3\xca\x47\x75\x90\x0c\x2c\xfa\xaf\xfa\xfd\x82\x83" "\xee\x99\x80\xa3\xf6\xaa\xd1\x0f\xba\x24\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x40\x2f\x8d\xf5\x8d\x95\xb1\xee\xdf\xd6\xea\xdb\xc1\xa0\xeb" "\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\xe9\xf5\xdf\x00\x00\x00\xff\xff\x28\x79\xc4" "\x36", 1315); syz_mount_image(/*fs=*/0x2000000004c0, /*dir=*/0x200000000500, /*flags=MS_NOEXEC*/ 8, /*opts=*/0x200000000080, /*chdir=*/4, /*size=*/0x523, /*img=*/0x2000000018c0); // openat arguments: [ // fd: fd_dir (resource) // file: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 31 00} (length 0x8) // } // flags: open_flags = 0x143041 (4 bytes) // mode: open_mode = 0x0 (2 bytes) // ] // returns fd memcpy((void*)0x200000000040, "./file1\000", 8); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000040ul, /*flags=O_SYNC|O_NOATIME|O_CREAT|FASYNC|O_WRONLY*/ 0x143041, /*mode=*/0); if (res != -1) r[0] = res; // pwritev2 arguments: [ // fd: fd (resource) // vec: ptr[in, array[iovec[in, array[int8]]]] { // array[iovec[in, array[int8]]] { // iovec[in, array[int8]] { // addr: ptr[in, buffer] { // buffer: {ff} (length 0x1) // } // len: len = 0xfdef (8 bytes) // } // } // } // vlen: len = 0x1 (8 bytes) // off_low: int32 = 0xe7b (4 bytes) // off_high: int32 = 0x0 (4 bytes) // flags: rwf_flags = 0x0 (8 bytes) // ] *(uint64_t*)0x2000000001c0 = 0x200000000080; memset((void*)0x200000000080, 255, 1); *(uint64_t*)0x2000000001c8 = 0xfdef; syscall(__NR_pwritev2, /*fd=*/r[0], /*vec=*/0x2000000001c0ul, /*vlen=*/1ul, /*off_low=*/0xe7b, /*off_high=*/0, /*flags=*/0ul); } int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*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=*/0x200001000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); const char* reason; (void)reason; use_temporary_dir(); loop(); return 0; }