// https://syzkaller.appspot.com/bug?id=3289920f8921e992e55d46658c549b9874e02538 // 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; } } } uint64_t r[1] = {0xffffffffffffffff}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: // 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 = 0x3200c02 (8 bytes) // opts: ptr[inout, array[ANYUNION]] { // array[ANYUNION] { // union ANYUNION { // ANYRES8: ANYRES8 (resource) // } // } // } // chdir: int8 = 0x3 (1 bytes) // size: len = 0xa80 (8 bytes) // img: ptr[in, buffer] { // buffer: (compressed buffer with length 0xa80) // } // ] // returns fd_dir memcpy((void*)0x200000000000, "nilfs2\000", 7); memcpy((void*)0x200000000040, "./file2\000", 8); *(uint8_t*)0x200000000140 = 0; memcpy( (void*)0x200000000180, "\x78\x9c\xec\xdd\x4d\x8c\x5b\x47\x01\x00\xe0\xb1\x77\xbd\xc9\x36\x29" "\x71\x4a\x42\x97\x24\xb4\x09\x3f\x6d\xf9\xe9\x6e\xb3\x59\xc2\x4f\x04" "\x4d\xd5\x5c\x88\x9a\x8a\x5b\xa5\x8a\x4b\x94\xa6\x25\x22\x0d\x88\x54" "\x82\x56\x95\x9a\xe4\xc4\x09\x5a\x55\xe1\x0a\x45\x9c\xca\xa1\x02\x84" "\xd4\x5e\x50\xd4\x13\x97\x4a\x34\x12\x97\x8a\x43\xe1\xc0\x81\x28\x48" "\x95\x38\x40\x21\x31\x5a\xef\x8c\xf7\x79\xd6\xe6\xd9\xfb\x67\x7b\xfd" "\x7d\xd2\xec\x78\xde\x3c\x7b\xe6\xbd\x7d\x7e\x7e\x7f\x33\x13\x80\xb1" "\x55\x6d\xfe\x5d\x58\x98\xa9\x84\x70\xf5\xad\x57\x4f\xfc\xfd\xbe\xbf" "\x4d\x2f\x4e\x79\xb8\x35\x47\xbd\xf9\x77\xb2\x90\xaa\x85\x10\x2a\x31" "\x3d\x99\x7d\xde\xfb\x13\x4b\xf1\xad\x0f\x5e\x3c\xd3\x29\xae\x84\xf9" "\xe6\xdf\x94\x0e\x8f\xdf\x6c\xbd\x77\x47\x08\xe1\x52\x38\x18\xae\x85" "\x7a\xd8\x77\xf5\xfa\x2b\xef\xcc\x3f\x76\xea\xf2\xc9\x2b\x87\xde\x7d" "\xfd\xd8\x8d\x8d\x59\x7a\x00\x00\x18\x2f\xdf\xbc\x76\x6c\x61\xef\x5f" "\xfe\xb8\x7f\xf7\x87\x6f\xdc\x73\x3c\x6c\x6b\x4d\x4f\xc7\xe7\xf5\x98" "\xde\x19\x8f\xfb\x8f\xc7\x03\xff\x74\xfc\x5f\x0d\xed\xe9\x4a\x21\x14" "\x4d\x65\xf3\x4d\xc6\x50\xcd\xe6\x9b\xe8\x30\x5f\xb1\x9c\x5a\x36\xdf" "\x64\x97\xf2\xa7\xb2\xcf\xad\xb5\xf2\xf7\xb7\xcd\xb7\xad\xa4\xfc\x89" "\xc2\xb4\x4e\xcb\x0d\xa3\x2c\x6d\xc7\xf5\x50\xa9\xce\xb6\xa5\xab\xd5" "\xd9\xd9\xa5\x73\xf2\xd0\x3c\xaf\x9f\xaa\xcc\x5e\x38\x77\xfe\xe9\x8b" "\x03\xaa\x28\xb0\xee\xfe\x79\x6f\x08\xe1\xa0\xd0\x6f\x68\x34\x1a\x2f" "\x35\x57\xe0\x10\xd4\x45\x10\x56\x1b\x1a\xbb\x06\xbd\x07\x02\x58\x92" "\xdf\x2f\x5c\xe1\x52\x7e\x65\x61\x6d\x5a\x9f\x36\xd9\x5b\xf9\x37\x1f" "\xa9\x76\x7e\x3f\xac\x83\xcd\xde\xfe\xcb\xca\xff\xf1\x9f\x07\x5b\xfe" "\x0a\x63\x5e\xfe\x2f\x2f\xdb\xe3\xb0\x7e\xb6\xea\xd6\x94\x96\x2b\x7d" "\x8f\x76\xc6\x74\x7e\x1f\x21\x7f\x7e\xa9\xdf\xef\x7f\xfa\xbc\xfc\x7e" "\x44\xad\xc7\x7a\x76\xbb\x8f\x30\x2a\xf7\x17\xba\xd5\x73\x62\x93\xeb" "\xb1\x5a\xdd\xea\x9f\x6f\x17\x5b\xd5\xd7\x62\x9c\xd6\xc3\xd7\xb3\xfc" "\xe2\xf7\x27\xff\x9f\x8e\xca\xff\x18\xe8\xec\x5f\x9b\x75\xfd\xff\xb5" "\xe9\x81\x5f\xeb\x5c\x0c\x07\x87\xa0\x0e\x5b\x3a\xd4\x86\xa0\x0e\x42" "\xcf\xa1\x31\xe8\x1d\x10\x30\xb4\x96\x9f\x9b\x5b\xd2\x88\x52\x7e\xfe" "\x5c\x5f\x9e\xbf\xad\x24\x7f\x7b\x49\xfe\x74\x49\xfe\x1d\x25\xf9\x3b" "\x4a\xf2\x61\x9c\xfd\xf6\xb9\x9f\x84\x97\x2b\xcb\xe7\xf9\xf9\x39\x7d" "\xbf\xd7\xc3\xd2\x75\xb6\x3b\x63\xfc\x91\x3e\xeb\x93\x5f\x8f\xec\xb7" "\xfc\xfc\xb9\xdf\x7e\xad\xb5\xfc\xfc\x79\x62\x18\x66\x6f\x9e\x7e\xe2" "\xec\x97\x9f\x7a\xf2\xfa\xd2\xf3\xff\x95\xd6\xf6\x7f\x3b\x6e\xef\x07" "\x63\xba\x1e\xbf\x5b\xd7\xe2\x0c\xe9\x7a\x61\x7e\x5d\xbd\xf5\xec\x7f" "\xbd\xbd\x9c\x6a\x97\xf9\xee\xca\xea\x73\xe7\x8a\xf9\x1b\x4b\x25\xee" "\x69\x9f\xaf\xb2\x67\xf9\x73\x42\x61\x3f\xb3\xa2\x1e\x33\xed\xef\xdb" "\xd5\x6d\xbe\x03\xed\xf3\xd5\xb3\xf9\xa6\x63\xd8\x9e\xd5\x37\x3f\x3e" "\xb9\x23\x7b\x5f\x3a\xfe\x48\xfb\xd5\xb4\xbe\x26\xb3\xe5\xad\x65\xcb" "\x31\x95\xd5\x23\xed\x57\x76\xc7\x38\xaf\x07\xac\x46\xda\x1e\xbb\x3d" "\xff\x9f\xb6\xcf\x99\x50\xab\x3c\x7d\xee\xfc\xd9\x87\x62\x3a\x6d\xa7" "\x7f\x98\xa8\x6d\x5b\x9c\x7e\xb8\xf8\xa1\xbf\xda\x9c\xba\x03\x6b\xd3" "\x6b\xfb\x9f\x99\xd0\xde\xfe\x67\x67\x6b\x7a\xad\x5a\xd8\x2f\xb4\x0e" "\xbf\xd3\xfe\xe2\x70\xeb\xf3\xda\xa7\xcf\x2f\x25\x6b\xf9\xfc\x47\x62" "\x3a\xfd\xce\x7d\x7b\x62\xba\x39\x7d\xf6\xcc\x77\xcf\x3f\xb5\xde\x0b" "\x0f\x63\xee\xe2\xf3\x2f\x7c\xe7\xf4\xf9\xf3\x67\xbf\xef\x45\x7a\x31" "\x6d\xb5\x78\xe1\x45\xd9\x9e\x63\xab\x3e\x39\x08\xe3\x63\xee\xb9\x67" "\xbf\x37\x77\xf1\xf9\x17\x1e\x3c\xf7\xec\xe9\x67\xce\x3e\x73\xf6\xc2" "\x91\xa3\x47\x8f\xcc\xcf\x1f\xfd\xca\x91\x85\xb9\xe6\x71\xfd\x5c\xf1" "\xac\x1f\xd8\x4a\x96\x7f\xf4\x07\x5d\x13\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\xa0\x57\x3f\x38\x79\xe2\xfa\x9f\xde\xfe\xd2\x7b\x4b\xed\xff" "\x97\xdb\xff\xa5\xf6\xff\xe9\xc9\xdf\xd4\xfe\xff\x47\x59\xfb\xff\xbc" "\x9d\x7c\x6a\x15\x90\xda\xd9\xef\xee\x90\xdf\x1c\x77\xef\xcd\xf6\x7a" "\x4c\x65\xf3\xd5\x62\xf8\x68\x56\xdf\x3d\x59\x39\x7b\xb3\xf7\x7d\x2c" "\xc6\xad\x71\xfc\x62\xfb\xff\xd4\xde\x3e\xef\xd7\x35\xd5\xe7\xee\x6c" "\x7a\xde\x7f\x6f\x9a\x2f\xeb\x4e\x60\x45\x7f\x29\x53\x59\x1f\x24\xad" "\xf1\x02\x63\x83\xfd\x4f\xc6\xf4\x95\x18\xff\x22\xc0\x00\x55\xa6\x3b" "\x4f\x8e\x71\x59\xff\xd6\x69\x5b\x6f\xf6\x4f\xf1\xd2\x46\x55\x92\x8d" "\x96\xfa\x13\x49\x5b\x43\xea\xc7\x24\xb5\xff\xee\xd6\xaf\x53\xda\xff" "\xef\xde\x84\x3a\xb2\xfe\x36\xa3\x39\xe1\xa0\x97\x11\xe8\xec\x1f\xc3" "\x38\xfe\x67\xb5\x98\x2e\x1c\x89\x0f\xba\x5e\xff\x3f\x34\x1a\x83\xaf" "\xc3\xda\xc3\xf0\xaf\x67\x61\x1d\x43\xa3\x61\x14\x0f\x60\x38\x0c\x7a" "\xfc\xcf\x74\xdd\x33\xc5\x17\x7e\xff\x8d\xed\x8b\x21\xcd\x76\xf3\x91" "\xf6\xfd\x65\xde\x7f\x29\xac\xc5\xb0\x8f\x3f\xa9\xfc\xad\x35\xfe\x67" "\x6b\xfc\xbb\x9e\xf6\x7f\x1d\x7a\x57\x6f\xeb\xe7\xb9\xf7\xd1\x15\xfe" "\xfd\xb3\x1b\xef\x15\x8a\x0d\xfb\x7a\xdd\xff\xe6\xcb\x9f\xfa\x81\xde" "\x53\x5e\x66\xd1\x87\xb1\xfc\xb4\xfc\xf7\x87\xde\xca\x6f\xbc\x96\x95" "\x9f\xdf\x10\xea\xd1\x7f\xb2\xf2\xef\xe8\xb1\xfc\x15\xcb\x7f\x60\x75" "\xe5\xff\x37\x96\x9f\x56\xdb\x03\x9f\xea\xb5\xfc\xa5\x1a\x57\xaa\xed" "\xf5\xc8\xaf\x1b\xa7\xfb\x7f\xf9\x75\xe3\xe4\x56\xb6\xfc\xa9\x6f\xcf" "\xbe\x97\x7f\x95\x03\x35\xde\x8e\xe5\xc3\x38\xeb\x3e\xce\x6c\xaf\x23" "\xd8\x0e\xa7\x51\x19\xff\xb7\x9b\xfc\x39\x8c\x2f\xc6\x74\xda\x11\xa6" "\xe7\x1c\xf2\x5f\xe4\x7e\xeb\x9f\x9e\xaf\x48\xbf\x03\x7b\xb3\xcf\xaf" "\x94\xfc\xbe\x8d\xca\x38\xc5\xdd\x8c\xfb\xf8\xbf\x5f\x8d\x71\xd9\xf7" "\x21\x8d\xff\x9b\xb6\xc7\x7a\x87\x74\xb5\x90\xae\x75\x58\xb7\xa3\xbe" "\xad\xc0\x56\xf3\xfe\x30\xde\xff\x1b\xe5\x70\x69\x08\xea\x20\x0c\x69" "\x18\x8e\x31\xb0\x8b\xa1\xd1\x68\x0c\xb4\x23\x6f\xbd\x88\x0f\xd6\xa0" "\xd7\xff\xa0\xef\x3e\x0f\xba\xfc\x41\xaf\xff\x32\xf9\xf8\xbf\xf9\x31" "\x7c\x3e\xfe\x6f\x35\x3b\x81\xc8\xc7\xff\xcd\xdf\x9f\x8f\xff\x9b\xe7" "\xe7\xe3\xeb\xe5\xf9\xf9\xf8\xbf\xf9\xfa\xcc\xc7\xff\xcd\xf3\xef\xce" "\x3e\x37\xbf\x82\x3d\x53\x92\xff\xf1\x92\xfc\x7d\x25\xf9\xfb\x97\xf3" "\xa7\x3b\xe5\x1f\x28\x79\xff\x27\x4a\xf2\x0f\x95\xe4\xdf\x53\x92\x7f" "\x6f\x49\xfe\x5d\x25\xf9\x13\x25\xf9\x9f\x2e\xc9\xff\x4c\x49\xfe\x7d" "\x25\xf9\x0f\x94\xe4\x7f\xb6\x24\x7f\xab\x6b\xb6\x47\x29\x7c\xa9\xc6" "\x6d\xf9\x61\x9c\xe5\xed\xf3\x7c\xff\x61\x7c\xa4\xfb\x3f\xdd\xbe\xff" "\x7b\x4a\xf2\x81\xd1\xf5\xd3\x37\x0e\x3f\xfa\xe4\x6f\xbe\x55\x5f\x6a" "\xff\x3f\xd5\x3a\x5f\x4b\xf7\xf1\x8e\xc7\x74\x2d\x9e\x3b\xff\x30\xa6" "\xf3\xfb\xde\xa1\x90\x5e\xcc\x7b\x3b\xa6\xff\x9a\xe5\x0f\xfb\xf5\x0e" "\x18\x27\x79\xff\x19\xf9\xef\xfb\xfd\x25\xf9\xc0\xe8\x4a\xcf\x79\xf9" "\x7e\xc3\x18\xaa\x6c\xef\x3c\x39\xc6\x69\xbf\xd0\xad\xdf\xaa\x6e\xc7" "\xf9\x8c\x96\xcf\xc5\xf8\xf3\x31\xfe\x42\x8c\x1f\x8c\xf1\x6c\x8c\xe7" "\x62\x7c\x38\xc6\xf3\x9b\x54\x3f\x36\xc6\xa3\xbf\xfe\xdd\xb1\x97\x2b" "\xcb\xe7\xfb\xbb\xb2\xfc\x5e\x9f\x27\xcf\xdb\x03\xe5\xfd\x44\x1d\xe9" "\xb1\x3e\xf9\xf5\x81\x7e\x9f\x67\xcf\xfb\xf1\xeb\xd7\x5a\xcb\x5f\x65" "\x73\x30\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\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\x81\xa9\x36\xff\x2e\x2c\xcc" "\x54\x42\xb8\xfa\xd6\xab\x27\x9e\x38\x75\x6e\x6e\x71\xca\xc3\xad\x39" "\xea\xcd\xbf\x93\x85\x54\xad\xf5\xbe\x10\x1e\x8a\xf1\x44\x8c\x7f\x1e" "\x5f\xdc\xfa\xe0\xc5\x33\xc5\xf8\x76\x8c\x2b\x61\x3e\x54\x42\xa5\x35" "\x3d\x3c\x7e\xb3\x55\xd2\x8e\x10\xc2\xa5\x70\x30\x5c\x0b\xf5\xb0\xef" "\xea\xf5\x57\xde\x99\x7f\xec\xd4\xe5\x93\x57\x0e\xbd\xfb\xfa\xb1\x1b" "\x1b\xb7\x06\x00\x00\x00\x60\xeb\xfb\x5f\x00\x00\x00\xff\xff\xad\xcb" "\x1c\xc2", 2688); syz_mount_image( /*fs=*/0x200000000000, /*dir=*/0x200000000040, /*flags=MS_LAZYTIME|MS_STRICTATIME|MS_RELATIME|MS_NOSUID|MS_NODIRATIME|0x400*/ 0x3200c02, /*opts=*/0x200000000140, /*chdir=*/3, /*size=*/0xa80, /*img=*/0x200000000180); break; case 1: // openat arguments: [ // fd: fd_dir (resource) // file: ptr[in, buffer] { // buffer: {2e 00} (length 0x2) // } // flags: open_flags = 0x0 (4 bytes) // mode: open_mode = 0x0 (2 bytes) // ] // returns fd memcpy((void*)0x200000000240, ".\000", 2); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000240ul, /*flags=*/0, /*mode=*/0); if (res != -1) r[0] = res; break; case 2: // ioctl$NILFS_IOCTL_CLEAN_SEGMENTS arguments: [ // fd: fd (resource) // cmd: const = 0x40786e88 (4 bytes) // arg: ptr[in, nilfs_ioctl_clean_segments_args] { // nilfs_ioctl_clean_segments_args { // argv0: nilfs_argv_typed[nilfs_vdesc, in, NILFS_VDESC_SIZE] { // v_base: nil // v_nmembs: len = 0x0 (4 bytes) // v_size: const = 0x40 (2 bytes) // v_flags: int16 = 0xd (2 bytes) // v_index: int64 = 0xe2 (8 bytes) // } // argv1: nilfs_argv_typed[nilfs_period, in, NILFS_PERIOD_SIZE] { // v_base: nil // v_nmembs: len = 0x0 (4 bytes) // v_size: const = 0x10 (2 bytes) // v_flags: int16 = 0x20c (2 bytes) // v_index: int64 = 0xfffffffffffffff8 (8 bytes) // } // argv2: nilfs_argv_typed[int64, in, 8] { // v_base: nil // v_nmembs: len = 0x0 (4 bytes) // v_size: const = 0x8 (2 bytes) // v_flags: int16 = 0x1 (2 bytes) // v_index: int64 = 0x2 (8 bytes) // } // argv3: nilfs_argv_typed[nilfs_bdesc, in, NILFS_BDESC_SIZE] { // v_base: nil // v_nmembs: len = 0x0 (4 bytes) // v_size: const = 0x28 (2 bytes) // v_flags: int16 = 0x0 (2 bytes) // v_index: int64 = 0x7 (8 bytes) // } // argv4: nilfs_argv_typed[int64, in, 8] { // v_base: ptr[in, array[int64]] { // array[int64] { // int64 = 0x3e (8 bytes) // } // } // v_nmembs: len = 0x1 (4 bytes) // v_size: const = 0x8 (2 bytes) // v_flags: int16 = 0x98f (2 bytes) // v_index: int64 = 0xffff (8 bytes) // } // } // } // ] *(uint64_t*)0x200000000640 = 0; *(uint32_t*)0x200000000648 = 0; *(uint16_t*)0x20000000064c = 0x40; *(uint16_t*)0x20000000064e = 0xd; *(uint64_t*)0x200000000650 = 0xe2; *(uint64_t*)0x200000000658 = 0; *(uint32_t*)0x200000000660 = 0; *(uint16_t*)0x200000000664 = 0x10; *(uint16_t*)0x200000000666 = 0x20c; *(uint64_t*)0x200000000668 = 0xfffffffffffffff8; *(uint64_t*)0x200000000670 = 0; *(uint32_t*)0x200000000678 = 0; *(uint16_t*)0x20000000067c = 8; *(uint16_t*)0x20000000067e = 1; *(uint64_t*)0x200000000680 = 2; *(uint64_t*)0x200000000688 = 0; *(uint32_t*)0x200000000690 = 0; *(uint16_t*)0x200000000694 = 0x28; *(uint16_t*)0x200000000696 = 0; *(uint64_t*)0x200000000698 = 7; *(uint64_t*)0x2000000006a0 = 0x2000000003c0; *(uint64_t*)0x2000000003c0 = 0x3e; *(uint32_t*)0x2000000006a8 = 1; *(uint16_t*)0x2000000006ac = 8; *(uint16_t*)0x2000000006ae = 0x98f; *(uint64_t*)0x2000000006b0 = 0xffff; syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x40786e88, /*arg=*/0x200000000640ul); break; case 3: // sync arguments: [ // ] syscall(__NR_sync); 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; }