// https://syzkaller.appspot.com/bug?id=67f74abd157e41c3c7e90b0a7100f34d9932d099 // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifndef __NR_memfd_create #define __NR_memfd_create 319 #endif static unsigned long long procid; static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); syscall(SYS_futex, &ev->state, FUTEX_WAKE | FUTEX_PRIVATE_FLAG, 1000000); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, 0); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; for (;;) { uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, &ts); if (__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) return 1; now = current_time_ms(); if (now - start > timeout) return 0; } } static bool write_file(const char* file, const char* what, ...) { char buf[1024]; va_list args; va_start(args, what); vsnprintf(buf, sizeof(buf), what, args); va_end(args); buf[sizeof(buf) - 1] = 0; int len = strlen(buf); int fd = open(file, O_WRONLY | O_CLOEXEC); if (fd == -1) return false; if (write(fd, buf, len) != len) { int err = errno; close(fd); errno = err; return false; } close(fd); return true; } //% This code is derived from puff.{c,h}, found in the zlib development. The //% original files come with the following copyright notice: //% Copyright (C) 2002-2013 Mark Adler, all rights reserved //% version 2.3, 21 Jan 2013 //% This software is provided 'as-is', without any express or implied //% warranty. In no event will the author be held liable for any damages //% arising from the use of this software. //% Permission is granted to anyone to use this software for any purpose, //% including commercial applications, and to alter it and redistribute it //% freely, subject to the following restrictions: //% 1. The origin of this software must not be misrepresented; you must not //% claim that you wrote the original software. If you use this software //% in a product, an acknowledgment in the product documentation would be //% appreciated but is not required. //% 2. Altered source versions must be plainly marked as such, and must not be //% misrepresented as being the original software. //% 3. This notice may not be removed or altered from any source distribution. //% Mark Adler madler@alumni.caltech.edu //% BEGIN CODE DERIVED FROM puff.{c,h} #define MAXBITS 15 #define MAXLCODES 286 #define MAXDCODES 30 #define MAXCODES (MAXLCODES + MAXDCODES) #define FIXLCODES 288 struct puff_state { unsigned char* out; unsigned long outlen; unsigned long outcnt; const unsigned char* in; unsigned long inlen; unsigned long incnt; int bitbuf; int bitcnt; jmp_buf env; }; static int puff_bits(struct puff_state* s, int need) { long val = s->bitbuf; while (s->bitcnt < need) { if (s->incnt == s->inlen) longjmp(s->env, 1); val |= (long)(s->in[s->incnt++]) << s->bitcnt; s->bitcnt += 8; } s->bitbuf = (int)(val >> need); s->bitcnt -= need; return (int)(val & ((1L << need) - 1)); } static int puff_stored(struct puff_state* s) { s->bitbuf = 0; s->bitcnt = 0; if (s->incnt + 4 > s->inlen) return 2; unsigned len = s->in[s->incnt++]; len |= s->in[s->incnt++] << 8; if (s->in[s->incnt++] != (~len & 0xff) || s->in[s->incnt++] != ((~len >> 8) & 0xff)) return -2; if (s->incnt + len > s->inlen) return 2; if (s->outcnt + len > s->outlen) return 1; for (; len--; s->outcnt++, s->incnt++) { if (s->in[s->incnt]) s->out[s->outcnt] = s->in[s->incnt]; } return 0; } struct puff_huffman { short* count; short* symbol; }; static int puff_decode(struct puff_state* s, const struct puff_huffman* h) { int first = 0; int index = 0; int bitbuf = s->bitbuf; int left = s->bitcnt; int code = first = index = 0; int len = 1; short* next = h->count + 1; while (1) { while (left--) { code |= bitbuf & 1; bitbuf >>= 1; int count = *next++; if (code - count < first) { s->bitbuf = bitbuf; s->bitcnt = (s->bitcnt - len) & 7; return h->symbol[index + (code - first)]; } index += count; first += count; first <<= 1; code <<= 1; len++; } left = (MAXBITS + 1) - len; if (left == 0) break; if (s->incnt == s->inlen) longjmp(s->env, 1); bitbuf = s->in[s->incnt++]; if (left > 8) left = 8; } return -10; } static int puff_construct(struct puff_huffman* h, const short* length, int n) { int len; for (len = 0; len <= MAXBITS; len++) h->count[len] = 0; int symbol; for (symbol = 0; symbol < n; symbol++) (h->count[length[symbol]])++; if (h->count[0] == n) return 0; int left = 1; for (len = 1; len <= MAXBITS; len++) { left <<= 1; left -= h->count[len]; if (left < 0) return left; } short offs[MAXBITS + 1]; offs[1] = 0; for (len = 1; len < MAXBITS; len++) offs[len + 1] = offs[len] + h->count[len]; for (symbol = 0; symbol < n; symbol++) if (length[symbol] != 0) h->symbol[offs[length[symbol]]++] = symbol; return left; } static int puff_codes(struct puff_state* s, const struct puff_huffman* lencode, const struct puff_huffman* distcode) { static const short lens[29] = {3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258}; static const short lext[29] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0}; static const short dists[30] = { 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577}; static const short dext[30] = {0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13}; int symbol; do { symbol = puff_decode(s, lencode); if (symbol < 0) return symbol; if (symbol < 256) { if (s->outcnt == s->outlen) return 1; if (symbol) s->out[s->outcnt] = symbol; s->outcnt++; } else if (symbol > 256) { symbol -= 257; if (symbol >= 29) return -10; int len = lens[symbol] + puff_bits(s, lext[symbol]); symbol = puff_decode(s, distcode); if (symbol < 0) return symbol; unsigned dist = dists[symbol] + puff_bits(s, dext[symbol]); if (dist > s->outcnt) return -11; if (s->outcnt + len > s->outlen) return 1; while (len--) { if (dist <= s->outcnt && s->out[s->outcnt - dist]) s->out[s->outcnt] = s->out[s->outcnt - dist]; s->outcnt++; } } } while (symbol != 256); return 0; } static int puff_fixed(struct puff_state* s) { static int virgin = 1; static short lencnt[MAXBITS + 1], lensym[FIXLCODES]; static short distcnt[MAXBITS + 1], distsym[MAXDCODES]; static struct puff_huffman lencode, distcode; if (virgin) { lencode.count = lencnt; lencode.symbol = lensym; distcode.count = distcnt; distcode.symbol = distsym; short lengths[FIXLCODES]; int symbol; for (symbol = 0; symbol < 144; symbol++) lengths[symbol] = 8; for (; symbol < 256; symbol++) lengths[symbol] = 9; for (; symbol < 280; symbol++) lengths[symbol] = 7; for (; symbol < FIXLCODES; symbol++) lengths[symbol] = 8; puff_construct(&lencode, lengths, FIXLCODES); for (symbol = 0; symbol < MAXDCODES; symbol++) lengths[symbol] = 5; puff_construct(&distcode, lengths, MAXDCODES); virgin = 0; } return puff_codes(s, &lencode, &distcode); } static int puff_dynamic(struct puff_state* s) { static const short order[19] = {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; int nlen = puff_bits(s, 5) + 257; int ndist = puff_bits(s, 5) + 1; int ncode = puff_bits(s, 4) + 4; if (nlen > MAXLCODES || ndist > MAXDCODES) return -3; short lengths[MAXCODES]; int index; for (index = 0; index < ncode; index++) lengths[order[index]] = puff_bits(s, 3); for (; index < 19; index++) lengths[order[index]] = 0; short lencnt[MAXBITS + 1], lensym[MAXLCODES]; struct puff_huffman lencode = {lencnt, lensym}; int err = puff_construct(&lencode, lengths, 19); if (err != 0) return -4; index = 0; while (index < nlen + ndist) { int symbol; int len; symbol = puff_decode(s, &lencode); if (symbol < 0) return symbol; if (symbol < 16) lengths[index++] = symbol; else { len = 0; if (symbol == 16) { if (index == 0) return -5; len = lengths[index - 1]; symbol = 3 + puff_bits(s, 2); } else if (symbol == 17) symbol = 3 + puff_bits(s, 3); else symbol = 11 + puff_bits(s, 7); if (index + symbol > nlen + ndist) return -6; while (symbol--) lengths[index++] = len; } } if (lengths[256] == 0) return -9; err = puff_construct(&lencode, lengths, nlen); if (err && (err < 0 || nlen != lencode.count[0] + lencode.count[1])) return -7; short distcnt[MAXBITS + 1], distsym[MAXDCODES]; struct puff_huffman distcode = {distcnt, distsym}; err = puff_construct(&distcode, lengths + nlen, ndist); if (err && (err < 0 || ndist != distcode.count[0] + distcode.count[1])) return -8; return puff_codes(s, &lencode, &distcode); } static int puff(unsigned char* dest, unsigned long* destlen, const unsigned char* source, unsigned long sourcelen) { struct puff_state s = { .out = dest, .outlen = *destlen, .outcnt = 0, .in = source, .inlen = sourcelen, .incnt = 0, .bitbuf = 0, .bitcnt = 0, }; int err; if (setjmp(s.env) != 0) err = 2; else { int last; do { last = puff_bits(&s, 1); int type = puff_bits(&s, 2); err = type == 0 ? puff_stored(&s) : (type == 1 ? puff_fixed(&s) : (type == 2 ? puff_dynamic(&s) : -1)); if (err != 0) break; } while (!last); } *destlen = s.outcnt; return err; } //% END CODE DERIVED FROM puff.{c,h} #define ZLIB_HEADER_WIDTH 2 static int puff_zlib_to_file(const unsigned char* source, unsigned long sourcelen, int dest_fd) { if (sourcelen < ZLIB_HEADER_WIDTH) return 0; source += ZLIB_HEADER_WIDTH; sourcelen -= ZLIB_HEADER_WIDTH; const unsigned long max_destlen = 132 << 20; void* ret = mmap(0, max_destlen, PROT_WRITE | PROT_READ, MAP_PRIVATE | MAP_ANON, -1, 0); if (ret == MAP_FAILED) return -1; unsigned char* dest = (unsigned char*)ret; unsigned long destlen = max_destlen; int err = puff(dest, &destlen, source, sourcelen); if (err) { munmap(dest, max_destlen); errno = -err; return -1; } if (write(dest_fd, dest, destlen) != (ssize_t)destlen) { munmap(dest, max_destlen); return -1; } return munmap(dest, max_destlen); } static int setup_loop_device(unsigned char* data, unsigned long size, const char* loopname, int* loopfd_p) { int err = 0, loopfd = -1; int memfd = syscall(__NR_memfd_create, "syzkaller", 0); if (memfd == -1) { err = errno; goto error; } if (puff_zlib_to_file(data, size, memfd)) { err = errno; goto error_close_memfd; } loopfd = open(loopname, O_RDWR); if (loopfd == -1) { err = errno; goto error_close_memfd; } if (ioctl(loopfd, LOOP_SET_FD, memfd)) { if (errno != EBUSY) { err = errno; goto error_close_loop; } ioctl(loopfd, LOOP_CLR_FD, 0); usleep(1000); if (ioctl(loopfd, LOOP_SET_FD, memfd)) { err = errno; goto error_close_loop; } } close(memfd); *loopfd_p = loopfd; return 0; error_close_loop: close(loopfd); error_close_memfd: close(memfd); error: errno = err; return -1; } static void reset_loop_device(const char* loopname) { int loopfd = open(loopname, O_RDWR); if (loopfd == -1) { return; } if (ioctl(loopfd, LOOP_CLR_FD, 0)) { } close(loopfd); } static long syz_mount_image(volatile long fsarg, volatile long dir, volatile long flags, volatile long optsarg, volatile long change_dir, volatile unsigned long size, volatile long image) { unsigned char* data = (unsigned char*)image; int res = -1, err = 0, need_loop_device = !!size; char* mount_opts = (char*)optsarg; char* target = (char*)dir; char* fs = (char*)fsarg; char* source = NULL; char loopname[64]; if (need_loop_device) { int loopfd; memset(loopname, 0, sizeof(loopname)); snprintf(loopname, sizeof(loopname), "/dev/loop%llu", procid); if (setup_loop_device(data, size, loopname, &loopfd) == -1) return -1; close(loopfd); source = loopname; } mkdir(target, 0777); char opts[256]; memset(opts, 0, sizeof(opts)); if (strlen(mount_opts) > (sizeof(opts) - 32)) { } strncpy(opts, mount_opts, sizeof(opts) - 32); if (strcmp(fs, "iso9660") == 0) { flags |= MS_RDONLY; } else if (strncmp(fs, "ext", 3) == 0) { bool has_remount_ro = false; char* remount_ro_start = strstr(opts, "errors=remount-ro"); if (remount_ro_start != NULL) { char after = *(remount_ro_start + strlen("errors=remount-ro")); char before = remount_ro_start == opts ? '\0' : *(remount_ro_start - 1); has_remount_ro = ((before == '\0' || before == ',') && (after == '\0' || after == ',')); } if (strstr(opts, "errors=panic") || !has_remount_ro) strcat(opts, ",errors=continue"); } else if (strcmp(fs, "xfs") == 0) { strcat(opts, ",nouuid"); } res = mount(source, target, fs, flags, opts); if (res == -1) { err = errno; goto error_clear_loop; } res = open(target, O_RDONLY | O_DIRECTORY); if (res == -1) { err = errno; goto error_clear_loop; } if (change_dir) { res = chdir(target); if (res == -1) { err = errno; } } error_clear_loop: if (need_loop_device) reset_loop_device(loopname); errno = err; return res; } static void kill_and_wait(int pid, int* status) { kill(-pid, SIGKILL); kill(pid, SIGKILL); for (int i = 0; i < 100; i++) { if (waitpid(-1, status, WNOHANG | __WALL) == pid) return; usleep(1000); } DIR* dir = opendir("/sys/fs/fuse/connections"); if (dir) { for (;;) { struct dirent* ent = readdir(dir); if (!ent) break; if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) continue; char abort[300]; snprintf(abort, sizeof(abort), "/sys/fs/fuse/connections/%s/abort", ent->d_name); int fd = open(abort, O_WRONLY); if (fd == -1) { continue; } if (write(fd, abort, 1) < 0) { } close(fd); } closedir(dir); } else { } while (waitpid(-1, status, __WALL) != pid) { } } static void reset_loop() { char buf[64]; snprintf(buf, sizeof(buf), "/dev/loop%llu", procid); int loopfd = open(buf, O_RDWR); if (loopfd != -1) { ioctl(loopfd, LOOP_CLR_FD, 0); close(loopfd); } } static void setup_test() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setpgrp(); write_file("/proc/self/oom_score_adj", "1000"); } static void setup_sysctl() { char mypid[32]; snprintf(mypid, sizeof(mypid), "%d", getpid()); 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", mypid}, }; for (size_t i = 0; i < sizeof(files) / sizeof(files[0]); i++) { if (!write_file(files[i].name, files[i].data)) printf("write to %s failed: %s\n", files[i].name, strerror(errno)); } } 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 < 10; 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 == 2 ? 4000 : 0)); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); #define WAIT_FLAGS __WALL static void loop(void) { int iter = 0; for (;; iter++) { reset_loop(); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { setup_test(); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { 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; } } } uint64_t r[1] = {0xffffffffffffffff}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: memcpy((void*)0x20000080, "ext4\000", 5); memcpy((void*)0x200000c0, "./" "file0aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\000", 253); *(uint8_t*)0x20002b40 = 0; memcpy( (void*)0x20000cc0, "\x78\x9c\xec\xdd\xcf\x6b\x1c\xe5\x1b\x00\xf0\x67\x36\xd9\x26\x4d\xfb" "\xfd\x26\x82\xa0\xf5\x14\x10\x34\x50\x9a\x98\x1a\x5b\x05\x0f\x15\x0f" "\x22\x58\x28\xe8\xd9\x1a\x92\x6d\x88\xd9\x64\x4b\x76\x53\x9a\x10\x68" "\x8b\x08\x5e\x04\x15\x0f\x82\x5e\x7a\xf6\x47\xbd\x79\x13\x7f\x5c\xf5" "\xbf\xf0\x20\x2d\x55\xd3\x62\xc5\x83\xac\xcc\x66\x36\xdd\x34\xbb\x4d" "\xd2\x6e\xb2\xad\xf9\x7c\x60\xda\xf7\x9d\x79\x77\x9f\x79\x76\xde\x99" "\x79\xb3\x33\xec\x04\xb0\x67\x0d\xa6\xff\xe4\x22\x0e\x45\xc4\x07\x49" "\x44\x7f\x36\x3f\x89\x88\x7c\xad\xd4\x1d\x71\x62\xb5\xdd\xad\x95\xe5" "\x89\x74\x4a\xa2\x5a\x7d\xfd\xf7\xa4\xd6\xe6\xe6\xca\xf2\x44\x34\xbc" "\x26\x75\x20\xab\x3c\x1e\x11\x3f\xbc\x1b\x71\x38\xb7\x31\x6e\x79\x71" "\x69\x66\xbc\x58\x2c\xcc\x67\xf5\x91\xca\xec\xd9\x91\xf2\xe2\xd2\x91" "\xe9\xd9\xf1\xa9\xc2\x54\x61\xee\xd8\xe8\xd8\xd8\xd1\xe3\xcf\x1d\x3f" "\xd6\xbe\x5c\xff\xfc\x79\xe9\xe0\xb5\x0f\x5f\x79\xfa\xab\x13\x7f\xbf" "\xf3\xd8\x95\xf7\x7f\x4c\xe2\x44\x1c\xcc\x96\x35\xe6\xd1\x2e\x83\x31" "\x98\x7d\x26\xf9\xf4\x23\x5c\xe7\xe5\x76\x07\xeb\xb0\xa4\xd3\x2b\xc0" "\x3d\x49\x77\xcd\xae\xd5\xbd\x3c\x0e\x45\x7f\x74\xd5\x4a\x00\xc0\x7f" "\xd9\x85\x88\xa8\x6e\xa2\x3e\xb6\xdb\xac\x1d\x00\xf0\xb0\x48\x9c\xd7" "\x01\x60\x8f\xa9\x7f\x0f\x70\x73\x65\x79\xa2\x3e\x75\xee\xdb\x88\xdd" "\x77\xfd\xa5\x88\xe8\x5d\xcd\xbf\x7e\x7d\x73\x75\x49\x77\x76\xcd\xae" "\xb7\x76\x1d\xb4\xef\x66\xb2\xee\xca\x48\x12\x11\x03\x6d\x88\x3f\x18" "\x11\x9f\x7d\xf3\xe6\x17\xe9\x14\x3b\x74\x1d\x12\xa0\x99\x8b\xdf\x66" "\x85\x0d\xc7\xff\x64\xc3\x3d\x0b\xdb\xf5\xcc\x16\xda\x0c\xde\x51\x77" "\xfc\x83\xdd\xf3\x5d\x3a\xfe\x79\xbe\xd9\xf8\x2f\xb7\x36\xfe\x89\x26" "\xe3\x9f\x9e\x26\xfb\xee\xbd\xd8\x7c\xff\xcf\x5d\x6d\x43\x98\x96\xd2" "\xf1\xdf\x8b\x0d\xf7\xb6\xdd\x6a\xc8\x3f\x33\xd0\x95\xd5\xfe\x57\x1b" "\xf3\xe5\x93\x33\xd3\xc5\x42\x7a\x6c\xfb\x7f\x44\x0c\x45\xbe\x27\xad" "\x8f\xde\x25\xc6\xd0\x8d\x7f\x6e\xb4\x5a\xd6\x38\xfe\xfb\xe3\xa3\xb7" "\x3f\x4f\xe3\xa7\xff\xdf\x6e\x91\xbb\xda\xdd\xb3\xfe\x35\x93\xe3\x95" "\xf1\xfb\xc9\xb9\xd1\xf5\x4b\x11\x4f\x74\x37\xcb\x3f\x59\xdb\xfe\x49" "\x8b\xf1\xef\xa9\x2d\xc6\x78\xf5\x85\xf7\x3e\x6d\xb5\x2c\xcd\x3f\xcd" "\xb7\x3e\x6d\xcc\x7f\x67\x55\x2f\x47\x3c\xd5\x64\xfb\xe7\x1b\xda\x24" "\x77\xbd\x3f\x71\xa4\xd6\x1d\x46\xea\x9d\xa2\x89\xaf\x7f\xf9\xa4\xaf" "\x55\xfc\xc6\xed\x9f\x4e\x69\xfc\xfa\xdf\x02\x75\x97\xda\x96\xed\x46" "\xe9\xf6\xef\x6b\xda\xff\xd7\xee\xe8\x1b\x48\x1a\xef\xd7\x2c\x6f\x3f" "\xc6\x4f\x97\xfb\xbf\x6f\xb5\x6c\xf3\xfc\x9b\xf7\xff\x7d\xc9\x1b\xb5" "\xf2\xbe\x6c\xde\xf9\xf1\x4a\x65\x7e\x34\x62\x5f\xf2\xda\xc6\xf9\x47" "\x6f\xbf\xb6\x5e\xaf\xb7\x4f\xf3\x1f\x7a\xb2\x96\xff\xfe\xac\xc9\x86" "\xe3\x5f\xb3\xfe\x9f\xf6\x8f\xb7\x36\x4b\x3c\x5b\x89\xee\x6b\xbf\x7d" "\x79\xef\xf9\xef\xac\x34\xff\xc9\x6d\x6d\xff\xed\x17\xae\xdc\x9a\xe9" "\x6a\x15\x7f\x6b\xdb\x7f\xac\x56\x1a\xca\xe6\x6c\xe5\xf8\x77\xf7\xf5" "\xca\xdf\x47\x6f\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x80\xed\xcb\x45\xc4\xc1\x48\x72\xc3\x6b\xe5" "\x5c\x6e\x78\x78\xf5\x19\xde\x8f\x46\x5f\xae\x58\x2a\x57\x0e\x9f\x29" "\x2d\xcc\x4d\x46\xed\x59\xd9\x03\x91\xcf\xd5\x7f\xea\xb2\xbf\xe1\xf7" "\x50\x47\xb3\xdf\xc3\xaf\xd7\x8f\xde\x51\x7f\x36\x22\x1e\x89\x88\x8f" "\x7b\xf6\x27\x67\xa6\x7b\x3b\x9d\x36\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\xac\x73\xa0\xc5\xf3\xff\x53\xbf\xf6\x74\x7a" "\xed\x00\x80\x1d\xd3\xdb\xe9\x15\x00\x00\x76\x9d\xf3\x3f\x00\xec\x3d" "\xdb\x3d\xff\x1b\x2f\x00\xc0\xc3\xcf\xf9\x1c\x00\xf6\x1e\xe7\x7f\x00" "\xd8\x7b\x9c\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\xd8\x61\xa7\x4e\x9e\x4c\xa7\xea\x5f\x2b\xcb\x13\x69" "\x7d\xf2\xdc\xe2\xc2\x4c\xe9\xdc\x91\xc9\x42\x79\x66\x78\x76\x61\x62" "\x78\xa2\x34\x7f\x76\x78\xaa\x54\x9a\x2a\x16\x86\x27\x4a\xb3\x9b\xbd" "\x5f\xb1\x54\x3a\x3b\x16\x73\x0b\xe7\x47\x2a\x85\x72\x65\xa4\xbc\xb8" "\x74\x7a\xb6\xb4\x30\x57\x39\x3d\x3d\x3b\x3e\x55\x38\x5d\xc8\xef\x4a" "\x56\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb0\x3d" "\xe5\xc5\xa5\x99\xf1\x62\xb1\x30\xaf\xf0\xe0\x17\xf2\x11\xd1\xa1\xe8" "\xd5\x6a\xf5\xc2\x83\xf1\x21\x28\x34\x2b\x5c\xcc\xf6\xe7\xf6\xbd\x73" "\x87\x0f\x4c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0f\x89\x7f\x03\x00\x00\xff\xff" "\x72\x73\x16\x22", 1925); syz_mount_image(/*fs=*/0x20000080, /*dir=*/0x200000c0, /*flags=MS_LAZYTIME|MS_NOATIME|MS_DIRSYNC*/ 0x2000480, /*opts=*/0x20002b40, /*chdir=*/3, /*size=*/0x785, /*img=*/0x20000cc0); break; case 1: memcpy((void*)0x200001c0, "./file0\000", 8); syscall(__NR_chdir, /*dir=*/0x200001c0ul); break; case 2: memcpy((void*)0x200000c0, "vfat\000", 5); memcpy((void*)0x20003200, "./file2\000", 8); memcpy( (void*)0x20000c00, "\x78\x9c\xec\xdc\xcb\x6b\x2b\x55\x1c\xc0\xf1\x5f\x1e\xcd\xab\xb4\xc9" "\x42\x14\x05\xe9\x41\x37\xba\x19\xda\xe8\x5a\x0c\xd2\x82\x18\xb0\xb4" "\x8d\xd8\x0a\xc2\xb4\x9d\x68\xc8\x98\x94\x4c\xa8\x44\xc4\xb6\x2b\xb7" "\xe2\xde\x95\xe0\xa2\x74\xd9\x5d\x41\xfb\x0f\x64\xe3\x4e\x37\x6e\xdc" "\x75\x73\xe1\x2e\x6e\x17\x97\x3b\x97\x99\xcc\x24\x93\x57\x9b\xa6\x8f" "\xf4\xb6\xdf\x0f\x94\x9c\x9c\x73\x7e\x99\x73\x72\x4e\xcb\x6f\x86\xce" "\x9c\x7d\xf9\xcb\x77\xe5\xa2\xa5\x15\xf5\xba\x84\x13\x4a\x42\x22\x22" "\xe7\x22\x19\x09\x8b\x2f\xe4\xbd\x86\xdd\x72\x4c\x82\xf6\xe5\xfd\xe9" "\xa7\xff\xbc\xbd\xba\xbe\xf1\x59\x2e\x9f\x5f\x5c\x51\x6a\x29\xb7\xf6" "\x41\x56\x29\x35\x3b\xf7\xe7\xf7\x3f\x26\xbd\x6e\x27\x71\x69\x66\xbe" "\x3e\x7b\x92\xfd\xbf\xf9\x7a\xf3\xcd\xb3\x17\x6b\xdf\x96\x2c\x55\xb2" "\x54\xa5\x5a\x57\xba\xda\xac\xfe\x57\xd7\x37\x4d\x43\x6d\x97\xac\xb2" "\xa6\xd4\xb2\x69\xe8\x96\xa1\x4a\x15\xcb\xa8\xb5\xda\xab\xad\xf6\xa2" "\x59\xdd\xd9\x69\x28\xbd\xb2\x3d\x93\xda\xa9\x19\x96\xa5\xf4\x4a\x43" "\x95\x8d\x86\xaa\x57\x55\xbd\xd6\x50\xfa\x37\x7a\xa9\xa2\x34\x4d\x53" "\x33\x29\x79\x8c\xa6\xae\xd4\xbb\x70\xb8\xb2\xa2\xe7\xc6\x3c\xd4\xd6" "\x98\x71\xb8\x63\xb5\x5a\x4e\x8f\x88\x48\xb2\xaf\xa5\x70\x38\x91\x01" "\x01\x00\x80\x89\x72\xf2\x82\x60\xfe\x1f\x76\x52\xfa\xb1\xf2\x7f\x99" "\x75\xf3\x7f\xa7\x73\x27\xff\x3f\x7a\xe7\xb4\x3e\xfd\xc5\xf1\xac\x97" "\xff\x9f\xc4\x06\xe5\xff\x1f\xfe\xdb\xfa\xac\xae\xfc\x3f\x21\x22\xe3" "\xe4\xff\xbf\xc9\x15\xf2\xff\xfe\x8c\xe8\x41\xeb\x3b\x39\xb8\x56\xfe" "\x8f\xfb\x61\x2e\xd6\x57\x15\xea\x7a\xe7\xe4\xff\x29\xef\xf7\xd7\x75" "\xf0\xd5\xd1\xbc\x5b\x20\xff\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\xe0\x55\x70\x6e\xdb\x69\xdb\xb6\xd3\xfe" "\xab\xff\xd3\xb9\x85\xc0\x7b\x8f\x07\x69\xd8\xfa\xc7\x45\x24\xe1\xac" "\xbe\xcd\xfa\x3f\x64\xab\xeb\x1b\x92\x70\x6f\xdc\x73\xd6\xd8\xfc\x79" "\xb7\xb0\x5b\x68\xbd\x7a\x1d\x4e\x45\xc4\x14\x43\xe6\x25\x2d\xcf\xdd" "\xfd\xe0\x71\xca\xfe\x9d\x47\xca\x91\x91\xbf\xcc\x3d\x2f\x7e\x6f\xb7" "\x10\x71\x5b\x72\x45\x29\xb9\xf1\x0b\x92\x96\x4c\x6f\xbc\x6d\x2f\x7d" "\x9a\x5f\x5c\x50\x2d\x5e\x7c\xfb\x36\xa5\x54\x30\x3e\x2b\x69\x79\x6d" "\x70\x7c\xb6\x3b\xde\x3b\x7e\x4c\xde\x7b\x37\x10\xaf\x49\x5a\xfe\xde" "\x92\xaa\x98\xb2\xed\xee\xeb\x4e\xfc\x4f\x0b\x4a\x7d\xf2\x79\xbe\x27" "\x3e\xe9\xf6\x6b\x8b\xdf\xe1\xa2\x00\x00\x00\x00\x00\x70\xc3\x34\xd5" "\x36\xf0\xfc\x5d\xd3\x86\xb5\xb7\x9e\x32\x92\x2b\xba\x97\x89\x86\x5c" "\x1f\x68\x9d\x5f\xcf\x0f\x3c\x3f\x8f\xa6\xdf\x6a\x4e\x7a\xf6\x00\x00" "\x00\x00\x00\x3c\x0e\x56\xe3\x87\xb2\x6e\x9a\x46\xed\x82\x42\x52\x2e" "\xef\x33\x7e\x21\x3a\x5a\xe7\x98\x5b\xf0\xff\xe1\xa0\xac\x4f\x5d\xd4" "\x39\x12\x98\xe1\xa8\xe3\x89\xb9\x17\x32\x44\xae\x3b\xaf\xdf\x47\xfc" "\x56\xbb\x0a\x9d\x79\x05\x9a\x12\x5e\xe5\x78\xe3\xf1\xe7\x7f\x63\xeb" "\xb5\x1f\xac\x09\xcb\x08\x51\xd1\xde\xc1\xcf\x39\x15\xea\x8a\x47\x3f" "\xf0\x26\xd2\xae\x89\x7a\x15\xb1\x21\xdf\xb3\x2c\xf7\x7f\x4e\xf8\x82" "\x9d\x30\x75\x63\xfb\xf9\x8d\x5f\xff\x78\x36\x4a\xe7\x78\x70\x3a\x43" "\x0b\x1f\x1d\xfb\x3b\xe0\xf2\xa3\x1f\x8c\x3b\xe6\x44\xcf\xae\x3b\x72" "\x07\xe6\x3f\x29\x3a\x72\x5b\x7f\x77\x00\x00\x00\x00\xdc\xbd\xce\xf9" "\x80\x5f\xf3\x71\xb0\x39\x34\x91\x41\x01\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf0\xc8" "\xdc\xca\x23\xfd\x7a\x0a\x93\x9e\x23\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x70\x5f\xbc\x0c\x00\x00\xff\xff\x65\x63\xf1\x39", 830); syz_mount_image(/*fs=*/0x200000c0, /*dir=*/0x20003200, /*flags=MS_REC|MS_NODEV|0x200*/ 0x4204, /*opts=*/0x20003240, /*chdir=*/6, /*size=*/0x33e, /*img=*/0x20000c00); break; case 3: memcpy((void*)0x200005c0, "./bus\000", 6); syscall(__NR_open, /*file=*/0x200005c0ul, /*flags=O_SYNC|O_NONBLOCK|O_NOATIME|O_DIRECT|O_CREAT|0x2002*/ 0x147842ul, /*mode=*/0ul); break; case 4: memcpy((void*)0x20000380, "/dev/loop", 9); *(uint8_t*)0x20000389 = 0x30 + procid * 1; *(uint8_t*)0x2000038a = 0; memcpy((void*)0x20000140, "./bus\000", 6); syscall(__NR_mount, /*src=*/0x20000380ul, /*dst=*/0x20000140ul, /*type=*/0ul, /*flags=MS_BIND*/ 0x1000ul, /*data=*/0ul); break; case 5: memcpy((void*)0x20000000, "./bus\000", 6); res = syscall(__NR_open, /*file=*/0x20000000ul, /*flags=O_SYNC|O_NOCTTY|O_NOATIME|O_RDWR|0x3c*/ 0x14113eul, /*mode=*/0ul); if (res != -1) r[0] = res; break; case 6: memcpy((void*)0x200001c0, "cgroup.controllers\000", 19); syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200001c0ul, /*flags=*/0x275aul, /*mode=*/0ul); break; case 7: syscall(__NR_read, /*fd=*/r[0], /*buf=*/0x20001700ul, /*len=*/0x2020ul); break; case 8: memcpy((void*)0x20000080, "#! ", 3); *(uint8_t*)0x20000083 = 0xa; syscall(__NR_write, /*fd=*/r[0], /*data=*/0x20000080ul, /*len=*/0x208e24bul); break; case 9: memcpy((void*)0x20000580, "./" "file1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\000", 247); syz_mount_image(/*fs=*/0, /*dir=*/0x20000580, /*flags=*/0, /*opts=*/0, /*chdir=*/0, /*size=*/0, /*img=*/0); break; } } int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x20000000ul, /*len=*/0x1000000ul, /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/ 7ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x21000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1, /*offset=*/0ul); setup_sysctl(); for (procid = 0; procid < 5; procid++) { if (fork() == 0) { loop(); } } sleep(1000000); return 0; }