// https://syzkaller.appspot.com/bug?id=1444535644f9fb5f9a881c9236aa7abf2806f39e // 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 use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } 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, 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 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, loopfd = -1, 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) { memset(loopname, 0, sizeof(loopname)); snprintf(loopname, sizeof(loopname), "/dev/loop%llu", procid); if (setup_loop_device(data, size, loopname, &loopfd) == -1) return -1; 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) { if (strstr(opts, "errors=panic") || strstr(opts, "errors=remount-ro") == 0) strcat(opts, ",errors=continue"); } else if (strcmp(fs, "xfs") == 0) { strcat(opts, ",nouuid"); } 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) { ioctl(loopfd, LOOP_CLR_FD, 0); close(loopfd); } errno = err; return res; } #define FS_IOC_SETFLAGS _IOW('f', 2, long) static void remove_dir(const char* dir) { int iter = 0; DIR* dp = 0; retry: while (umount2(dir, MNT_DETACH | UMOUNT_NOFOLLOW) == 0) { } dp = opendir(dir); if (dp == NULL) { if (errno == EMFILE) { exit(1); } exit(1); } struct dirent* ep = 0; while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); while (umount2(filename, MNT_DETACH | UMOUNT_NOFOLLOW) == 0) { } struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } int i; for (i = 0;; i++) { if (unlink(filename) == 0) break; if (errno == EPERM) { int fd = open(filename, O_RDONLY); if (fd != -1) { long flags = 0; if (ioctl(fd, FS_IOC_SETFLAGS, &flags) == 0) { } close(fd); continue; } } if (errno == EROFS) { break; } if (errno != EBUSY || i > 100) exit(1); if (umount2(filename, MNT_DETACH | UMOUNT_NOFOLLOW)) exit(1); } } closedir(dp); for (int i = 0;; i++) { if (rmdir(dir) == 0) break; if (i < 100) { if (errno == EPERM) { int fd = open(dir, O_RDONLY); if (fd != -1) { long flags = 0; if (ioctl(fd, FS_IOC_SETFLAGS, &flags) == 0) { } close(fd); continue; } } if (errno == EROFS) { break; } if (errno == EBUSY) { if (umount2(dir, MNT_DETACH | UMOUNT_NOFOLLOW)) exit(1); continue; } if (errno == ENOTEMPTY) { if (iter < 100) { iter++; goto retry; } } } exit(1); } } 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"); if (symlink("/dev/binderfs", "./binderfs")) { } } 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) { int i, call, thread; for (call = 0; call < 9; 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++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); reset_loop(); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); setup_test(); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: memcpy((void*)0x200000c0, "nilfs2\000", 7); memcpy((void*)0x200001c0, "./file0\000", 8); memcpy( (void*)0x20000200, "\x00\xdb\x16\x82\x9f\x6f\x99\x74\x76\x6e\x02\x8c\x22\x38\x01\xfb\xf3" "\x46\xfb\xcb\x36\x1a\x39\xdd\xaf\x9d\x9f\xb2\x8d\x24\xc1\x8d\x3c\x0a" "\xf9\xa8\xab\x94\xc7\x94\x1e\x0e\x3c\x94\x75\xe6\x33\x59\xae\xd7\x87" "\x88\xf3\x6d\x3a\x46\xdb\x8a\xec\x83\x3c\x27\xbd\x3e\x04\xb3\x36\xaa" "\xd4\xe9\x44\x58\xea\x4c\x54\xb6\x93\x74\x6f\x77\x8a\xee\x57\x1c\x41" "\x96\x14\x00\x00\x00\x00\x05\x00\x00\x00\xa2\xa5\xd0\x6b\xe4\x98\x80" "\xdb\x3e\x32\x8d\x0e\xd6\xfe\x22\x2f\xcf\xd1\xfc\x41\x11\xdf\x02\x63" "\xd4\xe2\xe0\x5f\x9b\x2b\x79\x69\x94\xe1\x8b\x86\xf1\xe3\xf9\xcf\xaf" "\x3e\xf4\x89\xa9\xa6\x9a\x56\x99\x45\xd6\x5d\x01\x36\x81\xca\x1e\xdb" "\xb1\x9a\x3a\xb3\xd7\x9e\x2c\x96\xa3\xf2\x81", 164); memcpy( (void*)0x20001540, "\x78\x9c\xec\xdd\x4b\x8c\x1c\x47\xdd\x00\xf0\xea\xd9\x9d\xf5\x33\x9f" "\xc7\xf9\x6c\xb2\x38\x26\xb1\x09\x24\xe1\x91\xdd\x78\xbd\x98\x87\x05" "\x71\x14\x5f\xb0\xe2\x88\x5b\xa4\x88\x8b\xe5\x38\xc1\xc2\x31\x08\x47" "\x82\x44\x39\xd8\x3e\x71\x23\x51\x64\xae\x3c\xc4\x29\x97\x08\x10\x12" "\xb9\x20\x2b\x27\x2e\x91\x88\x25\x2e\x39\x05\x0e\x1c\xb0\x8c\x14\x89" "\x03\x04\xec\x45\xde\xad\x9a\x9d\xfd\x7b\x46\x3d\xb3\xb6\x77\x76\x76" "\x7e\x3f\xa9\xb6\xa6\xba\x6a\xa6\xaa\x67\x7b\x7a\x7a\xba\xbb\xaa\x12" "\x30\xb6\x1a\x8b\x7f\xe7\xe7\xa7\xab\x94\x2e\xbd\xf3\xe6\xd1\xbf\x3f" "\xfc\xb7\x2d\x37\x97\x3c\xd1\x2e\xd1\x5a\xfc\x3b\xd9\x91\x6a\xa6\x94" "\xaa\x9c\x9e\x0c\xaf\xf7\xe1\xc4\x52\x7c\xfd\xa3\xd7\x4e\x76\x8b\xab" "\x34\xb7\xf8\xb7\xa4\xd3\x33\xd7\xda\xcf\xdd\x96\x52\x3a\x9f\xf6\xa5" "\xcb\xa9\x95\xf6\x5c\xba\xf2\xc6\x7b\x73\x4f\x1f\xbf\x70\xec\xe2\xfe" "\xf7\xdf\x3a\x7c\xf5\xee\xac\x3d\x00\x00\x8c\x97\x6f\x5d\x3e\x3c\xbf" "\xfb\x2f\x7f\xba\x7f\xe7\xc7\x6f\x3f\x70\x24\x6d\x6a\x2f\x2f\xc7\xe7" "\xad\x9c\xde\x9e\x8f\xfb\x8f\xe4\x03\xff\x72\xfc\xdf\x48\x2b\xd3\x55" "\x47\xe8\x34\x15\xca\x4d\xe6\xd0\x08\xe5\x26\xba\x94\xeb\xac\xa7\x19" "\xca\x4d\xf6\xa8\x7f\x2a\xbc\x6e\xb3\x47\xb9\x4d\x35\xf5\x4f\x74\x2c" "\xeb\xb6\xde\x30\xca\xca\x76\xdc\x4a\x55\x63\x66\x45\xba\xd1\x98\x99" "\x59\xfa\x4d\x9e\x16\x7f\xd7\x4f\x55\x33\x67\x4f\x9f\x79\xe1\xdc\x90" "\x1a\x0a\xdc\x71\xff\x7c\x30\xa5\xb4\x4f\x10\x84\x71\x0c\x0b\x3b\x86" "\xbd\x07\x02\x58\x12\xaf\x17\xde\xe2\x7c\x3c\xb3\x70\x7b\xda\xaf\x36" "\xd9\x5f\xfd\xd7\x9e\x6c\x74\x7f\x3e\xdc\x01\x6b\xbd\xfd\xab\x7f\xb4" "\xea\xff\xd5\x05\x7b\x1c\xee\x9c\x8d\xba\x35\x95\xf5\x2a\x9f\xa3\xed" "\x39\x1d\xaf\x23\xc4\xfb\x97\x06\xfd\xfc\x97\xd7\x8b\xd7\x23\x9a\x7d" "\xb6\xb3\xd7\x75\x84\x51\xb9\xbe\xd0\xab\x9d\x13\x6b\xdc\x8e\xd5\xea" "\xd5\xfe\xb8\x5d\x6c\x54\x5f\xcf\x71\x79\x1f\xbe\x11\xf2\x3b\x3f\x3f" "\xf1\x7f\x3a\x2a\xff\x63\xa0\xbb\x7f\x39\xff\x2f\x08\x63\x1b\x16\x86" "\xbd\x03\x02\xd6\xad\x78\xdf\xdc\x42\x56\xf2\xe3\x7d\x7d\x31\x7f\x53" "\x4d\xfe\xe6\x9a\xfc\x2d\x35\xf9\x5b\x6b\xf2\xb7\xd5\xe4\xc3\x38\xfb" "\xed\xcb\x3f\x49\xaf\x57\xcb\xbf\xf3\xe3\x6f\xfa\x41\xcf\x87\x95\xf3" "\x6c\xf7\xe4\xf8\xff\x06\x6c\x4f\x3c\x1f\x39\x68\xfd\xf1\xbe\xdf\x41" "\xdd\x6e\xfd\xf1\x7e\x62\x58\xcf\x7e\x7f\xe2\xd9\x53\x5f\x79\xfe\xb9" "\x2b\x4b\xf7\xff\x57\xed\xed\xff\x46\xde\xde\xf7\xe5\x74\x2b\x7f\xb6" "\x2e\xe7\x02\xe5\x7c\x61\x3c\xaf\xde\xbe\xf7\xbf\xb5\xb2\x9e\x46\x8f" "\x72\xf7\x86\xf6\xdc\xd3\xa5\xfc\xe2\xe3\x5d\x2b\xcb\x55\xbb\x96\x5f" "\x27\x75\xec\x67\x6e\x69\xc7\xf4\xca\xe7\xed\xe8\x55\x6e\xef\xca\x72" "\xad\x50\x6e\x4b\x0e\x9b\x43\x7b\xe3\xf1\xc9\xd6\xf0\xbc\x72\xfc\x51" "\xf6\xab\xe5\xfd\x9a\x0c\xeb\xdb\x0c\xeb\x31\x15\xda\x51\xf6\x2b\x3b" "\x73\x1c\xdb\x01\xab\x51\xb6\xc7\x5e\xf7\xff\x97\xed\x73\x3a\x35\xab" "\x17\x4e\x9f\x39\xf5\x78\x4e\x97\xed\xf4\x8f\x13\xcd\x4d\x37\x97\x1f" "\x58\xe3\x76\x03\xb7\xaf\xdf\xfe\x3f\xd3\x69\x65\xff\x9f\xed\xed\xe5" "\xcd\x46\xe7\x7e\x61\xc7\xf2\xf2\xaa\x73\xbf\xd0\x0a\xcb\xe7\x7a\x2c" "\x3f\x98\xd3\xe5\x7b\xee\x3b\x13\x5b\x16\x97\xcf\x9c\xfc\xde\x99\xe7" "\xef\xf4\xca\xc3\x98\x3b\xf7\xca\xab\xdf\x3d\x71\xe6\xcc\xa9\x1f\x78" "\xe0\x81\x07\x1e\xb4\x1f\x0c\x7b\xcf\x04\xdc\x6d\xb3\x2f\xbf\xf4\xfd" "\xd9\x73\xaf\xbc\xfa\xd8\xe9\x97\x4e\xbc\x78\xea\xc5\x53\x67\x0f\x1e" "\x3a\x74\x70\x6e\xee\xd0\x57\x0f\xce\xcf\x2e\x1e\xd7\xcf\x76\x1e\xdd" "\x03\x1b\xc9\xf2\x97\xfe\xb0\x5b\x02\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\xf4\xeb\x87\xc7\x8e\x5e\xf9\xf3\xbb\x5f\xfe\x60\xa9\xff\xff\x72" "\xff\xbf\xd2\xff\xbf\xdc\xf9\x5b\xfa\xff\xff\x38\xf4\xff\x8f\xfd\xe4" "\x4b\x3f\xf8\xd2\x0f\x70\x67\x97\xfc\xc5\x32\x61\x80\xd5\xa9\x50\xae" "\x99\xc3\xff\x87\xf6\xee\x0a\xf5\xec\x0e\xcf\xfb\x44\x8e\xdb\xf3\xf8" "\xe5\xfe\xff\xa5\xba\x38\xae\x6b\x69\xcf\x7d\x61\x79\x1c\xbf\xb7\x94" "\x0b\xc3\x09\xdc\x32\x5e\xca\x54\x18\x83\x24\xce\x17\xf8\xe9\x1c\x5f" "\xcc\xf1\x2f\x13\x0c\x51\xb5\xa5\xfb\xe2\x1c\xd7\x8d\x6f\x5d\xb6\xf5" "\x32\x3e\x85\x71\x29\x46\x53\xf9\xbf\x95\xad\xa1\x8c\x63\x52\xfa\x7f" "\xf7\x1a\xd7\xa9\xec\xff\x77\xae\x41\x1b\xb9\xf3\xd6\xa2\x3b\xe1\xb0" "\xd7\x11\xe8\xee\x1f\xc6\xff\x16\x84\xb1\x0d\x0b\x0b\x66\xf1\x00\xd6" "\x87\x61\xcf\xff\x59\xce\x7b\x96\xf8\xec\x1f\xbe\xb9\xf9\x66\x28\xc5" "\xae\x3d\xb9\x72\x7f\x19\xc7\x2f\x85\xdb\xb1\xde\xe7\x9f\x54\xff\xc6" "\x9a\xff\xb3\x3d\xff\x5d\xdf\xfb\xbf\x30\x63\x5e\x6b\x75\xf5\xfe\xfb" "\x67\x57\x3f\xe8\xa8\x36\xed\xe9\xb7\xfe\xb8\xfe\x65\x1c\xe8\x5d\x83" "\xd5\xff\x71\xae\xbf\xac\xcd\x23\xa9\xbf\xfa\x17\x7e\x11\xea\x8f\x17" "\x84\xfa\xf4\x9f\x50\xff\xd6\x3e\xeb\xbf\x65\xfd\xf7\xae\xae\xfe\xff" "\xe6\xfa\xcb\xdb\xf6\xe8\x43\xfd\xd6\xbf\xd4\xe2\xaa\xb1\xb2\x1d\xf1" "\xbc\x71\xb9\xfe\x17\xcf\x1b\x17\xd7\xc3\xfa\x97\xb1\x3d\x07\x5e\xff" "\x55\x4e\xd4\x78\x23\xd7\x0f\xe3\x6c\x54\xe6\x99\x1d\xd4\xa8\xcc\xff" "\xdb\x4b\xbc\x0f\xe3\x4b\x39\x5d\x76\x84\xe5\x3e\x87\x38\xdf\xc9\xa0" "\xed\x2f\xf7\x57\x94\xef\x81\xdd\xe1\xf5\xab\x9a\xef\x37\xf3\xff\x8e" "\xb6\xaf\xe5\xb8\xee\xf3\x50\xe6\xff\x2d\xdb\x63\xab\x4b\xba\xd1\x91" "\x6e\x76\x79\x6f\x37\xea\xbe\x06\x46\xd5\x87\xae\xff\x09\xc2\xd8\x86" "\x85\x85\x85\xbb\x7b\x42\xab\xc6\x50\x2b\x67\xe8\xef\xff\xb0\x7f\x27" "\x0c\xbb\xfe\x61\xbf\xff\x75\xe2\xfc\xbf\xf1\x18\x3e\xce\xff\x1b\xf3" "\xe3\xfc\xbf\x31\x3f\xce\xff\x1b\xf3\xe3\xfc\x7a\x31\x3f\xce\xff\x1b" "\xdf\xcf\x38\xff\x6f\xcc\xbf\x2f\xbc\x6e\x9c\x1f\x78\xba\x26\xff\x93" "\x35\xf9\x7b\x6a\xf2\xef\xaf\xc9\xdf\x5b\x93\xff\xa9\x9a\xfc\xfd\x35" "\xf9\x0f\xd4\xe4\x3f\x58\x93\x7f\x6f\x4d\xfe\x43\x35\xf9\x9f\xa9\xc9" "\xff\x6c\x4d\xfe\xc3\x35\xf9\x8f\xd6\xe4\x7f\xae\x26\x7f\xa3\x2b\xfd" "\x51\xc6\x75\xfd\x61\x9c\xc5\xfe\x79\x3e\xff\x30\x3e\xca\xf5\x9f\x5e" "\x9f\xff\x5d\x35\xf9\xc0\xe8\xfa\xe9\xdb\x07\x9e\x7a\xee\x37\xdf\x6e" "\x2d\xf5\xff\x9f\x6a\x9f\x0f\x29\xd7\xf1\x8e\xe4\x74\x33\xff\x76\xfe" "\x51\x4e\xc7\xeb\xde\xa9\x23\x7d\x33\xef\xdd\x9c\xfe\x6b\xc8\x5f\xef" "\xe7\x3b\x60\x9c\xc4\xf1\x33\xe2\xf7\xfb\x23\x35\xf9\xc0\xe8\x2a\xf7" "\x79\xf9\x7c\xc3\x18\xaa\xba\x8f\xd8\xd3\xef\xb8\x55\xbd\x8e\xf3\x19" "\x2d\x9f\xcf\xf1\x17\x72\xfc\xc5\x1c\x3f\x96\xe3\x99\x1c\xcf\xe6\xf8" "\x40\x8e\xe7\xd6\xa8\x7d\xdc\x1d\x4f\xfd\xfa\x77\x87\x5f\xaf\x96\x7f" "\xef\xef\x08\xf9\xfd\xde\x4f\x1e\xfb\x03\xc5\x71\xa2\x0e\xf6\xd9\x9e" "\x78\x7e\x60\xd0\xfb\xd9\xe3\x38\x7e\x83\xba\xdd\xfa\x57\xd9\x1d\x0c" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x60\x68\x1a\x8b\x7f\xe7\xe7\xa7\xab\x94" "\x2e\xbd\xf3\xe6\xd1\x67\x8f\x9f\x9e\xbd\xb9\xe4\x89\x76\x89\xd6\xe2" "\xdf\xc9\x8e\x54\xb3\xfd\xbc\x94\x1e\xcf\xf1\x44\x8e\x7f\x9e\x1f\x5c" "\xff\xe8\xb5\x93\x9d\xf1\x8d\x1c\x57\x69\x2e\x55\xa9\x6a\x2f\x4f\xcf" "\x5c\x6b\xd7\xb4\x2d\xa5\x74\x3e\xed\x4b\x97\x53\x2b\xed\xb9\x74\xe5" "\x8d\xf7\xe6\x9e\x3e\x7e\xe1\xd8\xc5\xfd\xef\xbf\x75\xf8\xea\xdd\x7b" "\x07\x00\x00\x00\x60\xe3\xfb\x5f\x00\x00\x00\xff\xff\x7c\x09\x0d\x9d", 2567); syz_mount_image(0x200000c0, 0x200001c0, 0x808, 0x20000200, 1, 0xa07, 0x20001540); break; case 1: memcpy((void*)0x200000c0, "./bus\000", 6); res = syscall(__NR_open, 0x200000c0ul, 0x14da42ul, 0ul); if (res != -1) r[0] = res; break; case 2: memcpy((void*)0x20000040, "/proc/self/exe\000", 15); res = syscall(__NR_openat, -1, 0x20000040ul, 0ul, 0ul); if (res != -1) r[1] = res; break; case 3: syscall(__NR_sendfile, r[0], r[1], 0ul, 0x80001d00c0d0ul); break; case 4: syscall(__NR_open, 0ul, 0x11d140ul, 0ul); break; case 5: memcpy((void*)0x20000380, "/dev/loop", 9); *(uint8_t*)0x20000389 = 0x30; *(uint8_t*)0x2000038a = 0; memcpy((void*)0x200003c0, "./bus\000", 6); syscall(__NR_mount, 0x20000380ul, 0x200003c0ul, 0ul, 0x1000ul, 0ul); break; case 6: memcpy((void*)0x200000c0, "./bus\000", 6); res = syscall(__NR_open, 0x200000c0ul, 0x14da42ul, 0ul); if (res != -1) r[2] = res; break; case 7: memcpy((void*)0x20000040, "/proc/self/exe\000", 15); res = syscall(__NR_openat, -1, 0x20000040ul, 0ul, 0ul); if (res != -1) r[3] = res; break; case 8: syscall(__NR_sendfile, r[2], r[3], 0ul, 0x80001d00c0d0ul); break; } } int main(void) { syscall(__NR_mmap, 0x1ffff000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul); syscall(__NR_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x32ul, -1, 0ul); syscall(__NR_mmap, 0x21000000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul); use_temporary_dir(); loop(); return 0; }