// https://syzkaller.appspot.com/bug?id=be6e90ce70987950e6deb3bac8418344ca8b96cd // 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, 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")) { } } static void setup_sysctl() { int cad_pid = fork(); if (cad_pid < 0) exit(1); if (cad_pid == 0) { for (;;) sleep(100); } char tmppid[32]; snprintf(tmppid, sizeof(tmppid), "%d", cad_pid); struct { const char* name; const char* data; } files[] = { {"/sys/kernel/debug/x86/nmi_longest_ns", "10000000000"}, {"/proc/sys/kernel/hung_task_check_interval_secs", "20"}, {"/proc/sys/net/core/bpf_jit_kallsyms", "1"}, {"/proc/sys/net/core/bpf_jit_harden", "0"}, {"/proc/sys/kernel/kptr_restrict", "0"}, {"/proc/sys/kernel/softlockup_all_cpu_backtrace", "1"}, {"/proc/sys/fs/mount-max", "100"}, {"/proc/sys/vm/oom_dump_tasks", "0"}, {"/proc/sys/debug/exception-trace", "0"}, {"/proc/sys/kernel/printk", "7 4 1 3"}, {"/proc/sys/kernel/keys/gc_delay", "1"}, {"/proc/sys/vm/oom_kill_allocating_task", "1"}, {"/proc/sys/kernel/ctrl-alt-del", "0"}, {"/proc/sys/kernel/cad_pid", tmppid}, }; for (size_t i = 0; i < sizeof(files) / sizeof(files[0]); i++) { if (!write_file(files[i].name, files[i].data)) { } } kill(cad_pid, SIGKILL); while (waitpid(cad_pid, NULL, 0) != cad_pid) ; } 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 < 11; 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 (;;) { 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[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: NONFAILING(memcpy((void*)0x200000000080, "ext4\000", 5)); NONFAILING(memcpy((void*)0x200000000140, "./file1\000", 8)); NONFAILING(memcpy((void*)0x2000000003c0, "errors=remount-ro", 17)); NONFAILING(*(uint8_t*)0x2000000003d1 = 0x2c); NONFAILING(memcpy((void*)0x2000000003d2, "nodiscard", 9)); NONFAILING(*(uint8_t*)0x2000000003db = 0x2c); NONFAILING(memcpy((void*)0x2000000003dc, "noquota", 7)); NONFAILING(*(uint8_t*)0x2000000003e3 = 0x2c); NONFAILING(memcpy((void*)0x2000000003e4, "init_itable", 11)); NONFAILING(*(uint8_t*)0x2000000003ef = 0x2c); NONFAILING(memcpy((void*)0x2000000003f0, "stripe", 6)); NONFAILING(*(uint8_t*)0x2000000003f6 = 0x3d); NONFAILING(sprintf((char*)0x2000000003f7, "0x%016llx", (long long)0x79)); NONFAILING(*(uint8_t*)0x200000000409 = 0x2c); NONFAILING(memcpy((void*)0x20000000040a, "resgid", 6)); NONFAILING(*(uint8_t*)0x200000000410 = 0x3d); NONFAILING(sprintf((char*)0x200000000411, "0x%016llx", (long long)0)); NONFAILING(*(uint8_t*)0x200000000423 = 0x2c); NONFAILING(memcpy((void*)0x200000000424, "sysvgroups", 10)); NONFAILING(*(uint8_t*)0x20000000042e = 0x2c); NONFAILING(memcpy((void*)0x20000000042f, "bsddf", 5)); NONFAILING(*(uint8_t*)0x200000000434 = 0x2c); NONFAILING(memcpy((void*)0x200000000435, "lazytime", 8)); NONFAILING(*(uint8_t*)0x20000000043d = 0x2c); NONFAILING(*(uint8_t*)0x20000000043e = 0); NONFAILING(memcpy( (void*)0x200000002d00, "\x78\x9c\xec\xdd\xcf\x6b\x1c\x6f\x19\x00\xf0\x67\x26\xd9\x6f\x7f\xe5" "\x6b\x52\xf5\x50\x0b\xb6\xc5\x56\xd2\xa2\xdd\x4d\x1a\xdb\x06\x0f\xb5" "\x82\xd8\x53\xc1\x5a\xef\x35\x26\x9b\x10\xb2\xc9\x86\xec\xa6\x6d\x42" "\x91\x14\xef\x0a\x22\x2a\x78\xf2\xe4\x45\xf0\x0f\x10\xa4\x7f\x82\x08" "\x05\xbd\x4b\x15\x45\xb4\xd5\x83\x07\x75\x65\x67\x67\x6b\x1b\x77\x9b" "\x48\xb7\x3b\x35\xf9\x7c\x60\x3a\xef\x3b\xef\xee\x3e\xcf\xdb\xb0\x33" "\xf3\xce\xbc\xec\x04\x70\x68\x9d\x8b\x88\x9b\x11\x31\x12\x11\x97\x22" "\x62\x3c\xdf\x9e\xe6\xcb\xad\x76\xfb\x9d\xce\xeb\x5e\x3c\x7f\x34\xdf" "\x5e\x92\x68\xb5\xee\xfe\x39\x89\x24\xdf\xd6\xfd\xac\x24\x5f\x9f\x88" "\x88\x9d\x88\x38\x1a\x11\x5f\xbd\x15\xf1\x8d\xe4\xbf\xe3\x36\xb6\xb6" "\x57\xe6\x6a\xb5\xea\x46\x5e\xaf\x34\x57\xd7\x2b\x8d\xad\xed\xcb\xcb" "\xab\x73\x4b\xd5\xa5\xea\xda\xcc\xcc\xf4\xb5\xd9\xeb\xb3\x57\x67\xa7" "\x06\xd2\xcf\x89\x88\xb8\xf1\xa5\xdf\x7f\xff\x3b\x3f\xf9\xf2\x8d\x5f" "\x7c\xf6\xc1\x6f\xef\xfd\xf1\xe2\x37\xdb\x69\x8d\xe5\xed\xaf\xf6\x63" "\x90\x3a\x5d\x2f\x65\xff\x17\x5d\xa3\x11\xb1\xf1\x2e\x82\x15\x60\x24" "\x5f\x97\xfa\xb4\x7f\x7b\x64\x88\xc9\x00\x00\xb0\xa7\xf6\x39\xfe\x47" "\x23\xe2\x53\xd9\xf9\xff\x78\x8c\x64\x67\xa7\x00\x00\x00\xc0\x41\xd2" "\xfa\xc2\x58\xfc\x23\x89\x68\x01\x00\x00\x00\x07\x56\x9a\xcd\x81\x4d" "\xd2\x72\x3e\x17\x60\x2c\xd2\xb4\x5c\xee\xcc\xe1\xfd\x78\x1c\x4f\x6b" "\xf5\x46\xf3\x33\x8b\xf5\xcd\xb5\x85\xce\x5c\xd9\x89\x28\xa5\x8b\xcb" "\xb5\xea\x54\x3e\x57\x78\x22\x4a\x49\xbb\x3e\x9d\xcf\xb1\xed\xd6\xaf" "\xec\xaa\xcf\x44\xc4\xc9\x88\xf8\xde\xf8\xb1\xac\x5e\x9e\xaf\xd7\x16" "\x8a\xbe\xf8\x01\x00\x00\x00\x87\xc4\x89\x5d\xe3\xff\xbf\x8d\x67\xe3" "\xff\x23\x45\xe7\x05\x00\x00\x00\x0c\xd8\x44\xd1\x09\x00\x00\x00\x00" "\xef\x9c\xf1\x3f\x00\x00\x00\x1c\x7c\xc6\xff\x00\x00\x00\x70\xa0\x7d" "\xe5\xf6\xed\xf6\xd2\xea\x3e\xff\x7a\xe1\xfe\xd6\xe6\x4a\xfd\xfe\xe5" "\x85\x6a\x63\xa5\xbc\xba\x39\x5f\x9e\xaf\x6f\xac\x97\x97\xea\xf5\xa5" "\xec\x37\xfb\x56\xf7\xfa\xbc\x5a\xbd\xbe\xfe\xb9\x58\xdb\x7c\x58\x69" "\x56\x1b\xcd\x4a\x63\x6b\xfb\xde\x6a\x7d\x73\xad\x79\x6f\xf9\xb5\x47" "\x60\x03\x00\x00\x00\x43\x74\xf2\xec\x93\xdf\x24\x11\xb1\xf3\xf9\x63" "\xd9\xd2\xf6\x41\xd1\x49\x01\x43\x91\xec\xd1\x9e\x3d\x24\xe4\x59\x5e" "\xf9\xdd\x10\x12\x02\x86\x66\xa4\xe8\x04\x80\xc2\x8c\x16\x9d\x00\x50" "\x98\x52\xd1\x09\x00\x85\xdb\xeb\x3a\x40\xdf\xc9\x3b\xbf\x1c\x7c\x2e" "\x00\x00\xc0\xbb\x31\xf9\x89\xfe\xf7\xff\x5d\x1b\x80\x83\x2d\x2d\x3a" "\x01\x00\x60\xe8\xdc\xff\x87\xc3\xab\xf4\xfa\x0c\xc0\xab\xc5\x65\x02" "\x14\xe5\x23\x7b\xb4\xbf\xfd\xfd\xff\x56\xeb\x7f\x4a\x08\x00\x00\x18" "\xb8\xb1\x6c\x49\xd2\x72\x7e\x2f\x70\x2c\xd2\xb4\x5c\x8e\xf8\x30\x7b" "\x2c\x40\x29\x59\x5c\xae\x55\xa7\xf2\xf1\xc1\xaf\xc7\x4b\x47\xda\xf5" "\xe9\xec\x9d\xc9\x9e\x73\x86\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x8e\x56\x2b\x89\x16\x00\x00" "\x00\x70\xa0\x45\xa4\x7f\x48\xb2\x5f\xf3\x8f\x98\x1c\xbf\x30\xb6\xfb" "\xfa\xc0\x07\xc9\xdf\xc7\xb3\x75\x44\x3c\xf8\xd1\xdd\x1f\x3c\x9c\x6b" "\x36\x37\xa6\xdb\xdb\xff\xf2\x72\x7b\xf3\x87\xf9\xf6\x2b\x45\x5c\xc1" "\x00\x00\x00\x00\x76\xeb\x8e\xd3\xbb\xe3\x78\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x18\xa4" "\x17\xcf\x1f\xcd\x77\x97\x61\xc6\xfd\xd3\x17\x23\x62\xa2\x67\xfc\xb3" "\x47\xb3\xd5\xd1\x28\x45\xc4\xf1\xbf\x26\x31\xfa\xca\xfb\x92\x88\x18" "\x19\x40\xfc\x9d\xc7\x11\x71\xaa\x57\xfc\xa4\x9d\x56\x4c\x44\x27\x8b" "\x5e\xf1\x8f\x15\x18\x3f\x8d\x88\x13\x03\x88\x0f\x87\xd9\x93\xf6\xfe" "\xe7\x66\xaf\xef\x5f\x1a\xe7\xb2\x75\xef\xef\xdf\x68\xbe\xbc\xad\xfe" "\xfb\xbf\x34\xba\xfb\xbf\x91\x3e\xfb\x9f\x0f\xf7\x19\xe3\xf4\xd3\x9f" "\x55\xfa\xc6\x7f\x1c\x71\x7a\xb4\xf7\xfe\xa7\x1b\x3f\xe9\x13\xff\xfc" "\x3e\xe3\x7f\xfd\x6b\xdb\xdb\xfd\xda\x5a\x3f\x8e\x98\xec\x79\xfc\x49" "\x5e\x8b\x55\x69\xae\xae\x57\x1a\x5b\xdb\x97\x97\x57\xe7\x96\xaa\x4b" "\xd5\xb5\x99\x99\xe9\x6b\xb3\xd7\x67\xaf\xce\x4e\x55\x16\x97\x6b\xd5" "\xfc\xdf\x9e\x31\xbe\xfb\xc9\x9f\xff\xeb\x4d\xfd\x3f\xde\x27\xfe\xc4" "\x1e\xfd\xbf\xb0\xcf\xfe\xff\xf3\xe9\xc3\xe7\x1f\xeb\x14\x4b\xbd\xe2" "\x5f\x3c\xdf\xfb\xf8\x7b\xaa\x4f\xfc\x34\x3f\xf6\x7d\x3a\x2f\xb7\xdb" "\x27\xbb\xe5\x9d\x4e\xf9\x55\x67\x7e\xfa\xab\x33\x6f\xea\xff\x42\x9f" "\xfe\xbf\xfc\xfb\xf7\x38\xd0\xb6\x63\x5e\xdc\x67\xff\x2f\xdd\xf9\xd6" "\xb3\x7d\xbe\x14\x00\x18\x82\xc6\xd6\xf6\xca\x5c\xad\x56\xdd\xf8\x7f" "\x2c\xa4\xf1\x5e\xa4\xa1\x30\x90\xc2\x91\xf7\x23\x0d\x85\x4e\xa1\xe8" "\x3d\x13\x00\x00\x30\x68\xff\x39\xe9\x2f\x3a\x13\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x38\xbc\x86\xf1\x73\x62\xbb" "\x63\xee\x14\xd3\x55\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\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\x37\xfa" "\x77\x00\x00\x00\xff\xff\xb1\xfe\xd9\x7a", 1234)); NONFAILING(syz_mount_image( /*fs=*/0x200000000080, /*dir=*/0x200000000140, /*flags=MS_LAZYTIME|MS_REC|MS_SYNCHRONOUS|MS_RELATIME|MS_NOSUID|0x800*/ 0x2204812, /*opts=*/0x2000000003c0, /*chdir=*/0x10, /*size=*/0x4d2, /*img=*/0x200000002d00)); break; case 1: NONFAILING(memcpy((void*)0x200000000040, "./bus\000", 6)); res = syscall(__NR_creat, /*file=*/0x200000000040ul, /*mode=*/0ul); if (res != -1) r[0] = res; break; case 2: NONFAILING(memcpy((void*)0x200000000180, "./bus\000", 6)); res = syscall( __NR_open, /*file=*/0x200000000180ul, /*flags=O_TRUNC|O_SYNC|O_NOATIME|O_LARGEFILE|O_CREAT|O_RDWR|0x3c*/ 0x14927eul, /*mode=*/0ul); if (res != -1) r[1] = res; break; case 3: NONFAILING(memcpy( (void*)0x2000000007c0, "syz1\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" "\000\000\000\000\000\000\000\000\000", 80)); NONFAILING(*(uint16_t*)0x200000000810 = 0x13); NONFAILING(*(uint16_t*)0x200000000812 = 4); NONFAILING(*(uint16_t*)0x200000000814 = 4); NONFAILING(*(uint16_t*)0x200000000816 = 6); NONFAILING(*(uint32_t*)0x200000000818 = 0x27); NONFAILING(*(uint32_t*)0x20000000081c = 3); NONFAILING(*(uint32_t*)0x200000000820 = 0x430); NONFAILING(*(uint32_t*)0x200000000824 = 7); NONFAILING(*(uint32_t*)0x200000000828 = 6); NONFAILING(*(uint32_t*)0x20000000082c = 8); NONFAILING(*(uint32_t*)0x200000000830 = 2); NONFAILING(*(uint32_t*)0x200000000834 = 7); NONFAILING(*(uint32_t*)0x200000000838 = 0); NONFAILING(*(uint32_t*)0x20000000083c = 5); NONFAILING(*(uint32_t*)0x200000000840 = 0x80000001); NONFAILING(*(uint32_t*)0x200000000844 = 1); NONFAILING(*(uint32_t*)0x200000000848 = 1); NONFAILING(*(uint32_t*)0x20000000084c = 3); NONFAILING(*(uint32_t*)0x200000000850 = 0x401); NONFAILING(*(uint32_t*)0x200000000854 = 9); NONFAILING(*(uint32_t*)0x200000000858 = 8); NONFAILING(*(uint32_t*)0x20000000085c = 2); NONFAILING(*(uint32_t*)0x200000000860 = 0xb67); NONFAILING(*(uint32_t*)0x200000000864 = 0xc2df); NONFAILING(*(uint32_t*)0x200000000868 = 0x93a); NONFAILING(*(uint32_t*)0x20000000086c = 0x884); NONFAILING(*(uint32_t*)0x200000000870 = 0x41); NONFAILING(*(uint32_t*)0x200000000874 = 5); NONFAILING(*(uint32_t*)0x200000000878 = 0x800); NONFAILING(*(uint32_t*)0x20000000087c = 9); NONFAILING(*(uint32_t*)0x200000000880 = 6); NONFAILING(*(uint32_t*)0x200000000884 = 0xffff); NONFAILING(*(uint32_t*)0x200000000888 = 0x40); NONFAILING(*(uint32_t*)0x20000000088c = 0); NONFAILING(*(uint32_t*)0x200000000890 = 0x58); NONFAILING(*(uint32_t*)0x200000000894 = 9); NONFAILING(*(uint32_t*)0x200000000898 = 0xcba); NONFAILING(*(uint32_t*)0x20000000089c = 5); NONFAILING(*(uint32_t*)0x2000000008a0 = 4); NONFAILING(*(uint32_t*)0x2000000008a4 = 0); NONFAILING(*(uint32_t*)0x2000000008a8 = 0xfff); NONFAILING(*(uint32_t*)0x2000000008ac = 0x80000001); NONFAILING(*(uint32_t*)0x2000000008b0 = 5); NONFAILING(*(uint32_t*)0x2000000008b4 = 6); NONFAILING(*(uint32_t*)0x2000000008b8 = 5); NONFAILING(*(uint32_t*)0x2000000008bc = 0x24); NONFAILING(*(uint32_t*)0x2000000008c0 = 8); NONFAILING(*(uint32_t*)0x2000000008c4 = 9); NONFAILING(*(uint32_t*)0x2000000008c8 = 4); NONFAILING(*(uint32_t*)0x2000000008cc = 5); NONFAILING(*(uint32_t*)0x2000000008d0 = 5); NONFAILING(*(uint32_t*)0x2000000008d4 = 5); NONFAILING(*(uint32_t*)0x2000000008d8 = 5); NONFAILING(*(uint32_t*)0x2000000008dc = 4); NONFAILING(*(uint32_t*)0x2000000008e0 = 8); NONFAILING(*(uint32_t*)0x2000000008e4 = 0); NONFAILING(*(uint32_t*)0x2000000008e8 = 9); NONFAILING(*(uint32_t*)0x2000000008ec = 0x10001); NONFAILING(*(uint32_t*)0x2000000008f0 = 7); NONFAILING(*(uint32_t*)0x2000000008f4 = 0x5b6b); NONFAILING(*(uint32_t*)0x2000000008f8 = 7); NONFAILING(*(uint32_t*)0x2000000008fc = 0x3fe0000); NONFAILING(*(uint32_t*)0x200000000900 = 0x80); NONFAILING(*(uint32_t*)0x200000000904 = 7); NONFAILING(*(uint32_t*)0x200000000908 = 0xf); NONFAILING(*(uint32_t*)0x20000000090c = 0xeb5); NONFAILING(*(uint32_t*)0x200000000910 = 4); NONFAILING(*(uint32_t*)0x200000000914 = 0x800); NONFAILING(*(uint32_t*)0x200000000918 = 0xd9); NONFAILING(*(uint32_t*)0x20000000091c = 0x2509); NONFAILING(*(uint32_t*)0x200000000920 = 0x400); NONFAILING(*(uint32_t*)0x200000000924 = 0x64); NONFAILING(*(uint32_t*)0x200000000928 = 0x50000000); NONFAILING(*(uint32_t*)0x20000000092c = 9); NONFAILING(*(uint32_t*)0x200000000930 = 0xfffffffc); NONFAILING(*(uint32_t*)0x200000000934 = 0x401); NONFAILING(*(uint32_t*)0x200000000938 = 7); NONFAILING(*(uint32_t*)0x20000000093c = 2); NONFAILING(*(uint32_t*)0x200000000940 = 7); NONFAILING(*(uint32_t*)0x200000000944 = 0xfffffffd); NONFAILING(*(uint32_t*)0x200000000948 = 0x100); NONFAILING(*(uint32_t*)0x20000000094c = 7); NONFAILING(*(uint32_t*)0x200000000950 = 0x400); NONFAILING(*(uint32_t*)0x200000000954 = 0xf38); NONFAILING(*(uint32_t*)0x200000000958 = 0xd51); NONFAILING(*(uint32_t*)0x20000000095c = 9); NONFAILING(*(uint32_t*)0x200000000960 = 0x50592a5); NONFAILING(*(uint32_t*)0x200000000964 = 6); NONFAILING(*(uint32_t*)0x200000000968 = 0xbc92); NONFAILING(*(uint32_t*)0x20000000096c = 1); NONFAILING(*(uint32_t*)0x200000000970 = 3); NONFAILING(*(uint32_t*)0x200000000974 = 0xc); NONFAILING(*(uint32_t*)0x200000000978 = 0x10001); NONFAILING(*(uint32_t*)0x20000000097c = 0xc); NONFAILING(*(uint32_t*)0x200000000980 = 6); NONFAILING(*(uint32_t*)0x200000000984 = 6); NONFAILING(*(uint32_t*)0x200000000988 = 0x101); NONFAILING(*(uint32_t*)0x20000000098c = 0x1ff); NONFAILING(*(uint32_t*)0x200000000990 = 0xc1e); NONFAILING(*(uint32_t*)0x200000000994 = 0); NONFAILING(*(uint32_t*)0x200000000998 = 5); NONFAILING(*(uint32_t*)0x20000000099c = 0x37d00f32); NONFAILING(*(uint32_t*)0x2000000009a0 = 2); NONFAILING(*(uint32_t*)0x2000000009a4 = 0); NONFAILING(*(uint32_t*)0x2000000009a8 = 0x7f); NONFAILING(*(uint32_t*)0x2000000009ac = 0); NONFAILING(*(uint32_t*)0x2000000009b0 = 0xc); NONFAILING(*(uint32_t*)0x2000000009b4 = 6); NONFAILING(*(uint32_t*)0x2000000009b8 = 0x18cb8); NONFAILING(*(uint32_t*)0x2000000009bc = 6); NONFAILING(*(uint32_t*)0x2000000009c0 = 0x10001); NONFAILING(*(uint32_t*)0x2000000009c4 = 6); NONFAILING(*(uint32_t*)0x2000000009c8 = 0x1000000); NONFAILING(*(uint32_t*)0x2000000009cc = 2); NONFAILING(*(uint32_t*)0x2000000009d0 = 0x800); NONFAILING(*(uint32_t*)0x2000000009d4 = 0x10001); NONFAILING(*(uint32_t*)0x2000000009d8 = 0); NONFAILING(*(uint32_t*)0x2000000009dc = 1); NONFAILING(*(uint32_t*)0x2000000009e0 = 0xf8f); NONFAILING(*(uint32_t*)0x2000000009e4 = 9); NONFAILING(*(uint32_t*)0x2000000009e8 = 0x37f87958); NONFAILING(*(uint32_t*)0x2000000009ec = 0xa); NONFAILING(*(uint32_t*)0x2000000009f0 = 0x1ff); NONFAILING(*(uint32_t*)0x2000000009f4 = 4); NONFAILING(*(uint32_t*)0x2000000009f8 = 0xa30a); NONFAILING(*(uint32_t*)0x2000000009fc = 5); NONFAILING(*(uint32_t*)0x200000000a00 = 7); NONFAILING(*(uint32_t*)0x200000000a04 = 0xe); NONFAILING(*(uint32_t*)0x200000000a08 = 7); NONFAILING(*(uint32_t*)0x200000000a0c = 0x7f); NONFAILING(*(uint32_t*)0x200000000a10 = 0x13); NONFAILING(*(uint32_t*)0x200000000a14 = 4); NONFAILING(*(uint32_t*)0x200000000a18 = 0x1000); NONFAILING(*(uint32_t*)0x200000000a1c = 0xfc43); NONFAILING(*(uint32_t*)0x200000000a20 = 4); NONFAILING(*(uint32_t*)0x200000000a24 = 0x10001); NONFAILING(*(uint32_t*)0x200000000a28 = 0x10000); NONFAILING(*(uint32_t*)0x200000000a2c = 6); NONFAILING(*(uint32_t*)0x200000000a30 = 2); NONFAILING(*(uint32_t*)0x200000000a34 = 5); NONFAILING(*(uint32_t*)0x200000000a38 = 0); NONFAILING(*(uint32_t*)0x200000000a3c = 0); NONFAILING(*(uint32_t*)0x200000000a40 = -1); NONFAILING(*(uint32_t*)0x200000000a44 = 4); NONFAILING(*(uint32_t*)0x200000000a48 = 8); NONFAILING(*(uint32_t*)0x200000000a4c = 0xfffff800); NONFAILING(*(uint32_t*)0x200000000a50 = 8); NONFAILING(*(uint32_t*)0x200000000a54 = 0x30000); NONFAILING(*(uint32_t*)0x200000000a58 = 0x7ff); NONFAILING(*(uint32_t*)0x200000000a5c = 0x3ff); NONFAILING(*(uint32_t*)0x200000000a60 = 7); NONFAILING(*(uint32_t*)0x200000000a64 = 0x77); NONFAILING(*(uint32_t*)0x200000000a68 = 5); NONFAILING(*(uint32_t*)0x200000000a6c = 0x556b); NONFAILING(*(uint32_t*)0x200000000a70 = 0x704c); NONFAILING(*(uint32_t*)0x200000000a74 = 0); NONFAILING(*(uint32_t*)0x200000000a78 = 0x8000); NONFAILING(*(uint32_t*)0x200000000a7c = 0x100); NONFAILING(*(uint32_t*)0x200000000a80 = 5); NONFAILING(*(uint32_t*)0x200000000a84 = 0xc8285b93); NONFAILING(*(uint32_t*)0x200000000a88 = 0x6f4c); NONFAILING(*(uint32_t*)0x200000000a8c = 0xc); NONFAILING(*(uint32_t*)0x200000000a90 = 0x387a); NONFAILING(*(uint32_t*)0x200000000a94 = 2); NONFAILING(*(uint32_t*)0x200000000a98 = 4); NONFAILING(*(uint32_t*)0x200000000a9c = 3); NONFAILING(*(uint32_t*)0x200000000aa0 = 0xec); NONFAILING(*(uint32_t*)0x200000000aa4 = 4); NONFAILING(*(uint32_t*)0x200000000aa8 = 4); NONFAILING(*(uint32_t*)0x200000000aac = 1); NONFAILING(*(uint32_t*)0x200000000ab0 = 0x3ff); NONFAILING(*(uint32_t*)0x200000000ab4 = 0); NONFAILING(*(uint32_t*)0x200000000ab8 = 9); NONFAILING(*(uint32_t*)0x200000000abc = 8); NONFAILING(*(uint32_t*)0x200000000ac0 = 1); NONFAILING(*(uint32_t*)0x200000000ac4 = 6); NONFAILING(*(uint32_t*)0x200000000ac8 = 0x2a); NONFAILING(*(uint32_t*)0x200000000acc = 0x3e5293); NONFAILING(*(uint32_t*)0x200000000ad0 = 8); NONFAILING(*(uint32_t*)0x200000000ad4 = 0xd); NONFAILING(*(uint32_t*)0x200000000ad8 = 0x400); NONFAILING(*(uint32_t*)0x200000000adc = 7); NONFAILING(*(uint32_t*)0x200000000ae0 = 6); NONFAILING(*(uint32_t*)0x200000000ae4 = 0xed); NONFAILING(*(uint32_t*)0x200000000ae8 = 3); NONFAILING(*(uint32_t*)0x200000000aec = 1); NONFAILING(*(uint32_t*)0x200000000af0 = 0x1ff); NONFAILING(*(uint32_t*)0x200000000af4 = 0xc78b); NONFAILING(*(uint32_t*)0x200000000af8 = 7); NONFAILING(*(uint32_t*)0x200000000afc = 0xa); NONFAILING(*(uint32_t*)0x200000000b00 = 1); NONFAILING(*(uint32_t*)0x200000000b04 = 0xa232); NONFAILING(*(uint32_t*)0x200000000b08 = 3); NONFAILING(*(uint32_t*)0x200000000b0c = 4); NONFAILING(*(uint32_t*)0x200000000b10 = 2); NONFAILING(*(uint32_t*)0x200000000b14 = 0x7fffffff); NONFAILING(*(uint32_t*)0x200000000b18 = 0xd4); NONFAILING(*(uint32_t*)0x200000000b1c = 3); NONFAILING(*(uint32_t*)0x200000000b20 = 0x800); NONFAILING(*(uint32_t*)0x200000000b24 = 6); NONFAILING(*(uint32_t*)0x200000000b28 = 3); NONFAILING(*(uint32_t*)0x200000000b2c = 0x7ff); NONFAILING(*(uint32_t*)0x200000000b30 = 0x5702); NONFAILING(*(uint32_t*)0x200000000b34 = 0x20c2); NONFAILING(*(uint32_t*)0x200000000b38 = 0x5f0); NONFAILING(*(uint32_t*)0x200000000b3c = 0x200); NONFAILING(*(uint32_t*)0x200000000b40 = 0xe3b); NONFAILING(*(uint32_t*)0x200000000b44 = 0x7fff); NONFAILING(*(uint32_t*)0x200000000b48 = 2); NONFAILING(*(uint32_t*)0x200000000b4c = 0x93); NONFAILING(*(uint32_t*)0x200000000b50 = 0x932); NONFAILING(*(uint32_t*)0x200000000b54 = 0x800); NONFAILING(*(uint32_t*)0x200000000b58 = 9); NONFAILING(*(uint32_t*)0x200000000b5c = 0x31b); NONFAILING(*(uint32_t*)0x200000000b60 = 5); NONFAILING(*(uint32_t*)0x200000000b64 = 0); NONFAILING(*(uint32_t*)0x200000000b68 = 2); NONFAILING(*(uint32_t*)0x200000000b6c = 8); NONFAILING(*(uint32_t*)0x200000000b70 = 0xcdf); NONFAILING(*(uint32_t*)0x200000000b74 = 9); NONFAILING(*(uint32_t*)0x200000000b78 = 0x61); NONFAILING(*(uint32_t*)0x200000000b7c = 0x57f); NONFAILING(*(uint32_t*)0x200000000b80 = 3); NONFAILING(*(uint32_t*)0x200000000b84 = 0x10000); NONFAILING(*(uint32_t*)0x200000000b88 = 1); NONFAILING(*(uint32_t*)0x200000000b8c = 0x5435e849); NONFAILING(*(uint32_t*)0x200000000b90 = 0x1085670e); NONFAILING(*(uint32_t*)0x200000000b94 = 6); NONFAILING(*(uint32_t*)0x200000000b98 = 0x10001); NONFAILING(*(uint32_t*)0x200000000b9c = 2); NONFAILING(*(uint32_t*)0x200000000ba0 = 8); NONFAILING(*(uint32_t*)0x200000000ba4 = 0xfffffff9); NONFAILING(*(uint32_t*)0x200000000ba8 = 0x10); NONFAILING(*(uint32_t*)0x200000000bac = 9); NONFAILING(*(uint32_t*)0x200000000bb0 = 1); NONFAILING(*(uint32_t*)0x200000000bb4 = 7); NONFAILING(*(uint32_t*)0x200000000bb8 = 0xf); NONFAILING(*(uint32_t*)0x200000000bbc = 0x40); NONFAILING(*(uint32_t*)0x200000000bc0 = 0xd583); NONFAILING(*(uint32_t*)0x200000000bc4 = 1); NONFAILING(*(uint32_t*)0x200000000bc8 = 0x1000); NONFAILING(*(uint32_t*)0x200000000bcc = 0xd7b); NONFAILING(*(uint32_t*)0x200000000bd0 = 0xa4e1); NONFAILING(*(uint32_t*)0x200000000bd4 = 1); NONFAILING(*(uint32_t*)0x200000000bd8 = 4); NONFAILING(*(uint32_t*)0x200000000bdc = 0xa); NONFAILING(*(uint32_t*)0x200000000be0 = 3); NONFAILING(*(uint32_t*)0x200000000be4 = 1); NONFAILING(*(uint32_t*)0x200000000be8 = 2); NONFAILING(*(uint32_t*)0x200000000bec = 0xffffffc1); NONFAILING(*(uint32_t*)0x200000000bf0 = 0xfffffff7); NONFAILING(*(uint32_t*)0x200000000bf4 = 4); NONFAILING(*(uint32_t*)0x200000000bf8 = 7); NONFAILING(*(uint32_t*)0x200000000bfc = 0x8001); NONFAILING(*(uint32_t*)0x200000000c00 = 0x40); NONFAILING(*(uint32_t*)0x200000000c04 = 8); NONFAILING(*(uint32_t*)0x200000000c08 = 0xfffffffc); NONFAILING(*(uint32_t*)0x200000000c0c = 0); NONFAILING(*(uint32_t*)0x200000000c10 = 1); NONFAILING(*(uint32_t*)0x200000000c14 = 5); NONFAILING(*(uint32_t*)0x200000000c18 = 6); syscall(__NR_write, /*fd=*/r[0], /*data=*/0x2000000007c0ul, /*len=*/0x45cul); break; case 4: syscall(__NR_fallocate, /*fd=*/r[1], /*mode=*/0ul, /*off=*/0ul, /*len=*/0x1000f4ul); break; case 5: NONFAILING(memcpy((void*)0x200000000380, "/dev/loop", 9)); NONFAILING(*(uint8_t*)0x200000000389 = 0x30); NONFAILING(*(uint8_t*)0x20000000038a = 0); NONFAILING(memcpy((void*)0x200000000140, "./bus\000", 6)); syscall(__NR_mount, /*src=*/0x200000000380ul, /*dst=*/0x200000000140ul, /*type=*/0ul, /*flags=MS_BIND*/ 0x1000ul, /*data=*/0ul); break; case 6: NONFAILING(memcpy((void*)0x200000000100, "./bus\000", 6)); res = syscall(__NR_open, /*file=*/0x200000000100ul, /*flags=O_SYNC|O_NOCTTY|O_NOATIME|O_RDWR|0x3c*/ 0x14113eul, /*mode=*/0ul); if (res != -1) r[2] = res; break; case 7: NONFAILING(memcpy((void*)0x2000000002c0, "/dev/hwrng\000", 11)); res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x2000000002c0ul, /*flags=*/0, /*mode=*/0); if (res != -1) r[3] = res; break; case 8: NONFAILING(*(uint64_t*)0x200000000240 = 0x200000033a80); NONFAILING(*(uint64_t*)0x200000000248 = 0xfffffd6e); syscall(__NR_preadv, /*fd=*/r[3], /*vec=*/0x200000000240ul, /*vlen=*/1ul, /*off_low=*/0, /*off_high=*/0); break; case 9: NONFAILING(memcpy((void*)0x200000000080, "#! ", 3)); NONFAILING(*(uint8_t*)0x200000000083 = 0xa); syscall(__NR_write, /*fd=*/r[2], /*data=*/0x200000000080ul, /*len=*/0x208e24bul); break; case 10: syscall(__NR_fallocate, /*fd=*/r[0], /*mode=FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE*/ 3ul, /*off=*/0ul, /*len=*/0x1a00ul); 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); setup_sysctl(); const char* reason; (void)reason; install_segv_handler(); use_temporary_dir(); loop(); return 0; }