// https://syzkaller.appspot.com/bug?id=fec7bccb1a83b60f07b81a0693939b172d693a41 // 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; memcpy((void*)0x20000040, "nilfs2\000", 7); memcpy((void*)0x20000300, "./file0\000", 8); memcpy( (void*)0x20000340, "\x78\x9c\xec\xdd\x4d\x8c\x5b\x47\xe1\x00\xf0\xb1\x77\xbd\xc9\x26\xe9\x3f" "\x4e\xff\x09\x5d\xd2\xd0\x26\x14\xda\xf2\xd1\x4d\xb3\x59\xc2\x47\x04\x49" "\x95\x08\x89\xa8\xa9\x10\x97\x4a\x15\x97\x28\x4d\x4b\x44\x08\x12\x45\x02" "\xaa\x4a\x24\x39\x71\xa3\x55\x15\x24\x4e\x7c\x88\x53\x2f\x55\x41\x48\xf4" "\x82\xa2\x9e\xb8\x54\xa2\x91\x2a\xa4\x9e\x0a\x07\x0e\x44\x41\x54\xe2\x00" "\x81\xc4\x28\xde\x19\xaf\x3d\xb1\xf3\x6c\xef\xc7\xb3\xd7\xbf\x9f\x34\x3b" "\x9e\x37\xf3\x3c\xf3\xbc\xcf\xcf\xef\x73\x26\x00\x13\xab\xda\xfc\xbb\xb8" "\x38\x57\x09\xe1\xf2\x9b\xaf\x1e\xff\xdb\xc3\x7f\x9d\xbd\x3d\xe5\x48\xab" "\x44\xbd\xf9\x77\xba\x2d\x55\x0b\x21\x54\x62\x7a\x3a\x7b\xbf\xf7\xa7\x96" "\xe2\x9b\x1f\xbc\x74\xba\x5b\x5c\x09\x0b\xcd\xbf\x29\x1d\x9e\xba\xde\x9a" "\x77\x6b\x08\xe1\x42\xd8\x1b\xae\x84\x7a\xd8\x7d\xf9\xea\x2b\x6f\x2f\x3c" "\x79\xf2\xe2\x89\x4b\xfb\xde\x79\xed\xf0\xb5\xb5\x59\x7a\x00\x00\x98\x2c" "\x5f\xbd\x72\x78\x71\xd7\x9f\xff\x78\xff\x8e\x1b\xaf\x3f\x70\x34\x6c\x6a" "\x4d\x4f\xfb\xe7\xf5\x98\xde\x16\xf7\xfb\x8f\xc6\x1d\xff\xb4\xff\x5f\x0d" "\x9d\xe9\x4a\x5b\x68\x37\x93\x95\x9b\x8e\xa1\x3a\xdb\x59\x6e\xaa\x4b\xb9" "\xf6\x7a\x6a\x59\xb9\xe9\x1e\xf5\xcf\x64\xf5\xd7\x7a\x94\xdb\x14\xee\x5e" "\xff\x54\xdb\xb4\x6e\xcb\x0d\xe3\x2c\xad\xc7\xf5\x50\xa9\xce\x77\xa4\xab" "\xd5\xf9\xf9\xa5\x63\xf2\xd0\x3c\xae\x9f\xa9\xcc\x9f\x3f\x7b\xee\xb9\x17" "\x4a\x6a\x28\xb0\xea\xfe\xf9\x60\x08\x61\x6f\x5b\x38\x76\xa9\x33\x3d\x6a" "\xe1\xc8\x08\xb4\x61\xc8\xd0\x18\x81\x36\x8c\x65\x38\xba\x7e\x75\xdd\x68" "\x2c\x29\x7d\x99\xd7\x29\x34\xb6\x97\xbd\x05\x02\x58\x92\x5f\x2f\xbc\xc3" "\x85\xfc\xcc\xc2\xca\xb4\xde\x6d\xba\xbf\xfa\xaf\x3f\x51\xed\x3e\x3f\xac" "\x82\xf5\x5e\xff\x07\xaa\x7f\xa6\xe4\xfa\xc3\xe4\xd6\x9f\xb6\x3a\xbf\xba" "\x68\x8b\xc3\xea\xd9\xa8\x6b\x53\x5a\xae\xf4\x3d\xda\x16\xd3\xf9\x75\x84" "\xfc\xfe\xa5\xde\xdf\xff\xfc\x4a\x47\xe7\xd4\xfc\x7a\x44\xad\xcf\x76\xf6" "\xba\x8e\x30\x2e\xd7\x17\x7a\xb5\x73\x6a\x9d\xdb\x31\xac\x5e\xed\xcf\xd7" "\x8b\x8d\xea\x8b\x31\x4e\x9f\xc3\x97\xb2\xfc\xf6\xef\x4f\xfe\x3f\x1d\x97" "\xff\x31\xd0\xdd\xbf\xf2\xf3\xff\x93\x10\x6a\x23\xd0\x06\x41\x18\x36\x84" "\x8e\x74\x6d\x25\xef\xd5\x28\x79\xfb\x03\x8c\xae\xfc\xbe\xb9\x46\xba\x3e" "\x1a\xe5\xf7\xf5\xe5\xf9\x9b\x0a\xf2\x37\x17\xe4\xcf\x16\xe4\x6f\x29\xc8" "\xdf\x5a\x90\x0f\x93\xec\x37\xdf\xfd\x71\x78\xb9\xb2\x7c\x9c\x9f\x1f\xd3" "\x0f\x7a\x3e\x3c\x9d\x67\xbb\x27\xc6\xff\x37\x60\x7b\xf2\xf3\x91\x83\xd6" "\x9f\xdf\xf7\x3b\xa8\x95\xd6\x9f\xdf\x4f\x0c\xa3\xec\x77\xa7\x9e\x3e\xf3" "\xb9\x67\x9f\xb9\xba\x74\xff\x7f\xa5\xb5\xfe\xdf\x8a\xeb\x7b\x3a\xdc\xa8" "\xc7\xef\xd6\x95\x58\x20\x9d\x2f\xcc\xcf\xab\xb7\xee\xfd\xaf\x77\xd6\x53" "\xed\x51\xee\xde\xac\x3d\xf7\x74\x29\xdf\x7c\xbd\xb3\xb3\x5c\x65\xe7\xf2" "\xfb\x84\xb6\xed\xcc\x1d\xed\x98\xeb\x9c\x6f\x7b\x5e\x6e\x5b\x2c\xb7\xa7" "\xb3\x5c\x3d\x2b\x37\x1b\xc3\xe6\xac\xbd\xf9\xfe\xc9\x96\x6c\xbe\xb4\xff" "\x91\xb6\xab\xe9\xf3\x9a\xce\x96\xb7\x96\x2d\xc7\x4c\xd6\x8e\xb4\x5d\xd9" "\x11\xe3\xbc\x1d\x30\x8c\xb4\x3e\xf6\xba\xff\x3f\xad\x9f\x73\xa1\x56\x79" "\xee\xec\xb9\x33\x8f\xc7\x74\x5a\x4f\xff\x30\x55\xdb\x74\x7b\xfa\x81\x75" "\x6e\x37\xb0\x72\xfd\x3e\xff\x33\x17\x3a\x9f\xff\x99\x69\x4d\xaf\x55\xdb" "\xb7\x0b\xdb\x97\xa7\x57\x96\xb6\x0b\x6f\xc4\xf7\xeb\x9c\xbe\xd0\xaa\xa7" "\x73\xfa\xc1\x98\x4e\xbf\x73\xdf\x98\x9a\x6d\x4e\x9f\x3f\xfd\xed\x73\xcf" "\xae\xfe\xe2\xc3\x44\x7b\xe1\x07\x2f\x7e\xf3\xd4\xb9\x73\x67\xbe\xe3\xc5" "\xd0\x2f\xbe\x3c\x1a\xcd\x18\xe4\x45\x3a\x6c\x19\x95\xf6\xac\xf5\x8b\xc9" "\x59\xd2\x55\x7b\x51\xf2\x86\x09\x58\x73\xfb\x7f\xb8\xb4\x13\xf0\xd8\xd9" "\x6f\x9d\x7a\xfe\xcc\xf3\x67\xce\x1f\x3c\x74\xe8\xe0\xc2\xc2\xa1\xcf\x1f" "\x5c\xdc\xdf\xdc\xaf\xdf\xdf\xbe\x77\xdf\xee\x42\x09\xad\x05\x56\xd3\xf2" "\x8f\x7e\xd9\x2d\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfa\xf5\xbd\x13" "\xc7\xaf\xbe\xfb\xd6\x67\xdf\x5b\x7a\xfe\x7f\xf9\xf9\xbf\xf4\xfc\x7f\xba" "\xf3\x37\x3d\xff\xff\xa3\xec\xf9\xff\xfc\x39\xf9\xf4\x1c\x7c\x7a\x0e\x70" "\x47\x97\xfc\x66\x99\xac\x83\xd5\x99\xac\x5c\x2d\x86\xff\xcf\xda\xbb\x33" "\xab\x67\x57\x36\xdf\x87\x62\xdc\x1a\xc7\x2f\x3e\xff\x9f\xaa\xcb\xfb\x75" "\x4d\xed\xb9\x2f\x9b\x5e\xeb\x91\xcc\xba\x13\xb8\xa3\xbf\x94\x99\xac\x0f" "\x92\x7c\xbc\xc0\x8f\xc6\xf8\x52\x8c\x7f\x19\xa0\x44\x95\xd9\xee\x93\x63" "\x5c\xd4\xbf\x75\x5a\xd7\x53\xff\x14\x6d\xfd\x52\x34\xf4\x0f\x3c\x3e\xd2" "\xff\x2d\xad\x0d\xa9\x1f\x93\xf4\xfc\x77\xd7\x7e\x9d\xda\xfe\xd9\x3b\xd6" "\xa1\x8d\xac\xbe\xf5\x78\x9c\xb0\xec\x65\x04\xba\xfb\xfb\x44\xf5\xff\xfd" "\x8f\xe5\x05\x2f\xbd\x2d\x1b\x25\x4c\x8f\xc9\x7b\xde\x25\xfc\x74\x72\xd7" "\x89\x46\xcf\xbd\xf4\x7e\x47\xb0\x01\x58\x1d\x65\x8f\xff\x99\xce\x7b\xa6" "\xf8\xfc\xef\xbf\xb2\xf9\x76\x48\xc5\xae\x3f\xd1\xb9\xbd\xcc\xfb\x2f\x85" "\x41\xfc\xe9\xdd\xce\xf4\xa8\x8e\x3f\xb9\x5e\xf5\xe7\xe3\xf6\xad\x77\xfd" "\x65\x2f\x7f\x51\xfd\xab\x3d\xfe\x67\x6b\xfc\xbb\xbe\xb7\x7f\xd9\x88\x79" "\xf5\xe1\xea\xfd\xf7\xcf\xae\xbd\xd7\x56\x6d\xd8\xdd\x6f\xfd\xf9\xf2\xa7" "\x7e\xa0\x77\x0e\x56\xff\x8d\x58\x7f\x5a\x9a\x47\x42\x7f\xf5\x37\x7e\x91" "\xd5\x9f\x5f\x10\xea\xd3\x7f\xb2\xfa\xb7\xf4\x59\xff\x1d\xcb\xbf\x67\xb8" "\xfa\xff\x1b\xeb\x4f\x1f\xdb\xa3\x0f\xf5\x5b\xff\x52\x8b\x2b\xd5\xce\x76" "\xe4\xe7\x8d\xd3\xf5\xbf\xfc\xbc\x71\x72\x33\x5b\xfe\xd4\xb7\xe7\x5d\xea" "\xff\xda\x8b\xdd\x96\x7f\xc8\x81\x1a\x6f\xc5\xfa\x61\x92\x8d\xcb\x38\xb3" "\x83\xca\xf6\x23\x5a\x3b\xed\xc3\x8f\xff\x1b\x5d\x58\xdd\xf1\x7f\x5b\x8d" "\xcd\x36\x6b\xf9\x7d\x18\x9f\x89\xe9\xb4\x21\x4e\xf7\x39\xe4\xe3\x9d\x0c" "\xda\xfe\x74\x7f\x45\xfa\x1d\xd8\x95\xbd\x7f\xa5\xe0\xf7\xcd\xf8\xbf\xe3" "\xed\x0b\x31\x2e\xfa\x3e\xa4\xf1\x7f\xd3\xfa\x58\x8f\x3f\xf9\x6d\xe9\xe6" "\x67\x99\xd2\xb5\x2e\x9f\xed\x46\xdd\xd6\xc0\xb8\x7a\x7f\xa2\xae\xff\x8d" "\x45\xd8\x3c\x02\x6d\x10\xfa\x0f\x8d\xa9\x21\xe6\x6b\x8d\x13\x57\x72\xfb" "\x1b\x8d\xc6\xda\x9e\xd0\x2a\x50\x6a\xe5\x94\xfe\xf9\x97\x7d\x9c\x50\x76" "\xfd\x65\x7f\xfe\x45\xf2\xf1\x7f\xf3\x7d\xf8\x7c\xfc\xdf\x3c\x3f\x1f\xff" "\x37\xcf\xcf\xc7\xff\xcd\xf3\x67\xe3\x7f\xa8\x57\x7e\x3e\xfe\x6f\xfe\x79" "\xe6\xe3\xff\xe6\xf9\xf7\x65\xef\x9b\x8f\x0f\x3c\x57\x90\xff\xe1\x82\xfc" "\xdd\xdd\xf3\x5b\x87\xed\xf7\x17\xcc\xbf\xa7\x20\xff\x23\x05\xf9\xfb\x5a" "\xf9\x47\x3a\x4a\xa4\xfc\x07\x0a\xe6\x7f\xb0\x20\xff\xde\x82\xfc\x87\x0a" "\xf2\x3f\x56\x90\xff\xf1\x82\xfc\x87\x0b\xf2\x1f\x6d\xcb\x6f\x1f\x03\x3a" "\xe5\x7f\xa2\x60\xfe\x8d\x2e\x3d\x8f\x32\xa9\xcb\x0f\x93\x2c\x7f\x3e\xcf" "\xf7\x1f\x26\x47\xba\xfe\xd3\xeb\xfb\xbf\xb3\x20\x1f\x18\x5f\x3f\x79\xfd" "\xc0\xb1\x67\x7e\xfd\xf5\xfa\xd2\xf3\xff\x33\xad\xf3\x21\xe9\x3a\xde\xd1" "\x98\xae\xc5\xe3\xa7\xef\xc7\x74\x7e\xdd\x3b\xb4\xa5\x6f\xe7\xbd\x15\xd3" "\x7f\xc9\xf2\x47\xfd\x7c\x07\x4c\x92\xbc\xff\x8c\xfc\xf7\xfd\x91\x82\x7c" "\x60\x7c\xa5\xfb\xbc\x7c\xbf\x61\x02\x55\x36\x77\x9f\x1c\xe3\xa2\x7e\xab" "\x7a\xed\xe7\x33\x5e\x3e\x19\xe3\x4f\xc5\xf8\xd3\x31\x7e\x2c\xc6\xf3\x31" "\xde\x1f\xe3\x03\x31\x5e\x58\xa7\xf6\xb1\x36\x8e\xbd\xf1\xdb\xc3\x2f\x57" "\x96\x8f\xf7\xb7\x67\xf9\xfd\xde\x4f\x9e\x3f\x0f\xd4\xd1\x4f\x54\x08\xe1" "\x60\x9f\xed\xc9\xcf\x0f\x0c\x7a\x3f\x7b\xde\x8f\xdf\xa0\x56\x5a\xff\x90" "\x8f\x83\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\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\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\xa6\xda\xfc\xbb\xb8\x38\x57\x09\xe1" "\xf2\x9b\xaf\x1e\x7f\xfa\xe4\xd9\xfd\xb7\xa7\x1c\x69\x95\xa8\x37\xff\x4e" "\xb7\xa5\x6a\xad\xf9\x42\x78\x3c\xc6\x53\x31\xfe\x79\x7c\x71\xf3\x83\x97" "\x4e\xb7\xc7\xb7\x62\x5c\x09\x0b\xa1\x12\x2a\xad\xe9\xe1\xa9\xeb\xad\x9a" "\xb6\x86\x10\x2e\x84\xbd\xe1\x4a\xa8\x87\xdd\x97\xaf\xbe\xf2\xf6\xc2\x93" "\x27\x2f\x9e\xb8\xb4\xef\x9d\xd7\x0e\x5f\x5b\xbb\x4f\x00\x00\x00\x00\x36" "\xbe\xff\x05\x00\x00\xff\xff\x11\x22\x0e\x2d", 2747); syz_mount_image(/*fs=*/0x20000040, /*dir=*/0x20000300, /*flags=*/0, /*opts=*/0x20000240, /*chdir=*/1, /*size=*/0xabb, /*img=*/0x20000340); memcpy((void*)0x20000140, "./bus\000", 6); syscall(__NR_open, /*file=*/0x20000140ul, /*flags=O_SYNC|O_NOCTTY|O_NOATIME|O_CREAT|FASYNC|0x2*/ 0x143142ul, /*mode=*/0ul); memcpy((void*)0x20000380, "/dev/loop", 9); *(uint8_t*)0x20000389 = 0x30; *(uint8_t*)0x2000038a = 0; memcpy((void*)0x20000080, "./bus\000", 6); syscall(__NR_mount, /*src=*/0x20000380ul, /*dst=*/0x20000080ul, /*type=*/0ul, /*flags=MS_I_VERSION|MS_PRIVATE|MS_POSIXACL|MS_NODIRATIME|MS_BIND*/ 0x851800ul, /*data=*/0ul); memcpy((void*)0x20000000, "./bus\000", 6); res = syscall(__NR_open, /*file=*/0x20000000ul, /*flags=*/0ul, /*mode=*/0ul); if (res != -1) r[0] = res; *(uint64_t*)0x20000b00 = 0; *(uint64_t*)0x20000b08 = 0; *(uint64_t*)0x20000b10 = 0; *(uint64_t*)0x20000b18 = 0x7fffffffffffffff; *(uint64_t*)0x20000b20 = 0; *(uint32_t*)0x20000b28 = 0; *(uint32_t*)0x20000b2c = 0; *(uint32_t*)0x20000b30 = 0; *(uint32_t*)0x20000b34 = 0; memcpy((void*)0x20000b38, "\xef\x35\x9f\x41\x3b\xb9\x01\x52\xf7\xd6\xd1\xce\x5d\x29\xc3\xee\x5e" "\x5c\xa9\x00\x0f\x7c\x41\x49\x9d\xc2\xaa\xc6\x3a\x01\x00\x00\x00\x00" "\x00\x00\x00\x4f\xaa\x2a\xd9\xc0\x84\xa0\x03\xea\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 64); memcpy((void*)0x20000b78, "\x03\x6c\x47\xc6\x78\x08\x20\x04\x00\x00\x00\x00\x00\x00\x00\x33\x52" "\x63\xbd\xbc\xef\x54\x9b\xa1\x97\xfc\xe4\x7d\xdf\xdd\x75\x3a\xbd\x95" "\x01\x00\x00\x2a\x00\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00" "\xe8\xf2\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00", 64); memcpy((void*)0x20000bb8, "\xb7\x32\x67\x36\x18\x1c\x20\x82\x20\x00\x00\x00\xb9\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\xf0\xff\xff\xff\xff\xf2\xff\x00\x00\x00", 32); *(uint64_t*)0x20000bd8 = 0; *(uint64_t*)0x20000be0 = 0; syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x4c04, /*arg=*/0x20000b00ul); } 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; }