// https://syzkaller.appspot.com/bug?id=2ad6cc2baea0704695c0b87e6c171fd60df0be70 // 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*)0x20000080, "ext3\000", 5); memcpy((void*)0x20000440, "./file0\000", 8); memcpy((void*)0x20000740, "jqfmt=vfsold,resgid=", 20); sprintf((char*)0x20000754, "0x%016llx", (long long)0xee00); memcpy( (void*)0x20000766, "\x2c\x6e\x6f\x62\x6c\x6f\x63\x6b\x5f\x76\x61\x6c\x69\x64\x69\x74\x79\x2c" "\x6e\x6f\x6c\x6f\x61\x64\x2c\x64\x61\x74\x61\x5f\x65\x72\x72\x3d\x69\x67" "\x6e\x6f\x72\x65\x2c\x75\x73\x72\x6a\x71\x75\x6f\x74\x61\x3d\x2c\x69\x6e" "\x69\x74\x5f\x69\x74\x61\x62\x6c\x65\x3d\x30\x78\x30\x30\x30\x30\x30\x30" "\x30\x30\x30\x30\x30\x30\x30\x36\x30\x31\x2c\x6d\x61\x78\x5f\x64\x69\x72" "\x5f\x73\x69\x7a\x65\x5f\x6b\x62\x3d\x30\x78\x30\x30\x30\x30\x30\x30\x30" "\x30\x30\x30\x30\x30\x30\x30\x30\x33\x2c\x00\x00\x80\xa2\xa1\x62\x24\x2f" "\x5f\x14\xe2\x7c\xd9\x03\xe7\x52\xde\xaf\x06\x90\x45\xd4\xf4\xb0\x73\xf9" "\xcf\xa1\x8c\x6c\x20\x15\x8a\xe1\x3a\x24\xe7\x9b\x65\x4e\xe8\x58\x8b\x67" "\x7e\x3b\x0c\xe2\xca\xf6\x52\xe5\xc6\x43\x33\xf7\x47\x21\xb5\xa3\x6a\x10" "\x45\xa0\x1e\x15\xc7\xa9\x29\x14\x6b\x16\x2c\x26\xa0\xe6\x1b\x81\x39\x35" "\xe3\xce\x71\xa2\x19\x54\xd9\xdc\x4e\x39\x70\x1c\x78\xe3\x89\x27\xc9\xdb" "\x9d\x9b\xc3\xaf\x4d\x44\x7a\xa1\x98\x1b\xe8\xf7\x65\x3c\x75\x0a\x90\x3c" "\x6f\x7c\x71\xa0\x85\x66\x9f\x96\xee\xf6\x83\x05\x00\x6a\x96\xdd\x79\xc2" "\x21\x67\xdb\xa4\x98\x19\x72\xae\x5a\xae\x35\x5b\xe7\x8a\x01\x3f\xe2\x95" "\xc7\x82\x56\xa1\x45\xc3\xef\xe6\x94\x05\x76\xa6\x55\xda\xb6\xde\x92\xf1" "\xaa\xe8\xa9\xec\xf3\xb9\xb1\x7c\xfe\x50\x78\x24\x3c\xec\xdd\x4a\x7f\x8f" "\xaf\x2f\x8f\xb7\xb7\x27\x0f\xc9\x23\x4a\xf8\xa1\xc8\x6d\xc7\xf4\x0d\x65" "\xbf\x6d\x42\x47\xb9\x2f\x4c\x3f\xb6\xa3\x4d\xe9\x28\xce\xfa\x87\xf4\x0f" "\xc9\xb5\xfc\x3f\xf0\x51\x0d\xbe\x6c\xef\x81\x0c\xf4\x23\x0f\x3e\xee\x9e" "\x4b\x6a\x52\x76\x71\x72\x43\xeb\x92\xe3\x62\x8a\xdc\xc4\xf5\xa8\xc5\x19" "\x7c\x5e\x9c\x48\xdc\xbc\x52\xed\x01\x22\x8a\x54\x83\xe2", 392); sprintf((char*)0x200008ee, "%020llu", (long long)-1); memcpy( (void*)0x20000940, "\x78\x9c\xec\xdc\xcf\x4f\x1c\x55\x1c\x00\xf0\xef\xec\xf2\xb3\xa5\x82\xb5" "\xfe\x28\xb6\x11\xad\x46\xe2\x0f\x28\xf4\x87\x3d\x78\xd1\x68\xe2\x41\x13" "\x13\x3d\x68\x3c\x11\xc0\x06\xbb\x2d\xa6\x60\x22\x0d\x51\xf4\x80\x47\x63" "\x62\xbc\x1a\x8f\xfe\x0b\x9e\xf4\x62\x8c\x27\x13\xaf\x7a\x37\x26\x8d\x72" "\x69\xf5\x60\xd6\xcc\xee\x0c\x5d\x60\x97\x2e\xb0\x65\xdb\xee\xe7\x93\x0c" "\xbc\x37\xf3\xe0\xbd\xef\xcc\xbc\xdd\x37\xef\xc1\x06\xd0\xb1\x46\xd2\x2f" "\x49\xc4\x40\x44\xfc\x16\x11\x83\xd5\xec\xc6\x02\x23\xd5\x6f\xd7\xd7\x96" "\xa7\xff\x59\x5b\x9e\x4e\xa2\x5c\x7e\xe3\xaf\xa4\x52\xee\xda\xda\xf2\x74" "\x5e\x34\xff\xb9\x83\xd5\x4c\xb9\x9c\xe5\x7b\xeb\xd4\xbb\xfa\x4e\xc4\x54" "\xa9\x34\x7b\x39\xcb\x8f\x2f\x5e\x7c\x7f\x7c\x61\xe9\xca\xb3\x73\x17\xa7" "\xce\xcf\x9e\x9f\xbd\x34\x79\xee\xdc\xe9\x53\xc7\x7b\xce\x4e\x9e\x69\x49" "\x9c\x69\x5c\xd7\x86\x3f\x9a\x3f\x76\xf4\x95\xb7\xbf\x78\xed\xc6\xfe\x81" "\xec\x7b\x6d\x1c\xad\x32\x52\x3d\xbb\x75\x3d\x51\xf9\xda\xd7\xea\x2a\xdb" "\xe6\x50\x4d\x3a\xe9\x6a\x63\x43\xd8\x91\x62\x44\xa4\x97\xab\xbb\xd2\xff" "\x07\xa3\x18\xfd\xeb\xc7\x06\xe3\xe5\x4f\xdb\xda\x38\xe0\x96\x2a\x97\xcb" "\xe5\x7a\xef\xcf\x99\x95\x32\x70\x17\x4b\xa2\xdd\x2d\x00\xda\x23\x7f\xa3" "\x4f\x9f\x7f\xf3\x6d\x9f\x86\x1e\xb7\x85\xab\x2f\x54\x1f\x80\xd2\xb8\xaf" "\x67\x5b\xf5\x48\x57\x14\xb2\x32\xdd\x9b\x9e\x6f\x5b\x69\x24\x22\xde\x5a" "\xf9\xf7\xeb\x74\x8b\x5b\x34\x0f\x01\x00\x50\xeb\xfb\x74\xfc\xf3\x4c\xbd" "\xf1\x5f\x21\x1e\xa8\x29\x77\x4f\xb6\x86\x32\x14\x11\xf7\x46\xc4\xe1\x88" "\xb8\x2f\x22\x8e\x44\xc4\xfd\x11\x95\xb2\x0f\x46\xc4\x43\x3b\xaa\xbd\x6f" "\xcb\x0a\xc9\x7e\x8f\x7f\xd2\xf1\xdf\xf3\xd9\xda\xd6\xc6\xf1\x5f\x3e\xfa" "\x8b\xa1\x62\x96\x3b\x54\x89\xbf\x3b\x79\x77\xae\x34\x7b\x32\x3b\x27\xa3" "\xd1\xdd\x9b\xe6\x27\xb6\xa9\xe3\x87\x97\x7e\xfd\xbc\xd1\xb1\xda\xf1\x5f" "\xba\xa5\xf5\xe7\x63\xc1\xac\x1d\x7f\x76\x6d\x9a\xa0\x9b\x99\x5a\x9c\xda" "\x4b\xcc\xb5\xae\x7e\x12\x31\xdc\x55\x2f\xfe\x24\xf2\x65\x9c\x24\x22\x8e" "\x46\xc4\xf0\x2e\xeb\x98\x7b\xea\xdb\x63\x8d\x8e\xdd\x3c\xfe\x6d\xb4\x60" "\x9d\xa9\xfc\x4d\xc4\x93\xd5\xeb\xbf\x12\x9b\xe2\xcf\x25\x0d\xd7\x27\x27" "\x9e\x3b\x3b\x79\x66\xbc\x2f\x4a\xb3\x27\xc7\xf3\xbb\x62\xab\x9f\x7f\x59" "\x7d\xbd\x51\xfd\x7b\x8a\xbf\x05\xd2\xeb\x7f\x20\xbb\xff\x37\xae\x46\xae" "\xc7\x3f\x94\xf4\x45\x2c\x7c\x75\xe5\x42\x65\xbd\x76\x61\xdb\x5f\xf7\xf7" "\xc6\xa7\xca\xaa\xd5\xdf\x3f\x6b\xd8\xa7\x77\x7b\xff\xf7\x24\x6f\x56\xd2" "\x3d\xd9\xbe\x0f\xa7\x16\x17\x2f\x4f\x44\xf4\x24\xaf\x6e\xdd\x3f\x79\xe3" "\x67\xf3\x7c\x5e\x3e\x8d\x7f\xf4\x44\xfd\xfe\x7f\xb8\xe6\x4c\x3c\x1c\x11" "\xe9\x4d\x7c\x7c\xfd\x37\x0d\x54\xda\xfe\x68\x44\x3c\x16\x11\x27\xb6\x39" "\x29\x3f\xbd\xf8\xf8\x7b\x79\x7a\xf3\x8a\x6f\xe3\xf8\xb7\x99\x95\x6f\xa1" "\x34\xfe\x99\xba\xaf\x7f\x35\xd7\x3f\x22\x16\x96\xf2\xeb\xff\x48\x9e\x58" "\x6a\x36\x51\xbc\xf0\xe3\x77\x8d\xea\x6f\xee\xfa\x9f\xae\xa4\x46\xb3\x3d" "\xcd\xbc\xfe\x35\xdb\xc0\xbd\x9c\x3b\x00\x00\x00\xb8\x53\x14\x2a\x33\x19" "\x49\x61\x6c\x3d\x5d\x28\x8c\x8d\x55\xff\x86\xff\x48\x1c\x28\x94\xe6\x17" "\x16\x9f\xee\x9f\xff\xe0\xd2\x4c\xf5\x6f\xe5\x87\xa2\xbb\x90\xcf\x74\x0d" "\xd6\xcc\x87\x4e\x64\x73\xc3\x79\x7e\x72\x53\xfe\x54\x36\x6f\xfc\x65\xb1" "\xbf\x92\x1f\x9b\x9e\x2f\xcd\xb4\x3b\x78\xe8\x70\x07\x1b\xf4\xff\xd4\x1f" "\xc5\x88\xf8\x6f\xcb\x74\x2e\x70\x37\xf1\xff\x5a\xd0\xb9\xf4\x7f\xe8\x5c" "\xfa\x3f\x74\x2e\xfd\x1f\x3a\x97\xfe\x0f\x9d\xab\x5e\xff\xff\xb8\x0d\xed" "\x00\xf6\x9f\xf7\x7f\xe8\x5c\xfa\x3f\x74\x2e\xfd\x1f\x3a\x97\xfe\x0f\x1d" "\xa9\xe1\xff\xc6\x17\x1a\x1f\xda\x9f\xc4\xce\x3f\x67\x40\x62\x3f\x13\x51" "\xb8\x2d\x9a\x71\x87\x26\x0a\xd1\x74\xe1\xae\xa6\x3f\xcc\x62\x97\x89\xde" "\xba\x87\xda\xfd\xca\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd0" "\x1a\xff\x07\x00\x00\xff\xff\x18\xa9\xe3\xf9", 1109); syz_mount_image( /*fs=*/0x20000080, /*dir=*/0x20000440, /*flags=MS_I_VERSION|MS_SLAVE|MS_PRIVATE|MS_POSIXACL|MS_RELATIME|MS_NOSUID|0xc0400004*/ 0xc0ed0006, /*opts=*/0x20000740, /*chdir=*/0x7e, /*size=*/0x455, /*img=*/0x20000940); memcpy((void*)0x20000000, "./file0\000", 8); syscall(__NR_chdir, /*dir=*/0x20000000ul); memcpy((void*)0x20000040, "./bus\000", 6); syscall(__NR_creat, /*file=*/0x20000040ul, /*mode=*/0ul); memcpy((void*)0x20000380, "/dev/loop", 9); *(uint8_t*)0x20000389 = 0x30; *(uint8_t*)0x2000038a = 0; memcpy((void*)0x20000140, "./bus\000", 6); syscall(__NR_mount, /*src=*/0x20000380ul, /*dst=*/0x20000140ul, /*type=*/0ul, /*flags=MS_BIND*/ 0x1000ul, /*data=*/0ul); memcpy((void*)0x20000080, "./bus\000", 6); res = syscall(__NR_open, /*file=*/0x20000080ul, /*flags=O_SYNC|O_NOCTTY|O_DIRECT|O_CLOEXEC|O_RDWR*/ 0x185102ul, /*mode=*/0ul); if (res != -1) r[0] = res; memcpy((void*)0x20000180, "memory.events\000", 14); syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x20000180ul, /*flags=*/0x26e1ul, /*mode=*/0ul); syscall(__NR_mmap, /*addr=*/0x20000000ul, /*len=*/0xb36000ul, /*prot=PROT_WRITE*/ 2ul, /*flags=MAP_STACK|MAP_POPULATE|MAP_FIXED|MAP_SHARED*/ 0x28011ul, /*fd=*/r[0], /*offset=*/0ul); memcpy((void*)0x20000580, "ext4\000", 5); memcpy((void*)0x200005c0, "./file0\000", 8); memcpy((void*)0x20000240, "debug", 5); *(uint8_t*)0x20000245 = 0x2c; memcpy((void*)0x20000246, "orlov", 5); *(uint8_t*)0x2000024b = 0x2c; memcpy((void*)0x2000024c, "nomblk_io_submit", 16); *(uint8_t*)0x2000025c = 0x2c; memcpy((void*)0x2000025d, "block_validity", 14); *(uint8_t*)0x2000026b = 0x2c; memcpy((void*)0x2000026c, "debug_want_extra_isize", 22); *(uint8_t*)0x20000282 = 0x3d; sprintf((char*)0x20000283, "0x%016llx", (long long)6); *(uint8_t*)0x20000295 = 0x2c; memcpy((void*)0x20000296, "init_itable", 11); *(uint8_t*)0x200002a1 = 0x3d; sprintf((char*)0x200002a2, "0x%016llx", (long long)0); *(uint8_t*)0x200002b4 = 0x2c; memcpy((void*)0x200002b5, "usrquota", 8); *(uint8_t*)0x200002bd = 0x2c; memcpy((void*)0x200002be, "usrquota", 8); *(uint8_t*)0x200002c6 = 0x2c; *(uint8_t*)0x200002c7 = 0; memcpy( (void*)0x20001bc0, "\x78\x9c\xec\xdd\xcd\x6f\x54\x55\x1b\x00\xf0\xe7\x4c\x3f\x28\x94\xf7\x6d" "\x21\x46\xc5\x85\x34\x31\x06\x12\xa5\xa5\x05\x0c\x31\x2e\x60\x4f\x1a\xfc" "\x88\x1b\x37\x56\x5a\x08\x52\xa0\xa1\x35\x5a\x34\xb1\x24\xb8\x31\x31\x6e" "\x8c\x31\x71\xe5\x42\xfc\x2f\x94\xc8\x96\x95\xae\x5c\xb8\x71\x65\x48\x88" "\x1a\x96\x26\x8e\xb9\x33\x73\x4b\x5b\xee\xb4\xb4\x4c\x7b\x2b\xf7\xf7\x4b" "\x86\xde\x7b\xce\x5c\xce\x73\x3b\x7d\x7a\xee\x9c\x9e\x73\x27\x80\xca\x1a" "\xca\xfe\xa9\x45\xec\x8b\x88\x99\x14\x31\x90\x16\x16\xeb\xba\xa3\x55\x39" "\xd4\x7c\xde\xbd\xbf\x3e\x3a\x93\x3d\x52\xd4\xeb\xaf\xff\x91\x22\xb5\xca" "\xf2\xe7\xa7\xd6\xd7\xfe\xd6\xc1\x7d\x11\xf1\xd3\x8f\x29\xf6\x76\x3d\xd8" "\xee\xec\xfc\xd5\x0b\x13\xd3\xd3\x53\x57\x5a\xfb\x23\x73\x17\x67\x46\x66" "\xe7\xaf\x1e\x3a\x7f\x71\xe2\xdc\xd4\xb9\xa9\x4b\x63\x2f\x8d\x1d\x3f\x76" "\xf4\xd8\xf1\xd1\xc3\x1d\x3b\xd7\x53\xd7\xdf\x7d\x7f\xe0\xd3\xf1\xb7\xbe" "\xfd\xfa\xef\x34\xfa\xdd\xaf\xe3\x29\x4e\xc4\xee\x56\xdd\xd2\xf3\xe8\x94" "\xa1\x18\x6a\x7e\x4f\x76\x2c\x2f\xcf\xbe\xaf\xc7\x3b\xdd\x58\x49\xba\x5a" "\xe7\xb3\xf4\x25\x4e\xdd\x25\x06\xc4\xba\xe4\xaf\x5f\x4f\x44\x3c\x15\x03" "\xd1\x15\xf7\x5f\xbc\x81\xf8\xe4\xd5\x52\x83\x03\x36\x55\x3d\x45\xd4\x81" "\x8a\x4a\xf2\x1f\x2a\x2a\xbf\x0e\xc8\xdf\xdb\xaf\x7c\x1f\x5c\x2b\xe5\xaa" "\x04\xd8\x0a\x77\x4f\x36\x07\x00\x1e\xcc\xff\xee\xe6\xd8\x60\xf4\x35\xc6" "\x06\x76\xdd\x4b\xb1\x74\x58\x27\x45\x44\x27\x46\xe6\xb2\x36\x6e\xdf\x1a" "\xbf\x7e\xf6\xd6\xf8\xf5\xd8\xa4\x71\x38\xa0\xd8\xc2\xb5\x88\x78\xba\x28" "\xff\x53\x23\x37\x07\x1b\xa3\xf8\x59\xfe\xd7\x96\xe5\x7f\x76\x5d\x70\xba" "\xf5\x35\x2b\x7f\x6d\x83\xed\x0f\xad\xd8\x97\xff\xb0\x75\x9a\xf9\xdf\xb7" "\xa1\xfc\x7f\x7b\x49\xfe\xbf\xb3\xc1\xf6\xe5\x3f\x00\x00\x00\x00\x00\x00" "\x74\xce\xcd\x93\x11\xf1\x62\xd1\xdf\xff\x6b\x8b\xf3\x7f\xa2\x60\xfe\x4f" "\x7f\x44\x9c\xe8\x40\xfb\x6b\xff\xfd\xaf\x76\xa7\x03\xcd\x00\x05\xee\x9e" "\x8c\x78\xa5\x70\xfe\x6f\x2d\x9f\xfd\x3b\xd8\xd5\xda\xfa\x5f\x63\x3e\x40" "\x4f\x3a\x7b\x7e\x7a\xea\x70\x44\xfc\x3f\x22\x0e\x46\xcf\x8e\x6c\x7f\x74" "\x95\x36\x0e\x7d\xb6\xf7\xab\x76\x75\xf9\xfc\xbf\xfc\x91\xb5\x7f\xbb\x35" "\x17\xb0\x15\xc7\x9d\xee\x15\xeb\x67\x27\x27\xe6\x26\x1e\xf5\xbc\x81\x88" "\xbb\xd7\x22\x9e\x29\x9c\xff\x9b\x16\xfb\xff\x54\xd0\xff\x67\xbf\x0f\x66" "\x1e\xb2\x8d\xbd\xcf\xdf\x38\xdd\xae\x6e\xed\xfc\x07\x36\x4b\xfd\x9b\x88" "\x03\x85\xfd\x7f\x5a\x7c\x4e\x5a\xfd\xfe\x1c\x23\x8d\xeb\x81\x91\xfc\xaa" "\xe0\x41\xcf\x7e\xf8\xf9\xf7\xed\xda\x97\xff\x50\x9e\xac\xff\xdf\xb5\x7a" "\xfe\x0f\xa6\xa5\xf7\xeb\x99\x5d\x7f\x1b\x47\xe6\xbb\xeb\xed\xea\x36\x7a" "\xfd\xdf\x9b\xde\x68\xdc\x72\xa6\xb7\x55\xf6\xc1\xc4\xdc\xdc\x95\xd1\x88" "\xde\x74\xaa\x2b\x2b\x5d\x56\x3e\xb6\xfe\x98\xe1\x71\x94\xe7\x43\x9e\x2f" "\x59\xfe\x1f\x7c\x6e\xf5\xf1\xbf\xa2\xeb\xff\x9d\x11\xb1\xb0\xe2\xff\x4e" "\x7f\x2e\x5f\x53\x9c\x7b\xf2\x9f\xfe\xdf\xda\xc5\xa3\xff\x87\xf2\x64\xf9" "\x3f\xb9\xae\xfe\x7f\xfd\x1b\x63\x37\x06\x7f\x68\xd7\xfe\xc3\xf5\xff\x47" "\x1b\x7d\xfd\xc1\x56\x89\xf1\x3f\x68\xfa\x32\x4f\xd3\xde\xe5\xe5\x05\xe9" "\xd8\x5d\x54\xb5\xd5\xf1\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc0\xe3\xa0\x16\x11" "\xbb\x23\xd5\x86\x17\xb7\x6b\xb5\xe1\xe1\x88\xfe\x88\x78\x22\x76\xd5\xa6" "\x2f\xcf\xce\xbd\x70\xf6\xf2\x7b\x97\x26\xb3\xba\xc6\xe7\xff\xd7\xf2\x4f" "\xfa\x1d\x68\xee\xa7\xfc\xf3\xff\x07\x97\xec\x8f\xad\xd8\x3f\x12\x11\x7b" "\x22\xe2\x8b\xae\x9d\x8d\xfd\xe1\x33\x97\xa7\x27\xcb\x3e\x79\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd8\x26\xfa\xdb\xac\xff" "\xcf\xfc\xde\x55\x76\x74\xc0\xa6\xeb\x2e\x3b\x00\xa0\x34\x05\xf9\xff\x73" "\x19\x71\x00\x5b\x4f\xff\x0f\xd5\x25\xff\xa1\xba\xe4\x3f\x54\x97\xfc\x87" "\xea\x92\xff\x50\x5d\xf2\x1f\xaa\x4b\xfe\x43\x75\xc9\x7f\x00\x00\x00\x00" "\x00\x78\xac\xec\xd9\x7f\xf3\x97\x14\x11\x0b\x2f\xef\x6c\x3c\x32\xbd\xad" "\xba\x9e\x52\x23\x03\x36\x5b\xad\xec\x00\x80\xd2\xb8\xc5\x0f\x54\x97\xa9" "\x3f\x50\x5d\xde\xe3\x03\x69\x8d\xfa\xbe\xb6\x07\xad\x75\xe4\x6a\x66\xce" "\x3c\xc2\xc1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x50\x39\x07\xf6\x59" "\xff\x0f\x55\x65\xfd\x3f\x54\x97\xf5\xff\x50\x5d\xf9\xfa\xff\xfd\x25\xc7" "\x01\x6c\x3d\xef\xf1\x81\x58\x63\x25\x7f\xe1\xfa\xff\x35\x8f\x02\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x3a\x69\x76\xfe\xea\x85\x89\xe9\xe9\xa9" "\x2b\x36\xde\xdc\x1e\x61\x6c\xe5\x46\xbd\x5e\xff\x38\xfb\x29\xd8\x2e\xf1" "\xfc\xc7\x37\xf2\xa9\xf0\xdb\x25\x9e\x47\xda\x28\xf7\xf7\x12\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x70\xdf\xbf\x01" "\x00\x00\xff\xff\x64\x22\x26\xa6", 1466); syz_mount_image(/*fs=*/0x20000580, /*dir=*/0x200005c0, /*flags=MS_STRICTATIME|MS_SILENT*/ 0x1008000, /*opts=*/0x20000240, /*chdir=*/1, /*size=*/0x5ba, /*img=*/0x20001bc0); } 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; }