// https://syzkaller.appspot.com/bug?id=d4a58de9696a60f9c0d79531cdc0d622e474e786 // 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 __thread int clone_ongoing; static __thread int skip_segv; static __thread jmp_buf segv_env; static void segv_handler(int sig, siginfo_t* info, void* ctx) { if (__atomic_load_n(&clone_ongoing, __ATOMIC_RELAXED) != 0) { exit(sig); } uintptr_t addr = (uintptr_t)info->si_addr; const uintptr_t prog_start = 1 << 20; const uintptr_t prog_end = 100 << 20; int skip = __atomic_load_n(&skip_segv, __ATOMIC_RELAXED) != 0; int valid = addr < prog_start || addr > prog_end; if (skip && valid) { _longjmp(segv_env, 1); } exit(sig); } static void install_segv_handler(void) { struct sigaction sa; memset(&sa, 0, sizeof(sa)); sa.sa_handler = SIG_IGN; syscall(SYS_rt_sigaction, 0x20, &sa, NULL, 8); syscall(SYS_rt_sigaction, 0x21, &sa, NULL, 8); memset(&sa, 0, sizeof(sa)); sa.sa_sigaction = segv_handler; sa.sa_flags = SA_NODEFER | SA_SIGINFO; sigaction(SIGSEGV, &sa, NULL); sigaction(SIGBUS, &sa, NULL); } #define NONFAILING(...) \ ({ \ int ok = 1; \ __atomic_fetch_add(&skip_segv, 1, __ATOMIC_SEQ_CST); \ if (_setjmp(segv_env) == 0) { \ __VA_ARGS__; \ } else \ ok = 0; \ __atomic_fetch_sub(&skip_segv, 1, __ATOMIC_SEQ_CST); \ ok; \ }) 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) { 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) { 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 < 8; 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); if (call == 6) break; event_timedwait(&th->done, 50 + (call == 0 ? 4000 : 0) + (call == 1 ? 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[1] = {0xffffffffffffffff}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: NONFAILING(memcpy((void*)0x20000040, "hfs\000", 4)); NONFAILING(memcpy((void*)0x20000080, "./bus\000", 6)); NONFAILING(memcpy((void*)0x20000480, "file_umask", 10)); NONFAILING(*(uint8_t*)0x2000048a = 0x3d); NONFAILING(sprintf((char*)0x2000048b, "%023llo", (long long)1)); NONFAILING(*(uint8_t*)0x200004a2 = 0x2c); NONFAILING(memcpy((void*)0x200004a3, "codepage", 8)); NONFAILING(*(uint8_t*)0x200004ab = 0x3d); NONFAILING(memcpy((void*)0x200004ac, "iso8859-2", 9)); NONFAILING(*(uint8_t*)0x200004b5 = 0x2c); NONFAILING(memcpy((void*)0x200004b6, "quiet", 5)); NONFAILING(*(uint8_t*)0x200004bb = 0x2c); NONFAILING(memcpy((void*)0x200004bc, "file_umask", 10)); NONFAILING(*(uint8_t*)0x200004c6 = 0x3d); NONFAILING(sprintf((char*)0x200004c7, "%023llo", (long long)0x1304)); NONFAILING(*(uint8_t*)0x200004de = 0x2c); NONFAILING(memcpy((void*)0x200004df, "quiet", 5)); NONFAILING(*(uint8_t*)0x200004e4 = 0x2c); NONFAILING(memcpy((void*)0x200004e5, "quiet", 5)); NONFAILING(*(uint8_t*)0x200004ea = 0x2c); NONFAILING(*(uint8_t*)0x200004eb = 0); NONFAILING(memcpy( (void*)0x20000b00, "\x78\x9c\xec\xdd\xc1\x4e\x13\x41\x1c\xc7\xf1\xdf\x6c\x5b\x40\x21\xb8" "\x82\xc6\xc4\x23\x4a\xa2\x17\x03\x78\x31\x5e\x6a\x4c\x1f\xc2\x93\x51" "\x69\x4d\x88\x0d\x46\xc5\x44\xb8\x88\xc6\xa3\xf1\x01\xbc\xfb\x0a\x3e" "\x84\x1e\x34\xbe\x00\x9e\x3c\xf9\x00\xdc\xd6\xcc\xec\x74\xd9\x85\xdd" "\x6e\x85\xd2\x85\xf2\xfd\x24\x6d\x76\xbb\x33\x3b\xff\xe9\xcc\x74\x66" "\x4a\x48\x05\xe0\xcc\xba\xdf\xda\xf9\x72\xfb\x8f\x7d\x18\xa9\xa6\x9a" "\xa4\xbb\x52\x20\x69\x4a\xaa\x4b\xba\xac\x2b\x53\xaf\xd7\x37\xd6\x36" "\xba\x9d\x76\xbf\x1b\xd5\x5c\x0e\xfb\x30\x8a\x73\x1a\x7f\xc5\x24\x69" "\x56\xd7\x3b\x79\x59\x6d\x3e\x97\xc3\x0b\xed\x59\x5d\x33\xe9\xd7\x70" "\x3c\xa2\x28\xba\xf7\xbb\xea\x20\x50\x39\x37\xfa\xa5\x46\xea\xdc\x09" "\xa4\x49\x3f\x3a\xed\xf5\x78\xac\x8e\x81\xed\xaa\x03\xa8\x98\xd9\xd5" "\xae\xde\x68\xb6\xea\x38\x00\x00\xd5\xf2\xf3\x7f\xe0\xe7\xf9\x19\xbf" "\x04\x08\x02\x69\xd1\x4f\xfb\x63\x30\xff\x47\x6f\x7b\x7b\x8a\xdd\xaa" "\x43\x39\x76\x51\xdf\xab\xa9\xf9\xdf\xbd\x23\x91\xb1\xed\x7b\xc1\x5d" "\xda\xdb\xef\xb9\x55\xa0\xbd\x1e\xf4\x76\x89\x83\x94\xdc\xd8\x77\x3e" "\xa1\xb8\x67\xd5\x32\x01\x94\xed\x2a\x5d\x2c\xc1\xb9\xa7\x6b\xdd\xce" "\xad\xd5\xe7\xdd\x76\xa0\xf7\x6a\x7a\xa9\x64\xef\xdc\x73\x3b\xee\xba" "\x3d\x25\xd1\x2e\xa4\xf6\xa4\x03\x18\xa0\xee\x26\x7f\x45\x39\xed\xea" "\xd0\xb0\x75\x58\x29\x88\x7f\xfe\x90\x25\x1e\x9a\xf9\x66\x7e\x9a\x87" "\x26\xd4\x67\xb5\x93\xf5\x5f\x3d\x32\xb6\x99\x5c\x4b\x85\xfb\x5a\x2a" "\x8e\x7f\xa9\xf8\x8e\xae\x96\xa1\x4d\x25\xff\xb1\xd1\x6c\x36\x83\x4c" "\x92\x8b\xae\x90\xab\xbe\x04\xaf\xa4\x96\x53\xd9\x30\xd2\x26\xfc\x3d" "\x27\xd3\x2f\x86\x65\x71\xba\x5c\x73\xca\x7e\xad\x10\xd7\x6e\xb9\x24" "\xd7\x7c\x6e\xae\x95\xde\x59\x41\xae\x4b\x99\x5c\xb6\x36\x49\x6f\x2e" "\x2e\xef\xc8\x4a\xfa\xb6\xf9\x64\x1e\x98\x05\xfd\xd5\x57\xb5\x52\xeb" "\xff\xc0\xc6\xb7\x28\x3f\x32\x4d\xc9\xf7\x3d\xc6\xa5\xf4\x3d\x23\xae" "\xcf\x44\x7e\xca\xba\x4b\x19\x1e\x98\x39\x0e\x0e\x97\xe4\x5d\x9c\xec" "\x5f\x01\x0c\xc3\x47\x3d\xd1\x1d\xcd\xbe\xda\xdc\x7a\x56\xeb\x76\x3b" "\x2f\xed\xc1\xe3\x9c\x83\x17\x33\xc9\x2b\x8d\x0f\x52\x6e\x9a\xde\x81" "\xf1\xbd\xbd\x5f\x9a\x63\x38\xd0\x76\x5c\xba\xaf\x59\x64\xe5\x26\xb6" "\xe1\xe5\xdc\x67\xd5\x77\xb8\xa1\x07\x76\x73\xa8\x37\xb4\x9f\x1f\xa5" "\x89\xed\x28\x1b\x52\xa1\xd2\xc8\x5a\xf0\xf4\x1c\xd8\xb5\xcd\xe6\x56" "\xeb\x47\x7e\x6f\xe9\x0d\xae\x13\x11\xea\x11\x0f\xaa\xf8\x50\xc2\xa8" "\xed\x35\xba\xf8\x73\xcb\xd9\x64\xd7\x5d\x26\xde\xff\xa5\xf6\x2b\x4b" "\x6e\x3a\xb5\x4f\xe1\xce\xf7\xc2\xbc\xfd\x37\x99\xd9\x1d\xd0\x72\xb2" "\x03\xca\x2e\x05\xe7\xdc\xf3\xf9\xff\xda\xc1\x4d\x17\xaf\x72\x07\xdd" "\x73\x5d\xbb\x21\x5d\x1f\xbc\xc4\xd0\xc7\x39\x26\x4c\x4b\xbf\xf4\x88" "\xef\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x4e\x9b\x51\xfc\x3b\x41\xd5\x75\x04\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\xe0\xb4\x1b\xc1\xef\xff\xee\xe1\xf7" "\x7f\x81\x13\xe5\x5f\x00\x00\x00\xff\xff\x5a\x06\x69\x35", 694)); NONFAILING(syz_mount_image( /*fs=*/0x20000040, /*dir=*/0x20000080, /*flags=*/0x180008a, /*opts=*/0x20000480, /*chdir=*/1, /*size=*/0x2b6, /*img=*/0x20000b00)); break; case 1: NONFAILING(memcpy((void*)0x200000c0, "hfs\000", 4)); NONFAILING(memcpy((void*)0x20000140, "./bus\000", 6)); NONFAILING(memcpy( (void*)0x200001c0, "\x74\x00\x00\x65\x3d\x85\xe7\xbc\xb7\x2c\x63\x6f\x64\x65\x70\x61\x67" "\x65\x3d\x75\x5c\x66\x38\x2c\x69\x6f\x63\x68\x61\x72\x7a\x65\x74\x3d" "\x63\x70\x38\x37\x34\xb9\x00\x00\x00\x00\x00\x00\x00\x3d\x30\x78\x66" "\x66\x66\x66\x66\x66\x66\x66\x66\x66\x66\x66\x66\x66\x66\x65\x57\xee" "\x7a\xef\x08\xdf\x18\xab\x68\xf7\x86\x28\xae\xb7\xd5\x20\x2c\x00\xff" "\xaf\xca\xff\x17\x38\xf1\x11\x0f\x46\x6b\x2d\xbd\xb5\x99\xc1\x42\x71" "\xf1\xe1\xdd\xa4\xd4\xc6\x78\xd8\x82\xe5\x35\xdc\x13\x8e\xab\x8a\xeb" "\x0b\x0e\x82\xf1\x71\x3b\x32\x57\xd3\x92\x4f\x6b\xa7\x83\x3c\x65\xf6" "\x68\x5b\xe0\x1d\x7b\x83\x26\x96\xc3\x63\xc6\xdc\xff\xec\xe7\x71\xf3" "\xc8\x5a\xe5\x83\xf3\x98\x07\x74\xba\x5c\x74\xb8\xdc\x69\x87\x6d\xad" "\x84\x10\x0a\x53\x4a\x78\xa9\xf7\x3d\xbd\xae\x52\xeb\x4e\x27\x82\xb8" "\x15\x55\xc7\x42\x47\x43\x65\x87\x1f\xe2\x06\xdb\xa2\xe6\xfc\xa9\xbf" "\x09\x01\xf3\x4d\x1b\x71\xf5\xb5\x2f\x1e\x8d\x50\x5c\x68\xab\xe4\x59" "\xf5\x8d\x0e\x4d\x40\x5c\xdf\x2c\x9d\x21\xd5\x96\x58\x45\xfa\x59\x5d" "\x32\xda\x02\x22\x17\x4a\xf1\x77\xdc\x5f\xcd\x34\x05\xd8\x51\x2c\x72" "\x8a\xf2\xe2\xa4\x38\x6e\xe1\x4a\x64\x18\xd1\xe7\x5f\x71\x22\x26\xf6" "\x20\x8e\x2f\xa4\xcb\x20\x09\xde\x1c\x2a\x66\x13\xb3\x0d\x1b\x47\x50" "\xba\x55\x85\xcb\x04\xc0\x5f\x7d\xc2\x79\x7e\x16\x1f\x8d\xcd\xb2\xa1" "\xfd\xad\xbf\x96\xee\x0c\xa2\xc9\x7b\xa7\x8b\x35\x6d\x00\x57\xe1\xc0" "\xc9\xbe\x98\xe0\xaf\x46\x6e\x06\x8d\x9a\x92\x69\xfc\x37\xdb\xb2\xd3" "\xc6\x17\x2e\x39\xa8\xd0\x7b\x91\xb8\x9d\x00\x1d\x7e\x59\x04\xd8\xd9" "\x0c\xd6\xaf\x96\x83\x11\x22\x44\x1c\x38\x61\x55\x64\x38\x2a\x16\x39" "\xa4\xdb\x99\xd5\x5b\xdd\x40\x7d\xbd\xec\xa8\x3b\xfa\x90\xfa\x02\xcd" "\xfd\xf7\x27\x9b\xe7\x64\x41\x5e\x3f\x70\xa9\xce\xd9\x1e\x65\xf6\xa2" "\xcb\x40\xf9\x73\xe2\x03\xb8\x92\xc9\x65\x63\x18\xb6\x96\x43\x93\x9c" "\x7a\xc3\x47\x94\xcf\x45\x10\xef\xd7\xba\x79\x39\x58\x96\xea\xf1\x6a" "\x5f\x4c\x5a\xe7\xcb\x7e\x00\x1a\x40\x69\x3c\xa4\xdc\xd4\x2d\xbf\x2a" "\xde\xf7\x2a\x0f\xe3\x9f\x3a\x28\xc7\xa1\x74\xdf\xb9\x4c\xf1\x7b\xe8" "\x48\xec\xbc\x33\xf8\x2e\x4e\x7c\xc4\x8b\x42\xef\x9e\x1d\x89\x38\x2b" "\x06\xd8\x91\x47\x6a\xae\xdd\x87\xf1\x6d\x04\x73\x8c\x8f\x61\x1f\x86" "\x34\x25\xd2\x8b\xb0\x53\xaa\x8f\xa2\x78\x1f\xe4\x6c\x2a\x76\x4c\x23" "\x55\xec\x33\x83\xad\x00\x65\x71\x68\x4a\x27\x58\x06\xa3\x69\x36\x60" "\x13\x1b\xd4\xce\x99\xf3\xbb\xa6\x74\xa4\x53\x70\x19\xd9\x80\x30\xd6" "\x12\x8b\xdc\xd7\x4e\x6c\x19\x99\x46\x0c\x93\x92\x55\x5b\xb3\x07\xc5" "\x1d\xeb\x7d\x7c\x86\xa1\xdf\x31\x7a\xe8\x38\x2f\x3d\x89\x62\x5d\x5d" "\x61\x21\x8d\x1d\xe4\xa2\xef\x8c\x92\xce\xbe\xef\xb6\x45\x0d\x30\xd9" "\x03\x24\xc2\x5d\x6c\x2e\xe4\x82\x6c", 621)); NONFAILING(memcpy( (void*)0x20000840, "\x78\x9c\xec\xdd\xbf\x6e\xd3\x5c\x18\xc7\xf1\xdf\x71\xd2\x36\x7d\x5b" "\xf5\x75\xff\xa0\x4a\x8c\x85\x4a\x4c\x88\x96\x05\xb1\x80\x50\x2e\x82" "\x01\x21\xa0\x09\x52\x45\x54\x24\x28\x12\x30\x21\x66\x84\xd8\x90\xd8" "\xd9\x98\x11\x37\xc0\xc2\x84\x58\x18\x61\x62\xe2\x02\xb2\x19\x9d\x63" "\x27\xb1\x13\xdb\x71\x42\x1a\xa7\xe1\xfb\x91\x1a\x25\xf5\x79\x7c\x9e" "\x63\x3b\xf1\x79\x2c\x25\x16\x80\x7f\xd6\x8d\xfa\x8f\xf7\x97\x7f\xd9" "\x3f\x23\x55\x54\x91\x74\x55\xf2\x24\xd5\xa4\xaa\xa4\x33\xda\xae\x3d" "\x39\x3a\x3e\x3c\x6e\x35\x1b\xc9\xd0\xef\x89\x57\x15\x17\x61\xff\x8c" "\xc2\x48\x33\xd0\xd9\xc1\x51\x33\x2d\x07\x1b\xe7\x22\x22\xbe\x7d\x55" "\xd5\x6a\xfc\x7f\x7d\x96\x47\x1e\x28\x52\x05\x41\x10\xfc\x2c\x3b\x09" "\x94\xce\xbd\xfb\x53\x78\xd2\x52\xf4\xee\x74\xcb\x6b\x53\xcf\xec\x64" "\xbc\x28\x3b\x81\x92\x99\xb6\xda\x7a\xaa\xb5\xb2\xf3\x00\x00\x94\x2b" "\x3a\xff\x7b\xd1\x79\x7e\x35\x9a\xbf\x7b\x9e\xb4\x1b\x9d\xf6\xe7\xea" "\xfc\xdf\x2e\x3b\x81\x92\xc5\xce\xff\xae\xca\x0a\x8c\xdd\xbf\xff\xbb" "\x45\xbd\x7a\xcf\x95\x70\x76\xb9\xd7\xa9\x12\x73\xd6\x98\xb9\x64\x51" "\xe1\x91\x95\x98\x60\x9a\x8c\xaa\xb2\xcb\xe5\xe2\x2d\xdf\x3f\x6c\x35" "\x2f\x1e\x3c\x6c\x35\x3c\xbd\xd4\xb5\x48\xac\xd9\x96\x7b\x6c\x84\x87" "\x6e\xc7\x90\x6c\x77\x72\x92\x4d\x31\x7c\xec\x59\x56\xdc\x18\x16\xec" "\x18\xf6\x33\xf2\xdf\x1c\xa7\xc7\xb7\xa3\xa7\xd2\x65\xbe\x98\xaf\xe6" "\xb6\xf1\xf5\x4e\x8d\xee\xfc\xaf\x1a\x18\xbb\x9b\xdc\x9e\xf2\xdd\x9e" "\xf2\xbb\x01\x61\xfe\x97\xb2\xd7\xe8\x46\xe9\x87\xad\x32\x46\xb9\xee" "\x3a\x39\x1b\xf5\xa0\x4f\x1f\x0a\x8c\xb2\x96\x5e\x91\xa8\x73\x44\xad" "\x2b\x79\x81\xc0\xef\xe4\xf9\x66\x31\x27\x6a\xa3\x2f\x2a\x1c\xdd\x5e" "\xf6\xe8\x5c\xd4\x66\x6a\xd4\xfe\x90\xa8\xad\xfe\xa8\xde\xd1\x9c\x1d" "\x39\xbe\x8c\x61\xf7\x31\xaf\xcd\x4d\xb3\xa3\xdf\xfa\xa8\x7a\x6c\xfe" "\xef\xd9\xad\xbd\xab\x22\xef\x4c\xdb\xc6\xb5\x8c\x8e\x8c\xdc\xf1\x54" "\x5d\x4b\xbf\x40\x62\x5e\xa1\xf4\x51\xd4\x42\xee\xd2\x57\xba\xa7\x2b" "\x5a\x7b\xfc\xec\xf9\x83\xbb\xad\x56\xf3\xd1\x54\x9f\xd8\x8f\xdf\x71" "\xc2\x2b\xd3\x4f\x75\x26\x9e\x54\x35\x8d\xbe\x3a\x07\xcc\x84\xd7\x6c" "\x3f\xc5\x67\x60\x1b\xce\xd4\x13\x4d\x60\xab\x2e\x9d\xec\x56\xcd\xfb" "\xf0\xe0\xf2\xfb\xbc\xe8\xed\x74\x6d\xdf\x2a\x3b\x19\x94\xc1\xce\xbb" "\x4c\x58\xff\xc5\xea\x95\xeb\xb1\x16\x76\x9e\xbe\xa0\xb4\x79\x7a\x30" "\x6c\xe5\xb1\x35\xee\x65\xd4\x06\x1b\xee\xf1\xbf\x91\x2a\xb8\x95\xc1" "\x0a\xce\x1b\xec\x31\xb7\xe6\x3a\x77\x41\x3a\x9f\xd3\xe3\xe7\xe4\xea" "\xfd\x28\xcf\x39\x61\xea\xfa\xa6\x3b\x5c\xff\x07\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x38\x6d\x8a\x7d\x1f\x60\x29\x6a" "\x3d\xde\xd7\x09\x4a\x1e\x22\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\xa7\xde\x5f\xdc\xff\x37\x29\xf3\xfe\xbf" "\xb1\x5f\xf5\x1e\x7e\xff\x5f\xf7\x2b\xdd\x05\xee\xff\x0b\x60\x02\xfe" "\x04\x00\x00\xff\xff\x99\xb8\x77\x9b", 672)); NONFAILING(syz_mount_image( /*fs=*/0x200000c0, /*dir=*/0x20000140, /*flags=*/0x81041a, /*opts=*/0x200001c0, /*chdir=*/7, /*size=*/0x2a0, /*img=*/0x20000840)); break; case 2: NONFAILING(memcpy((void*)0x20000000, "cpu.stat\000", 9)); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x20000000ul, /*flags=*/0x275aul, /*mode=*/0ul); if (res != -1) r[0] = res; break; case 3: syscall(__NR_write, /*fd=*/r[0], /*data=*/0x200001c0ul, /*len=*/0x208e24bul); break; case 4: syscall(__NR_mmap, /*addr=*/0x20000000ul, /*len=*/0xb36000ul, /*prot=*/0x800001ul, /*flags=*/0x28011ul, /*fd=*/r[0], /*offset=*/0ul); break; case 5: NONFAILING(memcpy((void*)0x20000180, "/dev/vcsu\000", 10)); syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x20000180ul, /*flags=*/0xf0ul, /*mode=*/0ul); break; case 6: NONFAILING(memcpy((void*)0x20000000, "cpu.stat\000", 9)); syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x20000000ul, /*flags=*/0x275aul, /*mode=*/0ul); break; case 7: syscall(__NR_write, /*fd=*/r[0], /*data=*/0x200001c0ul, /*len=*/0x208e24bul); break; } } int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=*/0x32ul, /*fd=*/-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x20000000ul, /*len=*/0x1000000ul, /*prot=*/7ul, /*flags=*/0x32ul, /*fd=*/-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x21000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=*/0x32ul, /*fd=*/-1, /*offset=*/0ul); install_segv_handler(); use_temporary_dir(); loop(); return 0; }