// https://syzkaller.appspot.com/bug?id=f0d34594467ade2b45400cec1695433d001df373 // 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 31 00} (length 0x8) // } // flags: mount_flags = 0x0 (8 bytes) // opts: ptr[inout, array[ANYUNION]] { // array[ANYUNION] { // union ANYUNION { // ANYRES32: ANYRES32 (resource) // } // } // } // chdir: int8 = 0x11 (1 bytes) // size: len = 0x6fd (8 bytes) // img: ptr[in, buffer] { // buffer: (compressed buffer with length 0x6fd) // } // ] // returns fd_dir memcpy((void*)0x200000000000, "hfsplus\000", 8); memcpy((void*)0x200000000100, "./file1\000", 8); *(uint32_t*)0x200000000040 = 0; memcpy( (void*)0x200000000ac0, "\x78\x9c\xec\xdd\x4d\x6c\x1c\x57\x1d\x00\xf0\xff\xac\xd7\xf6\x6e\x2a\x1c" "\xb7\x4d\xd3\x20\x55\xaa\x69\xa5\x82\x88\x48\xe2\x58\x2e\x98\x4b\x0c\x42" "\xc8\x48\x15\x54\x41\x82\xb3\xd5\x38\x8d\x95\xcd\x07\xb6\x8b\xdc\x1e\x88" "\x0b\x48\x5c\x39\x70\x45\x2a\x07\x73\x81\x13\x08\x21\x21\x21\x45\x2a\xe2" "\x08\xb7\xc2\xcd\xe2\x54\x81\xe0\xd2\x53\xd2\x43\x07\xcd\xd7\x7a\xec\xee" "\x7a\xd7\x71\xfc\x51\xf8\xfd\xa2\xc9\xbc\x99\x37\xef\xcd\x7f\xfe\x33\xf3" "\x66\x77\x25\x6b\x02\xf8\xbf\xb5\x70\x3e\x9a\xf7\xa3\x1d\x0b\xe7\x5f\x59" "\xcf\x96\xb7\x36\x67\x3a\x5b\x9b\x33\xb7\x8a\x72\xa3\x13\x11\xe3\x11\xd1" "\x88\x68\xd6\x5a\x25\xef\x46\xcc\x47\x31\xc5\xa7\xb3\x15\x55\x45\xbf\xfd" "\xfc\x6c\x79\xee\xea\x7b\x1f\x6c\xbd\x5f\x2c\x35\xcb\xa9\x11\xc5\x7f\xed" "\xfe\x01\x36\x87\x39\x8a\x8d\x72\x8a\xa9\x88\x18\x29\xe7\x07\xb0\xa3\xbf" "\xd7\x1e\xad\xbf\xf1\xed\x62\xd2\xcd\x4c\x96\xb0\x17\xab\xc4\xc1\x71\x1b" "\x8d\x88\x74\x87\xef\x9d\xdd\xae\xe9\x25\x1d\xa9\x2d\xf4\xbd\xdf\x81\x4f" "\x8e\xa4\x78\x6e\xd6\x14\xf7\xff\x64\xc4\xa9\x88\x68\x55\x0f\xb4\x8d\xa2" "\xb2\x71\xf4\x11\x0e\xb4\xaf\xb1\x68\xe3\xf0\xe2\x00\x00\x00\x80\x13\xe3" "\xf4\x83\x7b\x11\xeb\x31\x71\xdc\x71\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\xc0\x27\x49\xf9\xfe\xff\xa4\x9c\x1e\x56\xe5\xa9\x48\xaa\xf7\xff\x8f\xd5" "\xde\xb1\x3f\x76\xcc\xe1\xf6\xb7\x77\x64\xad\xaa\x70\xbf\x71\x14\xc1\x00" "\x00\x00\x00\x00\x00\x00\xc0\xe1\x7a\xfe\x41\xfc\xea\x6a\x9a\x4e\x54\xcb" "\x69\x12\x8d\xef\x8c\x94\x0b\xed\x72\xfe\x46\xac\xc6\x52\x33\xe2\x42\xac" "\xc7\x62\xac\xc5\x5a\xac\xc4\x74\x44\x4c\xd6\x3a\x1a\x5b\x5f\x5c\x5b\x5b" "\x99\x8e\x17\xf2\xa5\x33\x1f\xa6\x69\x1a\x4f\x14\x2d\x63\x65\x47\xcb\xcb" "\x3d\x5b\x5e\x1e\x32\xe0\xf6\x41\x8f\x18\x00\x00\x00\x00\x00\x00\x00\xfe" "\xa7\x5c\x99\x1d\xcf\xe7\x3f\x8c\x85\x98\x38\xee\x60\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\xa0\x2e\x89\x18\x29\x66\xf9\x74\xa6\x2a\x4f\x46" "\xa3\x19\x11\xad\x88\x18\xcb\xb6\xdb\x88\xf8\x6b\x55\x3e\x41\x9a\xfb\x6d" "\x70\xff\x70\xe2\x00\x00\x00\x80\x13\xe5\xf4\x83\x78\x10\xeb\x31\x51\x2d" "\xa7\x49\xfe\x9d\xff\x6c\xfe\xbd\xbf\x15\x6f\xc4\xed\x58\x8b\xe5\x58\x8b" "\x4e\x2c\xc5\xb5\xfc\xb7\x80\xe2\x5b\x7f\x63\x6b\x73\xa6\xb3\xb5\x39\x73" "\x2b\x9b\x22\x62\x74\x67\xbf\x5f\xf9\xcf\x76\xf9\xb7\x13\x03\xc3\xc8\x7b" "\x8c\xe2\xb7\x87\xde\x7b\x3e\x97\x6f\xd1\x8e\xeb\xb1\x9c\xaf\xb9\x10\xaf" "\xc5\x9d\xe8\xc4\xb5\x68\xe4\x2d\x33\xe7\xaa\x78\x6a\x71\xd5\xbc\x9d\xc5" "\x94\x5c\x29\xa4\x69\x8c\x0f\x93\xa0\x6b\xe5\x3c\x3b\xf2\x9f\x96\xf3\x23" "\xd1\x1e\xb4\xc1\x64\x9e\x91\xd1\x6e\x46\x2e\x65\xb1\x25\x45\x1e\x9f\xdc" "\x3b\x13\xf5\xb3\x33\x84\xdd\x7b\x9a\x8e\x46\xf7\x97\x9f\x33\xfd\xf7\xd4" "\xfd\x31\xa6\xca\xf9\x95\x3d\xf7\x92\x7c\x94\xa6\x45\xe9\x54\xb5\x26\xe2" "\x89\x6f\xec\x99\xf3\xfc\x7a\x19\xdd\xd7\xc1\xf4\xf7\xb7\x3f\xff\xfb\x5b" "\x03\x36\xd9\x9d\x89\xcb\xb5\xab\xef\xec\xde\x39\x8f\xf8\xec\xef\x7e\xfd" "\xdd\x1b\x9d\xdb\x37\x6f\x24\x1b\xe7\x8f\xec\x32\x7a\x24\xcf\xf7\x5e\x3d" "\xfe\x8f\xea\x0c\x55\x99\x28\x6c\xc4\x52\xcc\xd4\x32\xf1\xec\xd0\x99\xb8" "\xbe\x7a\xc2\x33\xd1\xd7\xce\x5f\x1a\x1b\xf1\x4c\xb7\xbc\x10\x5f\x8f\x6f" "\xc7\xf9\x98\x8a\x57\x63\x25\x96\xe3\xfb\xb1\x18\x6b\xb1\x14\x53\xf1\xb5" "\xbc\xb4\x58\x5e\xcf\xd9\xff\x93\x7b\x67\x6a\x7e\xc7\xd2\xab\x83\x62\x1a" "\x2b\xcf\xcb\xc8\xae\x98\x3e\x73\xba\x98\xef\x15\xd3\x0b\x79\xdb\x89\x58" "\x8e\x6f\xc6\x9d\xb8\x16\x4b\xf1\x72\xfe\xef\x72\x4c\xc7\x17\x63\x36\x66" "\x63\xae\x76\x86\x9f\x19\x62\xa4\x6d\xf4\xb8\xeb\x7f\xdf\x3f\xf8\x17\x3f" "\x57\x16\xb2\x81\xef\x27\xdb\x03\xe0\xe3\xba\xbb\x0f\x20\xcb\xeb\x93\xb5" "\xbc\xd6\xc7\xdc\xc9\xbc\xae\xbe\xa6\x11\x69\xf9\x64\x79\x6a\x1f\xcf\xa3" "\xbd\xc7\xc6\xca\xf6\x23\x2b\x3b\x13\x3f\xaa\xdd\x83\xc7\xaf\x9b\x89\x56" "\x74\x9f\x12\x55\x74\x4f\x57\x19\x18\xed\x99\x89\x5f\xe4\xc3\xca\x6a\xe7" "\xf6\xcd\x95\x1b\x8b\x77\x77\xf5\x9b\x6c\xf4\xde\xdf\x4b\xb1\xf3\xf0\x4f" "\xce\x40\x92\x5d\x2f\x4f\x75\xc7\x88\x9d\x57\x47\x56\xf7\x74\xcf\xba\xe9" "\xbc\xee\x4c\xb7\xae\xb1\xbb\xee\x97\xed\x6e\xdd\xa0\x3b\x75\xac\xfc\x0c" "\xf7\xf1\x9e\x2e\xe7\x75\xcf\x46\xc4\xcf\xcb\x68\xb3\xba\x4c\x36\x86\x67" "\x75\xe7\x6a\xed\xb2\xcf\x5b\xad\xbc\xee\xc3\x34\x4d\x8b\xcf\x5b\x00\x9c" "\x50\x1f\xa5\xdd\x2f\x52\x9f\x3f\x35\xd6\xfe\x57\xfb\x2f\xed\x77\xda\x3f" "\x6e\xdf\x68\xbf\xd2\xfa\xea\xf8\x97\xc6\x9f\x1b\x8b\xd1\x3f\x8d\x7e\xb9" "\x79\x69\xe4\xa5\xc6\x73\xc9\x6f\xe2\x9d\xf8\x41\x0c\xfe\x86\x0e\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x0c\xb4\xfa\xe6\x5b\x37\x17\x3b\x9d\xa5\x95\x5d\x85\x34\x4d" "\xef\xf5\xa9\x3a\x94\x42\x34\x23\x76\xac\xf9\xe3\x1f\x6a\xdb\xe4\xef\x1a" "\x8b\x88\xe1\x3b\xcc\xb6\x9e\x6f\x44\xe4\x6b\x9a\x51\x16\x86\x68\xfe\xcf" "\x88\x28\xd7\xdc\x7b\xb4\xc3\x79\xbb\x57\xd5\x78\x0c\x6e\xfe\xf7\xf2\x9c" "\x1c\x49\xc2\xf7\x28\x24\x43\x6f\xdc\xea\x7b\xfd\x94\x85\x3b\x9f\x2a\x0f" "\xe7\x61\x9a\xa6\x47\x7e\x38\xd5\xbb\xda\xf6\xdd\x3c\x2d\x1d\xdb\x29\x78" "\xcc\x85\xea\x15\x59\x1f\xab\x4a\x9a\x11\x7d\x5a\x1d\xcb\x70\x04\x1c\xa1" "\x8b\x6b\xb7\xee\x5e\x5c\x7d\xf3\xad\x2f\x2c\xdf\x5a\x7c\x7d\xe9\xf5\xa5" "\xdb\x73\xb3\xb3\x73\x97\xe6\x66\x5f\x9e\xb9\x78\x7d\xb9\xd3\x3a\xee\xf0" "\x80\x43\x94\x3f\xeb\xf3\xcf\x39\xc7\x1d\x09\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x30\xac\xe1\xfe\x38\x27\xb9\xb9\x18\xc5\x9a\x66\xaf\xbf\x22\x18" "\xd4\x1c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\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\x00\x16\xce\x47\xf3\x7e\x24\x31\x7d\xe9\xc2\xa5" "\x6c\x79\x6b\x73\xa6\x93\x4d\x55\x39\x9b\x8f\xe4\x5b\x3e\x8c\x88\x46\x44" "\x24\x53\x11\xc9\xbb\x11\xf3\x51\x4c\x31\x59\xeb\x2e\xe9\xb7\x9f\x8d\x88" "\xab\xef\x7d\xb0\xf5\x7e\xb1\xd4\x2c\xa7\x7c\xfb\xc6\xc1\x8f\x62\xa3\x9c" "\x62\xaa\x0c\x77\xaa\xf7\x76\xad\x5e\x2b\xd3\x7b\xfd\xfa\x4b\xf2\x7e\xee" "\xf6\xef\x6f\x48\x49\x39\x8d\x74\xd7\xcc\x1f\xa8\x3f\x78\x4c\xfe\x1b\x00" "\x00\xff\xff\xce\x2f\x0e\x90", 1789); syz_mount_image(/*fs=*/0x200000000000, /*dir=*/0x200000000100, /*flags=*/0, /*opts=*/0x200000000040, /*chdir=*/0x11, /*size=*/0x6fd, /*img=*/0x200000000ac0); // creat arguments: [ // file: ptr[in, buffer] { // buffer: {2e 2f 62 75 73 00} (length 0x6) // } // mode: open_mode = 0x182 (8 bytes) // ] // returns fd memcpy((void*)0x2000000000c0, "./bus\000", 6); syscall(__NR_creat, /*file=*/0x2000000000c0ul, /*mode=S_IWOTH|S_IWUSR|S_IRUSR*/ 0x182ul); // openat arguments: [ // fd: fd_dir (resource) // file: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 31 00} (length 0x8) // } // flags: open_flags = 0x181242 (4 bytes) // mode: open_mode = 0x148 (2 bytes) // ] // returns fd memcpy((void*)0x200000000180, "./file1\000", 8); syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000180ul, /*flags=O_TRUNC|O_SYNC|O_CREAT|O_CLOEXEC|O_RDWR*/ 0x181242, /*mode=S_IXGRP|S_IXUSR|S_IRUSR*/ 0x148); // rename arguments: [ // old: ptr[in, buffer] { // buffer: {2e 2f 62 75 73 00} (length 0x6) // } // new: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 31 00} (length 0x8) // } // ] memcpy((void*)0x200000000440, "./bus\000", 6); memcpy((void*)0x2000000003c0, "./file1\000", 8); syscall(__NR_rename, /*old=*/0x200000000440ul, /*new=*/0x2000000003c0ul); // rename arguments: [ // old: ptr[in, buffer] { // buffer: {2e 2f 62 75 73 00} (length 0x6) // } // new: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 31 00} (length 0x8) // } // ] memcpy((void*)0x200000000440, "./bus\000", 6); memcpy((void*)0x2000000003c0, "./file1\000", 8); syscall(__NR_rename, /*old=*/0x200000000440ul, /*new=*/0x2000000003c0ul); } 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; }