// https://syzkaller.appspot.com/bug?id=19dc6f10777fbb1b30af85af5e77cac6732d6a8a // 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"); } 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; } } } uint64_t r[2] = {0xffffffffffffffff, 0xffffffffffffffff}; void execute_one(void) { intptr_t res = 0; if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } memcpy((void*)0x20000600, "hfsplus\000", 8); memcpy((void*)0x20000640, "./file1\000", 8); memcpy( (void*)0x2001f6c0, "\x78\x9c\xec\xdd\x4f\x6f\x1c\x67\x1d\x07\xf0\xef\xae\xff\x64\x1d\xa4\xd4" "\x75\x93\x36\xa0\x4a\x58\x45\xaa\x10\x16\x89\xd7\x96\x48\xe1\x42\x29\x05" "\x59\xa8\x42\x95\x38\x70\xe1\x62\x11\xa7\xb1\xb2\x49\x2b\x7b\x8b\xdc\x1e" "\x68\x40\x1c\x2a\x4e\x7d\x09\xe5\xe0\x37\x80\x38\x16\x29\x07\xda\x23\x9c" "\x2a\x71\x33\xea\x11\x89\xbb\x6f\x46\x33\x3b\xe3\xdd\xc4\xdb\xd4\x8e\xd7" "\xd9\x4d\xf3\xf9\x48\xb3\xcf\xf3\xec\x33\xf3\xec\xef\xf9\xcd\xec\x64\x66" "\xac\x68\x03\x3c\xb5\xd6\x96\x32\x7d\x2f\x8d\xac\x2d\xbd\xb1\x53\xb4\xf7" "\x76\x57\x3b\x7b\xbb\xab\xb7\xeb\x7a\x92\x73\x49\x9a\x49\x2b\x49\xa3\x78" "\xfb\x6f\x49\xbe\x48\xee\xa6\xb7\xe4\x9b\x75\xc7\x40\x79\xc4\xe7\x9f\xb4" "\xde\xfa\xec\xa3\x4f\x3f\xec\xb5\x5a\xd5\x52\xae\xdf\x78\xd8\x76\xc7\x73" "\x18\xcb\x7c\x2f\xd6\xb2\x1c\xd5\x78\x2b\xa7\x1e\xaf\x9c\x5d\xab\x6e\x2d" "\x24\x59\x3c\x5d\x7c\x30\x1a\x07\xb5\xff\x0c\xed\x3e\xe5\xf7\x12\x00\x98" "\x64\x8d\x64\x6a\xd8\xfb\xf3\xc9\xf9\xea\xe2\xb5\xb8\x0f\xe8\x5d\x15\xf7" "\xae\xb1\x9f\x68\x77\xc7\x1d\x00\x00\x00\x00\x3c\x06\xcf\xec\x67\x3f\x3b" "\xb9\x30\xee\x38\x00\x00\x00\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\x49\x52\xfd\xfe" "\x7f\xa3\x5a\x9a\x75\x7d\x31\x8d\xfa\xf7\xff\x67\xab\xf7\x52\xd5\x9f\x68" "\xf7\xc6\x1d\x00\x00\x00\x00\x00\x00\x00\x00\x8c\xc0\xb7\xf7\xb3\x9f\x9d" "\x5c\xa8\xdb\x07\x8d\xf2\x6f\xfe\x2f\x95\x8d\x8b\xe5\xeb\x37\xf2\x6e\xb6" "\xb3\x91\xad\x5c\xc9\x4e\xd6\xd3\x4d\x37\x5b\x69\x27\x99\x1f\x18\x68\x76" "\x67\xbd\xdb\xdd\x6a\x1f\x63\xcb\x95\xa1\x5b\xae\x3c\x9e\xf9\x02\x00\x00" "\x00\x00\x00\x00\xc0\xd7\xd4\x1f\xb3\xd6\xff\xfb\x3f\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x4c\x82\x46\x32\xd5\x2b\xca\xe5\x62\x5d\x9f\x4f" "\x73\x3a\x49\x2b\xc9\x6c\xb1\xde\xdd\xe4\x5f\x75\x7d\xb2\xcc\x9c\x68\xed" "\x57\xcf\x2c\x0e\x00\x00\x00\x98\x1c\xcf\xec\x67\x3f\x3b\xb9\x50\xb7\x0f" "\x1a\xe5\x3d\xff\xf3\xe5\x7d\x7f\x2b\xef\xe6\x4e\xba\xd9\x4c\x37\x9d\x6c" "\xe4\x7a\xf9\x2c\xa0\x77\xd7\xdf\xdc\xdb\x5d\xed\xec\xed\xae\xde\x2e\x96" "\xa3\xe3\xfe\xe4\x7f\x27\x0a\xa3\x1c\x31\xbd\x67\x0f\xc3\x3f\xf9\x72\xb9" "\xc6\x5c\x6e\x64\xb3\x7c\xe7\x4a\x7e\x9b\xb7\xd3\xc9\xf5\x34\xcb\x2d\x0b" "\x97\xeb\x78\x86\xc7\xf5\x87\x22\xa6\xc6\x8f\x2b\xc7\x8c\xec\x7a\x55\x16" "\x33\xff\x45\x55\x4e\x86\xf9\x32\x23\x33\x87\x19\x59\xae\x62\x2b\xb2\xf1" "\xec\xc3\x33\x71\xc2\xbd\xf3\xe0\x27\xb5\xd3\x3c\x7c\xf2\x73\xf1\x0c\x72" "\x7e\xbe\x2a\x8b\xf9\xbc\x3e\xd1\x39\x5f\x19\x38\xfa\x9e\x7f\x78\x26\x92" "\x85\x5f\xff\xf9\xda\xcd\xce\x9d\x5b\x37\x6f\x6c\x2f\x4d\xce\x94\x1e\xd1" "\x83\x99\x58\x1d\xc8\xc4\x0b\x4f\x55\x26\x96\xcb\x4c\x5c\x3a\x6c\xaf\xe5" "\xe7\xf9\x55\x96\xb2\x98\x37\xb3\x95\xcd\xfc\x2e\xeb\xe9\x66\x23\x8b\x79" "\xbd\xac\xad\x57\xc7\x73\xf1\x3a\xbf\xb7\xbb\x7a\xd0\xf3\xc1\x90\x4c\xbd" "\x7a\xdf\xf3\xd5\x37\xbf\x2a\x92\xd9\x6a\xbf\xf4\xce\xa2\x27\x8b\xe9\xa5" "\x72\xdb\x0b\xd9\xcc\x2f\xf3\x76\xae\x97\x7b\x74\x39\xd7\x72\x2d\x2b\xf9" "\x41\x7e\x98\xe5\xfb\xf6\xf0\xa5\xa1\x7b\xf8\x83\x83\xaa\xbb\xfc\xd6\x37" "\x4f\xf6\xad\xff\xce\x77\xab\xca\x4c\x92\x9f\x9d\xf8\x41\xee\x59\x2a\xf2" "\xfa\xec\x40\x5e\x07\xcf\xb9\xf3\x65\xdf\xe0\x3b\xfd\x2c\x2d\x8c\xfe\xdc" "\x38\xfd\xad\xaa\x52\x1c\x3d\xaf\x4d\xdc\xb9\xb1\x9f\x89\x99\xf2\x5f\x89" "\x3a\x13\xcf\x3d\x98\x89\xfb\x77\xee\x5f\xca\x03\x67\xbb\x73\xe7\xd6\xd6" "\xcd\xf5\x77\x8e\xf9\x79\x2f\x57\x65\x91\x81\x9f\x1e\xc9\xc4\xc1\xd4\xe9" "\x67\xf4\xa8\x8a\xe3\x65\xa1\xd8\x59\x65\xeb\xfe\xa3\xa3\xe8\x7b\x6e\x68" "\x5f\xbb\xec\xbb\x78\xd8\xd7\x3c\xd2\x77\xe9\xb0\xef\xab\xbe\xa9\xb3\xd5" "\x35\xdc\xd1\x91\x56\xca\xbe\x17\x86\xf6\xf5\xb6\xbb\x3c\xd0\x37\xec\x7a" "\x0b\x80\x89\x77\xfe\x7b\xe7\x67\xe7\xfe\x3b\xf7\xcf\xb9\x8f\xe7\xfe\x34" "\x77\x73\xee\x8d\xd6\x6b\xe7\x5e\x39\xf7\xe2\x6c\x66\xfe\x31\xf3\xa3\xe9" "\xe5\xa9\x97\x9b\x2f\x36\xfe\x9a\x8f\xf3\xfb\xfe\xfd\x3f\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\xf0\xe8\xb6\xdf\x7b\xff\xd6\x7a\xa7\xb3\xb1\xa5\xa2\xf2\xf4\x55\x16" "\x93\x8c\x66\xc0\xc5\x49\x98\xce\x08\x2b\xe7\xc6\x7d\x66\x02\xce\xda\xd5" "\xee\xed\x77\xae\x6e\xbf\xf7\xfe\xf7\x37\x6f\xaf\xd7\xbf\xda\xf7\x4a\xbb" "\xdd\xbe\xb6\x7c\xf5\xc6\x66\x67\xa3\x7a\x1d\x77\x94\x00\xc0\x28\xf5\x2f" "\xfa\xc7\x1d\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf0\x65\x1e" "\xc7\x7f\x27\x1e\xf7\x1c\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\x80\xaf\xb7\xb5\xa5\x4c\xdf\x4b\x23\xed\xe5\x2b\xcb" "\x45\x7b\x6f\x77\xb5\x53\x2c\x75\xbd\xbf\x66\x2b\x49\xa3\xa8\xfc\x3d\xf9" "\xf7\x17\xc9\xdd\xf4\x96\xcc\xe7\x37\x53\xf5\x4a\x8d\x2f\xfb\x9c\xcf\x3f" "\x69\xbd\xf5\xd9\x47\x9f\x7e\xd8\x1f\xab\x55\xaf\xdf\x78\xd8\x76\xc7\x33" "\x10\x4b\xd2\xac\xca\x51\x8d\xb7\x72\xea\xf1\xfa\x33\x5c\x4c\xb2\x50\x95" "\x30\x76\xff\x0f\x00\x00\xff\xff\x6e\xc3\x04\xba", 1524); syz_mount_image( /*fs=*/0x20000600, /*dir=*/0x20000640, /*flags=MS_SYNCHRONOUS|MS_STRICTATIME|MS_SILENT|MS_NODIRATIME*/ 0x1008810, /*opts=*/0x20002600, /*chdir=*/1, /*size=*/0x5f4, /*img=*/0x2001f6c0); res = syscall(__NR_socket, /*domain=*/1ul, /*type=SOCK_STREAM*/ 1ul, /*proto=*/0); if (res != -1) r[0] = res; *(uint16_t*)0x20000040 = 1; memcpy( (void*)0x20000042, "\351\037q\211Y\036\2223aK\000\000\000\000\000\000\000\000\000\000\000" "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 108); syscall(__NR_bind, /*fd=*/r[0], /*addr=*/0x20000040ul, /*addrlen=*/0x6eul); memcpy((void*)0x200000c0, "msdos\000", 6); memcpy((void*)0x20000980, "./" "file1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\000", 108); sprintf((char*)0x200002c0, "%020llu", (long long)-1); memcpy((void*)0x200002d4, "\x20\xa9\xc7\xc5\xcd\x33\x52\x76\xdb\xd8\xc4\xda\x4a\xfc\x82\x51\x9f" "\xc1\xa9\x05\x72\x71\x6b\x8e\x22\x3a\x8a\x34\x31\x9b\x95\x9a\x85\xe3", 34); syz_mount_image( /*fs=*/0x200000c0, /*dir=*/0x20000980, /*flags=MS_UNBINDABLE|MS_POSIXACL|MS_SILENT|MS_REMOUNT|MS_RDONLY|0xc06*/ 0x38c27, /*opts=*/0x200002c0, /*chdir=*/0xb, /*size=*/0, /*img=*/0x20000000); memcpy((void*)0x20000040, ".\000", 2); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x20000040ul, /*flags=*/0ul, /*mode=*/0ul); if (res != -1) r[1] = res; memcpy((void*)0x20000180, "./file1\000", 8); memcpy((void*)0x20000640, "./bus\000", 6); syscall(__NR_linkat, /*oldfd=*/r[1], /*old=*/0x20000180ul, /*newfd=*/r[1], /*new=*/0x20000640ul, /*flags=*/0ul); } int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x20000000ul, /*len=*/0x1000000ul, /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/ 7ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x21000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1, /*offset=*/0ul); const char* reason; (void)reason; loop(); return 0; }