// https://syzkaller.appspot.com/bug?id=f71a46bd4d0e712cfa3969985a0a12fc43962397 // 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 #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 void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); syscall(SYS_futex, &ev->state, FUTEX_WAKE | FUTEX_PRIVATE_FLAG, 1000000); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, 0); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; for (;;) { uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, &ts); if (__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) return 1; now = current_time_ms(); if (now - start > timeout) return 0; } } 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"); } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } int i, call, thread; for (call = 0; call < 4; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); event_timedwait(&th->done, 50 + (call == 0 ? 4000 : 0)); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } 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_call(int call) { switch (call) { case 0: // syz_mount_image$hfsplus arguments: [ // fs: ptr[in, buffer] { // buffer: {68 66 73 70 6c 75 73 00} (length 0x8) // } // dir: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 30 00} (length 0x8) // } // flags: mount_flags = 0xa08802 (8 bytes) // opts: ptr[inout, array[ANYUNION]] { // array[ANYUNION] { // } // } // chdir: int8 = 0xff (1 bytes) // size: len = 0x6c8 (8 bytes) // img: ptr[in, buffer] { // buffer: (compressed buffer with length 0x6c8) // } // ] // returns fd_dir memcpy((void*)0x200000000000, "hfsplus\000", 8); memcpy((void*)0x200000000400, "./file0\000", 8); memcpy( (void*)0x2000000011c0, "\x78\x9c\xec\xdd\xdd\x6b\x5c\x69\x1d\x07\xf0\xef\x99\x4c\x26\x49\x85" "\x36\xeb\xb6\x75\x95\x05\xc3\x2e\xac\x62\xb1\x4d\x1a\xb3\x1a\x11\x1a" "\xbd\x90\x5e\x2c\xb2\x54\x70\x11\xbc\x09\x6d\xda\x86\x4e\xbb\x4b\x9a" "\x95\xec\x22\x1a\xdf\xbd\xd3\x8b\xfd\x03\xd6\x8b\x5c\x08\xde\x28\x08" "\x5e\x16\x56\xf0\x4a\xbd\x10\x16\xef\x82\x88\x14\x04\x2f\x5c\x6f\x72" "\x57\x99\x33\x67\x92\x49\x93\x99\xce\xa4\x6d\xd2\xba\x9f\x4f\x38\x73" "\x9e\x73\xce\xf3\xf2\x3b\xbf\x33\xe7\x9c\x79\x21\x4c\x80\x0f\xad\x8b" "\x67\x52\xbf\x93\x22\x17\xcf\xbc\xb2\xd6\x5a\xde\xdc\x98\x6d\x6e\x6e" "\xcc\x8e\x55\x9b\x9b\x49\x5a\xe5\x5a\x52\x6f\xcf\x52\xdc\x4a\x8a\xf7" "\x92\x85\xb4\xa7\x7c\xbc\xb5\xb2\xaa\x5f\xf4\x1a\xe7\x9d\xe5\xf9\x4b" "\xef\x7f\xb0\x79\xb7\xbd\x54\xaf\xa6\xb2\x7e\xad\x5f\xbb\xc1\xac\x57" "\x53\xa6\x92\x8c\x54\xf3\xbd\x46\x0f\xd4\xdf\xe5\x2a\xd6\x41\x7d\xa9" "\x9a\x2f\x6e\xaf\x29\xb6\xf7\xb0\x95\xb0\x17\x3b\x89\x83\xa3\x76\x6f" "\x8f\xf5\x61\x9a\x3f\xe4\x79\x0b\x3c\x09\x8a\xf6\x7d\x73\x8f\xc9\xe4" "\x58\x92\xf1\xea\x75\x40\xaa\xab\x43\xed\x70\xa3\x1b\xce\x68\x7a\xec" "\x4c\x97\xa1\xae\x72\x00\x00\x00\xf0\x94\x3a\xb1\x95\xad\xac\xe5\xf8" "\x51\xc7\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x4f\x93\x22\x13" "\x23\xe5\xac\x3d\xd5\x3a\xe5\xa9\x14\x9d\xdf\xff\x6f\x54\xeb\x52\x95" "\x2f\xd5\x8e\x38\xe6\x87\x71\xe7\xa8\x03\x00\x00\x00\x00\x00\x00\x00" "\x80\x47\xe0\x93\x5b\xd9\xca\x5a\x8e\x27\xf9\x6b\x51\x4f\xee\xb5\xbf" "\xd9\x7f\xa1\x7c\x3c\x59\x3e\x7e\x24\x6f\xe6\x76\x96\xb2\x92\xb3\x59" "\xcb\x62\x56\xb3\x9a\x95\xcc\x24\x99\xec\xea\xa8\xb1\xb6\xb8\xba\xba" "\x32\x33\x40\xcb\xf3\xfb\xb6\x3c\xdf\x2f\xca\x9f\xdf\xed\xb5\xe5\x37" "\x0f\xb1\xef\x00\x00\x00\x00\x00\x00\x00\xf0\x7f\xe4\x07\xb9\x58\x7e" "\xff\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x4f\x8c" "\x22\x19\x69\xcf\xca\xe9\x64\xa7\x3c\x99\x5a\x3d\xc9\x78\x92\x46\xab" "\xde\x7a\xf2\x97\x4e\x39\xc9\xe8\xd1\x46\x3d\x90\x62\xbf\x95\x77\x0e" "\x3f\x0e\x00\x00\x00\x78\x28\xe3\x07\x68\x73\x62\x2b\x5b\x59\xcb\xf1" "\xce\xf2\xbd\xa2\x7c\xcf\x7f\xba\x7c\xbf\x3c\x9e\x37\x73\x2b\xab\x59" "\xce\x6a\x9a\x59\xca\x95\xea\x3d\x74\xeb\x5d\x7f\x6d\x73\x63\xb6\xb9" "\xb9\x31\x7b\x73\x73\x63\xb6\x1c\xf8\x5b\xf7\xda\xda\xfd\x7c\xf9\xdf" "\x43\x85\x51\xf6\x98\xf6\x67\x0f\xfb\x8f\xfc\x5c\x59\x63\x22\x57\xb3" "\x5c\xae\x39\x9b\xcb\x65\x30\x57\x52\x2b\x5b\xb6\x3c\x57\xc5\xb3\x3d" "\xed\x1e\xe4\xfb\xad\x98\x26\x2e\x54\x06\x8c\xec\x4a\x35\x6f\x0d\xf6" "\x8b\x5e\x9f\x22\x3c\x0a\xb5\x61\x1b\x4c\x96\x8d\x46\xb7\x33\x32\x5d" "\xc5\xd6\xea\xe8\x99\xfe\x99\x78\xe0\xd1\xa9\xf7\x1d\x69\x26\xb5\xed" "\x4f\x7e\x4e\xf6\x19\xa9\xb3\x4b\xc5\x90\x39\x3f\xd6\x69\x97\xe4\x27" "\xf7\xe5\xfc\xc2\x3f\x7f\xf5\xcd\x01\xbb\x79\x0c\xb6\x33\x51\x4b\x99" "\x89\xf3\xa9\xe5\x3f\xd5\xb6\xd3\x9b\x1b\xb3\x23\xe9\x99\xf3\xe4\x53" "\xbf\xfb\xf5\x6b\xd7\x9b\xb7\x6e\x5c\xbf\x7a\xfb\xcc\x63\x7b\x1a\x1d" "\x96\xfb\x9f\x13\xb3\x5d\xe7\xe1\xc7\xfa\x3f\xfb\x9e\xe8\x4c\x0c\x14" "\xce\xef\x1b\x5d\x0b\xd3\x65\x26\x4e\x6d\x2f\x5f\xcc\x57\xf3\xf5\x9c" "\xc9\x54\x5e\xcd\x4a\x96\xf3\xed\x2c\x66\x35\x4b\xa9\xae\x8c\x59\x6c" "\x8d\x31\x56\x2d\x74\x65\x29\xd9\x93\xa9\x85\x5d\x4b\xaf\x3e\x28\xac" "\x46\x75\x5c\xda\x57\xd1\x41\x62\x9a\xca\x58\x59\x5a\xcc\x0b\x65\xdb" "\xe3\x59\x4e\x91\xd7\x73\x25\x4b\x79\xb9\xfc\x3b\x9f\x99\x7c\x3e\x73" "\x99\xcb\x7c\xd7\x11\x3e\xd5\xf3\x08\x97\xf9\x2b\xaf\xb4\xb5\xe1\xce" "\xfa\x17\x3f\x9d\x9d\xf4\xff\xb4\x75\xa5\x1e\xac\x5d\xf2\xc7\x41\x2b" "\x0e\xaf\x7d\x4b\x6d\xe5\xf5\x99\xae\xbc\x76\x5f\x73\x27\xcb\x6d\xdd" "\x6b\x76\xb2\xf4\xd1\x3c\xf8\x7e\x34\xe4\xb5\xb1\xfe\x89\xaa\xd0\x1a" "\xe3\x87\x07\xb9\x6d\x3c\x36\xf7\x67\x62\xa6\x2b\x13\xcf\xf6\xbf\x22" "\xfc\xb2\x3c\x37\x6e\x37\x6f\xdd\x58\xb9\xbe\xf8\x46\x8f\xfe\xd7\xef" "\x5b\x7e\xa9\xeb\x4b\x87\x1f\x3f\xce\x3b\xf3\xd0\x1a\xe5\xb1\x1f\xaf" "\xee\xa2\xbb\x9f\x1d\xad\x6d\xcf\x6e\xdf\x61\x77\xe7\xab\x51\x7d\xe3" "\xd2\xde\x56\xdb\xb3\xed\x54\xb9\xad\x28\x3a\x67\xea\xd7\xf6\x39\x53" "\x5b\x19\x9f\x2f\x6b\x9f\xde\xb7\xa7\xf3\x69\xec\x3a\xb3\xb6\xb7\x8d" "\x54\x91\xff\xed\xef\x5d\xed\x76\xbd\xde\xca\xeb\x7f\x3a\xec\x4c\x02" "\x70\x20\xc7\x3e\x73\xac\x31\xf1\xaf\x89\x3f\x4f\xbc\x3b\xf1\xa3\x89" "\xeb\x13\xaf\x8c\x7f\x65\xec\x0b\x63\xcf\x37\x32\xfa\x87\xd1\x2f\xd6" "\xa7\x47\x5e\xaa\x3d\x5f\xfc\x36\xef\xe6\xbb\x3b\xef\xff\x01\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x80\x83\xbb\xfd\xd6\xdb\x37\x16\x9b\xcd\xa5\x95\xfd\x0b" "\xb5\xde\x9b\x1e\x6d\xa1\xa8\x7e\xc8\xa7\x57\x9d\x7a\x26\x72\x08\x61" "\x1c\x66\xa1\x48\xd6\x9b\xf7\x46\x86\x6c\xd5\xe8\x7f\xe0\x72\x58\x7b" "\xd1\x89\xe3\x40\xcd\x3b\x8d\x07\x6d\x75\xe1\x1f\xed\xfa\xf7\x6f\x7a" "\x6d\x61\x4f\xe5\x9f\x7d\xae\x5f\x87\x73\xd7\x06\x1f\xf4\x43\x52\x18" "\x49\x52\xad\xf9\x5e\xb2\xf3\xfc\xa9\x0e\x51\xfb\x97\xd0\xbe\xf1\xdf" "\xc3\xbd\x2c\x01\x87\xe0\xdc\xea\xcd\x37\xce\xdd\x7e\xeb\xed\xcf\x2e" "\xdf\x5c\xbc\xb6\x74\x6d\xe9\xd6\xe8\xdc\xdc\xfc\xf4\xfc\xdc\xcb\xb3" "\xe7\xae\x2e\x37\x97\xa6\xdb\x8f\x47\x1d\x25\xf0\x38\xec\xbc\x1e\x38" "\xea\x48\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x41\x0d\xfe\xaf\x02" "\x63\x07\xfe\x4f\x83\xae\xe1\xa6\x8e\x70\x57\x01\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x80\xa7\xd4\xc5\x33\xa9\x8f\xa6\xc8\xcc\xf4\xd9\xe9\xd6\xf2\xe6\xc6" "\x6c\xb3\x35\x75\xca\x3b\x35\xeb\x49\x6a\xb5\xa4\xf8\x4e\x52\xbc\x97" "\x2c\xa4\x3d\xe5\x44\x57\x77\x45\xaf\x71\xde\x59\x9e\xbf\xf4\xfe\x07" "\x9b\x77\x77\xfa\xaa\x77\xea\xd7\xfa\xb5\x1b\xcc\x7a\x35\x65\x2a\xc9" "\x48\x35\xdf\xcf\xe4\x01\xfa\xbb\xdc\xa7\xbf\xc1\x14\xdb\x7b\xb8\x50" "\x6b\xaf\x59\x78\xa8\xfe\xe0\x11\xf9\x5f\x00\x00\x00\xff\xff\x8b\x53" "\xff\x57", 1736); syz_mount_image( /*fs=*/0x200000000000, /*dir=*/0x200000000400, /*flags=MS_I_VERSION|MS_SILENT|MS_RELATIME|MS_NOSUID|MS_NODIRATIME*/ 0xa08802, /*opts=*/0x200000000180, /*chdir=*/-1, /*size=*/0x6c8, /*img=*/0x2000000011c0); break; case 1: // setxattr$incfs_metadata arguments: [ // path: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 30 00} (length 0x8) // } // name: ptr[in, buffer] { // buffer: {75 73 65 72 2e 69 6e 63 66 73 2e 6d 65 74 61 64 61 74 61 // 00} (length 0x14) // } // val: nil // size: bytesize = 0x0 (8 bytes) // flags: setxattr_flags = 0x1 (8 bytes) // ] memcpy((void*)0x2000000000c0, "./file0\000", 8); memcpy((void*)0x200000000100, "user.incfs.metadata\000", 20); syscall(__NR_setxattr, /*path=*/0x2000000000c0ul, /*name=*/0x200000000100ul, /*val=*/0ul, /*size=*/0ul, /*flags=XATTR_CREATE*/ 1ul); break; case 2: // removexattr arguments: [ // path: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 30 00} (length 0x8) // } // name: ptr[in, xattr_name] { // union xattr_name { // known: buffer: {75 73 65 72 2e 69 6e 63 66 73 2e 6d 65 74 61 64 61 // 74 61 00} (length 0x14) // } // } // ] memcpy((void*)0x200000000140, "./file0\000", 8); memcpy((void*)0x200000000080, "user.incfs.metadata\000", 20); syscall(__NR_removexattr, /*path=*/0x200000000140ul, /*name=*/0x200000000080ul); break; case 3: // removexattr arguments: [ // path: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 30 00} (length 0x8) // } // name: ptr[in, xattr_name] { // union xattr_name { // known: buffer: {75 73 65 72 2e 69 6e 63 66 73 2e 6d 65 74 61 64 61 // 74 61 00} (length 0x14) // } // } // ] memcpy((void*)0x200000000140, "./file0\000", 8); memcpy((void*)0x200000000080, "user.incfs.metadata\000", 20); syscall(__NR_removexattr, /*path=*/0x200000000140ul, /*name=*/0x200000000080ul); break; } } 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; }