// https://syzkaller.appspot.com/bug?id=9a3975abfa4c02537b8a73dbbe37be121d31cb2a // 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 #ifndef __NR_memfd_create #define __NR_memfd_create 279 #endif #ifndef __NR_mmap #define __NR_mmap 222 #endif #ifndef __NR_mount #define __NR_mount 40 #endif #ifndef __NR_setxattr #define __NR_setxattr 5 #endif static unsigned long long procid; 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_RDONLY); 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) { if (chdir(target) == -1) { err = errno; close(res); res = -1; } } 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, "stats=global")) { 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); } void loop(void) { if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } // syz_mount_image$ext4 arguments: [ // fs: ptr[in, buffer] { // buffer: {65 78 74 34 00} (length 0x5) // } // dir: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 30 00} (length 0x8) // } // flags: mount_flags = 0x810 (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 { // errors_remount: buffer: {65 72 72 6f 72 73 3d 72 65 6d 6f 75 // 6e 74 2d 72 6f} (length 0x11) // } // comma: const = 0x2c (1 bytes) // } // fs_opt_elem[ext4_options] { // elem: union ext4_options { // grpquota: buffer: {67 72 70 71 75 6f 74 61} (length 0x8) // } // comma: const = 0x2c (1 bytes) // } // } // common: array[fs_opt_elem[fs_options_common]] { // } // null: const = 0x0 (1 bytes) // } // } // chdir: int8 = 0x8 (1 bytes) // size: len = 0x4fe (8 bytes) // img: ptr[in, buffer] { // buffer: (compressed buffer with length 0x4fe) // } // ] // returns fd_dir memcpy((void*)0x200004c0, "ext4\000", 5); memcpy((void*)0x20000500, "./file0\000", 8); memcpy((void*)0x20000000, "errors=remount-ro", 17); *(uint8_t*)0x20000011 = 0x2c; memcpy((void*)0x20000012, "grpquota", 8); *(uint8_t*)0x2000001a = 0x2c; *(uint8_t*)0x2000001b = 0; memcpy( (void*)0x20000a40, "\x78\x9c\xec\xdd\xcf\x6f\x1b\x59\x1d\x00\xf0\xef\x4c\xe2\x26\x9b\x75\x37" "\x5d\xd8\x03\x20\x60\xcb\xb2\x50\xd0\xaa\xce\x8f\xee\x46\x2b\x38\xd0\xbd" "\x80\xd0\x6a\x25\xc4\x8a\x13\x87\x6e\x48\xdc\x28\x8a\x5d\x47\x71\x52\x9a" "\xd0\x43\x72\xe4\x8e\x44\x25\x4e\xf0\x27\x70\xe3\x80\xd4\x13\x07\x6e\xdc" "\xe0\xc6\xa5\x1c\x90\x2a\xa8\x40\x0d\x52\x0f\x46\x33\x9e\x26\x26\x89\x63" "\xb3\x4d\xe2\x26\xfe\x7c\xa4\xf1\xcc\x7b\xe3\xf8\xfb\x9e\xed\xf7\x9e\xe7" "\x25\xce\x0b\x60\x68\x5d\x8d\x88\xed\x88\xb8\x14\x11\x9f\x44\xc4\x64\x91" "\x9f\x14\x5b\xdc\x6c\x6f\xd9\xfd\x9e\x3e\xb9\xbf\xb0\xfb\xe4\xfe\x42\x12" "\xad\xd6\xc7\xff\x48\xf2\xf3\x59\x5e\x74\xfc\x4c\xe6\xd5\xe2\x31\xc7\x23" "\xe2\x87\xdf\x8b\xf8\x49\x72\x38\x6e\x73\x73\x6b\x65\xbe\x56\xab\xae\x15" "\xe9\xa9\xf5\xfa\xea\x54\x73\x73\xeb\xfa\x72\x5a\xe4\xcc\xce\xcd\xcc\x4d" "\xbf\x7f\xe3\xbd\xd9\x13\xab\xeb\x9b\xf5\xdf\x3e\xfe\xee\xf2\x87\x3f\xfa" "\xfd\xef\xbe\xf4\xe8\x4f\xdb\xdf\xfc\x59\x56\xac\xf2\xcf\x2f\xe7\xe7\x3a" "\xeb\x71\x92\xda\x55\x2f\x45\xb9\x23\x6f\x34\x22\x3e\x3c\x8d\x60\x03\x32" "\x5a\xbc\x7f\x38\x7f\xb2\xd6\xf6\x99\x88\x78\x2b\x6f\xff\x93\x31\x92\xbf" "\x9a\xfd\x39\xa2\x59\x03\x00\xe7\x40\xab\x35\x19\xad\xc9\xce\x34\x00\x70" "\xd1\x65\xd7\xff\xe5\x48\xd2\x4a\x31\x17\x50\x8e\x34\xad\x54\xda\x73\x78" "\x6f\xc4\x44\x5a\x6b\x34\xd7\xdf\x99\x6c\x6c\xdc\x59\x8c\x7c\x0e\xeb\x4a" "\x94\xd2\xdb\xcb\xb5\xea\x74\x31\x57\x78\x25\x4a\x49\x96\x9e\xc9\x8f\xf7" "\xd3\xb3\x07\xd2\x37\x22\xe2\xf5\x88\xf8\xc5\xd8\x2b\x79\xba\xb2\xd0\xa8" "\x2d\x0e\xf2\x83\x0f\x00\x0c\xb1\x57\x0f\x8c\xff\xff\x1e\x6b\x8f\xff\x00" "\xc0\x05\x37\x3e\xe8\x02\x00\x00\x67\xce\xf8\x0f\x00\xc3\xc7\xf8\x0f\x00" "\xc3\xe7\xff\x18\xff\xfb\xff\x76\x20\x00\xf0\x52\x73\xfd\x0f\x00\xc3\xc7" "\xf8\x0f\x00\xc3\xa7\xe7\xf8\xbf\x73\x36\xe5\x00\x00\xce\xc4\x0f\x3e\xfa" "\x28\xdb\x5a\xbb\xc5\xff\xbf\x5e\xbc\xbb\xb9\xf1\xed\xf2\xdd\xeb\x8b\xd5" "\xe6\x4a\xa5\xbe\xb1\x50\x59\x68\xac\xad\x56\x96\x1a\x8d\xa5\x5a\xb5\xb2" "\xd0\x6a\xf5\x7a\xbc\x5a\xa3\xb1\x3a\xf3\xee\x5e\xb2\xb9\xb9\x75\xab\xde" "\xd8\xb8\xb3\x7e\x6b\xb9\x3e\xbf\x54\xbd\x55\x2d\x9d\x72\x7d\x00\x80\xde" "\x5e\x7f\xf3\xe1\x5f\x92\x88\xd8\xfe\xd6\x2b\xf9\x16\x1d\x6b\x39\x18\xab" "\xe1\x62\x4b\x07\x5d\x00\x60\x60\x46\x06\x5d\x00\x60\x60\x7c\x9f\x07\x86" "\x57\x1f\xd7\xf8\xa6\x01\xe0\x82\xeb\xb5\x96\x67\xd7\x3f\x11\x7a\x60\xf1" "\x57\x38\xaf\xae\x7d\xde\xfc\x3f\x0c\x2b\xf3\xff\x30\xbc\x3e\xdd\xfc\xff" "\x77\x4e\xbc\x1c\xc0\xd9\x33\xff\x0f\xc3\xab\xd5\x4a\xac\xf9\x0f\x00\x43" "\xc6\x1c\x3f\xf0\x42\xbf\xff\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x21\x55\xce\xb7" "\x24\xad\xe4\x6b\x81\x6f\x67\xb7\x69\xa5\x12\x71\x39\x22\xae\x44\x29\xb9" "\xbd\x5c\xab\x4e\x47\xc4\x6b\x11\xf1\xe7\xb1\xd2\x58\x96\x9e\x19\x74\xa1" "\x01\x80\x17\x94\xfe\x3d\x29\xd6\xff\xba\x36\xf9\x76\xf9\xe0\xd9\x4b\xc9" "\x7f\xc6\xf2\x7d\x44\xfc\xf4\x57\x1f\xff\xf2\xde\xfc\xfa\xfa\xda\x4c\x96" "\xff\xcf\xbd\xfc\xf5\x07\x45\xfe\xec\xa5\x41\x54\x00\x00\xe8\x74\xf3\x70" "\x56\x7b\x9c\x2e\xf6\x1d\x17\xf2\x4f\x9f\xdc\x5f\x78\xbe\x9d\x65\x11\x1f" "\x7f\xd0\x5e\x5c\x34\x8b\xbb\x5b\x6c\xed\x33\xa3\x31\x9a\xef\xc7\xa3\x14" "\x11\x13\xff\x4a\x8a\x74\x5b\xf6\x79\x65\xe4\x04\xe2\x6f\xef\x44\xc4\xe7" "\xf6\xeb\x7f\xaf\x23\x42\x39\x9f\x03\x69\xaf\x7c\x7a\x30\x7e\x16\xfb\xf2" "\x29\xc4\xdf\x7f\xfe\x0f\xc6\x4f\xff\x27\x7e\x9a\x9f\xcb\xf6\xa5\xfc\xb9" "\xf8\xec\x09\x94\x05\x86\xcd\xc3\x0f\xda\xfd\x64\xd1\xf6\xb2\x26\x56\xb4" "\xbf\x34\xae\xe6\xfb\xa3\xdb\xff\x78\xde\x43\xbd\xb8\xe7\xfd\xdf\xee\xa1" "\xfe\x2f\xdd\xeb\xff\x46\x0e\xc5\x4f\xf2\x36\x7f\x75\x2f\x7d\x7c\x49\x1e" "\xbf\xfb\x87\xef\x1f\xca\x6c\x4d\xb6\xcf\xed\x44\x7c\x61\xf4\xa8\xf8\xc9" "\x5e\xfc\xa4\x4b\xff\xfb\x76\x9f\x75\xfc\xeb\x17\xbf\xfc\x56\xb7\x73\xad" "\x5f\x47\x5c\x8b\xa3\xe3\xb7\xd5\xf3\x6e\x76\x6a\xbd\xbe\x3a\xd5\xdc\xdc" "\xba\xbe\x5c\x9f\x5f\xaa\x2e\x55\xef\xcc\xce\xce\xcd\xcc\x4d\xbf\x7f\xe3" "\xbd\xd9\xa9\x7c\x8e\xba\x7d\xfb\xc7\x03\x0f\xff\xac\x58\xe6\xfe\xb5\xae" "\xcf\xcd\x4e\xc4\x44\x97\xf8\xe3\x3d\xea\xff\xb5\x3e\xeb\xff\x9b\x67\x9f" "\xfc\xf8\x2b\xc7\xc4\xff\xc6\x57\x8f\x7e\xfd\xdf\x38\x26\x7e\x36\x26\x7e" "\xbd\xcf\xf8\xf3\x13\x37\xbb\x2e\xdf\x9d\xc5\x5f\xec\x52\xff\x5e\xaf\xff" "\x3b\x7d\xc6\x7f\xf4\xb7\xad\xc5\x3e\xef\x0a\x00\x9c\x81\xe6\xe6\xd6\xca" "\x7c\xad\x56\x5d\xeb\x71\x90\x7d\xd6\xec\x75\x1f\x07\xe7\xf3\x20\xb6\x23" "\x5e\x82\x62\xf4\x3a\x48\x8b\xb7\xec\xcb\x52\x9e\x0b\x7e\x70\x4c\xa7\x91" "\x9e\x51\xe7\x04\x9c\xaa\xfd\x46\x3f\xe8\x92\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\xdd\x34\x37\xb7\x56\xc6\xe2\x74\xbf\x4e\x34\xe8\x3a" "\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x70\x71\xfd\x37\x00\x00\xff\xff\x2d\x33\xd2" "\x1d", 1278); syz_mount_image(/*fs=*/0x200004c0, /*dir=*/0x20000500, /*flags=MS_SYNCHRONOUS|MS_NODIRATIME*/ 0x810, /*opts=*/0x20000000, /*chdir=*/8, /*size=*/0x4fe, /*img=*/0x20000a40); // mount arguments: [ // src: ptr[in, blockdev_filename] { // union blockdev_filename { // filename: buffer: {6d 74 64 30 00} (length 0x5) // } // } // dst: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 30 00} (length 0x8) // } // type: ptr[in, buffer] { // buffer: {6a 66 66 73 32 00} (length 0x6) // } // flags: mount_flags = 0x800000 (8 bytes) // data: nil // ] memcpy((void*)0x20000200, "mtd0\000", 5); memcpy((void*)0x20000100, "./file0\000", 8); memcpy((void*)0x20000300, "jffs2\000", 6); syscall(__NR_mount, /*src=*/0x20000200ul, /*dst=*/0x20000100ul, /*type=*/0x20000300ul, /*flags=MS_I_VERSION*/ 0x800000ul, /*data=*/0ul); // setxattr$system_posix_acl arguments: [ // path: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 30 00} (length 0x8) // } // name: ptr[in, buffer] { // buffer: {73 79 73 74 65 6d 2e 70 6f 73 69 78 5f 61 63 6c 5f 64 65 66 // 61 75 6c 74 00} (length 0x19) // } // val: ptr[inout, array[ANYUNION]] { // array[ANYUNION] { // union ANYUNION { // ANYBLOB: buffer: {02 00 00 00 01 00 02 00 00 00 00 00 04 00 00 00 // 00 00 00 00 10 00 04 00 00 00 00 00 20} (length 0x1d) // } // } // } // size: len = 0x24 (8 bytes) // flags: setxattr_flags = 0x0 (8 bytes) // ] memcpy((void*)0x200000c0, "./file0\000", 8); memcpy((void*)0x20000000, "system.posix_acl_default\000", 25); memcpy((void*)0x20000240, "\x02\x00\x00\x00\x01\x00\x02\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00" "\x00\x00\x00\x10\x00\x04\x00\x00\x00\x00\x00\x20", 29); syscall(__NR_setxattr, /*path=*/0x200000c0ul, /*name=*/0x20000000ul, /*val=*/0x20000240ul, /*size=*/0x24ul, /*flags=*/0ul); } int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x20000000ul, /*len=*/0x1000000, /*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=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); const char* reason; (void)reason; do_sandbox_none(); return 0; }