// https://syzkaller.appspot.com/bug?id=82d42d63041af807396903be5a8cde141b51113c // 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 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 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_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/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_binderfs(); setup_fusectl(); } 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)) { } if (symlink("/dev/binderfs", "./binderfs")) { } } 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); } 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"); } 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++) { reset_loop(); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { 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; } } } uint64_t r[2] = {0xffffffffffffffff, 0xffffffffffffffff}; void execute_one(void) { intptr_t res = 0; if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } memcpy((void*)0x20000040, "hfs\000", 4); memcpy((void*)0x20000100, "\023\023w\305\3745\324\024T\325\324\035)\255\032`)" "Y\201F\346\276\026nA\255\r\275@T\003<\2373\273\332\202$" "\242\363\327r\347cnH\263<\277p\203r\350\361\271\223>" "\305\022wC\276\"\006 \236\360-\371\313\362\366\350\200\3238/\000", 78); memcpy((void*)0x20000080, "\x71\x75\x69\x65\x74\x2c\x63\x72\x65\x61\x74\x6f\x72\x3d\xd4\x67\x5f" "\x16\x2c\x69\x6f\x63\x68\x61\x72\x73\x65\x74\x3d\x63\x70\x37\x37\x35" "\x2c\x63\x6f\x64\x65\x70\x61\x67\x65\x3d\x6d\x61\x63\x67\x61\x65\x6c" "\x69\x63\x2c\x74\x79\x70\x65\x3d\xb1\x19\x63\xb0\x2c\x00\xb6\x79\xbe" "\xd5\x39\x7f\xaa\x62\x4a\xe3\x35\x4a\xa8\xcf\x32\x12\x81\xef\xb9\x84" "\x91\x4b\xc9\x59\x28\x70\x76\x26\xbe\xd9\x50\x70\xe1\x3f\x5a\x28\xa1" "\xe5\xd0\x19\xc7\x01\xdb", 108); memcpy( (void*)0x20000180, "\x78\x9c\xec\xdd\xcd\x6a\x13\x5d\x1c\xc7\xf1\xdf\x99\xa4\x6d\x9e\xa7\xa5" "\x4e\x5f\x44\x70\x23\x54\x0b\xba\x11\xad\x1b\x71\x13\x91\x5c\x84\x2b\x51" "\x9b\x08\xc5\x50\x51\x2b\xbe\xac\xaa\xb8\x12\xd1\xbd\xfb\xde\x82\x4b\x2f" "\xc0\x8d\xe2\x0d\xd4\x95\x2b\x2f\xa0\xba\x19\x39\x67\x26\x99\x24\xf3\xda" "\xd2\x66\x1a\xfd\x7e\xa0\xe1\x24\x73\xce\x9c\xff\xc9\xbc\x9c\xf3\x0f\x94" "\x11\x80\x7f\xd6\x8d\xd6\xee\xce\x95\x1f\xf6\xcf\x48\x35\xd5\xa4\x37\xd7" "\x24\x4f\x52\x43\xaa\x4b\x3a\xa9\x53\x8d\x27\x9b\x5b\x1b\x5b\xdd\x4e\x3b" "\x6f\x47\x35\xd7\xc2\xfe\x19\x85\x2d\x4d\xa2\xce\xfa\x66\x27\xad\xa9\x6d" "\xe7\x5a\x44\x7c\xfb\xae\xae\xb9\xc1\xcf\x70\x34\x82\x20\xb8\xfe\xbd\xea" "\x20\x50\x39\x77\xf5\xa7\xf0\xa4\x99\xe8\xea\x74\xdb\x1b\x63\x8f\x2c\xdf" "\xcb\x03\xb6\xdb\x3e\xe4\x38\x26\x8d\xd9\xd3\x9e\x9e\x69\xbe\xea\x38\x00" "\x00\xd5\x8a\xe6\x7f\x2f\x9a\xe7\xe7\xa2\xf5\xbb\xe7\x49\xab\xd1\xb4\x7f" "\x2c\xe7\xff\x42\x19\x13\xfd\xde\xb8\xe3\x18\xbb\x20\x77\xeb\xc0\xfc\xef" "\xb2\xac\xc0\xd8\xe3\x7b\xc2\x6d\x8a\xf3\x3d\x97\xc2\xd9\xed\x5e\x2f\x4b" "\x2c\xd3\xf3\xd4\xc8\xfb\x69\x85\x67\xd6\xd0\x02\xd3\x14\x65\x95\x2e\x16" "\xef\xbf\x7b\x1b\xdd\xce\xc5\xf5\x07\xdd\xb6\xa7\x57\x6a\x46\x06\xaa\x2d" "\xbb\xd7\x76\x78\xea\xf6\x14\x44\xbb\x92\x92\x9b\xe6\x28\x31\x76\x93\x7e" "\xa2\xcd\xba\x31\x4c\xd9\x31\xac\x85\xf1\x3f\x95\x34\x14\xff\xd2\x01\x7b" "\x3c\x30\xf3\xd9\x7c\x35\xb7\x8c\xaf\x0f\x6a\xf7\xd7\x7f\xf5\xc0\xd8\xc3" "\xe4\x8e\x94\x3f\x72\xa4\xc2\xf8\x2f\x65\xef\xd1\x8d\xd2\xb7\xb5\x14\xdd" "\x36\x9a\xcd\xa6\x37\x54\x65\xc1\x75\x72\x3a\xea\x21\xb2\xbb\xf3\x49\x39" "\xa3\x6c\xa4\x67\x24\xea\x9d\x51\x0b\x1a\xfe\x81\xc0\x2f\x8a\xd3\xb5\x5a" "\x1c\x69\x15\x8e\xee\x72\x41\xab\xa5\xd4\x56\x6b\xbd\x77\x19\xad\x96\x87" "\x5a\xd9\xd1\xf4\xcf\xe6\xec\xfe\x8e\x9a\x79\x67\x6e\x9a\x15\xfd\xd4\x47" "\xb5\x06\xd6\xff\x9e\x8d\x6f\x55\xb9\x57\x66\x7c\xd5\x98\xd5\x70\x2a\x70" "\xdf\x78\x38\x9e\xe9\xf4\xee\xea\x6e\x9f\x7e\x62\xe6\x48\x5e\x2e\xfd\x6f" "\x71\x26\x2b\xf4\x5f\xf9\xf7\x34\xec\xc3\x5b\xdd\xd5\x55\xcd\x3f\x7e\xfe" "\xe2\x7e\xad\xdb\xed\x3c\xb2\x85\x3b\x29\x85\x87\x73\xfd\x4f\xa6\x5e\x4b" "\xa9\x75\x2a\x2e\x68\x3b\xfe\x64\x46\x81\x93\xa8\xdc\x9b\x94\x4a\xee\xf9" "\x77\x90\xb1\x9f\xfd\x14\x2e\x1c\xea\x48\xed\xfd\xa3\xb0\xb2\xbd\xca\x8e" "\xc5\x41\xf9\xab\x0b\xad\x2f\xa5\x4f\xa4\x89\x2d\x54\x7c\x7f\xc2\x58\xc4" "\x07\xbd\xea\x48\x50\x11\xbb\xee\x32\x61\xfe\x17\xe7\x2b\xf5\x70\xb1\x67" "\x5f\xfc\xd4\x6c\xa4\xe4\x0f\x01\xd1\x1e\x03\xbb\xc6\xee\x67\x70\x71\xdb" "\x40\x3a\xb3\xe8\x4a\xff\xef\x2b\x83\x9b\xcd\xce\xe0\x92\x39\x57\x22\x67" "\x74\x39\xd7\xd9\xf3\xd2\xb9\xf2\x3d\xfa\x5a\x2c\x31\xdc\x89\x61\x5a\xfa" "\xa6\xdb\xfc\xfe\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x30\x69\xc6\xf1\xef\x04\x55\x8f\x11\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x80\x49\xd7\x7f\xfe\xaf\x7a\xcf\xff\x55" "\xb9\xe7\xff\x8e\x3e\x8a\xe5\x30\x9f\xff\xfb\x7e\x53\x3c\xff\x17\x38\x7a" "\x7f\x02\x00\x00\xff\xff\x22\x5a\x81\x87", 712); res = -1; res = syz_mount_image( /*fs=*/0x20000040, /*dir=*/0x20000100, /*flags=MS_LAZYTIME|MS_REC|MS_STRICTATIME|MS_RDONLY|MS_MANDLOCK*/ 0x3004041, /*opts=*/0x20000080, /*chdir=*/0x11, /*size=*/0x2c8, /*img=*/0x20000180); if (res != -1) r[0] = res; memcpy((void*)0x20000180, "msdos\000", 6); memcpy((void*)0x20000100, ".\000", 2); *(uint32_t*)0x200007c0 = -1; *(uint8_t*)0x200007c4 = r[0]; *(uint8_t*)0x200007c5 = -1; memcpy( (void*)0x200007c6, "\xf1\xbc\xca\x05\xed\x58\x8d\x63\xa5\x76\xcc\x3a\xfd\x51\xba\xf2\x9c\xde" "\x22\x81\xa8\x43\x92\xf4\xe6\x6f\xf7\xf7\x7d\xaa\x9a\xf7\x27\xce\xae\x8a" "\x8e\xc9\x5f\xc1\xb7\x30\x83\xde\x2d\xe8\x25\xa0\xce\x27\xc1\x6b\xc2\x3b" "\x2f\x7c\x7f\xb7\x25\x85\x54\x89\x39\x69\x8f\x28\x3e\x00\x00\x00\x25\x5a" "\x9a\x92\x40\x08\xf8\x47\x7e\x82\xba\x11\xcd\xb1\x1e\xfd\x5c\xa2\xf1\xab" "\x04\x9c\xe2\xcc\xc4\x15\xd2\xda\xf8\xda\xc7\x25\x53\x3a\x55\x8d\x56\x16" "\x54\xfa\xf5\xe0\x92\x4f\x13\x76\x17\x4f\x37\x4d\x66\x4f\xad\x4a\x6a\xb2" "\x4e\xc0\xe8\x22\xe7\xf9\x42\x6e\x8e\x5d\xe1\xfe\x58\x08\x5a\x0a\xe8\x6f" "\xd0\x2a\x11\x8b\x93\x65\x96\x18\x34\xd4\x62\x08\xb9\xfb\x4c\xb1\xa1\xfa" "\x96\x2a\x8b\x00\x00\xdc\x2e\x31\x93\x79\xea\x1e\x5a\x07\xae\xb3\xf9\xcd" "\x4e\x64\x8d\xf4\xdd\x18\xe6\x25\x3e\x7b\x23\x10\xa7\x8d\x63\xa2\x32\xa2" "\xa4\x07\x58\x02\x7a\x47\x2e\x7d\x26\x3e\xf5\x67\xa8\x41\x86\x37\x87\x88" "\x9b\xf1\xc9\x0f\xcc\xf3\x19\x54\xa9\x40\xc8\xb5\x84\xca\x69\xa5\x12\xf2" "\x8e\xde\xc0\x86\xb1\xc0\x82\x3c\x02\x88\x40\xee\xaf\x3f\x5d\x87\x69\x02" "\x3c\x01\x21\x86\x14\xf4\xfa\x40\xbe\x98\x92\xe7\xa2\x85\xac\x63\xf7\xf9" "\x7a\xaa\x5b\x8e\xcc\x86\xea\x8c\x61\x93\xbc\x21\xa2\xb8\x33\xe5\xc2\xc9" "\xc7\x03\xc4\xcf\xa0\x63\xdd\x34\xc2\x45\x70\x6b\xde\x3d\x7a\xc3\x73\xab" "\x04\xb6\x2b\x41\x11\xb5\x9e\xab\xd4\x36\xdd\x97\xe7\x88\xa3\x6e\xf2\x5b" "\xad\x99\xbe\x2a\xa9\x24\x94\x95\x58\xc8\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x6e\x90\x27\x7c\x25\xa2\x4d\x59\x0a\x73\x06\xae\x96\x05\x62" "\xb9\x18\x3b\x4d\xe2\xdd\x5e\x2f\xc7\x31\xdd\xfd\x1a\x23\xb3\xe9\x91\xd9" "\x47\xcd\x02\x62\x24\x52\x3a\xbd\x11\x56\x66\x5e\x5e\x57\x3a\x6d\x1e\xc5" "\x98\xee\xc9\xf1\x07\x90\xc1\x87\xde\xb4\x57\xee\xa1\xea\xcd\x5f\xa6\x17" "\xfc\x1a\x54\xc3\x7a\x12\xf3\x5b\x60\x64\x78\x4a\x33\xe0\x1c\x31\x6e\x12" "\x43\x4f\xb0\xc1\x38\xcd\x31\x27\x46\x03\xd8\x51\x40\x95\x00\x17\xfe\xde" "\x1b\x75\x61\x5d\x27\x29", 456); *(uint16_t*)0x2000098e = r[0]; *(uint8_t*)0x20000990 = -1; sprintf((char*)0x20000991, "%023llo", (long long)-1); memcpy( (void*)0x200009a8, "\x2d\xaa\x64\x0e\x5b\xbc\x38\x82\xd2\xae\xbe\xe9\xd9\x61\xbb\xfa\x49\xc0" "\xcc\x74\xa9\x7c\xba\x86\xce\x93\x7a\x83\xdf\xb1\x7e\x0d\xa2\x12\x96\x82" "\x33\xc9\x84\x67\x3d\x15\x18\x6f\xf5\x46\x86\x42\x43\x2a\xec\x49\x87\x7c" "\x37\x9b\x73\x23\x63\x44\xbc\x4f\x8b\x9e\xfb\xef\xde\xa7\x1e\xf7\x7f\x6f" "\xac\x49\x35\x1c\xf2\x48\x29\x91\x05\x40\x96\x30\x9c\xe9\x4f\x64\x7a\x90" "\xfb\xbf\x45\x4f\xb0\x4e\xdc\xde\x83\x9d\x82\xef\xf8\xd9\x3f\xab\xd7\x4a" "\xbe\x79\x54\x60\x2b\xaa\x4e\x1b\xbb\xaf\x83\x1f\xc0\x77\xfc\xa0\xeb\x49" "\x8f\xbb\x6a\x2c\x2c\x27\xdc\x72\xa4\x2d\xc7\x62\xcb\x97\x0b\xb4\x9f\xa9" "\x2e\x7e\xd4\xb6\x39\x76\xbc\x93\xb0\x4a\x4a\x43\x71\x56\x67\x3e\x1d\x31" "\xa7\xb1\x03\xc8\x5a\xb4\xf3\x84\x1e\xbc\xa7\x29\x8b\x0f\x33\x83\x24\xaf" "\x7d\x87\x25\x11\x9c\x4e\xa3\xd8\x02\x04\x6c\x48\x18\xb4\x66\x94\xcb\x73" "\xdb\x2a\x17\x7c\x10\x77\xbe\x54\xdf\x45\x01\xc1\xdd\xf8\x86\x10\xc5\x85" "\x70\xcd\xb9\x3c\x41\x3e\xf4\xf8\x84\xfb\x3a\xbb\x4b\x7c\xa9\x66\x90\xd8" "\x31\x5d\xda\xee\x05\x84\xcf", 241); *(uint16_t*)0x20000a99 = r[0]; *(uint32_t*)0x20000a9b = -1; sprintf((char*)0x20000a9f, "0x%016llx", (long long)-1); sprintf((char*)0x20000ab1, "%020llu", (long long)-1); sprintf((char*)0x20000ac5, "0x%016llx", (long long)-1); sprintf((char*)0x20000ad7, "0x%016llx", (long long)-1); sprintf((char*)0x20000ae9, "%023llo", (long long)-1); syz_mount_image( /*fs=*/0x20000180, /*dir=*/0x20000100, /*flags=MS_I_VERSION|MS_PRIVATE|MS_SYNCHRONOUS|MS_STRICTATIME|MS_REMOUNT|MS_RELATIME|0x240c*/ 0x1a4243c, /*opts=*/0x200007c0, /*chdir=*/1, /*size=*/0, /*img=*/0x20000000); memcpy((void*)0x20000080, "./bus\000", 6); syscall(__NR_open, /*file=*/0x20000080ul, /*flags=O_SYNC|O_NOATIME|O_CREAT|O_RDWR|0x400000000*/ 0x400141042ul, /*mode=*/0ul); memcpy((void*)0x20000380, "/dev/loop", 9); *(uint8_t*)0x20000389 = 0x30; *(uint8_t*)0x2000038a = 0; memcpy((void*)0x20000140, "./bus\000", 6); syscall(__NR_mount, /*src=*/0x20000380ul, /*dst=*/0x20000140ul, /*type=*/0ul, /*flags=MS_BIND*/ 0x1000ul, /*data=*/0ul); memcpy((void*)0x20000000, "./bus\000", 6); res = syscall(__NR_open, /*file=*/0x20000000ul, /*flags=O_SYNC|O_NOCTTY|O_NOATIME|O_RDWR|0x3c*/ 0x14113eul, /*mode=*/0ul); if (res != -1) r[1] = res; memcpy((void*)0x20000080, "#! ", 3); *(uint8_t*)0x20000083 = 0xa; syscall(__NR_write, /*fd=*/r[1], /*data=*/0x20000080ul, /*len=*/0x208e24bul); } 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); const char* reason; (void)reason; do_sandbox_none(); return 0; }