// https://syzkaller.appspot.com/bug?id=8d28769a7829c99fe344f48407dcd992c47add54 // 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 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; } 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"); } 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); 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++) { 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[2] = {0xffffffffffffffff, 0xffffffffffffffff}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: NONFAILING(memcpy((void*)0x20000740, "ext4\000", 5)); NONFAILING(memcpy((void*)0x20000040, "./bus\000", 6)); NONFAILING(memcpy( (void*)0x20000440, "\x00\x89\xf2\x83\x27\x30\xbf\x99\x4f\x58\x98\x85\xcc\x76\x9f\xe9\xff" "\x0f\x61\xf4\x6a\xbe\xbb\xde\x12\xc3\x00\x00\x00\x00\x00\x00\x00\x00" "\x4f\x9c\xcb\x1b\xb4\x34\xbf\xd3\x00\x00\x98\xc9\x4e\x05\x6c\x08\x50" "\x98\x0a\x00\x83\xcf\xe8\xb4\x22\x98\x7b\x76\x00\x00\x00\x00\xf2\x93" "\x5e\x17\x62\x97\xb1\x08\x4a\x51\xbd\x8f\x96\x8f\x05\xa5\xd6\x57\x83" "\x2f\xf1\x43\x1d\x56\x21\x36\xb4\xda\x36\x01\x17\xf7\x75\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\xbb\xa7\xdc\x7f\xca\x7c\x1c\xd1\xd8\xd0\xef" "\x48\x7a\x65\x8a\x9c\xa8\xd9\xa9\x77\x46\x73\x67\x98\x56\x2f\xb2\xab" "\x78\xaf\xa0\xce\x15\x44\x9e\x28\x77\x79\x3e\x46\x89\x74\xc8\x29\xbd" "\xec\x6f\xa5\x5d\xff\xee\x9d\x4a\x3d\x79\xf2\x42\x19\x47\x2a\x8f\xb1" "\xc3\x83\xf3\xb6\x07\xbd\x1e\xb9\x95\xde\x5c\x87\x40\xff\x8b\x61\xa5" "\xe6\xc4\xe8\x26\x2c\x27\x68\xc2\x96\x27\xaa\x05\x89\x72\x7a\xcd\xfa" "\x3a\xe7\x61\x5a\xbd\x1d\xb4\x48\xfa\xc3\x3f\x7a\x6b\xa8\xb3\x27\x3b" "\xf0\x2c\x2c\x7b\xc5\x6a\xc9\xec\x78\xf9\x2d\xfa\x51\xdb\xfd\x53\x17" "\xd5\xa0\xa7\xdb\xeb\x3d\x71\xa5\x68\x0c\xb3\xa3\xa1\x25\x83\x30\x9f" "\x59\x7e\x50\x9a\x6e\xd8\x51\x0e\xd5\x54\xaf\x64\xd9\x7e\x13\x35\x79" "\x59\xbb\x7f\x42\x8c\xb3", 278)); NONFAILING(sprintf((char*)0x20000556, "%020llu", (long long)-1)); NONFAILING(memcpy( (void*)0x20001640, "\x78\x9c\xec\xdc\xcf\x6b\x1c\x75\x1f\x07\xf0\xcf\x4c\xb3\xfd\x99\xe7" "\xd9\x3c\xf0\x1c\x9e\xc7\x83\x08\x2d\xb4\x50\x3a\x49\x9a\x4b\x7b\x32" "\x5e\xc4\x4b\xa1\x50\xf0\x5a\x43\x32\x09\x21\x93\x6c\xc9\x6e\x6a\x13" "\x0b\x6d\x3d\x0b\xb5\xb9\x28\x08\xa2\x77\x8f\x5e\x85\x52\xff\x00\x6f" "\x52\x50\xf0\x2e\x88\xd6\x78\x10\x2f\x91\xd9\x6c\xb6\x6d\xba\xbb\x6e" "\xdb\x24\x2b\xf1\xf5\x82\xe9\x7e\xbf\xf3\x63\xdf\xdf\xcf\x76\xf2\xcd" "\x0c\x64\x36\x80\x7f\xac\xd7\xca\x7f\x92\x88\xe1\x88\xb8\x1c\x11\xd5" "\xd6\xfa\x34\x22\x0e\x37\x5b\x47\x23\x6e\x6f\xed\xb7\xf1\xe8\xe6\x74" "\xb9\x24\xb1\xb9\x79\xe5\xe7\xa4\x3c\x2c\x36\x36\xab\xed\xf7\x4a\x5a" "\xaf\x27\xa2\x79\x48\xfc\x2f\x22\x1e\x54\x22\xce\xbe\xff\x6c\x6e\x7d" "\x75\x6d\x61\xaa\x28\xf2\xe5\x56\x7f\xb4\xb1\x78\x6d\xb4\xbe\xba\x76" "\x6e\x7e\x71\x6a\x2e\x9f\xcb\x97\xc6\x27\x2e\x8e\x5d\x98\x98\xb8\x30" "\x36\xb1\x6b\xb5\x9e\x7a\xfb\xe2\xb1\x7b\xdf\xbc\xb9\xbe\xfe\xed\x97" "\x8d\xbb\xaf\x0e\x9d\x4b\x62\xb2\x59\x77\xb4\x6a\xdb\xb5\xa0\x27\x6c" "\x7d\x26\x95\x98\xdc\xb1\x7e\x69\x2f\xc2\x06\x28\xe9\x63\x9f\xa1\x7d" "\x18\x07\x00\x00\xbd\x95\xd7\xf9\x87\x5a\xd7\x66\x95\xa8\xc6\x21\x57" "\x69\x00\x00\x00\x70\xe0\x6c\x1e\xd9\x04\x00\x00\x00\x0e\xbc\x24\x06" "\x3d\x02\x00\x00\x00\x60\x6f\x6d\xff\x1d\xc0\xf6\xb3\xbd\x7b\xf5\x1c" "\x6c\x37\x3f\xbd\x11\x11\x23\x9d\xf2\x87\x9a\xcf\x10\x47\x1c\x8d\x4a" "\x44\x1c\xdf\x48\x9e\x7a\x32\x21\xd9\x3a\x0c\x5e\xca\xed\x3b\x11\x71" "\x7f\xb2\xc3\xf9\x97\xb4\xce\xbf\x17\x37\xb6\xa3\xdf\xcf\x33\xd2\xec" "\xaf\xfb\xe5\xfc\x33\xd9\x69\xfe\x49\xdb\xf3\x4f\x74\x98\x7f\x86\xb6" "\xbf\x3b\xe1\x25\x75\x9f\xff\x1e\xe7\x1f\xea\x32\xff\x5d\xee\x33\xe3" "\xab\x4f\xff\x5f\xe9\x9a\x7f\x27\xe2\x95\xa1\x4e\xf9\x49\x3b\x3f\xe9" "\x92\xff\x4e\x9f\xf9\x77\xd7\x3f\xb8\xd7\x6d\xdb\xe6\xe7\x11\xa7\x3b" "\xfe\xfe\x49\x9e\xca\xea\xf1\xfd\x10\xa3\xb3\xf3\x45\xcf\x1f\xad\x07" "\x7f\x9c\x79\xd8\xab\xfe\xe3\xcf\xe4\x27\x49\x33\x35\xe9\x5d\xff\xb5" "\x3e\xeb\x7f\x6f\xe3\xd7\x85\x6e\x73\x49\x99\x7f\xe6\x64\xef\xff\xff" "\x4e\xf9\xe5\x39\xf1\x61\x6b\x1c\x69\x44\xdc\x6b\xbd\x96\xfd\xf5\x1d" "\x19\x27\x17\xbf\xfb\xfa\xd9\xe4\xe4\xf6\x76\xfe\x4c\x97\xcf\xbf\x73" "\xfe\x5b\xed\xfa\x3f\xeb\xb3\xfe\x1f\xbe\x38\x72\xa3\xcf\x5d\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\xa0\x29\x8d\x88\xe1\x48\xd2\xac" "\xdd\x4e\xd3\x2c\x8b\x38\x11\x11\xff\x8d\xe3\x69\x51\xab\x37\xce\xce" "\xd6\x56\x96\x66\xca\x6d\x11\x23\x51\x49\x67\xe7\x8b\x7c\x2c\x22\xaa" "\x5b\xfd\xa4\xec\x8f\x37\xdb\x8f\xfb\xe7\x77\xf4\x27\x22\xe2\x3f\xdf" "\x1f\xdb\x0a\x9d\x2f\xf2\x6c\xba\x56\xcc\x0c\xba\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" "\x00\x00\x00\x00\x00\x00\x00\x00\xda\x4e\x44\xc4\x70\x24\x69\x16\x11" "\x69\x44\xfc\x56\x4d\xd3\x2c\x1b\xf4\xa8\x00\x00\x00\x80\x5d\x37\x32" "\xe8\x01\x00\x00\x00\x00\x7b\xce\xfd\x3f\x00\x00\x00\x1c\x7c\x2f\x7a" "\xff\x9f\xec\xf2\x38\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\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\x03\xed\xf2\xa5\x4b\xe5\xb2\xb9\xf1\xe8\xe6\x74\xd9\x9f\xb9\xbe" "\xba\xb2\x50\xbb\x7e\x6e\x26\xaf\x2f\x64\x8b\x2b\xd3\xd9\x74\x6d\xf9" "\x5a\x36\x57\xab\xcd\x15\x79\x36\x5d\x5b\xfc\xab\xf7\x4b\x23\x62\xfc" "\x62\xac\xdc\x18\x6d\xe4\xf5\xc6\x68\x7d\x75\xed\xea\x62\x6d\x65\xa9" "\x71\x75\x7e\x71\x6a\x2e\xbf\x9a\x57\xf6\xa5\x2a\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x9e\xd7\x70\x73\x49\xd2\x2c\x22\xd2\x66" "\x3b\x4d\xb3\x2c\xe2\x5f\x11\x31\x12\x95\x64\x76\xbe\xc8\xc7\x22\xe2" "\xdf\x11\xf1\xb0\x5a\x39\x52\xf6\xc7\x07\x3d\x68\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x76\x5d\x7d\x75\x6d\x61\xaa\x28\xf2\x65" "\x0d\x0d\x8d\x7d\x6b\xdc\x8a\x88\xbf\xc1\x30\x7a\x34\x06\x3d\x33\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\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x30\x08\xf5\xd5\xb5\x85\xa9" "\xa2\xc8\x97\xeb\x83\x1e\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x83\x95\xfe\x98\x44\x44\xb9\x9c\xae\x9e\x1a\xde\xb9\xf5\x70" "\xf2\x7b\xb5\xf9\x1a\x11\xef\x7e\x72\xe5\xa3\x1b\x53\x8d\xc6\xf2\x78" "\xb9\xfe\x97\xf6\xfa\xc6\xc7\xad\xf5\xe7\x9f\x38\xf0\xd6\x7e\xd6\x00" "\x00\x00\x00\x07\xde\xeb\xcf\xb3\xf3\xf6\x7d\xfa\xf6\x7d\x3c\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x40\xbf\xea\xab\x6b\x0b\x53\x45\x91\x2f\xef\x61\x23\xee\x0c\xba" "\x4a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\xe0\x45\xfc\x19\x00\x00\xff\xff\x2d\x73" "\xc5\xe7", 1872)); NONFAILING(syz_mount_image(0x20000740, 0x20000040, 0x2804c00, 0x20000440, 1, 0x750, 0x20001640)); break; case 1: NONFAILING(memcpy((void*)0x20000080, "./file0\000", 8)); syscall(__NR_chdir, 0x20000080ul); break; case 2: NONFAILING(memcpy((void*)0x200000c0, "./bus\000", 6)); syscall(__NR_open, 0x200000c0ul, 0x14da42ul, 0ul); break; case 3: NONFAILING(memcpy((void*)0x20000380, "/dev/loop", 9)); NONFAILING(*(uint8_t*)0x20000389 = 0x30 + procid * 1); NONFAILING(*(uint8_t*)0x2000038a = 0); NONFAILING(memcpy((void*)0x20000180, "./bus\000", 6)); syscall(__NR_mount, 0x20000380ul, 0x20000180ul, 0ul, 0x1000ul, 0ul); break; case 4: NONFAILING(memcpy((void*)0x20000400, "./bus\000", 6)); res = syscall(__NR_open, 0x20000400ul, 0x14113eul, 0ul); if (res != -1) r[0] = res; break; case 5: NONFAILING(memcpy((void*)0x200001c0, "memory.current\000", 15)); res = syscall(__NR_openat, 0xffffff9c, 0x200001c0ul, 0x275aul, 0ul); if (res != -1) r[1] = res; break; case 6: syscall(__NR_write, r[1], 0x20000000ul, 0x208e24bul); break; case 7: syscall(__NR_write, r[0], 0x200000c0ul, 0x208e24bul); break; } } int main(void) { syscall(__NR_mmap, 0x1ffff000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul); syscall(__NR_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x32ul, -1, 0ul); syscall(__NR_mmap, 0x21000000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul); install_segv_handler(); for (procid = 0; procid < 6; procid++) { if (fork() == 0) { loop(); } } sleep(1000000); return 0; }