// https://syzkaller.appspot.com/bug?id=05b7d384296a75aab127d7fd467706b623a5be05 // 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, 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"); } 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; } #define FS_IOC_SETFLAGS _IOW('f', 2, long) static void remove_dir(const char* dir) { int iter = 0; DIR* dp = 0; const int umount_flags = MNT_FORCE | UMOUNT_NOFOLLOW; retry: while (umount2(dir, umount_flags) == 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, umount_flags) == 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, umount_flags)) 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, umount_flags)) 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) { if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } int i, call, thread; for (call = 0; call < 7; 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) + (call == 5 ? 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 (;;) { 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; } remove_dir(cwdbuf); } } uint64_t r[1] = {0xffffffffffffffff}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: memcpy((void*)0x200000000300, "minix\000", 6); memcpy((void*)0x2000000002c0, "./file2\000", 8); memcpy( (void*)0x200000000080, "\x78\x9c\xec\xdc\x4d\x4f\x13\x41\x1c\xc7\xf1\xdf\x76\x5b\xa8\x68\xc4" "\x87\xf8\x10\x4f\x26\x26\xc6\x8b\x54\x81\x84\xf4\xa4\xbc\x00\xdf\x80" "\x89\x07\x82\x85\x34\x16\x35\xe2\x05\x62\xa2\xbc\x09\xef\x5e\x3d\xf9" "\x12\x4c\xf4\x7d\xf8\x06\xe0\xe0\xcd\x13\x63\x66\x77\x9a\x76\xdb\x85" "\xce\x0e\x6d\x57\xe9\xf7\x93\xd0\xfd\xb3\x9d\xdf\xec\x6c\x61\x86\x6e" "\x1b\x2a\x00\x33\xeb\x69\x72\x1b\x29\x52\x3d\xa9\x8c\x31\x1f\xef\x4a" "\x7a\xfe\x4c\x52\xb5\xe4\xc1\x01\x98\x28\xe3\xb6\xc7\x06\xc0\xec\x89" "\x83\xa7\xfe\x8b\xee\x1a\x02\xe0\xbf\x74\xb4\x1e\x4b\xaa\xeb\x7b\x24" "\xfd\xfa\xfd\x61\xf3\xd0\x7d\xd5\x3d\x9f\x3f\x1c\xad\x57\xd2\x22\x92" "\x0e\xfb\xf2\x17\x7c\xf3\x07\x51\xb2\xbd\x53\xcd\xe6\x17\x24\x5d\x1c" "\x6a\x3d\x7c\x41\x62\xbe\xa4\xf9\xfb\xca\xe6\x2f\x15\x3c\xfe\xc2\x40" "\x5e\x57\x7c\xf3\xe9\xf9\x3f\xb8\xa7\x9a\xfa\xf2\x97\x25\x2d\x4a\x49" "\x37\x57\x25\x5d\x93\x74\x5d\x9a\xb7\x6d\x6f\x48\xaa\x64\x8e\x3f\xe7" "\xbe\xeb\xe5\x6f\xa7\x3b\x0e\x3c\x4f\x03\x00\x00\x00\x00\x80\x53\xd9" "\xab\xcf\xa5\xb3\xe6\x47\x76\x10\x4b\x7a\x94\x7b\x8f\xbd\x0e\xde\x6a" "\x77\x5a\xf9\xf7\x8e\x56\x73\xf9\xc7\x81\xf9\x39\x97\x5f\x3e\x63\x7e" "\xa5\x7f\x67\xe5\xa4\xd6\x51\xaf\xac\xa5\x9b\x79\x97\x5f\xda\x7c\xd3" "\x79\x19\x38\x06\x20\x54\xa5\xd8\xfc\x1f\x7a\x59\xd0\x67\xfe\x9f\x38" "\x1d\xdc\xca\x90\x9d\xff\x35\xff\xd1\xb8\x57\x04\xb7\xda\x9f\x0b\x65" "\x00\xa4\x76\xf7\xf6\x5f\x6d\x74\x3a\xad\x77\xe3\x2c\x9e\x9c\xd6\x46" "\x2a\xda\xa1\x5d\x11\xc6\x3c\xc2\xfc\xe2\xab\x2d\xf4\x27\x7d\x67\x64" "\xc2\xc7\x0a\x29\xec\x62\x1b\x1a\xef\xbe\x21\x13\x10\xef\xfe\xae\xe4" "\xb6\xf9\xa4\xd1\xfd\x18\x8f\x36\xe7\xa9\xa8\x8e\x7c\x9c\xe3\xfc\x07" "\x33\xbf\xf8\xa1\x68\x70\x9e\x56\x33\x93\xe8\x9b\xfb\x01\xd9\x3d\x63" "\x9b\x29\x03\x0b\x45\x3c\xbd\x35\x09\xc0\x74\x34\xde\xef\xbc\x6d\xec" "\xee\xed\x3f\x6c\xef\x6c\x6c\xb7\xb6\x5b\xaf\x57\xd7\x9a\xcd\xb5\xd5" "\x95\xe5\x66\x23\x79\x5a\x6e\x6f\xcd\x62\xd9\xa3\x04\x30\x09\xbd\x3f" "\xfa\x65\x8f\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x84\xba" "\x29\xe9\x56\x52\xfd\x3c\x2e\x10\xf3\xfd\x78\x0f\x00\x00\x00\x00\xff" "\x90\x69\xfc\x53\x54\xd9\xe7\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\xc0\x79\xf7\x37\x00\x00\xff\xff\x7e\x2d\x33\xb1", 523); syz_mount_image(/*fs=*/0x200000000300, /*dir=*/0x2000000002c0, /*flags=MS_I_VERSION|MS_REC|MS_MANDLOCK*/ 0x804040, /*opts=*/0x200000000340, /*chdir=*/-1, /*size=*/0x20b, /*img=*/0x200000000080); break; case 1: memcpy((void*)0x200000000440, "./bus\000", 6); syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000440ul, /*flags=O_SYNC|O_NONBLOCK|O_NOATIME|O_CREAT|O_RDWR*/ 0x141842, /*mode=*/0); break; case 2: memcpy((void*)0x200000000380, "/dev/loop", 9); *(uint8_t*)0x200000000389 = 0x30; *(uint8_t*)0x20000000038a = 0; memcpy((void*)0x200000000140, "./bus\000", 6); syscall(__NR_mount, /*src=*/0x200000000380ul, /*dst=*/0x200000000140ul, /*type=*/0ul, /*flags=MS_BIND*/ 0x1000ul, /*data=*/0ul); break; case 3: memcpy((void*)0x200000000240, "./bus\000", 6); res = syscall( __NR_open, /*file=*/0x200000000240ul, /*flags=O_SYNC|O_NOCTTY|O_DIRECT|O_CLOEXEC|FASYNC|0x2*/ 0x187102ul, /*mode=S_IXOTH*/ 1ul); if (res != -1) r[0] = res; break; case 4: syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0x800000ul, /*prot=PROT_WRITE*/ 2ul, /*flags=MAP_STACK|MAP_POPULATE|MAP_FIXED|MAP_SHARED*/ 0x28011ul, /*fd=*/r[0], /*offset=*/0ul); break; case 5: memcpy((void*)0x2000000005c0, "udf\000", 4); memcpy((void*)0x200000000600, "./file0\000", 8); memcpy( (void*)0x200000000680, "\x78\x9c\xec\xdd\x4f\x6c\x1c\x57\x1d\x07\xf0\xdf\x9b\x78\xed\x75\x1a" "\x27\x9b\x34\x75\x0b\x04\x75\xa5\xaa\x2a\x0a\x22\x8a\x1d\xda\x26\x36" "\x12\x98\x18\x57\x88\xa8\xb1\x70\x1c\x11\x4e\x98\x78\x13\x96\xfa\x4f" "\x64\x27\xc8\xa9\x00\xf5\x06\x07\x24\xc4\x81\x03\x07\x24\x84\x84\x14" "\x81\x40\x88\x23\xe2\x40\x4f\x70\x40\xdc\x81\x7b\x7b\xe0\xe2\x03\x12" "\x12\x07\x84\x66\x76\xd6\xbb\xb1\xb7\xc4\xaa\xb3\x71\x5d\x7f\x3e\x52" "\xbc\xb3\x6f\x7e\xf3\xe6\xcd\x1c\x22\x7d\xf7\xcd\xbe\x0d\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\xe2\xf3\x5f\x98\x3a" "\x3f\x96\xf6\x7b\x14\x00\x00\x00\x40\x3f\xbd\x3e\xf7\xe5\xf3\xe3\xf2" "\x3f\x00\x00\x00\x7c\xa8\x5d\x33\xff\x0f\x00\x00\x00\x00\x00\x00\x00" "\x07\x5d\x8a\x2c\xbe\x17\x29\xbe\x34\xb9\x99\x8e\x15\xef\x5b\xaa\x57" "\x9a\x2b\xf7\x36\xe6\xa7\x67\x7a\x1f\x36\x9c\x8a\x23\x8f\x14\xf5\xf9" "\xbf\xea\xd8\xf8\x85\x4f\xbf\xfc\xca\xab\x17\xdb\xaf\xff\xff\xf8\xc7" "\xed\x23\x71\x75\xee\xda\x54\xfd\xf2\xea\xf2\x9d\xb5\xc6\xfa\x7a\x63" "\xb1\x3e\xbf\xd2\xbc\xb9\xba\xd8\xd8\x75\x0f\x7b\x3d\x7e\xbb\xb3\xc5" "\x0d\xa8\x2f\xbf\x71\x6f\xf1\xd6\xad\xf5\xfa\xf8\xb9\x0b\x0f\xed\xde" "\xa8\xbd\x33\xf4\xd4\x68\x6d\xf2\xe2\xc4\x8d\x5a\xbb\x76\x7e\x7a\x66" "\x66\xae\xab\x66\xa0\xf2\xbe\xcf\xbe\x83\x27\x3c\x00\x00\x00\x0e\xb7" "\xc1\xc8\xe2\xf5\x48\xf1\xf6\x9f\x7f\x93\x46\x22\x22\x8b\xbd\x67\xe1" "\x47\x7c\x76\xd0\x6f\xc3\x51\xcb\xf3\x77\x71\x11\xf3\xd3\x33\xc5\x85" "\x2c\x35\x17\x56\xee\xe6\x3b\x67\xdb\x41\xb8\x56\x5e\x6b\x69\xb0\x9d" "\x91\x9f\x40\x16\xdf\x93\x9f\x45\x9c\xca\xc7\x3a\x28\xd1\x03\x00\x00" "\xb0\x7b\x95\x22\x05\xa7\x78\xed\x77\x9b\xe9\x78\x44\x1c\x69\xe7\xe0" "\x4f\x16\x0b\x03\xbe\xf7\x81\xf5\x27\x38\xc8\x1e\xf2\x71\x9e\x89\x88" "\x17\xe2\x00\x64\x76\x00\x00\x00\xd8\x67\x43\x91\xc5\x4f\x23\xc5\xf2" "\x89\x6a\x9c\xc8\x33\xf3\x7e\x0f\x08\x00\x00\x00\x78\xec\x06\x22\x8b" "\x57\x23\xc5\xbf\x26\x37\x53\xad\x78\x1e\x20\x22\xce\xce\x4f\xcf\xd4" "\xaf\x5c\xaf\x7f\x71\xe5\xd6\x6a\x57\xed\x6c\x2a\x67\xd4\x0f\xfa\xf7" "\x03\x9e\x24\xcf\x26\x00\x00\x00\xf0\x01\x50\x8d\x2c\x46\x8a\x27\xfe" "\x37\xd3\xc9\xfd\x1e\x0c\x00\x00\x00\xd0\x17\xc3\x91\xc5\x5f\x23\xc5" "\xc7\x9e\xff\x56\xb1\xae\x5c\x14\xeb\xd2\x9f\x98\xbc\x34\x38\x3e\xd6" "\xbd\xc2\xdc\xb3\x8f\xe8\x27\xaf\x3d\x17\x11\xcf\xec\xf2\x3b\xf9\x95" "\x72\xad\xc1\xd9\x34\x9b\x52\xf6\xf8\xaf\x0b\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\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\xc3" "\x65\x28\x65\xf1\xdf\x48\xf1\x9d\xeb\xf5\x4e\x63\x2d\x45\x16\x91\xda" "\x6f\xab\xf9\x9f\xd9\xf4\xb9\xe3\xfb\x33\x44\x00\x00\x00\x00\x00\x00" "\x00\xe0\x51\x52\x16\x3f\x8e\x14\x3f\xa9\x6c\xa6\x2c\x22\x36\x6a\xef" "\x0c\x3d\x35\x5a\x9b\xbc\x38\x71\xa3\x76\x24\x8e\x14\x0f\x01\xa4\xee" "\xfa\xab\x73\xd7\xa6\xea\x97\x57\x97\xef\xac\x35\xd6\xd7\x1b\x8b\xf5" "\xf9\x95\xe6\xcd\xd5\xc5\xc6\x6e\x4f\x57\xbd\xd2\x5c\xb9\xb7\x31\x3f" "\x3d\xd3\x97\x8b\x79\xa4\xe1\x3e\x8f\x7f\xb8\x7a\x79\xf5\xce\xfd\xb5" "\xe6\xed\x6f\xdc\xed\xb9\xff\x68\x75\xea\xeb\xeb\x77\xd7\x16\x6e\xf6" "\xde\x1d\xc3\x51\x8f\x38\xd2\xdd\x72\xb6\x18\xf0\xfc\xf4\x4c\x31\xe8" "\xa5\xe6\xc2\x4a\x71\xe8\x6c\xda\xed\x88\x01\x00\x00\x20\xa2\x92\xb2" "\xf8\x4f\xa4\x78\xb1\xfe\x20\x6d\xe5\xce\xd6\xf3\xff\x03\xad\x37\x9d" "\x34\xfa\x8b\xcf\x44\xde\x5e\xa8\x6e\xcf\x9f\xc5\xe7\x06\xc7\x8b\xcf" "\x0d\x5a\xdb\x27\x26\x2f\x55\xc6\x5f\xea\xde\xee\x19\x59\xcf\x16\x81" "\x3a\x0f\xb8\x33\x73\x5d\xcd\x03\x95\x9d\xa5\xf9\x39\x53\xca\x62\x2a" "\x52\xbc\x3b\xf1\x5c\x31\xb2\x14\x47\x63\x47\x66\x8e\x56\xdd\x48\xa4" "\xf8\xe1\x57\xcf\x94\x75\xd9\x60\xd4\x22\xda\xdd\xd6\x5a\x3d\xde\x6a" "\x2e\x35\xce\xe7\xb5\x3f\x8a\x14\xa7\x6f\xb4\x6b\xa3\xa8\xad\x96\xb5" "\x4f\x77\x6a\xc7\xf2\xda\xa1\xbc\xdf\x6b\x0f\xd7\x0e\x97\xb5\xa7\x3b" "\xb5\xe3\x79\xed\x4c\xa4\xf8\xc7\x6b\xbd\x6b\x9f\xe9\xd4\x5e\xc8\x6b" "\x37\x22\xc5\x83\x07\xf5\x76\xed\xd1\xbc\x76\xa4\xac\x1d\xed\xd4\x9e" "\xbb\xb9\xba\xb4\xd8\xeb\x56\x02\x00\x00\x00\x00\x00\x00\x70\x78\x55" "\x52\x16\xbf\x8a\x14\x7f\xfc\x43\x3d\xb5\xe7\xc6\x07\x5a\xf3\xcf\x3b" "\xe7\xff\xbf\xdd\xf9\x2e\xc0\x5b\xdb\x3b\x7a\x8f\x39\xff\xbd\xce\xff" "\xd7\xba\xda\xde\x2a\xe7\xf5\x7f\x90\x8f\xe2\x9b\xcf\x15\x73\xf9\xc5" "\xfc\x7f\xad\xf7\xfc\xff\x54\xa4\xf8\xcb\xd5\x33\x65\x5d\x6b\xee\x7d" "\xb0\xdc\x7f\xb2\xf8\xdb\x99\xff\xbf\x1e\x29\xde\x5e\x7d\xb8\x76\xa8" "\xac\x3d\xd5\xa9\x1d\xdb\xf5\x8d\x05\x00\x00\x80\x0f\x90\x3c\xff\x9f" "\x89\x14\xdf\xff\xd3\xef\x07\xda\xd9\xb8\xcc\xff\x65\x02\xef\x9d\xff" "\x3f\x3a\xb0\xad\xa3\x3e\xe5\xff\x93\x5d\x6d\xf9\x39\xd7\xef\xbf\xf9" "\xc6\xc2\xd2\x52\x63\xcd\x86\x0d\x1b\x36\xb6\x36\xf6\xfe\x7f\x21\x00" "\x00\x7c\xd8\xe5\xf9\xbf\x11\x29\x7e\xfe\xb7\xbf\x6f\xcd\x77\x97\xf9" "\xff\x58\xeb\x5d\x27\xff\xff\xfb\xbb\x9d\xfc\x3f\xb1\xbd\xa3\x3e\xe5" "\xff\x53\x5d\x6d\x13\xe5\x5a\x84\x95\x81\x88\xea\xdd\xe5\x3b\x95\xd1" "\x88\xea\xfa\xfd\x37\x3f\xd5\x5c\x5e\xb8\xdd\xb8\xdd\x58\x19\xbb\xf4" "\xca\xf8\xc5\xf1\xf3\x63\x2f\x57\x06\xdb\x73\xfb\x9d\xad\x3d\xdf\x2a" "\x00\x00\x00\x38\xb0\xf2\xfc\x3f\x17\x29\x7e\xfd\xcf\x5f\x6e\xad\x77" "\xb7\x9b\xf9\xff\xa3\xdb\x3b\xea\x53\xfe\x7f\xba\xab\x2d\x3f\x67\x67" "\xd2\x6f\xcf\x97\x0e\x00\x00\x00\x87\x46\x9e\xff\x2f\x45\x8a\xaf\x3c" "\xff\xdb\xad\x75\xe9\x1f\xce\xff\x9d\xd4\x9e\xe7\xff\xf6\xfa\xff\x9f" "\x78\xa1\xf5\xda\xf9\xcd\x80\xfe\xe4\xff\xd3\x5d\x6d\xb5\xf2\xbc\x3b" "\x3e\x7b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x80\x03\xae\x92\xb2\x78\x29\x52\xbc\xf8\xee\x40\x1a\x29\xdb\x76\xb3" "\xfe\xdf\xe2\xf6\x8e\xfa\xf4\xfd\xff\xd1\xae\xb6\xc5\x78\x32\xbf\xff" "\xb7\xe7\x9b\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x1c\x4a\x59\x64\xd1\x8c\x14\x1f\x7f\x76\x33\x7d" "\x36\x6f\xf8\x5a\xc4\xb1\xee\x57\x00\x00\x00\xe0\xc0\xfb\x5f\x00\x00" "\x00\xff\xff\x4a\xa7\x19\x68", 1469); syz_mount_image(/*fs=*/0x2000000005c0, /*dir=*/0x200000000600, /*flags=MS_SYNCHRONOUS|MS_NOEXEC*/ 0x18, /*opts=*/0x200000000240, /*chdir=*/1, /*size=*/0x5bd, /*img=*/0x200000000680); break; case 6: memcpy((void*)0x200000000040, "cpuacct.usage_sys\000", 18); syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000040ul, /*flags=*/0x275a, /*mode=*/0); 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; use_temporary_dir(); loop(); return 0; }