// 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 279 #endif #ifndef __NR_mmap #define __NR_mmap 222 #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"); } 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)) { } memcpy((void*)0x20000140, "ext4\000", 5); memcpy((void*)0x200005c0, "./file1\000", 8); *(uint8_t*)0x20000280 = 0; memcpy( (void*)0x200011c0, "\x78\x9c\xec\xdd\xcf\x6b\x1c\x55\x1c\x00\xf0\xef\xec\x26\x31\x69\xa3\x69" "\x45\xc4\x56\xc5\x80\x87\x16\xa4\x69\x52\x8b\x55\x4f\x6d\x3d\x58\xa1\x60" "\xc1\x1e\x44\x3c\x34\x34\x49\x0d\xdd\xfe\xa0\x49\xc1\xd6\x82\x29\x78\x11" "\x54\x44\xbc\x7a\xe8\xc5\x7f\xc0\xbb\xf4\xee\x4d\x04\xf5\xe6\x59\xa8\xa2" "\x15\x0f\x22\x5d\x99\xd9\x9d\x76\x4d\x77\x37\x4b\x9a\xcd\x6c\x3a\x9f\x0f" "\xcc\xe6\xbd\x37\xb3\x79\xef\x9b\xc9\xdb\x79\x6f\x76\x5f\x12\x40\x69\x4d" "\xa6\x0f\x95\x88\x5d\x11\x71\x2a\x89\x98\x68\xd9\x37\x1e\x8d\x9d\x93\xcd" "\xe3\x6e\xff\x71\xed\x74\xba\x25\x51\xaf\xbf\xf5\x7b\x12\x49\xb3\x2c\x3f" "\xfe\x4e\xf3\xeb\xf6\xf4\x21\x89\x18\x8d\x88\xef\x8f\x46\x3c\x5e\xbd\xbf" "\xde\xa5\x2b\x57\xcf\xce\xd6\xea\x0d\x1f\x46\xec\x5f\x3e\x77\x71\xff\xd2" "\x95\xab\xfb\x16\xcf\xcd\x9e\x99\x3f\x33\x7f\x7e\xe6\xc0\xcb\x07\x0f\x4d" "\xbf\x32\x73\x70\x66\x43\xe2\xcc\xe3\x3a\x76\xfc\xcd\x67\x3e\xfd\xe8\xbd" "\x97\x16\x7e\xa8\xed\x4b\xe2\x70\x9c\x1c\xfe\x60\x2e\x56\xc5\xb1\x51\x26" "\x63\x32\xee\x34\x43\x6c\x2d\x1f\x8a\x88\x43\x69\xa2\xcd\xcf\x65\xab\xc9" "\x43\x48\x0a\x6e\x07\xeb\x53\x6d\xfe\x3e\x0e\x47\xc4\x93\x31\x11\xd5\x2c" "\xd7\x30\x11\x8b\x9f\x14\xda\x38\xa0\xaf\xea\xd5\x88\x3a\x50\x52\x89\xfe" "\x0f\x25\x95\x8f\x03\xf2\xb9\x7d\x3f\xe6\xc1\x83\xec\xd6\x91\xc6\x04\xe8" "\xfe\xf8\x87\x1a\xf7\x46\x62\x34\x9b\x1b\x6d\xbb\x9d\xb4\xcc\x8c\x1a\xf3" "\xdd\x1d\x1b\x50\x7f\x5a\xc7\xbf\xd7\x76\x7f\x95\x6e\xd1\xa7\xfb\x10\xdd" "\xac\x5c\x8f\x88\xa7\xda\xc5\x9f\x64\x6d\xdb\x91\xdd\xc5\x49\xe3\xaf\x44" "\xa5\xe5\x79\x69\x7a\x3a\x22\x46\x9a\xf3\xc7\xd7\xd6\x59\x7f\xe3\x67\x1c" "\x97\xff\x6c\xe6\x07\x39\xfe\xd6\xf3\x9f\xc6\x7f\xb8\xf9\x35\x2d\x3f\xba" "\xce\xfa\x27\x57\xe5\xcb\xd6\xff\x00\x28\xc6\xcd\x23\x11\xd9\x28\x70\x25" "\xcd\xdd\xbb\xfe\xa5\x65\xf9\xf8\x27\xda\x8c\x7f\xc6\xdb\x5c\xbb\xd6\xa3" "\xe8\xeb\x5f\xe7\xf1\x5f\x7e\xbd\x1f\xcd\xee\x91\xb7\x1b\xff\x9d\x68\xff" "\x2d\x87\x57\x17\xfc\xf2\xf1\xb1\x2f\x3a\xd5\xdf\x3a\xfe\x4b\xb7\xb4\xfe" "\x7c\x2c\xb8\x19\x6e\x5d\x8f\xd8\xbd\x3a\xfe\xec\x94\x27\x77\xcf\x7f\xd2" "\x26\xfe\x74\xdc\x73\xaa\xc7\x3a\x5e\xff\xf1\xb7\x63\x9d\xf6\xfd\x3f\xfe" "\x6a\xf6\x3b\xb8\x99\xf1\xd7\x6f\x44\xec\x69\x3b\xff\xb9\xf7\x8e\x56\x9a" "\xea\xf2\xfe\xe4\xfe\x85\xc5\xda\xfc\x74\xe3\xb1\x6d\x1d\xdf\x7e\xf7\xee" "\xd7\x9d\xea\x1f\x84\xf3\xbf\xad\x43\xfc\xdd\xce\x7f\x5a\x76\xb1\xc7\x3a" "\xbe\x39\x71\xe3\x5c\xa7\x7d\x6b\xc7\x5f\xf9\x75\x24\x39\x99\xa5\x46\x9a" "\x25\xef\xcf\x2e\x2f\x5f\x9a\x89\x18\x49\x8e\x37\x0f\x69\x29\x3f\xd0\xbd" "\x2d\xf9\x31\xf9\xf7\x48\xe3\xdf\xfb\x7c\xfb\xfe\xdf\x2d\xfe\xb1\xfc\x25" "\xb3\x07\x17\xdf\x3e\x7b\x7b\xfd\xf1\x77\x75\xa7\xde\xe3\x81\x9d\xa4\xf1" "\xcf\xad\xf3\xfc\x7f\xde\x63\x1d\x7f\xbf\x73\xf9\xd9\x4e\xfb\xba\xc5\x3f" "\xf6\x20\x81\x01\x00\x00\x00\x00\x00\x40\x09\x55\xb2\xcf\x72\x24\x95\xa9" "\xbb\xe9\x4a\x65\x6a\xaa\xb1\x86\xf7\x89\xd8\x56\xa9\x5d\x58\x5a\x7e\x61" "\xe1\xc2\xe5\xf3\x73\x11\x7b\xb3\xcf\x43\x0e\x57\xf2\x77\xba\x27\x1a\xf9" "\x24\xcd\xcf\x34\x3f\x0f\x9b\xe7\x0f\xac\xca\xbf\x18\x11\x3b\x23\xe2\xcb" "\xea\x58\x96\x9f\x3a\x7d\xa1\x36\x57\x74\xf0\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x30\x20\xb6\xaf\x5a\xff\xff\x57\xb5\xb1" "\xfe\x1f\x28\x89\xa1\xa2\x1b\x00\x14\x46\xff\x87\xf2\xca\xfa\x7f\xa5\xe8" "\x56\x00\x45\x70\xfd\x87\xf2\xd2\xff\xa1\xbc\x7a\xec\xff\x6f\xf4\xbb\x1d" "\xc0\xe6\x73\xfd\x87\xf2\xd2\xff\xa1\xbc\x86\xbc\x04\x40\x69\xe9\xfc\x50" "\x5e\xfa\x3f\x00\x00\x00\x00\x3c\x94\x76\x3e\x77\xf3\xe7\x24\x22\x56\x5e" "\x1d\xcb\xb6\xd4\x48\x73\xdf\xf0\x9a\xcf\x76\xe3\x10\xb6\xb2\xb5\xfb\x38" "\xf0\xb0\xaa\x16\xdd\x00\xa0\x30\x77\x47\xf0\x96\xff\x43\xe9\xf4\x34\xfe" "\xff\xa7\xde\xd0\xff\xe6\x00\x05\x48\xda\x15\x66\x83\x83\x7a\xf7\xce\x7f" "\xb3\xed\x33\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x3e\xd8\xb3\xeb" "\x41\xd6\xff\x03\x5b\x99\x65\x7f\x50\x5e\x0f\xb0\xfe\xbf\xfa\xf4\x46\x36" "\x04\xd8\x74\xfe\x82\x17\x94\x97\x39\x3e\xf0\xd9\x1a\x13\x81\xd1\x4e\x3b" "\xac\xff\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x4d\x33\x9e\x6d\x49" "\x65\xaa\xb9\x16\x78\x3c\x2a\x95\xa9\xa9\x88\x47\x23\x62\x47\x0c\x27\x0b" "\x8b\xb5\xf9\xe9\x88\x78\x2c\x22\x7e\xaa\x0e\x3f\x92\xe6\x67\x8a\x6e\x34" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3c\x64\x96" "\xae\x5c\x3d\x3b\x5b\xab\xcd\x5f\x2a\x73\x22\xff\x2f\xa8\x83\xd2\x9e\xd6" "\x44\x24\x9b\x5f\xe9\x58\x44\x0c\x42\xec\xfd\x49\x0c\xb5\x94\x24\x11\x2b" "\xe9\x99\x1f\x88\x86\x5d\x5a\x8a\xc1\x68\x46\x96\x28\xf8\x85\x09\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x4a\xa8\x65\xed\x31\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x94\xd6\xbd\xff\xff\xdf" "\xbf\x44\xd1\x31\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x5b\xd3\x7f\x01\x00\x00\xff\xff\x5c" "\x11\x35\xf3", 1497); syz_mount_image(/*fs=*/0x20000140, /*dir=*/0x200005c0, /*flags=MS_REC*/ 0x4000, /*opts=*/0x20000280, /*chdir=*/0x80, /*size=*/0x5db, /*img=*/0x200011c0); memcpy((void*)0x200000c0, "ext4\000", 5); memcpy((void*)0x20000040, "./file1\000", 8); *(uint8_t*)0x20000000 = 0; memcpy( (void*)0x20001c40, "\x78\x9c\xec\xdd\x5f\x6b\x63\x69\x19\x00\xf0\xe7\x9c\x36\xdd\x76\xa6\x6b" "\xba\x2a\xb2\x2e\xb8\x2e\xee\x4a\x67\xd1\x49\xa6\x5b\x77\xb7\x88\xe8\x7a" "\xa3\x57\x0b\xea\x7a\x5f\x6b\x9b\x96\xd2\xa4\x29\x4d\xba\x4e\xcb\xe2\x74" "\xf0\x1b\x88\xe0\x80\x57\x5e\x88\x37\x82\x1f\x40\x18\xe6\xc2\x0f\x20\x03" "\x03\x7a\x23\x5e\x88\x8a\x22\x3a\xa3\x17\x82\x3a\x47\x92\x9c\x30\x9d\x34" "\x69\xcb\x4c\xdb\x8c\xcd\xef\x07\xa7\x79\xdf\xf3\xef\x79\xde\x13\xf2\xe6" "\x9c\x93\xd3\x73\x02\x18\x59\xaf\x44\xc4\x3b\x11\x31\x16\x11\xaf\x47\x44" "\x31\x1f\x9f\xe6\xc3\x62\xab\xb2\xdf\x99\xef\xc1\xfd\x0f\x96\x5b\x43\x12" "\x59\xf6\xde\xdf\x92\x48\xf2\x71\xdd\x75\xb5\xea\xe3\x11\x71\xb9\xb3\x48" "\x4c\x46\xc4\x37\xbe\x1a\xf1\xed\xe4\x70\xdc\xc6\xee\xde\xc6\x52\xb5\x5a" "\xd9\x8e\x98\x6a\x2d\x59\x6e\xd6\xb6\xca\x8d\xdd\xbd\xab\xeb\xb5\xa5\xb5" "\xca\x5a\x65\x73\x7e\x7e\xee\xad\x85\xb7\x17\xde\x5c\xb8\x96\xe5\x9e\xaa" "\x9d\x33\xdd\xc2\x4f\xbf\xf2\xc5\xdb\x9f\xfd\xce\xef\x17\xff\x72\xe5\xbb" "\xad\xb4\xbe\xf0\xb1\x28\x44\x4f\x3b\x4e\x53\xa7\xe9\x85\xf6\xb6\xe8\x6a" "\x6d\xa3\xed\xb3\x08\x36\x04\x63\x79\x7b\x0a\xc3\x4e\x04\x00\x80\x13\x69" "\xed\xe3\x7f\x38\x22\x3e\xd5\xde\xff\x2f\xc6\x58\x7b\x6f\xae\xc7\xd8\x30" "\x32\x03\x00\x00\x00\x4e\x4b\xf6\xa5\xe9\xf8\x4f\x12\x91\x01\x00\x00\x00" "\x17\x56\x1a\x11\xd3\x91\xa4\xa5\xfc\x5a\x80\xe9\x48\xd3\x89\xfc\xdc\xc0" "\x47\xe3\x52\x5a\xad\x37\x9a\x9f\x59\xad\xef\x6c\xae\xb4\xa6\x45\xcc\x44" "\x21\x5d\x5d\xaf\x76\x17\x6f\xd5\x93\xd5\xf5\x6a\x65\x2e\xbf\xc6\xb6\x5b" "\x7f\xa3\xa7\x3e\x1f\x11\x2f\x44\xc4\x0f\x8a\x53\xed\x7a\x69\xb9\x5e\x5d" "\x19\xf2\xb9\x0f\x00\x00\x00\x18\x15\x97\x7b\x8e\xff\xff\x59\x4c\xdb\xe5" "\xe3\xf5\xf9\x3f\x01\x00\x00\x00\xe0\xd9\x35\x33\xb0\x02\x00\x00\x00\x5c" "\x14\x0e\xf9\x01\x00\x00\xe0\xe2\xeb\x3d\xfe\xbf\x3d\xa4\x3c\x00\x00\x00" "\x80\x33\xf1\xb5\x77\xdf\x6d\x0d\x59\xf7\xf9\xd7\x2b\xef\xef\xee\x6c\xd4" "\xdf\xbf\xba\x52\x69\x6c\x94\x6a\x3b\xcb\xa5\xe5\xfa\xf6\x56\x69\xad\x5e" "\x5f\x6b\xdf\xb3\xaf\x76\xdc\xfa\xaa\xf5\xfa\xd6\xe7\x62\x73\xe7\x7a\xb9" "\x59\x69\x34\xcb\x8d\xdd\xbd\xc5\x5a\x7d\x67\xb3\xb9\xb8\xfe\xd8\x23\xb0" "\x01\x00\x00\x80\x73\xf4\xc2\x27\xef\xfc\x26\x89\x88\xfd\xcf\x4f\xb5\x87" "\xc8\xef\x03\x08\xf0\x98\x3f\x0e\x3b\x01\xe0\x34\x8d\x0d\x3b\x01\x60\x68" "\xdc\xc5\x1b\x46\x57\x61\xd8\x09\x00\x43\x97\x1c\x33\xdd\xc5\x3b\x00\x00" "\xf0\xff\x6f\xf6\xe3\x87\x7f\xff\xef\x3e\xff\xdf\xb9\x01\xb8\xd8\x5c\xeb" "\x03\x00\xa3\xc7\xef\xff\x30\xba\x0a\xae\x00\x84\x91\x96\x46\xc4\x87\x3a" "\xc5\xe7\x06\xcd\x33\xf0\xf7\xff\x5f\x9d\x34\x4a\x96\x45\xdc\x2d\x1e\x1c" "\xe3\xfc\x22\x00\x00\x9c\xaf\xe9\xf6\x90\xa4\xa5\xfc\x38\x60\x3a\xd2\xb4" "\x54\x8a\x78\x3e\x22\x9d\x89\x42\xb2\xba\x5e\xad\x5c\xcb\x8f\x0f\x7e\x5d" "\x2c\x3c\xd7\xaa\xcf\xb5\x97\x4c\x8e\xbd\x66\x18\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe8\xc8\xb2\x24\x32" "\x00\x00\x00\xe0\x42\x8b\x48\xff\x9c\xb4\xef\xe6\x1f\x31\x5b\x7c\x6d\xba" "\xf7\xfc\xc0\x44\xf2\xaf\x62\xfc\x29\xaf\xfc\xe8\xbd\x1f\x5e\x5f\x6a\x36" "\xb7\xe7\x5a\xe3\xff\xde\x7e\x96\xd7\x44\x44\x34\x6f\xe5\xe3\xdf\x18\xf8" "\xf8\x30\x00\x00\x00\xe0\xb4\x25\xfb\x03\x27\x75\x8e\xd3\xf3\xd7\xb9\x73" "\xcd\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\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x80\x11\xf0\xe0\xfe\x07\xcb\xdd\xe1\x3c\xe3\xfe\xf5\xcb\x11\x31" "\xd3\x2f\xfe\x78\x4c\xb6\x5f\x27\xa3\x10\x11\x97\xfe\x91\xc4\xf8\x81\xe5" "\x92\x88\x18\x3b\x85\xf8\xfb\x37\x23\xe2\xc5\x7e\xf1\x93\x78\x98\x65\x37" "\x22\xcf\xa2\x5f\xfc\xa9\x33\x8e\x3f\xd3\xde\x34\xfd\xe3\xa7\x11\x71\xf9" "\x14\xe2\xc3\x28\xbb\xd3\xea\x7f\xde\xe9\xf7\xf9\x4b\xe3\x95\xf6\x6b\xff" "\xcf\xdf\x78\x3e\x3c\xad\xc1\xfd\x5f\x9a\x47\x7e\xb1\xdd\xcf\xf5\xeb\x7f" "\x9e\x3f\xb4\xb6\x5a\xdf\x18\x2f\xdd\xfb\x79\x79\x60\xfc\x9b\x11\x2f\x8d" "\xf7\xef\x7f\xba\xfd\x6f\x32\x20\xfe\xab\x87\xd6\xf6\xef\x2c\xcb\x0e\xc7" "\xf8\xd6\x37\xf7\xf6\x06\xc5\xcf\x7e\x1c\x31\xdb\xf7\xfb\x27\x79\x2c\x56" "\xb9\x59\xdb\x2a\x37\x76\xf7\xae\xae\xd7\x96\xd6\x2a\x6b\x95\xcd\xf9\xf9" "\xb9\xb7\x16\xde\x5e\x78\x73\xe1\x5a\x79\x75\xbd\x5a\xc9\xff\xf6\x8d\xf1" "\xfd\x4f\xfc\xe2\xe1\x51\xed\xbf\xd4\x27\xfe\xef\x7e\xdb\xe9\x7f\x8f\x6a" "\xff\x6b\x83\x56\xda\xe3\xbf\xf7\xae\xdf\xff\x48\xa7\x58\xe8\x17\xff\xca" "\xab\x7d\xbf\x7f\x27\x63\x40\xfc\x34\xff\xee\xfb\x74\x5e\x6e\x4d\x9f\xed" "\x96\xf7\x3b\xe5\x83\x5e\xfe\xd9\xdd\x97\x8f\x6a\xff\xca\x80\xed\x7f\xdc" "\xfb\x7f\xe5\x84\xed\x7f\xfd\xeb\xdf\xfb\xc3\x09\x67\x05\x00\xce\x41\x63" "\x77\x6f\x63\xa9\x5a\xad\x6c\x1f\x51\x98\x3c\xc1\x3c\x67\x5a\x98\x3f\x9b" "\x35\xff\x72\x72\xc8\xed\x7a\xa2\x42\x76\xa3\xf3\xce\x3d\x2b\xf9\x3c\x69" "\xa1\xb5\xb7\xfa\x68\x4c\xb7\x55\xcf\x40\x62\x07\x0a\xd9\xb9\xc5\x1a\x8b" "\x93\xce\x3c\x31\x70\xd2\x4f\x6e\x9d\x66\x62\x43\xed\x96\x00\x00\x80\x33" "\xf0\x68\xa7\x7f\xd8\x99\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\xc0\xe8\x3a\x8f\xdb\x9b\xf5\xc6\xdc\x1f\x4e\x53\x01\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x8e\xf4\xbf\x00\x00\x00\xff\xff\xd8\x63\xe6\x5f", 1310); syz_mount_image(/*fs=*/0x200000c0, /*dir=*/0x20000040, /*flags=MS_LAZYTIME|MS_SYNCHRONOUS|MS_STRICTATIME*/ 0x3000010, /*opts=*/0x20000000, /*chdir=*/1, /*size=*/0x51e, /*img=*/0x20001c40); } int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x20000000ul, /*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=*/0x21000000ul, /*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; }