// https://syzkaller.appspot.com/bug?id=b3d4ed3e41b3085ce97f4504f4183e3f99115fb2 // 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 #ifndef __NR_fallocate #define __NR_fallocate 47 #endif #ifndef __NR_memfd_create #define __NR_memfd_create 279 #endif #ifndef __NR_mmap #define __NR_mmap 222 #endif #ifndef __NR_openat #define __NR_openat 56 #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 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; } #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_RDONLY); 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 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_one(void) { intptr_t res = 0; if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } // syz_mount_image$ext4 arguments: [ // fs: ptr[in, buffer] { // buffer: {65 78 74 34 00} (length 0x5) // } // dir: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 31 00} (length 0x8) // } // flags: mount_flags = 0x20081e (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 { // nodelalloc: buffer: {6e 6f 64 65 6c 61 6c 6c 6f 63} (length // 0xa) // } // comma: const = 0x2c (1 bytes) // } // fs_opt_elem[ext4_options] { // elem: union ext4_options { // grpid: buffer: {67 72 70 69 64} (length 0x5) // } // comma: const = 0x2c (1 bytes) // } // fs_opt_elem[ext4_options] { // elem: union ext4_options { // auto_da_alloc: buffer: {61 75 74 6f 5f 64 61 5f 61 6c 6c 6f // 63} (length 0xd) // } // comma: const = 0x2c (1 bytes) // } // } // common: array[fs_opt_elem[fs_options_common]] { // } // null: const = 0x0 (1 bytes) // } // } // chdir: int8 = 0x1 (1 bytes) // size: len = 0x4ef (8 bytes) // img: ptr[in, buffer] { // buffer: (compressed buffer with length 0x4ef) // } // ] // returns fd_dir memcpy((void*)0x20000080, "ext4\000", 5); memcpy((void*)0x200000c0, "./file1\000", 8); memcpy((void*)0x20000040, "nodelalloc", 10); *(uint8_t*)0x2000004a = 0x2c; memcpy((void*)0x2000004b, "grpid", 5); *(uint8_t*)0x20000050 = 0x2c; memcpy((void*)0x20000051, "auto_da_alloc", 13); *(uint8_t*)0x2000005e = 0x2c; *(uint8_t*)0x2000005f = 0; memcpy( (void*)0x200003c0, "\x78\x9c\xec\xdd\x4d\x6f\x5b\x59\x19\x00\xe0\xd7\xce\x97\x93\xc9\x4c\x32" "\xc3\x2c\x00\x01\x53\x86\x81\x82\xaa\x3a\x89\xdb\x46\x55\x17\x50\x56\x08" "\xa1\x4a\x88\x2e\x41\x6a\x43\xe2\x46\x51\xec\x38\x8a\x9d\xd2\x84\x2e\xd2" "\xff\x80\x44\x25\x56\xb0\xe4\x07\xb0\xee\x8a\x3d\x1b\x04\x3b\x36\x65\x81" "\xc4\x47\x04\x6a\x2a\xb1\x30\xba\xd7\x37\xa9\x9b\xda\x4d\x68\x12\x3b\x8a" "\x9f\x47\xba\xba\xf7\xdc\x63\xfb\x3d\x27\xce\x3d\xc7\x7e\x9d\xf8\x04\x30" "\xb0\x2e\x45\xc4\x4e\x44\x8c\x46\xc4\xfd\x88\x98\xca\xce\xe7\xb2\x2d\x6e" "\xb7\xb6\xe4\x76\x2f\x76\x1f\x2f\xee\xed\x3e\x5e\xcc\x45\xb3\x79\xf7\x9f" "\xb9\xb4\x3e\x39\x17\x6d\xf7\x49\xbc\x97\x3d\x66\x21\x22\x7e\xf4\xbd\x88" "\x9f\xe6\xde\x8c\x5b\xdf\xda\x5e\x5d\xa8\x54\xca\x1b\xad\xe2\xf8\x4c\xa3" "\xba\x3e\x53\xdf\xda\xbe\xba\x52\x5d\x58\x2e\x2f\x97\xd7\x4a\xa5\xf9\xb9" "\xf9\xd9\x9b\xd7\x6e\x94\x4e\xad\xaf\x9f\x54\x47\xb3\xa3\x2f\x3f\xff\xc3" "\xce\xb7\x7e\x9e\x34\x6b\x32\x3b\xd3\xde\x8f\xd3\xd4\xea\xfa\xc8\x41\x9c" "\xc4\x70\x44\xfc\xe0\x2c\x82\xf5\xc1\x50\xd6\x9f\xd1\x7e\x37\x84\x77\x92" "\x8f\x88\x8f\x22\xe2\xd3\xf4\xfa\x9f\x8a\xa1\xf4\xd9\x04\x00\x2e\xb2\x66" "\x73\x2a\x9a\x53\xed\x65\x00\xe0\xa2\xcb\xa7\x39\xb0\x5c\xbe\x98\xe5\x02" "\x26\x23\x9f\x2f\x16\x5b\x39\xbc\x8f\x63\x22\x5f\xa9\xd5\x1b\x57\x1e\xd4" "\x36\xd7\x96\x5a\xb9\xb2\xe9\x18\xc9\x3f\x58\xa9\x94\x67\xb3\x5c\xe1\x74" "\x8c\xe4\x92\xf2\x5c\x7a\xfc\xaa\x5c\x3a\x54\xbe\x16\x11\x1f\x46\xc4\x2f" "\xc6\xc6\xd3\x72\x71\xb1\x56\x59\xea\xe7\x0b\x1f\x00\x18\x60\xef\x1d\x9a" "\xff\xff\x33\xd6\x9a\xff\x01\x80\x0b\xae\xd0\xef\x06\x00\x00\x3d\x67\xfe" "\x07\x80\xc1\x63\xfe\x07\x80\xc1\x63\xfe\x07\x80\xc1\x63\xfe\x07\x80\xc1" "\x63\xfe\x07\x80\xc1\x63\xfe\x07\x80\x81\xf2\xc3\x3b\x77\x92\xad\xb9\x97" "\x7d\xff\xf5\xd2\xc3\xad\xcd\xd5\xda\xc3\xab\x4b\xe5\xfa\x6a\xb1\xba\xb9" "\x58\x5c\xac\x6d\xac\x17\x97\x6b\xb5\xe5\xf4\x3b\x7b\xaa\x47\x3d\x5e\xa5" "\x56\x5b\x9f\xbb\x1e\x9b\x8f\xa6\xbf\xbd\x5e\x6f\xcc\xd4\xb7\xb6\xef\x55" "\x6b\x9b\x6b\x8d\x7b\xe9\xf7\x7a\xdf\x2b\x8f\xf4\xa4\x57\x00\xc0\xdb\x7c" "\xf8\xc9\xb3\x3f\xe7\x22\x62\xe7\xd6\x78\xba\x45\xdb\x5a\x0e\xe6\x6a\xb8" "\xd8\xf2\xfd\x6e\x00\xd0\x37\x43\xfd\x6e\x00\xd0\x37\x56\xfb\x82\xc1\x75" "\x82\xf7\xf8\xd2\x03\x70\x41\x74\x58\xa2\xf7\x35\x85\x88\x18\x3f\x7c\xb2" "\xd9\x6c\x36\xcf\xae\x49\xc0\x19\xbb\xfc\x05\xf9\x7f\x18\x54\x6d\xf9\x7f" "\x7f\x05\x0c\x03\x46\xfe\x1f\x06\x97\xfc\x3f\x0c\xae\x66\x33\x77\xdc\x35" "\xff\xe3\xb8\x37\x04\x00\xce\x37\x39\x7e\xa0\xcb\xe7\xff\x1f\x65\xfb\xdf" "\x66\x1f\x0e\xfc\x64\xe9\xf0\x2d\x9e\x9e\x65\xab\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\x7c\xdb\x5f\xff\xb7\x98\xad\x05\x3e\x19\xf9\x7c\xb1\x18\xf1\x7e\x44" "\x4c\xc7\x48\xee\xc1\x4a\xa5\x3c\x1b\x11\x1f\x44\xc4\x9f\xc6\x46\xc6\x92" "\xf2\x5c\x9f\xdb\x0c\x00\x9c\x54\xfe\x6f\xb9\x6c\xfd\xaf\xcb\x53\x9f\x4d" "\x1e\xae\x1d\xcd\xbd\x1c\x4b\xf7\x11\xf1\xb3\x5f\xdd\xfd\xe5\xa3\x85\x46" "\x63\xe3\x8f\xc9\xf9\x7f\x1d\x9c\x6f\x3c\xcd\xce\x97\xfa\xd1\x7e\x00\xe0" "\x28\xfb\xf3\x74\xba\x6f\x7b\x23\xff\x62\xf7\xf1\xe2\xfe\xd6\xcb\xf6\xfc" "\xfd\xbb\x11\x51\x68\xc5\xdf\xdb\x1d\x8d\xbd\x83\xf8\xc3\x31\x9c\xee\x0b" "\x31\x12\x11\x13\xff\xce\x65\xe5\x96\x5c\x5b\xee\xe2\x24\x76\x9e\x44\xc4" "\xe7\x3b\xf5\x3f\x17\x93\x69\x0e\xa4\xb5\xf2\xe9\xe1\xf8\x49\xec\xf7\x7b" "\x1a\x3f\xff\x5a\xfc\x7c\x5a\xd7\xda\x27\x3f\x8b\xcf\x9d\x42\x5b\x60\xd0" "\x3c\x4b\xc6\x9f\xdb\x9d\xae\xbf\x7c\x5c\x4a\xf7\x9d\xaf\xff\x42\x3a\x42" "\x9d\x5c\x36\xfe\x25\x0f\xb5\xb8\x97\x8e\x81\xaf\xe2\xef\x8f\x7f\x43\x5d" "\xc6\xbf\x4b\xc7\x8d\x71\xfd\xf7\xdf\x6f\x1d\x8d\xbf\x59\xf7\x24\xe2\x8b" "\xc3\x11\xfb\xb1\xf7\xda\xc6\x9f\xfd\xf8\xb9\x2e\xf1\x3f\x3b\x66\xfc\xbf" "\x7c\xe9\x2b\x9f\x76\xab\x6b\xfe\x3a\xe2\x72\x74\x8e\xdf\x1e\x6b\xa6\x51" "\x5d\x9f\xa9\x6f\x6d\x5f\x5d\xa9\x2e\x2c\x97\x97\xcb\x6b\xa5\xd2\xfc\xdc" "\xfc\xec\xcd\x6b\x37\x4a\x33\x69\x8e\x7a\xa6\xfb\x6c\xf0\x8f\x5b\x57\x3e" "\xe8\x56\x97\xf4\x7f\xa2\x4b\xfc\xc2\x11\xfd\xff\xfa\x31\xfb\xff\x9b\xff" "\xde\xff\xf1\x57\xdf\x12\xff\x9b\x5f\xeb\x14\x3f\x1f\x1f\xbf\x25\x7e\x32" "\x27\x7e\xe3\x98\xf1\x17\x26\x7e\x57\xe8\x56\x97\xc4\x5f\xea\xd2\xff\xa3" "\x9e\xff\x2b\xc7\x8c\xff\xfc\xaf\xdb\x6f\x2c\x1b\x0e\x00\xf4\x4f\x7d\x6b" "\x7b\x75\xa1\x52\x29\x6f\xf4\xf2\x60\xff\x85\x44\x4f\x83\x3a\xb8\x00\x07" "\xc9\x6f\xcd\x39\x68\x46\xc7\x83\xef\xf4\x2a\xd6\x68\xfc\x5f\xf7\x6a\x36" "\xdf\x29\x56\xb7\x11\xe3\x34\xb2\x6e\xc0\x79\x70\x70\xd1\x47\xc4\xcb\x7e" "\x37\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe8\xa8\x17\xff\xb1" "\xd4\xef\x3e\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\x2f\x00\x00\xff\xff\x3d" "\x7c\xce\xd6", 1263); syz_mount_image( /*fs=*/0x20000080, /*dir=*/0x200000c0, /*flags=MS_SYNCHRONOUS|MS_RELATIME|MS_NOSUID|MS_NOEXEC|0x804*/ 0x20081e, /*opts=*/0x20000040, /*chdir=*/1, /*size=*/0x4ef, /*img=*/0x200003c0); // openat$cgroup_ro arguments: [ // fd: fd_cgroup (resource) // file: ptr[in, buffer] { // buffer: {63 67 72 6f 75 70 2e 63 6f 6e 74 72 6f 6c 6c 65 72 73 00} // (length 0x13) // } // flags: const = 0x275a (4 bytes) // mode: const = 0x0 (2 bytes) // ] // returns fd memcpy((void*)0x20000080, "cgroup.controllers\000", 19); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x20000080ul, /*flags=*/0x275a, /*mode=*/0); if (res != -1) r[0] = res; // fallocate arguments: [ // fd: fd (resource) // mode: fallocate_mode = 0x0 (8 bytes) // off: intptr = 0x0 (8 bytes) // len: intptr = 0x8009 (8 bytes) // ] syscall(__NR_fallocate, /*fd=*/r[0], /*mode=*/0ul, /*off=*/0ul, /*len=*/0x8009ul); // 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 = 0x8413 (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 { // grpid: buffer: {67 72 70 69 64} (length 0x5) // } // comma: const = 0x2c (1 bytes) // } // fs_opt_elem[ext4_options] { // elem: union ext4_options { // bsdgroups: buffer: {62 73 64 67 72 6f 75 70 73} (length 0x9) // } // comma: const = 0x2c (1 bytes) // } // fs_opt_elem[ext4_options] { // elem: union ext4_options { // nogrpid: buffer: {6e 6f 67 72 70 69 64} (length 0x7) // } // comma: const = 0x2c (1 bytes) // } // fs_opt_elem[ext4_options] { // elem: union ext4_options { // noblock_validity: buffer: {6e 6f 62 6c 6f 63 6b 5f 76 61 6c 69 // 64 69 74 79} (length 0x10) // } // comma: const = 0x2c (1 bytes) // } // } // common: array[fs_opt_elem[fs_options_common]] { // } // null: const = 0x0 (1 bytes) // } // } // chdir: int8 = 0x0 (1 bytes) // size: len = 0x50c (8 bytes) // img: ptr[in, buffer] { // buffer: (compressed buffer with length 0x50c) // } // ] // returns fd_dir memcpy((void*)0x20000040, "ext4\000", 5); memcpy((void*)0x20000500, "./file0\000", 8); memcpy((void*)0x200003c0, "grpid", 5); *(uint8_t*)0x200003c5 = 0x2c; memcpy((void*)0x200003c6, "bsdgroups", 9); *(uint8_t*)0x200003cf = 0x2c; memcpy((void*)0x200003d0, "nogrpid", 7); *(uint8_t*)0x200003d7 = 0x2c; memcpy((void*)0x200003d8, "noblock_validity", 16); *(uint8_t*)0x200003e8 = 0x2c; *(uint8_t*)0x200003e9 = 0; memcpy( (void*)0x20000a40, "\x78\x9c\xec\xdd\xcf\x6b\x1c\x6d\x1d\x00\xf0\xef\x6c\xb2\x79\x9b\x26\x7d" "\x93\x57\x3d\xe8\x0b\xbe\x6f\xb5\x95\xb4\x68\x77\x93\x86\xb6\xc1\x43\xad" "\x20\x7a\x2a\xa8\xf5\x5e\x63\xb2\x09\x21\x9b\x6c\xc9\x6e\xda\x26\x14\x9b" "\xe2\x1f\x20\x88\xa8\xe0\x49\x2f\x5e\x04\xff\x00\x41\x0a\x5e\x3c\x8a\x50" "\xd0\xb3\xa2\xa2\x88\xb6\x7a\x50\xd0\x8e\xec\xee\x6c\x9a\x26\xbb\x49\xde" "\x74\x9b\x4d\x93\xcf\x07\xa6\xf3\xfc\xd8\x99\xef\xf3\x6c\x3b\xb3\xf3\xcc" "\x4c\x67\x02\x38\xb1\x6e\x64\xd3\xf3\x34\x4d\x2f\x46\xc4\x48\x56\x9e\xcb" "\xa6\x4f\xd6\x33\x1b\x11\x67\x23\xe2\xd9\xd3\x07\x33\xf5\x29\x89\x34\xbd" "\xf5\xf7\x24\x92\xac\xac\xb5\xae\xb4\xe1\xad\x18\x6a\x2e\xd2\x58\xc1\x57" "\xbf\x14\xf1\x8d\x64\x67\xdc\xea\xda\xfa\xe2\x74\xb9\x5c\x5a\xc9\xf2\xc5" "\xda\xd2\x9d\x62\x75\x6d\xfd\xd2\xc2\xd2\xf4\x7c\x69\xbe\xb4\x3c\x39\x39" "\x71\x75\xea\xda\xd4\x95\xa9\xf1\x57\xe9\xde\xdc\x50\x96\x38\x13\x11\xd7" "\xbf\xf0\xe7\xef\x7d\xfb\x27\x5f\xbc\xfe\x8b\xcf\xdc\xfb\xc3\xed\xbf\x5e" "\xf8\x66\xd2\x6c\xf3\xc3\xd8\xd6\x8f\x0f\xa8\x7f\xb7\xca\xe6\xf7\x99\x8f" "\x53\x5b\xca\xea\x71\x57\x0e\x18\xec\x28\xea\xdf\x9a\x18\xdc\xdf\x32\x8f" "\xb2\x7f\x22\x00\x00\x1c\xae\xfa\x71\xe9\x87\xb2\xe3\xfc\x8b\x31\x12\x7d" "\xbb\x1f\xce\x02\x00\x00\x00\x6f\xa0\xf4\x73\xc3\xf1\xdf\xa4\x75\xed\x6e" "\x87\x81\x0e\xe5\x00\x00\x00\xc0\x1b\x24\x17\x11\xc3\x91\xe4\x0a\xd9\xfd" "\xbe\xc3\x91\xcb\x15\x0a\xd1\xb8\x87\xf7\x23\x71\x3a\x57\xae\x54\x6b\x9f" "\x9e\xab\xac\x2e\xcf\xd6\xeb\x22\x46\x23\x9f\x9b\x5b\x28\x97\xc6\xb3\x7b" "\x5b\x47\x23\x9f\xd4\xf3\x13\x8d\xf4\x8b\xfc\xe5\x6d\xf9\xc9\x88\x78\x27" "\x22\xbe\x3b\x32\xd8\xc8\x17\x66\x2a\xe5\xd9\x5e\x9f\xfc\x00\x00\x00\x80" "\x13\x62\x68\xdb\xf8\xff\x5f\x23\xcd\xf1\x3f\x00\x00\x00\x70\xcc\x8c\xf6" "\xba\x01\x00\x00\x00\xc0\x6b\x67\xfc\x0f\x00\x00\x00\xc7\x9f\xf1\x3f\x00" "\x00\x00\x1c\x6b\x5f\xbe\x79\xb3\x3e\xa5\xad\xf7\x5f\xcf\xde\x5d\x5b\x5d" "\xac\xdc\xbd\x34\x5b\xaa\x2e\x16\x96\x56\x67\x0a\x33\x95\x95\x3b\x85\xf9" "\x4a\x65\xbe\xf1\xcc\xbe\xa5\x5d\x57\xb6\xf9\xea\xc0\xe5\xd5\xfb\xc5\x5a" "\xa9\x5a\x2b\x56\xd7\xd6\x6f\x2f\x55\x56\x97\x6b\xb7\x17\x5e\x7a\x05\x36" "\x00\x00\x00\x70\x88\xde\x79\xff\xf1\xef\x92\x88\xd8\xf8\xec\x60\x63\xaa" "\x1b\xd8\x52\xff\x9f\xec\x3d\x01\x3d\x6b\x20\xf0\xda\x6c\x9e\xb2\x8b\x24" "\x9b\x0f\xec\xfc\xd0\xef\xdf\x6e\xce\xff\x74\x48\x8d\x02\x0e\x45\x5f\xaf" "\x1b\x00\xf4\x4c\x7f\xaf\x1b\x00\xf4\x4c\xbe\xd7\x0d\x00\x7a\x2e\xd9\xa3" "\xbe\xe3\xcd\x3b\xbf\xce\xe6\x9f\xe8\x6e\x7b\x00\x00\x80\xee\x1b\xfb\x58" "\xe7\xeb\xff\xb9\x5d\x97\xdc\xd8\xbd\x1a\x38\xf2\x6c\xc4\x70\x72\xb9\xfe" "\x0f\x27\x57\xe3\xfa\x7f\x9b\x5b\xfe\xda\x72\xb0\x00\xc7\x4a\xde\x11\x00" "\x9c\x78\xaf\x7c\xfd\x7f\x4f\xfe\x0f\x11\x00\x00\xf4\xda\x70\x63\x4a\x72" "\x85\xec\xf4\xde\x70\xe4\x72\x85\x42\xc4\x99\xc6\x6b\x01\xf2\xc9\xdc\x42" "\xb9\x34\x1e\x11\x6f\x47\xc4\x6f\x47\xf2\x6f\xd5\xf3\x13\x8d\x25\x93\x3d" "\xc7\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x40\x53\x9a\x26\x91\x02\x00\x00\x00\xc7\x5a\x44\xee\x2f\xc9" "\x2f\x9b\xcf\xf2\x1f\x1b\x39\x3f\xbc\xfd\xfc\xc0\x40\xf2\xef\x91\xc8\x5e" "\x11\x7a\xef\x87\xb7\xbe\x7f\x7f\xba\x56\x5b\x99\xa8\x97\xff\x63\xb3\xbc" "\xf6\x83\xac\xfc\x72\x2f\xce\x60\x00\x00\x00\x00\xdb\xb5\xc6\xe9\xad\x71" "\x3c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x74\xd3\xb3\xa7\x0f\x66\x5a\xd3\x61\xc6\xfd\xdb\xe7\x23\x62\xb4" "\x5d\xfc\xfe\x38\xd5\x98\x9f\x8a\x7c\x44\x9c\xfe\x67\x12\xfd\x5b\x96\x4b" "\x22\xa2\xaf\x0b\xf1\x37\x1e\x45\xc4\x47\xdb\xc5\x4f\xea\xcd\xda\x0c\xd9" "\x2e\xfe\xe0\xeb\x8f\x1f\xa3\xd9\xb7\xd0\x2e\xfe\x50\x17\xe2\xc3\x49\xf6" "\xb8\xbe\xff\xb9\xd1\x6e\xfb\xcb\xc5\xd9\xc6\xbc\xfd\xf6\xd7\x1f\xf1\x52" "\xfe\xa0\x3a\xef\xff\x62\x73\xff\xd7\xd7\x61\xfb\x3f\xb3\xcf\x18\xef\x3e" "\xf9\x59\xb1\x63\xfc\x47\x11\xef\xf6\xb7\xdf\xff\xb4\xe2\x27\x1d\xe2\x9f" "\xdb\x67\xfc\xaf\x7f\x6d\x7d\xbd\x53\x5d\xfa\xa3\x88\xb1\xb6\xbf\x3f\xc9" "\x4b\xb1\x8a\xb5\xa5\x3b\xc5\xea\xda\xfa\xa5\x85\xa5\xe9\xf9\xd2\x7c\x69" "\x79\x72\x72\xe2\xea\xd4\xb5\xa9\x2b\x53\xe3\xc5\xb9\x85\x72\x29\xfb\xb3" "\x6d\x8c\xef\x7c\xfc\xe7\xcf\x77\xeb\xff\xe9\x0e\xf1\x47\xf7\xe8\xff\xf9" "\x7d\xf6\xff\x7f\x4f\xee\x3f\xfd\x70\x33\x99\x6f\x17\xff\xc2\xb9\x36\xf1" "\x7f\xf5\xe3\xec\x13\x3b\xe3\xe7\xb2\xdf\xbe\x4f\x65\xe9\x7a\xfd\x58\x2b" "\xbd\xd1\x4c\x6f\xf5\xde\x4f\x7f\xf3\xde\x6e\xfd\x9f\xed\xd0\xff\xbd\xfe" "\xfe\x2f\xec\xb3\xff\x17\xbf\xf2\xad\x3f\xee\xf3\xa3\x00\xc0\x21\xa8\xae" "\xad\x2f\x4e\x97\xcb\xa5\x95\x63\x9b\xa8\x8f\xd2\x8f\x40\x33\x24\x8e\x60" "\xe2\xe1\xce\xaa\xf7\xe3\xc0\x2b\x4c\xd3\x34\xad\x6f\x53\xaf\xd0\xb0\xe4" "\xe0\xd1\xbb\x93\x48\x36\x4b\x7a\xbd\x67\x02\x00\x00\xba\xed\xc5\xd1\x7f" "\xaf\x5b\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x27\xd7\x61\x3c\x57\x6c\x7b\xcc\x8d\xcd\x54\xd2\x8d\x47\x68\x03\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x74\xc5\xff\x03\x00\x00\xff\xff\x0e\x03\xe9\x45", 1292); syz_mount_image( /*fs=*/0x20000040, /*dir=*/0x20000500, /*flags=MS_SYNCHRONOUS|MS_SILENT|MS_RDONLY|MS_NOSUID|0x400*/ 0x8413, /*opts=*/0x200003c0, /*chdir=*/0, /*size=*/0x50c, /*img=*/0x20000a40); } 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; use_temporary_dir(); loop(); return 0; }