// https://syzkaller.appspot.com/bug?id=d4a58de9696a60f9c0d79531cdc0d622e474e786 // 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; const int umount_flags = MNT_FORCE | UMOUNT_NOFOLLOW; retry: while (umount2(dir, umount_flags) == 0) { } dp = opendir(dir); if (dp == NULL) { if (errno == EMFILE) { exit(1); } exit(1); } struct dirent* ep = 0; while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); while (umount2(filename, umount_flags) == 0) { } struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } int i; for (i = 0;; i++) { if (unlink(filename) == 0) break; if (errno == EPERM) { int fd = open(filename, O_RDONLY); if (fd != -1) { long flags = 0; if (ioctl(fd, FS_IOC_SETFLAGS, &flags) == 0) { } close(fd); continue; } } if (errno == EROFS) { break; } if (errno != EBUSY || i > 100) exit(1); if (umount2(filename, umount_flags)) exit(1); } } closedir(dp); for (int i = 0;; i++) { if (rmdir(dir) == 0) break; if (i < 100) { if (errno == EPERM) { int fd = open(dir, O_RDONLY); if (fd != -1) { long flags = 0; if (ioctl(fd, FS_IOC_SETFLAGS, &flags) == 0) { } close(fd); continue; } } if (errno == EROFS) { break; } if (errno == EBUSY) { if (umount2(dir, umount_flags)) exit(1); continue; } if (errno == ENOTEMPTY) { if (iter < 100) { iter++; goto retry; } } } exit(1); } } static void kill_and_wait(int pid, int* status) { kill(-pid, SIGKILL); kill(pid, SIGKILL); for (int i = 0; i < 100; i++) { if (waitpid(-1, status, WNOHANG | __WALL) == pid) return; usleep(1000); } DIR* dir = opendir("/sys/fs/fuse/connections"); if (dir) { for (;;) { struct dirent* ent = readdir(dir); if (!ent) break; if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) continue; char abort[300]; snprintf(abort, sizeof(abort), "/sys/fs/fuse/connections/%s/abort", ent->d_name); int fd = open(abort, O_WRONLY); if (fd == -1) { continue; } if (write(fd, abort, 1) < 0) { } close(fd); } closedir(dir); } else { } while (waitpid(-1, status, __WALL) != pid) { } } static void reset_loop() { char buf[64]; snprintf(buf, sizeof(buf), "/dev/loop%llu", procid); int loopfd = open(buf, O_RDWR); if (loopfd != -1) { ioctl(loopfd, LOOP_CLR_FD, 0); close(loopfd); } } static void setup_test() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setpgrp(); write_file("/proc/self/oom_score_adj", "1000"); if (symlink("/dev/binderfs", "./binderfs")) { } } static void execute_one(void); #define WAIT_FLAGS __WALL static void loop(void) { int iter = 0; for (;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); reset_loop(); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); setup_test(); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { sleep_ms(10); if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; if (current_time_ms() - start < 5000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[1] = {0xffffffffffffffff}; void execute_one(void) { intptr_t res = 0; if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } memcpy((void*)0x200000000300, "hfs\000", 4); memcpy((void*)0x200000000880, "./" "file0aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\000", 252); memcpy( (void*)0x200000000980, "\x78\x9c\xec\xdd\xbb\x4f\x14\x41\x1c\xc0\xf1\xdf\xec\xdd\xc1\x21\x04\x57" "\xc0\x90\x58\xa2\x24\x56\x46\xb1\x31\x36\x18\xc3\xdf\x60\x2c\xd4\x88\xdc" "\x99\x10\x2e\x98\x00\x26\x62\x23\xb1\x36\xc6\xce\x47\x67\x61\x67\x6d\x6c" "\x2c\xed\x89\xd6\x46\x2b\x63\x61\x0f\xdd\x9a\x79\x2c\xb7\x78\xbb\xb3\xf7" "\xe0\x6e\x39\xfd\x7e\x12\x2e\xeb\xed\xcc\xec\x6f\x76\x67\x67\x67\x2e\x59" "\x47\x00\xfc\xb7\xae\x2f\x7d\x7f\x77\xf9\xa7\xfe\x53\x22\x25\x29\x89\xc8" "\x55\x91\x40\x44\xaa\x22\x65\x11\x39\x2d\xb3\xd5\x87\xeb\x5b\xab\x5b\x8d" "\x7a\xcd\x57\x50\xc9\xe4\xd0\x7f\x4a\x6c\x4e\xd5\x92\x66\x65\xbd\x9e\x96" "\x55\xe7\x33\x39\x9c\x50\xff\xab\x2c\x13\xc9\xef\xd0\x1f\x51\x14\x45\x3f" "\xbe\x96\xfc\x69\x4e\x0e\x2c\x1c\x14\xc4\xdc\xfd\x51\x6b\x3b\x08\x44\x46" "\xdd\xdd\x69\x76\x56\x8b\x08\xae\x0f\x76\x8a\x0e\xa0\x60\x6a\x5f\xf6\xe5" "\x91\x4c\x16\x1d\x07\x00\xa0\x58\xfa\xf9\x5f\xb1\x03\x7f\xfd\x9c\x9f\x70" "\xe3\xf7\x20\x10\x99\x77\x8f\xfd\x21\x7b\xfe\xfb\x47\xad\xfb\x83\x0b\xe4" "\x58\x4a\x3c\xff\xcd\x2c\x2b\x52\xfa\xfa\x9a\x53\xa6\x9a\xf3\x3d\x33\x85" "\xd3\xfb\x83\x78\x96\xe8\x29\x31\x73\xcf\x88\xd8\x81\xe4\xa1\xd1\xa5\xca" "\x9b\x55\x9a\x58\x82\xb1\xfb\xab\x8d\xfa\x85\x95\x07\x8d\x5a\x20\x4f\x65" "\xd1\x49\x24\x9b\x31\x9f\x35\xdb\x74\x63\x39\xd1\xce\x79\x82\x4d\x91\x5f" "\xf7\x2c\xa6\xc6\x41\x45\xd7\x61\x21\x23\xfe\xe9\x6e\x8e\xf8\xb2\xf3\x50" "\x0e\xec\x45\x6a\x57\xdd\x51\xa1\xbc\x91\xda\xc1\xf8\xaf\x1c\x99\x33\x62" "\xae\x54\x68\xe2\x0e\x0f\x32\xd8\xf8\x2f\x9a\xed\x1b\x95\x94\x12\xc7\xf5" "\x87\x52\x26\x55\x46\x2d\x4f\x99\x83\x9c\x71\x47\x90\x8f\xef\xdb\xa8\x65" "\x55\x32\xa7\xa5\x23\xae\x4c\xdb\x74\x9f\xd8\x2f\xc3\x38\xce\x17\x23\x9e" "\x5c\x53\x72\xf8\x67\x05\x5b\xbb\x4b\x59\x47\x72\xb9\xa6\x53\x73\x2d\xe4" "\xe4\x9a\x69\xe6\xfa\x15\xf7\x9c\xae\x35\x67\xe7\xec\x5e\x46\xb5\xff\xa2" "\x9e\xab\x9b\x6a\x4e\x7e\xcb\x07\x59\x4a\x8c\xff\x03\x7d\xb6\xe7\x4d\x82" "\xf8\xb4\x7b\x82\x54\x26\xa5\x6b\x19\xde\xfa\x94\x4d\xca\xb0\x8d\xc0\x82" "\xb6\xc2\x47\xbb\xd2\x6e\xd5\xa6\x67\x72\x4f\xae\xc8\xe4\xe6\xf6\xe3\xb5" "\xe5\x46\xa3\xbe\xd1\xee\xc6\xa7\x6f\x1d\x24\x3e\xaa\x8d\xd7\x6f\xed\x46" "\xa9\x97\x72\xe2\x9a\xb7\xec\x2a\x4b\xaf\x11\x46\xa3\xb6\xe8\x7e\x9d\x84" "\x2e\x23\xd4\x5d\x4e\x07\xb9\xe2\x06\xd3\xef\x6b\x2a\x22\x3b\xee\x9b\xf8" "\x9a\x64\x26\x8e\xfb\xb4\xb4\x72\x54\xeb\xa5\x1c\x96\x0d\xe9\xb9\x9c\x92" "\x8c\xca\x5a\xdc\x67\x1e\x59\x60\xee\x6c\xef\xac\x2d\x37\xec\x56\xfa\x40" "\x69\xac\xdb\x3e\x09\xc7\x4c\xa2\x7b\x9c\xbd\x95\x9f\x3c\x1a\x44\x4c\x18" "\x28\xdd\x87\x28\x3b\xff\x33\x23\x79\x3b\xaa\xbb\x66\xf6\xe9\xdb\x3f\x34" "\xe3\xf4\x8a\xa4\x8d\xd3\x73\xdb\x83\x29\xf1\xd5\xed\x5d\x3b\x7d\x48\xcc" "\x0d\x9a\x83\xd5\x29\xf3\x79\xa2\xa3\x19\xdc\x78\xf6\x0c\x2e\x51\x07\xef" "\x9c\xeb\xec\x79\x91\x73\x9e\x23\x7e\x3e\x5c\x6c\xe8\xe2\xfc\x47\xa8\x25" "\xf9\x22\x77\xf9\xfd\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x60\xd8\xe4\xbe\x18\xb0\x17\x6d\x6c\x6e\xbb\xd7\x5b\xba\x7c\x33" "\xa4\xe0\x2a\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x30\xf4\x7c\xeb\xff\x9a\x35\x32\x73\xd6\xff\x8d\xdf\x0c\xc8\x5e" "\xff\x37\xf1\xbf\x7a\xe7\xaf\xff\xbb\xa8\x0b\xca\x58\xff\xd7\xbf\x48\x2d" "\x80\x8e\xfd\x09\x00\x00\xff\xff\xc3\xeb\x6b\x52", 768); syz_mount_image(/*fs=*/0x200000000300, /*dir=*/0x200000000880, /*flags=MS_SYNCHRONOUS|MS_NODIRATIME|MS_NOATIME*/ 0xc10, /*opts=*/0x200000000180, /*chdir=*/3, /*size=*/0x300, /*img=*/0x200000000980); memcpy((void*)0x2000000001c0, "hfs\000", 4); memcpy((void*)0x200000000000, "./file2\000", 8); memcpy( (void*)0x200000000680, "\x78\x9c\xec\xdd\x4f\x6b\x13\x41\x18\xc7\xf1\xdf\x6c\xd2\x26\xb5\xb1\xa6" "\x7f\x44\xf0\x58\x2d\xe8\x45\xb4\x5e\xc4\x4b\x44\xf2\x16\x04\xf1\x20\xda" "\x36\x42\x31\x54\xd4\x0a\xea\xc5\x54\x3c\x89\xe8\xdd\xbb\x6f\xc1\x17\xe1" "\x45\xf1\x0d\xe8\xc9\x83\xf8\x02\xda\xd3\xca\xcc\xfe\x49\x36\xd9\xcd\xa6" "\xb1\x49\x1a\xfc\x7e\x40\xdd\x6c\xe6\xd9\x79\x26\x9b\xdd\x7d\x26\x20\x23" "\x00\xff\xad\x9b\xf5\x1f\x9f\xae\xfe\xb2\x7f\x8c\x54\x50\x41\x7a\x7b\x5d" "\xf2\x24\x95\xa5\xa2\xa4\xd3\x3a\x53\x7e\xb6\xb3\xbb\xbd\xdb\x6c\x6c\xf5" "\x3b\x50\xc1\x45\xe8\xc0\x97\x51\x10\x69\x7a\xda\x6c\xee\x34\xdc\xbf\x7b" "\xc9\xdd\x36\xce\x45\x84\xaa\xf6\x55\x51\x95\xce\x7d\x18\x0d\xdf\xf7\x6f" "\xfc\xec\xda\xf7\xdb\x9b\x50\x32\x98\x18\x77\xf5\xa7\xf0\xa4\x52\x78\x75" "\xba\xf7\xcb\x63\xcf\xac\xbf\xbd\x21\xe3\x5a\x47\x9c\xc7\xb4\x31\xfb\xda" "\xd7\x73\x2d\x4c\x3a\x0f\x00\xc0\xa4\x04\x8f\x7d\xfb\xfc\xdf\x0b\x0a\x7f" "\xbb\xa3\x12\xd6\xef\x9e\x27\xad\x85\x8f\xfd\x63\xf9\xfc\x1f\xd6\xfe\xa4" "\x13\x18\x39\xbf\xef\xbb\x1d\xcf\x7f\x37\xcb\xf2\x8d\x3d\xbf\xa7\xdc\x5b" "\xed\xf9\x9e\x9b\xc2\xd9\xf7\xbd\x68\x96\x38\x48\xcf\x33\x5d\xaf\x67\x15" "\x14\x92\x89\x02\xd3\xe4\xcd\x2a\x5d\x2e\xde\xdc\x83\xed\x66\xe3\xd2\xe6" "\xa3\xe6\x96\xa7\xd7\xaa\x85\x3a\x9a\xad\xc4\x3d\x84\xec\x37\x34\x27\xdb" "\xd5\x94\xb9\x69\x1f\x03\x8c\xdd\xa4\x56\x94\x41\x5a\xde\x8c\x1d\xc3\x7a" "\x46\xfe\xcb\x43\xf6\xd8\x47\xcf\xf4\x2d\x71\x42\xcc\x17\xf3\xcd\xdc\x35" "\x55\x7d\xd4\x56\x5c\xff\x15\x7d\x63\xb3\x75\x09\x57\xbb\xce\x54\x90\xff" "\xe5\xec\xfe\xe6\x5d\x94\x6d\xa5\xf0\xb6\x51\xab\xd5\x3c\x77\xa0\xc8\xa2" "\xeb\xe4\x6c\xf2\x4c\xe5\x8c\xb2\x9c\x3e\x23\x51\xf4\xc1\x2e\x2a\xf9\x03" "\x41\x35\x2f\x4f\x17\xb5\xd4\x15\x15\x8c\xee\x4a\x6a\x40\x29\x8e\x5a\x4e" "\x8d\x5a\x8f\x5e\x65\xf4\xb5\x92\x88\xb2\xa3\x89\xbf\xcd\xd9\x59\x8e\x9a" "\x79\x6f\x6e\x9b\x55\xfd\xd1\x67\xd5\x3b\xea\x7f\xcf\xe6\xb7\xe6\x1a\x78" "\x59\x57\x66\xfb\xaa\x31\x6b\xc1\x85\xe6\x3e\xf1\x60\x3c\xb3\xe9\xdd\x15" "\xdd\x31\xab\x3d\x4f\x8e\x96\xee\x54\x92\x7b\xe2\x4f\xb1\x94\x95\xfa\x41" "\xff\x7b\x1a\x06\x10\x9d\xc3\x77\xda\xd0\x35\x2d\x3c\x7d\xf1\xf2\x61\xa1" "\xd9\x6c\x3c\xb1\x1b\xf7\x53\x36\x1e\x57\xe2\x3d\x33\x6f\xa4\xd4\x36\xff" "\xbe\x61\x8a\xd2\xd0\xe1\x6a\xb5\xf7\x94\xe4\x3b\x3d\x8d\xa3\x7b\xe0\x08" "\x92\xcf\xdc\xb8\x78\xa4\x07\xb4\xf7\x8f\xdc\xc6\xf6\x2a\x1b\xcb\x00\x47" "\xf5\x4d\x70\x1b\xf2\xc6\x79\x9a\x0e\xbf\x51\xff\x3a\xaa\x2f\x92\x5f\x3a" "\x0e\x03\x3c\x39\xc1\x1b\x14\xc6\xa9\x7d\xd2\x87\x0a\xef\x2e\xf5\x31\x7d" "\x6c\xdd\x65\x82\xf9\x9f\xab\xe4\xc3\x7a\xdf\x15\x0a\xf6\xaf\x5b\xa5\xec" "\x3a\x3d\x2a\xc8\xd2\x4a\x36\x57\xbd\x87\x47\xf4\x6d\x8d\x1d\xcf\x80\xca" "\x89\xf8\x25\xb7\x75\x22\x59\x46\xe7\xcc\x0d\xe6\xc3\x3a\x26\x65\x1e\xd7" "\xd2\x60\x73\xae\x73\x17\xa4\xf3\x83\xf7\x58\x0d\xf3\x9c\x0e\xfe\xab\x9c" "\x06\xa6\xae\xef\xba\xc7\xef\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\xd3\xe6\xf0\xff\x43\x60\xee\xd0\x51\x93\x1e\x23\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd3\x2e" "\x5e\xff\x57\xd1\xfa\xbf\x1a\x6c\xfd\xdf\xee\xa5\x58\xc2\xf5\x7f\xcb\xca" "\x59\xff\x77\xa3\x37\x87\x9e\xf5\x7f\x3f\xec\xc8\xb4\x24\xd6\xff\x05\x46" "\xeb\x6f\x00\x00\x00\xff\xff\xe4\x51\x7e\xe4", 767); syz_mount_image(/*fs=*/0x2000000001c0, /*dir=*/0x200000000000, /*flags=MS_MANDLOCK*/ 0x40, /*opts=*/0x200000000280, /*chdir=*/0x11, /*size=*/0x2ff, /*img=*/0x200000000680); memcpy((void*)0x2000000000c0, "./bus\000", 6); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x2000000000c0ul, /*flags=O_SYNC|O_CREAT|O_APPEND|O_RDWR*/ 0x101442, /*mode=*/0); if (res != -1) r[0] = res; memset((void*)0x200000000140, 50, 1); syscall(__NR_pwrite64, /*fd=*/r[0], /*buf=*/0x200000000140ul, /*count=*/0xfdeful, /*pos=*/0xfeccul); memcpy((void*)0x200000000140, "./file1\000", 8); syscall(__NR_open, /*file=*/0x200000000140ul, /*flags=O_NONBLOCK|O_NOFOLLOW|O_NOATIME|O_DIRECT|O_CREAT|0x2002*/ 0x66842ul, /*mode=S_IXOTH|S_IRGRP*/ 0x21ul); memcpy((void*)0x200000000040, "./file1\000", 8); syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000040ul, /*flags=O_SYNC|O_CREAT|O_RDWR*/ 0x101042, /*mode=S_IXOTH|S_IROTH|S_IWGRP*/ 0x15); memcpy((void*)0x200000000300, "./file1\000", 8); syscall( __NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000300ul, /*flags=O_NOATIME|O_DIRECT|O_CREAT|O_CLOEXEC|0x2*/ 0xc4042, /*mode=S_IXOTH|S_IWOTH|S_IROTH|S_IXGRP|S_IWGRP|S_IRGRP|S_IXUSR|S_IWUSR|0x100*/ 0x1ff); } 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; }