// https://syzkaller.appspot.com/bug?id=9426bc33ebdbac2dd67ecbd81da6b25091cfffd8 // 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 #ifndef __NR_memfd_create #define __NR_memfd_create 319 #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 bool write_file(const char* file, const char* what, ...) { char buf[1024]; va_list args; va_start(args, what); vsnprintf(buf, sizeof(buf), what, args); va_end(args); buf[sizeof(buf) - 1] = 0; int len = strlen(buf); int fd = open(file, O_WRONLY | O_CLOEXEC); if (fd == -1) return false; if (write(fd, buf, len) != len) { int err = errno; close(fd); errno = err; return false; } close(fd); return true; } //% This code is derived from puff.{c,h}, found in the zlib development. The //% original files come with the following copyright notice: //% Copyright (C) 2002-2013 Mark Adler, all rights reserved //% version 2.3, 21 Jan 2013 //% This software is provided 'as-is', without any express or implied //% warranty. In no event will the author be held liable for any damages //% arising from the use of this software. //% Permission is granted to anyone to use this software for any purpose, //% including commercial applications, and to alter it and redistribute it //% freely, subject to the following restrictions: //% 1. The origin of this software must not be misrepresented; you must not //% claim that you wrote the original software. If you use this software //% in a product, an acknowledgment in the product documentation would be //% appreciated but is not required. //% 2. Altered source versions must be plainly marked as such, and must not be //% misrepresented as being the original software. //% 3. This notice may not be removed or altered from any source distribution. //% Mark Adler madler@alumni.caltech.edu //% BEGIN CODE DERIVED FROM puff.{c,h} #define MAXBITS 15 #define MAXLCODES 286 #define MAXDCODES 30 #define MAXCODES (MAXLCODES + MAXDCODES) #define FIXLCODES 288 struct puff_state { unsigned char* out; unsigned long outlen; unsigned long outcnt; const unsigned char* in; unsigned long inlen; unsigned long incnt; int bitbuf; int bitcnt; jmp_buf env; }; static int puff_bits(struct puff_state* s, int need) { long val = s->bitbuf; while (s->bitcnt < need) { if (s->incnt == s->inlen) longjmp(s->env, 1); val |= (long)(s->in[s->incnt++]) << s->bitcnt; s->bitcnt += 8; } s->bitbuf = (int)(val >> need); s->bitcnt -= need; return (int)(val & ((1L << need) - 1)); } static int puff_stored(struct puff_state* s) { s->bitbuf = 0; s->bitcnt = 0; if (s->incnt + 4 > s->inlen) return 2; unsigned len = s->in[s->incnt++]; len |= s->in[s->incnt++] << 8; if (s->in[s->incnt++] != (~len & 0xff) || s->in[s->incnt++] != ((~len >> 8) & 0xff)) return -2; if (s->incnt + len > s->inlen) return 2; if (s->outcnt + len > s->outlen) return 1; for (; len--; s->outcnt++, s->incnt++) { if (s->in[s->incnt]) s->out[s->outcnt] = s->in[s->incnt]; } return 0; } struct puff_huffman { short* count; short* symbol; }; static int puff_decode(struct puff_state* s, const struct puff_huffman* h) { int first = 0; int index = 0; int bitbuf = s->bitbuf; int left = s->bitcnt; int code = first = index = 0; int len = 1; short* next = h->count + 1; while (1) { while (left--) { code |= bitbuf & 1; bitbuf >>= 1; int count = *next++; if (code - count < first) { s->bitbuf = bitbuf; s->bitcnt = (s->bitcnt - len) & 7; return h->symbol[index + (code - first)]; } index += count; first += count; first <<= 1; code <<= 1; len++; } left = (MAXBITS + 1) - len; if (left == 0) break; if (s->incnt == s->inlen) longjmp(s->env, 1); bitbuf = s->in[s->incnt++]; if (left > 8) left = 8; } return -10; } static int puff_construct(struct puff_huffman* h, const short* length, int n) { int len; for (len = 0; len <= MAXBITS; len++) h->count[len] = 0; int symbol; for (symbol = 0; symbol < n; symbol++) (h->count[length[symbol]])++; if (h->count[0] == n) return 0; int left = 1; for (len = 1; len <= MAXBITS; len++) { left <<= 1; left -= h->count[len]; if (left < 0) return left; } short offs[MAXBITS + 1]; offs[1] = 0; for (len = 1; len < MAXBITS; len++) offs[len + 1] = offs[len] + h->count[len]; for (symbol = 0; symbol < n; symbol++) if (length[symbol] != 0) h->symbol[offs[length[symbol]]++] = symbol; return left; } static int puff_codes(struct puff_state* s, const struct puff_huffman* lencode, const struct puff_huffman* distcode) { static const short lens[29] = {3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258}; static const short lext[29] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0}; static const short dists[30] = { 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577}; static const short dext[30] = {0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13}; int symbol; do { symbol = puff_decode(s, lencode); if (symbol < 0) return symbol; if (symbol < 256) { if (s->outcnt == s->outlen) return 1; if (symbol) s->out[s->outcnt] = symbol; s->outcnt++; } else if (symbol > 256) { symbol -= 257; if (symbol >= 29) return -10; int len = lens[symbol] + puff_bits(s, lext[symbol]); symbol = puff_decode(s, distcode); if (symbol < 0) return symbol; unsigned dist = dists[symbol] + puff_bits(s, dext[symbol]); if (dist > s->outcnt) return -11; if (s->outcnt + len > s->outlen) return 1; while (len--) { if (dist <= s->outcnt && s->out[s->outcnt - dist]) s->out[s->outcnt] = s->out[s->outcnt - dist]; s->outcnt++; } } } while (symbol != 256); return 0; } static int puff_fixed(struct puff_state* s) { static int virgin = 1; static short lencnt[MAXBITS + 1], lensym[FIXLCODES]; static short distcnt[MAXBITS + 1], distsym[MAXDCODES]; static struct puff_huffman lencode, distcode; if (virgin) { lencode.count = lencnt; lencode.symbol = lensym; distcode.count = distcnt; distcode.symbol = distsym; short lengths[FIXLCODES]; int symbol; for (symbol = 0; symbol < 144; symbol++) lengths[symbol] = 8; for (; symbol < 256; symbol++) lengths[symbol] = 9; for (; symbol < 280; symbol++) lengths[symbol] = 7; for (; symbol < FIXLCODES; symbol++) lengths[symbol] = 8; puff_construct(&lencode, lengths, FIXLCODES); for (symbol = 0; symbol < MAXDCODES; symbol++) lengths[symbol] = 5; puff_construct(&distcode, lengths, MAXDCODES); virgin = 0; } return puff_codes(s, &lencode, &distcode); } static int puff_dynamic(struct puff_state* s) { static const short order[19] = {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; int nlen = puff_bits(s, 5) + 257; int ndist = puff_bits(s, 5) + 1; int ncode = puff_bits(s, 4) + 4; if (nlen > MAXLCODES || ndist > MAXDCODES) return -3; short lengths[MAXCODES]; int index; for (index = 0; index < ncode; index++) lengths[order[index]] = puff_bits(s, 3); for (; index < 19; index++) lengths[order[index]] = 0; short lencnt[MAXBITS + 1], lensym[MAXLCODES]; struct puff_huffman lencode = {lencnt, lensym}; int err = puff_construct(&lencode, lengths, 19); if (err != 0) return -4; index = 0; while (index < nlen + ndist) { int symbol; int len; symbol = puff_decode(s, &lencode); if (symbol < 0) return symbol; if (symbol < 16) lengths[index++] = symbol; else { len = 0; if (symbol == 16) { if (index == 0) return -5; len = lengths[index - 1]; symbol = 3 + puff_bits(s, 2); } else if (symbol == 17) symbol = 3 + puff_bits(s, 3); else symbol = 11 + puff_bits(s, 7); if (index + symbol > nlen + ndist) return -6; while (symbol--) lengths[index++] = len; } } if (lengths[256] == 0) return -9; err = puff_construct(&lencode, lengths, nlen); if (err && (err < 0 || nlen != lencode.count[0] + lencode.count[1])) return -7; short distcnt[MAXBITS + 1], distsym[MAXDCODES]; struct puff_huffman distcode = {distcnt, distsym}; err = puff_construct(&distcode, lengths + nlen, ndist); if (err && (err < 0 || ndist != distcode.count[0] + distcode.count[1])) return -8; return puff_codes(s, &lencode, &distcode); } static int puff(unsigned char* dest, unsigned long* destlen, const unsigned char* source, unsigned long sourcelen) { struct puff_state s = { .out = dest, .outlen = *destlen, .outcnt = 0, .in = source, .inlen = sourcelen, .incnt = 0, .bitbuf = 0, .bitcnt = 0, }; int err; if (setjmp(s.env) != 0) err = 2; else { int last; do { last = puff_bits(&s, 1); int type = puff_bits(&s, 2); err = type == 0 ? puff_stored(&s) : (type == 1 ? puff_fixed(&s) : (type == 2 ? puff_dynamic(&s) : -1)); if (err != 0) break; } while (!last); } *destlen = s.outcnt; return err; } //% END CODE DERIVED FROM puff.{c,h} #define ZLIB_HEADER_WIDTH 2 static int puff_zlib_to_file(const unsigned char* source, unsigned long sourcelen, int dest_fd) { if (sourcelen < ZLIB_HEADER_WIDTH) return 0; source += ZLIB_HEADER_WIDTH; sourcelen -= ZLIB_HEADER_WIDTH; const unsigned long max_destlen = 132 << 20; void* ret = mmap(0, max_destlen, PROT_WRITE | PROT_READ, MAP_PRIVATE | MAP_ANON, -1, 0); if (ret == MAP_FAILED) return -1; unsigned char* dest = (unsigned char*)ret; unsigned long destlen = max_destlen; int err = puff(dest, &destlen, source, sourcelen); if (err) { munmap(dest, max_destlen); errno = -err; return -1; } if (write(dest_fd, dest, destlen) != (ssize_t)destlen) { munmap(dest, max_destlen); return -1; } return munmap(dest, max_destlen); } static int setup_loop_device(unsigned char* data, unsigned long size, const char* loopname, int* loopfd_p) { int err = 0, loopfd = -1; int memfd = syscall(__NR_memfd_create, "syzkaller", 0); if (memfd == -1) { err = errno; goto error; } if (puff_zlib_to_file(data, size, memfd)) { err = errno; goto error_close_memfd; } loopfd = open(loopname, O_RDWR); if (loopfd == -1) { err = errno; goto error_close_memfd; } if (ioctl(loopfd, LOOP_SET_FD, memfd)) { if (errno != EBUSY) { err = errno; goto error_close_loop; } ioctl(loopfd, LOOP_CLR_FD, 0); usleep(1000); if (ioctl(loopfd, LOOP_SET_FD, memfd)) { err = errno; goto error_close_loop; } } close(memfd); *loopfd_p = loopfd; return 0; error_close_loop: close(loopfd); error_close_memfd: close(memfd); error: errno = err; return -1; } static void reset_loop_device(const char* loopname) { int loopfd = open(loopname, O_RDWR); if (loopfd == -1) { return; } if (ioctl(loopfd, LOOP_CLR_FD, 0)) { } close(loopfd); } static long syz_mount_image(volatile long fsarg, volatile long dir, volatile long flags, volatile long optsarg, volatile long change_dir, volatile unsigned long size, volatile long image) { unsigned char* data = (unsigned char*)image; int res = -1, err = 0, need_loop_device = !!size; char* mount_opts = (char*)optsarg; char* target = (char*)dir; char* fs = (char*)fsarg; char* source = NULL; char loopname[64]; if (need_loop_device) { int loopfd; memset(loopname, 0, sizeof(loopname)); snprintf(loopname, sizeof(loopname), "/dev/loop%llu", procid); if (setup_loop_device(data, size, loopname, &loopfd) == -1) return -1; close(loopfd); source = loopname; } mkdir(target, 0777); char opts[256]; memset(opts, 0, sizeof(opts)); if (strlen(mount_opts) > (sizeof(opts) - 32)) { } strncpy(opts, mount_opts, sizeof(opts) - 32); if (strcmp(fs, "iso9660") == 0) { flags |= MS_RDONLY; } else if (strncmp(fs, "ext", 3) == 0) { bool has_remount_ro = false; char* remount_ro_start = strstr(opts, "errors=remount-ro"); if (remount_ro_start != NULL) { char after = *(remount_ro_start + strlen("errors=remount-ro")); char before = remount_ro_start == opts ? '\0' : *(remount_ro_start - 1); has_remount_ro = ((before == '\0' || before == ',') && (after == '\0' || after == ',')); } if (strstr(opts, "errors=panic") || !has_remount_ro) strcat(opts, ",errors=continue"); } else if (strcmp(fs, "xfs") == 0) { strcat(opts, ",nouuid"); } res = mount(source, target, fs, flags, opts); if (res == -1) { err = errno; goto error_clear_loop; } res = open(target, O_RDONLY | O_DIRECTORY); if (res == -1) { err = errno; goto error_clear_loop; } if (change_dir) { res = chdir(target); if (res == -1) { err = errno; } } error_clear_loop: if (need_loop_device) reset_loop_device(loopname); errno = err; return res; } 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 (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); } static void setup_common() { 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); setsid(); 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); setup_common(); sandbox_common(); drop_caps(); if (unshare(CLONE_NEWNET)) { } write_file("/proc/sys/net/ipv4/ping_group_range", "0 65535"); sandbox_common_mount_tmpfs(); setup_binderfs(); loop(); exit(1); } void loop(void) { if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } NONFAILING(memcpy((void*)0x20000000, "ext4\000", 5)); NONFAILING(memcpy((void*)0x20000480, "./bus\000", 6)); NONFAILING(memcpy((void*)0x20000040, "jqfmt=vfsv0", 11)); NONFAILING(*(uint8_t*)0x2000004b = 0x2c); NONFAILING(memcpy((void*)0x2000004c, "test_dummy_encryption", 21)); NONFAILING(*(uint8_t*)0x20000061 = 0x2c); NONFAILING(*(uint8_t*)0x20000062 = 0); NONFAILING(memcpy( (void*)0x20000a40, "\x78\x9c\xec\xdc\x4d\x4f\x5c\xd5\x1b\x00\xf0\xe7\x5e\xa0\xcd\x9f\xf6\x2f" "\x55\xf1\x0d\x5b\x45\x5b\x5b\xb4\x0a\x42\x15\x35\x31\x4d\xd8\xb9\x20\xba" "\xd0\x85\xdb\x09\x50\x6c\xe4\x45\x0b\x26\xb6\x21\x06\x12\x17\x6e\x4d\xec" "\x07\xd0\xb8\xb5\x1f\xc1\x68\x13\x5f\x36\xba\x32\xdd\xaa\xd1\x85\x9a\x10" "\x53\x58\x34\xb1\x8b\x31\x77\xde\x18\xe8\x0c\xed\x28\xf4\x1a\xe6\xf7\x4b" "\xee\xf4\x9c\x3b\x67\x7a\xce\xbd\x4f\x9f\x3b\x77\x4e\x4f\x6e\x00\x6d\xab" "\x3f\x7b\x49\x22\x0e\x46\xc4\x0f\x11\xd1\x53\xae\x6e\x6e\xd0\x5f\xfe\x63" "\xfd\xea\xd2\x44\xb6\x25\x51\x2c\xbe\xfa\x67\x52\x6a\xb7\x76\x75\x69\xa2" "\xda\xb4\xfa\xb9\x03\xd9\x4b\x1a\x31\x90\x46\xa4\xef\x27\xf1\x60\x83\x7e" "\x17\xce\x5f\x78\xb3\x30\x33\x33\x75\xae\x52\x1f\x5a\x9c\x7d\x6b\x68\xe1" "\xfc\x85\xa7\xce\xce\x16\xa6\xa7\xa6\xa7\xe6\x86\x4f\x0d\x8f\x8e\x3e\xf7" "\xec\xf3\x23\xc3\xdb\x0d\xbf\xef\x60\x0b\xc7\xfa\xd2\xf7\xeb\xbf\x7e\xd2" "\xf9\xf2\xdc\xa7\x17\xd7\xe6\xae\x9d\x1e\xe9\xce\xc6\x5b\xfd\x7c\xfd\x71" "\xec\x94\xfe\xe8\xdf\x7c\x2e\xeb\x1c\xdf\xe9\xce\x72\x76\x4f\x5d\x39\xe9" "\xcc\x71\x20\xb4\xa4\x23\x22\xb2\x70\x75\x95\xf2\xbf\x27\x3a\x62\x23\x78" "\x3d\xf1\xcd\x4f\xb9\x0e\x0e\xd8\x55\xc5\xcc\xfe\xa6\x6f\x2f\x17\x81\x3d" "\x2c\x89\xbc\x47\x00\xe4\xa3\xfa\x45\x9f\xfd\xfe\xad\x6e\x0d\xee\x03\xfe" "\x2a\xee\xd6\x0d\x08\xb9\x5a\x1d\x2b\xff\x00\x5c\xab\xcc\xed\xac\xd7\xe2" "\xdf\x19\x69\xb9\xf0\xf6\xf1\xaf\xbe\xdc\xf4\xfb\x7e\x27\xf5\x47\xc4\xeb" "\xe3\xaf\x1c\xc9\xb6\xd8\xa5\x79\x18\x00\x00\x00\x80\x76\xf6\xc5\x58\x44" "\x3c\xd9\x68\xfe\x2f\x8d\x7b\xeb\xda\x65\xe5\xfb\x22\xe2\xfe\x88\x78\x20" "\x22\xfa\x22\x4a\xeb\x7a\x0e\x47\xc4\x91\x88\x78\x28\x22\x1e\xae\xae\x27" "\x6a\xc1\xd6\xf6\x5b\xe6\x7f\x9a\xff\xcf\x24\x3b\x62\x75\x2c\xe2\xc5\xba" "\xb5\x5d\xeb\x75\xf1\xaf\x38\xd4\x51\xa9\xfd\x3f\xab\x44\x57\x72\xe6\xec" "\xcc\xd4\xd3\x11\x71\x47\x44\x0c\x44\xd7\xfe\xac\xbe\xdd\x2a\xad\xd9\x37" "\x0a\xdf\x35\x7b\x6f\x63\xfe\xef\x72\x77\x79\xcf\xd2\x44\x75\x2e\xb0\x32" "\x8e\x3f\x3a\xb7\xfc\x2b\x98\x2c\x2c\x16\xfe\xf1\x01\xb3\xc9\xea\x4a\x44" "\x5f\x67\xa3\xf8\x27\xb5\x95\x40\x49\x44\x3c\x12\x11\x8f\xde\xca\x5f\xf8" "\x75\x69\x45\xdd\x74\xef\xa5\xeb\xb5\x5d\x2f\x7c\x70\xf7\x95\x66\xcd\xeb" "\xe7\x7f\xb3\x2d\xeb\x7f\x73\xfc\xd9\x4d\xc5\x8f\x23\x4e\x34\xcc\xff\x95" "\x5a\x9b\x64\xfb\xf5\x99\x43\xa5\xeb\xc1\x50\xf5\xaa\x70\xa3\x6f\x2f\x8e" "\x7e\xd6\xac\x7f\xf1\xcf\x57\x96\xff\xdd\x0d\xe3\x5f\x5b\xb9\x7a\x28\xa9" "\x5f\xaf\xbb\xd0\x7a\x1f\x97\x7b\x7f\xfe\xb1\xd9\x7b\xd7\x8b\xc5\xe2\xf6" "\xf1\x6f\x7c\xfd\xdf\x97\xbc\x56\x1a\xe0\xbe\xca\xbe\x77\x0b\x8b\x8b\xe7" "\x86\x23\xf6\x25\xe3\x37\xee\x1f\x69\x7d\xcc\x7b\x55\xf5\x7c\x54\xcf\x57" "\x16\xff\x81\xa3\x1b\xf1\xdf\x68\x99\xc6\x5d\x95\x52\x76\x42\x8f\x46\xc4" "\xb1\x88\x78\xac\xb2\x76\xf9\x44\xe9\xbb\x3f\xe2\xf1\x88\x78\x22\x22\x4e" "\x6e\xd3\xe7\xf2\xf4\x2f\x4d\xef\xe3\xe4\x7f\xbe\xb2\xf8\x4f\xb6\x94\xff" "\xad\x17\x7e\x5f\xf9\xf0\x58\xb3\xfe\x6f\x1e\xff\x2c\xff\x9f\x29\x0d\x66" "\xa0\xb2\xc7\xfd\xdf\xcd\xdd\x6a\x80\xf2\x1e\x27\x00\x00\x00\x00\x00\x00" "\x00\x3b\x23\x2d\x3d\x03\x2f\x49\x07\x6b\xe5\x34\x1d\x1c\x2c\x3f\xc3\xaf" "\x37\xba\xd3\x99\xf9\x85\xc5\x93\x67\xe6\xdf\x99\x9b\x2c\x3f\x2b\xef\x50" "\x74\xa5\xd5\x95\x5e\x3d\x75\xeb\x41\x87\x4b\xe5\x8d\xfa\xc8\x96\xfa\xa9" "\x88\xb8\x33\x22\x3e\xea\xf8\x5f\xa9\x3e\x38\x31\x3f\x33\x99\xf7\xc1\x43" "\x9b\x3b\xd0\x24\xff\x33\xbf\x75\xe4\x3d\x3a\x60\xd7\x79\x5e\x2b\xb4\x2f" "\xf9\x0f\xed\x4b\xfe\x43\xfb\x92\xff\xd0\xbe\xe4\x3f\xb4\x2f\xf9\x0f\xed" "\x4b\xfe\x43\xfb\xaa\xe4\xff\x72\xde\xe3\x00\x6e\xbf\xad\xdf\xff\xef\x5d" "\x19\x3f\x7d\xed\xf3\xc3\x97\x72\x1a\x0e\x70\x1b\xb9\xff\x87\xb6\xf4\x6f" "\x9e\xeb\xa7\xa0\xa0\xb0\x57\x0b\x79\x5f\x99\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfe\x1b\xfe" "\x0e\x00\x00\xff\xff\xef\x61\xd2\xa1", 1107)); NONFAILING(syz_mount_image(/*fs=*/0x20000000, /*dir=*/0x20000480, /*flags=MS_NODIRATIME*/ 0x800, /*opts=*/0x20000040, /*chdir=*/1, /*size=*/0x453, /*img=*/0x20000a40)); NONFAILING(memcpy((void*)0x20000100, "./bus\000", 6)); NONFAILING(syz_mount_image(/*fs=*/0, /*dir=*/0x20000100, /*flags=MS_REC|MS_NODIRATIME*/ 0x4800, /*opts=*/0, /*chdir=*/0, /*size=*/0, /*img=*/0x20000000)); NONFAILING(memcpy((void*)0x200003c0, "./bus\000", 6)); syscall(__NR_chdir, /*dir=*/0x200003c0ul); NONFAILING(memcpy((void*)0x20000280, "./file0\000", 8)); syscall(__NR_mkdir, /*path=*/0x20000280ul, /*mode=*/0ul); NONFAILING(memcpy((void*)0x20000300, "./bus\000", 6)); syscall(__NR_mkdir, /*path=*/0x20000300ul, /*mode=*/0ul); NONFAILING(memcpy((void*)0x20000440, "./file1\000", 8)); syscall(__NR_mkdir, /*path=*/0x20000440ul, /*mode=*/0ul); NONFAILING(memcpy((void*)0x200000c0, "./bus\000", 6)); NONFAILING(memcpy((void*)0x20000080, "overlay\000", 8)); NONFAILING(memcpy((void*)0x20000500, "workdir", 7)); NONFAILING(*(uint8_t*)0x20000507 = 0x3d); NONFAILING(memcpy((void*)0x20000508, "./bus", 5)); NONFAILING(*(uint8_t*)0x2000050d = 0x2c); NONFAILING(memcpy((void*)0x2000050e, "lowerdir", 8)); NONFAILING(*(uint8_t*)0x20000516 = 0x3d); NONFAILING(memcpy((void*)0x20000517, "./file0", 7)); NONFAILING(*(uint8_t*)0x2000051e = 0x2c); NONFAILING(memcpy((void*)0x2000051f, "upperdir", 8)); NONFAILING(*(uint8_t*)0x20000527 = 0x3d); NONFAILING(memcpy((void*)0x20000528, "./file1", 7)); NONFAILING(*(uint8_t*)0x2000052f = 0x2c); NONFAILING(*(uint8_t*)0x20000530 = 0); syscall(__NR_mount, /*src=*/0ul, /*dst=*/0x200000c0ul, /*type=*/0x20000080ul, /*flags=*/0ul, /*opts=*/0x20000500ul); NONFAILING(memcpy((void*)0x20000000, "./bus\000", 6)); NONFAILING(memcpy((void*)0x200001c0, "./bus\000", 6)); NONFAILING(memcpy((void*)0x200000c0, "incremental-fs\000", 15)); syscall(__NR_mount, /*src=*/0x20000000ul, /*dst=*/0x200001c0ul, /*type=*/0x200000c0ul, /*flags=*/0ul, /*opts=*/0ul); NONFAILING(memcpy((void*)0x20000240, "./file0\000", 8)); NONFAILING(memcpy((void*)0x20000040, "./file0\000", 8)); NONFAILING(memcpy((void*)0x20000180, "incremental-fs\000", 15)); syscall(__NR_mount, /*src=*/0x20000240ul, /*dst=*/0x20000040ul, /*type=*/0x20000180ul, /*flags=*/0ul, /*opts=*/0ul); } 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; install_segv_handler(); do_sandbox_none(); return 0; }