// https://syzkaller.appspot.com/bug?id=a5a37263bb85dee61db538cb371cf86af5e6ac70 // 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_memfd_create #define __NR_memfd_create 319 #endif static unsigned long long procid; static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static 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"); } 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) { res = chdir(target); if (res == -1) { err = errno; } } 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_RDWR); if (loopfd != -1) { ioctl(loopfd, LOOP_CLR_FD, 0); close(loopfd); } } static void setup_test() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setpgrp(); write_file("/proc/self/oom_score_adj", "1000"); if (symlink("/dev/binderfs", "./binderfs")) { } } static void 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); } } void execute_one(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 62 75 73 00} (length 0x6) // } // flags: mount_flags = 0xe (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 { // journal_ioprio: fs_opt["journal_ioprio", fmt[hex, int32[0:7]]] // { // name: buffer: {6a 6f 75 72 6e 61 6c 5f 69 6f 70 72 69 6f} // (length 0xe) eq: const = 0x3d (1 bytes) val: int32 = 0x1 (18 // bytes) // } // } // comma: const = 0x2c (1 bytes) // } // fs_opt_elem[ext4_options] { // elem: union ext4_options { // nouid32: buffer: {6e 6f 75 69 64 33 32} (length 0x7) // } // comma: const = 0x2c (1 bytes) // } // fs_opt_elem[ext4_options] { // elem: union ext4_options { // debug_want_extra_isize: fs_opt["debug_want_extra_isize", // fmt[hex, int32]] { // name: buffer: {64 65 62 75 67 5f 77 61 6e 74 5f 65 78 74 72 // 61 5f 69 73 69 7a 65} (length 0x16) eq: const = 0x3d (1 // bytes) val: int32 = 0x68 (18 bytes) // } // } // comma: const = 0x2c (1 bytes) // } // fs_opt_elem[ext4_options] { // elem: union ext4_options { // lazytime: buffer: {6c 61 7a 79 74 69 6d 65} (length 0x8) // } // comma: const = 0x2c (1 bytes) // } // fs_opt_elem[ext4_options] { // elem: union ext4_options { // nombcache: buffer: {6e 6f 6d 62 63 61 63 68 65} (length 0x9) // } // comma: const = 0x2c (1 bytes) // } // fs_opt_elem[ext4_options] { // elem: union ext4_options { // inode_readahead_blks: fs_opt["inode_readahead_blks", fmt[hex, // flags[ext4_inode_readahead_blks]]] { // name: buffer: {69 6e 6f 64 65 5f 72 65 61 64 61 68 65 61 64 // 5f 62 6c 6b 73} (length 0x14) eq: const = 0x3d (1 bytes) // val: ext4_inode_readahead_blks = 0x4000000 (18 bytes) // } // } // comma: const = 0x2c (1 bytes) // } // fs_opt_elem[ext4_options] { // elem: union ext4_options { // noquota: buffer: {6e 6f 71 75 6f 74 61} (length 0x7) // } // 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 = 0x440 (8 bytes) // img: ptr[in, buffer] { // buffer: (compressed buffer with length 0x440) // } // ] // returns fd_dir memcpy((void*)0x200000000240, "ext4\000", 5); memcpy((void*)0x200000000000, "./bus\000", 6); memcpy((void*)0x2000000000c0, "journal_ioprio", 14); *(uint8_t*)0x2000000000ce = 0x3d; sprintf((char*)0x2000000000cf, "0x%016llx", (long long)1); *(uint8_t*)0x2000000000e1 = 0x2c; memcpy((void*)0x2000000000e2, "nouid32", 7); *(uint8_t*)0x2000000000e9 = 0x2c; memcpy((void*)0x2000000000ea, "debug_want_extra_isize", 22); *(uint8_t*)0x200000000100 = 0x3d; sprintf((char*)0x200000000101, "0x%016llx", (long long)0x68); *(uint8_t*)0x200000000113 = 0x2c; memcpy((void*)0x200000000114, "lazytime", 8); *(uint8_t*)0x20000000011c = 0x2c; memcpy((void*)0x20000000011d, "nombcache", 9); *(uint8_t*)0x200000000126 = 0x2c; memcpy((void*)0x200000000127, "inode_readahead_blks", 20); *(uint8_t*)0x20000000013b = 0x3d; sprintf((char*)0x20000000013c, "0x%016llx", (long long)0x4000000); *(uint8_t*)0x20000000014e = 0x2c; memcpy((void*)0x20000000014f, "noquota", 7); *(uint8_t*)0x200000000156 = 0x2c; *(uint8_t*)0x200000000157 = 0; memcpy( (void*)0x200000000780, "\x78\x9c\xec\xdb\xcb\x6f\x1b\xc5\x1f\x00\xf0\xef\xda\x49\xfa\xeb\xeb\x97" "\x50\x95\x47\x1f\x40\xa0\x20\xca\x2b\x69\xd2\x52\x7a\xe0\x02\x02\x89\x03" "\x48\x48\x70\x28\xc7\x90\xa4\x55\xa8\xdb\xa0\x26\x48\xb4\x8a\x20\x20\x54" "\x8e\xa8\x12\x27\x2e\x88\x23\x12\x7f\x01\x27\xb8\x20\xe0\x84\xc4\x15\xee" "\xa8\x52\x85\x72\x69\xe1\x64\xb4\xf6\x6e\x62\x3b\xb6\x1b\xa7\x4e\x5c\xea" "\xcf\x47\x5a\x77\x66\x77\xdc\x99\xaf\x77\xc7\x9e\xd9\xc9\x06\xd0\xb7\x46" "\xd3\x97\x24\x62\x4f\x44\xfc\x1e\x11\xc3\xd5\x6c\x7d\x81\xd1\xea\x3f\x37" "\x57\x96\xa6\xff\x5e\x59\x9a\x4e\xa2\x5c\x7e\xf3\xaf\xa4\x52\xee\xc6\xca" "\xd2\x74\x5e\x34\x7f\xdf\xee\x3c\x33\x10\x51\xf8\x34\x89\x43\x4d\xea\x5d" "\xb8\x74\xf9\xdc\x54\xa9\x34\x7b\x31\xcb\x8f\x2f\x9e\x7f\x6f\x7c\xe1\xd2" "\xe5\x67\xe7\xce\x4f\x9d\x9d\x3d\x3b\x7b\x61\xf2\xd4\xa9\x13\xc7\x27\x9e" "\x3f\x39\xf9\x5c\x57\xe2\x4c\xe3\xba\x71\xf0\xc3\xf9\xc3\x07\x5e\x7d\xfb" "\xea\xeb\xd3\xa7\xaf\xbe\xf3\xf3\xb7\x49\x1e\x7f\x43\x1c\x5d\x32\xda\xee" "\xe0\xe3\xe5\x72\x97\xab\xeb\xad\xbd\x35\xe9\x64\xa0\x87\x0d\xa1\x23\xc5" "\x6a\x37\x8d\xc1\x4a\xff\x1f\x8e\x62\xac\x9d\xbc\xe1\x78\xe5\x93\x9e\x36" "\x0e\xd8\x52\xe5\x72\xb9\x7c\x5f\xeb\xc3\xcb\x65\xe0\x2e\x96\x44\xaf\x5b" "\x00\xf4\x46\xfe\x43\x9f\xce\x7f\xf3\x6d\x9b\x86\x1e\x77\x84\xeb\x2f\x56" "\x27\x40\x69\xdc\x37\xb3\xad\x7a\x64\x20\x0a\x59\x99\xc1\x86\xf9\x6d\x37" "\x8d\x46\xc4\xe9\xe5\x7f\xbe\x4a\xb7\xd8\x9a\xfb\x10\x00\x00\x75\xbe\x4f" "\xc7\x3f\xcf\x34\x1b\xff\x15\xa2\xf6\xbe\xd0\xff\xb3\x35\x94\x91\x88\xb8" "\x27\x22\xf6\x45\xc4\xc9\x88\xd8\x1f\x11\xf7\x46\x54\xca\xde\x1f\x11\x0f" "\x74\x58\x7f\xe3\x22\xc9\xfa\xf1\x4f\xe1\xda\xa6\x02\xdb\xa0\x74\xfc\xf7" "\x42\xb6\xb6\x55\x3f\xfe\xcb\x47\x7f\x31\x52\xcc\x72\x7b\x2b\xf1\x0f\x26" "\x67\xe6\x4a\xb3\xc7\xb2\xcf\xe4\x68\x0c\xee\x48\xf3\x13\x6d\xea\xf8\xe1" "\xe5\xdf\x3e\x6f\x75\xac\x76\xfc\x97\x6e\x69\xfd\xf9\x58\x30\x6b\xc7\xb5" "\x81\x1d\xf5\xef\x99\x99\x5a\x9c\xba\x9d\x98\x6b\x5d\xff\x38\xe2\xe0\x40" "\xb3\xf8\x93\xd5\x95\x80\x24\x22\x0e\x44\xc4\xc1\x4d\xd6\x31\xf7\xd4\x37" "\x87\x5b\x1d\xbb\x75\xfc\x6d\x74\x61\x9d\xa9\xfc\x75\xc4\x13\xd5\xf3\xbf" "\x1c\x0d\xf1\xe7\x92\xf6\xeb\x93\xe3\xff\x8b\xd2\xec\xb1\xf1\xfc\xaa\x58" "\xef\x97\x5f\xaf\xbc\xd1\xaa\xfe\xdb\x8a\xbf\x0b\xd2\xf3\xbf\xab\xe9\xf5" "\xbf\x1a\xff\x48\x52\xbb\x5e\xbb\xd0\xc9\xff\xfe\xe5\x93\xe9\xeb\x95\x3f" "\x3e\x6b\x39\xa7\xd9\xec\xf5\x3f\x94\xbc\x55\xb7\xef\x83\xa9\xc5\xc5\x8b" "\x13\x11\x43\xc9\x6b\xd5\x46\xd7\xee\x9f\x6c\x28\x37\xb9\x56\x3e\x8d\xff" "\xe8\x91\xe6\xfd\x7f\x5f\xac\x7d\x12\x87\x22\x22\xbd\x88\x1f\x8c\x88\x87" "\x22\xe2\xe1\xac\xed\x8f\x44\xc4\xa3\x11\x71\xa4\xcd\xa7\xf0\xd3\x4b\x8f" "\xbd\xbb\xf9\xf8\xb7\x56\x1a\xff\x4c\x47\xe7\x7f\x2d\x31\x14\x8d\x7b\x9a" "\x27\x8a\xe7\x7e\xfc\xae\xae\xd2\x91\x4e\xe2\x4f\xcf\xff\x89\x4a\xea\x68" "\xb6\x67\x23\xdf\x7f\x1b\x69\x57\xa7\x57\x33\x00\x00\x00\xfc\x57\x15\x22" "\x62\x4f\x24\x85\xb1\xd5\x74\xa1\x30\x36\x56\xfd\x1b\xfe\xfd\xb1\xab\x50" "\x9a\x5f\x58\x7c\xfa\xcc\xfc\xfb\x17\x66\xaa\xcf\x08\x8c\xc4\x60\x21\xbf" "\xd3\x35\x5c\x73\x3f\x74\x22\x9b\xd6\xe7\xf9\xc9\x86\xfc\xf1\xec\xbe\xf1" "\x17\xc5\x9d\x95\xfc\xd8\xf4\x7c\x69\xa6\xd7\xc1\x43\x9f\xdb\xdd\xa2\xff" "\xa7\xfe\x2c\xf6\xba\x75\xc0\x96\xf3\xbc\x16\xf4\x2f\xfd\x1f\xfa\x97\xfe" "\x0f\xfd\x4b\xff\x87\xfe\xd5\xa4\xff\xef\xec\x45\x3b\x80\xed\xd7\xec\xf7" "\xff\xa3\x1e\xb4\x03\xd8\x7e\x0d\xfd\xdf\xb2\x1f\xf4\x11\xf3\x7f\xe8\x5f" "\x9b\xe9\xff\xbe\x33\xe0\xee\xd0\xb6\x2f\x0f\x6d\x5f\x3b\x80\x6d\xb5\xb0" "\x33\x6e\xfd\x90\xbc\x84\xc4\xba\x44\x14\xee\x88\x66\x48\x6c\x51\xa2\xd7" "\xdf\x4c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xdd\xf1\x6f\x00" "\x00\x00\xff\xff\x9f\x0f\xe7\xa2", 1088); syz_mount_image(/*fs=*/0x200000000240, /*dir=*/0x200000000000, /*flags=MS_NOSUID|MS_NOEXEC|MS_NODEV*/ 0xe, /*opts=*/0x2000000000c0, /*chdir=*/1, /*size=*/0x440, /*img=*/0x200000000780); // setxattr$incfs_metadata arguments: [ // path: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 31 00} (length 0x8) // } // name: ptr[in, buffer] { // buffer: {75 73 65 72 2e 69 6e 63 66 73 2e 6d 65 74 61 64 61 74 61 00} // (length 0x14) // } // val: ptr[in, buffer] { // buffer: {c1 04 e8 87 f4 b3 fd 5a af 62 fb 50 c4 9b db 48 b9 e1 14 f3 // d9 f2 c4 76 a7 49 08 6b c3 19 cc 93 51 6a f4 80 4e 1f 5f 7d 21 28 50 // 33 29 c8 85 7b 71 6b ba 99 f7 78 29 33 b9 b8 5f 06 b6 82 57 8c 89 df // 53 e5 c8 86 5d 17 34 d9 07 a1 c7 59 cd f4 8e e2 ee 8e 3c 20 4c 47 11 // 95 0d b0 3c 0b ed 36 f7 e9 da 42 11 7d 7a 0c a8 ff d3 81 02 4e 93 d3 // 8a 97 fd 18 5d 35 57 9c 1c a1 84 69 8c 86 51 da 27 96 40 f7 10 af c4 // 99 bf 60 3d f8 1b e9 84 85 1f 96 d5 3e e2 1b a6 75 46 c3 ef dc b3 c6 // fa 02 b1 33 84 e1 25 33 ab 74 ba 19 59 2c a9 ac f3 4a ce 38 11 c3 3e // 5e 48 a6 12 f7 3e d1 db 55 52 8d 99 de 81 61 88 13 b6 2b a6 25 b1 ce // a2 96 f5 f6 ea 41 df 83 a6 72 cc 86 44 1a 75 bc 6e 3c 95 38 3b ba 8c // 41 85 5d 87 37 0c 41 dd 6a c1 00 2b b8 8f 9d c8 7d 6d cd dd d7 c0 2e // e9 2d e9 12 a2 64 84 69 f7 aa ec 56 43 1e cf 81 ef dd 09 46 32 bc 49 // 3c 79 5d f3 ae 29 51 fa 9d b3 da 77 88 86 ad ae cd 8b ef a9 7e 5b 39 // 67 8c 1d e4 ee 49 96 d4 b1 fc fc 89 97 8d 63 89 c2 a2 ed 0b e5 c4 97 // b8 04 2e cb 2b 8b ec c0 9b 41 54 20 52 a8 f9 93 0f e0 5a 35 ce 06 db // 36 bd 7e c4 13 c0 f7 1e 80 39 b4 18 a5 01 42 df de de ea 53 2a 32 1d // 63 e0 1d 27 68 07 59 10 b1 f4 14 53 ca e7 32 00 5c f8 56 21 56 5f 43 // 15 aa bb 2b 05 82 9e 06 0e de ec 97 1e 32 23 c7 42 aa 51 ee 09 09 df // f0 ea f1 ad ed 61 02 5a 4f 2a 11 fb 30 fd 29 98 e9 26 13 6a 82 50 ae // 3e 06 54 8f 90 a1 9f 35 48 b5 e2 dd f0 8a 98 ef 3f f6 78 66 88 ac ab // 60 e3 e6 e4 80 dc 61 2b 16 22 e0 b3 6d ee fc ac b9 00 17 2a 05 66 9b // f7 be cc 20 1f ad c6 5c a7 b0 c4 e7 af 33 fa ec 73 f7 b2 6d 52 d9 b9 // 34 e7 4c cb 96 18 94 b8 aa 84 5f 87 5e b5 3a ad 82 e2 0e 8c 29 96 32 // 67 cb d1 47 8b 68 eb c7 59 fe c9 0b 89 ec 8f 4c 10 fd b5 bc dd b7 b1 // 87 d3 6d fe 64 29 d5 ff ab 22 b9 46 a1 86 4b 28 40 2e b4 0f 18 34 80 // 5f e3 c4 54 9e a7 b3 97 df df 1f fd dd 58 d1 97 a3 97 eb d2 d7 4f 86 // 55 00 eb f1 00 69 92 3b 3f 3b fe 12 55 13 c8 e2 29 82 04 36 e5 1f 7a // 15 d7 5b d3 67 3a 1b c8 0b 7e f4 07 56 85 28 f3 be ee 4c ea f7 32 87 // 1b e8 56 79 70 2e 16 3c a3 fd 11 fb 86 d8 69 c2 db f0 57 bb 3e de 74 // e3 65 88 54 88 66 6a 76 77 71 18 ec 4d 9f c2 85 c8 11 ab a7 49 b8 e5 // 3b d0 4f 91 96 6f 77 58 0c c5 0b d9 d4 f5 13 49 61 6c 2b f0 50 84 ce // 9c 38 a0 72 b6 4a 04 75 b1 7a 22 95 08 9d 2b d0 02 a5 4e 30 ca 70 6c // 35 5a 03 f8 6b 0d 33 8f 77 07 ad 5d e9 b1 1c 00 af 8b 85 31 cd fd af // 3b c5 23 0c 20 97 8d 77 ae a9 35 ac 20 f8 d9 d7 a1 fd 4d 74 4e 41 79 // 74 42 0b df 87 e3 96 22 c6 bd fd e0 c0 79 21 e0 68 7f e9 c0 00 a9 53 // a9 14 7c a1 f3 00 24 7a da 2b 82 85 42 fa 3e 95 40 84 2a 7d 0e 18 87 // 73 20 98 12 94 e3 5d 74 d2 e2 0c a8 af 77 3a f6 ec 83 f6 80 8b 9c 54 // f2 66 24 20 65 bc b6 df 2c c6 85 ba aa 46 fb 70 3c cf fa 72 ac 43 0a // c1 82 59 6f 45 86 6e ba 5b 91 8d} (length 0x372) // } // size: bytesize = 0x372 (8 bytes) // flags: setxattr_flags = 0x0 (8 bytes) // ] memcpy((void*)0x200000000100, "./file1\000", 8); memcpy((void*)0x200000000140, "user.incfs.metadata\000", 20); memcpy( (void*)0x200000000e80, "\xc1\x04\xe8\x87\xf4\xb3\xfd\x5a\xaf\x62\xfb\x50\xc4\x9b\xdb\x48\xb9\xe1" "\x14\xf3\xd9\xf2\xc4\x76\xa7\x49\x08\x6b\xc3\x19\xcc\x93\x51\x6a\xf4\x80" "\x4e\x1f\x5f\x7d\x21\x28\x50\x33\x29\xc8\x85\x7b\x71\x6b\xba\x99\xf7\x78" "\x29\x33\xb9\xb8\x5f\x06\xb6\x82\x57\x8c\x89\xdf\x53\xe5\xc8\x86\x5d\x17" "\x34\xd9\x07\xa1\xc7\x59\xcd\xf4\x8e\xe2\xee\x8e\x3c\x20\x4c\x47\x11\x95" "\x0d\xb0\x3c\x0b\xed\x36\xf7\xe9\xda\x42\x11\x7d\x7a\x0c\xa8\xff\xd3\x81" "\x02\x4e\x93\xd3\x8a\x97\xfd\x18\x5d\x35\x57\x9c\x1c\xa1\x84\x69\x8c\x86" "\x51\xda\x27\x96\x40\xf7\x10\xaf\xc4\x99\xbf\x60\x3d\xf8\x1b\xe9\x84\x85" "\x1f\x96\xd5\x3e\xe2\x1b\xa6\x75\x46\xc3\xef\xdc\xb3\xc6\xfa\x02\xb1\x33" "\x84\xe1\x25\x33\xab\x74\xba\x19\x59\x2c\xa9\xac\xf3\x4a\xce\x38\x11\xc3" "\x3e\x5e\x48\xa6\x12\xf7\x3e\xd1\xdb\x55\x52\x8d\x99\xde\x81\x61\x88\x13" "\xb6\x2b\xa6\x25\xb1\xce\xa2\x96\xf5\xf6\xea\x41\xdf\x83\xa6\x72\xcc\x86" "\x44\x1a\x75\xbc\x6e\x3c\x95\x38\x3b\xba\x8c\x41\x85\x5d\x87\x37\x0c\x41" "\xdd\x6a\xc1\x00\x2b\xb8\x8f\x9d\xc8\x7d\x6d\xcd\xdd\xd7\xc0\x2e\xe9\x2d" "\xe9\x12\xa2\x64\x84\x69\xf7\xaa\xec\x56\x43\x1e\xcf\x81\xef\xdd\x09\x46" "\x32\xbc\x49\x3c\x79\x5d\xf3\xae\x29\x51\xfa\x9d\xb3\xda\x77\x88\x86\xad" "\xae\xcd\x8b\xef\xa9\x7e\x5b\x39\x67\x8c\x1d\xe4\xee\x49\x96\xd4\xb1\xfc" "\xfc\x89\x97\x8d\x63\x89\xc2\xa2\xed\x0b\xe5\xc4\x97\xb8\x04\x2e\xcb\x2b" "\x8b\xec\xc0\x9b\x41\x54\x20\x52\xa8\xf9\x93\x0f\xe0\x5a\x35\xce\x06\xdb" "\x36\xbd\x7e\xc4\x13\xc0\xf7\x1e\x80\x39\xb4\x18\xa5\x01\x42\xdf\xde\xde" "\xea\x53\x2a\x32\x1d\x63\xe0\x1d\x27\x68\x07\x59\x10\xb1\xf4\x14\x53\xca" "\xe7\x32\x00\x5c\xf8\x56\x21\x56\x5f\x43\x15\xaa\xbb\x2b\x05\x82\x9e\x06" "\x0e\xde\xec\x97\x1e\x32\x23\xc7\x42\xaa\x51\xee\x09\x09\xdf\xf0\xea\xf1" "\xad\xed\x61\x02\x5a\x4f\x2a\x11\xfb\x30\xfd\x29\x98\xe9\x26\x13\x6a\x82" "\x50\xae\x3e\x06\x54\x8f\x90\xa1\x9f\x35\x48\xb5\xe2\xdd\xf0\x8a\x98\xef" "\x3f\xf6\x78\x66\x88\xac\xab\x60\xe3\xe6\xe4\x80\xdc\x61\x2b\x16\x22\xe0" "\xb3\x6d\xee\xfc\xac\xb9\x00\x17\x2a\x05\x66\x9b\xf7\xbe\xcc\x20\x1f\xad" "\xc6\x5c\xa7\xb0\xc4\xe7\xaf\x33\xfa\xec\x73\xf7\xb2\x6d\x52\xd9\xb9\x34" "\xe7\x4c\xcb\x96\x18\x94\xb8\xaa\x84\x5f\x87\x5e\xb5\x3a\xad\x82\xe2\x0e" "\x8c\x29\x96\x32\x67\xcb\xd1\x47\x8b\x68\xeb\xc7\x59\xfe\xc9\x0b\x89\xec" "\x8f\x4c\x10\xfd\xb5\xbc\xdd\xb7\xb1\x87\xd3\x6d\xfe\x64\x29\xd5\xff\xab" "\x22\xb9\x46\xa1\x86\x4b\x28\x40\x2e\xb4\x0f\x18\x34\x80\x5f\xe3\xc4\x54" "\x9e\xa7\xb3\x97\xdf\xdf\x1f\xfd\xdd\x58\xd1\x97\xa3\x97\xeb\xd2\xd7\x4f" "\x86\x55\x00\xeb\xf1\x00\x69\x92\x3b\x3f\x3b\xfe\x12\x55\x13\xc8\xe2\x29" "\x82\x04\x36\xe5\x1f\x7a\x15\xd7\x5b\xd3\x67\x3a\x1b\xc8\x0b\x7e\xf4\x07" "\x56\x85\x28\xf3\xbe\xee\x4c\xea\xf7\x32\x87\x1b\xe8\x56\x79\x70\x2e\x16" "\x3c\xa3\xfd\x11\xfb\x86\xd8\x69\xc2\xdb\xf0\x57\xbb\x3e\xde\x74\xe3\x65" "\x88\x54\x88\x66\x6a\x76\x77\x71\x18\xec\x4d\x9f\xc2\x85\xc8\x11\xab\xa7" "\x49\xb8\xe5\x3b\xd0\x4f\x91\x96\x6f\x77\x58\x0c\xc5\x0b\xd9\xd4\xf5\x13" "\x49\x61\x6c\x2b\xf0\x50\x84\xce\x9c\x38\xa0\x72\xb6\x4a\x04\x75\xb1\x7a" "\x22\x95\x08\x9d\x2b\xd0\x02\xa5\x4e\x30\xca\x70\x6c\x35\x5a\x03\xf8\x6b" "\x0d\x33\x8f\x77\x07\xad\x5d\xe9\xb1\x1c\x00\xaf\x8b\x85\x31\xcd\xfd\xaf" "\x3b\xc5\x23\x0c\x20\x97\x8d\x77\xae\xa9\x35\xac\x20\xf8\xd9\xd7\xa1\xfd" "\x4d\x74\x4e\x41\x79\x74\x42\x0b\xdf\x87\xe3\x96\x22\xc6\xbd\xfd\xe0\xc0" "\x79\x21\xe0\x68\x7f\xe9\xc0\x00\xa9\x53\xa9\x14\x7c\xa1\xf3\x00\x24\x7a" "\xda\x2b\x82\x85\x42\xfa\x3e\x95\x40\x84\x2a\x7d\x0e\x18\x87\x73\x20\x98" "\x12\x94\xe3\x5d\x74\xd2\xe2\x0c\xa8\xaf\x77\x3a\xf6\xec\x83\xf6\x80\x8b" "\x9c\x54\xf2\x66\x24\x20\x65\xbc\xb6\xdf\x2c\xc6\x85\xba\xaa\x46\xfb\x70" "\x3c\xcf\xfa\x72\xac\x43\x0a\xc1\x82\x59\x6f\x45\x86\x6e\xba\x5b\x91" "\x8d", 882); syscall(__NR_setxattr, /*path=*/0x200000000100ul, /*name=*/0x200000000140ul, /*val=*/0x200000000e80ul, /*size=*/0x372ul, /*flags=*/0ul); // openat arguments: [ // fd: fd_dir (resource) // file: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 31 00} (length 0x8) // } // flags: open_flags = 0x109342 (4 bytes) // mode: open_mode = 0x0 (2 bytes) // ] // returns fd memcpy((void*)0x200000000040, "./file1\000", 8); syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000040ul, /*flags=O_TRUNC|O_SYNC|O_NOCTTY|O_LARGEFILE|O_CREAT|O_RDWR*/ 0x109342, /*mode=*/0); } int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0x1000000ul, /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/ 7ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x200001000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); const char* reason; (void)reason; use_temporary_dir(); loop(); return 0; }