// https://syzkaller.appspot.com/bug?id=073f2a74db93d4a584beb6a9e5ebeb7029aacf5e // 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, 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[3] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: memcpy((void*)0x20000580, "ext4\000", 5); memcpy((void*)0x200005c0, "./file0\000", 8); memcpy((void*)0x200000c0, "grpquota", 8); *(uint8_t*)0x200000c8 = 0x2c; memcpy((void*)0x200000c9, "debug_want_extra_isize", 22); *(uint8_t*)0x200000df = 0x3d; sprintf((char*)0x200000e0, "0x%016llx", (long long)0x82); *(uint8_t*)0x200000f2 = 0x2c; memcpy((void*)0x200000f3, "nodiscard", 9); *(uint8_t*)0x200000fc = 0x2c; memcpy((void*)0x200000fd, "nojournal_checksum", 18); *(uint8_t*)0x2000010f = 0x2c; memcpy((void*)0x20000110, "data=ordered", 12); *(uint8_t*)0x2000011c = 0x2c; memcpy((void*)0x2000011d, "init_itable", 11); *(uint8_t*)0x20000128 = 0x3d; sprintf((char*)0x20000129, "0x%016llx", (long long)3); *(uint8_t*)0x2000013b = 0x2c; memcpy((void*)0x2000013c, "usrquota", 8); *(uint8_t*)0x20000144 = 0x2c; memcpy((void*)0x20000145, "max_dir_size_kb", 15); *(uint8_t*)0x20000154 = 0x3d; sprintf((char*)0x20000155, "0x%016llx", (long long)0x40d2); *(uint8_t*)0x20000167 = 0x2c; *(uint8_t*)0x20000168 = 0; memcpy( (void*)0x20000c00, "\x78\x9c\xec\xdd\xcf\x6f\x14\x55\x1c\x00\xf0\xef\x6c\x7f\xd0\x52\xb4" "\x85\x18\x15\x0f\xd2\xc4\x18\x48\x94\x96\x16\x30\xc4\x78\x80\xab\x21" "\x0d\xfe\x88\x17\x2f\x56\x5a\x10\x29\xd0\xd0\x1a\x2d\x9a\x50\x12\xbc" "\x98\x18\x2f\xc6\x98\x78\xf2\x20\xfe\x17\x4a\xe4\xca\x49\x4f\x1e\xbc" "\x78\x32\x24\x44\x0d\x47\x13\xd7\xcc\x76\xa6\x74\xdb\xd9\x96\x2e\x6d" "\xa7\x32\x9f\x4f\xb2\xf4\xcd\x7b\x3b\xbc\x37\xdd\x7e\xfb\xde\xbe\xbe" "\x37\x1b\x40\x65\x0d\xa6\xff\xd4\x22\xf6\x46\xc4\x74\x12\xd1\x9f\xcc" "\x2f\x96\x75\x46\x56\x38\xb8\xf0\xbc\x7b\x7f\x7f\x72\x3a\x7d\x24\x51" "\xaf\xbf\xf1\x67\x12\x49\x96\x97\x3f\x3f\xc9\xbe\xf6\x65\x27\xf7\x44" "\xc4\xcf\x3f\x25\xb1\xa7\x63\x65\xbd\x33\x73\x57\xce\x8f\x4f\x4d\x4d" "\x5e\xce\x8e\x87\x67\x2f\x4c\x0f\xcf\xcc\x5d\x39\x78\xee\xc2\xf8\xd9" "\xc9\xb3\x93\x17\x47\x5f\x1a\x3d\x76\xf4\xc8\xd1\x63\x23\x87\xda\xba" "\xae\xab\x05\x79\x27\xaf\xbf\xff\x61\xff\x67\x63\x6f\x7f\xf7\xcd\x3f" "\xc9\xc8\xf7\xbf\x8d\x25\x71\x3c\x5e\xcd\x9e\xb8\xf4\x3a\x36\xca\x60" "\x0c\x36\xbe\x27\xc9\xca\xa2\xbe\x63\x1b\x5d\x59\x49\x3a\xb2\x9f\x93" "\xa5\x2f\x71\xd2\x59\x62\x83\x58\x97\xfc\xf5\xeb\x8a\x88\xa7\xa2\x3f" "\x3a\xe2\xfe\x8b\xd7\x1f\x9f\xbe\x56\x6a\xe3\x80\x4d\x55\x4f\x22\xea" "\x40\x45\x25\xe2\x1f\x2a\x2a\x1f\x07\xe4\xef\xed\x97\xbf\x0f\xae\x95" "\x32\x2a\x01\xb6\xc2\xdd\x13\x0b\x13\x00\x2b\xe3\xbf\x73\x61\x6e\x30" "\x7a\x1a\x73\x03\x3b\xef\x25\xb1\x74\x5a\x27\x89\x88\xf6\x66\xe6\x9a" "\xed\x8a\x88\xdb\xb7\xc6\xae\x9f\xb9\x35\x76\x3d\x36\x69\x1e\x0e\x28" "\x36\x7f\x2d\x22\x9e\x2e\x8a\xff\xa4\x11\xff\x03\xd1\x13\x03\x8d\xf8" "\xaf\x35\xc5\x7f\x3a\x2e\x38\x95\x7d\x4d\xf3\x5f\x6f\xb3\xfe\xe5\x53" "\xc5\xe2\x1f\xb6\xce\x42\xfc\xf7\xac\x1a\xff\xd1\x22\xfe\xdf\x59\x12" "\xff\xef\xb6\x59\xff\xe0\xfd\xe4\x7b\xbd\x4d\xf1\xdf\xdb\xee\x25\x01" "\x00\x00\x00\x00\x00\x40\x65\xdd\x3c\x11\x11\x2f\x16\xfd\xfd\xbf\xb6" "\xb8\xfe\x27\x0a\xd6\xff\xf4\x45\xc4\xf1\x0d\xa8\x7f\x70\xd9\xf1\xca" "\xbf\xff\xd7\xee\x6c\x40\x35\x40\x81\xbb\x27\x22\x5e\x29\x5c\xff\x5b" "\xcb\x57\xff\x0e\x74\x64\xa9\xc7\x1a\xeb\x01\xba\x92\x33\xe7\xa6\x26" "\x0f\x45\xc4\xe3\x11\x71\x20\xba\x76\xa4\xc7\x23\xab\xd4\x71\xf0\xf3" "\x3d\x5f\xb7\x2a\x1b\xcc\xd6\xff\xe5\x8f\xb4\xfe\xdb\xd9\x5a\xc0\xac" "\x1d\x77\x3a\x77\x34\x9f\x33\x31\x3e\x3b\xfe\xb0\xd7\x0d\x44\xdc\xbd" "\x16\xf1\x4c\xe1\xfa\xdf\x64\xb1\xff\x4f\x0a\xfa\xff\xf4\xf7\xc1\xf4" "\x03\xd6\xb1\xe7\xf9\x1b\xa7\x5a\x95\xad\x1d\xff\xc0\x66\xa9\x7f\x1b" "\xb1\xbf\xb0\xff\xbf\x7f\xd7\x8a\x64\xf5\xfb\x73\x0c\x37\xc6\x03\xc3" "\xf9\xa8\x60\xa5\x67\x3f\xfe\xe2\x87\x56\xf5\xb7\x1b\xff\x6e\x31\x01" "\x0f\x2f\xed\xff\x77\xae\x1e\xff\x03\xc9\xd2\xfb\xf5\xcc\xac\xbf\x8e" "\xc3\x73\x9d\xf5\x56\x65\xed\x8e\xff\xbb\x93\x37\x1b\xb7\x9c\xe9\xce" "\xf2\x3e\x1a\x9f\x9d\xbd\x3c\x12\xd1\x9d\x9c\xec\x48\x73\x9b\xf2\x47" "\xd7\xdf\x66\x78\x14\xe5\xf1\x90\xc7\x4b\x1a\xff\x07\x9e\x5b\x7d\xfe" "\xaf\x68\xfc\xdf\x1b\x11\xf3\xcb\xfe\xef\xe4\xaf\xe6\x3d\xc5\xb9\x27" "\xff\xed\xfb\xbd\x55\x7b\x8c\xff\xa1\x3c\x69\xfc\x4f\xac\xab\xff\x5f" "\x7f\x62\xf4\xc6\xc0\x8f\xad\xea\x7f\xb0\xfe\xff\x48\xa3\xaf\x3f\x90" "\xe5\x98\xff\x83\x05\x5f\xe5\x61\xda\xdd\x9c\x5f\x10\x8e\x9d\x45\x45" "\x5b\xdd\x5e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x78\x14\xd4\x22\x62\x57" "\x24\xb5\xa1\xc5\x74\xad\x36\x34\x14\xd1\x17\x11\x4f\xc4\xce\xda\xd4" "\xa5\x99\xd9\x17\xce\x5c\xfa\xe0\xe2\x44\x5a\xd6\xf8\xfc\xff\x5a\xfe" "\x49\xbf\xfd\x0b\xc7\x49\xfe\xf9\xff\x03\x4b\x8e\x47\x97\x1d\x1f\x8e" "\x88\xdd\x11\xf1\x65\x47\x6f\xe3\x78\xe8\xf4\xa5\xa9\x89\xb2\x2f\x1e" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb6\x89" "\xbe\x16\xfb\xff\x53\x7f\x74\x94\xdd\x3a\x60\xd3\x75\x96\xdd\x00\xa0" "\x34\x05\xf1\xff\x4b\x19\xed\x00\xb6\x9e\xfe\x1f\xaa\x4b\xfc\x43\x75" "\x89\x7f\xa8\x2e\xf1\x0f\xd5\x25\xfe\xa1\xba\xc4\x3f\x54\x97\xf8\x87" "\xea\x12\xff\x00\x00\x00\x00\x00\xf0\x48\xd9\xbd\xef\xe6\xaf\x49\x44" "\xcc\xbf\xdc\xdb\x78\xa4\xba\xb3\xb2\xae\x52\x5b\x06\x6c\xb6\x5a\xd9" "\x0d\x00\x4a\xe3\x16\x3f\x50\x5d\x96\xfe\x40\x75\x79\x8f\x0f\x24\x6b" "\x94\xf7\xb4\x3c\x69\xad\x33\x57\x33\x7d\xfa\x21\x4e\x06\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x80\xca\xd9\xbf\xd7\xfe\x7f\xa8\x2a\xfb\xff" "\xa1\xba\xec\xff\x87\xea\xca\xf7\xff\xef\x2b\xb9\x1d\xc0\xd6\xf3\x1e" "\x1f\x88\x35\x76\xf2\x17\xee\xff\x5f\xf3\x2c\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x60\x23\xcd\xcc\x5d\x39\x3f\x3e\x35\x35\x79\x59\xe2" "\xad\xed\xd1\x8c\xad\x4c\xd4\xeb\xf5\xab\xe9\x4f\xc1\x76\x69\xcf\xff" "\x3c\x91\x2f\x85\xdf\x2e\xed\x59\x96\xc8\xf7\xfa\x3d\xd8\x59\xe5\xfd" "\x4e\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x9a\xfd\x17\x00\x00\xff\xff\x16\x12\x24\xc5", 1496); syz_mount_image(0x20000580, 0x200005c0, 0x1008002, 0x200000c0, 1, 0x5d8, 0x20000c00); break; case 1: memcpy((void*)0x20002000, "./bus\000", 6); res = syscall(__NR_open, 0x20002000ul, 0x143142ul, 0ul); if (res != -1) r[0] = res; break; case 2: memcpy((void*)0x20000040, "./bus\000", 6); res = syscall(__NR_open, 0x20000040ul, 0x147042ul, 0ul); if (res != -1) r[1] = res; break; case 3: syscall(__NR_ftruncate, r[1], 0x2007ffful); break; case 4: syscall(__NR_sendfile, r[0], r[1], 0ul, 0x1000000201005ul); break; case 5: 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, 0x20000380ul, 0x20000140ul, 0ul, 0x1000ul, 0ul); break; case 6: memcpy((void*)0x20002000, "./bus\000", 6); res = syscall(__NR_open, 0x20002000ul, 0x143042ul, 0ul); if (res != -1) r[2] = res; break; case 7: *(uint64_t*)0x200014c0 = 0; *(uint64_t*)0x200014c8 = 0; *(uint64_t*)0x200014d0 = 0; *(uint64_t*)0x200014d8 = 0; *(uint64_t*)0x200014e0 = 0; *(uint64_t*)0x200014e8 = 0; *(uint64_t*)0x200014f0 = 0; *(uint64_t*)0x200014f8 = 0; *(uint64_t*)0x20001500 = 0x200004c0; memcpy( (void*)0x200004c0, "\xd3\x25\xd5\x12\x13\x6e\xfa\xc1\x9c\x33\x47\x09\xcf\x13\xf9\xa9\xac" "\x3d\x2d\x36\x20\x64\x0a\x56\xdf\x58\xa5\x62\xea\x3d\x18\x2f\xfa\x18" "\xdc\x34\x7b\xdd\x8f\xcb\x18\xbb\x6f\x22\x3b\x6f\xe0\xc6\x40\xbf\x1b" "\xd8\xa3\x55\xb0\x41\xab\xa3\x3b\x90\x0c\x45\x25\xff\x33\xe2\x0e\x34" "\x9f\xd2\xba\x0b\x3e\x61\x10\xfe\x0e\x4e\x57\x8b\x0b\x20\x65\xd2\x91" "\x95\x3e\x5c\x09\x2a\x9f\x20\x6e\x04\xe8\xe8\x2b\x1a\xc7\x1b\xda\x18" "\x00\xed\x45\x75\xf2\x39\x47\x08\xe0\xef\xe1\xdd\x13\x43\x3c\xc2\x68" "\xc1\x19\x26\x6f\x3e\xd4\x5a\x3f\x0a\xd4\x14\xbe\xf1\x4e\x87\x4d\x28" "\xb6\xa1\x80\x3b\xc2\x86\x49\x6a\x25\xe7\xb2\x22\x92\xaf\x72\x43\xe5" "\x1b\x9f\x51\x29\x7b\xf1\xa3\x52\xab\x5e\xb0\x9a\x13\xa1\x10\x98\x9a" "\x31\x42\x86\x68\xed\x8d\x14\x57\x2f\xc1\x2a\xcc\xb5\x68\x48\xf6\x3d" "\x8f\x22\xcb\xab\x78\x9f\xfc\xb9\xd5\xc1\x0f\x1e\xe9\x0a\x3e\x8a\x76" "\xe0\xf9\x8a\x8f\x0c\x3e\x8f\x5f\xfe\x38\xcc\xea\x34\xea\xdd\x6a\xae" "\xfb\x8a\x5a\x79\x1b\xeb\x60\x63\xe4\x1f\x73\x9f\xe9\xef\x9d\x87\xae" "\xaf\xa7\x50\xde\xad\x49\x41\x61\x69\xa1\x13\x8f\x33\xb4\xf0\x72\xa0" "\x47\x81\x4b\x9f\x1c\xe2\xe2\xd0\xbd\x57\x91\x9a\x80\xa7\xae\x85\x38" "\xb9\x87\x3d\x44\xd1\xae\x4f\x0c\xaa\xdd\x0c\xf1\xf4\x68\xca\xec\xf0" "\x97\x04\xc8\xbc\xc3\x1a\x34\x55\x32\x66\xb7\x92\xc7\xb0\x33\xd2\x8e" "\xfe\x38\x04\xb6\xb9\x49\xe1\x41\xc8\x1a\x49\xe9\xb1\xfd\x6c\x0b\x82" "\xbc\x30\x37\x2a\x25\x42\xf7\x35\xdd\xac\x78\xc0\xa7\x42\x06\x1e\x94" "\xb0\xba\xf6\x68\x78\x47\xac\xf0\x60\xa8\x74\x48\x6b\x27\xa4\x74\x10" "\x93\x99\xa5\xef\x52\x6a\x88\x1d\xb4\x21\x54\x43\x6f\x30\x3b\xc8\xfb" "\xbf\x77\xce\xa3\x8e\x74\x86\x19\x89\x54\x64\xd1\xca\x87\x6f\x05\x6a" "\x12\xa4\x32\x49\x2f\x57\x75\x11\xd9\xd9\x72\xd0\x6f\x5c\xba\x7b\xea" "\x1f\xbd\x2b\x0d\x53\xff\x67\x77\x34\x47\x49\xb9\x2a\xbf\x7e\x21\xdf" "\xfd\x8a\x50\xc1\xb9\x06\x9d\x94\x1f\x3e\x90\x1a\x8e\x91\x68\x4b\xaa" "\x7c\x8c\x69\xa0\x2c\xc6\xa7\x19\x49\x93\x74\xd8\x74\xa9\x66\xa8\xf7" "\x23\xb3\xb8\xaf\xf6\xfc\xbe\xda\x16\x06\x4b\x7b\x97\xd1\xcf\x98\x1e" "\x9a\x66\x42\x14\x69\x46\x22\x02\xa0\x81\x90\x8a\x6b\x7b\xca\x31\xaa" "\x2b\x38\x01\x8d\xbf\x60\x84\xb9\xd6\x47\x8c\x9d\x5b\xdb\x1f\x43\x86" "\xf9\xf9\xfe\xd6\x63\x76\x6e\x9d\xbc\x7c\x1e\xc7\xfb\x98\x10\xa4\xbf" "\x15\xdf\x21\x34\x97\x9f\x78\x28\xb0\x3c\xf6\x3a\x7d\xf9\x4d\xf9\xc3" "\xbb\x43\x51\x87\xd7\x8e\xd1\xbc\xa5\xe2\x11\x21\x00\x53\x27\x60\x29" "\x9a\x20\x5c\x8b\x0f\xd4\x37\x06\x28\xf3\xba\x86\xe9\xd0\xc1\x6a\x4f" "\xf6\x0b\xca\x6e\x05\xe5\x51\xcd\x69\x82\x8c\x3f\xf4\x0a\x74\x05\xce" "\x83\x97\xad\x7e\x2c\x44\x88\x1d\xe0\xe6\x19\xfb\x94\xcd\x18\x19\x32" "\x02\xab\x7b\x93\x9b\xc0\x51\x7c\x03\x59\x51\x21\x86\x98\x5e\xc4\xd9" "\x1a\xe9\x79\xfd\x95\xb5\x54\xc5\x35\xe4\x1b\x6d\x1f\xa4\xab\x18\x57" "\xc7\xd7\x32\x3e\xc5\xca\xe3\x67\xdf\xca\x13\x80\xa9\x6d\xdd\x1f\x46" "\x15\xb6\xdf\xc3\x55\x74\x7c\x75\x44\xbc\xe7\xa6\x6f\x41\x17\xc6\xba" "\x4c\x30\xbb\x39\x5c\xaa\x8a\x72\x97\x99\x19\xdb\x4e\x69\x1b\x87\x4c" "\x7f\x1e\xf8\x55\xa9\xa1\x31\xb7\x5c\x3b\x18\xa8\x1b\x7b\xd6\xde\x3d" "\xe4\xc4\x95\x49\x8f\x0e\xa3\xbb\x5c\x86\x55\xdc\x9a\x8d\xcf\xd6\xe6" "\xcc\x7d\xf2\xc3\x84\x0a\xba\xaf\x28\x9e\x53\x73\x31\x38\x52\x0b\x5a" "\xa5\xe3\xd1\x68\xfc\x1b\x68\xb4\xb1\x12\xc5\x75\xa6\x0a\xcc\xf3\xad" "\x9b\xcf\x8a\xac\xec\x70\xfb\x97\x5a\xe7\xe0\x27\xcf\x9d\x61\x87\x30" "\x13\x0d\x51\x2e\x97\x8d\x42\x23\x06\x04\x72\x5b\x56\x1e\x63\xbb\x1c" "\x5e\x11\x98\xf6\xf5\xa6\xbd\x61\x33\xef\xc7\x6c\x1a\x77\x84\xdd\x05" "\x01\x4b\xa3\x4f\xbf\xa4\x79\x06\xa7\x82\x4c\xc0\x1c\x8b\xae\xa1\x7c" "\x15\xfb\x84\x40\xab\x83\x73\x21\xf5\xc5\x7a\x69\x36\x90\x20\xa0\x18" "\x99\x37\x6d\x34\x10\x18\x75\x85\x82\x59\xf5\x2d\x86\x75\x55\x13\x22" "\xb0\x66\x68\x6a\xd5\xbe\xde\x08\xc5\x8e\x6c\x52\xb4\x1b\x0a\x5c\xea" "\xe1\x52\xb7\x26\x71\xa7\xb1\x46\xe5\xcd\x46\x41\xb9\x8a\x60\x1a\x88" "\xf4\x4f\x3e\xab\x64\x4c\x47\x1c\x75\x69\xb7\xaa\x6b\x57\xa8\x61\xd2" "\xa1\xa8\x19\xfb\x58\x0f\xb4\x94\x64\x4c\xd5\x96\x3c\xd9\xa5\x07\x45" "\x89\x0c\xec\xbc\x6f\xce\x35\x24\xb7\x4b\xdb\x7c\x56\x2a\x38\x7f\x3f" "\x01\xf9\x20\x1b\xe2\xd1\xf3\xf5\x9a\x3b\x0e\x29\x6e\xe8\x0f\x0b\xda" "\xb6\x07\x3b\xad\x76\xfd\xe4\xa1\xe7\x97\x03\x14\x68\x92\x49\x7a\x6c" "\xb1\x6a\xde\x1e\x9e\xf4\xdf\x6e\x42\xcb\x8c\xbf\xef\x3e\xc0\x19\x05" "\x3d\x41\x8f\xcc\x9c\xf6\xdb\x29\x0c\xe3\x19\x3e\x93\xef\x64\x5f\x5e" "\x59\x0c\x5a\x05\xaf\x45\xd5\x93\x73\x30\x33\xa5\x73\x31\x5b\x8e\xad" "\xb3\x39\x63\xaa\xeb\x7c\x8a\x8a\x29\xc3\x32\x8b\xa4\x5c\x06\x01\xb4" "\xf7\xbb\x26\x9b\xc1\x0c\x66\xb7\xcd\x6c\xac\x6a\x7f\x09\xd7\x13\xb1" "\x18\x1d\xec\xaf\xfd\x41\x22\x55\x33\x02\x87\xe5\x06\x81\xba\x98\x47" "\x4c\x23\x4d\x43\xd0\x4f\x2f\xe4\x81\x71\xb4\xf7\xeb\x54\x8c\x3c\x60" "\xdc\x99\xb4\x5a\x88\x37\x20\xce\xfc\x15\x09\x01\x62\x2f\x8f\xf7\x03" "\x8e\x07\xd5\x29\xb0\x2e\xdf\x70\x1d\x93\xfd\xb5\x42\x65\x96\x8a\xaa" "\xc2\x28\x8e\x19\xa7\xcc\xf9\x5c\x02\x13\x88\x2f\x0e\xf8\x6c\x92\x33" "\x79\xb3\x0e\x5c\x08\x83\xc9\xb2\x99\x0d\x2e\x6f\xdc\xd9\xe6\xec\x29" "\x5c\x2b\x55\x66\x9f\x1f\xd3\x31\xec\x37\xd4\x07\xa1\x77\x22\x16\x67" "\xb7\xf2\x76\x82\x7e\xe5\x4e\xa8\x9f\xd8\x52\xa3\x19\xd4\x87\x24\x34" "\x89\x11\x2a\xcc\xa3\x89\xc9\xc9\xf2\xcf\x64\x0d\x7f\x02\xa6\xcc\x1b" "\xff\x52\x75\x24\x75\x34\xf2\x79\x8e\xf8\x00\xe8\x44\x57\x61\x0d\xa1" "\x8f\x0b\xcd\x71\x91\x91\x6a\x04\x45\x92\xb0\x5b\xdb\x40\xc5\x87\x40" "\x37\x95\xd2\xbd\xe8\xb1\x74\x89\xdc\x20\xeb\xd3\xd5\xa6\x1d\x83\x6e" "\x7a\xba\xb7\xd4\x88\x84\x9d\x4b\x6b\x24\xa9\xd3\x8b\xc3\xab\x9d\xbb" "\x09\xe4\x7f\xf2\x9f\xc9\x20\x23\xfd\x8f\xb7\x80\x24\x91\x29\xb0\x37" "\x4f\xe5\xf1\xc0\xe5\x03\x24\xa6\x05\x00\xa1\x6f\x70\x68\xf2\x50\x91" "\xc3\x9b\x76\x83\x22\x17\xe9\x00\x44\x9d\x43\x93\x36\xfd\xfc\x9a\x98" "\xbc\xd2\xcc\x14\x4d\x51\xb5\x54\x8d\x86\x0e\xe2\x8a\xea\x53\x22\x95" "\x63\xb4\xd8\xff\x55\x96\xc5\xd5\xee\x4e\x65\x61\x93\xba\xdf\x39\x28" "\xd0\xd8\x31\x0e\x41\x69\x5e\xf0\x6c\x5e\x9d\x39\x15\x70\x81\xbe\x8e" "\x91\xd1\x2b\xdb\x2e\x23\x8a\x36\x8f\x81\x4e\x19\x13\x54\xfe\x8d\x7f" "\x50\x80\x8a\xc1\x08\x6e\x39\x14\xd4\x86\xf1\x8d\x30\x59\x9b\xbc\x51" "\xd7", 1429); *(uint64_t*)0x20001508 = 0x595; syscall(__NR_writev, r[2], 0x200014c0ul, 5ul); 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); for (procid = 0; procid < 6; procid++) { if (fork() == 0) { loop(); } } sleep(1000000); return 0; }