// https://syzkaller.appspot.com/bug?id=65f3caae39807b0b41f8e62dec2a517a7e510651 // 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 #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 void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); syscall(SYS_futex, &ev->state, FUTEX_WAKE | FUTEX_PRIVATE_FLAG, 1000000); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, 0); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; for (;;) { uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, &ts); if (__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) return 1; now = current_time_ms(); if (now - start > timeout) return 0; } } 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"); } 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); } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } int i, call, thread; for (call = 0; call < 7; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); event_timedwait(&th->done, 50 + (call == 0 ? 4000 : 0) + (call == 4 ? 4000 : 0)); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); close_fds(); } static void execute_one(void); #define WAIT_FLAGS __WALL static void loop(void) { int iter = 0; for (;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); reset_loop(); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); setup_test(); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { sleep_ms(10); if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; if (current_time_ms() - start < 5000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[1] = {0xffffffffffffffff}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: memcpy((void*)0x200000000000, "hfsplus\000", 8); memcpy((void*)0x200000000040, "./file1\000", 8); memcpy( (void*)0x200000000940, "\x78\x9c\xec\xdd\x4f\x6c\x1c\x57\x1d\x07\xf0\xef\x6e\x76\xd7\xde\x80" "\x52\xa7\x4d\xd2\x80\x2a\x11\x35\x52\x41\x44\x24\x4e\xac\xa4\x98\x4b" "\x03\x42\x28\x12\x15\xaa\xca\x01\x21\x4e\x56\xe2\x34\x56\x36\x69\xe5" "\xb8\xc8\x89\x10\x84\xff\x07\x2e\x1c\x7a\xe2\x42\x91\xc8\x8d\x0b\x48" "\xdc\x83\xca\x19\x38\xf5\xea\x63\x25\x24\x2e\x3d\x05\x90\x58\x34\xb3" "\xb3\xf6\x7a\xed\x38\xbb\x26\xce\xda\xe2\xf3\x89\x66\xdf\x9b\x79\x7f" "\xe6\xbd\xdf\xcc\xec\xec\xce\x2a\x72\x80\xff\x5b\x57\xce\xa4\xf1\x30" "\xb5\x5c\x39\xf3\xfa\x6a\xb1\xbe\xf6\x60\xae\xb3\xf6\x60\xee\x56\x3f" "\x9f\x64\x2a\x49\x3d\x69\xf4\x92\xd4\x6e\x27\xb5\x0f\x92\xcb\x49\xbb" "\xec\xe2\x53\xc5\xc6\xaa\xbb\xda\xe3\xf6\xf3\xde\xd2\xfc\x9b\x1f\x7e" "\xbc\xf6\x51\x6f\xad\x51\x2d\x65\xfd\xfa\x4e\xed\xb6\xb8\x54\xdf\x66" "\xe3\xfd\x6a\xc9\xa9\x24\x87\xaa\x74\xd8\xaf\xbe\x33\xf2\x4e\x36\xf5" "\x77\x75\xa8\xbf\xd6\xc8\xdd\xf4\xd5\xd6\x67\x78\x39\xc9\xe9\x2a\x85" "\x89\x6b\x26\xe9\x6e\xf2\xed\x13\x1b\x25\x4f\x34\xfa\x75\x0b\xec\x5b" "\xb5\xde\x7d\x73\xcb\x05\x3d\x93\x1c\x4e\x32\x5d\x7d\x0e\xe8\xdd\x15" "\x7b\xf7\xec\x03\xed\xfe\xa4\x07\x00\x00\x00\x00\xcf\xc0\x73\xbf\x28" "\xbf\xc2\x1f\x99\xf4\x38\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe0" "\x20\xa9\xfe\xfe\x7f\xad\x5a\xea\xfd\xfc\xa9\xd4\xfa\x7f\xff\xbf\x55" "\x6d\x4b\x95\x3f\xd0\x1e\x4e\x7a\x00\x00\x00\x00\x00\x00\x00\x00\x30" "\xbe\xaf\x7f\x72\x68\xc3\x67\x1e\xe5\x51\x56\x73\xa4\xbf\xde\xad\x95" "\xbf\xf9\xbf\x5c\xae\x1c\x2b\x5f\x3f\x91\x77\x73\x27\x8b\x59\xce\xd9" "\xac\x66\x21\x2b\x59\xc9\x72\xce\x27\x99\x29\xcb\x9b\xe5\x6b\x6b\x75" "\x61\x65\x65\xf9\xfc\x08\x2d\x2f\xac\xb7\xcc\x40\xcb\x0b\x23\xce\xa0" "\xbd\xfb\xc9\x03\x00\x00\x00\x00\x00\x00\xc0\x41\xd1\x18\xbf\xc9\x8f" "\x72\x65\xe3\xf7\x7f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\xd8\x0f\x6a\xc9\xa1\x5e\x52\x2e\xc7\xfa\xf9\x99\xd4\x1b\x49\xa6" "\x93\xb4\x8a\x7a\xf7\x93\xbf\xf6\xf3\xfb\xd2\xaf\xff\x34\xb8\xd6\xfd" "\x77\xb7\xb4\xa5\xda\xc3\x67\x39\x26\x00\x00\x00\x98\x90\xe7\x1e\xe5" "\x51\x56\x73\xa4\xbf\xde\xad\x95\xdf\xf9\x4f\x94\xdf\xfb\xa7\xf3\x6e" "\x6e\x67\x25\x4b\x59\x49\x27\x8b\xb9\x56\x3e\x0b\xe8\x7d\xeb\xaf\xaf" "\x3d\x98\xeb\xac\x3d\x98\xbb\x55\x2c\x5b\xfb\xfd\xf2\x3f\xc6\x1a\x46" "\xd9\x63\x7a\xcf\x1e\xb6\xdf\xf3\xc9\xb2\x46\x3b\xd7\xb3\x54\x6e\x39" "\x9b\xab\x79\x3b\x9d\x5c\x4b\xbd\x6c\x59\x38\xd9\x1f\xcf\xf6\xe3\xfa" "\x61\x31\xa6\xda\x6b\x95\x11\x47\x76\xad\x4a\x8b\x99\xff\x32\xcd\xb1" "\x66\xb5\x1b\xb5\x91\x6b\xce\x94\x11\x29\x46\xd4\x8b\xc8\x6c\xd5\xb6" "\x88\xc6\xd1\x9d\x23\x31\xe6\xd1\xe9\xef\xa9\x1f\xfb\xf3\xa9\xaf\x3f" "\xf9\x39\xf6\x34\x63\xbe\xda\x4b\x5e\xfd\x6d\x2f\x2d\xe6\xf3\xb3\xb1" "\x62\xb2\xd7\x86\x23\x71\x61\xe0\xec\x3b\xb1\x73\x24\x92\xcf\xfe\xf1" "\x77\xdf\xba\xd1\xb9\x7d\x73\xea\xfa\x9d\x33\xfb\x67\x4a\x63\x98\x1a" "\x78\x82\x36\x1c\x89\xb9\x81\x48\xbc\xb8\x5d\x24\xda\x03\x1d\xf5\x23" "\x71\xe3\xa0\x46\x62\xd0\x6c\x19\x89\xe3\xeb\xeb\x57\xf2\xb5\x7c\x33" "\x67\x72\x2a\x6f\x64\x39\x4b\xf9\x6e\x16\xb2\x92\xc5\x9c\xca\x57\xb3" "\x90\x43\x59\xa8\xce\xe7\xe2\x75\x66\xe7\x73\xe6\xf2\xa6\xb5\x37\x9e" "\x34\x92\x56\x79\x5c\x9a\xd5\xbb\xe8\xe8\x63\x5a\xc9\x42\x5e\x2e\xdb" "\x1e\xc9\x52\xbe\x91\xb7\x73\x2d\x8b\xb9\x54\xfe\xbb\x90\xf3\x79\x35" "\x17\x73\x31\xf3\x03\x47\xf8\xf8\x08\x57\x7d\x7d\xbc\x77\xda\xd3\x9f" "\x1b\x78\x98\xfc\xf3\xa1\x13\x66\xb2\x8a\x81\x1d\x5d\xbf\x3b\x0d\x9e" "\xf5\xb3\xe5\x75\x70\x74\xd3\x96\x8d\x28\x3d\xff\xf4\xef\x47\x8d\x4f" "\x57\x99\x62\x1f\x3f\xae\xd2\xfd\x61\x38\x12\xe7\x07\x22\xf1\xc2\xce" "\x91\xf8\x4d\xf9\xb6\x72\xa7\x73\xfb\xe6\xf2\x8d\x85\x77\x46\xdc\xdf" "\x2b\x55\x5a\x5c\x47\x3f\x1d\xf3\x2e\xb1\xb7\x51\x2b\xce\x97\xe7\x8b" "\x83\x55\xae\x6d\x3e\x3b\x8a\xb2\x17\x86\xcb\xa6\x7b\xf1\x6a\x55\xbf" "\xb8\x34\xaa\x31\x0e\xc6\xb2\x28\x3b\xbe\x5e\xf6\xa4\x2b\xb5\x55\x7d" "\x86\xdb\xda\xd3\x85\xb2\xec\xc5\x6d\xcb\xe6\xca\xb2\x93\x03\x65\x9b" "\x3e\x6f\x5d\xee\x7d\xde\x02\x60\xdf\x3b\xfc\xf9\xc3\xad\xf6\xdf\xdb" "\x7f\x69\xbf\xdf\xfe\x49\xfb\x46\xfb\xf5\xe9\xaf\x4c\x7d\x71\xea\xa5" "\x56\x9a\x7f\x6e\x7e\xa9\x31\x7b\xe8\x95\xfa\x4b\xb5\x3f\xe4\xfd\x7c" "\x7f\xe3\xfb\x3f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb0\x7b\x77\xee\xde\xbb\xb9" "\xd0\xe9\x2c\x2e\x0f\x65\xba\xdd\xee\x0f\x1e\x53\xb4\x87\x99\x76\x92" "\xfe\x96\xe4\x49\xad\x9a\x79\x72\x9d\xbd\xc9\xb4\x92\x94\x99\x46\x3f" "\x33\x5e\x3f\x53\x23\x55\x6e\x6d\x1c\x9d\xd7\x7e\xbf\xcb\xa1\x4e\x27" "\x59\x6c\x56\x5b\x9a\x8f\x3d\xdc\x43\x99\xe4\xa9\x04\xaa\x51\x9d\x64" "\x77\xef\xdd\xfc\x67\xb7\xdb\x7d\xe6\x87\x69\x9b\x4c\x73\x87\x73\x7e" "\x23\xd3\xad\x6c\x29\xea\x8e\xd4\x7c\x62\x99\x7f\x75\x9f\x5e\x87\x13" "\x7e\x63\x02\xf6\xdc\xb9\x95\x5b\xef\x9c\xbb\x73\xf7\xde\x17\x96\x6e" "\x2d\xbc\xb5\xf8\xd6\xe2\xed\xf9\x8b\x17\xe7\x67\xe7\x2f\x5e\xfa\xdb" "\xb9\xeb\x4b\x9d\xc5\xd9\xde\xeb\xa4\x47\x09\xec\x85\x8d\x9b\xfe\xa4" "\x47\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x8c\xea\x59\xfc\xb7\x84" "\xc7\xec\xfa\x3f\xcf\x78\xaa\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\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\x01\x75\xe5" "\xcc\x54\x95\x3b\x3b\x5b\xbc\xae\x3d\x98\xeb\x14\x4b\x3f\xbf\x5e\xb1" "\xac\x56\x4f\x52\xfb\x5e\x52\xfb\x20\xb9\x9c\xde\x92\x99\x81\xee\x6a" "\x8f\xdb\xcf\x7b\x4b\xf3\x6f\x7e\xf8\xf1\xda\x47\xbd\xb5\x46\xb5\x94" "\xf5\xeb\x9b\xda\x35\x77\x33\x8b\xfb\xd5\x92\x53\x49\x0e\x55\xe9\xa0" "\xe9\xff\xa1\xbf\xab\x55\xba\xab\x91\x95\x6a\xeb\x33\x2c\x02\x76\xba" "\x1f\x38\x98\xb4\xff\x06\x00\x00\xff\xff\x87\x01\x0f\xf4", 1697); syz_mount_image(/*fs=*/0x200000000000, /*dir=*/0x200000000040, /*flags=MS_NOATIME*/ 0x400, /*opts=*/0x2000000000c0, /*chdir=*/1, /*size=*/0x6a1, /*img=*/0x200000000940); break; case 1: memcpy((void*)0x200000000200, "./file1\000", 8); syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000200ul, /*flags=O_LARGEFILE|O_CREAT|O_CLOEXEC*/ 0x88040, /*mode=*/0); break; case 2: syscall(__NR_truncate, /*file=*/0ul, /*len=*/0x9673ul); break; case 3: syscall(__NR_fcntl, /*fd=*/(intptr_t)-1, /*cmd=*/0x400ul, /*typ=*/0ul); break; case 4: memcpy((void*)0x200000020940, "hfs\000", 4); memcpy((void*)0x200000000000, "./file0\000", 8); memcpy( (void*)0x2000000004c0, "\x63\x72\x65\x61\x74\x6f\x72\x3d\x61\x84\x01\x71\x2c\x70\x61\x72\x74" "\x3d\x30\x78\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30" "\x30\x33\x2c\x66\x69\x6c\x65\x5f\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" "\x2c\x74\x79\x70\x65\x3d\x5a\xa3\x68\x4b\x2c\x70\x61\x72\x74\x3d\x30" "\x78\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x34\x30\x34\x30\x30" "\x2c\x69\x6f\x63\x68\x61\x72\x73\x65\x74\x3d\x63\x70\x38\x35\x35\x2c" "\x63\x6f\x64\x65\x70\x61\x67\x65\x3d\x6d\x61\x63\x63\x65\x6e\x74\x65" "\x75\x72\x6f\x2c\x00\xb1\xa1\x37\x97\x43\x3d\x4c\x89\xa6\xa8\x9d\xbc" "\xe7\xef\x16\xe9\xb8\xb9\x70\xd7\xd8\xbd\xf9\x2c\xac\x31\xda\x69\x64" "\xad\xbb\x92\xdd\x1f\xf7\x8a\x77\x12\xa7\xe2\x16\xa6\x8b\xe6\x51\x57" "\x4b\xb4\x01\x2d\x90\x69\x43\x7e\xcc\xf8\x49\x7d\x57\xf7\x7c\x24\x43" "\x91\x13\xe8\xea\xdf\x50\xf6\x4f\x95\xec\xc1\x6e\xb9\x58\x3b\x93\xf0" "\x64\xc6\x4e\xd0\x43\x63\x7d\x2b\x62\x20\xa3\x43\x06\x77\x8a\x57\x0a" "\xfa\x87\x39\xf9\xd0\xdc\xbd\xb0\x9d\xf9\x20\x48\x2f\xb5\xe1\xa6\x0b" "\x9c\x5d\x3f\xaa\xcb\xca\x7a\xef\xdf\x01\x4b\xc5\xb2\x02\xd5\x5e\xd3", 272); memcpy( (void*)0x200000001100, "\x78\x9c\xec\xdd\x4d\x6f\x13\x47\x1c\xc7\xf1\xdf\xac\xed\xc4\x69\xa2" "\x74\x9b\xa4\xaa\xd4\x4b\xab\xb4\x91\xda\x4b\xd4\xb4\x3d\x54\xbd\xb8" "\xaa\x7c\xed\xbd\xa7\xaa\x6d\xec\x48\x11\x56\x10\x49\x90\x80\x0b\x26" "\xe2\x88\x78\x01\xdc\x79\x0b\xbc\x08\x2e\x20\xde\x00\x70\xe1\xc4\x0b" "\xc8\x6d\xd1\xcc\xce\xae\xd7\xf6\x78\x9d\x08\x3b\x9b\x84\xef\x47\xb2" "\x35\x9e\x9d\x87\xff\xb0\x4f\x33\x2b\x91\x15\x80\x4f\xd6\x9f\xed\xd7" "\x4f\x7f\x79\x67\x3f\x46\xaa\xa9\x26\xe9\x77\x29\x92\xd4\x94\xea\x92" "\xbe\xd4\x57\xcd\xdb\x07\xc7\xfb\xc7\xbd\x6e\xa7\xac\xa1\x9a\xab\x61" "\x3f\x46\x69\x4d\x33\x56\x66\xf7\xa0\x1b\xaa\x6a\xeb\xb9\x1a\x5e\x6c" "\x7f\xd5\xb5\x52\xcc\xc3\x7c\x24\x49\xf2\xc7\x9b\xaa\x83\x40\xe5\xdc" "\xd9\x1f\x10\x49\x8b\xfe\x3c\x74\xdb\x9b\x17\x1c\xd7\xac\x8c\x0e\xae" "\x2f\x7d\x53\x51\x28\x95\x29\xfe\x1b\x98\x53\x9d\xea\x8e\x56\x2b\x0c" "\x07\x00\x70\x09\xf8\xfb\x7f\xe4\x6f\x13\x2b\x2e\xcb\x28\x8a\xa4\x2d" "\x7f\xdb\xbf\xd2\xf7\xff\x51\xa7\x55\x07\x30\x5b\xbf\xf6\xc6\xb2\x92" "\xd2\x0a\x85\xfb\xbf\x9b\xdd\x25\xc6\xee\xdf\xcf\xdd\xa6\xc1\x7a\xcf" "\x2d\xe1\xec\xf6\x28\x5b\x25\x9e\x25\x98\xc6\xc8\xef\x05\xa5\x47\xd6" "\xd0\x1c\xcc\x84\x57\x95\x6f\x93\x94\x8f\x25\x5a\xda\xdb\xaf\x6b\x7b" "\xf7\x81\x3a\x91\x4e\xd4\xf2\x0a\x15\x36\xdc\x77\x27\x3d\x74\x33\x53" "\xa2\xdd\x0c\xac\x4d\x4b\x4c\x6e\xad\xa1\xbf\x3e\x4b\x47\x63\x67\x94" "\x4b\xa3\x9b\xb3\x90\xf6\xf6\x7b\xdd\x45\x9b\x08\xc4\xbf\x7e\xbe\x1e" "\x3f\x9e\x79\x6e\x5e\x9a\x7f\x4c\xac\x27\xea\xe4\xf3\xbf\x7a\x62\xec" "\x6e\x72\x7b\x2a\x1e\xd9\x53\x51\xc3\xc6\xff\xd3\xe4\x16\x97\x5d\x2d" "\x5b\x4a\x7e\xd9\xdf\x6a\xb5\xa2\xa1\x22\x5f\xb8\x4e\xbe\xf6\x3d\x78" "\x53\x46\xd9\x0c\xaf\x48\x8a\x6d\x66\x0f\x08\xfa\x79\x04\x81\x38\x4f" "\xb2\x84\xeb\x7b\x4d\xc3\x8f\x15\xd2\xd1\xed\x84\x3a\x30\x83\xc6\xd7" "\x43\xb5\xe2\xfc\xd7\x78\x5d\xd7\xd7\xc6\x50\xad\x9a\x3f\x12\xb6\x77" "\x6f\xf6\x4a\x1f\xa5\xcc\x47\x36\x44\xf3\xd8\xfc\x6d\x36\xf5\x5e\xcf" "\xd4\x2e\xcc\xff\x23\x1b\xdf\x96\x0a\x67\x66\xd9\xa5\xde\xb8\x92\xfe" "\xc8\x48\xc7\xb3\x10\x2e\x59\x77\x25\xe3\xb1\x3b\x47\x3f\x4f\x7d\x9b" "\x47\xe0\x2d\x9e\x7b\x6c\x90\xce\xf9\xb4\xec\x91\xfe\xd7\x6f\x5a\x3d" "\xba\x7b\xef\x46\xad\xd7\xeb\x1e\xda\xc4\x7f\x81\xc4\xad\x95\x43\xe3" "\x73\x1a\x0f\xa5\x60\x99\xf9\x27\x6a\x2a\x29\xa3\xfe\x20\xc7\xdd\x3c" "\xee\x27\xc9\x59\x5b\x4e\xe6\x19\xfc\x8f\x33\x6d\xd0\x5e\x3f\xf2\x1c" "\x7b\xfa\x84\x0a\xdb\xb3\x2c\xcf\x89\x2e\x7a\x37\x5d\xbf\x44\x5d\xa1" "\x4d\xed\x17\x2a\x3b\x20\xe7\x9a\xc8\xa6\x2e\x33\x69\xd0\x4e\xb4\x26" "\x6c\x9a\xcb\x35\x0a\x97\xcc\x91\xc9\x76\xba\xcf\x18\x9b\xc4\xe2\x9a" "\xb3\xf3\x2e\x93\xae\xff\xdc\x4c\xde\xcf\xea\xdc\x75\xc6\x7e\xc5\x25" "\xf3\xf4\xf2\x45\xa6\x86\x5a\xdc\xc9\x57\x70\xc3\x53\xc1\xb5\xd0\xdc" "\x65\xca\xda\x60\x79\xf2\x0a\xae\xd0\xe3\xcf\x13\xd6\x8c\x6e\xcd\xf5" "\xdd\x0f\xd2\xf7\x85\x4c\xa3\xd2\x1e\x63\x17\xe7\xb5\x61\xda\x7a\xa5" "\x7f\x79\xfe\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x70\xd5\x5c\xc4\xff\x58\xa8\x7a\x8c\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x5c\x75\x67\x7f\xff\xef\xd2" "\xe0\x4d\x4d\xa1\xbf\x11\xef\xde\xff\x1b\x4f\x7d\xff\xef\xd0\x0b\x80" "\xfd\x8b\xa2\x78\xff\x2f\x50\x8d\x0f\x01\x00\x00\xff\xff\x14\x90\x7d" "\x5b", 766); syz_mount_image(/*fs=*/0x200000020940, /*dir=*/0x200000000000, /*flags=MS_LAZYTIME*/ 0x2000000, /*opts=*/0x2000000004c0, /*chdir=*/1, /*size=*/0x2fe, /*img=*/0x200000001100); break; case 5: memcpy((void*)0x200000000140, ".pending_reads\000", 15); res = syscall( __NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000140ul, /*flags=O_SYNC|O_NOFOLLOW|O_EXCL|O_CREAT|O_CLOEXEC|0x1*/ 0x1a10c1, /*mode=S_IXOTH|S_IWOTH|S_IWUSR|S_IRUSR|0xc00*/ 0xd83); if (res != -1) r[0] = res; break; case 6: *(uint32_t*)0x200000000740 = 0; *(uint16_t*)0x200000000744 = 0x18; *(uint16_t*)0x200000000746 = 0xfa00; *(uint64_t*)0x200000000748 = 0; *(uint64_t*)0x200000000750 = 0; *(uint16_t*)0x200000000758 = 0x111; *(uint8_t*)0x20000000075a = 9; memset((void*)0x20000000075b, 0, 5); syscall(__NR_write, /*fd=*/r[0], /*data=*/0x200000000740ul, /*len=*/0x20ul); break; } } int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0x1000000ul, /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/ 7ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x200001000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); const char* reason; (void)reason; use_temporary_dir(); do_sandbox_none(); return 0; }