// https://syzkaller.appspot.com/bug?id=ef01f350186f2234aaa4e9f787f66978c5142652 // 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"); } 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; retry: const int umount_flags = MNT_FORCE | UMOUNT_NOFOLLOW; 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 (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); 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)) { } memcpy((void*)0x20000140, "nilfs2\000", 7); memcpy((void*)0x20000000, "./file0\000", 8); *(uint64_t*)0x20000540 = 0; sprintf((char*)0x20000548, "%020llu", (long long)-1); *(uint16_t*)0x2000055c = -1; sprintf((char*)0x2000055e, "0x%016llx", (long long)-1); *(uint32_t*)0x20000570 = -1; *(uint16_t*)0x20000574 = -1; *(uint64_t*)0x20000576 = -1; sprintf((char*)0x2000057e, "%023llo", (long long)-1); memcpy( (void*)0x20000595, "\xa3\x51\x62\x9a\x0e\xc9\xe3\x78\x2f\xfe\xc3\x40\xfa\x6a\x5a\x82\xa5\x65" "\x46\x5a\x00\xfd\x03\x1c\x05\xeb\x8e\x4d\x01\x1b\x0d\x9b\x07\x87\x15\x62" "\x75\xa5\x9d\xdb\x68\xa2\xd6\x6b\x58\x02\x24\xdb\x7a\xa8\x06\xff\x05\x87" "\x79\x6b\x8b\xb5\x0e\xe6\x98\x69\xd0\x6f\x54\x9c\x4a\xca\xe5\x1b\x91\x6d" "\x5d\x69\x9e\xd3\x03\xfc\x53\x6f\xd9\x29\xcd\xe3\xc4\x7f\x80\xb1\x8d\xae" "\x1b\x50\xb5\x9f\xb9\x41\xa2\x33\x61\x5b\x2e\xc3\x7a\xc7\x57\x74\xbb\x27" "\x6a\xf0\x48\x3e\x65\x85\xe8\xd9\xff\x42\x17\x39\x5e\x46\xaf\x33\x34\x3c" "\x64\xb3\x49\x0c\x72\xee\xd7\x4d\xab\xd5\x82\x35\xeb\xe5\x48\x94\xb2\xb2" "\x82\x8a\xdd\x6e\xa9\xfa\xb4\xb1\x3d\x6b", 154); *(uint64_t*)0x2000062f = 0; sprintf((char*)0x20000637, "%023llo", (long long)-1); memcpy( (void*)0x200042c0, "\x78\x9c\xec\xdd\x4d\x8c\x1b\x57\x1d\x00\xf0\xf1\xee\x7a\x93\x6d\x53\xe2" "\x94\x84\x86\xb4\xb4\x09\x85\xb6\x02\xba\xdb\xec\x86\xf0\x11\x41\x53\x35" "\x17\xa2\x06\x71\xab\x54\x71\x89\xd2\xb4\x44\xa4\x01\x91\x4a\xd0\xaa\x12" "\x49\x4e\xdc\x68\x15\x85\x1b\xe2\x43\x9c\x7a\xa9\x00\x21\xd1\x0b\x8a\x7a" "\xe2\x52\x89\x46\xe2\xd2\x53\xe1\xc0\x81\x28\x48\x95\x38\x40\x4b\x62\xb4" "\xde\xf7\xbc\xf6\x3f\x76\xc7\xde\xaf\x59\xaf\x7f\x3f\x69\xfc\x3c\xf3\xde" "\xcc\x7b\x33\x9e\x19\xcf\xe7\x7b\x05\x30\xb6\x26\x5a\x9f\xf5\xd6\xe7\x95" "\x37\x2f\x1f\xfb\xe7\x43\xff\x98\x59\xfc\xfe\x78\x3b\x45\xa3\xf5\x39\xd5" "\xd1\xb7\x98\xba\x96\xfa\xa7\xc2\xf4\xde\x9b\x5c\x0a\x6f\xbe\xff\xca\xa9" "\x5e\x61\xad\x98\x6f\x7d\xe6\xfe\xc9\x8e\x71\xef\x2c\x8a\xe2\x42\xb1\xbf" "\xb8\x5a\x34\x8a\x7d\x57\xae\xbd\xf6\xf6\xfc\x53\x27\x2e\x1e\xbf\x74\xe0" "\x9d\xd7\x8f\x5c\x5f\x87\x59\x07\x00\x80\xb1\xf3\xad\xab\x47\x0e\xed\xf9" "\xdb\x5f\xee\xdd\xf5\xc1\x1b\xf7\x1f\x2d\xb6\xb5\x87\xe7\xe3\xf3\x46\xea" "\xdf\x91\x8e\xfb\x8f\xa6\x03\xff\xc5\x60\xaa\x96\xcf\x1f\x96\xcf\x07\x6a" "\x1d\x5d\xa7\xe9\x90\x6e\x2a\x75\x13\x21\xdd\x64\x8f\x74\x45\x47\xba\x7a" "\x4e\xb7\xbd\x7b\xbc\x98\xff\x74\x98\x6e\xbd\x4f\xba\x6d\x25\xf9\x4f\x86" "\x73\x94\x5a\x28\x0f\x8c\xb2\xbc\x1e\x37\x8a\xda\xc4\x6c\x57\xff\xc4\xc4" "\xec\xec\xd2\x39\x79\xd1\x3a\xaf\x9f\xae\xcd\x9e\x3b\x73\xf6\xb9\xf3\x15" "\x15\x14\x58\x73\xff\x7e\xa0\x28\x8a\xfd\x3a\xdd\xb8\x75\xcd\x9d\xed\x8d" "\xa0\xf2\xb2\x54\xd7\x75\x2c\x05\x80\x4a\xc5\xfb\x85\xb7\xb9\x10\xaf\x2c" "\xac\x4e\x7b\x6a\x53\x83\xe5\x7f\xe3\x89\x89\xde\xe3\x77\xab\xaf\x65\x19" "\x19\x1f\x1b\xbd\xfe\xcb\x3f\x4e\xbf\xbb\x1c\x1b\x9d\x7f\xd9\xfc\xff\xe6" "\xe2\x3a\xcf\x3f\x63\x65\xf0\xb5\x69\xfb\xba\x96\x63\xad\xe5\xf9\xca\xdb" "\xd1\x8e\xd4\x1f\xef\x23\xc4\xe7\x97\x86\xdd\xff\xe4\xe9\x4d\x86\xe9\x0d" "\x7a\x00\xd0\xef\x3e\xc2\xa8\xdc\x5f\xe8\x57\xce\xc9\x0d\x2e\xc7\x4a\xf5" "\x2b\x7f\x5c\x2f\xb6\xaa\xaf\xa5\x30\x2f\x87\xaf\x87\xf8\xce\xed\x27\xfe" "\xa6\xa3\xf2\x1b\x03\xbd\xfd\x67\xad\xaf\xff\xe7\xbf\xc7\x15\x4f\x63\x66" "\xb9\x70\x9b\xe0\xfa\xa8\x4e\xb7\x95\xbb\x66\x55\x3b\x1e\xa0\x7a\x25\xa7" "\xf5\xf1\xb9\xb9\x66\x92\xe3\xe3\x73\x7d\x31\x7e\x5b\x49\xfc\xf6\x92\xf8" "\x99\x92\xf8\x3b\x4a\xe2\xef\x2c\x89\x87\x71\xf6\xfb\x17\x7f\x5a\xbc\x5a" "\x2b\x7a\xbe\x8f\x57\x2c\x9d\xff\xb7\x36\x96\x41\xaf\x87\xe5\xeb\x6c\x77" "\xa5\xf0\x63\x43\x96\x27\x5e\x8f\x1c\xf6\x7a\x5c\x7c\xee\x77\x58\xab\xcd" "\x3f\x3e\x4f\x0c\x9b\xd9\x1f\x4f\x3e\x7d\xfa\xcb\xcf\x3e\x73\x6d\xe9\xf9" "\xff\x5a\x7b\xfd\xbf\x95\xd6\xf7\xfd\xa9\xbf\x91\xb6\xad\xab\x29\x41\xbe" "\x5e\x18\xaf\xab\xb7\x9f\xfd\x6f\x74\xe7\x33\xd1\x27\xdd\xdd\xa1\x3c\x77" "\xf5\x48\xdf\xfa\xbe\xbb\x3b\x5d\x6d\xf7\xf2\x74\x8a\x8e\xfd\xcc\x6d\xe5" "\xd8\xdb\x3d\xde\xce\x7e\xe9\xee\xeb\x4e\xd7\x08\xe9\x66\x52\x17\x0f\x97" "\xe2\xf1\xc9\x1d\x61\xbc\x7c\xfc\x91\xf7\xab\x79\x79\x4d\x85\xf9\xad\x87" "\xf9\x98\x0e\xe5\xc8\xfb\x95\x5d\x29\x1c\xad\xbb\x31\x6c\x56\x79\x7d\xec" "\xf7\xfc\x7f\x5e\x3f\xf7\x16\xf5\xda\x73\x67\xce\x9e\x7e\x2c\xf5\xe7\xf5" "\xf4\xcf\x93\xf5\x6d\x8b\xc3\x0f\x6e\x70\xb9\x81\xd5\x1b\xf4\xfd\x9f\xbd" "\x45\xf7\xfb\x3f\x3b\xda\xc3\xeb\x13\x9d\xfb\x85\x9d\xcb\xc3\x6b\x9d\xfb" "\x85\x46\x18\x3e\xdf\x67\xf8\x42\xea\xcf\xff\x73\xdf\x99\x9c\x69\x0d\x9f" "\x3d\xf5\xbd\xb3\xcf\xae\xf5\xcc\xc3\x98\x3b\xff\xd2\xcb\xdf\x3d\x79\xf6" "\xec\xe9\x1f\xf8\xe2\x8b\x2f\xbe\xb4\xbf\x54\xbd\x67\x02\xd6\xdb\xdc\x8b" "\x2f\x7c\x7f\xee\xfc\x4b\x2f\x3f\x7a\xe6\x85\x93\xcf\x9f\x7e\xfe\xf4\xb9" "\x85\xc3\x87\x17\xe6\xe7\x0f\x7f\x65\xe1\xd0\x5c\xeb\xb8\x7e\xae\xf3\xe8" "\x1e\xd8\x4a\x96\xff\xf4\xab\x2e\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x30\xa8\x1f\x1e\x3f\x76\xed\xaf\x6f\x7d\xe9\xdd\xa5\xf7\xff\x97\xdf\xff" "\xcb\xef\xff\xe7\x27\x7f\xf3\xfb\xff\x3f\x09\xef\xff\xc7\xf7\xe4\xf3\x7b" "\xf0\xf9\x3d\xc0\x5d\x3d\xe2\x5b\x69\x42\x05\xab\xd3\x21\x5d\x3d\x75\x1f" "\x0f\xe5\xdd\x1d\xf2\xd9\x13\xc6\xfb\x44\x0a\xdb\xed\xf8\xa5\xf7\xff\x73" "\x76\xb1\x5e\xd7\x5c\x9e\x7b\xc2\xf0\x58\x7f\x6f\x4e\x17\xaa\x13\xb8\xad" "\xbe\x94\xe9\x50\x07\x49\x6c\x2f\xf0\xd3\x29\xbc\x94\xc2\x5f\x17\x50\xa1" "\xda\xcf\x7b\x0f\x4e\x61\x59\xfd\xd6\x79\x5d\xcf\xf5\x53\xa8\x97\x62\x34" "\xe5\xdf\x2d\xd7\x67\x92\xeb\x31\xc9\xef\x7f\xf7\xab\xd7\x29\xef\xff\x77" "\xf5\x9e\xec\x8f\xd7\xba\x9c\xac\xad\x8d\x78\x9d\xb0\xea\x79\x04\x7a\xfb" "\xd7\x78\xb4\xff\xb9\x5c\xe1\x67\xe5\x65\xe9\x38\x63\x18\x66\xbc\xa3\x6b" "\x58\x86\x89\xcd\xb2\x2c\x74\xb1\xbb\xd9\x6c\x36\x37\x32\xbf\x66\xf3\xa3" "\x5a\xf1\xd0\xd6\x14\xb0\x71\xaa\x6e\xff\x33\x5f\xf7\xcc\xe1\xb9\x3f\x7d" "\x63\xfb\x62\x97\x93\xdd\x78\xa2\x7b\x7f\x19\xeb\x2f\x85\xd5\xa8\xba\xfd" "\xcb\xca\xf2\xcf\x17\x16\x47\x65\xfe\x67\xaa\xc9\x7f\xad\xdb\xff\x6c\xb7" "\x7f\x37\xb5\xf4\xbd\x7c\xff\x17\x5a\xcc\x6b\xac\x2c\xdf\xff\xfe\xe2\xfa" "\xbb\x45\xc7\xcf\xbe\xaf\xef\xfe\x77\x5b\xd1\x95\x7f\x9c\xff\x5c\x0f\xf4" "\xee\xe1\xf2\xff\x20\xe5\x9f\xe7\xe6\xe1\xa2\x5f\xfe\xdd\xf3\xdf\xfc\x55" "\xc8\x3f\xde\x10\x1a\xd0\x87\x21\xff\x3b\x06\xcc\x3f\xce\xff\xe5\x61\x33" "\x4e\x19\xfe\x2f\xe5\x9f\x17\xdb\x23\x0f\x0e\x9a\xff\xd2\x04\x6a\x13\xdd" "\xe5\x88\xd7\x8d\xf3\xfd\xbf\x78\xdd\x38\xbb\x19\xe6\x3f\xd7\xed\x39\xec" "\xfc\xaf\xb4\xa1\xc6\x5b\x29\x7f\x18\x67\xa3\xd2\xce\xec\xb0\xba\xda\xff" "\xbd\xd8\xdc\xf8\xf6\x7f\x57\xd9\xc2\x50\x7c\x0e\xe3\x8b\xa9\x3f\xef\x08" "\xf3\x73\x0e\xb1\xbd\x93\x61\xcb\x9f\x9f\xaf\xc8\xff\x03\x7b\xc2\xf4\x6b" "\x25\xff\x6f\x5b\xbf\xfd\xdf\xad\xba\x85\x2c\xf9\x6a\x0a\xcb\xb6\x87\xdc" "\xfe\x6f\x5e\x1f\x1b\x3d\xfa\x3b\x8f\x1f\xeb\x3d\x96\xdc\xd6\x5e\x92\x30" "\x7a\xde\x5b\xb3\xfb\x7f\x1d\x4f\xcc\x6d\x82\xfb\x28\xba\xf1\xe9\x6a\xd6" "\xb9\x15\x77\xcd\x66\xb3\xd2\x9b\x7c\xee\x30\x56\xab\xea\xe5\x5f\xf5\x79" "\x42\xd5\xf9\x57\xbd\xfc\x3f\x42\xd7\xa9\x65\x7c\x1e\x38\x26\xea\x17\x1f" "\xdb\xff\x8d\xf1\xb1\xfd\xdf\x18\xdf\xba\xae\xf8\xe1\x72\xa3\xbd\x71\x79" "\xc5\xf6\x7f\x63\x7c\x6c\xff\x37\xc6\xdf\x13\xf2\x8d\xed\x03\xef\x2d\x89" "\xff\x64\x49\xfc\xbe\x92\xf8\x7b\x4b\xe2\xef\x2b\x89\xff\x54\x49\xfc\x81" "\x92\xf8\xfb\x4b\xe2\x1f\x28\x89\xbf\xbb\x24\xfe\xc1\x92\xf8\xcf\x84\x5f" "\x3c\xc6\x7f\xb6\x64\xfc\x87\x4a\xe2\x1f\x49\xe1\x4c\xef\xf8\x85\x1f\x95" "\x8c\xbf\xd5\xe5\xf7\x51\xc6\x75\xfe\x61\x9c\xc5\xf7\xf3\x6c\xff\x30\x3e" "\xf2\xfd\x9f\x7e\xdb\xff\xee\x92\x78\x60\x74\xfd\xec\x8d\x83\x4f\x3e\xf3" "\xbb\x6f\x37\x96\xde\xff\x9f\x6e\x5f\x0f\xc9\xf7\xf1\x8e\xa6\xfe\x7a\x3a" "\x77\x8e\xe7\x4b\xf1\xfa\xc9\x64\x8a\x7b\x2b\xf5\xff\x3d\xc4\x6f\xe2\xeb" "\x1d\x30\x76\x62\xfd\x19\xf1\xff\xfd\xe1\x92\x78\x60\x74\xe5\xe7\xbc\x6c" "\xdf\x30\x86\x6a\xbd\x6b\xec\x19\xb4\xde\xaa\x7e\xc7\xf9\x8c\x96\xcf\xa5" "\xf0\xf3\x29\xfc\x42\x0a\x1f\x4d\xe1\x6c\x0a\xe7\x52\x78\x30\x85\xf3\x1b" "\x54\x3e\xd6\xc7\x93\xbf\xfd\xc3\x91\x57\x6b\xcb\xe7\xfb\x3b\x43\xfc\xa0" "\xcf\x93\xc7\xf7\x81\x62\x3d\x51\x0b\x03\x96\x27\x5e\x1f\x18\xf6\x79\xf6" "\x58\x8f\xdf\xb0\x56\x9b\xff\x0a\x5f\x07\x03\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa8\xcc" "\x44\xeb\xf3\xd0\xa1\xbd\xb5\xa2\xb8\xf2\xe6\xe5\x63\x4f\x9f\x38\x33\xb7" "\x38\xe4\xf1\x76\x8a\x46\xeb\x73\xaa\xa3\xaf\xde\x1e\xaf\x28\x1e\x4b\xe1" "\x64\x0a\x7f\x99\xbe\xdc\x7c\xff\x95\x53\x9d\xe1\xad\x14\xd6\x8a\xf9\xa2" "\x56\xd4\xda\xc3\x8b\x6f\xde\x68\xe7\x74\x67\x51\x14\x17\x8a\xfd\xc5\xd5" "\xa2\x51\xec\xbb\x72\xed\xb5\xb7\xe7\x9f\x3a\x71\xf1\xf8\xa5\x03\xef\xbc" "\x7e\xe4\xfa\xfa\x2d\x01\x00\x00\x00\xd8\xfa\xfe\x1f\x00\x00\xff\xff\x2a" "\xa9\x1b\xe2", 2703); syz_mount_image( /*fs=*/0x20000140, /*dir=*/0x20000000, /*flags=MS_POSIXACL|MS_NOEXEC|MS_NODIRATIME|MS_NODEV*/ 0x1080c, /*opts=*/0x20000540, /*chdir=*/1, /*size=*/0xa8f, /*img=*/0x200042c0); memcpy((void*)0x20000080, "./file0\000", 8); memcpy((void*)0x200000c0, "ramfs\000", 6); syscall(__NR_mount, /*src=*/0ul, /*dst=*/0x20000080ul, /*type=*/0x200000c0ul, /*flags=*/0ul, /*data=*/0ul); memcpy((void*)0x20000140, "./file0\000", 8); res = syscall(__NR_open, /*file=*/0x20000140ul, /*flags=*/0ul, /*mode=*/0ul); if (res != -1) r[0] = res; syscall(__NR_fchdir, /*fd=*/r[0]); memcpy((void*)0x20000040, "./file0\000", 8); syscall(__NR_mkdir, /*path=*/0x20000040ul, /*mode=*/0ul); memcpy((void*)0x20000400, "./file1\000", 8); syscall(__NR_mkdirat, /*fd=*/0xffffff9c, /*path=*/0x20000400ul, /*mode=*/0ul); memcpy((void*)0x200000c0, "./bus\000", 6); syscall(__NR_mkdirat, /*fd=*/0xffffff9c, /*path=*/0x200000c0ul, /*mode=*/0ul); memcpy((void*)0x200000c0, "./bus\000", 6); memcpy((void*)0x20000080, "overlay\000", 8); memcpy((void*)0x20000500, "workdir", 7); *(uint8_t*)0x20000507 = 0x3d; memcpy((void*)0x20000508, "./bus", 5); *(uint8_t*)0x2000050d = 0x2c; memcpy((void*)0x2000050e, "lowerdir", 8); *(uint8_t*)0x20000516 = 0x3d; memcpy((void*)0x20000517, "./file0", 7); *(uint8_t*)0x2000051e = 0x2c; memcpy((void*)0x2000051f, "upperdir", 8); *(uint8_t*)0x20000527 = 0x3d; memcpy((void*)0x20000528, "./file1", 7); *(uint8_t*)0x2000052f = 0x2c; *(uint8_t*)0x20000530 = 0; syscall(__NR_mount, /*src=*/0ul, /*dst=*/0x200000c0ul, /*type=*/0x20000080ul, /*flags=*/0ul, /*opts=*/0x20000500ul); } int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-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=*/-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x21000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1, /*offset=*/0ul); use_temporary_dir(); loop(); return 0; }