// https://syzkaller.appspot.com/bug?id=2dc0a7760777197118e32b794d1146a7d84b894a // 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$hfs arguments: [ // fs: ptr[in, buffer] { // buffer: {68 66 73 00} (length 0x4) // } // dir: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 31 00} (length 0x8) // } // flags: mount_flags = 0x1000812 (8 bytes) // opts: ptr[inout, array[ANYUNION]] { // array[ANYUNION] { // union ANYUNION { // ANYBLOB: buffer: {71 75 69 65 74 2c 63 6f 64 65 70 61 67 65 3d 63 // 70 38 36 30 2c 69 6f 63 68 61 72 73 65 74 3d 63 70 38 36 31 2c 00 // 80 8f ea d0 42 bd 35 dc 78 f7 f0 63 33 a5 e7 16 5b 82 71 e4 1a ee // 85 e5 9c bb 6c 2d f3 d4 e4 c1 6b 06 c7 3f 2e 3b 34 ac 8d 48 13 c9 // c3 d9 ce e1 dd b9 5d 1b bc f5 04 e0 65 b3 74 9a 1c bd 84 1e 68 5a // 55 85 98 cf 0d b1 0b 55 88 59 46 e6 78 d0 a7 18 77 03 7a 09 00 00 // 00 07 00 84 88 79 ef 16 04 ca dc 1f ac a3 aa 22 a5 76 75 0d 55 9c // 4e 12 4d 4c b7 29 3e 73 93 b7 72 86 fa 8c 6d c4 49 ed a0 a0 3d 34 // 23 82 e8 4d 6d 3c 29 ab 95 cc 92 3f be 25 e1 34 d1 c4 21 32 0a 3b // ff aa 17 fc d6 b5 17 8e 32 2c c4 71 33 b3 81 1e 3d 3b c3 49 98 dc // 7e d0 29 83 4a d5 91 d9 d5 6c 41 06 3d 8d e2 d5 0a 23 98 e7 3f f2 // 91 3a 9f e8 e9 54 a4 e4 ca 99 ce b5 73 7e 57 19 3c 5f 47 fd 63 b1 // 6c 8b 34 f2 56 db ac 0e 5e bd 00 90 78 df 2c b1 ca 01 51 ad 09 1a // db fe e5 12 6d 8a 59 fa 54 38 73 4b c3 e8 cc 7b 7e dc 10 71 6a 0a // 9b 71 19 52 cd f9 65 86 e0 6f ba ce 21 dc 04 bd b4 a1 a2 07 2c e5 // f7 2c f0 2e 52 56 ff 74 be 5e 07 a5 f8 d6 ec 2f a8 67 b2 a3 53 bf // 6e a1 b5 33 37 78 03 80 4a 49 a4 99 d5 1f 1c b7 1e 1c ea 55 15 98 // 93 9a fe 8f f8 e8 47 23 52 e2 d5 19 3b c8 66 c0 00 00 00 00 00 00 // 00 00 00 00 00 00} (length 0x18c) // } // union ANYUNION { // ANYRESOCT: ANYRES64 (resource) // } // union ANYUNION { // ANYBLOB: buffer: {b0 79 0a 07 e1 e4 71 ae d2 09 03 6f a5 f5 ca 6b // c1 ad 17 03 71 c5 e2 bd 52 cf 99 29 6e 6c dd 08 82 cc 4c 07 5a 7c // 4b 8c a0 d7 80 22 16 06 60 db 09 21 9e bb 75 dc 37 49 9a 82 72 c1 // 48 66 2b 3a fc 12 4f f5 5a 70 52 38 d3 47 a5 a5 4b c2 2f c6 e8 53 // 9f 02 d1 a1 4d 4d f8 76 89 f2 e3 4e 74 49 a8 43 df 2a 4e 9f be 05 // 9f 21 02 bb 7e fa 83 db 5e f2 68 95 be 03 38 58 45 60 61 b9 ac 96 // 5c 95 f1 92 8d e0 5e b8 11 73 16 01} (length 0x8a) // } // union ANYUNION { // ANYRES32: ANYRES32 (resource) // } // union ANYUNION { // ANYRESHEX: ANYRES64 (resource) // } // union ANYUNION { // ANYBLOB: buffer: {0a ff d5 ec e6 51 e2 a4 64 8f 9b 27 9d 8d c4 4b // c4 bd 6a cc 0a a0 1a 3a b5 6e 46 9d 3c 33 8a 26 ff 99 6b 57 af be // 65 c4 eb 94 f6 fd 4c fb da 2a f6 c8 5c 6e 13 59 55 ca 06 40 54 6a // 2a ac 7b b0 24 32 e4 5e 6d 33 31 81 ee 92 1f 9f 26 a8 ef 00 00 00 // 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // 00 00 00 00 00 00 4d e9 f9 1a ea b6 6c c8 b2 19 7d 3c 00 06 83 24 // c7 b7 bd} (length 0x81) // } // } // } // chdir: int8 = 0x1 (1 bytes) // size: len = 0x305 (8 bytes) // img: ptr[in, buffer] { // buffer: (compressed buffer with length 0x305) // } // ] // returns fd_dir memcpy((void*)0x200000000180, "hfs\000", 4); memcpy((void*)0x2000000000c0, "./file1\000", 8); memcpy( (void*)0x200000001240, "\x71\x75\x69\x65\x74\x2c\x63\x6f\x64\x65\x70\x61\x67\x65\x3d\x63\x70\x38" "\x36\x30\x2c\x69\x6f\x63\x68\x61\x72\x73\x65\x74\x3d\x63\x70\x38\x36\x31" "\x2c\x00\x80\x8f\xea\xd0\x42\xbd\x35\xdc\x78\xf7\xf0\x63\x33\xa5\xe7\x16" "\x5b\x82\x71\xe4\x1a\xee\x85\xe5\x9c\xbb\x6c\x2d\xf3\xd4\xe4\xc1\x6b\x06" "\xc7\x3f\x2e\x3b\x34\xac\x8d\x48\x13\xc9\xc3\xd9\xce\xe1\xdd\xb9\x5d\x1b" "\xbc\xf5\x04\xe0\x65\xb3\x74\x9a\x1c\xbd\x84\x1e\x68\x5a\x55\x85\x98\xcf" "\x0d\xb1\x0b\x55\x88\x59\x46\xe6\x78\xd0\xa7\x18\x77\x03\x7a\x09\x00\x00" "\x00\x07\x00\x84\x88\x79\xef\x16\x04\xca\xdc\x1f\xac\xa3\xaa\x22\xa5\x76" "\x75\x0d\x55\x9c\x4e\x12\x4d\x4c\xb7\x29\x3e\x73\x93\xb7\x72\x86\xfa\x8c" "\x6d\xc4\x49\xed\xa0\xa0\x3d\x34\x23\x82\xe8\x4d\x6d\x3c\x29\xab\x95\xcc" "\x92\x3f\xbe\x25\xe1\x34\xd1\xc4\x21\x32\x0a\x3b\xff\xaa\x17\xfc\xd6\xb5" "\x17\x8e\x32\x2c\xc4\x71\x33\xb3\x81\x1e\x3d\x3b\xc3\x49\x98\xdc\x7e\xd0" "\x29\x83\x4a\xd5\x91\xd9\xd5\x6c\x41\x06\x3d\x8d\xe2\xd5\x0a\x23\x98\xe7" "\x3f\xf2\x91\x3a\x9f\xe8\xe9\x54\xa4\xe4\xca\x99\xce\xb5\x73\x7e\x57\x19" "\x3c\x5f\x47\xfd\x63\xb1\x6c\x8b\x34\xf2\x56\xdb\xac\x0e\x5e\xbd\x00\x90" "\x78\xdf\x2c\xb1\xca\x01\x51\xad\x09\x1a\xdb\xfe\xe5\x12\x6d\x8a\x59\xfa" "\x54\x38\x73\x4b\xc3\xe8\xcc\x7b\x7e\xdc\x10\x71\x6a\x0a\x9b\x71\x19\x52" "\xcd\xf9\x65\x86\xe0\x6f\xba\xce\x21\xdc\x04\xbd\xb4\xa1\xa2\x07\x2c\xe5" "\xf7\x2c\xf0\x2e\x52\x56\xff\x74\xbe\x5e\x07\xa5\xf8\xd6\xec\x2f\xa8\x67" "\xb2\xa3\x53\xbf\x6e\xa1\xb5\x33\x37\x78\x03\x80\x4a\x49\xa4\x99\xd5\x1f" "\x1c\xb7\x1e\x1c\xea\x55\x15\x98\x93\x9a\xfe\x8f\xf8\xe8\x47\x23\x52\xe2" "\xd5\x19\x3b\xc8\x66\xc0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00", 396); sprintf((char*)0x2000000013cc, "%023llo", (long long)-1); memcpy( (void*)0x2000000013e3, "\xb0\x79\x0a\x07\xe1\xe4\x71\xae\xd2\x09\x03\x6f\xa5\xf5\xca\x6b\xc1\xad" "\x17\x03\x71\xc5\xe2\xbd\x52\xcf\x99\x29\x6e\x6c\xdd\x08\x82\xcc\x4c\x07" "\x5a\x7c\x4b\x8c\xa0\xd7\x80\x22\x16\x06\x60\xdb\x09\x21\x9e\xbb\x75\xdc" "\x37\x49\x9a\x82\x72\xc1\x48\x66\x2b\x3a\xfc\x12\x4f\xf5\x5a\x70\x52\x38" "\xd3\x47\xa5\xa5\x4b\xc2\x2f\xc6\xe8\x53\x9f\x02\xd1\xa1\x4d\x4d\xf8\x76" "\x89\xf2\xe3\x4e\x74\x49\xa8\x43\xdf\x2a\x4e\x9f\xbe\x05\x9f\x21\x02\xbb" "\x7e\xfa\x83\xdb\x5e\xf2\x68\x95\xbe\x03\x38\x58\x45\x60\x61\xb9\xac\x96" "\x5c\x95\xf1\x92\x8d\xe0\x5e\xb8\x11\x73\x16\x01", 138); *(uint32_t*)0x20000000146d = 0; sprintf((char*)0x200000001471, "0x%016llx", (long long)0); memcpy((void*)0x200000001483, "\x0a\xff\xd5\xec\xe6\x51\xe2\xa4\x64\x8f\x9b\x27\x9d\x8d\xc4\x4b\xc4" "\xbd\x6a\xcc\x0a\xa0\x1a\x3a\xb5\x6e\x46\x9d\x3c\x33\x8a\x26\xff\x99" "\x6b\x57\xaf\xbe\x65\xc4\xeb\x94\xf6\xfd\x4c\xfb\xda\x2a\xf6\xc8\x5c" "\x6e\x13\x59\x55\xca\x06\x40\x54\x6a\x2a\xac\x7b\xb0\x24\x32\xe4\x5e" "\x6d\x33\x31\x81\xee\x92\x1f\x9f\x26\xa8\xef\x00\x00\x00\x00\x08\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x4d\xe9\xf9\x1a\xea\xb6\x6c\xc8\xb2" "\x19\x7d\x3c\x00\x06\x83\x24\xc7\xb7\xbd", 129); memcpy( (void*)0x200000000340, "\x78\x9c\xec\xdd\x4d\x6b\x13\x5b\x1c\xc7\xf1\xdf\x99\xa4\x4d\x7a\x9b\xdb" "\x9b\x3e\x5c\x2e\xdc\x65\xb5\xa0\x1b\xd1\xba\x11\x37\x11\xc9\x5b\x10\xc4" "\x85\x68\xdb\x08\xc5\x50\x51\x2b\xa8\x1b\x53\x71\x25\xa2\x7b\xf7\xbe\x05" "\x5f\x84\x1b\xc5\x37\xa0\x2b\x17\xe2\x0b\x68\x37\x8e\x9c\x33\x0f\xc9\x24" "\x93\x99\x34\x24\x1d\x83\xdf\x0f\x88\x93\xc9\xfc\xe7\xfc\xcf\x3c\xfe\x4f" "\xa0\x1c\x01\xf8\x63\x5d\x6d\x7e\x79\x77\xf1\x9b\xfd\x67\xa4\x92\x4a\xd2" "\xcb\xcb\x92\x27\xa9\x2a\x95\x25\xfd\xab\xff\xaa\x8f\xf6\xf6\x77\xf7\xdb" "\xad\x9d\xac\x1d\x95\x5c\x84\x8e\x7c\x19\x05\x91\x66\x60\x9b\xed\xbd\x96" "\xfb\xff\x20\xb9\xda\xc6\xb9\x88\x50\xdd\x7e\x2a\xab\xd6\xbb\x0e\xd3\xe1" "\xfb\xfe\x95\xaf\x7d\xeb\xbe\x7b\x05\x25\x83\xc2\xb8\xbb\x3f\x85\x27\x55" "\xc2\xbb\xd3\x7d\x5f\x3d\xf1\xcc\xb2\x1d\x8c\x19\xd7\x99\x70\x1e\xb3\xc6" "\x1c\xea\x50\x8f\xb5\x54\x74\x1e\x00\x80\x62\xd9\xf7\xff\x41\x50\xf8\xdb" "\xf7\x7c\x2d\xac\xdf\x3d\x4f\xda\x08\x5f\xfb\xbf\xe5\xfb\x7f\x5c\x87\x45" "\x27\x30\x75\x7e\xe6\xb7\x3d\xef\x7f\x37\xca\xf2\x8d\x3d\xbf\xff\xb8\xaf" "\xba\xe3\x3d\x37\x84\xb3\xdf\x7b\xd1\x28\x71\x94\x96\xe7\xfa\x3e\xcf\x2b" "\x28\x24\x13\x05\xa6\x49\x1f\x55\x76\x87\x7c\x2e\x17\x6f\xe1\xce\x6e\xbb" "\x75\x6e\xfb\x5e\x7b\xc7\xd3\x73\x35\x42\x3d\x01\x6b\x71\x0b\x21\x7b\x85" "\xe6\x64\xbb\x9e\x32\x36\xcd\x30\x42\xdf\x4d\x6a\x45\x19\xa4\xe5\xcd\xd9" "\x3e\x6c\x0e\xc9\x7f\x75\xcc\x16\x33\x0c\x0c\xdf\x12\x27\xc4\x7c\x30\x9f" "\xcc\x4d\x53\xd7\x5b\xed\xc4\xf5\x5f\xd9\x37\x36\x5b\x97\x70\xbd\xef\x4c" "\x05\xf9\x9f\x1f\xde\xde\xa2\x8b\xb2\x5b\x29\x7c\x6c\x34\x1a\x0d\xcf\xed" "\x28\xb2\xec\x1a\xf9\x3f\x79\xa6\x72\x7a\x59\x4d\x1f\x91\x28\x3a\xb0\xcb" "\x4a\xfe\x40\x50\xcf\xcb\xd3\x45\xad\xf4\x45\x05\xbd\xbb\x90\x1a\x50\x89" "\xa3\x56\x53\xa3\x36\xa3\x4f\x43\xda\x5a\x4b\x44\xd9\xde\xc4\x57\xf3\xf0" "\x2c\xa7\xcd\xbc\x36\xd7\xcd\xba\x7e\xe8\xbd\x9a\x3d\xf5\xbf\x67\xf3\xdb" "\xd0\xf0\x3b\x33\xf1\x8b\x8e\xd9\x08\x6e\x34\x77\xc4\x83\xfe\xcc\xa7\x37" "\x57\x76\xfb\xac\x0f\xbc\x39\x3a\xba\x51\x4b\xae\x89\x8f\x62\x65\x58\xea" "\x47\xd9\xcf\x34\x8c\x20\x3a\x87\xaf\xb4\xa5\x4b\x5a\x7a\xf8\xe4\xe9\xdd" "\x52\xbb\xdd\x7a\x60\x17\x6e\xa7\x2c\xdc\xaf\xc5\x6b\xe6\x5e\x48\xa9\xdb" "\x14\xbc\xa0\x4e\x77\x4d\x45\xbe\x33\xb0\x71\xf4\x0c\x4c\x84\x2f\x84\x2b" "\xa7\x94\xd8\xd9\x89\xee\xd0\x3e\x3f\x72\x37\xb6\x77\xd9\x89\x1c\xf9\xde" "\x2b\x21\xba\x61\x27\xd6\x84\xbc\xe2\x2f\xad\xac\x6b\xa3\xf9\xb1\xef\x42" "\x9a\xd8\x82\x5f\x99\xf0\x0e\x7f\xfa\x63\x44\xfd\x7d\xc2\x0f\x25\x14\xa5" "\x7b\xd2\x8b\xce\x04\x05\xb1\x75\x97\x09\xc6\x7f\xae\x92\x0f\xeb\x7d\x57" "\xaf\xd9\x6a\xe1\x5a\x65\x78\x9d\x1e\x15\x64\x69\x25\x9b\xab\xde\xc3\x3d" "\xfa\xb6\xc6\x8e\x47\x40\xd5\x44\xfc\x8a\x5b\xfa\x2b\x59\x46\xe7\x8c\x0d" "\x16\xc3\x3a\x26\x65\x1c\xd7\xd1\x68\x63\xae\x53\x67\xa4\xd3\xa3\xb7\x58" "\x0f\xf3\x9c\x0d\xfe\xb3\x9c\x0d\x4c\x53\x9f\x75\x8b\xdf\xff\x01\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x66\xcd\xf1\xff\xae\x60" "\xe1\xd8\x51\x45\xf7\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x80\x59\x17\xcf\xff\xab\x68\xfe\x5f\x8d\x36\xff\x6f\xff" "\x54\x2c\xe1\xfc\xbf\x55\xe5\xcc\xff\xbb\x35\x98\xc3\xc0\xfc\xbf\x6f\xf6" "\x64\x3a\x12\xf3\xff\x02\xd3\xf5\x2b\x00\x00\xff\xff\xff\x2c\x77\xb3", 773); syz_mount_image( /*fs=*/0x200000000180, /*dir=*/0x2000000000c0, /*flags=MS_SYNCHRONOUS|MS_STRICTATIME|MS_NOSUID|MS_NODIRATIME*/ 0x1000812, /*opts=*/0x200000001240, /*chdir=*/1, /*size=*/0x305, /*img=*/0x200000000340); // openat arguments: [ // fd: fd_dir (resource) // file: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 31 00} (length 0x8) // } // flags: open_flags = 0x42 (4 bytes) // mode: open_mode = 0x0 (2 bytes) // ] // returns fd memcpy((void*)0x200000000000, "./file1\000", 8); syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000000ul, /*flags=O_CREAT|O_RDWR*/ 0x42, /*mode=*/0); // truncate arguments: [ // file: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 31 00} (length 0x8) // } // len: intptr = 0x2fffffd (8 bytes) // ] memcpy((void*)0x200000000940, "./file1\000", 8); syscall(__NR_truncate, /*file=*/0x200000000940ul, /*len=*/0x2fffffdul); // openat arguments: [ // fd: fd_dir (resource) // file: ptr[in, buffer] { // buffer: {2e 2f 62 75 73 00} (length 0x6) // } // flags: open_flags = 0x4042 (4 bytes) // mode: open_mode = 0x80 (2 bytes) // ] // returns fd memcpy((void*)0x200000000140, "./bus\000", 6); syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000140ul, /*flags=O_DIRECT|O_CREAT|O_RDWR*/ 0x4042, /*mode=S_IWUSR*/ 0x80); // syz_mount_image$fuse arguments: [ // fs: nil // dir: nil // flags: mount_flags = 0x0 (8 bytes) // opts: nil // chdir: int8 = 0x3e (1 bytes) // size: const = 0x0 (8 bytes) // img: nil // ] // returns fd_dir syz_mount_image(/*fs=*/0, /*dir=*/0, /*flags=*/0, /*opts=*/0, /*chdir=*/0x3e, /*size=*/0, /*img=*/0); } int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0x1000000ul, /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/ 7ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x200001000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); const char* reason; (void)reason; loop(); return 0; }