// https://syzkaller.appspot.com/bug?id=2fadd6c28069190d97183c9606710816bf750532 // 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; } } } 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)) { } // syz_mount_image$nilfs2 arguments: [ // fs: ptr[in, buffer] { // buffer: {6e 69 6c 66 73 32 00} (length 0x7) // } // dir: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 32 00} (length 0x8) // } // flags: mount_flags = 0x0 (8 bytes) // opts: ptr[inout, array[ANYUNION]] { // array[ANYUNION] { // union ANYUNION { // ANYRES8: ANYRES8 (resource) // } // union ANYUNION { // ANYBLOB: buffer: {ef ab 32 c8 7c 45 3c 50 89 39 5d a8 b3 cc 54 dd // 1f 85 aa b8 99 89 6a cd c9 f2 a5 12 f8 11 d1 0c 68 b6 13 cb dd a6 // 13 43 e5 62 3a 50 81 5f bc f3 f5 2e 7b 4c 40 28 94 08 07 36 51 63 // 74 d0 f4 cf 2a 3f 10 b4 c7 13 53 a4 c5 e5 7a 80 13 85 4f 4b 03 57 // b7 69 5e c0 c4 72 e2 71 bb bc bd 29 cf 92 06 3b 2c 50 df ae 6b 5e // 28 8a 3d 36 9a db 0f 04 28 7d 9a 9e ee 56 1b 2a 56 e8 a5 e5 60 93 // 00 33 4f a9 44 7a 03 93 10 b2 1c 84 c4 a9 62 8f fc fc 48 ec 59 24 // 1e d9 14 a8 70 91 d3 c7 f4 5e ac 56 bb 3a 45 84 85 1e bc fe 3c 1f // 70 cd 3f cd 20 41 2b 71 54 02 ad 1d 81 77 e3 09 47 65 de 48 40 1e // e4 5a 06 e0 6a 0e 85 47} (length 0xc8) // } // union ANYUNION { // ANYRES64: ANYRES64 (resource) // } // union ANYUNION { // ANYRES8: ANYRES8 (resource) // } // } // } // chdir: int8 = 0x3 (1 bytes) // size: len = 0xa8f (8 bytes) // img: ptr[in, buffer] { // buffer: (compressed buffer with length 0xa8f) // } // ] // returns fd_dir memcpy((void*)0x200000000000, "nilfs2\000", 7); memcpy((void*)0x200000000040, "./file2\000", 8); *(uint8_t*)0x200000001200 = 0; memcpy((void*)0x200000001201, "\xef\xab\x32\xc8\x7c\x45\x3c\x50\x89\x39\x5d\xa8\xb3\xcc\x54\xdd\x1f" "\x85\xaa\xb8\x99\x89\x6a\xcd\xc9\xf2\xa5\x12\xf8\x11\xd1\x0c\x68\xb6" "\x13\xcb\xdd\xa6\x13\x43\xe5\x62\x3a\x50\x81\x5f\xbc\xf3\xf5\x2e\x7b" "\x4c\x40\x28\x94\x08\x07\x36\x51\x63\x74\xd0\xf4\xcf\x2a\x3f\x10\xb4" "\xc7\x13\x53\xa4\xc5\xe5\x7a\x80\x13\x85\x4f\x4b\x03\x57\xb7\x69\x5e" "\xc0\xc4\x72\xe2\x71\xbb\xbc\xbd\x29\xcf\x92\x06\x3b\x2c\x50\xdf\xae" "\x6b\x5e\x28\x8a\x3d\x36\x9a\xdb\x0f\x04\x28\x7d\x9a\x9e\xee\x56\x1b" "\x2a\x56\xe8\xa5\xe5\x60\x93\x00\x33\x4f\xa9\x44\x7a\x03\x93\x10\xb2" "\x1c\x84\xc4\xa9\x62\x8f\xfc\xfc\x48\xec\x59\x24\x1e\xd9\x14\xa8\x70" "\x91\xd3\xc7\xf4\x5e\xac\x56\xbb\x3a\x45\x84\x85\x1e\xbc\xfe\x3c\x1f" "\x70\xcd\x3f\xcd\x20\x41\x2b\x71\x54\x02\xad\x1d\x81\x77\xe3\x09\x47" "\x65\xde\x48\x40\x1e\xe4\x5a\x06\xe0\x6a\x0e\x85\x47", 200); *(uint64_t*)0x2000000012c9 = 0; *(uint8_t*)0x2000000012d1 = 0; memcpy( (void*)0x200000001400, "\x78\x9c\xec\xdd\x4d\x8c\x5b\x47\x01\x00\xe0\xb1\x77\xbd\xc9\x26\x29\x71" "\x4a\x42\x97\x24\xb4\x09\x3f\x4d\xf9\xe9\x6e\xb3\x59\x52\x20\x82\xa6\x6a" "\x2e\x44\x4d\xc5\xad\x52\xc5\x25\x4a\xd3\x12\x91\x06\x44\x2a\x41\xab\x48" "\x4d\x72\xe2\x04\xad\xaa\x70\x85\x22\x4e\xe5\x50\x01\x42\x6a\x2f\x28\xea" "\x89\x4b\x25\x1a\x89\x4b\xc5\xa1\x70\xe0\x40\x08\x52\x25\x0e\x50\x48\x8c" "\xd6\x3b\xe3\xb5\x67\x6d\x9e\x9d\xdd\xec\xb3\xd7\xdf\x27\xcd\x8e\xe7\xcd" "\xb3\x67\xde\xdb\xe7\xe7\xf7\x37\x33\x01\x18\x5b\xd5\xe6\xdf\x85\x85\x99" "\x4a\x08\x57\xde\x7a\xf5\xd8\xdf\xee\xff\xeb\xf4\xe2\x94\x47\x5a\x73\xd4" "\x9b\x7f\x27\xdb\x52\xb5\x10\x42\x25\xa6\x27\xb3\xcf\x7b\x7f\x62\x29\xbe" "\xf9\xc1\x85\x53\xdd\xe2\x4a\x98\x6f\xfe\x4d\xe9\xf0\xc4\x8d\xd6\x7b\xb7" "\x86\x10\x2e\x86\x7d\xe1\x6a\xa8\x87\xdd\x57\xae\xbd\xf2\xce\xfc\xe3\x27" "\x2e\x1d\xbf\xbc\xff\xdd\xd7\x8f\x5c\xbf\x33\x4b\x0f\x00\x00\xe3\xe5\x1b" "\x57\x8f\x2c\xec\xfa\xf3\x1f\xf6\xec\xf8\xf0\x8d\x7b\x8f\x86\x4d\xad\xe9" "\xe9\xf8\xbc\x1e\xd3\xdb\xe2\x71\xff\xd1\x78\xe0\x9f\x8e\xff\xab\xa1\x33" "\x5d\x69\x0b\xed\xa6\xb2\xf9\x26\x63\xa8\x66\xf3\x4d\x74\x99\xaf\xbd\x9c" "\x5a\x36\xdf\x64\x8f\xf2\xa7\xb2\xcf\xad\xb5\xf2\xf7\x74\xcc\xb7\xa9\xa0" "\xfc\x89\xb6\x69\xdd\x96\x1b\x46\x59\xda\x8e\xeb\xa1\x52\x9d\xed\x48\x57" "\xab\xb3\xb3\x4b\xe7\xe4\xa1\x79\x5e\x3f\x55\x99\x3d\x77\xe6\xec\x33\xe7" "\x4b\xaa\x28\xb0\xe6\xfe\x79\x5f\x08\x61\x9f\x30\x68\x68\x34\x1a\x2f\x35" "\x57\xe0\x10\xd4\x45\x10\x6e\x37\x34\xb6\x97\xbd\x07\x02\x58\x92\xdf\x2f" "\x5c\xe1\x62\x7e\x65\x61\x75\x5a\x9f\x36\xd9\x5f\xf9\x37\x1e\xad\x76\x7f" "\x3f\xac\x81\xf5\xde\xfe\x8b\xca\xff\xd1\x9f\xca\x2d\x7f\x85\x21\x28\x7f" "\x73\x89\xe5\xff\xe2\x92\x3d\x0e\x6b\x67\xa3\x6e\x4d\x69\xb9\xd2\xf7\x68" "\x5b\x4c\xe7\xf7\x11\xf2\xe7\x97\x06\xdd\xff\xa4\xcf\xcb\xef\x47\xd4\xfa" "\xac\x67\xaf\xfb\x08\xa3\x72\x7f\xa1\x57\x3d\x27\xd6\xb9\x1e\xb7\xab\x57" "\xfd\xf3\xed\x62\xa3\xfa\x6a\x8c\xd3\x7a\xf8\x5a\x96\xdf\xfe\xfd\xc9\xff" "\xa7\xa3\xf2\x3f\x06\xba\xfb\xd7\x7a\x5d\xff\x7f\x6d\xba\xf4\x6b\x9d\x8b" "\x61\xdf\x10\xd4\x61\x43\x87\xda\x10\xd4\x41\xe8\x3b\x34\xca\xde\x01\x01" "\x43\x6b\xf9\xb9\xb9\x25\x8d\x28\xe5\xe7\xcf\xf5\xe5\xf9\x9b\x0a\xf2\x37" "\x17\xe4\x4f\x17\xe4\x6f\x29\xc8\xdf\x5a\x90\x0f\xe3\xec\x37\xcf\xff\x38" "\xbc\x5c\x59\x3e\xcf\xcf\xcf\xe9\x07\xbd\x1e\x96\xae\xb3\xdd\x15\xe3\x8f" "\x0c\x58\x9f\xfc\x7a\xe4\xa0\xe5\xe7\xcf\xfd\x0e\x6a\xb5\xe5\xe7\xcf\x13" "\xc3\x30\x7b\xf3\xe4\x93\xa7\xbf\xf4\xf4\x53\xd7\x96\x9e\xff\xaf\xb4\xb6" "\xff\x5b\x71\x7b\xdf\x17\xd3\xf5\xf8\xdd\xba\x1a\x67\x48\xd7\x0b\xf3\xeb" "\xea\xad\x67\xff\xeb\x9d\xe5\x54\x7b\xcc\x77\x77\x56\x9f\xbb\x56\xcc\xdf" "\x58\x2a\x71\x67\xe7\x7c\x95\x9d\xcb\x9f\x13\xda\xf6\x33\x2b\xea\x31\xd3" "\xf9\xbe\xed\xbd\xe6\xdb\xdb\x39\x5f\x3d\x9b\x6f\x3a\x86\xfc\xde\x5f\x7e" "\x7c\xb2\x25\x7b\x5f\x3a\xfe\x48\xfb\xd5\xb4\xbe\x26\xb3\xe5\xad\x65\xcb" "\x31\x95\xd5\x23\xed\x57\x76\xc4\xf8\x4e\xde\x83\x64\x7c\xa4\xed\xb1\xd7" "\xf3\xff\x69\xfb\x9c\x09\xb5\xca\x33\x67\xce\x9e\x7e\x28\xa6\xd3\x76\xfa" "\xfb\x89\xda\xa6\xc5\xe9\x07\xdb\x3f\xf4\x97\xeb\x53\x77\x60\x75\xfa\x6d" "\xff\x33\x13\x3a\xdb\xff\x6c\x6b\x4d\xaf\x55\xdb\xf6\x0b\xad\xc3\xef\xb4" "\xbf\x38\xd8\xfa\xbc\xce\xe9\xf3\x4b\xc9\x5a\x3e\xff\xa1\x98\x4e\xbf\x73" "\xdf\x9a\x98\x6e\x4e\x9f\x3d\xf5\x9d\xb3\x4f\xaf\xf5\xc2\xc3\x98\x3b\xff" "\xc2\x8b\xdf\x3e\x79\xf6\xec\xe9\xef\x79\x91\x5e\x4c\x5b\x2d\x5e\x78\x51" "\xb4\xe7\xd8\xa8\x4f\x0e\xc2\xf8\x98\x7b\xfe\xb9\xef\xce\x9d\x7f\xe1\xc5" "\x07\xcf\x3c\x77\xf2\xd9\xd3\xcf\x9e\x3e\x77\xe8\xf0\xe1\x43\xf3\xf3\x87" "\xbf\x7c\x68\x61\xae\x79\x5c\x3f\xd7\x7e\xd6\x0f\x6c\x24\xcb\x3f\xfa\x65" "\xd7\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe8\xd7\xf7\x8f\x1f\xbb\xf6" "\xc7\xb7\x1f\x7e\x6f\xa9\xfd\xff\x72\xfb\xbf\xd4\xfe\x3f\x3d\xf9\x9b\xda" "\xff\xff\x30\x6b\xff\x9f\xb7\x93\x4f\xad\x02\x52\x3b\xfb\x1d\x5d\xf2\x9b" "\xe3\xee\xbd\xd9\x59\x8f\xa9\x6c\xbe\x5a\x0c\x1f\xcd\xea\xbb\x33\x2b\x67" "\x57\xf6\xbe\x8f\xc5\xb8\x35\x8e\x5f\x6c\xff\x9f\xda\xdb\xe7\xfd\xba\xa6" "\xfa\xdc\x93\x4d\xcf\xfb\xef\x4d\xf3\x65\xdd\x09\xac\xe8\x2f\x65\x2a\xeb" "\x83\xa4\x35\x5e\x60\x6c\xb0\xff\xc9\x98\xbe\x1c\xe3\x9f\x07\x28\x51\x65" "\xba\xfb\xe4\x2c\xdd\xab\x7f\xeb\xb4\xad\x37\xfb\xa7\x78\xe9\x4e\x54\x90" "\xf5\x90\xfa\x13\x49\x5b\x43\xea\xc7\x24\xb5\xff\xee\xd5\xaf\x53\xda\xff" "\xef\x58\x87\x3a\xb2\xf6\xd6\xa3\x39\x61\xd9\xcb\x08\x74\xf7\x8f\x61\x1c" "\xff\xb3\xda\x9e\x6e\x3b\x12\x2f\xbb\x5e\xff\x3f\x34\x1a\xe5\xd7\x61\xf5" "\x61\xf8\xd7\xb3\xb0\x86\xa1\xd1\x30\x8a\x07\x30\x1c\xca\x1e\xff\x33\x5d" "\xf7\x4c\xf1\xb9\xdf\x7d\x7d\xf3\x62\x48\xb3\xdd\x78\xb4\x73\x7f\x99\xf7" "\x5f\x0a\xab\x31\x0a\xe3\x5f\x2a\xbf\xbc\xf2\xd7\x7a\xfc\xcf\xd6\xf8\x77" "\x7d\xed\xff\xba\xf4\xae\xde\xd1\xcf\x73\xff\xa3\x2b\xfc\xfb\xa7\xd7\xdf" "\x6b\x2b\x36\xec\xee\x77\xff\x9b\x2f\x7f\xea\x07\x7a\xe7\x81\xbf\x5f\x78" "\xb8\xb8\xdc\xe4\xc3\x58\x7e\x5a\xfe\x03\xa1\xbf\xf2\x1b\xaf\x65\xe5\xe7" "\x37\x84\xfa\xf4\x9f\xac\xfc\x2d\x7d\x96\xbf\x62\xf9\xf7\xde\x5e\xf9\xff" "\x8d\xe5\xa7\xfb\x69\x0f\x7c\xaa\xdf\xf2\x97\x6a\x5c\xa9\xc6\x7a\xc4\x28" "\xbf\x6e\x9c\xee\xff\xe5\xd7\x8d\x93\x9b\xd9\xf2\xa7\xbe\x3d\x07\x5e\xfe" "\xdb\x1c\xa8\xf1\x56\x2c\x1f\xc6\x59\xef\x71\x66\xfb\x1d\xc1\x76\x38\x8d" "\xca\xf8\xbf\xbd\xe4\xcf\x61\x7c\x31\xa6\xd3\x8e\x30\x3d\xe7\x90\xff\x22" "\x0f\x5a\xff\xf4\x7c\x45\xfa\x1d\xd8\x95\x7d\x7e\xa5\xe0\xf7\x6d\x54\xc6" "\x29\xee\x65\xdc\xc7\xff\xfd\x4a\x8c\x8b\xbe\x0f\x69\xfc\xdf\xb4\x3d\xd6" "\xbb\xa4\xab\x6d\xe9\x5a\x97\x75\x3b\xea\xdb\x0a\x6c\x34\xef\x0f\xe3\xfd" "\xbf\x51\x0e\x17\x87\xa0\x0e\xc2\x90\x86\xe1\x18\x03\xbb\x3d\x34\x1a\x8d" "\x52\x3b\xf2\xd6\x8b\x78\xb9\xca\x5e\xff\x65\xdf\x7d\x2e\xbb\xfc\xb2\xd7" "\x7f\x91\x7c\xfc\xdf\xfc\x18\x3e\x1f\xff\xb7\x9a\x9d\x40\xe4\xe3\xff\xe6" "\xef\xcf\xc7\xff\xcd\xf3\xf3\xf1\xf5\xf2\xfc\x7c\xfc\xdf\x7c\x7d\xe6\xe3" "\xff\xe6\xf9\xf7\x64\x9f\x9b\x5f\xc1\x9e\x29\xc8\xff\x78\x41\xfe\xee\x82" "\xfc\x3d\xcb\xf9\xd3\xdd\xf2\xf7\x16\xbc\xff\x13\x05\xf9\xfb\x0b\xf2\xef" "\x2d\xc8\xbf\xaf\x20\xff\xee\x82\xfc\x89\x82\xfc\x4f\x17\xe4\x7f\xa6\x20" "\xff\xfe\x82\xfc\x07\x0a\xf2\x3f\x5b\x90\xbf\xd1\x35\xdb\xa3\xb4\x7d\xa9" "\xc6\x6d\xf9\x61\x9c\xe5\xed\xf3\x7c\xff\x61\x7c\xa4\xfb\x3f\xbd\xbe\xff" "\x3b\x0b\xf2\x81\xd1\xf5\x93\x37\x0e\x3e\xf6\xd4\xaf\xbf\x59\x5f\x6a\xff" "\x3f\xd5\x3a\x5f\x4b\xf7\xf1\x8e\xc6\x74\x2d\x9e\x3b\xff\x20\xa6\xf3\xfb" "\xde\xa1\x2d\xbd\x98\xf7\x76\x4c\xff\x25\xcb\x1f\xf6\xeb\x1d\x30\x4e\xf2" "\xfe\x33\xf2\xdf\xf7\x03\x05\xf9\xc0\xe8\x4a\xcf\x79\xf9\x7e\xc3\x18\xaa" "\x6c\xee\x3e\x39\xc6\x69\xbf\xd0\xab\xdf\xaa\x5e\xc7\xf9\x8c\x96\xcf\xc5" "\xf8\xf3\x31\xfe\x42\x8c\x1f\x8c\xf1\x6c\x8c\xe7\x62\x7c\x30\xc6\xf3\xeb" "\x54\x3f\xee\x8c\xc7\x7e\xf5\xdb\x23\x2f\x57\x96\xcf\xf7\xb7\x67\xf9\xfd" "\x3e\x4f\xde\x6a\x0f\x14\xe5\xfd\x44\x1d\xea\xb3\x3e\xf9\xf5\x81\x41\x9f" "\x67\xcf\xfb\xf1\x1b\xd4\x6a\xcb\xbf\xcd\xe6\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\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\xa5\xa9\x36\xff\x2e\x2c\xcc\x54\x42\xb8\xf2\xd6\xab\xc7\x9e\x3c\x71\x66" "\x6e\x71\xca\x23\xad\x39\xea\xcd\xbf\x93\x6d\xa9\x5a\xeb\x7d\x21\x3c\x14" "\xe3\x89\x18\xff\x2c\xbe\xb8\xf9\xc1\x85\x53\xed\xf1\xad\x18\x57\xc2\x7c" "\xa8\x84\x4a\x6b\x7a\x78\xe2\x46\xab\xa4\xad\x21\x84\x8b\x61\x5f\xb8\x1a" "\xea\x61\xf7\x95\x6b\xaf\xbc\x33\xff\xf8\x89\x4b\xc7\x2f\xef\x7f\xf7\xf5" "\x23\xd7\xef\xdc\x1a\x00\x00\x00\x80\x8d\xef\x7f\x01\x00\x00\xff\xff\x0b" "\x96\x1e\x8f", 2703); syz_mount_image(/*fs=*/0x200000000000, /*dir=*/0x200000000040, /*flags=*/0, /*opts=*/0x200000001200, /*chdir=*/3, /*size=*/0xa8f, /*img=*/0x200000001400); // openat arguments: [ // fd: fd_dir (resource) // file: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 31 00} (length 0x8) // } // flags: open_flags = 0xc4042 (4 bytes) // mode: open_mode = 0x1ff (2 bytes) // ] // returns fd memcpy((void*)0x200000000300, "./file1\000", 8); res = syscall( __NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000300ul, /*flags=O_NOATIME|O_DIRECT|O_CREAT|O_CLOEXEC|0x2*/ 0xc4042, /*mode=S_IXOTH|S_IWOTH|S_IROTH|S_IXGRP|S_IWGRP|S_IRGRP|S_IXUSR|S_IWUSR|0x100*/ 0x1ff); if (res != -1) r[0] = res; // truncate arguments: [ // file: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 32 00} (length 0x8) // } // len: intptr = 0x2 (8 bytes) // ] memcpy((void*)0x200000000040, "./file2\000", 8); syscall(__NR_truncate, /*file=*/0x200000000040ul, /*len=*/2ul); // openat$nullb arguments: [ // fd: const = 0xffffffffffffff9c (8 bytes) // file: ptr[in, buffer] { // buffer: {2f 64 65 76 2f 6e 75 6c 6c 62 30 00} (length 0xc) // } // flags: open_flags = 0x6200 (4 bytes) // mode: const = 0x0 (2 bytes) // ] // returns fd_block memcpy((void*)0x200000000040, "/dev/nullb0\000", 12); res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x200000000040ul, /*flags=O_TRUNC|O_DIRECT|FASYNC*/ 0x6200, /*mode=*/0); if (res != -1) r[1] = res; // sendfile arguments: [ // fdout: fd (resource) // fdin: fd (resource) // off: nil // count: intptr = 0x20fffe82 (8 bytes) // ] syscall(__NR_sendfile, /*fdout=*/r[0], /*fdin=*/r[1], /*off=*/0ul, /*count=*/0x20fffe82ul); } 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; }