// https://syzkaller.appspot.com/bug?id=f32b917d64bf4d45721b424a08e7eea72cbbe34f // 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 #ifndef __NR_statx #define __NR_statx 332 #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; } static long syz_open_procfs(volatile long a0, volatile long a1) { char buf[128]; memset(buf, 0, sizeof(buf)); if (a0 == 0) { snprintf(buf, sizeof(buf), "/proc/self/%s", (char*)a1); } else if (a0 == -1) { snprintf(buf, sizeof(buf), "/proc/thread-self/%s", (char*)a1); } else { snprintf(buf, sizeof(buf), "/proc/self/task/%d/%s", (int)a0, (char*)a1); } int fd = open(buf, O_RDWR); if (fd == -1) fd = open(buf, O_RDONLY); return fd; } //% 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, unsigned long extra_space, 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; } if (extra_space) { off_t cur = lseek(memfd, 0, SEEK_END); if (cur >= 0 && ftruncate(memfd, cur + extra_space)) { } } 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_RDONLY); 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); unsigned long extra_space = strncmp(fs, "ext", 3) == 0 ? (16 << 20) : 0; if (setup_loop_device(data, size, extra_space, 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) { if (chdir(target) == -1) { err = errno; close(res); res = -1; } } 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_RDONLY); 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[1] = {0xffffffffffffffff}; void execute_one(void) { intptr_t res = 0; if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } // syz_mount_image$squashfs arguments: [ // fs: ptr[in, buffer] { // buffer: {73 71 75 61 73 68 66 73 00} (length 0x9) // } // dir: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 31 00} (length 0x8) // } // flags: mount_flags = 0x2000000 (8 bytes) // opts: ptr[inout, array[ANYUNION]] { // array[ANYUNION] { // union ANYUNION { // ANYRES64: ANYRES64 (resource) // } // union ANYUNION { // ANYRES16: ANYRES16 (resource) // } // union ANYUNION { // ANYBLOB: buffer: {94 89 36 ee d3 28 31 d0 6f d0 34 e3 19 9e a2 b2 // 6b f1 c7 cd 04 b1 62 d8 87 13 d4 d0 84 b0 16 0a 42 98 3e dd f8 57 // 09 9d 0e 42 ab 60 a1 24 76 dc b8 7d d8 59 8b 61 57 d6 cd 80 36 35 // 7f 4e e8 3d 25 e8 14 a8 87 1d 7c bf 63 03 9c 61 da 92 75 0b 32 6b // 19 c8 70 a0 9e bf 1f 75 12 7c b8 31 1a 8f e5 05 26 4a be 55 ec 81 // 68 a2 c3 c9 fc 5f 07 d1 58 0d 6f ce 8a 18 e3 08 ba 6e 64 aa 7e aa // fc f1 a5 e2 1c c8 ce 87 d8 f2 14 d7 a8 40 86 0c 0a 9e b2 30 80 1a // 45 9d 40 dd 3a c6 4a d5 28 ce 82 76 ec 54 4d 2a 5a ee 66 53 71 49 // 91 be 8d 17 18 c5 78 1c d0 96 af 85 9a 03 f0 5e f7 c2 dd 35 68 68 // 87 d9 c1 19 93 64 f5 1f 14 c8 15 ce 6c e2 95 0c fa 68 24 f5 f4 cb // 4a 27 ec 25 2c f9 fa 54 9c ff 35 1f c9 bf 07 01 48 8d e3 a1 ab 1c // 60 9e 75 01 a1 72 ab eb ac b7 ec 0b e1 c9 1e 62 d0 ae 6c 93 13 07 // 9b 8a 7c be 14 ec 6b 2b 19 6a 1e d7 0b 02 8d be 7d ae 48 44 6a 06 // d2 aa da 1a 7b 96 32 40 c1 a5 ae e0 b6 c9 00 48 7c 4d e7 38 ba 42 // bd 7b c7 6c 9f af 42 92 f6 ae 26 91 2b a7 b4 78 e0 21 6e 87 1a 3d // f9 b7 1a 57 95 96 31 3a f7 a1 40 c4 75 e0 c9 dd 62 be 4d 1e 83 05 // f3 fe 09 4d 24 1e 98 e9 5d 48 7d 8b ca 85 e1 92 af 9a 7e 6d 3d 2a // b9 22 10 98 78 3d 2b ca e4 32 38 e6 3e 42 6b 15 e0 a4 e8 31 b2 a6 // 1e 10 87 8b 9c c2 02 9f cd 44 1c ad f4 1a 57 03 7b c1 ae 94 45 85 // 03 4d 6a 19 3d d4 ce e6 ab 41 b1 a7 ec fd bb 1a e6 26 d6 a1 58 dd // c8 dd 6f 27 48 89 05 95 2f 2e 46 8a ed 79 43 1e 6d 18 1f 7a 73 35 // 62 9b e7 f0 b2 68 08 d6 0e 1f 24 16 60 09 25 77 ae 1c ca 8c 72 d1 // 55 b8 57 0d d3 c7 f4 d9 73 56 85 9b 7c f7 d1 0c ca ec 02 a6 0f 57 // 16 4a a8 17 d9 0a d0 71 e4 fa 2e b6 7e db a2 cd d2 76 e2 b6 17 12 // ff 41 de e1 1b 2b f4 51 91 3f c1 18 ce 70 d0 19 de de fc 54 25} // (length 0x21f) // } // union ANYUNION { // ANYRESOCT: ANYRES64 (resource) // } // union ANYUNION { // ANYRES8: ANYRES8 (resource) // } // union ANYUNION { // ANYRESOCT: ANYRES64 (resource) // } // } // } // chdir: int8 = 0x1 (1 bytes) // size: len = 0x184 (8 bytes) // img: ptr[in, buffer] { // buffer: (compressed buffer with length 0x184) // } // ] // returns fd_dir memcpy((void*)0x200000000040, "squashfs\000", 9); memcpy((void*)0x200000000180, "./file1\000", 8); *(uint64_t*)0x20000001fc80 = 0; *(uint16_t*)0x20000001fc88 = 0; memcpy( (void*)0x20000001fc8a, "\x94\x89\x36\xee\xd3\x28\x31\xd0\x6f\xd0\x34\xe3\x19\x9e\xa2\xb2\x6b\xf1" "\xc7\xcd\x04\xb1\x62\xd8\x87\x13\xd4\xd0\x84\xb0\x16\x0a\x42\x98\x3e\xdd" "\xf8\x57\x09\x9d\x0e\x42\xab\x60\xa1\x24\x76\xdc\xb8\x7d\xd8\x59\x8b\x61" "\x57\xd6\xcd\x80\x36\x35\x7f\x4e\xe8\x3d\x25\xe8\x14\xa8\x87\x1d\x7c\xbf" "\x63\x03\x9c\x61\xda\x92\x75\x0b\x32\x6b\x19\xc8\x70\xa0\x9e\xbf\x1f\x75" "\x12\x7c\xb8\x31\x1a\x8f\xe5\x05\x26\x4a\xbe\x55\xec\x81\x68\xa2\xc3\xc9" "\xfc\x5f\x07\xd1\x58\x0d\x6f\xce\x8a\x18\xe3\x08\xba\x6e\x64\xaa\x7e\xaa" "\xfc\xf1\xa5\xe2\x1c\xc8\xce\x87\xd8\xf2\x14\xd7\xa8\x40\x86\x0c\x0a\x9e" "\xb2\x30\x80\x1a\x45\x9d\x40\xdd\x3a\xc6\x4a\xd5\x28\xce\x82\x76\xec\x54" "\x4d\x2a\x5a\xee\x66\x53\x71\x49\x91\xbe\x8d\x17\x18\xc5\x78\x1c\xd0\x96" "\xaf\x85\x9a\x03\xf0\x5e\xf7\xc2\xdd\x35\x68\x68\x87\xd9\xc1\x19\x93\x64" "\xf5\x1f\x14\xc8\x15\xce\x6c\xe2\x95\x0c\xfa\x68\x24\xf5\xf4\xcb\x4a\x27" "\xec\x25\x2c\xf9\xfa\x54\x9c\xff\x35\x1f\xc9\xbf\x07\x01\x48\x8d\xe3\xa1" "\xab\x1c\x60\x9e\x75\x01\xa1\x72\xab\xeb\xac\xb7\xec\x0b\xe1\xc9\x1e\x62" "\xd0\xae\x6c\x93\x13\x07\x9b\x8a\x7c\xbe\x14\xec\x6b\x2b\x19\x6a\x1e\xd7" "\x0b\x02\x8d\xbe\x7d\xae\x48\x44\x6a\x06\xd2\xaa\xda\x1a\x7b\x96\x32\x40" "\xc1\xa5\xae\xe0\xb6\xc9\x00\x48\x7c\x4d\xe7\x38\xba\x42\xbd\x7b\xc7\x6c" "\x9f\xaf\x42\x92\xf6\xae\x26\x91\x2b\xa7\xb4\x78\xe0\x21\x6e\x87\x1a\x3d" "\xf9\xb7\x1a\x57\x95\x96\x31\x3a\xf7\xa1\x40\xc4\x75\xe0\xc9\xdd\x62\xbe" "\x4d\x1e\x83\x05\xf3\xfe\x09\x4d\x24\x1e\x98\xe9\x5d\x48\x7d\x8b\xca\x85" "\xe1\x92\xaf\x9a\x7e\x6d\x3d\x2a\xb9\x22\x10\x98\x78\x3d\x2b\xca\xe4\x32" "\x38\xe6\x3e\x42\x6b\x15\xe0\xa4\xe8\x31\xb2\xa6\x1e\x10\x87\x8b\x9c\xc2" "\x02\x9f\xcd\x44\x1c\xad\xf4\x1a\x57\x03\x7b\xc1\xae\x94\x45\x85\x03\x4d" "\x6a\x19\x3d\xd4\xce\xe6\xab\x41\xb1\xa7\xec\xfd\xbb\x1a\xe6\x26\xd6\xa1" "\x58\xdd\xc8\xdd\x6f\x27\x48\x89\x05\x95\x2f\x2e\x46\x8a\xed\x79\x43\x1e" "\x6d\x18\x1f\x7a\x73\x35\x62\x9b\xe7\xf0\xb2\x68\x08\xd6\x0e\x1f\x24\x16" "\x60\x09\x25\x77\xae\x1c\xca\x8c\x72\xd1\x55\xb8\x57\x0d\xd3\xc7\xf4\xd9" "\x73\x56\x85\x9b\x7c\xf7\xd1\x0c\xca\xec\x02\xa6\x0f\x57\x16\x4a\xa8\x17" "\xd9\x0a\xd0\x71\xe4\xfa\x2e\xb6\x7e\xdb\xa2\xcd\xd2\x76\xe2\xb6\x17\x12" "\xff\x41\xde\xe1\x1b\x2b\xf4\x51\x91\x3f\xc1\x18\xce\x70\xd0\x19\xde\xde" "\xfc\x54\x25", 543); sprintf((char*)0x20000001fea9, "%023llo", (long long)-1); *(uint8_t*)0x20000001fec0 = -1; sprintf((char*)0x20000001fec1, "%023llo", (long long)-1); memcpy( (void*)0x20000001ff00, "\x78\x9c\xec\x90\xbf\x4e\x2a\x41\x14\xc6\xbf\xd9\x5d\xf6\xc2\x2d\x6e\x2e" "\xc9\xad\x68\x20\xb9\x46\xb1\x50\x96\x45\x8d\xb1\xd1\x12\x7b\x1f\x40\x02" "\x2b\x12\x17\xff\xb0\x24\x02\xa1\x58\x62\x0c\x85\x85\xb1\xf4\x09\x78\x0d" "\x13\x5f\x40\x0b\x43\xac\xe9\x4c\x28\xa8\xac\x0c\x66\x76\xce\x0e\xc3\x33" "\x38\xbf\x62\xbf\x9d\x73\xbe\x73\xe6\x9c\x39\x0d\xae\x82\x5f\x00\xbe\x66" "\xfd\x2a\x0e\x10\x61\xe2\x0f\x5e\x19\x83\x05\x20\xcb\x44\x6c\x6a\x08\x7d" "\x20\x7d\x23\xbd\x17\x82\x17\xf2\x1d\x52\xfc\x86\x34\x13\x74\x7b\x67\x15" "\xdf\xf7\x5a\xb9\xbd\x1c\xd2\x8b\xc0\x9c\x7d\xce\x05\x80\xf4\x04\xfb\x03" "\x03\xd3\xa8\xd5\x78\xd6\xaf\xf2\x9f\x63\x00\xdc\x65\x03\xa8\x01\x1f\x69" "\x00\xaa\xc7\x7c\xb7\xa2\x8b\x44\x27\x20\x63\x01\xff\xa2\x25\xe6\xd2\xc3" "\x1d\xfc\xb0\x06\xa0\xd0\x6e\x5e\x16\x82\x6e\x6f\xa3\xd1\xac\xd4\xbd\xba" "\x77\xee\xba\xa5\x1d\x67\xcb\x71\xb6\xdd\xc2\x49\xc3\xf7\x1c\xf1\xb5\x69" "\x2f\x5e\x4e\xab\x80\xeb\x3a\x00\xfe\x5e\x29\x65\x84\x04\x80\x5b\xf2\xfc" "\xa6\x7c\x0c\x53\x46\xa3\x3c\x53\x6b\x6d\xe5\x0d\xf3\xff\xb1\x84\x81\x94" "\xfc\x8f\x7b\x30\x3c\xc9\xda\xf8\x1e\x13\xc0\x11\x56\x91\x04\x70\x1d\xb2" "\x45\x74\x2c\xba\x58\x88\x56\x2a\x83\xc1\xa4\x43\xd1\x52\xe6\x13\xae\x64" "\x94\xd8\xac\x5e\xf8\xb5\x21\x18\x58\x5c\x36\x82\x25\x7b\x14\x27\x18\x50" "\x81\xef\xb9\x13\x24\x64\xa6\xb4\x1b\xc6\xa3\x0e\x49\x57\x48\xcb\xa4\x23" "\xe5\x19\x39\x59\x7b\x39\x60\x45\x1d\xee\xe8\x94\x0f\xe3\x11\x5b\x45\x6e" "\xec\x24\xe3\xfe\x9d\x4a\xbb\xdd\x72\x6d\xf9\xf7\x37\x84\xd2\x88\xdf\xfa" "\x68\x2c\x2f\xf7\x6c\x40\xa3\xd1\x68\x34\x1a\x8d\x46\xa3\xd1\x68\x7e\x3a" "\xdf\x01\x00\x00\xff\xff\x32\xed\x79\x8f", 388); syz_mount_image(/*fs=*/0x200000000040, /*dir=*/0x200000000180, /*flags=MS_LAZYTIME*/ 0x2000000, /*opts=*/0x20000001fc80, /*chdir=*/1, /*size=*/0x184, /*img=*/0x20000001ff00); // mmap$IORING_OFF_SQ_RING arguments: [ // addr: const = 0x0 (8 bytes) // len: int32 = 0x8 (4 bytes) // prot: mmap_prot = 0x2000007 (8 bytes) // flags: mmap_flags = 0x401d031 (8 bytes) // fd: fd_io_uring (resource) // offset: const = 0x0 (8 bytes) // ] // returns ring_ptr syscall( __NR_mmap, /*addr=*/0ul, /*len=*/8, /*prot=PROT_GROWSUP|PROT_WRITE|PROT_READ|PROT_EXEC*/ 0x2000007ul, /*flags=MAP_UNINITIALIZED|MAP_POPULATE|MAP_NORESERVE|MAP_NONBLOCK|MAP_FIXED|0x1021*/ 0x401d031ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); // syz_open_procfs arguments: [ // pid: pid (resource) // file: ptr[in, buffer] { // buffer: {66 64 00} (length 0x3) // } // ] // returns fd memcpy((void*)0x2000000001c0, "fd\000", 3); res = -1; res = syz_open_procfs(/*pid=*/-1, /*file=*/0x2000000001c0); if (res != -1) r[0] = res; // statx arguments: [ // fd: fd_dir (resource) // file: nil // flags: statx_flags = 0x1000 (8 bytes) // mask: statx_mask = 0x10 (8 bytes) // statxbuf: nil // ] syscall(__NR_statx, /*fd=*/r[0], /*file=*/0ul, /*flags=AT_EMPTY_PATH*/ 0x1000ul, /*mask=STATX_GID*/ 0x10ul, /*statxbuf=*/0ul); // symlink arguments: [ // old: nil // new: nil // ] syscall(__NR_symlink, /*old=*/0ul, /*new=*/0ul); } int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0x1000000, /*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=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); const char* reason; (void)reason; loop(); return 0; }