// https://syzkaller.appspot.com/bug?id=f5b30c5511e9f91516bef7d4ff05cda5c6677f03 // 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 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; } static void kill_and_wait(int pid, int* status) { kill(-pid, SIGKILL); kill(pid, SIGKILL); for (int i = 0; i < 100; i++) { if (waitpid(-1, status, WNOHANG | __WALL) == pid) return; usleep(1000); } DIR* dir = opendir("/sys/fs/fuse/connections"); if (dir) { for (;;) { struct dirent* ent = readdir(dir); if (!ent) break; if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) continue; char abort[300]; snprintf(abort, sizeof(abort), "/sys/fs/fuse/connections/%s/abort", ent->d_name); int fd = open(abort, O_WRONLY); if (fd == -1) { continue; } if (write(fd, abort, 1) < 0) { } close(fd); } closedir(dir); } else { } while (waitpid(-1, status, __WALL) != pid) { } } static void reset_loop() { char buf[64]; snprintf(buf, sizeof(buf), "/dev/loop%llu", procid); int loopfd = open(buf, O_RDWR); if (loopfd != -1) { ioctl(loopfd, LOOP_CLR_FD, 0); close(loopfd); } } static void setup_test() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setpgrp(); write_file("/proc/self/oom_score_adj", "1000"); } static void execute_one(void); #define WAIT_FLAGS __WALL static void loop(void) { int iter = 0; for (;; iter++) { reset_loop(); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { setup_test(); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { sleep_ms(10); if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; if (current_time_ms() - start < 5000) continue; kill_and_wait(pid, &status); break; } } } void execute_one(void) { if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } memcpy((void*)0x400000000000, "hfsplus\000", 8); memcpy((void*)0x400000000080, "./file0\000", 8); memcpy((void*)0x400000002440, "\x66\x6f\x72\x63\x65\x2c\x6e\x6c\x73\x3d\x65\x75\x63\x2d\x6a\x70\x2c" "\x62\x61\x72\x72\x69\x65\x72\x2c\x74\x79\x70\x65\x3d\x88\x3b\x7f\x38" "\x2c\x75\x6d\x61\x73\x6b\x3d\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30" "\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x36\x2c\x66\x6f\x72" "\x63\x65\x2c\x62\x61\x72\x72\x69\x65\x72\x2c\x74\x79\x70\x65\x3d\x49" "\xd3\x88\x24\x2c\x67\x69\x64\x3d", 93); sprintf((char*)0x40000000249d, "0x%016llx", (long long)0); memcpy((void*)0x4000000024af, "\x2c\x00\x5d\xc1\x5e\x24\x6d\x93\x0a\x23\xb5\xf4\x09\x37\x07\xc1\x02" "\x26\xaf\xb2\x8f\x3e\x28\x38\xbb\x91\x78\x86\xa2\x7a\xfe\xce\x1c\xbc" "\xf9\xae\x2d\x32\xc2\xc3\xf5\xbf\x4b\xb6\xfc\xd7\x3d\x5c\x59\xe4\x63" "\xcd\x17\x3c\x18\x8e\x1e\xef\xab\xa6\xfc\xea\xeb\x58\x40\xcb\xeb\x14" "\x5a\x56\xad\x67\x4e\x7f\x2f\x8c\x49\xea\xf5\xb1\xc6\x5e\xb6\xd7\x62" "\x30\x0b\x8c\x5c\x2f\xf6\x96\x71\xe6\xb2\x09\x00\x00\x00", 99); memcpy( (void*)0x400000000c80, "\x78\x9c\xec\xdd\x4b\x68\x1c\xe7\x1d\x00\xf0\xff\xac\x56\xab\x5d\x15\x1c" "\x39\xf1\x23\x2d\x81\x2c\x31\xa4\xa5\xa2\xb6\x64\xa1\xb4\xea\xa5\x6e\x29" "\x45\x87\x50\x42\x7a\xe8\x79\xb1\xe5\x58\x78\x2d\x07\x49\x29\xb2\x29\xb5" "\xd2\xc7\xbd\x87\x9c\x7a\x4a\x0f\xba\x85\x1e\x4a\x7a\x37\xb4\xe7\x86\x40" "\xf1\x55\xc7\x40\x21\x97\x9c\x74\x53\x99\xd9\x99\xd5\x48\xbb\xda\x5d\xd9" "\x7a\x25\xfd\xfd\xc4\xcc\x7c\x33\xdf\x73\xfe\xb3\x33\xb3\x0f\xc4\x04\xf0" "\x7f\x6b\x71\x3a\xaa\x4f\x23\x89\xc5\xe9\xb7\x37\xd2\xf5\xed\xad\xb9\xf6" "\xd8\xd6\xdc\x44\x9e\xdd\x8e\x88\x5a\x44\x54\x22\xaa\x9d\x45\x24\x2b\x91" "\xe5\xde\xca\xa7\xf8\x76\xba\x31\x2f\x9f\xc4\x78\xff\x7e\x3e\x5a\x5e\x78" "\xf7\xd9\x57\xdb\x5f\x74\xd6\xaa\xf9\x94\xd5\xab\x94\xea\x8f\xa2\xd6\xbb" "\x69\x33\x9f\xa2\x19\x11\x63\xf9\xb2\xd7\x21\x63\x8b\x4f\x0f\x76\xbf\xaf" "\xbd\xdb\x87\xb6\x37\xaa\xa4\xbb\x87\x69\xc0\xae\x15\x81\x8b\xbf\xbc\x50" "\xab\xf0\xc2\x76\x7b\x6c\x76\xf3\x3e\xf9\x4f\x36\x1f\x54\xfd\x28\xe7\x2d" "\x70\x4e\x25\x9d\xfb\x66\x8f\xa9\x88\xc9\x88\xa8\x47\x74\xee\xfa\xf9\xd5" "\xa1\x72\xba\xa3\x3b\x7e\x9b\x67\x3d\x00\x00\x00\x00\x38\xaa\xc6\xd1\xab" "\xbc\xb4\x13\x3b\xb1\x11\x17\x4e\x62\x38\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\xf0\x4d\x95\x3f\xff\x3f\xc9\xa7\x4a\x91\x6e\x46\x52\x3c\xff\xbf\x96" "\x6f\x8b\x3c\x7d\x0e\x0d\x7f\x10\xe2\xe7\x13\x9d\xe5\xd3\x93\x1f\x0c\x00" "\x00\x00\x00\x00\x00\x00\x9c\xb8\xd7\x77\x62\x27\x36\xe2\x42\xb1\xbe\x9b" "\x64\xbf\xf9\xbf\x51\xfa\x8d\xff\x5b\xf1\x41\xac\xc5\x52\xac\xc6\xf5\xd8" "\x88\x56\xac\xc7\x7a\xac\xc6\x6c\x44\x4c\x95\x1a\xaa\x6d\xb4\xd6\xd7\x57" "\x67\xb3\x9a\xd1\xb8\x34\xa0\xe6\xcd\xf8\xac\x4f\xcd\x9b\x87\x8f\xf1\xd6" "\x71\xef\x34\x00\x00\x00\x00\x00\x00\x00\x9c\x6f\xf5\x21\xf9\xf7\xc7\x7b" "\xb7\xfd\x3e\x16\xf7\x7e\xff\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\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\xf3\x20\x89\x18\xeb\x2c\xb2\xe9\x52\x91\x9e\x8a\x4a\x35\x22\xea\x11" "\x51\x4b\xcb\x6d\x46\x7c\x56\xa4\xbf\x26\x92\x7e\x1b\x9f\x9e\xfe\x38\x00" "\x00\x00\xe0\x85\xd4\xf7\xaf\x26\xf5\x11\xea\xbc\xf4\x24\x76\x62\x23\x2e" "\x14\xeb\xbb\x49\xf6\x99\xff\x4a\xf6\x79\xb9\x1e\x1f\xc4\x4a\xac\xc7\x72" "\xac\x47\x3b\x96\xe2\x4e\xfe\x19\x3a\xfd\xd4\x5f\xd9\xde\x9a\x6b\x6f\x6f" "\xcd\x3d\x48\xa7\xde\x76\x7f\xfa\xe5\x91\x86\x9e\xb5\x18\x9d\xef\x1e\xfa" "\xf7\xfc\x6a\x56\xa2\x11\x77\x63\x39\xdb\x72\x3d\x6e\x47\x12\xbb\x99\x4a" "\xde\xca\xab\xdb\x5b\x73\xe9\xf2\x41\xff\x71\x7d\x98\x8e\x29\xf9\x49\x6e" "\xc0\x68\xc6\x4a\xe9\x3b\xe9\xec\xea\xa7\x59\xfa\xcf\xfb\xbf\x45\xa8\x1e" "\x69\x17\x9f\x53\xe5\xd0\x9c\xa9\x2c\x77\xbc\x1b\x91\x99\x7c\x6c\x69\x8d" "\x8b\x45\x04\xfa\x47\x62\xe8\xd1\xa9\x0e\xec\x69\x36\x2a\xdd\x6f\x7e\x2e" "\x0d\xee\xa9\x7f\xcc\x3f\x1c\xdc\xfb\xe4\x81\x52\x7d\xbf\xb9\x39\x13\x07" "\x23\x71\x33\x2a\xdd\x23\x74\x65\x70\x24\x22\xbe\xfb\x8f\x4f\x7e\x7d\xaf" "\xbd\x72\xff\xde\xdd\xb5\xe9\xf3\xb3\x4b\x7d\x3d\x19\x5a\xe2\x60\x24\xe6" "\x4a\x91\xb8\xfa\x0d\x8a\xc4\x70\x33\x59\x24\x2e\x77\xd7\x17\xe3\x17\xf1" "\xab\x98\x8e\x2f\x27\xde\x89\xd5\x58\x8e\xdf\x44\x2b\xd6\x63\xa9\x59\xe4" "\xb7\xf2\xd7\x73\x3a\x9f\x1a\x1c\xa9\xcf\x27\xcb\x6b\xef\x0c\x1b\x49\x7a" "\x4e\x36\xbb\xd7\xaf\x7e\x63\x6a\xc6\xbe\x31\x45\x33\x7e\x9e\xa5\x5a\xf1" "\x46\x76\x4c\x2f\xc4\x72\x24\xf1\x30\x22\x96\xe2\xad\xec\xef\x66\xcc\x76" "\xaf\x06\x7b\x47\xf8\xf2\x08\x67\x7d\x65\x84\x2b\x6d\xc9\xb5\xef\x65\x8b" "\x6e\x98\xa2\x71\x78\xd9\xbf\x8d\xd6\xe4\x71\x49\xe3\x7a\xb1\x14\xd7\xf2" "\x35\x77\x2a\xcb\x2b\x6f\xd9\x8b\xd2\xcb\x7d\xa3\x54\xdc\xeb\x46\xbf\x1f" "\x95\x54\xbf\x93\x27\xd2\x16\xfe\x30\xf0\xfe\x70\xda\x0e\x46\x62\xb6\x14" "\x89\x57\x0e\x7b\xbd\x74\x42\xfa\xd7\xdd\x74\xbe\xd6\x5e\xb9\xbf\x7a\xaf" "\xf5\xfe\x88\xfd\xbd\x99\x2f\xd3\xf3\xe8\x4f\xe7\xea\x2e\x91\x1e\xe1\x97" "\xa3\x9e\xef\xdc\xc5\x6c\x9e\x64\xe7\xd4\x4c\x96\xf7\x4a\xf7\x0e\xbb\x3f" "\x5e\xb5\xfc\x17\x97\x8e\x4a\x4f\xde\xe5\x6e\xbd\xce\x99\xfa\xcb\x78\x18" "\x77\xf6\x9d\xa9\x3f\x8c\xf9\x98\x8f\x85\xac\xf4\x95\xac\xf4\x78\xcf\x1d" "\x2b\xcd\xbb\xda\x6d\x69\xff\x35\x3c\xcd\x4b\xdf\x69\x55\xbb\x3f\xec\x94" "\xdf\x6f\x3d\x8c\x76\xe7\xfd\x10\x00\xe7\xdb\xe4\xf7\x27\x6b\x8d\xff\x36" "\xfe\xdd\xf8\xb8\xf1\xc7\xc6\xbd\xc6\xdb\xf5\x9f\x4d\xfc\x68\xe2\xb5\x5a" "\x8c\xff\x6b\xfc\xc7\xd5\x99\xb1\x37\x2b\xaf\x25\x7f\x8f\x8f\xe3\x77\x7b" "\x9f\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x80\xe7\xb7\xf6\xe8\xf1\xfd\x56\xbb\xbd\xb4" "\xda\x3f\x51\xe9\x9f\x95\x0c\xae\xd5\x6a\xef\x16\x0f\x12\x1b\x50\x66\x5f" "\x22\xc9\x1f\x95\x33\x42\xe1\x64\xed\xd1\xe3\xdd\xa1\x0d\x0e\x4e\x4c\xe4" "\xc3\x7b\xce\xea\xc7\x99\x28\x9e\xd6\x38\xbc\x70\xf3\x04\x87\x91\x6c\x1e" "\x3c\x5e\xf5\xe1\xc7\xa2\x78\xca\xd3\x08\x5d\x24\x3d\x01\x4f\x2b\x3f\xf7" "\x98\x8b\x9e\xf7\xb6\x8c\x9f\x83\x43\x79\x30\xd1\x1c\x52\x26\x89\x91\x1b" "\x2c\x5e\xb0\xa5\xac\xa3\xbf\x7a\x1b\xfd\x8e\xd7\x58\x44\xdf\x61\x0c\xb9" "\x70\x8c\x1d\xc7\xd5\x07\x38\x4b\x37\xd6\x1f\xbc\x7f\x63\xed\xd1\xe3\x1f" "\x2c\x3f\x68\xbd\xb7\xf4\xde\xd2\xca\xf8\xfc\xfc\xc2\xcc\xc2\xfc\x5b\x73" "\x37\xee\x2e\xb7\x97\x66\x3a\xf3\x52\x85\x53\x79\xf8\x2d\x70\x1a\xca\x6f" "\x27\xba\x6a\x11\xf1\xfa\xf0\xba\x03\x1e\xd4\x0a\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x9c\xa0\xd3\xf8\x5f\x88\xb3\xde\x47\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe0\xeb\x6d" "\x71\x3a\xaa\x4f\x23\x89\xd9\x99\xeb\x33\xe9\xfa\xf6\xd6\x5c\x3b\x9d\x8a" "\xf4\x5e\xc9\x6a\x44\x54\x22\x22\xf9\x6d\x44\xf2\xcf\x88\x5b\xf1\xe4\xd9" "\xad\x34\x63\xaa\xd4\x5c\x72\x58\x3f\x1f\x2d\x2f\xbc\xfb\xec\xab\xed\x2f" "\xf6\xda\xaa\x16\xe5\x2b\x11\x9b\x87\xd6\x1b\xcd\x66\x3e\x45\x33\x22\xc6" "\xf2\xe5\x71\xb5\x77\x7b\x78\x7b\xb5\xbd\xe4\x44\x9f\xec\xa4\x1b\x99\x34" "\x60\xd7\xf2\x25\x9c\xb9\xff\x05\x00\x00\xff\xff\x18\xfd\xed\x14", 1762); syz_mount_image(/*fs=*/0x400000000000, /*dir=*/0x400000000080, /*flags=MS_I_VERSION|MS_NOEXEC|MS_NODEV*/ 0x80000c, /*opts=*/0x400000002440, /*chdir=*/2, /*size=*/0x6e2, /*img=*/0x400000000c80); memcpy((void*)0x400000000040, "./file1\000", 8); memcpy((void*)0x400000001300, "./file0/file0\000", 14); syscall(__NR_rename, /*old=*/0x400000000040ul, /*new=*/0x400000001300ul); } int main(void) { syscall(__NR_mmap, /*addr=*/0x3ffffffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x400000000000ul, /*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=*/0x400001000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1, /*offset=*/0ul); const char* reason; (void)reason; loop(); return 0; }