// https://syzkaller.appspot.com/bug?id=bf3ad150355f4910301875ebf126f262aef834fb // 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: {6d 6e 74 00} (length 0x4) // } // flags: mount_flags = 0x0 (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 69 // 73 6f 38 38 35 39 2d 31 35 2c 70 61 72 74 3d 30 78 30 30 30 30 30 // 30 30 00 00 00 00 00 00 00 00 66 2c 00 a2 00 00 00 07 00 00 00 00 // ed e9 de bf 53 0c 3c c4 d0 4b 54 89 19 ac a0 c2 93 7d 4d a1 fc 31 // dc 42 fc 2e 3e} (length 0x57) // } // union ANYUNION { // ANYBLOB: buffer: {23 34 11 29 bf b4 fc c3 88 a8 0c 49 b4 f4 d9 62 // 54 cb 93 56 75 97 76 b0 3b 58 10 50 24 0d 2d 9a 5c f3 44 0e 76 c8 // 86 f1 e5 c8 60 65 6a 36 48 10 12 23 fc 28 8f c5 27 4f 0e 60 9c fe // d0 fc 73 8d 84 eb 54 47 91 dd 1c b9 59 42 1d b9 fb cb 63 4d f8 76 // aa 21 33 fd 62 e2 45 fb 6b 1e ad 07 ca 04 77 2d 78 56 4a f8 f4 20 // 15 e5 be 55 7a b3 bd 60 82 47 68 69 10 05 cb d3 d2 95 40 26 93 d9 // 34 22 65 95 de eb a1 ff 74 8b 7d de 9c 61 77 49 aa 38 09 6e f6 67 // 70 0a 6b 36 68 cb 72 96 b0 24 fb cf 9f 74 e5 0b f0 f8 34 15 9f 51 // 73 7b aa c1 84 f9 4d d1 3a 97 93 b7 69 46 20 8f 29 06 37 d8 de f9 // 4e 5f 56 f1 18 1d a3 ee d5 00 44 0f} (length 0xcc) // } // union ANYUNION { // ANYRES32: ANYRES32 (resource) // } // union ANYUNION { // ANYBLOB: buffer: {45 00 a9 c2 fb b2 3c 14 93 5e 1d cc 6d 11 c2 4c // a3 ff 81 cc c7 d4 56 f8 65 b1 5c 0d b9 a1 85 67 9f 26 6e 7b 27 61 // a1 e9 ff 25 cf d2 f5 bd 23 52 8b 43 27 ab 23 fd 41 e3 c1 e4 96 e2 // cf 4c b0 d2 36 34 cb 20 4c 27 f5 bb b3 75 10 31 04 b0 1d ca 3f 21 // 2f a6 ac 51 c2 88 7d a2 47 61 46 9a c2 a3 3f be e7 2d 22 37 65 74 // b7 81 53 7d 01 05 8b e2 1d 7c 92 c4 94 84 ac 09 fd a3 57 17 1e fa // 3a 61 c7 f9 fa 31 1e ac 1e 39 3b 07 a4 d9 22 04 54 ee ba c1 4a e3 // a3 19 d0 06 75 51 33 5d b1 44 33 26 26 03 2a 9d 9f 11 d4 55 bc 5f // 40 8b 6f a6 4f 16 f9 24 42 74 ab fb 3c 4e 4b 0f 9d d1 f0 39 ab 08 // 56 84 a7 11 65 91 7b 54 be 56 f9 73 48 df f0 62 20 d2 e6 2c 4d 91 // 58 41 c0 cc da 63 c1 04 8e 10 fb 6c 6c bd f9 96 72 bb 90 bf 3d 1c // 5e 33 3e 43 bb da} (length 0xf2) // } // union ANYUNION { // ANYRES16: ANYRES16 (resource) // } // } // } // chdir: int8 = 0x11 (1 bytes) // size: len = 0x2dd (8 bytes) // img: ptr[in, buffer] { // buffer: (compressed buffer with length 0x2dd) // } // ] // returns fd_dir memcpy((void*)0x200000000180, "hfs\000", 4); memcpy((void*)0x200000000100, "mnt\000", 4); memcpy( (void*)0x200000001e40, "\x71\x75\x69\x65\x74\x2c\x63\x6f\x64\x65\x70\x61\x67\x65\x3d\x69\x73\x6f" "\x38\x38\x35\x39\x2d\x31\x35\x2c\x70\x61\x72\x74\x3d\x30\x78\x30\x30\x30" "\x30\x30\x30\x30\x00\x00\x00\x00\x00\x00\x00\x00\x66\x2c\x00\xa2\x00\x00" "\x00\x07\x00\x00\x00\x00\xed\xe9\xde\xbf\x53\x0c\x3c\xc4\xd0\x4b\x54\x89" "\x19\xac\xa0\xc2\x93\x7d\x4d\xa1\xfc\x31\xdc\x42\xfc\x2e\x3e", 87); memcpy((void*)0x200000001e97, "\x23\x34\x11\x29\xbf\xb4\xfc\xc3\x88\xa8\x0c\x49\xb4\xf4\xd9\x62\x54" "\xcb\x93\x56\x75\x97\x76\xb0\x3b\x58\x10\x50\x24\x0d\x2d\x9a\x5c\xf3" "\x44\x0e\x76\xc8\x86\xf1\xe5\xc8\x60\x65\x6a\x36\x48\x10\x12\x23\xfc" "\x28\x8f\xc5\x27\x4f\x0e\x60\x9c\xfe\xd0\xfc\x73\x8d\x84\xeb\x54\x47" "\x91\xdd\x1c\xb9\x59\x42\x1d\xb9\xfb\xcb\x63\x4d\xf8\x76\xaa\x21\x33" "\xfd\x62\xe2\x45\xfb\x6b\x1e\xad\x07\xca\x04\x77\x2d\x78\x56\x4a\xf8" "\xf4\x20\x15\xe5\xbe\x55\x7a\xb3\xbd\x60\x82\x47\x68\x69\x10\x05\xcb" "\xd3\xd2\x95\x40\x26\x93\xd9\x34\x22\x65\x95\xde\xeb\xa1\xff\x74\x8b" "\x7d\xde\x9c\x61\x77\x49\xaa\x38\x09\x6e\xf6\x67\x70\x0a\x6b\x36\x68" "\xcb\x72\x96\xb0\x24\xfb\xcf\x9f\x74\xe5\x0b\xf0\xf8\x34\x15\x9f\x51" "\x73\x7b\xaa\xc1\x84\xf9\x4d\xd1\x3a\x97\x93\xb7\x69\x46\x20\x8f\x29" "\x06\x37\xd8\xde\xf9\x4e\x5f\x56\xf1\x18\x1d\xa3\xee\xd5\x00\x44\x0f", 204); *(uint32_t*)0x200000001f63 = 0; memcpy( (void*)0x200000001f67, "\x45\x00\xa9\xc2\xfb\xb2\x3c\x14\x93\x5e\x1d\xcc\x6d\x11\xc2\x4c\xa3\xff" "\x81\xcc\xc7\xd4\x56\xf8\x65\xb1\x5c\x0d\xb9\xa1\x85\x67\x9f\x26\x6e\x7b" "\x27\x61\xa1\xe9\xff\x25\xcf\xd2\xf5\xbd\x23\x52\x8b\x43\x27\xab\x23\xfd" "\x41\xe3\xc1\xe4\x96\xe2\xcf\x4c\xb0\xd2\x36\x34\xcb\x20\x4c\x27\xf5\xbb" "\xb3\x75\x10\x31\x04\xb0\x1d\xca\x3f\x21\x2f\xa6\xac\x51\xc2\x88\x7d\xa2" "\x47\x61\x46\x9a\xc2\xa3\x3f\xbe\xe7\x2d\x22\x37\x65\x74\xb7\x81\x53\x7d" "\x01\x05\x8b\xe2\x1d\x7c\x92\xc4\x94\x84\xac\x09\xfd\xa3\x57\x17\x1e\xfa" "\x3a\x61\xc7\xf9\xfa\x31\x1e\xac\x1e\x39\x3b\x07\xa4\xd9\x22\x04\x54\xee" "\xba\xc1\x4a\xe3\xa3\x19\xd0\x06\x75\x51\x33\x5d\xb1\x44\x33\x26\x26\x03" "\x2a\x9d\x9f\x11\xd4\x55\xbc\x5f\x40\x8b\x6f\xa6\x4f\x16\xf9\x24\x42\x74" "\xab\xfb\x3c\x4e\x4b\x0f\x9d\xd1\xf0\x39\xab\x08\x56\x84\xa7\x11\x65\x91" "\x7b\x54\xbe\x56\xf9\x73\x48\xdf\xf0\x62\x20\xd2\xe6\x2c\x4d\x91\x58\x41" "\xc0\xcc\xda\x63\xc1\x04\x8e\x10\xfb\x6c\x6c\xbd\xf9\x96\x72\xbb\x90\xbf" "\x3d\x1c\x5e\x33\x3e\x43\xbb\xda", 242); *(uint16_t*)0x200000002059 = -1; memcpy( (void*)0x200000001b40, "\x78\x9c\xec\xdd\xcb\x6a\x14\x4b\x1c\xc7\xf1\x5f\xf5\x4c\x92\xc9\xc9\x90" "\xd3\xb9\x1c\x0e\x9c\x65\x8e\x01\xdd\x48\x8c\x1b\x71\x33\x41\xe6\x21\xc4" "\x85\xa8\x99\x11\x82\x43\x44\x13\x41\xdd\x18\xc5\x85\x88\xe8\xde\xbd\xaf" "\xe0\x2b\x08\x6e\x14\x5f\x40\x57\xae\x7c\x80\x11\x84\x96\xaa\xae\xb9\xa6" "\xa7\x3b\x19\x32\xdd\x19\xfc\x7e\xc0\xd0\xd3\x5d\xd5\xf5\xaf\xf4\xa5\xea" "\x3f\x60\x4a\x00\xfe\x58\x57\xea\x5f\xdf\x5d\xfc\x6e\xff\x19\xa9\xa4\x92" "\xf4\xf2\xb2\x14\x48\x7a\x21\x95\x25\xfd\xa3\x7f\x2b\x0f\x76\xf7\x77\xf6" "\x5b\xcd\x46\xca\x79\xda\x91\xa3\x8a\x64\x14\xd7\x34\x87\x0a\x6d\xef\x36" "\x93\xea\x56\xe4\x6b\x78\xa1\xfd\x54\x56\xb5\x7f\x1f\x26\x23\x8a\xa2\xad" "\x6f\x92\xf6\x8a\x0e\x04\x85\x72\x4f\x7f\x82\x40\x9a\xf3\x4f\xa7\x3b\x5e" "\xc9\x3d\xb2\x74\x4f\xc7\xac\x77\x70\xc2\x71\x4c\x1b\xd3\x56\x5b\x0f\xb5" "\x58\x74\x1c\x00\x80\x62\xf9\xf1\x3f\xf0\xe3\x7c\xd5\xcf\xdf\x83\x40\x5a" "\xf7\xc3\xfe\xa9\x1c\xff\xc7\xd5\x2e\x3a\x80\x89\x8b\x52\x8f\xf6\x8d\xff" "\x2e\xcb\x8a\x8c\xbd\xbe\x7f\xbb\x43\xbd\x7c\xcf\xa5\x70\xf6\x78\xd0\xc9" "\x12\x8f\xd2\xf2\xcc\xd0\xe7\x59\xc5\x77\xd6\xc0\x04\xd3\x64\x65\x95\x2e" "\x96\x60\xfe\xf6\x4e\xab\x79\x7e\xfb\x6e\xab\x11\xe8\x99\x6a\x5e\x5f\xb1" "\x55\xf7\xb3\x11\xdf\xba\x1d\x19\xd1\xae\x25\xe4\xa6\x29\x8e\xd0\x77\x93" "\x3c\xa3\x5c\x70\x7d\x98\xb1\x7d\xd8\x1c\x11\xff\xca\x98\x2d\x8e\xcd\x7c" "\x34\x9f\xcd\x75\x13\xea\xad\x1a\xdd\xf9\x5f\x39\x32\xf6\x32\xb9\x2b\x15" "\x0e\x5d\xa9\x38\xfe\x8d\xd1\x67\x74\xbd\x0c\x6d\x29\xf9\xd7\x46\xad\x56" "\x0b\x06\x8a\x2c\xb9\x46\xfe\xf3\x2d\x78\x19\xbd\xac\x24\x67\x24\xea\xdc" "\x51\x4b\x1a\xfc\x82\x20\xcc\x8a\xd3\xd5\x5a\x1e\xaa\x15\xf7\xee\x42\x46" "\xad\x95\xb8\xd6\xd6\xfc\x40\xad\xcd\xce\xa7\x11\xb5\x56\x07\xda\xb2\xbd" "\xe9\xde\xcd\xa3\xdb\x9b\x34\xf3\xda\x5c\x35\x6b\xfa\xa1\xf7\xaa\xf7\xcd" "\xff\x03\x1b\xdf\xba\x52\x9f\xcc\xde\x53\x63\xd6\xe3\xa1\xc0\xfd\xc6\xe3" "\xfe\xcc\x26\x37\x57\x76\xe7\x0c\x0f\x8d\x1c\x07\xba\x56\x1d\xdc\xd3\xfd" "\x2d\xce\x8d\x0a\xfd\x67\xfa\x3b\x0d\x43\x9e\xa4\x1c\x7b\xa5\x5b\xba\xa4" "\xc5\xbd\x47\x8f\xef\x94\x5a\xad\xe6\x7d\xbb\x71\x33\x61\xe3\x5e\xb5\xbb" "\x67\xe6\xb9\x94\x58\xa6\x80\x8d\x40\xbd\x3d\x3a\xe8\x1d\x9a\x53\xfc\x45" "\xe4\xa1\x5a\x9d\x41\x29\xcf\x50\xcf\x9d\xe8\x09\xed\xfb\x23\xb3\xb0\x7d" "\xca\x72\xe9\xe0\xa9\xb9\x13\x8a\xd8\xa8\x7f\x3a\xee\x8d\x34\x7b\xac\x26" "\xec\x1b\xb0\xe8\x9e\xe6\xf4\x8e\x42\xa1\x7a\x17\x3d\xb3\xe8\x87\x5c\x02" "\x42\xde\xdc\xbc\x2b\xce\xff\xfa\xf2\x95\x0d\x37\xd9\xb3\x3f\xc2\x94\x79" "\x7a\xe6\x84\xcc\x9f\x31\xb2\x73\xec\x6e\x06\x54\x19\xa8\xbf\xec\xb6\xfe" "\x3a\x56\x06\xb7\x30\x3a\x83\x3b\x6a\xce\xf5\xff\x59\xe9\x4c\x77\xd7\xaf" "\x28\xa3\xc5\xd0\xc7\x39\x1d\xa2\xb4\xa9\x9f\x65\xea\xfa\xa2\x1b\x7c\xff" "\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x30\x6d\xf2" "\xf8\xef\x04\x45\xf7\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x80\x69\xd7\x5d\xff\x57\x9d\xf5\x7f\xe5\xd7\xff\xad\xa4" "\xaf\xff\x3b\xfc\x97\xbf\x4b\xf1\x0a\x2f\x27\xb2\xfe\xef\x9b\x5d\xb1\xfe" "\x2f\x30\x79\xbf\x03\x00\x00\xff\xff\x0c\xf0\x88\x97", 733); syz_mount_image(/*fs=*/0x200000000180, /*dir=*/0x200000000100, /*flags=*/0, /*opts=*/0x200000001e40, /*chdir=*/0x11, /*size=*/0x2dd, /*img=*/0x200000001b40); // openat arguments: [ // fd: fd_dir (resource) // file: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 31 00} (length 0x8) // } // flags: open_flags = 0x101042 (4 bytes) // mode: open_mode = 0x155 (2 bytes) // ] // returns fd memcpy((void*)0x200000000280, "./file1\000", 8); syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000280ul, /*flags=O_SYNC|O_CREAT|O_RDWR*/ 0x101042, /*mode=S_IXOTH|S_IROTH|S_IWGRP|S_IXUSR|S_IRUSR*/ 0x155); // 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); } 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; }