// https://syzkaller.appspot.com/bug?id=3d4ab200db20b8c137af1a257cbecb4dd7a114a6 // 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 < 5; 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[2] = {0xffffffffffffffff, 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 30 00} (length 0x8) // } // flags: mount_flags = 0x1080c (8 bytes) // opts: ptr[inout, array[ANYUNION]] { // array[ANYUNION] { // } // } // chdir: int8 = 0x3 (1 bytes) // size: len = 0xa53 (8 bytes) // img: ptr[in, buffer] { // buffer: (compressed buffer with length 0xa53) // } // ] // returns fd_dir memcpy((void*)0x200000000000, "nilfs2\000", 7); memcpy((void*)0x200000000100, "./file0\000", 8); memcpy( (void*)0x200000002640, "\x78\x9c\xec\xdd\x4d\x8c\x5b\x47\x1d\x00\xf0\x67\xef\x7a\xf3\x59\xe2" "\x94\x84\x86\xb4\xb4\x09\x85\xb6\x02\xba\xdb\xec\x86\xf0\x11\x41\x53" "\x35\x17\xa2\xa6\xe2\x56\xa9\xe2\x12\xa5\x69\x89\x48\x03\x22\x95\xa0" "\x55\x0e\x49\x4e\xdc\x68\x15\x85\x1b\xe2\x43\x9c\x7a\xa9\x00\x21\xd1" "\x0b\x8a\x7a\xe2\x52\x89\x46\xe2\xd2\x53\xe1\xc0\x81\x28\x48\x91\x38" "\x40\x4b\x62\x14\xef\x8c\xd7\xfe\xc7\xee\xb3\x93\xdd\x7d\xeb\xf5\xef" "\x27\x8d\xc7\xef\xcd\xd8\x33\xcf\xfb\xfc\xf6\x79\xde\x9b\x99\x02\x98" "\x58\xf5\xf6\x63\xa3\xfd\x78\xe9\xed\x8b\x87\xff\xf9\xc8\x3f\x36\xdd" "\x7a\xfe\x64\x27\x47\xb3\xfd\x38\xdd\xb5\x74\x2b\x77\x2d\x2d\x4f\x87" "\xf7\xfb\x60\x6a\x31\xbe\x71\xfd\xec\xf1\x7e\x71\xad\x98\x6f\x3f\xe6" "\xe5\xe2\xd9\x6b\x9d\xd7\x6e\x29\x8a\xe2\x5c\xb1\xa7\xb8\x5c\x34\x8b" "\xdd\x97\xae\xbc\xf1\xee\xfc\x33\x47\xcf\x1f\xb9\xb0\xf7\xbd\x37\x0f" "\x5e\x5d\x89\x6d\x07\x00\x80\x49\xf3\xed\xcb\x07\xf7\xef\xfc\xdb\x5f" "\xee\xdf\xfe\xe1\x5b\x0f\x1e\x2a\x36\x74\xd6\xe7\xf3\xf3\x66\x5a\xde" "\x9a\xce\xfb\x0f\xa5\x13\xff\x7c\xfe\x5f\x2f\x7a\x97\x6b\x5d\xa1\xdb" "\x4c\xc8\x37\x9d\x42\x3d\xe4\x9b\xea\x93\xaf\xbb\x9c\x46\xce\xb7\xb1" "\xf7\x75\xb1\xfc\x99\xf0\xbe\x8d\x01\xf9\x36\x94\x94\x3f\xd5\xb5\xae" "\xdf\x76\xc3\x38\xcb\xfb\x71\xb3\xa8\xd5\x67\x7b\x96\xeb\xf5\xd9\xd9" "\xc5\xdf\xe4\x45\xfb\x77\xfd\x4c\x6d\xf6\xf4\xc9\x53\x2f\x9e\xa9\xa8" "\xa2\xc0\xb2\xfb\xf7\x43\x45\x51\xec\x11\x84\x49\x0b\xad\x6d\x9d\x2f" "\x41\xe5\x75\xa9\x2e\x74\x7d\x0a\x00\x95\x8a\xd7\x0b\x6f\x73\x2e\xb6" "\x2c\xdc\x9d\xce\xbb\x4d\x0f\x57\xfe\xb5\xa7\xea\xfd\x5f\x0f\xcb\x60" "\xb5\xf7\x7f\xe5\xc7\xf7\xef\xad\xc7\x6a\x97\x5f\xb6\xfd\xbf\x39\xef" "\x88\xc3\xf2\x19\x7e\x6f\xda\xb8\xa2\xf5\x58\x6e\x79\xbb\xf2\xf7\x68" "\x6b\x5a\x8e\xd7\x11\xe2\xfd\x4b\xa3\x1e\x7f\xf2\xfb\x4d\x85\xf7\x6b" "\x0c\x59\xcf\x41\xd7\x11\xc6\xe5\xfa\xc2\xa0\x7a\x4e\xad\x72\x3d\xee" "\xd4\xa0\xfa\xc7\xfd\x62\xbd\xfa\x46\x8a\xf3\xe7\xf0\xcd\x90\xde\xfd" "\xfd\x89\x7f\xd3\x71\xf9\x1b\x03\xfd\xfd\x67\xcd\xb5\xff\x6f\x5a\xaa" "\x5c\xe5\x75\x19\x29\x6c\x1c\xd3\x7a\x0b\x13\x1c\x5a\xd5\x1c\x76\x80" "\x31\x10\xef\x9b\x6b\x25\x39\x3d\xde\xd7\x17\xd3\x37\x94\xa4\x6f\x2c" "\x49\xdf\x54\x92\xbe\xb9\x24\x7d\x4b\x49\x3a\x4c\xb2\xdf\xbf\xf2\xd3" "\xe2\xf5\xda\xd2\xef\xfc\xf8\x9b\xfe\xc6\xf5\xb3\xed\x2f\xcb\xb0\xed" "\x61\xb9\x9d\xed\x9e\x14\x7f\x62\xc4\xfa\xc4\xf6\xc8\x51\xdb\xe3\xe2" "\x7d\xbf\xa3\xba\xdb\xf2\xe3\xfd\xc4\xb0\x96\xfd\xf1\xd8\x73\x27\xbe" "\xfa\xc2\xf3\x57\x16\xef\xff\xaf\x75\xf6\xff\x9b\x69\x7f\xdf\x93\x96" "\x9b\xe9\xbb\x75\x39\x65\xc8\xed\x85\xb1\x5d\xbd\x73\xef\x7f\xb3\xb7" "\x9c\xfa\x80\x7c\xf7\x86\xfa\xdc\xd3\x27\x7f\xfb\xf9\x8e\xde\x7c\xb5" "\x1d\x4b\xef\x53\x74\x1d\x67\x6e\xab\xc7\xae\xde\xd7\x6d\x1b\x94\xef" "\x81\xde\x7c\xcd\x90\x6f\x53\x0a\xf1\x2a\x48\x3c\x3f\xd9\x1c\x5e\x97" "\xcf\x3f\xf2\x71\x35\x7f\x5e\xd3\x61\x7b\x1b\x61\x3b\x66\x42\x3d\xf2" "\x71\x65\x7b\x8a\xc7\xeb\x6a\x0c\x6b\x55\xde\x1f\x07\xdd\xff\x9f\xf7" "\xcf\x5d\x45\xa3\xf6\xe2\xc9\x53\x27\x9e\x48\xcb\x79\x3f\xfd\xf3\x54" "\x63\xc3\xad\xf5\xfb\x56\xb9\xde\xc0\xdd\x1b\xb6\xff\xcf\xae\xa2\xb7" "\xff\xcf\xd6\xce\xfa\x46\xbd\xfb\xb8\xb0\x6d\x69\x7d\xad\xfb\xb8\xd0" "\x0c\xeb\xe7\x07\xac\x5f\x48\xcb\xf9\xff\xdc\x77\xa7\x36\xb5\xd7\xcf" "\x1e\xff\xfe\xa9\x17\x96\x7b\xe3\x61\xc2\x9d\x79\xf5\xb5\xef\x1d\x3b" "\x75\xea\xc4\x0f\x3d\xf1\xc4\x13\x4f\x3a\x4f\xaa\x3e\x32\x01\x2b\x6d" "\xee\x95\x97\x7f\x30\x77\xe6\xd5\xd7\x1e\x3f\xf9\xf2\xb1\x97\x4e\xbc" "\x74\xe2\xf4\xc2\x81\x03\x0b\xf3\xf3\x07\xbe\xb6\xb0\x7f\xae\x7d\x5e" "\x3f\xd7\x7d\x76\x0f\xac\x27\x4b\xff\xf4\xab\xae\x09\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x30\xac\x1f\x1d\x39\x7c\xe5\xaf\xef\x7c\xe5\xfd" "\xc5\xfe\xff\x4b\xfd\xff\x72\xff\xff\x7c\xe7\x6f\xee\xff\xff\x93\xd0" "\xff\x3f\xf6\x93\xcf\xfd\xe0\x73\x3f\xc0\xed\x7d\xd2\xdb\x79\xc2\x00" "\xab\x33\x21\x5f\x23\x85\x4f\x86\xfa\xee\x08\xe5\xec\x0c\xaf\xfb\x54" "\x8a\x3b\xf3\xf8\xa5\xfe\xff\xb9\xb8\x38\xae\x6b\xae\xcf\x7d\x61\x7d" "\x1c\xbf\x37\xe7\x0b\xc3\x09\xdc\x36\x5e\xca\x4c\x18\x83\x24\xce\x17" "\xf8\xd9\x14\x5f\x48\xf1\xaf\x0b\xa8\x50\xed\xe7\xfd\x57\xa7\xb8\x6c" "\x7c\xeb\xbc\xaf\xe7\xf1\x29\x8c\x4b\x31\x9e\xf2\xdf\x2d\x8f\x67\x92" "\xc7\x31\xc9\xfd\xbf\x07\x8d\xeb\x94\x8f\xff\xdb\x57\xa1\x8e\x2c\xbf" "\xd5\xe8\x4e\x58\xf5\x36\x02\xfd\xfd\x6b\xcd\x8d\xff\xbd\xde\x43\xd7" "\x2f\x86\xca\xeb\x22\xac\xb5\x70\xa3\xd5\x6a\xad\x66\x79\xad\x96\x59" "\x3c\x80\xb5\xa1\xea\xf9\x3f\x73\xbb\x67\x8e\x4f\xff\xe9\x5b\x1b\x6f" "\x85\x9c\xed\xda\x53\xbd\xc7\xcb\x38\x7e\x29\xdc\x8d\xaa\xe7\xbf\xac" "\xac\xfc\xdc\xb0\x38\xa9\xdb\x3f\x64\xf9\xcb\x3d\xff\x67\x67\xfe\xbb" "\xa1\x8f\x7f\x61\xc6\xbc\xe6\x9d\x95\xfb\xdf\x5f\x5c\x7d\xbf\xab\xd8" "\x62\xf7\xb0\xe5\xc7\xed\xcf\xe3\x40\xef\x18\xad\xfc\x0f\x53\xf9\x79" "\x6b\x1e\x2d\x86\x2b\xbf\xf5\xab\x50\x7e\xbc\x20\x34\xa4\x8f\x42\xf9" "\x9b\x87\x2c\x3f\x6e\xff\xc5\x51\x0b\x4e\x05\xfe\x2f\x95\x9f\x3f\xb6" "\xc7\x1e\x1e\xb6\xfc\xc5\x37\xa8\xd5\x7b\xeb\x11\xdb\x8d\xf3\xf5\xbf" "\xd8\x6e\x9c\xdd\x08\xdb\x9f\xc7\xf6\x1c\xf9\xef\x7f\x87\x13\x35\xde" "\x4c\xe5\xc3\x24\x1b\x97\x79\x66\x47\x35\x2e\xf3\xff\x0e\x12\xef\xc3" "\xf8\x72\x5a\xce\x07\xc2\x7c\x9f\x43\x9c\xef\x64\xd4\xfa\xe7\xfb\x2b" "\xf2\xff\x81\x9d\xe1\xfd\x6b\x25\xff\xdf\xcc\xff\x3b\xde\xbe\x9e\xe2" "\xb2\xef\x43\x9e\xff\x37\xef\x8f\xcd\x3e\xcb\xf5\xae\xe5\x46\x9f\xcf" "\x76\xbd\x1e\x6b\x60\x5c\x7d\xe0\xfa\x9f\x30\xe6\xa1\x7d\x46\xb3\x06" "\xea\x31\x8e\xa1\xd5\x6a\xad\x6c\x83\x56\x89\x4a\x0b\xa7\xf2\xcf\xbf" "\xea\xdf\x09\x55\x97\x5f\xf5\xe7\x5f\x26\xce\xff\x1b\xcf\xe1\xe3\xfc" "\xbf\x31\x3d\xce\xff\x1b\xd3\xe3\xfc\xbf\x31\xbd\xdd\xae\xf8\xd1\xd2" "\xa4\xbd\x31\x3d\xce\xff\x1b\x3f\xcf\x38\xff\x6f\x4c\xbf\x2f\x94\x1b" "\xe7\x07\xde\x55\x92\xfe\xe9\x92\xf4\xdd\x25\xe9\xf7\x97\xa4\x3f\x50" "\x92\xfe\x99\x92\xf4\xbd\x25\xe9\x0f\x96\xa4\x3f\x54\x92\x7e\x6f\x49" "\xfa\xc3\x25\xe9\x9f\x2b\x49\xff\x7c\x49\xfa\x23\x25\xe9\x8f\x7d\x7c" "\xfa\xc2\x8f\x4b\x5e\xbf\xde\xe5\xfe\x28\x93\xba\xfd\x30\xc9\x62\xff" "\x3c\xdf\x7f\x98\x1c\xf9\xfa\xcf\xa0\xef\xff\x8e\x92\x74\x60\x7c\xfd" "\xec\xad\x7d\x4f\x3f\xff\xbb\xef\x34\x17\xfb\xff\xcf\x74\xda\x43\xf2" "\x75\xbc\x43\x69\xb9\x91\x7e\x3b\xc7\xdf\x4b\xb1\xfd\x64\x2a\xa5\xbd" "\x93\x96\xff\x1e\xd2\xd7\x7a\x7b\x07\x4c\x92\x38\x7e\x46\xfc\xff\xfe" "\x68\x49\x3a\x30\xbe\xf2\x7d\x5e\xbe\xdf\x30\x81\x6a\xfd\x47\xec\x19" "\x76\xdc\xaa\x41\xe7\xf9\x8c\x97\x2f\xa4\xf8\x8b\x29\xfe\x52\x8a\x1f" "\x4f\xf1\x6c\x8a\xe7\x52\xbc\x2f\xc5\xf3\xab\x54\x3f\x56\xc6\xd3\xbf" "\xfd\xc3\xc1\xd7\x6b\x4b\xbf\xf7\xb7\x85\xf4\x61\xef\x27\x8f\xfd\x81" "\xe2\x38\x51\x0b\x43\xd6\x27\xb6\x0f\x8c\x7a\x3f\x7b\x1c\xc7\x6f\x54" "\x77\x5b\xfe\x1d\x76\x07\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa8\x4c\xbd" "\xfd\xb8\x7f\xff\xae\x5a\x51\x5c\x7a\xfb\xe2\xe1\xe7\x8e\x9e\x9c\xbb" "\xb5\xe6\xc9\x4e\x8e\x66\xfb\x71\xba\x6b\xa9\xd1\x79\x5d\x51\x3c\x91" "\xe2\xa9\x14\xff\x32\x3d\xb9\x71\xfd\xec\xf1\xee\xf8\x66\x8a\x6b\xc5" "\x7c\x51\x2b\x6a\x9d\xf5\xc5\xb3\xd7\x3a\x25\x6d\x29\x8a\xe2\x5c\xb1" "\xa7\xb8\x5c\x34\x8b\xdd\x97\xae\xbc\xf1\xee\xfc\x33\x47\xcf\x1f\xb9" "\xb0\xf7\xbd\x37\x0f\x5e\x5d\xb9\x4f\x00\x00\x00\x00\xd6\xbf\xff\x07" "\x00\x00\xff\xff\xf7\xb7\x18\xe1", 2643); syz_mount_image( /*fs=*/0x200000000000, /*dir=*/0x200000000100, /*flags=MS_POSIXACL|MS_NOEXEC|MS_NODIRATIME|MS_NODEV*/ 0x1080c, /*opts=*/0x200000000180, /*chdir=*/3, /*size=*/0xa53, /*img=*/0x200000002640); break; case 1: // open arguments: [ // file: ptr[in, buffer] { // buffer: {2e 00} (length 0x2) // } // flags: open_flags = 0x0 (8 bytes) // mode: open_mode = 0x0 (8 bytes) // ] // returns fd memcpy((void*)0x2000000000c0, ".\000", 2); res = syscall(__NR_open, /*file=*/0x2000000000c0ul, /*flags=*/0ul, /*mode=*/0ul); if (res != -1) r[0] = res; break; case 2: // open arguments: [ // file: ptr[in, buffer] { // buffer: {2e 00} (length 0x2) // } // flags: open_flags = 0x0 (8 bytes) // mode: open_mode = 0x0 (8 bytes) // ] // returns fd memcpy((void*)0x200000000040, ".\000", 2); res = syscall(__NR_open, /*file=*/0x200000000040ul, /*flags=*/0ul, /*mode=*/0ul); if (res != -1) r[1] = res; break; case 3: // ioctl$EXT4_IOC_GROUP_ADD arguments: [ // fd: fd (resource) // cmd: const = 0xc0185879 (4 bytes) // arg: ptr[in, ext4_new_group_input] { // ext4_new_group_input { // group: int32 = 0x2 (4 bytes) // pad = 0x0 (4 bytes) // block_bitmap: int64 = 0x5fc (8 bytes) // inode_bitmap: int64 = 0x9 (8 bytes) // inode_table: int64 = 0x2 (8 bytes) // blocks_count: int32 = 0x800000 (4 bytes) // reserved_blocks: int16 = 0x0 (2 bytes) // unused: const = 0x2401 (2 bytes) // } // } // ] *(uint32_t*)0x2000000004c0 = 2; *(uint64_t*)0x2000000004c8 = 0x5fc; *(uint64_t*)0x2000000004d0 = 9; *(uint64_t*)0x2000000004d8 = 2; *(uint32_t*)0x2000000004e0 = 0x800000; *(uint16_t*)0x2000000004e4 = 0; *(uint16_t*)0x2000000004e6 = 0x2401; syscall(__NR_ioctl, /*fd=*/r[1], /*cmd=*/0xc0185879, /*arg=*/0x2000000004c0ul); break; case 4: // ioctl$EXT4_IOC_GROUP_ADD arguments: [ // fd: fd (resource) // cmd: const = 0x40106e80 (4 bytes) // arg: ptr[in, ext4_new_group_input] { // ext4_new_group_input { // group: int32 = 0x1 (4 bytes) // pad = 0x0 (4 bytes) // block_bitmap: int64 = 0x1 (8 bytes) // inode_bitmap: int64 = 0x3 (8 bytes) // inode_table: int64 = 0x3 (8 bytes) // blocks_count: int32 = 0x0 (4 bytes) // reserved_blocks: int16 = 0x9 (2 bytes) // unused: const = 0x2401 (2 bytes) // } // } // ] *(uint32_t*)0x200000000040 = 1; *(uint64_t*)0x200000000048 = 1; *(uint64_t*)0x200000000050 = 3; *(uint64_t*)0x200000000058 = 3; *(uint32_t*)0x200000000060 = 0; *(uint16_t*)0x200000000064 = 9; *(uint16_t*)0x200000000066 = 0x2401; syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x40106e80, /*arg=*/0x200000000040ul); 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; }