// https://syzkaller.appspot.com/bug?id=d7c3c31edf29f851c5935f32f68924a4d0f2543b // 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; } static long syz_open_procfs(volatile long a0, volatile long a1) { char buf[128]; memset(buf, 0, sizeof(buf)); if (a0 == 0) { snprintf(buf, sizeof(buf), "/proc/self/%s", (char*)a1); } else if (a0 == -1) { snprintf(buf, sizeof(buf), "/proc/thread-self/%s", (char*)a1); } else { snprintf(buf, sizeof(buf), "/proc/self/task/%d/%s", (int)a0, (char*)a1); } int fd = open(buf, O_RDWR); if (fd == -1) fd = open(buf, O_RDONLY); return fd; } //% 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[3] = {0xffffffffffffffff, 0xffffffffffffffff, 0x0}; void execute_one(void) { intptr_t res = 0; memcpy((void*)0x20000100, "ext4\000", 5); memcpy((void*)0x20000200, "./file1\000", 8); *(uint8_t*)0x20000640 = 0; memcpy( (void*)0x20000e00, "\x78\x9c\xec\xdd\xef\x6b\x24\x67\x1d\x00\xf0\xef\x4c\xb2\xd7\xbd\xbb\xd4" "\x6c\x55\xe4\x2c\xd8\x16\x5b\xb9\x2b\x72\xbb\x97\xc6\xb6\x51\xa4\xad\x20" "\xfa\xaa\xa0\xd6\xf7\x67\x4c\xf6\x42\xc8\x26\x1b\xb2\x9b\x72\x09\x45\x53" "\x8a\xaf\x05\x11\x2b\xf8\x07\x88\x20\xf8\x07\x08\xd2\x3f\x41\x84\x82\xbe" "\x17\x15\x45\xf4\xaa\x6f\xed\xc8\xcc\xce\x6a\x7e\xec\x26\x7b\xcd\x8f\x3d" "\x36\x9f\x0f\xcc\xce\xf3\xcc\x33\x33\xdf\xe7\x19\x76\x67\xe7\xc7\xc3\x4c" "\x00\x97\xd6\x33\x11\xf1\x5a\x44\x4c\x45\xc4\xf3\x11\x31\x5b\x4e\x4f\xcb" "\xe1\x6e\x9e\xd9\xeb\xcd\xf7\xc1\x83\xb7\x96\xf2\x21\x89\x2c\x7b\xe3\x1f" "\x49\x24\xe5\xb4\xfe\xba\xf2\xfc\x74\x44\x5c\xef\x2d\x12\xd5\x88\xf8\xd6" "\xd7\x23\xbe\x9b\xf4\xca\x2b\xfb\xe2\x76\x76\x76\xd7\x16\x5b\xad\xe6\x56" "\x99\x6f\x74\xd7\x37\x1b\x9d\x9d\xdd\xdb\xab\xeb\x8b\x2b\xcd\x95\xe6\xc6" "\xfc\xfc\xdc\x4b\x0b\x2f\x2f\xbc\xb8\x70\x27\x2b\x9d\xaa\x9d\xb5\x88\x78" "\xe5\xab\x7f\xf9\xc9\x0f\x7f\xfe\xb5\x57\x7e\xf3\x83\xea\x1f\xef\xfe\xed" "\xd6\xf7\xf2\x6a\x7d\xf9\x53\xbd\x7a\x47\xc4\xd2\xa9\x02\x0c\xd1\x5b\x77" "\xa5\xd8\x16\x7d\xf9\x36\xda\x3a\x8f\x60\x63\x92\xb7\xa7\x32\x35\xee\x5a" "\x00\x00\x30\x8a\xfc\x18\xff\xe3\x11\xf1\xd9\xe2\xf8\x7f\x36\xa6\x8a\xa3" "\x39\x00\x00\x00\x60\x92\x64\xaf\xce\x14\xf7\xa8\x32\x00\x00\x00\x60\x62" "\xa5\x11\x31\x13\x49\x5a\x2f\xfb\x02\xcc\x44\x9a\xd6\xeb\xbd\x3e\xbc\x9f" "\x8c\x6b\x69\xab\xdd\xe9\x7e\xfe\x5e\x7b\x7b\x63\x39\x2f\x8b\xa8\x45\x25" "\xbd\xb7\xda\x6a\xde\x29\xfb\x0a\xd7\xa2\x92\xe4\xf9\xb9\xb2\x8f\x6d\x3f" "\xff\xc2\xa1\xfc\x7c\x44\x3c\x11\x11\x3f\x9e\xbd\x5a\xe4\xeb\x4b\xed\xd6" "\xf2\xb8\x2f\x7e\x00\x00\x00\xc0\x25\x71\xfd\xe9\x83\xe7\xff\xff\x9e\x4d" "\x8b\x34\x00\x00\x00\x30\x61\x6a\x43\x33\x00\x00\x00\xc0\xa4\x70\xca\x0f" "\x00\x00\x00\x93\xcf\xf9\x3f\x00\x00\x00\x4c\xb4\x6f\xbc\xfe\x7a\x3e\x64" "\xfd\xf7\x78\x2f\xbf\xb9\xb3\xbd\xd6\x7e\xf3\xf6\x72\xb3\xb3\x56\x5f\xdf" "\x5e\xaa\x2f\xb5\xb7\x36\xeb\x2b\xed\xf6\x4a\xf1\xcc\xbe\xf5\x93\xd6\xd7" "\x6a\xb7\x37\xbf\x10\x1b\xdb\xf7\x1b\xdd\x66\xa7\xdb\xe8\xec\xec\xde\x5d" "\x6f\x6f\x6f\x74\xef\xae\x1e\x78\x05\x36\x00\x00\x00\x70\x81\x9e\x78\xfa" "\xbd\x3f\x24\x11\xb1\xf7\xa5\xab\xc5\x10\xe5\x73\x00\x4b\x53\xe3\xab\x19" "\xf0\x48\xf9\xf3\xb8\x2b\x00\x9c\x25\x7f\xf0\x70\x79\x4d\x8f\xbb\x02\xc0" "\xd8\x54\x4e\x9c\xc3\x1e\x02\x26\xd7\x2f\x8a\xcf\xe4\x84\xb9\x8e\x76\xde" "\xe9\x5d\x2b\x8c\xdf\x9e\x47\x9d\x00\x00\x80\xf3\x70\xf3\xd3\x47\xef\xff" "\x5f\x29\xcb\x0e\x5f\x1b\x70\xaf\x00\x26\x4b\x3a\xee\x0a\x00\x00\x17\xce" "\xdd\x3d\xb8\xbc\x2a\xfd\xb3\xfa\x2c\xcb\xb2\x87\x59\xf0\xc6\x39\x55\x08" "\xb8\x70\x1f\x2b\xc7\xc3\xfa\x01\xec\xbf\xff\xff\xee\xfe\xcc\x08\xf7\xff" "\x7b\xd7\x18\x1e\x6e\xf7\x02\x00\x00\x9c\xbd\x99\x62\x48\xd2\x7a\x79\x9c" "\x3e\x13\x69\x5a\xaf\x47\x3c\x5e\xbc\x16\xa0\x92\xdc\x5b\x6d\x35\xef\x94" "\xe7\x07\xbf\x9f\xad\x3c\x96\xe7\xe7\x8a\x25\x93\x13\xfb\x0c\x03\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3d" "\x59\x96\x14\x8f\xfe\x07\x00\x00\x00\x26\x57\x44\xfa\xd7\xa4\x7c\xef\xd7" "\xcd\xd9\xe7\x66\x0e\x5e\x1d\xa8\x1e\xcc\xfe\xec\x8d\x77\xef\x2f\x76\xbb" "\x5b\x73\x11\x57\x92\x7f\xce\xe6\x93\xae\x44\x44\xf7\xa7\xe5\xf4\x17\x32" "\xaf\x04\x00\x00\x00\x80\x47\x40\xef\x3c\xbd\x1c\xcf\x8d\xbb\x36\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x4c" "\x9a\x0f\x1e\xbc\xb5\xd4\x1f\x2e\x32\xee\xdf\xbf\x12\x11\xb5\x41\xf1\xa7" "\xa3\x5a\x8c\xab\x51\x89\x88\x6b\xff\x4a\x62\x7a\xdf\x72\x49\x44\x4c\x9d" "\x41\xfc\xbd\xb7\x23\xe2\xc6\xa0\xf8\x49\x7c\x98\x65\x59\xad\xac\xc5\xa0" "\xf8\x57\xcf\x39\x7e\xad\xd8\x34\x83\xe3\xa7\x11\x71\xfd\x0c\xe2\xc3\x65" "\xf6\x5e\xbe\xff\x79\x6d\xd0\xef\x2f\x8d\x67\x8a\xf1\xe0\xdf\xdf\x74\x39" "\x9c\xd6\xf0\xfd\x5f\xfa\xbf\xfd\xdf\xd4\x90\xfd\xcf\xe3\x87\xf2\xc3\x3c" "\xf9\xfe\xaf\x1a\x43\xe3\xbf\x1d\xf1\xe4\xf4\xe0\xfd\x4f\x3f\x7e\xd2\x8b" "\x7f\x20\x44\x9e\x79\x76\xc4\x36\x7e\xe7\xdb\xbb\xbb\x03\x0b\xf6\xad\x72" "\x50\xfc\xfd\xb1\x1a\xdd\xf5\xcd\x46\x67\x67\xf7\xf6\xea\xfa\xe2\x4a\x73" "\xa5\xb9\x31\x3f\x3f\xf7\xd2\xc2\xcb\x0b\x2f\x2e\xdc\x69\xdc\x5b\x6d\x35" "\xcb\xcf\x81\x61\x7e\xf4\x99\x5f\x7f\x78\x5c\xfb\xaf\x0d\x89\x5f\x3b\xd8" "\xfe\x23\xdb\xff\xb9\x91\x5a\x9f\xc5\x7f\xde\xbf\xff\xe0\x13\xbd\x4c\x65" "\x50\xfc\x5b\xcf\x0e\xfe\xff\xbd\x31\x24\x7e\x5a\xfe\xf7\x7d\xae\x4c\xe7" "\xe5\x37\xfb\xe9\xbd\x5e\x7a\xbf\xa7\x7e\xf9\xbb\xa7\x8e\x6b\xff\xf2\x90" "\xf6\x57\x4f\x68\xff\xad\x91\xda\x1f\x5f\x7c\xfe\x9b\xef\xfc\x69\x60\xc9" "\x91\xad\x01\x00\x5c\x84\xce\xce\xee\xda\x62\xab\xd5\xdc\x3a\x26\x51\x1d" "\x61\x9e\x0b\x4e\xbc\xfa\x68\x54\xe3\x0c\x13\x91\x27\x62\xec\xd5\x18\x57" "\x22\xfb\x7e\xef\xfb\x78\xba\xf5\x9c\x72\xf1\x23\x89\xec\xc4\x79\x1e\x1b" "\x5e\x34\x1d\x67\x50\x8d\x2b\x47\x7e\xa7\x53\x1f\xf9\x4b\x92\x44\xec\xe5" "\xeb\x1a\xf1\x0b\x09\x00\x00\x4c\x98\xff\x1f\xf4\x1f\x77\x07\x09\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x38\x4f\x23\x3c\x3c" "\xec\x9d\x38\x5a\x54\x8d\x88\x91\x9f\x3d\x76\x38\xe6\xde\x78\x9a\x0a\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\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\xac\xff\x06\x00\x00\xff\xff\xc2\x15\xd4\x5a", 1329); syz_mount_image( /*fs=*/0x20000100, /*dir=*/0x20000200, /*flags=MS_LAZYTIME|MS_SYNCHRONOUS|MS_STRICTATIME|MS_RDONLY|MS_NOSUID|0x4c*/ 0x300005f, /*opts=*/0x20000640, /*chdir=*/1, /*size=*/0x531, /*img=*/0x20000e00); memcpy((void*)0x20000080, "ext4\000", 5); memcpy((void*)0x20000500, "./file1\000", 8); memcpy((void*)0x20000140, "init_itable", 11); *(uint8_t*)0x2000014b = 0x2c; memcpy((void*)0x2000014c, "noquota", 7); *(uint8_t*)0x20000153 = 0x2c; memcpy((void*)0x20000154, "nouid32", 7); *(uint8_t*)0x2000015b = 0x2c; memcpy((void*)0x2000015c, "barrier", 7); *(uint8_t*)0x20000163 = 0x2c; memcpy((void*)0x20000164, "noauto_da_alloc", 15); *(uint8_t*)0x20000173 = 0x2c; memcpy((void*)0x20000174, "journal_dev", 11); *(uint8_t*)0x2000017f = 0x3d; sprintf((char*)0x20000180, "0x%016llx", (long long)0x1ff); *(uint8_t*)0x20000192 = 0x2c; memcpy((void*)0x20000193, "barrier", 7); *(uint8_t*)0x2000019a = 0x2c; memcpy((void*)0x2000019b, "delalloc", 8); *(uint8_t*)0x200001a3 = 0x2c; memcpy((void*)0x200001a4, "usrquota", 8); *(uint8_t*)0x200001ac = 0x2c; *(uint8_t*)0x200001ad = 0; memcpy( (void*)0x20000ec0, "\x78\x9c\xec\xdd\xcf\x6b\x1c\x6f\x19\x00\xf0\x67\x36\xd9\x6f\x7f\xa5\x26" "\x55\x0f\xb5\x60\x5b\x6c\x25\x2d\xda\xdd\xa4\xb1\x6d\xf0\x50\x2b\x88\x3d" "\x48\x41\xad\xf7\x1a\x93\x4d\x08\xd9\x64\x43\x76\xd3\x36\xa1\x48\x8a\x77" "\x05\x11\x15\x3c\x79\xf2\x22\xf8\x07\x08\xd2\x3f\x41\x84\x82\xde\xa5\x8a" "\x22\xda\xea\xc1\x83\xba\xb2\xb3\xb3\x9a\xa6\xbb\xdd\x7c\xe9\x66\xa7\x24" "\x9f\x0f\x4c\xe7\x7d\x67\x76\xf6\x79\xde\xb6\xfb\xee\xbc\x33\x2f\x3b\x01" "\x1c\x59\x17\x23\xe2\x4e\x44\x8c\x44\xc4\xd5\x88\x18\xcf\xb6\x17\xb2\xe5" "\x6e\xab\xb2\xd3\x7e\xdd\xab\x97\x4f\xe6\x5b\x4b\x12\xcd\xe6\xfd\xbf\x26" "\x91\x64\xdb\x3a\xef\x95\x64\xeb\x53\xed\x43\xe2\x78\x44\x7c\xfd\x6e\xc4" "\xb7\x92\x37\xe3\xd6\xb7\xb6\x57\xe6\xaa\xd5\xca\x46\x56\x2f\x37\x56\xd7" "\xcb\xf5\xad\xed\x6b\xcb\xab\x73\x4b\x95\xa5\xca\xda\xcc\xcc\xf4\xcd\xd9" "\x5b\xb3\x37\x66\xa7\x06\xd2\xce\x89\x88\xb8\xfd\xa5\x3f\xfe\xf0\x7b\x3f" "\xfb\xf2\xed\x5f\x7d\xf6\xd1\xef\x1f\xfc\xf9\xca\xb7\x5b\x69\x8d\x65\xfb" "\x77\xb7\x63\x90\xda\x4d\x2f\xa6\x7f\x17\x1d\xa3\x11\xb1\x71\x10\xc1\x72" "\x30\x92\xad\x8b\x3d\xf6\x7f\x77\x64\x88\xc9\x00\x00\xd0\x57\xeb\x1c\xff" "\xa3\x11\xf1\xa9\xf4\xfc\x7f\x3c\x46\xd2\xb3\x53\x00\x00\x00\xe0\x30\x69" "\x7e\x61\x2c\xfe\x95\x44\x34\x01\x00\x00\x80\x43\xab\x90\xce\x81\x4d\x0a" "\xa5\x6c\x2e\xc0\x58\x14\x0a\xa5\x52\x7b\x0e\xef\xc7\xe3\x64\xa1\x5a\xab" "\x37\x3e\xb3\x58\xdb\x5c\x5b\x68\xcf\x95\x9d\x88\x62\x61\x71\xb9\x5a\x99" "\xca\xe6\x0a\x4f\x44\x31\x69\xd5\xa7\xb3\x39\xb6\x9d\xfa\xf5\x3d\xf5\x99" "\x88\x38\x13\x11\x3f\x18\x3f\x91\xd6\x4b\xf3\xb5\xea\x42\xde\x17\x3f\x00" "\x00\x00\xe0\x88\x38\xb5\x67\xfc\xff\x8f\xf1\x74\xfc\x7f\x2c\xef\xbc\x00" "\x00\x00\x80\x01\x9b\xc8\x3b\x01\x00\x00\x00\xe0\xc0\x19\xff\x03\x00\x00" "\xc0\xe1\x67\xfc\x0f\x00\x00\x00\x87\xda\x57\xef\xdd\x6b\x2d\xcd\xce\xf3" "\xaf\x17\x1e\x6e\x6d\xae\xd4\x1e\x5e\x5b\xa8\xd4\x57\x4a\xab\x9b\xf3\xa5" "\xf9\xda\xc6\x7a\x69\xa9\x56\x5b\x4a\x7f\xb3\x6f\xb5\xdf\xfb\x55\x6b\xb5" "\xf5\xcf\xc5\xda\xe6\xe3\x72\xa3\x52\x6f\x94\xeb\x5b\xdb\x0f\x56\x6b\x9b" "\x6b\x8d\x07\xcb\xaf\x3d\x02\x1b\x00\x00\x00\x18\xa2\x33\x17\x9e\xfd\x2e" "\x89\x88\x9d\xcf\x9f\x48\x97\x96\x0f\xf2\x4e\x0a\x18\x8a\xa4\xcf\xfe\xf4" "\x21\x21\x2f\xb2\xca\x1f\x86\x90\x10\x30\x34\x23\x79\x27\x00\xe4\x66\x34" "\xef\x04\x80\xdc\x14\xf3\x4e\x00\xc8\x5d\xbf\xeb\x00\x3d\x27\xef\xfc\x7a" "\xf0\xb9\x00\x00\x00\x07\x63\xf2\x13\xbd\xef\xff\xbb\x36\x00\x87\x5b\x21" "\xef\x04\x00\x80\xa1\x73\xff\x1f\x8e\xae\xa2\x19\x80\x70\xe4\x7d\xa4\xcf" "\xfe\x77\xbf\xff\xdf\x6c\x7e\xa8\x84\x00\x00\x80\x81\x1b\x4b\x97\xa4\x50" "\xca\xee\x05\x8e\x45\xa1\x50\x2a\x45\x9c\x4e\x1f\x0b\x50\x4c\x16\x97\xab" "\x95\xa9\x6c\x7c\xf0\xdb\xf1\xe2\xb1\x56\x7d\x3a\x3d\x32\xe9\x3b\x67\x18" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x68\x6b\x36\x93\x68\x02\x00\x00\x00\x87\x5a\x44\xe1\x4f\x49\xfa\x6b" "\xfe\x11\x93\xe3\x97\xc7\xf6\x5e\x1f\xf8\x20\xf9\xe7\x78\xba\x8e\x88\x47" "\x3f\xb9\xff\xa3\xc7\x73\x8d\xc6\xc6\x74\x6b\xfb\xdf\xfe\xb7\xbd\xf1\xe3" "\x6c\xfb\xf5\x3c\xae\x60\x00\x00\x00\x00\x7b\x75\xc6\xe9\x9d\x71\x3c\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x0c\xd2\xab\x97\x4f\xe6\x3b\xcb\x30\xe3\xfe\xe5\x8b\x11\x31\xd1\x35\xfe" "\x85\xe3\xe9\xea\x78\x14\x23\xe2\xe4\xdf\x93\x18\xdd\x75\x5c\x12\x11\x23" "\x03\x88\xbf\xf3\x34\x22\xce\x76\x8b\x9f\xb4\xd2\x8a\x89\x68\x67\xd1\x2d" "\xfe\x89\x1c\xe3\x17\x22\xe2\xd4\x00\xe2\xc3\x51\xf6\xac\xd5\xff\xdc\xe9" "\xf6\xf9\x2b\xc4\xc5\x74\xdd\xfd\xf3\x37\x9a\x2d\xef\xaa\x77\xff\x57\x88" "\x4e\xff\x37\xb2\x2b\x7e\x31\x3b\xae\xd5\xff\x9c\xde\x67\x8c\x73\xcf\x7f" "\x51\xee\x19\xff\x69\xc4\xb9\xd1\xee\xfd\x4f\x27\x7e\xd2\xa3\xff\xbb\xb4" "\xcf\xf8\xdf\xfc\xc6\xf6\x76\xaf\x7d\xcd\x9f\x46\x4c\x76\xfd\xfe\x49\x5e" "\x8b\x55\x6e\xac\xae\x97\xeb\x5b\xdb\xd7\x96\x57\xe7\x96\x2a\x4b\x95\xb5" "\x99\x99\xe9\x9b\xb3\xb7\x66\x6f\xcc\x4e\x95\x17\x97\xab\x95\xec\xcf\xae" "\x31\xbe\xff\xc9\x5f\xfe\xe7\x6d\xed\x3f\xd9\x23\xfe\x44\x9f\xf6\x5f\xde" "\x67\xfb\xff\xfd\xfc\xf1\xcb\x8f\xb5\x8b\xc5\x6e\xf1\xaf\x5c\xea\xfe\xfd" "\x7b\xf6\xcd\xf8\x5f\x79\x94\xf5\xfd\xad\xff\x13\x9f\xce\xca\xad\xfd\x93" "\x9d\xf2\x4e\xbb\xbc\xdb\xf9\x9f\xff\xe6\xfc\xdb\xda\xbf\xd0\xa3\xfd\xfd" "\xfe\xfd\xaf\xec\xb3\xfd\x57\xbf\xf6\x9d\x17\xfb\x7c\x29\x00\x30\x04\xf5" "\xad\xed\x95\xb9\x6a\xb5\xb2\xf1\xde\x17\x62\x27\xe2\x3d\x48\x43\xe1\xa0" "\x0a\xc7\xde\x8f\x34\x14\xda\x85\xbc\x7b\x26\x00\x00\x60\xd0\xfe\x7f\xd2" "\x9f\x77\x26\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x70\x74\x0d\xe3\xe7\xc4\xf6\xc6\xdc\xc9\xa7\xa9\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6f" "\xf5\xdf\x00\x00\x00\xff\xff\xdb\xbd\xda\x8c", 1235); syz_mount_image(/*fs=*/0x20000080, /*dir=*/0x20000500, /*flags=MS_REC|MS_NOATIME|0x100*/ 0x4500, /*opts=*/0x20000140, /*chdir=*/0x10, /*size=*/0x4d3, /*img=*/0x20000ec0); memcpy((void*)0x20004280, "./file0\000", 8); res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x20004280ul, /*flags=*/0ul, /*mode=*/0ul); if (res != -1) r[0] = res; memcpy((void*)0x20001840, "net/raw6\000", 9); res = -1; res = syz_open_procfs(/*pid=*/0, /*file=*/0x20001840); if (res != -1) r[1] = res; res = syscall(__NR_read, /*fd=*/r[1], /*buf=*/0x20001880ul, /*len=*/0x2020ul); if (res != -1) r[2] = *(uint32_t*)0x20001890; syscall(__NR_fchown, /*fd=*/r[0], /*uid=*/r[2], /*gid=*/0); } 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; }