// https://syzkaller.appspot.com/bug?id=11de193de8eac449423a6cd2af14e966d88b4cfb // 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 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; } static void kill_and_wait(int pid, int* status) { kill(-pid, SIGKILL); kill(pid, SIGKILL); for (int i = 0; i < 100; i++) { if (waitpid(-1, status, WNOHANG | __WALL) == pid) return; usleep(1000); } DIR* dir = opendir("/sys/fs/fuse/connections"); if (dir) { for (;;) { struct dirent* ent = readdir(dir); if (!ent) break; if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) continue; char abort[300]; snprintf(abort, sizeof(abort), "/sys/fs/fuse/connections/%s/abort", ent->d_name); int fd = open(abort, O_WRONLY); if (fd == -1) { continue; } if (write(fd, abort, 1) < 0) { } close(fd); } closedir(dir); } else { } while (waitpid(-1, status, __WALL) != pid) { } } static void reset_loop() { char buf[64]; snprintf(buf, sizeof(buf), "/dev/loop%llu", procid); int loopfd = open(buf, O_RDWR); if (loopfd != -1) { ioctl(loopfd, LOOP_CLR_FD, 0); close(loopfd); } } static void setup_test() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setpgrp(); write_file("/proc/self/oom_score_adj", "1000"); } static void execute_one(void); #define WAIT_FLAGS __WALL static void loop(void) { int iter = 0; for (;; iter++) { reset_loop(); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { setup_test(); execute_one(); 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; } } } void execute_one(void) { if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } // syz_mount_image$hfsplus arguments: [ // fs: ptr[in, buffer] { // buffer: {68 66 73 70 6c 75 73 00} (length 0x8) // } // dir: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 32 00} (length 0x8) // } // flags: mount_flags = 0x2000011 (8 bytes) // opts: ptr[inout, array[ANYUNION]] { // array[ANYUNION] { // } // } // chdir: int8 = 0x9 (1 bytes) // size: len = 0x6f2 (8 bytes) // img: ptr[in, buffer] { // buffer: (compressed buffer with length 0x6f2) // } // ] // returns fd_dir memcpy((void*)0x200000000340, "hfsplus\000", 8); memcpy((void*)0x200000000380, "./file2\000", 8); memcpy( (void*)0x200000001480, "\x78\x9c\xec\xdd\xcf\x6f\x1c\x67\x19\x07\xf0\xef\xac\xd7\x8e\x37\x54\xc1" "\x69\x13\x1a\x89\x22\xac\x44\x2a\x48\x11\x89\x13\x2b\x85\x70\x89\x41\x08" "\xe5\x50\xa1\xaa\x1c\x7a\xb6\x12\xa7\xb1\xba\x49\x2a\xc7\x45\x49\x41\x34" "\x05\x04\x27\x24\x0e\xfd\x03\x0a\x92\x6f\x1c\x10\x12\xf7\xa0\x70\xe1\x52" "\x6e\xbd\xfa\x58\x09\xa9\x97\x08\xa1\xa8\x12\x5a\x34\xb3\xb3\xeb\x5d\x7b" "\x1d\x7b\xf3\xc3\x4e\xe0\xf3\x89\xc6\xf3\xbe\x33\xf3\xbe\xef\xb3\xcf\xbe" "\x33\xe3\x5d\x67\xb5\x01\xfe\x6f\x5d\x3c\x99\xe6\xdd\x14\xb9\x78\xf2\xf5" "\x5b\x65\x7d\x7d\x6d\xbe\xbd\xbe\x36\x7f\xa0\xde\xdd\x4e\x52\x96\x1b\x49" "\xb3\xbb\x4a\x71\x3d\x29\xee\x25\x0b\xe5\xfe\x62\x60\xc9\xc0\x7a\x8b\x8f" "\x96\xcf\xbf\xf9\xe9\xfd\xf5\xcf\xba\xb5\x66\xbd\x54\xc7\x4f\xf4\xdb\x4d" "\xef\x2a\xe4\x11\x63\xdc\xa9\x97\xcc\xd6\xfd\xcd\x8e\x6c\x39\xb9\xab\xfe" "\xbb\x7d\x55\xe1\xe5\x85\x24\x97\xea\xf5\xb0\xa9\xdd\xf6\x35\x74\x60\x99" "\xb4\x13\xf5\x1a\xf6\x5d\x67\x8b\x3b\xe3\x34\xdf\xf6\x7c\x07\x9e\x7d\xd5" "\xdd\xe9\xa7\x5f\x4d\x66\xaa\xfb\xe6\x16\x33\xc9\xc1\xfa\xce\xdc\x1c\xd8" "\xdc\xd8\xb3\x00\x9f\x92\xb1\xae\x72\x00\x00\x00\xf0\x9c\xfa\xe4\xc6\x7e" "\x47\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xcf\x9f\x22\xd5\xf7\xff\x17" "\xf5\xd2\xa8\xd7\x99\x4d\xd1\xfb\xfe\xff\xa9\xde\xb6\xba\xfc\x0c\x5a\xd8" "\xf5\x91\x77\x9f\x6a\x1c\x00\x00\x00\x00\x00\x00\x00\xb0\x37\xbe\xfe\x20" "\x0f\x72\x2b\x87\x7a\xf5\x4e\x51\xfd\xcd\xff\x78\x55\x39\x92\x2f\x3a\xc9" "\x97\xf2\x5e\x6e\x66\x29\x2b\x39\x95\x5b\x59\xcc\x6a\x56\xb3\x92\x33\x49" "\x66\x06\x3a\x9a\xba\xb5\xb8\xba\xba\x72\xa6\xdf\xb2\x34\xba\xe5\xd9\x91" "\x2d\xcf\xee\xd5\x23\x06\x00\x00\x00\x00\x00\x00\x80\xff\x49\xbf\x48\x6b" "\xe3\xef\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf0\x2c\x28\x92" "\x89\xee\xaa\x5a\x8e\x24\xff\x2e\xd7\x99\x49\xa3\x99\x8d\x7d\xb9\x93\xfc" "\x23\xc9\xd4\x7e\xc7\x3b\x86\x62\x53\xfd\x3f\x9d\xae\x7d\x0a\x07\x00\x00" "\x00\x1e\xcd\xf4\x23\xb4\xf9\xf2\x83\x3c\xc8\xad\x1c\xea\xbd\x3e\xee\x14" "\xe5\x6b\xfe\x7c\xa5\xaa\x4f\xe7\xbd\x5c\xcf\x6a\x96\xb3\x9a\x76\x96\x72" "\xb9\x7e\x0d\x5d\xbe\xea\x6f\xac\xaf\xcd\xb7\xd7\xd7\xe6\xaf\x95\x4b\x59" "\x1f\x8e\xe3\x7b\x9f\x8f\x15\xc6\x54\xdd\xc3\x44\x55\x1b\x35\xf2\xb1\xea" "\x88\x56\xae\x64\xb9\xda\x72\x2a\x97\xaa\x60\x2e\xa7\xd1\x1d\xfb\x44\x72" "\xac\x17\xcf\x40\x5c\x03\x3e\xfc\x7c\x23\xcc\x0b\x17\x76\x19\x59\xb3\x4e" "\x6b\x39\xd8\xef\x46\xbc\x8b\xf0\xe4\xdc\x1d\xaa\x35\x1e\x72\x64\x6b\x23" "\xb8\xa4\x9f\x91\xb9\x3a\xb6\xb2\xe5\xe1\x6e\x06\x8a\xea\x8d\x9a\x64\x73" "\x26\x76\x7c\x76\x9a\x43\xb5\x99\xaa\xd7\xc9\xfe\x48\x67\xd2\xe8\xbf\xf3" "\x73\x64\xe7\x9c\xa7\xb8\x50\xdb\x61\xd4\x9e\x83\xf5\xba\x7c\x3c\xbf\x7e" "\xaa\x39\x1f\x57\x3f\x13\x8d\x54\x99\x38\xdb\x9b\x7d\xe5\x39\xf3\xf0\x4c" "\x24\xdf\xf8\xcb\x1f\xdf\xba\xda\xbe\xfe\xce\xd5\x2b\x37\x4f\x3e\x3b\x0f" "\x69\x07\x13\xdb\x4c\xc4\xcd\x73\x62\x7e\x20\x13\x2f\x3f\xd7\x99\x68\x8e" "\x79\xfc\x5c\x95\x89\xa3\xfd\xfa\xc5\xfc\x30\x3f\xce\xc9\xcc\xe6\x8d\xac" "\x64\x39\x3f\xc9\x62\x56\xb3\x94\xde\x1b\x8d\x8b\xf5\x7c\x2e\x7f\xce\x3c" "\x3c\x53\x0b\x43\xb5\x37\x76\x8a\x64\xaa\x7e\x5e\xba\x57\xd1\xdd\xc4\x34" "\x9b\x1f\x54\xa5\xc5\x1c\xaf\xda\x1e\xca\x72\x8a\xdc\xc8\xe5\x2c\xe5\xb5" "\xea\xdf\xd9\x9c\xc9\xb7\x73\x2e\xe7\x72\x7e\xe0\x19\x3e\xba\x6d\xdc\xd5" "\x63\xab\xce\xfa\xc6\xe6\xb3\xbe\xf7\x4c\xff\x75\x64\xf0\x27\xbe\x59\x17" "\xca\xab\xdb\x6f\x36\xae\x72\x0b\x0f\x7b\xc4\x13\x3b\xa5\xe4\x31\x75\xaf" "\xfd\x65\x5e\x0f\x0f\xe4\xb5\x3b\xeb\xef\xf7\x8f\x3a\x3c\x70\x1e\xcc\x0d" "\x64\xe9\xc5\x5e\x76\x26\x47\x76\x3e\xde\xb5\x71\xd3\x5b\xed\xe5\x18\xbf" "\xdc\xe1\x3e\xb1\xb7\x66\xea\x4c\x94\x27\x50\xef\x2e\xd1\x8b\xee\xa5\x6e" "\x26\x9a\xd5\xbd\x68\xeb\x3c\xff\x7d\xa7\x6c\x97\xf6\xf5\x4e\xe7\xea\xe2" "\xbb\xdb\xf4\x7f\x67\x53\xfd\xd5\x7a\x5d\x4e\xab\xb5\xaf\xed\x74\x74\xcf" "\xe8\xa7\xe2\xc9\x2a\x9f\xaa\x17\x33\x5d\x5f\x49\x86\x67\x47\xb9\xef\xa5" "\xfe\x55\x66\x60\x5f\x67\x63\x2e\x77\xf7\x0d\xdf\x71\xcb\x76\x47\xab\x7d" "\x45\xd1\x3b\x53\x7f\x94\x1b\xd5\x04\xd8\x7a\xa6\x4e\xd5\xbf\xc3\x6d\xea" "\xa9\x3f\xc4\xcb\x23\x47\x99\xaf\xda\x1d\x1b\xd8\x37\xf4\xfb\x56\x6e\xa4" "\x9d\xcb\x7b\x90\x3f\x00\x1e\xc5\xdf\xdf\xea\x17\x67\x72\x70\xaa\xf5\xcf" "\xd6\x27\xad\x8f\x5b\xbf\x6a\x5d\x6d\xbd\x3e\xfd\xfd\x03\xdf\x39\xf0\xca" "\x54\x26\xff\x36\xf9\xdd\xe6\xdc\xc4\xab\x8d\x57\x8a\x3f\xe7\xe3\xfc\xbc" "\x7a\xfd\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x3c\xa6\x9b\xb7\xdf\x7f\x67\xb1\xdd\x5e" "\x5a\x19\x5d\x68\x6c\xbf\x6b\xa8\xd0\xca\xe6\x2d\xdb\xf5\x7c\x60\x74\x3f" "\x45\xfd\x85\x3e\xbb\x18\x6b\xe5\xe6\xed\x4e\xa7\xf3\xc1\xee\x02\xdb\xaf" "\xc2\x74\x92\xa1\x2d\xd5\xf7\x1c\x3d\x91\x21\x9a\x63\xf4\xd3\xda\x1c\x46" "\xb7\x30\x91\xa4\xde\xd2\xf9\x20\xd9\xf3\xfc\xf4\xbe\xd3\x6a\xf4\x31\xbf" "\x2d\x0b\xcd\x2d\x33\x6a\x54\x61\x61\x68\xcb\x9f\xb6\x76\xf8\xe1\x98\x11" "\x16\xbb\x3b\x2f\x9e\x62\xa1\x91\xbd\x1d\xb4\x9c\x0b\xa3\x76\xed\xe3\x45" "\x09\xd8\x13\xa7\x57\xaf\xbd\x7b\xfa\xe6\xed\xf7\xbf\xb5\x7c\x6d\xf1\xed" "\xa5\xb7\x97\xae\x4f\x9e\x3b\x77\x7e\xee\xfc\xb9\xd7\xe6\x4f\x5f\x59\x6e" "\x2f\xcd\x75\x7f\xee\x77\x94\xc0\xd3\xb0\x71\xd3\xdf\xef\x48\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x80\xdd\x1a\xf5\xc1\x80\xe3\x2f\x8c\xfc\xd0\xc8" "\xb8\x9f\xf1\xf0\x3f\x0b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x27\xe2\xe2\xc9\x34\xef\xa6\xc8" "\x99\xb9\x53\x73\x65\x7d\x7d\x6d\xbe\x5d\x2e\xbd\xf2\xc6\x91\xcd\x24\x8d" "\x46\x52\xfc\x2c\x29\xee\x25\x0b\xe9\x2e\x99\x19\xe8\xae\xc8\x1f\xee\xa5" "\x33\x62\x9c\x8f\x96\xcf\xbf\xf9\xe9\xfd\xf5\xcf\x36\xfa\x6a\x76\x8f\x4f" "\x1a\xf5\x7a\x7b\x0f\xdf\x9b\xe4\x4e\xbd\x64\x36\xc9\x44\xbd\x7e\x0c\x43" "\xfd\x5d\x7a\xec\xfe\x8a\x7f\xf5\x1e\x43\x99\xb0\x2f\x3a\x9d\xce\xc2\xe3" "\xc5\x07\x4f\xc6\x7f\x03\x00\x00\xff\xff\xa1\x49\xfa\x24", 1778); syz_mount_image(/*fs=*/0x200000000340, /*dir=*/0x200000000380, /*flags=MS_LAZYTIME|MS_SYNCHRONOUS|MS_RDONLY*/ 0x2000011, /*opts=*/0x200000000140, /*chdir=*/9, /*size=*/0x6f2, /*img=*/0x200000001480); // mount arguments: [ // src: nil // dst: ptr[in, buffer] { // buffer: {2e 00} (length 0x2) // } // type: nil // flags: mount_flags = 0x2390024 (8 bytes) // data: nil // ] memcpy((void*)0x200000000240, ".\000", 2); syscall( __NR_mount, /*src=*/0ul, /*dst=*/0x200000000240ul, /*type=*/0ul, /*flags=MS_LAZYTIME|MS_SHARED|MS_SLAVE|MS_POSIXACL|MS_REMOUNT|MS_RELATIME|0x4*/ 0x2390024ul, /*data=*/0ul); // mknod$loop arguments: [ // file: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 30 61 61 61 61 61 61 61 61 61 61 61 61 61 // 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 // 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 // 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 // 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 // 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 // 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 // 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 // 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 // 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 // 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 00} // (length 0xfa) // } // mode: mknod_mode = 0xc000 (8 bytes) // dev: proc = 0x1 (4 bytes) // ] memcpy((void*)0x200000000080, "./" "file0aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\000", 250); syscall(__NR_mknod, /*file=*/0x200000000080ul, /*mode=S_IFSOCK*/ 0xc000ul, /*dev=*/0x701); // unlink arguments: [ // path: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 30 61 61 61 61 61 61 61 61 61 61 61 61 61 // 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 // 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 // 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 // 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 // 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 // 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 // 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 // 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 // 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 // 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 00} // (length 0xfa) // } // ] memcpy((void*)0x200000000200, "./" "file0aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\000", 250); syscall(__NR_unlink, /*path=*/0x200000000200ul); } 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; loop(); return 0; }