// https://syzkaller.appspot.com/bug?id=d2abf370930f1cbd63e0e4dc9fbc90e94e673533 // 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; } } } void execute_call(int call) { switch (call) { case 0: // syz_mount_image$ext4 arguments: [ // fs: ptr[in, buffer] { // buffer: {65 78 74 34 00} (length 0x5) // } // dir: ptr[in, buffer] { // buffer: {2e 2f 62 75 73 00} (length 0x6) // } // flags: mount_flags = 0x2008042 (8 bytes) // opts: ptr[in, fs_options[ext4_options]] { // fs_options[ext4_options] { // elems: array[fs_opt_elem[ext4_options]] { // } // common: array[fs_opt_elem[fs_options_common]] { // } // null: const = 0x0 (1 bytes) // } // } // chdir: int8 = 0x1 (1 bytes) // size: len = 0x571 (8 bytes) // img: ptr[in, buffer] { // buffer: (compressed buffer with length 0x571) // } // ] // returns fd_dir memcpy((void*)0x200000000080, "ext4\000", 5); memcpy((void*)0x200000000040, "./bus\000", 6); *(uint8_t*)0x2000000000c0 = 0; memcpy( (void*)0x200000000780, "\x78\x9c\xec\xdd\xcf\x8f\x1b\x57\x1d\x00\xf0\xef\xcc\xfe\x72\x93\xb4" "\x9b\x40\x0f\x50\x01\x09\x50\x08\x28\x8a\x9d\x75\xda\xa8\xea\xa5\xe5" "\x02\x42\x55\x25\x44\xc5\x01\x71\x48\x97\x5d\x67\xb5\xc4\x8e\x43\xec" "\x2d\xdd\x25\x52\xb7\x7f\x03\x48\x20\x71\x82\x3f\x81\x03\x12\x07\xa4" "\x9e\x38\x70\xe3\x88\xc4\x01\x10\xe5\x80\x54\x20\x02\x25\x48\x1c\x06" "\xcd\xd8\xbb\xeb\x6c\xec\xc4\x8d\xbd\x76\xb3\xfe\x7c\xa4\xc9\xbc\x99" "\x37\xe3\xef\x7b\xf6\xce\xbc\xe7\x67\xc7\x2f\x80\x99\x75\x2e\x22\x76" "\x23\x62\x31\x22\xde\x8c\x88\xe5\xee\xfe\xa4\xbb\xc4\xab\x9d\x25\x3f" "\xee\xee\x9d\xdb\x6b\xf7\xee\xdc\x5e\x4b\x22\xcb\xde\xf8\x67\x52\xe4" "\xe7\xfb\xa2\xe7\x9c\xdc\xc9\xee\x63\x96\x22\xe2\x9b\x5f\x8b\xf8\x6e" "\xf2\x60\xdc\xd6\xf6\xce\xf5\xd5\x7a\xbd\x76\xab\xbb\x5d\x69\x37\x6e" "\x56\x5a\xdb\x3b\x17\x37\x1b\xab\x1b\xb5\x8d\xda\x8d\x6a\xf5\xca\xca" "\x95\x4b\x2f\x5d\x7e\xb1\x3a\xb6\xba\x9e\x6d\xfc\xf2\x83\xaf\x6e\xbe" "\xf6\xad\xdf\xfc\xfa\xd3\xef\xff\x7e\xf7\xcb\x3f\xcc\x8b\x75\xaa\x9b" "\xd7\x5b\x8f\x71\xea\x54\x7d\x61\x3f\x4e\x6e\x3e\x22\x5e\x3b\x8a\x60" "\x53\x30\xd7\x5d\x2f\x4e\xb9\x1c\x3c\x9e\x34\x22\x3e\x16\x11\x9f\x2b" "\xae\xff\xe5\x98\x2b\xfe\x3a\x01\x80\xe3\x2c\xcb\x96\x23\x5b\xee\xdd" "\x06\x00\x8e\xbb\xb4\x18\x03\x4b\xd2\x72\x44\xa4\x69\xb7\x13\x50\xee" "\x8c\xe1\x3d\x1b\x27\xd2\x7a\xb3\xd5\xbe\x70\xad\xb9\x75\x63\xbd\x33" "\x56\x76\x3a\x16\xd2\x6b\x9b\xf5\xda\xa5\x33\x4b\x7f\xfc\x7e\x71\xf0" "\x42\x92\x6f\xaf\x14\x79\x45\x7e\xb1\x5d\x3d\xb4\x7d\x39\x22\xce\x44" "\xc4\x8f\x97\x9e\x2a\xb6\xcb\x6b\xcd\xfa\xfa\x74\xba\x3c\x00\x30\xf3" "\x4e\xf6\xb6\xff\x11\xf1\x9f\xa5\x34\x2d\x97\x87\x3a\xb5\xcf\xa7\x7a" "\x00\xc0\x13\xa3\x34\xed\x02\x00\x00\x13\xa7\xfd\x07\x80\xd9\xa3\xfd" "\x07\x80\xd9\x33\x44\xfb\xdf\xfd\xb0\x7f\xf7\xc8\xcb\x02\x00\x4c\x86" "\xf7\xff\x00\x30\x7b\xb4\xff\x00\x30\x7b\xb4\xff\x00\x30\x53\xbe\xf1" "\xfa\xeb\xf9\x92\xdd\xeb\xfe\xfe\xf5\xfa\x5b\xdb\x5b\xd7\x9b\x6f\x5d" "\x5c\xaf\xb5\xae\x97\x1b\x5b\x6b\xe5\xb5\xe6\xad\x9b\xe5\x8d\x66\x73" "\xa3\xf8\xcd\x9e\xc6\xa3\x1e\xaf\xde\x6c\xde\x5c\x79\x21\xb6\xde\xae" "\xb4\x6b\xad\x76\xa5\xb5\xbd\x73\xb5\xd1\xdc\xba\xd1\xbe\x5a\xfc\xae" "\xf7\xd5\xda\xc2\x44\x6a\x05\x00\x3c\xcc\x99\xb3\xef\xfd\x21\x89\x88" "\xdd\x97\x9f\x2a\x96\xe8\x99\xcb\x41\x5b\x0d\xc7\x5b\x3a\xc6\xa3\x80" "\x27\xcb\xdc\x28\x27\xeb\x20\xc0\x13\xcd\x6c\x5f\x30\xbb\x86\x6a\xc2" "\x8b\x4e\xc2\xef\x8e\xbc\x2c\xc0\x74\xf4\xfd\x31\xef\x52\xdf\xe4\xfd" "\x7e\xfa\x21\x82\xf8\x9e\x11\x7c\xa4\x9c\xff\xe4\xf0\xe3\xff\xe6\x78" "\x86\xe3\xc5\xc8\x3e\xcc\xae\xc7\x1b\xff\x7f\x65\xec\xe5\x00\x26\xef" "\xb1\xc7\xff\xff\x3c\xde\x72\x00\x93\x97\x65\xc9\xe1\x39\xff\x17\xf7" "\xb3\x00\x80\x63\x69\x84\xaf\xf0\x65\xef\x8c\xab\x13\x02\x4c\xd5\xa3" "\x26\xf3\x1e\xcb\xe7\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x70\xcc\x9c\x8a" "\x88\xef\x45\x92\x96\x8b\xb9\xc0\xd3\xfc\xdf\xb4\x5c\x8e\x78\x3a\x22" "\x4e\xc7\x42\x72\x6d\xb3\x5e\xbb\x14\x11\xcf\xc4\xd9\x88\x58\x58\xca" "\xb7\x57\xa6\x5d\x68\x00\x60\x44\xe9\xdf\x93\xee\xfc\x5f\xe7\x97\x9f" "\x3f\x75\x38\x77\x31\xf9\xef\x52\xb1\x8e\x88\x1f\xfc\xec\x8d\x9f\xbc" "\xbd\xda\x6e\xdf\x5a\xc9\xf7\xff\x6b\x7f\xff\xd2\xde\xf4\x61\xd5\x83" "\xf3\x46\x98\x57\x10\x00\x18\xde\x5f\x87\x39\xa8\x68\xbf\xab\xdd\x75" "\xcf\x1b\xf9\xbb\x77\x6e\xaf\xed\x2d\x47\x58\xc6\x07\x7c\xf0\x95\xfd" "\xc9\x47\xd7\xee\xdd\xb9\x5d\x2c\x9d\x9c\xf9\xc8\xb2\x2c\x8b\x28\x15" "\x7d\x89\x13\xff\x4e\x62\xbe\x7b\x4e\x29\x22\x9e\x8b\x88\xb9\x31\xc4" "\xdf\x7d\x37\x22\x3e\xd1\xaf\xfe\x49\x31\x36\x72\xba\x3b\xf3\x69\x6f" "\xfc\xe8\xc6\x7e\x7a\xa2\xf1\xd3\xfb\xe2\xa7\x45\x5e\x67\x9d\x3f\x7d" "\x1f\x1f\x43\x59\x60\xd6\xbc\x97\xdf\x7f\x5e\x3d\x7c\xfd\xcd\x15\x57" "\xd6\xb9\xe2\x88\xfe\xd7\x7f\xa9\xb8\x43\x8d\xae\xb8\xff\x95\x22\xf6" "\xee\x7d\x07\xf7\xbf\xbd\xeb\xbd\x54\x94\xe6\x70\xfc\xfc\x9a\x3f\x37" "\x6c\x8c\x17\x7e\xfb\xf5\x07\x76\x66\xcb\x9d\xbc\x77\x23\x9e\x9b\xef" "\x17\x3f\xd9\x8f\x9f\x0c\x88\xff\xfc\x90\xf1\xff\xf4\xa9\xcf\xfc\xe8" "\x95\x01\x79\xd9\xcf\x23\xce\x47\xff\xf8\xbd\xb1\x2a\xed\xc6\xcd\x4a" "\x6b\x7b\xe7\xe2\x66\x63\x75\xa3\xb6\x51\xbb\x51\xad\x5e\x59\xb9\x72" "\xe9\xa5\xcb\x2f\x56\x2b\xc5\x18\x75\x65\x6f\xa4\xfa\x41\xff\x78\xf9" "\xc2\x33\x83\xca\x96\xd7\xff\xc4\x80\xf8\x9d\x57\xfe\xe4\xa1\xfa\x2f" "\xee\x9f\xfb\x85\x21\xeb\xff\x8b\xff\xbd\xf9\x9d\xcf\x1e\x6c\x2e\x1d" "\x8e\xff\xa5\xcf\xf7\x7f\xfd\x9f\x2d\xd6\xfd\x9f\xff\xbc\x4d\xfc\xe2" "\x90\xf1\x57\x4f\xfc\x6a\xe0\xf4\xdd\x79\xfc\xf5\x01\xf5\x7f\xd4\xeb" "\x7f\x61\xc8\xf8\xef\xff\x6d\x67\x7d\xc8\x43\x01\x80\x09\x68\x6d\xef" "\x5c\x5f\xad\xd7\x6b\xb7\x46\x4a\xe4\xef\x42\x3f\xfc\x59\x59\x96\xbd" "\x93\x97\xe1\x21\xc7\xe4\xd9\xc3\x3d\xe0\x5e\x77\x71\xb4\xea\xfc\x25" "\x8a\xc4\xc1\xd3\x92\x44\x12\xa3\x3f\x3f\xf7\x27\xf2\xce\xd8\x30\x07" "\x2f\x8c\x5c\x9d\xfb\x12\x7b\xc3\x25\xe3\xae\x4e\x9f\xc4\xfc\x7e\x5f" "\x71\xbc\x8f\xfc\xed\x87\xff\xb5\x0c\x4a\x2c\x8e\x12\x34\x1d\x7b\x2d" "\x1e\x27\x11\xa7\xbb\x89\xbb\x93\x0a\x3a\x95\xdb\x11\x30\x41\x07\x17" "\xfd\xb4\x4b\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0c\x32" "\x89\xff\xc3\x34\xed\x3a\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x70\x7c\xfd\x3f\x00\x00\xff\xff\x67\x57\xbe\x2d", 1393); syz_mount_image( /*fs=*/0x200000000080, /*dir=*/0x200000000040, /*flags=MS_LAZYTIME|MS_SILENT|MS_NOSUID|MS_MANDLOCK*/ 0x2008042, /*opts=*/0x2000000000c0, /*chdir=*/1, /*size=*/0x571, /*img=*/0x200000000780); break; case 1: // mknod$loop arguments: [ // file: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 30 00} (length 0x8) // } // mode: mknod_mode = 0xc000 (8 bytes) // dev: proc = 0x1 (4 bytes) // ] memcpy((void*)0x200000000080, "./file0\000", 8); syscall(__NR_mknod, /*file=*/0x200000000080ul, /*mode=S_IFSOCK*/ 0xc000ul, /*dev=*/0x701); break; case 2: // mkdirat arguments: [ // fd: fd_dir (resource) // path: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 30 00} (length 0x8) // } // mode: open_mode = 0x0 (8 bytes) // ] memcpy((void*)0x200000000200, "./file0\000", 8); syscall(__NR_mkdirat, /*fd=*/0xffffff9c, /*path=*/0x200000000200ul, /*mode=*/0ul); break; case 3: // mkdirat arguments: [ // fd: fd_dir (resource) // path: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 31 00} (length 0x8) // } // mode: open_mode = 0x1 (8 bytes) // ] memcpy((void*)0x200000000040, "./file1\000", 8); syscall(__NR_mkdirat, /*fd=*/0xffffff9c, /*path=*/0x200000000040ul, /*mode=S_IXOTH*/ 1ul); break; case 4: // mkdirat arguments: [ // fd: fd_dir (resource) // path: ptr[in, buffer] { // buffer: {2e 2f 62 75 73 00} (length 0x6) // } // mode: open_mode = 0x0 (8 bytes) // ] memcpy((void*)0x2000000000c0, "./bus\000", 6); syscall(__NR_mkdirat, /*fd=*/0xffffff9c, /*path=*/0x2000000000c0ul, /*mode=*/0ul); 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; }