// https://syzkaller.appspot.com/bug?id=d6b034154398dfd2445bbab80b1de0efd67f7f91 // 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 #include #include #include #include #ifndef __NR_memfd_create #define __NR_memfd_create 279 #endif #ifndef __NR_mmap #define __NR_mmap 222 #endif #ifndef __NR_mprotect #define __NR_mprotect 226 #endif #ifndef __NR_openat #define __NR_openat 56 #endif #ifndef __NR_quotactl #define __NR_quotactl 60 #endif static unsigned long long procid; static __thread int clone_ongoing; static __thread int skip_segv; static __thread jmp_buf segv_env; static void segv_handler(int sig, siginfo_t* info, void* ctx) { if (__atomic_load_n(&clone_ongoing, __ATOMIC_RELAXED) != 0) { exit(sig); } uintptr_t addr = (uintptr_t)info->si_addr; const uintptr_t prog_start = 1 << 20; const uintptr_t prog_end = 100 << 20; int skip = __atomic_load_n(&skip_segv, __ATOMIC_RELAXED) != 0; int valid = addr < prog_start || addr > prog_end; if (skip && valid) { _longjmp(segv_env, 1); } exit(sig); } static void install_segv_handler(void) { struct sigaction sa; memset(&sa, 0, sizeof(sa)); sa.sa_handler = SIG_IGN; syscall(SYS_rt_sigaction, 0x20, &sa, NULL, 8); syscall(SYS_rt_sigaction, 0x21, &sa, NULL, 8); memset(&sa, 0, sizeof(sa)); sa.sa_sigaction = segv_handler; sa.sa_flags = SA_NODEFER | SA_SIGINFO; sigaction(SIGSEGV, &sa, NULL); sigaction(SIGBUS, &sa, NULL); } #define NONFAILING(...) \ ({ \ int ok = 1; \ __atomic_fetch_add(&skip_segv, 1, __ATOMIC_SEQ_CST); \ if (_setjmp(segv_env) == 0) { \ __VA_ARGS__; \ } else \ ok = 0; \ __atomic_fetch_sub(&skip_segv, 1, __ATOMIC_SEQ_CST); \ ok; \ }) 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; } #define MAX_FDS 30 //% 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"); } else if (strncmp(fs, "gfs2", 4) == 0 && (strstr(opts, "errors=panic") || strstr(opts, "debug"))) { strcat(opts, ",errors=withdraw"); } res = mount(source, target, fs, flags, opts); if (res == -1) { err = errno; goto error_clear_loop; } res = open(target, O_RDONLY | O_DIRECTORY); if (res == -1) { err = errno; goto error_clear_loop; } if (change_dir) { res = chdir(target); if (res == -1) { err = errno; } } error_clear_loop: if (need_loop_device) reset_loop_device(loopname); errno = err; return res; } static void setup_gadgetfs(); static void setup_binderfs(); static void setup_fusectl(); static void sandbox_common_mount_tmpfs(void) { write_file("/proc/sys/fs/mount-max", "100000"); if (mkdir("./syz-tmp", 0777)) exit(1); if (mount("", "./syz-tmp", "tmpfs", 0, NULL)) exit(1); if (mkdir("./syz-tmp/newroot", 0777)) exit(1); if (mkdir("./syz-tmp/newroot/dev", 0700)) exit(1); unsigned bind_mount_flags = MS_BIND | MS_REC | MS_PRIVATE; if (mount("/dev", "./syz-tmp/newroot/dev", NULL, bind_mount_flags, NULL)) exit(1); if (mkdir("./syz-tmp/newroot/proc", 0700)) exit(1); if (mount("syz-proc", "./syz-tmp/newroot/proc", "proc", 0, NULL)) exit(1); if (mkdir("./syz-tmp/newroot/selinux", 0700)) exit(1); const char* selinux_path = "./syz-tmp/newroot/selinux"; if (mount("/selinux", selinux_path, NULL, bind_mount_flags, NULL)) { if (errno != ENOENT) exit(1); if (mount("/sys/fs/selinux", selinux_path, NULL, bind_mount_flags, NULL) && errno != ENOENT) exit(1); } if (mkdir("./syz-tmp/newroot/sys", 0700)) exit(1); if (mount("/sys", "./syz-tmp/newroot/sys", 0, bind_mount_flags, NULL)) exit(1); if (mount("/sys/kernel/debug", "./syz-tmp/newroot/sys/kernel/debug", NULL, bind_mount_flags, NULL) && errno != ENOENT) exit(1); if (mount("/sys/fs/smackfs", "./syz-tmp/newroot/sys/fs/smackfs", NULL, bind_mount_flags, NULL) && errno != ENOENT) exit(1); if (mount("/proc/sys/fs/binfmt_misc", "./syz-tmp/newroot/proc/sys/fs/binfmt_misc", NULL, bind_mount_flags, NULL) && errno != ENOENT) exit(1); if (mkdir("./syz-tmp/newroot/syz-inputs", 0700)) exit(1); if (mount("/syz-inputs", "./syz-tmp/newroot/syz-inputs", NULL, bind_mount_flags | MS_RDONLY, NULL) && errno != ENOENT) exit(1); if (mkdir("./syz-tmp/pivot", 0777)) exit(1); if (syscall(SYS_pivot_root, "./syz-tmp", "./syz-tmp/pivot")) { if (chdir("./syz-tmp")) exit(1); } else { if (chdir("/")) exit(1); if (umount2("./pivot", MNT_DETACH)) exit(1); } if (chroot("./newroot")) exit(1); if (chdir("/")) exit(1); setup_gadgetfs(); setup_binderfs(); setup_fusectl(); } static void setup_gadgetfs() { if (mkdir("/dev/gadgetfs", 0777)) { } if (mount("gadgetfs", "/dev/gadgetfs", "gadgetfs", 0, NULL)) { } } static void setup_fusectl() { if (mount(0, "/sys/fs/fuse/connections", "fusectl", 0, 0)) { } } static void setup_binderfs() { if (mkdir("/dev/binderfs", 0777)) { } if (mount("binder", "/dev/binderfs", "binder", 0, NULL)) { } } static void loop(); static void sandbox_common() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); if (getppid() == 1) exit(1); struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = (200 << 20); setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 32 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 136 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); if (unshare(CLONE_NEWNS)) { } if (mount(NULL, "/", NULL, MS_REC | MS_PRIVATE, NULL)) { } if (unshare(CLONE_NEWIPC)) { } if (unshare(0x02000000)) { } if (unshare(CLONE_NEWUTS)) { } if (unshare(CLONE_SYSVSEM)) { } typedef struct { const char* name; const char* value; } sysctl_t; static const sysctl_t sysctls[] = { {"/proc/sys/kernel/shmmax", "16777216"}, {"/proc/sys/kernel/shmall", "536870912"}, {"/proc/sys/kernel/shmmni", "1024"}, {"/proc/sys/kernel/msgmax", "8192"}, {"/proc/sys/kernel/msgmni", "1024"}, {"/proc/sys/kernel/msgmnb", "1024"}, {"/proc/sys/kernel/sem", "1024 1048576 500 1024"}, }; unsigned i; for (i = 0; i < sizeof(sysctls) / sizeof(sysctls[0]); i++) write_file(sysctls[i].name, sysctls[i].value); } static int wait_for_loop(int pid) { if (pid < 0) exit(1); int status = 0; while (waitpid(-1, &status, __WALL) != pid) { } return WEXITSTATUS(status); } static void drop_caps(void) { struct __user_cap_header_struct cap_hdr = {}; struct __user_cap_data_struct cap_data[2] = {}; cap_hdr.version = _LINUX_CAPABILITY_VERSION_3; cap_hdr.pid = getpid(); if (syscall(SYS_capget, &cap_hdr, &cap_data)) exit(1); const int drop = (1 << CAP_SYS_PTRACE) | (1 << CAP_SYS_NICE); cap_data[0].effective &= ~drop; cap_data[0].permitted &= ~drop; cap_data[0].inheritable &= ~drop; if (syscall(SYS_capset, &cap_hdr, &cap_data)) exit(1); } static int do_sandbox_none(void) { if (unshare(CLONE_NEWPID)) { } int pid = fork(); if (pid != 0) return wait_for_loop(pid); sandbox_common(); drop_caps(); if (unshare(CLONE_NEWNET)) { } write_file("/proc/sys/net/ipv4/ping_group_range", "0 65535"); sandbox_common_mount_tmpfs(); loop(); exit(1); } #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 close_fds() { for (int fd = 3; fd < MAX_FDS; fd++) close(fd); } 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(); close_fds(); 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)) { } // syz_mount_image$ext4 arguments: [ // fs: ptr[in, buffer] { // buffer: {65 78 74 32 00} (length 0x5) // } // dir: ptr[in, buffer] { // buffer: {2e 2f 62 75 73 00} (length 0x6) // } // flags: mount_flags = 0x0 (8 bytes) // opts: ptr[in, fs_options[ext4_options]] { // fs_options[ext4_options] { // elems: array[fs_opt_elem[ext4_options]] { // fs_opt_elem[ext4_options] { // elem: union ext4_options { // nobh: buffer: {6e 6f 62 68} (length 0x4) // } // comma: const = 0x2c (1 bytes) // } // } // common: array[fs_opt_elem[fs_options_common]] { // } // null: const = 0x0 (1 bytes) // } // } // chdir: int8 = 0x1 (1 bytes) // size: len = 0x498 (8 bytes) // img: ptr[in, buffer] { // buffer: (compressed buffer with length 0x498) // } // ] // returns fd_dir NONFAILING(memcpy((void*)0x200002c0, "ext2\000", 5)); NONFAILING(memcpy((void*)0x20000000, "./bus\000", 6)); NONFAILING(memcpy((void*)0x20000080, "nobh", 4)); NONFAILING(*(uint8_t*)0x20000084 = 0x2c); NONFAILING(*(uint8_t*)0x20000085 = 0); NONFAILING(memcpy( (void*)0x20000300, "\x78\x9c\xec\xdc\xcb\x6f\x54\xd5\x1f\x00\xf0\xef\x9d\x3e\xa0\x3c\xfb\xe3" "\x87\x0f\x10\xb4\x8a\x0f\xe2\xa3\xa5\xe5\x21\x0b\x37\x1a\x17\x2e\x34\x31" "\xd1\x05\xea\xaa\xb6\x85\x54\x0a\x35\xb4\x26\x42\x88\x54\x17\x98\xb8\x31" "\x24\xee\x8d\x3b\x4d\xfc\x0b\x5c\x69\x4c\x8c\xba\x32\x71\xab\x7b\x43\x42" "\x0c\x1b\xc0\xd5\x35\x77\xee\xbd\x65\x3a\x9d\x19\x28\x0c\x9d\xda\xf9\x7c" "\x92\x0b\xe7\xcc\x3d\x77\xce\xf9\xce\xb9\xa7\x73\xee\x3d\x33\x13\x40\xd7" "\x1a\xca\xfe\x49\x22\xb6\x44\xc4\x1f\x11\xb1\x3d\xcf\x2e\x2d\x30\x94\xff" "\x77\xfd\xea\xf9\x89\x1b\x57\xcf\x4f\x24\x91\xa6\x6f\xfc\x9d\x54\xcb\x5d" "\xbb\x7a\x7e\xa2\x2c\x5a\x1e\xb7\x39\xcf\xa4\x69\x91\xdf\xd0\xa0\xde\x8b" "\xef\x44\x8c\xcf\xcc\x4c\x9d\x29\xf2\x23\xf3\xa7\xde\x1f\x99\x3b\x7b\xee" "\xb9\xe9\x53\xe3\x27\xa6\x4e\x4c\x9d\x1e\x3b\x7a\xf4\xd0\xc1\xbd\xfd\x47" "\xc6\x0e\xb7\x25\xce\x2c\xae\x6b\xbb\x3f\x9a\xdd\xb3\xeb\x95\xb7\x2e\xbd" "\x36\x71\xec\xd2\xbb\xbf\x7c\x9b\xb5\x77\x4b\xb1\xbf\x36\x8e\x52\xff\x5d" "\xd6\x39\x94\xbf\xba\x0d\x3d\x71\x97\xcf\xbd\xd6\x6c\xad\x49\x27\xbd\x1d" "\x6c\x08\x2b\xd2\x13\x11\x59\x77\xf5\x55\xc7\xff\xf6\xe8\x89\x81\xec\xe1" "\x27\xb7\xe5\xbb\x3f\x69\x3c\x7a\x81\xf5\x20\x4d\xd3\xb4\xc5\x08\x5f\x48" "\x81\x75\x2c\x89\x4e\xb7\x00\xe8\x8c\xf2\x8d\x3e\xbb\xfe\xad\x6e\x69\xb2" "\x4a\x33\x8f\xb5\xe1\xca\x8b\xf9\x05\x50\x16\xfb\xf5\x62\xcb\xf7\xf4\x46" "\xa5\x28\xd3\x57\x77\x7d\xdb\x4e\x43\x11\x71\x6c\xe1\x9f\x2f\xb3\x2d\x9a" "\xdc\x87\x00\x00\x68\xa7\xef\xb3\xf9\xcf\xb3\x35\xf3\xbf\xc5\xf9\x47\x25" "\xee\xaf\x29\xb7\xad\x58\x43\x19\x8c\x88\xff\x45\xc4\x8e\x88\xf8\x7f\x44" "\xec\x8c\x88\xfb\x22\xaa\x65\x1f\x88\x88\x07\x57\x58\x7f\xfd\x0a\xc9\xf2" "\xf9\x4f\xe5\xf2\x1d\x05\x76\x9b\xb2\xf9\xdf\x0b\xc5\xda\xd6\xd2\xf9\x5f" "\x39\xfb\x8b\xc1\x9e\x22\xb7\xb5\x1a\x7f\x5f\x72\x7c\x7a\x66\xea\x40\xf1" "\x9a\xec\x8f\xbe\x0d\x59\x7e\xb4\x2c\xdd\x60\xd1\xe8\x87\x97\x7f\xff\xbc" "\x59\xfd\xb5\xf3\xbf\x6c\xcb\xea\x2f\xe7\x82\x45\x3b\x2e\xf7\xd6\xdd\xa0" "\x9b\x1c\x9f\x1f\xaf\x4e\x4a\xdb\xe0\xca\xc7\x11\xbb\x7b\x1b\xc5\x9f\x44" "\xb9\x8c\x93\x5d\x11\xec\x8a\x88\xdd\x37\x0f\x5b\x58\x49\x1d\xd3\x4f\x7f" "\xb3\xa7\xd9\xbe\xa1\xb8\x91\xa6\x69\xab\xf8\x5b\x68\xc3\x3a\x53\xfa\x55" "\xc4\x53\x79\xff\x2f\x44\x5d\xfc\xa5\xa4\xe9\xfa\xe4\xe8\xf3\x47\xc6\x0e" "\x8f\x6c\x8c\x99\xa9\x03\x23\xe5\x59\xb1\xdc\xaf\xbf\x5d\x7c\xbd\x59\xfd" "\xb7\xea\xff\x7b\x7d\x35\x96\xf5\xff\xa6\x86\xe7\xff\x62\xcd\x83\xc9\xc6" "\x88\xb9\xb3\xe7\x4e\x56\xd7\x6b\xe7\x9a\x3c\x51\xed\xc5\x64\x9d\x8b\x7f" "\x7e\xda\xf4\x9a\xa6\x75\xfc\x69\xd3\xf3\xbf\x3f\x79\xb3\x9a\x2e\x87\xdb" "\x87\xe3\xf3\xf3\x67\x46\x23\xfa\x93\x57\x97\x3f\x3e\x76\xf3\xd8\x32\x5f" "\x96\xcf\xe2\xdf\xbf\xaf\xf1\xf8\xdf\x11\x37\x5f\x89\x87\x22\x22\x3b\x89" "\xf7\x46\xc4\xc3\x11\xf1\x48\xd1\xf6\x47\x23\xe2\xb1\x88\xd8\xd7\x2c\xc0" "\x88\xf8\xf9\xa5\xc7\xdf\x5b\x79\xfc\xab\xb3\xee\x96\xc5\x3f\x99\xf7\xff" "\xdb\x9f\xe5\x0f\x2d\xef\xff\xa8\xed\xff\xfa\x13\x61\xa1\xc1\xae\xa5\x89" "\x9e\x93\x3f\x7d\xd7\xac\xfe\x16\xfd\x7f\x21\x2f\x91\xf5\xff\xa1\x6a\x6a" "\x7f\x71\x4c\xf5\xef\xdf\x2d\xb4\x68\x4e\xa3\x20\x00\x00\x00\x60\x5d\xab" "\x54\x3f\x03\x9f\x54\x86\x17\xd3\x95\xca\xf0\x70\xfe\x19\xfe\x9d\xb1\xa9" "\x32\x33\x3b\x37\xff\xcc\xf1\xd9\x0f\x4e\x4f\xe6\x9f\x95\x1f\x8c\xbe\xca" "\xf1\xe9\x99\xa9\x81\xc5\xfb\xc1\xf9\xfd\xd0\xd1\xe2\xde\x70\x99\x1f\xab" "\xcb\x1f\x2c\xee\x1b\x7f\xd1\x33\x50\xcd\x0f\x4f\xcc\xce\x4c\x76\x3a\x78" "\xe8\x72\x9b\x9b\x8c\xff\xcc\x5f\x3d\x9d\x6e\x1d\x70\xcf\xf9\xbe\x16\x74" "\x2f\xe3\x1f\xba\x97\xf1\x0f\xdd\x2a\x31\xfe\xa1\x8b\x55\xc7\xff\xc6\x4e" "\xb7\x02\xe8\x84\x46\xef\xff\x17\x3a\xd0\x0e\x60\xf5\x99\xff\x43\xf7\x32" "\xfe\xa1\x3b\xfd\xf8\xb5\xf1\x0f\xdd\xec\x4e\xc7\xff\x40\x9b\xdb\x01\xac" "\xaa\xa6\xdf\x8d\xaf\x2c\xdd\x55\x89\x88\xdb\xfb\x46\xbd\xc4\x7a\x48\xdc" "\xfa\x07\x14\xa2\xb2\x46\x9a\xba\xb6\x12\xb1\x10\xd1\xde\x67\xee\x6d\xd6" "\x17\xf9\x08\x4e\xe2\x2e\xab\x48\xa2\xe1\xae\xd6\x7f\x37\xba\xeb\x57\x42" "\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\x80\xff\xb2\x7f\x03\x00\x00" "\xff\xff\x65\xfc\xdf\x74", 1176)); NONFAILING(syz_mount_image(/*fs=*/0x200002c0, /*dir=*/0x20000000, /*flags=*/0, /*opts=*/0x20000080, /*chdir=*/1, /*size=*/0x498, /*img=*/0x20000300)); // quotactl$Q_QUOTAON arguments: [ // cmd: quota_cmd_quota_on = 0xffffffff80000201 (8 bytes) // special: ptr[in, blockdev_filename] { // union blockdev_filename { // loop: loop_filename { // prefix: buffer: {2f 64 65 76 2f 6c 6f 6f 70} (length 0x9) // id: proc = 0x0 (1 bytes) // z: const = 0x0 (1 bytes) // } // } // } // id: uid (resource) // addr: nil // ] NONFAILING(memcpy((void*)0x20000180, "/dev/loop", 9)); NONFAILING(*(uint8_t*)0x20000189 = 0x30); NONFAILING(*(uint8_t*)0x2000018a = 0); syscall(__NR_quotactl, /*cmd=Q_QUOTAON_GRP*/ 0xffffffff80000201ul, /*special=*/0x20000180ul, /*id=*/0, /*addr=*/0ul); // mprotect arguments: [ // addr: VMA[0x3000] // len: len = 0x3000 (8 bytes) // prot: mmap_prot = 0x9 (8 bytes) // ] syscall(__NR_mprotect, /*addr=*/0x20000000ul, /*len=*/0x3000ul, /*prot=PROT_SEM|PROT_READ*/ 9ul); // openat$cgroup_ro arguments: [ // fd: fd_cgroup (resource) // file: ptr[in, buffer] { // buffer: {68 75 67 65 74 6c 62 2e 31 47 42 2e 75 73 61 67 65 5f 69 6e // 5f 62 79 74 65 73 00} (length 0x1b) // } // flags: const = 0x275a (4 bytes) // mode: const = 0x0 (2 bytes) // ] // returns fd NONFAILING(memcpy((void*)0x20000180, "hugetlb.1GB.usage_in_bytes\000", 27)); res = syscall(__NR_openat, /*fd=*/(intptr_t)-1, /*file=*/0x20000180ul, /*flags=*/0x275a, /*mode=*/0); if (res != -1) r[0] = res; // mmap arguments: [ // addr: VMA[0xb36000] // len: len = 0xb36000 (8 bytes) // prot: mmap_prot = 0xa (8 bytes) // flags: mmap_flags = 0x28011 (8 bytes) // fd: fd (resource) // offset: intptr = 0x0 (8 bytes) // ] syscall(__NR_mmap, /*addr=*/0x20000000ul, /*len=*/0xb36000ul, /*prot=PROT_SEM|PROT_WRITE*/ 0xaul, /*flags=MAP_STACK|MAP_POPULATE|MAP_FIXED|MAP_SHARED*/ 0x28011ul, /*fd=*/r[0], /*offset=*/0ul); // syz_mount_image$hfs arguments: [ // fs: ptr[in, buffer] { // buffer: {68 66 73 00} (length 0x4) // } // dir: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 30 00} (length 0x8) // } // flags: mount_flags = 0x12 (8 bytes) // opts: ptr[inout, array[ANYUNION]] { // array[ANYUNION] { // union ANYUNION { // ANYBLOB: buffer: {63 6f 64 65 70 61 67 65 3d 69 73 6f 38 38 35 39 // 2d 35 2c 75 6d 61 73 6b 3d 30 30 30 30 30 30 30 30 30 30 30 30 30 // 30 30 30 30 30 30 30 37 37 37 2c 69 6f 63 68 61 72 73 65 74 3d 63 // 70 38 36 39 2c 00 59 3e 6b 66 db da 70 1c 69 30 c6 2a 96 88 70 c6 // 71 f6 47 7c b1 45 c6 d8 9c c4 84 2e b0 72 0e ec df 2e bd 09 f8 db // f6 43 b0 ad ac e8 21 1e ff c5 9b 60 80 09 19 35 6a 98 8f c7 21 24 // c7 43 83 34 5c ff d7 c5 6c a2 93 57 0c 91 cd 0a 24 6a 89 57 8c 98 // a5 d7 ad ce 29 63 7c 11 81 f1 68 3d 5b 3c 23 1f c7 00 f5 a4 d5 ad // e9 2e 53 6e 6d 48 a3 3c 8f e7 19 6d 3c 21 f8 51 02 d7 1c 4a 75 7c // 81 1f 27 06 51 dd 6c fe 28 90 f2 65 0f ba a1 12 eb d9 f2 a7 22 f5 // 81 1f bf c1 b0 68 07 a0 e8 7b 42 b6 cc 7b bb 2f d4 95 cd cb 77 aa // ef 06 9c 17 41 93 a8 35 01 50 f8 6d 32 b8 6d 93 bb 71 ff 0a f7 0d // d2 40 bd f6 00 dc a5 28 99 a1 f6 4a 3c f2 35 0d d9 93 a7 02 35 3c // e0 d9 06 41 2f 63 01 a9 61 fe c3 04 95 36 17 4a 7c ad d6 be 69 70 // 4f f9 c8 e4 5b c9 2f 4c cd fc 76 26 eb d4 ad 65 aa 37 78 bb 67 97 // cb 9e 25 f8 03 25 f1 fa 59 03 d4 e6 cd e0 4b b0 be f0 7c 4f c5 a0 // 2f a2 1e 6a 0a 2a} (length 0x160) // } // } // } // chdir: int8 = 0x4 (1 bytes) // size: len = 0x339 (8 bytes) // img: ptr[in, buffer] { // buffer: (compressed buffer with length 0x339) // } // ] // returns fd_dir NONFAILING(memcpy((void*)0x20000000, "hfs\000", 4)); NONFAILING(memcpy((void*)0x20000100, "./file0\000", 8)); NONFAILING(memcpy( (void*)0x20001240, "\x63\x6f\x64\x65\x70\x61\x67\x65\x3d\x69\x73\x6f\x38\x38\x35\x39\x2d\x35" "\x2c\x75\x6d\x61\x73\x6b\x3d\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30" "\x30\x30\x30\x30\x30\x30\x30\x30\x30\x37\x37\x37\x2c\x69\x6f\x63\x68\x61" "\x72\x73\x65\x74\x3d\x63\x70\x38\x36\x39\x2c\x00\x59\x3e\x6b\x66\xdb\xda" "\x70\x1c\x69\x30\xc6\x2a\x96\x88\x70\xc6\x71\xf6\x47\x7c\xb1\x45\xc6\xd8" "\x9c\xc4\x84\x2e\xb0\x72\x0e\xec\xdf\x2e\xbd\x09\xf8\xdb\xf6\x43\xb0\xad" "\xac\xe8\x21\x1e\xff\xc5\x9b\x60\x80\x09\x19\x35\x6a\x98\x8f\xc7\x21\x24" "\xc7\x43\x83\x34\x5c\xff\xd7\xc5\x6c\xa2\x93\x57\x0c\x91\xcd\x0a\x24\x6a" "\x89\x57\x8c\x98\xa5\xd7\xad\xce\x29\x63\x7c\x11\x81\xf1\x68\x3d\x5b\x3c" "\x23\x1f\xc7\x00\xf5\xa4\xd5\xad\xe9\x2e\x53\x6e\x6d\x48\xa3\x3c\x8f\xe7" "\x19\x6d\x3c\x21\xf8\x51\x02\xd7\x1c\x4a\x75\x7c\x81\x1f\x27\x06\x51\xdd" "\x6c\xfe\x28\x90\xf2\x65\x0f\xba\xa1\x12\xeb\xd9\xf2\xa7\x22\xf5\x81\x1f" "\xbf\xc1\xb0\x68\x07\xa0\xe8\x7b\x42\xb6\xcc\x7b\xbb\x2f\xd4\x95\xcd\xcb" "\x77\xaa\xef\x06\x9c\x17\x41\x93\xa8\x35\x01\x50\xf8\x6d\x32\xb8\x6d\x93" "\xbb\x71\xff\x0a\xf7\x0d\xd2\x40\xbd\xf6\x00\xdc\xa5\x28\x99\xa1\xf6\x4a" "\x3c\xf2\x35\x0d\xd9\x93\xa7\x02\x35\x3c\xe0\xd9\x06\x41\x2f\x63\x01\xa9" "\x61\xfe\xc3\x04\x95\x36\x17\x4a\x7c\xad\xd6\xbe\x69\x70\x4f\xf9\xc8\xe4" "\x5b\xc9\x2f\x4c\xcd\xfc\x76\x26\xeb\xd4\xad\x65\xaa\x37\x78\xbb\x67\x97" "\xcb\x9e\x25\xf8\x03\x25\xf1\xfa\x59\x03\xd4\xe6\xcd\xe0\x4b\xb0\xbe\xf0" "\x7c\x4f\xc5\xa0\x2f\xa2\x1e\x6a\x0a\x2a", 352)); NONFAILING(memcpy( (void*)0x20000140, "\x78\x9c\xec\xdd\x4f\x4f\xd4\x4c\x1c\x07\xf0\xef\xb4\xbb\x4b\xf7\x81\x07" "\x2b\x60\x48\x3c\x19\x94\xc4\x13\x01\x3c\x68\xbc\x40\x0c\xf1\x35\x78\x30" "\x44\x84\x25\x21\xac\x98\x28\x26\x4a\x4c\x44\xcf\xc6\x78\x33\x31\xf1\xc8" "\xcd\xb3\xd1\xb7\xa0\x17\xe3\x1b\xd0\x13\x07\xe3\x49\x2f\xc4\x83\x35\x33" "\x9d\xee\x4e\x97\x99\xb6\x0b\xb8\x85\xec\xf7\x93\xb8\x76\xdb\xf9\xf3\x9b" "\xb6\xd3\xce\xec\x66\x29\x88\xa8\x6f\x5d\x5b\xf8\xba\x73\x69\x57\xfe\x13" "\x55\x00\x3e\x80\xab\x80\x07\x20\x00\x2a\x00\xce\x60\x3c\x78\xb0\xb1\x99" "\x5b\x90\xdf\x5a\x12\x88\x73\x8a\x7d\x69\x96\x37\x1a\xb6\xac\x01\x74\x0e" "\x2d\x94\xef\x2a\x18\x32\xd7\xd1\xbf\x11\x45\x51\xf4\x2d\x37\xd5\xcf\x9e" "\xc4\x42\xe5\x11\x66\x0f\x36\x78\xc0\x80\xee\x9d\x6a\x7b\xd0\xf3\xc8\x0e" "\x6d\xce\xb6\x72\x3b\x6e\x57\x7f\x31\x8e\xb0\xd8\xc3\x1e\x1e\x62\xb8\xcc" "\x70\x88\x88\xa8\x7c\xfa\xfe\xef\xe9\xbb\xc4\x90\x1e\xbf\x7b\x1e\x30\xa9" "\xc7\xe1\x27\xf5\xfe\x9f\x48\x8d\x6f\xf6\xca\x8b\xe3\x58\x68\xdd\xff\xbd" "\xf8\x7d\x24\xe4\xfe\x39\xa5\x36\xc9\xf9\xde\xda\x66\xb3\xb1\x12\x4f\xe1" "\xe4\xd1\xf7\x92\x59\xa2\xad\x2c\xeb\x39\x11\xb5\x77\x77\x0d\xf1\x99\xe5" "\x0f\x1a\x43\x2e\xa3\x16\x3b\x15\x8b\x57\x5f\x5d\x6b\x36\xa6\xb6\x55\x01" "\xcf\x30\xa7\x19\xc9\xc6\xd4\xeb\x0a\x92\x86\x28\xae\x68\x6b\xc0\x0c\x80" "\x09\xcb\xdc\x34\x43\x56\xdb\xb3\x0d\xaa\x36\x54\x65\x1b\x66\x1d\xf1\x8f" "\x66\xd5\x68\x9d\x00\x7f\xf8\x8e\x57\xf6\xea\x16\x3f\x15\x88\x49\x7c\x14" "\x9f\xc5\xa2\x08\xf1\x1a\x2b\xad\xf1\x5f\x25\x12\x72\xe7\xa8\x23\x15\x76" "\x74\x95\x38\xfe\x69\x77\x89\xaa\x95\x61\x9c\x2a\xd5\xca\x76\xf8\xa7\x55" "\x25\x67\x75\x0d\x78\xff\xb6\xdd\xca\xba\x6b\xbf\x06\xf0\x65\x2c\x36\xb2" "\x14\xd1\x39\x7e\x0f\x93\x38\x5f\xd6\xdc\xb9\x30\x82\xf4\xc7\x0a\x71\xeb" "\x66\xdc\xad\x53\xb9\x46\x81\x8a\x50\xb3\x06\x33\xd7\x6c\x2b\xd1\x6f\x6b" "\xae\xb1\xce\xba\xea\xab\xd5\x66\x63\x6a\xf9\x6e\xd3\x75\xd2\x1f\x2d\xeb" "\x8c\x4e\xbc\x10\x37\xc4\x04\x7e\xe0\x1d\x16\x8c\xf1\xbf\x27\x53\x4f\xc2" "\xdd\x33\x53\xbd\x5c\xa8\x94\xfa\xcc\xc8\x6c\x4f\x45\xa5\x74\x1c\xc7\x14" "\xd5\x81\xef\x74\xd5\x33\x49\xb9\x9e\xba\xf8\x15\xf3\x1c\xb7\x71\x05\xc3" "\xf7\x1f\x6d\xad\x2f\x35\x9b\x8d\x7b\xe5\x2f\x24\x5d\xe5\x80\xd9\xcf\x1d" "\x71\x3c\xf1\x89\xa8\x4f\x47\xb9\x46\xfe\x6f\xa4\x41\x20\x17\xaa\x00\x9c" "\xe5\x54\xdd\x9b\xac\x0b\x7f\xa2\x28\xb2\x6e\xaa\xa0\x17\x87\xa0\xaa\x9a" "\x7a\xf9\x4d\xbb\xc9\x5b\xeb\x4b\x42\x5f\xf3\x0e\x57\x85\xbc\x72\x76\x6c" "\x9a\x77\x27\x06\x30\x0f\x40\xaf\x49\xae\x08\x07\xa9\xfd\x49\x2b\xd7\x40" "\xbb\xc0\x42\xd9\x7f\xc9\xa3\xad\xd6\xd8\x4f\xc8\x24\xaa\x1e\x74\x90\xa4" "\xaa\xd4\x26\x1f\x03\x85\x7a\x4a\x7d\xdf\x9a\x9d\x9c\x5c\x8f\xff\x3f\xd8" "\x55\x88\x4e\xa0\xf6\xd1\xc7\xf8\xcd\xb2\x83\xa1\x32\xc8\xb1\x83\x88\xe7" "\x7f\xc6\x7c\x65\x5a\x5d\x75\xe4\x4b\x98\x31\xff\x89\xf2\x0a\x37\x4a\x9c" "\x71\xcc\x80\x46\xd4\xeb\x7f\xc5\x66\x70\xad\x62\x9d\xe3\xc4\xc1\x64\x21" "\x67\xce\x75\xfe\x22\x70\xa1\xa3\x46\x0f\x49\x8d\x4f\x3b\x8b\x0d\x75\x9c" "\x38\x8e\xdf\x4a\x76\xff\x55\x86\x58\xc0\x17\xdc\xe2\xe7\xff\x44\x44\x44" "\x44\x44\x44\x44\x44\x44\x44\x44\x44\x44\x44\x44\x44\x44\x44\x44\x44\x27" "\x4d\xb7\xbf\x46\xd8\xff\x73\x82\xfc\x85\x74\x8d\xbb\x7d\xf8\x87\x37\x88" "\x88\x88\x88\x88\x88\x88\x88\x88\x88\x88\x88\x88\x88\x88\x88\x88\x88\x88" "\x88\x88\x88\x88\x0e\xc7\x78\xfe\x2f\xe0\xab\x27\xc6\xd4\x6c\xcf\xff\xcd" "\x7a\x52\x93\xe2\xc7\x4f\x88\x09\x8e\xe2\xf9\xbf\x7e\x81\xe7\xff\x8a\xed" "\x2e\x5a\x49\x44\x36\x7f\x03\x00\x00\xff\xff\x5e\x0f\x5c\x50", 825)); NONFAILING(syz_mount_image(/*fs=*/0x20000000, /*dir=*/0x20000100, /*flags=MS_SYNCHRONOUS|MS_NOSUID*/ 0x12, /*opts=*/0x20001240, /*chdir=*/4, /*size=*/0x339, /*img=*/0x20000140)); // syz_mount_image$vfat arguments: [ // fs: ptr[in, buffer] { // buffer: {76 66 61 74 00} (length 0x5) // } // dir: ptr[in, buffer] { // buffer: {e9 1f 71 89 59 1e 92 33 61 4b 00} (length 0xb) // } // flags: mount_flags = 0x804070 (8 bytes) // opts: nil // chdir: int8 = 0xfc (1 bytes) // size: len = 0x0 (8 bytes) // img: ptr[in, buffer] { // buffer: (compressed buffer with length 0x0) // } // ] // returns fd_dir NONFAILING(memcpy((void*)0x20000080, "vfat\000", 5)); NONFAILING(memcpy((void*)0x20000680, "\351\037q\211Y\036\2223aK\000", 11)); NONFAILING(syz_mount_image( /*fs=*/0x20000080, /*dir=*/0x20000680, /*flags=MS_I_VERSION|MS_REC|MS_SYNCHRONOUS|MS_REMOUNT|MS_MANDLOCK*/ 0x804070, /*opts=*/0, /*chdir=*/0xfc, /*size=*/0, /*img=*/0x20000140)); } int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-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=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x21000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); const char* reason; (void)reason; install_segv_handler(); use_temporary_dir(); do_sandbox_none(); return 0; }