// 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: {13 13 77 c5 fc 35 d4 14 54 d5 d4 1d 29 ad 1a 60 29 59 81 46 // e6 be 16 6e 41 ad 0d bd 40 54 03 3c 9f 33 bb da 82 24 a2 f3 d7 72 e7 // 63 6e 48 b3 3c bf 70 83 72 e8 f1 b9 93 3e c5 12 77 43 be 22 06 20 9e // f0 2d f9 cb f2 f6 e8 80 d3 38 2f 00} (length 0x4e) // } // flags: mount_flags = 0x0 (8 bytes) // opts: ptr[inout, array[ANYUNION]] { // array[ANYUNION] { // } // } // chdir: int8 = 0x1 (1 bytes) // size: len = 0x6f2 (8 bytes) // img: ptr[in, buffer] { // buffer: (compressed buffer with length 0x6f2) // } // ] // returns fd_dir memcpy((void*)0x200000000000, "hfsplus\000", 8); memcpy((void*)0x20000000bc40, "\023\023w\305\3745\324\024T\325\324\035)\255\032`)" "Y\201F\346\276\026nA\255\r\275@T\003<\2373\273\332\202$" "\242\363\327r\347cnH\263<\277p\203r\350\361\271\223>" "\305\022wC\276\"\006 \236\360-\371\313\362\366\350\200\3238/\000", 78); memcpy( (void*)0x200000000ac0, "\x78\x9c\xec\xdd\x4f\x6c\x1c\x57\x19\x00\xf0\x6f\xd6\x6b\x7b\x37\x55\x1d" "\xb7\x4d\xd3\x20\x55\xaa\x69\x51\x41\x58\x24\xb1\x2d\x17\xcc\x25\x06\x21" "\x64\xa4\x0a\xaa\x20\xc1\xd9\x6a\x9c\xc6\xca\xe6\x0f\xb6\x8b\xdc\x1e\xb0" "\x0b\x48\x5c\x39\x70\x45\x2a\x07\x73\x81\x13\x08\x21\x21\x21\x45\x2a\x67" "\xb8\x55\xdc\x2c\x4e\x15\x48\x5c\x7a\x4a\x7a\x60\xd0\xfc\x5b\xaf\xdd\xdd" "\xf5\x3a\xae\xbd\x2e\xfc\x7e\xd1\x64\xde\xbc\x37\xef\xcd\x37\xdf\xcc\xbe" "\xd9\x5d\xc9\xda\x00\xfe\x6f\x2d\x4d\x47\xfd\x41\x34\x63\x69\xfa\xd5\xcd" "\x6c\x7b\x77\x67\xae\xb5\xbb\x33\x77\xa7\x28\xd7\x5a\x11\x31\x1e\x11\xb5" "\x88\x7a\x47\xaf\xe4\xbd\x88\xc5\x28\x96\xf8\x4c\x56\x51\x35\xf4\x3a\xce" "\x2f\x56\x17\xae\xbf\xff\xe1\xee\x07\xc5\x56\xbd\x5c\x6a\x51\xfc\xd7\xec" "\x1d\x60\x7d\x90\xb3\xd8\x2e\x97\x98\x8a\x88\x91\x72\x7d\x0c\xfb\xc6\x7b" "\xfd\xf1\xc6\x1b\xdf\x2b\x26\xed\xcc\x64\x09\x7b\xa9\x4a\x1c\x0c\xdb\x68" "\x44\xa4\xfb\xfc\xe0\xe2\x5e\x4b\x37\xe9\x48\xc7\x46\xcf\xd7\x3b\xf0\xe9" "\x91\x14\xcf\xcd\x0e\xc5\xeb\x7f\x32\xe2\x5c\x44\x34\xaa\x07\xda\x76\xd1" "\x58\x3b\xfd\x08\x0f\x75\xa4\xb9\x68\xfb\xe4\xe2\x00\x00\x00\x80\x33\xe3" "\xfc\xc3\xad\x88\xcd\x98\x18\x76\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" "\xf0\x69\x52\xfe\xfe\x7f\x52\x2e\x8f\xaa\xf2\x54\x24\xd5\xef\xff\x7f\xae" "\x63\xf7\xb1\x21\x86\xda\x5f\xff\xc8\x1a\x55\xe1\x41\xed\x34\x82\x01\x00" "\x00\x00\x00\x00\x00\x80\x93\xf5\xc2\xc3\xf8\xcd\xf5\x34\x9d\xa8\xb6\xd3" "\x24\x6a\xdf\x1b\x29\x37\x9a\xe5\xfa\xcd\x58\x8f\x95\x7a\xc4\xe5\xd8\x8c" "\xe5\xd8\x88\x8d\x58\x8b\x99\x88\x98\xec\x18\x68\x6c\x73\x79\x63\x63\x6d" "\x26\x5e\xcc\xb7\x2e\x7c\x94\xa6\x69\x3c\x51\xf4\x8c\xb5\x7d\x3d\x67\xbb" "\xf6\x9c\x1d\x30\xe0\xe6\x71\xcf\x18\x00\x00\x00\x00\x00\x00\x00\xfe\xa7" "\x5c\x9b\x1f\xcf\xd7\x3f\x8e\xa5\x98\x18\x76\x30\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\xd0\x29\x89\x18\x29\x56\xf9\x72\xa1\x2a\x4f\x46\xad" "\x1e\x11\x8d\x88\x18\xcb\xf6\xdb\x8e\xf8\x5b\x55\x3e\x43\xea\x47\xed\xf0" "\xe0\x64\xe2\x00\x00\x00\x80\x21\x1b\xdd\xb7\x75\xfe\x61\x3c\x8c\xcd\x98" "\xa8\xb6\xd3\x24\xff\xcc\x7f\x31\xff\xdc\xdf\x88\x37\xe3\x6e\x6c\xc4\x6a" "\x6c\x44\x2b\x56\xe2\x46\xfe\x5d\x40\xf1\xa9\xbf\xb6\xbb\xb3\x35\xbd\xbb" "\x33\x77\x27\x5b\xca\x61\xbf\xf3\x64\x7b\xdc\xaf\xfd\x7b\xef\x18\xbf\x9f" "\x38\x34\xa8\x7c\xc4\x28\xbe\x7b\xe8\x7e\xe4\x4b\xf9\x1e\xcd\xb8\x19\xab" "\x79\xcd\xe5\x78\x3d\xee\x45\x2b\x6e\x44\x2d\xef\x99\xb9\x54\xc5\xd3\x11" "\x57\x87\x77\xb2\x98\x92\x6b\x85\x34\x8d\xf1\x41\xd2\x75\xa3\x5c\x67\x67" "\xfe\xf3\x72\x7d\x2a\x9a\x87\xed\x30\x99\x67\x64\xb4\x9d\x91\xab\x59\x6c" "\x49\x91\xc7\xa7\xfa\x67\xa2\xf3\xea\x0c\xe0\xe0\x91\x66\xa2\xd6\xfe\xe6" "\xe7\x42\xef\x23\xb5\xbf\x8c\xa9\x72\x7e\xad\xef\x51\x92\xff\xa4\x69\x51" "\x3a\x57\xd5\x44\x3c\xf1\xad\xbe\x39\xcf\xef\x97\xd1\x23\x9d\xcc\xb1\x1c" "\xcc\xc4\x6c\xc7\xdd\x77\xb1\x7f\xce\x23\x3e\xff\x87\xdf\x7e\xff\x56\xeb" "\xee\xed\x5b\xc9\xf6\xf4\xa9\xdd\x46\x8f\xe5\x85\xee\xd5\xe3\xff\xa8\xae" "\x50\x95\x89\xc2\x76\xac\xc4\x5c\x47\x26\x9e\x1b\x38\x13\x37\xd7\xcf\x78" "\x26\x7a\xda\xff\x4d\x63\x2d\x9e\x6d\x97\x97\xe2\x9b\xf1\xdd\x98\x8e\xa9" "\x78\x2d\xd6\x62\x35\x7e\x18\xcb\xb1\x11\x2b\x31\x15\xdf\xc8\x4b\xcb\xe5" "\xfd\x9c\xfd\x3f\xd9\x3f\x53\x8b\xfb\xb6\x5e\x3b\x2c\xa6\xb1\xf2\xba\x8c" "\x1c\x88\xe9\xb3\xe7\x8b\x75\xbf\x98\x5e\xcc\xfb\x4e\xc4\x6a\x7c\x3b\xee" "\xc5\x8d\x58\x89\x57\xf2\x7f\xb3\x31\x13\x5f\x8e\xf9\x98\x8f\x85\x8e\x2b" "\xfc\xec\x00\x33\x6d\xad\xcb\xab\xfe\x8f\xbd\x83\x7f\xe9\x0b\x65\x21\x9b" "\xf8\x7e\xb6\x37\x01\x9e\xe2\xab\xbb\x97\x2c\xaf\x4f\x75\xe4\xb5\x73\xce" "\x9d\xcc\xdb\x3a\x6b\x6a\x91\x96\x4f\x96\xa7\x8f\xf0\x3c\xea\x3f\x37\x56" "\xf6\x1e\x59\xd9\x95\xf8\x49\xc7\x6b\x70\xf8\xda\x99\x68\x44\xfb\x29\x51" "\x45\xf7\x4c\x95\x81\xd1\xae\x99\xf8\x55\x3e\xad\xac\xb7\xee\xde\x5e\xbb" "\xb5\x7c\xff\xc0\xb8\xc9\x76\xf7\xe3\xbd\x1c\xfb\x4f\xff\xec\x4c\x24\xd9" "\xfd\xf2\x74\x7b\x8e\xd8\x7f\x77\x64\x6d\xcf\x74\x6d\x9b\xc9\xdb\x2e\xb4" "\xdb\x6a\x07\xdb\x7e\xdd\x6c\xb7\x1d\xf6\x4a\x1d\x2b\xdf\xc3\x7d\x7c\xa4" "\xd9\xbc\xed\xb9\x88\xf8\x65\x19\x6d\xd6\x96\xc9\xe6\xf0\xac\xed\x52\x47" "\xbf\xec\xfd\x56\x23\x6f\xfb\x28\x4d\xd3\xe2\xfd\x16\x00\x67\xde\xb9\x2f" "\x9e\x1b\x6b\xfe\xab\xf9\xd7\xe6\xbb\xcd\x9f\x36\x6f\x35\x5f\x6d\x7c\x7d" "\xfc\x2b\xe3\xcf\x8f\xc5\xe8\x5f\x46\xbf\x5a\xbf\x3a\xf2\x72\xed\xf9\xe4" "\x77\xf1\x6e\xfc\x28\x0e\xff\x84\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1c\x6a\xfd\xad" "\xb7\x6f\x2f\xb7\x5a\x2b\x6b\x07\x0a\x69\x9a\x6e\xf5\x68\x3a\x91\x42\xd4" "\x23\xf6\xd5\xfc\xf9\x4f\x1d\xfb\xe4\xbf\x35\x16\x11\x83\x0f\x98\xed\xbd" "\x58\x8b\xc8\x6b\xea\x51\x16\x06\xe8\xfe\xcf\x88\x28\x6b\xb6\x1e\xef\x74" "\xde\x79\xdc\x24\xfc\xbd\xbc\x26\xa7\x92\xf0\x3e\x85\x64\xe0\x9d\x1b\x3d" "\xef\x9f\xb2\x70\xef\xc9\xf2\x74\x1e\xa5\x69\x7a\xea\xa7\x53\xfd\x56\xdb" "\x91\xbb\xa7\xa5\xa1\x5d\x82\x4f\xb8\x50\xfd\x44\xd6\xc7\x9a\x92\x7a\x44" "\x8f\x5e\x43\x99\x8e\x80\x53\x74\x65\xe3\xce\xfd\x2b\xeb\x6f\xbd\xfd\xa5" "\xd5\x3b\xcb\x6f\xac\xbc\xb1\x72\x77\x61\x7e\x7e\xe1\xea\xc2\xfc\x2b\x73" "\x57\x6e\xae\xb6\x1a\xc3\x0e\x0f\x38\x41\xf9\xb3\x3e\x7f\x9f\x33\xec\x48" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x41\x0d\xf6\xc7\x39\xc9\xed\xe5" "\x28\x6a\xea\xdd\xfe\x8a\xe0\xb0\xee\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc7\xb0\x34\x1d\xf5" "\x07\x91\xc4\xcc\xd5\xcb\x57\xb3\xed\xdd\x9d\xb9\x56\xb6\x54\xe5\x6c\x3d" "\x92\xef\xf9\x28\x22\x6a\x11\x91\x4c\x45\x24\xef\x45\x2c\x46\xb1\xc4\x64" "\xc7\x70\x49\xaf\xe3\x6c\x47\x5c\x7f\xff\xc3\xdd\x0f\x8a\xad\x7a\xb9\xe4" "\xfb\xd7\x8e\x7f\x16\xdb\xe5\x12\x53\x65\xb8\x53\xdd\xf7\x6b\x74\xab\x4c" "\xb7\x7a\x8d\x97\xe4\xe3\xdc\xef\x3d\xde\x80\x92\x72\x19\x69\xd7\x2c\x1e" "\x6b\x3c\xf8\x84\xfc\x37\x00\x00\xff\xff\x11\x30\x09\x2b", 1778); syz_mount_image(/*fs=*/0x200000000000, /*dir=*/0x20000000bc40, /*flags=*/0, /*opts=*/0x200000000700, /*chdir=*/1, /*size=*/0x6f2, /*img=*/0x200000000ac0); // openat arguments: [ // fd: fd_dir (resource) // file: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 31 00} (length 0x8) // } // flags: open_flags = 0x143042 (4 bytes) // mode: open_mode = 0x0 (2 bytes) // ] // returns fd memcpy((void*)0x200000000d80, "./file1\000", 8); syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000d80ul, /*flags=O_SYNC|O_NOATIME|O_CREAT|FASYNC|O_RDWR*/ 0x143042, /*mode=*/0); // open arguments: [ // file: ptr[in, buffer] { // buffer: {2e 2f 62 75 73 00} (length 0x6) // } // flags: open_flags = 0x169242 (8 bytes) // mode: open_mode = 0x10 (8 bytes) // ] // returns fd memcpy((void*)0x200000000080, "./bus\000", 6); syscall(__NR_open, /*file=*/0x200000000080ul, /*flags=O_TRUNC|O_SYNC|O_NOFOLLOW|O_NOATIME|O_LARGEFILE|O_CREAT|0x2*/ 0x169242ul, /*mode=S_IWGRP*/ 0x10ul); // 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; }