// https://syzkaller.appspot.com/bug?id=0a52da0bbfd5ff2cd097edb1607fd2bda63a1c4d // 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 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); } } void execute_one(void) { 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 = 0x64 (1 bytes) // size: len = 0x52b (8 bytes) // img: ptr[in, buffer] { // buffer: (compressed buffer with length 0x52b) // } // ] // returns fd_dir memcpy((void*)0x200000000180, "ext4\000", 5); memcpy((void*)0x2000000001c0, "./bus\000", 6); *(uint8_t*)0x200000000080 = 0; memcpy( (void*)0x200000000f80, "\x78\x9c\xec\xdd\xcf\x6b\x24\x59\x1d\x00\xf0\x6f\x75\xba\x63\x32\x93\xd9" "\x64\xd5\x83\x2e\xb8\xae\xee\x42\x66\xd0\xe9\x4e\x36\xee\x6e\xf0\xb0\x8e" "\x20\x7a\x5a\x50\xd7\xfb\x18\x93\x4e\x08\xe9\xa4\x43\xba\xb3\x3b\x09\x8b" "\x9b\xc1\x3f\x40\x10\x51\xc1\x93\x5e\xbc\x08\xfe\x01\x82\x2c\x78\xf1\xb8" "\x08\x0b\x7a\x56\x54\x14\xd1\x59\x05\x3d\xe8\xd4\x52\xdd\xd5\x99\x99\x4c" "\x77\xa7\x33\xd3\xf9\x31\xc9\xe7\x03\x95\x7a\xaf\x5e\x55\x7d\xdf\xeb\x50" "\xd5\xf5\xba\x1e\x55\x01\x5c\x58\xcf\x45\xc4\x8d\x88\xb8\x9b\xa6\xe9\xb5" "\x88\x98\xcc\x97\x17\xf2\x29\xf6\xda\x53\xb6\xde\xfb\x77\xde\x5a\xcc\xa6" "\x24\xd2\xf4\xf5\x7f\x24\x91\xe4\xcb\x3a\xfb\x4a\xf2\xf9\xe5\x7c\xb3\xb1" "\x88\xf8\xfa\x57\x22\xbe\x95\x3c\x1c\xb7\xb1\xb3\xbb\xb6\x50\xab\x55\xb7" "\xf2\x7c\xa5\xb9\xbe\x59\x69\xec\xec\x5e\x5f\x5d\x5f\x58\xa9\xae\x54\x37" "\xe6\xe6\x66\x5f\x9e\x7f\x65\xfe\xa5\xf9\x99\xa1\xb4\xf3\x4a\x44\xbc\xfa" "\xa5\xbf\xfc\xe0\xbb\x3f\xfb\xf2\xab\xbf\xfa\xec\x9b\x7f\xbc\xf9\xb7\xab" "\xdf\xce\xaa\x35\x91\x97\xdf\xdf\x8e\x23\x2a\xf6\x2b\x6c\x37\xbd\x74\xe3" "\xe0\x06\x5b\x8f\x18\xec\x2c\xca\xda\x53\xea\x64\xc6\xbb\xad\x31\xf2\xd0" "\x92\xdb\xc7\x5c\x27\x00\x00\xba\xcb\xae\xf1\x3f\x1c\x11\x9f\x8e\x88\x6b" "\x31\x19\x23\xfd\x2f\x67\x01\x00\x00\x80\x27\x50\xfa\x85\x89\xf8\x5f\x12" "\x91\x76\x37\xda\x63\x39\x00\x00\x00\xf0\x04\x29\xb4\xc6\xc0\x16\xa3\x9c" "\x8f\x05\x98\x88\x42\xa1\x5c\x6e\x8f\xe1\xfd\x68\x5c\x2a\xd4\xea\x8d\xe6" "\x67\x96\xeb\xdb\x1b\x4b\xed\xb1\xb2\x53\x51\x2a\x2c\xaf\xd6\xaa\x33\xf9" "\x58\xe1\xa9\x28\x25\x59\x7e\xb6\x95\xbe\x97\x7f\xf1\x40\x7e\x2e\x22\x9e" "\x8e\x88\xef\x4f\x8e\xb7\xf2\xe5\xc5\x7a\x6d\xe9\xb4\x7f\xfc\x00\x00\x00" "\x80\x0b\xe2\x72\xab\xcf\x9f\x14\x3a\xfd\xff\x7f\x4f\xb6\xfb\xff\x00\x00" "\x00\xc0\x39\x33\x75\x84\x75\xff\x73\x8c\xf5\x00\x00\x00\x00\x8e\xcf\x51" "\xfa\xff\x00\x00\x00\xc0\x93\x49\xff\x1f\x00\x00\x00\xce\xb5\xaf\xbe\xf6" "\x5a\x36\xa5\x9d\xf7\x5f\x2f\xbd\xb1\xb3\xbd\x56\x7f\xe3\xfa\x52\xb5\xb1" "\x56\x5e\xdf\x5e\x2c\x2f\xd6\xb7\x36\xcb\x2b\xf5\xfa\x4a\xeb\x99\x7d\xeb" "\x87\xed\xaf\x56\xaf\x6f\x7e\x2e\x36\xb6\x6f\x55\x9a\xd5\x46\xb3\xd2\xd8" "\xd9\xbd\xb9\x5e\xdf\xde\x68\xde\x5c\x6d\xbd\x0e\x1c\x00\x00\x00\x38\x05" "\x4f\x7f\xf2\x9d\xdf\x27\x11\xb1\xf7\xf9\xf1\xd6\x94\x19\x1d\x6c\xd3\x01" "\x57\x03\xce\xaa\xe2\x7e\x2a\xc9\xe7\x5d\x0e\xeb\x3f\x3c\xd5\x9e\xff\xf9" "\x84\x2a\x05\x9c\x88\x91\xbe\xa5\xa5\x13\xab\x07\x70\xf2\x8a\xa7\x5d\x01" "\xe0\xd4\xf8\x86\x07\x92\x43\xca\x7b\x0e\xde\x79\x37\x9f\x7f\x6a\xb8\xf5" "\x01\x00\x00\x86\x6f\xfa\xe3\xbd\xef\xff\x17\xfa\x6e\xb9\xd7\xbf\x18\x38" "\xf3\x1c\xc4\x70\x71\xf5\xbf\xff\x0f\x9c\x67\xad\xfb\xff\x83\x8e\xe4\x75" "\xb1\x00\xe7\x4a\xc9\x15\x00\x5c\x78\x83\xdf\xff\x3f\x70\x11\xf0\xee\xa0" "\x11\xd2\xf4\xc8\x95\x02\x00\x00\x86\x6a\xa2\x35\x25\x85\x72\x7e\x65\x3f" "\x11\x85\x42\xb9\x1c\x71\xa5\xf5\x5a\x80\x52\xb2\xbc\x5a\xab\xce\x44\xc4" "\x53\x11\xf1\xbb\xc9\xd2\x87\xb2\xfc\x6c\x6b\xcb\xe4\xd0\x3e\x03\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd0" "\x96\xa6\x49\xa4\x00\x00\x00\xc0\xb9\x16\x51\xf8\x6b\xf2\xeb\xf6\xb3\xfc" "\xa7\x27\x5f\x98\x38\xf8\xfb\xc0\x68\xf2\xdf\xc9\xc8\x5f\x11\xfa\xe6\x8f" "\x5f\xff\xe1\xad\x85\x66\x73\x6b\x36\x5b\xfe\xcf\xfd\xe5\xcd\x1f\xe5\xcb" "\x5f\x3c\x8d\x5f\x30\x00\x00\x00\xe0\x42\x38\xd2\x0b\xfc\x3b\xfd\xf4\x4e" "\x3f\x1e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x86\xe9\xfd\x3b\x6f\x2d\x76\xa6\x93\x8c\xfb\xf7\x2f\x46\xc4" "\xd4\x81\xf8\x49\x56\x52\x8c\xb1\x88\xd1\x88\xb1\x28\x45\xc4\xa5\x7f\x25" "\x51\xbc\x6f\xbb\x42\x44\x8c\x0c\x21\xfe\x78\xf6\xe7\x63\xdd\xda\x9f\x64" "\xd5\xda\x0f\x79\x30\x7e\xd2\xd9\xf6\x31\xed\xdd\xee\x1b\x3f\xa6\xb2\x4f" "\xa1\x47\xfc\xcb\x43\x88\x0f\x17\xd9\x3b\xd9\xf9\xe7\x46\xb7\xe3\xaf\x10" "\xcf\xb5\xe6\xdd\x8f\xbf\x62\xc4\x03\xf9\x47\xd5\xf5\xfc\x97\x1b\xcb\xff" "\x8e\xf4\x38\xfe\xaf\x0c\x18\xe3\x99\xf7\x7e\x51\xe9\x19\xff\x76\xc4\x33" "\xc5\xee\xe7\x9f\x4e\xfc\xa4\x47\xfc\xe7\x07\x8c\xff\xcd\x6f\xec\xee\xf6" "\x2a\x4b\x7f\x12\x31\xdd\xf5\xfb\x27\x79\x20\x56\xa5\xb9\xbe\x59\x69\xec" "\xec\x5e\x5f\x5d\x5f\x58\xa9\xae\x54\x37\xe6\xe6\x66\x5f\x9e\x7f\x65\xfe" "\xa5\xf9\x99\xca\xf2\x6a\xad\x9a\xff\xed\x1a\xe3\x7b\x9f\xf8\xe5\xdd\x7e" "\xed\xbf\xd4\x23\xfe\xd4\x21\xed\x7f\x61\xc0\xf6\xff\xff\xbd\x5b\x77\x3e" "\xd2\x4e\x96\xba\xc5\xbf\xfa\x7c\x97\xf8\xbf\xf9\x69\xbe\xc6\xc3\xf1\xf3" "\xef\xbe\xf4\xed\x3c\x9d\x95\x4f\x77\xd2\x7b\xed\xf4\xfd\x9e\xfd\xf9\x6f" "\x9f\xed\xd7\xfe\xa5\x1e\xed\x3f\xec\xff\x7f\x75\xc0\xf6\x5f\xfb\xda\x77" "\xfe\x34\xe0\xaa\x00\xc0\x09\x68\xec\xec\xae\x2d\xd4\x6a\xd5\xad\x61\x27" "\x0a\xc7\xb6\xe7\x23\x26\xb2\x5e\xfa\x19\xa8\xc6\x59\xfb\x58\x24\xaa\x5b" "\x8d\xb7\x87\xba\xc3\x34\x4d\xd3\xec\x98\x7a\x8c\xfd\x24\x71\x16\x3e\x96" "\x56\xe2\xb4\xcf\x4c\x00\x00\xc0\xb0\xdd\xbb\xe8\x3f\xed\x9a\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc0\xc5\x75\x12\x8f\x13" "\x3b\x18\x73\x6f\x3f\x95\x0c\xe3\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\x43\xf1\x41" "\x00\x00\x00\xff\xff\xd1\x39\xdb\x0d", 1323); syz_mount_image(/*fs=*/0x200000000180, /*dir=*/0x2000000001c0, /*flags=MS_RDONLY|MS_MANDLOCK*/ 0x41, /*opts=*/0x200000000080, /*chdir=*/0x64, /*size=*/0x52b, /*img=*/0x200000000f80); // 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 = 0x21081e (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 { // i_version: buffer: {69 5f 76 65 72 73 69 6f 6e} (length 0x9) // } // 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 { // bh: buffer: {62 68} (length 0x2) // } // 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 = 0x523 (8 bytes) // img: ptr[in, buffer] { // buffer: (compressed buffer with length 0x523) // } // ] // returns fd_dir memcpy((void*)0x200000000180, "ext4\000", 5); memcpy((void*)0x200000000000, "./bus\000", 6); memcpy((void*)0x200000000080, "i_version", 9); *(uint8_t*)0x200000000089 = 0x2c; memcpy((void*)0x20000000008a, "nogrpid", 7); *(uint8_t*)0x200000000091 = 0x2c; memcpy((void*)0x200000000092, "bh", 2); *(uint8_t*)0x200000000094 = 0x2c; *(uint8_t*)0x200000000095 = 0; memcpy( (void*)0x200000000c00, "\x78\x9c\xec\xdd\xcf\x6f\x1c\x57\x1d\x00\xf0\xef\x4c\xb2\xb6\x93\xb8\x75" "\x5a\x7a\x00\x04\x6d\x68\x0b\x01\x45\x59\xc7\x9b\xd6\xaa\x7a\x80\x72\x42" "\x08\x55\x42\xf4\x08\x22\x35\xf6\xc6\xb2\xbc\xeb\xb5\xbc\xeb\x52\x9b\x48" "\xb8\x67\xae\x48\x54\xe2\x04\x47\xfe\x00\xce\x3d\x71\xe7\x82\xe0\xc6\xa5" "\x1c\x90\xf8\x61\x81\x6a\x24\x0e\x53\xcd\xec\xd8\xd9\xd8\xbb\xf6\xa6\x89" "\xbd\x96\xf7\xf3\x91\x46\xf3\xde\xbc\xf1\x7e\xdf\x8b\x33\xef\xcd\xbc\x5d" "\xef\x0b\x60\x6c\xdd\x88\x88\x9d\x88\x98\x88\x88\x77\x23\x62\xa6\x3c\x9e" "\x94\x5b\xbc\xd5\xdd\xf2\xf3\x3e\xd9\x7d\xb0\xb8\xb7\xfb\x60\x31\x89\x2c" "\x7b\xe7\x5f\x49\x51\x9e\x1f\x8b\x9e\x9f\xc9\x5d\x2b\x5f\x73\x2a\x22\x7e" "\xf0\x9d\x88\x9f\x24\x47\xe3\xb6\xb7\xb6\x57\x17\x1a\x8d\xfa\x46\x99\x9f" "\xed\x34\xd7\x67\xdb\x5b\xdb\xb7\x57\x9a\x0b\xcb\xf5\xe5\xfa\x5a\xad\x36" "\x3f\x37\x7f\xe7\x8d\xbb\xaf\xd7\x1e\xa3\x35\x53\xc7\x96\xbe\xd4\x9c\x28" "\x53\x5f\xfe\xf8\x8f\x3b\xdf\xf8\x59\x5e\xad\xe9\xf2\x48\x6f\x3b\x9e\xa6" "\x6e\xd3\x2b\x07\x71\x72\x97\x23\xe2\x7b\xa7\x11\x6c\x04\x2e\x95\xed\x99" "\x18\x75\x45\xf8\x4c\xd2\x88\x78\x3e\x22\x5e\x2e\xae\xff\x99\xb8\x54\xfc" "\x36\x01\x80\x8b\x2c\xcb\x66\x22\x9b\xe9\xcd\x03\x00\x17\x5d\x5a\xcc\x81" "\x25\x69\xb5\x9c\x0b\x98\x8e\x34\xad\x56\xbb\x73\x78\x2f\xc4\xd5\xb4\xd1" "\x6a\x77\x6e\xdd\x6f\x6d\xae\x2d\x75\xe7\xca\xae\x47\x25\xbd\xbf\xd2\xa8" "\xdf\x29\xe7\x0a\xaf\x47\x25\xc9\xf3\x73\x45\xfa\x61\xbe\x76\x28\x7f\x37" "\x22\x9e\x8b\x88\x5f\x4e\x5e\x29\xf2\xd5\xc5\x56\x63\x69\x94\x37\x3e\x00" "\x30\xc6\xae\x1d\x1a\xff\xff\x3b\xd9\x1d\xff\x01\x80\x0b\xee\xf8\x8f\xcd" "\x00\x00\x17\x91\xf1\x1f\x00\xc6\x8f\xf1\x1f\x00\xc6\x8f\xf1\x1f\x00\xc6" "\x4f\x77\xfc\xbf\xf2\xb8\x3f\x96\x65\xd9\xcf\x4f\xa3\x3a\x00\xc0\x19\xf0" "\xfc\x0f\x00\xe3\xc7\xf8\x0f\x00\x63\xe5\xfb\x6f\xbf\x9d\x6f\xd9\x5e\xf9" "\xfd\xd7\x4b\xef\x6d\x6d\xae\xb6\xde\xbb\xbd\x54\x6f\xaf\x56\x9b\x9b\x8b" "\xd5\xc5\xd6\xc6\x7a\x75\xb9\xd5\x5a\x2e\xbe\xb3\xa7\x79\xd2\xeb\x35\x5a" "\xad\xf5\xb9\xd7\x62\xf3\xfd\xeb\xdf\x5c\x6f\x77\x66\xdb\x5b\xdb\xf7\x9a" "\xad\xcd\xb5\xce\xbd\xe2\x7b\xbd\xef\xd5\x2b\xc5\x59\x3b\x67\xd0\x32\x00" "\x60\x90\xe7\x5e\xfa\xe8\x2f\x49\x3e\x22\xbf\x79\xa5\xd8\xa2\x67\x2d\x87" "\xca\x48\x6b\x06\x9c\xb6\x74\xd4\x15\x00\x46\xe6\xd2\xa8\x2b\x00\x8c\x8c" "\xd5\xbe\x60\x7c\x3d\x7c\xc6\x7f\xec\x0f\x01\x98\x1e\x80\x0b\xa2\xcf\x12" "\xbd\x8f\x98\xea\xf7\x07\x42\x59\x96\x65\xa7\x57\x25\xe0\x94\xdd\xfc\x82" "\xf9\x7f\x18\x57\x3d\xf3\xff\x3e\x05\x0c\x63\xe6\xa4\xf9\xff\x62\x6d\x60" "\x6f\x12\xc2\x85\x64\xfe\x1f\xc6\x57\x96\x25\xc3\xae\xf9\x1f\xc3\x9e\x08" "\x00\x9c\x6f\xc7\xcc\xf1\x5f\x3f\xcb\xfb\x10\x60\x74\x06\xbc\xff\xff\x7c" "\xb9\xff\x5d\xf9\xe6\xc0\x8f\x96\x0e\x9f\xf1\xe1\x69\xd6\x0a\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\xce\xb7\xfd\xf5\x7f\xab\xe5\x32\xbf\xd3\x91\xa6\xd5\x6a\xc4" "\x33\xc5\x02\x40\x95\xe4\xfe\x4a\xa3\x7e\x27\x22\x9e\x8d\x88\x3f\x4f\x56" "\x26\xf3\xfc\xdc\x88\xeb\x0c\x00\x3c\xa9\xf4\xef\x49\xb9\xfe\xd7\xcd\x99" "\x57\xa7\x1f\x29\x7a\xf1\xda\x41\x72\x22\x22\x7e\xfa\xeb\x77\x7e\xf5\xfe" "\x42\xa7\xb3\xf1\xa7\x88\x89\xe4\xdf\x93\xfb\xc7\x3b\x1f\x96\xc7\x6b\x27" "\x06\x9b\x3a\x8d\x16\x00\x00\xc7\xdb\x1f\xa7\x8b\x7d\xcf\x83\xfc\x27\xbb" "\x0f\x16\xf7\xb7\xb3\xac\xcf\x3f\xbe\xdd\xbd\x2b\xc8\xe3\xee\xed\x4e\xc4" "\xde\x41\xfc\xcb\x71\xb9\xd8\x4f\x45\x25\x22\xae\xfe\x27\x29\xf3\x5d\x49" "\xcf\xdc\xc5\x93\xd8\xf9\x20\x22\x3e\xdf\xaf\xfd\x49\x4c\x17\x73\x20\xdd" "\x5b\x96\xc3\xf1\xf3\xd8\xcf\x9c\x69\xfc\xf4\x91\xf8\x69\xb9\x40\x73\x5a" "\xfe\x5b\x7c\xee\x29\xd4\x05\xc6\xcd\x47\x79\xff\xf3\x56\xbf\xeb\x2f\x8d" "\x1b\xc5\xbe\xff\xf5\x3f\x55\xf4\x50\x4f\xae\xec\xff\xf2\x97\x5a\xdc\x2b" "\xfa\xc0\x87\xf1\xf7\xfb\xbf\x4b\x03\xfa\xbf\x1b\xc3\xc6\x78\xed\x0f\xdf" "\xed\xa6\xae\x1c\x2d\xfb\x20\xe2\x8b\x97\x23\xf6\x63\xef\xf5\xf4\x3f\xfb" "\xf1\x93\x01\xf1\x5f\x1d\x32\xfe\x5f\xbf\xf4\xe2\xcb\x83\xca\xb2\xdf\x44" "\xdc\x8c\xfe\xf1\x7b\x63\xcd\x76\x9a\xeb\xb3\xed\xad\xed\xdb\x2b\xcd\x85" "\xe5\xfa\x72\x7d\xad\x56\x9b\x9f\x9b\xbf\xf3\xc6\xdd\xd7\x6b\xb3\xc5\x1c" "\xf5\xec\xe0\xd1\xe0\x9f\x6f\xde\x7a\x76\x50\x59\xde\xfe\xab\x03\xe2\x4f" "\x9d\xd0\xfe\xaf\x0e\xd9\xfe\xdf\xfe\xff\xdd\x1f\x7e\xe5\x98\xf8\x5f\x7f" "\xa5\x5f\xfc\x34\x5e\x38\x26\x7e\x3e\x26\x7e\x6d\xc8\xf8\x0b\x57\x7f\x3f" "\xf0\xb9\x3b\x8f\xbf\x74\xb4\xfd\xc9\x30\xbf\xff\x5b\x43\xc6\xff\xf8\x6f" "\xdb\x47\x96\x0d\x07\x00\x46\xa7\xbd\xb5\xbd\xba\xd0\x68\xd4\x37\x24\xc6" "\x34\xf1\xe3\x38\x17\xd5\x18\x2e\x91\xff\x97\x3d\x07\xd5\xe8\x9b\xf8\xd6" "\x59\xc5\x9a\x88\xfe\x45\xbf\x78\xa5\x7b\x4d\x1f\x2a\xca\xb2\xcf\x14\x6b" "\x50\x8f\xf1\x34\x66\xdd\x80\xf3\xe0\xe0\xa2\x8f\x88\xff\x8d\xba\x32\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x5f\x67\xf1\x17\x4b\xa3\x6e" "\x23\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x17\xd7\xa7\x01\x00\x00\xff\xff\xf8\x4d\xd3" "\x43", 1315); syz_mount_image( /*fs=*/0x200000000180, /*dir=*/0x200000000000, /*flags=MS_POSIXACL|MS_SYNCHRONOUS|MS_RELATIME|MS_NOSUID|0x80c*/ 0x21081e, /*opts=*/0x200000000080, /*chdir=*/1, /*size=*/0x523, /*img=*/0x200000000c00); // openat arguments: [ // fd: fd_dir (resource) // file: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 31 00} (length 0x8) // } // flags: open_flags = 0x181242 (4 bytes) // mode: open_mode = 0x148 (2 bytes) // ] // returns fd memcpy((void*)0x200000000180, "./file1\000", 8); syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000180ul, /*flags=O_TRUNC|O_SYNC|O_CREAT|O_CLOEXEC|O_RDWR*/ 0x181242, /*mode=S_IXGRP|S_IXUSR|S_IRUSR*/ 0x148); } 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; }