// https://syzkaller.appspot.com/bug?id=7a6f366ed7148c614775d4cf844c8ad21185e84a
// autogenerated by syzkaller (https://github.com/google/syzkaller)

#define _GNU_SOURCE

#include <endian.h>
#include <errno.h>
#include <fcntl.h>
#include <sched.h>
#include <setjmp.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/mount.h>
#include <sys/prctl.h>
#include <sys/resource.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>

#include <linux/capability.h>
#include <linux/loop.h>

#ifndef __NR_memfd_create
#define __NR_memfd_create 319
#endif

static unsigned long long procid;

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 setup_common()
{
  if (mount(0, "/sys/fs/fuse/connections", "fusectl", 0, 0)) {
  }
}

static void setup_binderfs()
{
  if (mkdir("/dev/binderfs", 0777)) {
  }
  if (mount("binder", "/dev/binderfs", "binder", 0, NULL)) {
  }
  if (symlink("/dev/binderfs", "./binderfs")) {
  }
}

static void loop();

static void sandbox_common()
{
  prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0);
  setsid();
  struct rlimit rlim;
  rlim.rlim_cur = rlim.rlim_max = (200 << 20);
  setrlimit(RLIMIT_AS, &rlim);
  rlim.rlim_cur = rlim.rlim_max = 32 << 20;
  setrlimit(RLIMIT_MEMLOCK, &rlim);
  rlim.rlim_cur = rlim.rlim_max = 136 << 20;
  setrlimit(RLIMIT_FSIZE, &rlim);
  rlim.rlim_cur = rlim.rlim_max = 1 << 20;
  setrlimit(RLIMIT_STACK, &rlim);
  rlim.rlim_cur = rlim.rlim_max = 128 << 20;
  setrlimit(RLIMIT_CORE, &rlim);
  rlim.rlim_cur = rlim.rlim_max = 256;
  setrlimit(RLIMIT_NOFILE, &rlim);
  if (unshare(CLONE_NEWNS)) {
  }
  if (mount(NULL, "/", NULL, MS_REC | MS_PRIVATE, NULL)) {
  }
  if (unshare(CLONE_NEWIPC)) {
  }
  if (unshare(0x02000000)) {
  }
  if (unshare(CLONE_NEWUTS)) {
  }
  if (unshare(CLONE_SYSVSEM)) {
  }
  typedef struct {
    const char* name;
    const char* value;
  } sysctl_t;
  static const sysctl_t sysctls[] = {
      {"/proc/sys/kernel/shmmax", "16777216"},
      {"/proc/sys/kernel/shmall", "536870912"},
      {"/proc/sys/kernel/shmmni", "1024"},
      {"/proc/sys/kernel/msgmax", "8192"},
      {"/proc/sys/kernel/msgmni", "1024"},
      {"/proc/sys/kernel/msgmnb", "1024"},
      {"/proc/sys/kernel/sem", "1024 1048576 500 1024"},
  };
  unsigned i;
  for (i = 0; i < sizeof(sysctls) / sizeof(sysctls[0]); i++)
    write_file(sysctls[i].name, sysctls[i].value);
}

static int wait_for_loop(int pid)
{
  if (pid < 0)
    exit(1);
  int status = 0;
  while (waitpid(-1, &status, __WALL) != pid) {
  }
  return WEXITSTATUS(status);
}

static void drop_caps(void)
{
  struct __user_cap_header_struct cap_hdr = {};
  struct __user_cap_data_struct cap_data[2] = {};
  cap_hdr.version = _LINUX_CAPABILITY_VERSION_3;
  cap_hdr.pid = getpid();
  if (syscall(SYS_capget, &cap_hdr, &cap_data))
    exit(1);
  const int drop = (1 << CAP_SYS_PTRACE) | (1 << CAP_SYS_NICE);
  cap_data[0].effective &= ~drop;
  cap_data[0].permitted &= ~drop;
  cap_data[0].inheritable &= ~drop;
  if (syscall(SYS_capset, &cap_hdr, &cap_data))
    exit(1);
}

static int do_sandbox_none(void)
{
  if (unshare(CLONE_NEWPID)) {
  }
  int pid = fork();
  if (pid != 0)
    return wait_for_loop(pid);
  setup_common();
  sandbox_common();
  drop_caps();
  if (unshare(CLONE_NEWNET)) {
  }
  write_file("/proc/sys/net/ipv4/ping_group_range", "0 65535");
  setup_binderfs();
  loop();
  exit(1);
}

void loop(void)
{
  memcpy((void*)0x20000a40, "nilfs2\000", 7);
  memcpy((void*)0x20000a80, "./file0\000", 8);
  memcpy(
      (void*)0x20000ac0,
      "\x78\x9c\xec\xdd\x4f\x8c\x5b\x47\xfd\x00\xf0\xb1\x77\xbd\x69\x9a\xf6\x17"
      "\xa7\xbf\x84\x2e\x69\x68\x13\x0a\x6d\xf9\xd3\xdd\x66\xb3\x84\x3f\x11\x34"
      "\x55\x73\x21\x6a\x2a\x6e\x95\x2a\x2e\x51\x9a\x96\x88\x34\x20\x52\x09\x5a"
      "\xf5\x90\xe4\x80\xb8\xd1\xaa\x0a\x57\xfe\x88\x53\x2f\x15\x20\x24\x7a\x41"
      "\x51\x4f\x5c\x2a\xd1\x48\x5c\x7a\x2a\x1c\x38\x10\x05\xa9\x12\x07\x28\x24"
      "\x8b\xd6\x3b\xe3\xb5\xbf\xb1\x79\xde\x3f\x59\xaf\xd7\x9f\x8f\x34\x3b\x9e"
      "\x37\x63\xcf\x3c\xef\xf3\xf3\xf3\x7b\x6f\x66\x12\x30\xb6\xea\xad\xbf\xf3"
      "\xf3\xd3\xb5\x94\x2e\xbf\xfd\xc6\xb1\xbf\x3d\xf4\xd7\xed\x8b\x4b\x1e\x6f"
      "\x97\x68\xb6\xfe\x4e\x76\xa4\x1a\x29\xa5\x5a\x4e\x4f\x86\xd7\xfb\x60\x62"
      "\x29\xbe\xf1\xe1\xab\xa7\x7a\xc5\xb5\x34\xd7\xfa\x5b\xd2\xe9\xe9\xeb\xed"
      "\xe7\xee\x48\x29\x5d\x48\xfb\xd3\x95\xd4\x4c\x7b\x2f\x5f\x7d\xfd\xdd\xb9"
      "\xa7\x4e\x5c\x3c\x7e\xe9\xc0\x7b\x6f\x1e\xb9\x76\x7b\xd6\x1e\x00\x00\xc6"
      "\xcb\x37\xae\x1c\x99\xdf\xf3\xe7\x3f\xde\xb7\xeb\xa3\xb7\xee\x3f\x9a\xb6"
      "\xb5\x97\x97\xe3\xf3\x66\x4e\xdf\x95\x8f\xfb\x8f\xe6\x03\xff\x72\xfc\x5f"
      "\x4f\xdd\xe9\x5a\x47\xe8\x34\x15\xca\x4d\xe6\x50\x0f\xe5\x26\x7a\x94\xeb"
      "\xac\xa7\x11\xca\x4d\xf6\xa9\x7f\x2a\xbc\x6e\xa3\x4f\xb9\x6d\x15\xf5\x4f"
      "\x74\x2c\xeb\xb5\xde\x30\xca\xca\x76\xdc\x4c\xb5\xfa\x4c\x57\xba\x5e\x9f"
      "\x99\x59\xfa\x4d\x9e\x5a\xbf\xeb\xa7\x6a\x33\xe7\xce\x9c\x7d\xfe\xfc\x62"
      "\x6a\x61\x62\x38\xad\x05\xd6\xd3\x3f\x1e\x48\x29\xed\x17\x84\x4d\x1c\x8e"
      "\x6e\x82\x36\xac\x43\xf8\x61\x1a\x7e\x1b\x62\x58\xd8\x39\xec\x3d\x10\xc0"
      "\x92\x78\xbd\xf0\x16\x17\xe2\x99\x85\xb5\x89\xaf\x56\x55\xff\xf5\x27\xea"
      "\xff\xf3\xf9\xb0\x16\x1b\xbd\xfd\xab\x7f\xb4\xea\xff\xe5\x45\x7b\x1c\xd6"
      "\xcf\x56\xdd\x9a\xca\x7a\x95\xcf\xd1\x5d\x39\x1d\xaf\x23\xc4\xfb\x97\xfa"
      "\x7f\xfe\xe2\x95\x8e\xee\xa5\xf1\x7a\x44\x63\xc0\x76\xf6\xbb\x8e\x30\x2a"
      "\xd7\x17\xfa\xb5\x73\x54\x4e\x10\xf7\x6b\x7f\xdc\x2e\xb6\xaa\xaf\xe6\xb8"
      "\xbc\x0f\x5f\x0b\xf9\x9d\x9f\x9f\xf8\x3f\x1d\x95\xff\x31\xd0\xdb\x3f\xd7"
      "\xff\xfc\xff\xc4\xb0\xcf\x69\x0a\x82\x30\x58\x58\x18\xf6\x0e\x08\xd8\xb4"
      "\xe2\x7d\x73\x0b\x59\xc9\x8f\xf7\xf5\xc5\xfc\x6d\x15\xf9\x77\x54\xe4\x6f"
      "\xaf\xc8\xbf\xb3\x22\x7f\x47\x45\x3e\x8c\xb3\xdf\xbc\xf4\xe3\xf4\x5a\x6d"
      "\xf9\x77\x7e\xfc\x4d\xbf\xd2\xf3\xe1\xe5\x3c\xdb\xdd\x39\xfe\xbf\x15\xb6"
      "\x67\xa5\xd7\xe3\x62\xfd\xf1\xbe\xdf\x95\x5a\x6b\xfd\xf1\x7e\x62\xd8\xcc"
      "\x7e\x77\xf2\x99\xd3\x5f\x7a\xee\xd9\xab\x4b\xf7\xff\xd7\xda\xdb\xff\xcd"
      "\xbc\xbd\xef\xcf\xe9\x66\xfe\x6c\x5d\xc9\x05\xca\xf9\xc2\x78\x5e\xbd\x7d"
      "\xef\x7f\xb3\xbb\x9e\x7a\x9f\x72\xf7\x84\xf6\xdc\xdd\xa3\x7c\xeb\xf1\xee"
      "\xee\x72\xb5\xdd\xcb\xaf\x93\x3a\xf6\x33\xb7\xb4\x63\xba\xfb\x79\x3b\xfb"
      "\x95\xdb\xd7\x5d\xae\x19\xca\x6d\xcf\xe1\x8e\xd0\xde\x78\x7c\x72\x67\x78"
      "\x5e\x39\xfe\x28\xfb\xd5\xf2\x7e\x4d\x86\xf5\x6d\x84\xf5\x98\x0a\xed\x28"
      "\xfb\x95\x5d\x39\x8e\xed\x80\xd5\x28\xdb\x63\xbf\xfb\xff\xcb\xf6\x39\x9d"
      "\x1a\xb5\xe7\xcf\x9c\x3d\xfd\x58\x4e\x97\xed\xf4\x0f\x13\x8d\x6d\x8b\xcb"
      "\x0f\x6e\x70\xbb\x81\xb5\x1b\xb4\xff\xcf\x74\xea\xec\xff\xb3\xbc\xdf\x98"
      "\x4e\x8d\x7a\xe7\x7e\x61\xe7\xf2\xf2\x5a\xe7\x7e\xa1\x19\x96\xcf\xf5\x59"
      "\x7e\x28\xa7\xcb\xf7\xdc\xb7\x26\xb6\xb7\x96\xcf\x9c\xfa\xce\xd9\xe7\xd6"
      "\x7b\xe5\x61\xcc\x9d\x7f\xf9\x95\x6f\x9f\x3c\x7b\xf6\xf4\xf7\x3c\xf0\xc0"
      "\x03\x0f\xda\x0f\x86\xbd\x67\x02\x6e\xb7\xd9\x97\x5e\xfc\xee\xec\xf9\x97"
      "\x5f\x79\xf4\xcc\x8b\x27\x5f\x38\xfd\xc2\xe9\x73\x87\x0e\x1f\x3e\x34\x37"
      "\x77\xf8\xcb\x87\xe6\x67\x5b\xc7\xf5\xb3\x9d\x47\xf7\xc0\x56\xb2\xfc\xa5"
      "\x3f\xec\x96\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x83\xfa\xfe\xf1\x63"
      "\x57\xff\xf4\xce\x17\xdf\x5f\xea\xff\xbf\xdc\xff\xaf\xf4\xff\x2f\x77\xfe"
      "\x96\xfe\xff\x3f\x0a\xfd\xff\x63\x3f\xf9\xd2\x0f\xbe\xf4\x03\xdc\xd5\x23"
      "\xbf\x55\x26\x0c\xb0\x3a\x15\xca\x35\x72\xf8\xff\xd0\xde\xdd\xa1\x9e\x3d"
      "\xe1\x79\x1f\xcb\x71\x7b\x1e\xbf\xdc\xff\xbf\x54\x17\xc7\x75\x2d\xed\xb9"
      "\x37\x2c\x8f\xe3\xf7\x96\x72\x61\x38\x81\x5b\xc6\x4b\x99\x0a\x63\x90\xc4"
      "\xf9\x02\x3f\x99\xe3\x4b\x39\xfe\x45\x82\x21\xaa\x6d\xef\xbd\x38\xc7\x55"
      "\xe3\x5b\x97\x6d\xbd\x8c\x4f\x61\x5c\x8a\xd1\x54\xfe\x6f\x65\x6b\x28\xe3"
      "\x98\x94\xfe\xdf\x3d\xc7\x75\xea\xf8\x67\xef\xda\x80\x36\xb2\xfe\x36\xa2"
      "\x3b\xe1\xb0\xd7\x11\xe8\xed\xef\xe6\xff\x14\x84\xb1\x0d\x0b\xa6\xf2\x06"
      "\x36\x89\xa1\xcd\xff\x99\x4f\x6c\x94\xf3\x9e\x25\x3e\xf7\xfb\xaf\xdf\xb1"
      "\x18\x4a\xb1\xeb\x4f\x74\xef\x2f\xe3\xf8\xa5\xb0\x16\x9b\x7d\xfe\x49\xf5"
      "\x6f\xad\xf9\x3f\xdb\xf3\xdf\x0d\xbc\xff\x0b\x33\xe6\x35\x57\x57\xef\xbf"
      "\x7e\x7a\xed\xfd\x8e\x6a\xd3\xde\x41\xeb\x8f\xeb\x5f\xc6\x81\xde\xbd\xb2"
      "\xfa\x3f\xca\xf5\x97\xb5\x79\x38\x0d\x56\xff\xc2\xcf\x43\xfd\xf1\x82\xd0"
      "\x80\xfe\x1d\xea\xbf\x73\xc0\xfa\x6f\x59\xff\x7d\xab\xab\xff\x3f\xb9\xfe"
      "\xf2\xb6\x3d\xf2\xe0\xa0\xf5\x2f\xb5\xb8\x56\xef\x6e\x47\x3c\x6f\x5c\xae"
      "\xff\xc5\xf3\xc6\xc5\x8d\xb0\xfe\x65\x6c\xcf\x15\xaf\xff\x2a\x27\x6a\xbc"
      "\x99\xeb\x87\x71\x36\x2a\xf3\xcc\xae\xd4\xad\xf3\xff\x2e\x5d\xa9\x5c\xfd"
      "\xfc\xbf\xd9\x85\xf5\x9d\xff\xb7\x9f\x78\x1f\xc6\x17\x72\xba\xec\x08\xcb"
      "\x7d\x0e\x71\xbe\x93\x95\xb6\xbf\xdc\x5f\x51\xbe\x07\xf6\x84\xd7\xaf\x55"
      "\x7c\xbf\x99\xff\x77\xb4\x7d\x25\xc7\x55\x9f\x87\x32\xff\x6f\xd9\x1e\x9b"
      "\xf9\x2b\xbf\x23\xdd\x7a\x2f\x4b\xba\xd1\xe3\xbd\xdd\xaa\xfb\x1a\x18\x55"
      "\x1f\xb8\xfe\x27\x08\x1b\x1e\xda\xf3\xc4\x0d\xb9\x1d\x0b\x0b\x0b\xb7\xf7"
      "\x84\x56\x85\xa1\x56\xce\xd0\xdf\xff\x61\xff\x4e\x18\x76\xfd\xc3\x7e\xff"
      "\xab\xc4\xf9\x7f\xe3\x31\x7c\x9c\xff\x37\xe6\xc7\xf9\x7f\x63\x7e\x9c\xff"
      "\x37\xe6\xc7\xf9\xf5\x62\x7e\x9c\xff\x37\xbe\x9f\x71\xfe\xdf\x98\x7f\x6f"
      "\x78\xdd\x38\x3f\xf0\x74\x45\xfe\xc7\x2b\xf2\xf7\xf6\xce\x6f\xff\x6c\xbf"
      "\xaf\xe2\xf9\xfb\x2a\xf2\x3f\x51\x91\x7f\xa0\x22\xff\xfe\x8a\xfc\x07\x2a"
      "\xf2\xef\xa9\xc8\x7f\xb0\x22\xff\x53\x15\xf9\x9f\x2e\xf9\x13\xdd\x05\x4a"
      "\xfe\x43\x15\xcf\x7f\xa4\x22\xff\x33\x15\xf9\x5b\x5d\xe9\x8f\x32\xae\xeb"
      "\x0f\xe3\x2c\xf6\xcf\xf3\xf9\x87\xf1\x51\xae\xff\xf4\xfb\xfc\xef\xae\xc8"
      "\x07\x46\xd7\x4f\xde\x3a\xf8\xe4\xb3\xbf\xfe\x66\x73\xa9\xff\xff\x54\xfb"
      "\x7c\x48\xb9\x8e\x77\x34\xa7\x1b\xf9\xb7\xf3\x0f\x72\x3a\x5e\xf7\x4e\x1d"
      "\xe9\xc5\xbc\x77\x72\xfa\x2f\x21\x7f\xb3\x9f\xef\x80\x71\x12\xc7\xcf\x88"
      "\xdf\xef\x0f\x57\xe4\x03\xa3\xab\xdc\xe7\xe5\xf3\x0d\x63\xa8\xd6\x7b\xc4"
      "\x9e\x41\xc7\xad\xea\x77\x9c\xcf\x68\xf9\x6c\x8e\x3f\x97\xe3\xcf\xe7\xf8"
      "\xd1\x1c\xcf\xe4\x78\x36\xc7\x07\x73\x3c\xb7\x41\xed\xe3\xf6\x78\xf2\x57"
      "\xbf\x3d\xf2\x5a\x6d\xf9\xf7\xfe\xce\x90\x3f\xe8\xfd\xe4\xb1\x3f\x50\xd7"
      "\x38\x51\x29\xa5\x43\x03\xb6\x27\x9e\x1f\x58\xe9\xfd\xec\x71\x1c\xbf\x95"
      "\x5a\x6b\xfd\xab\xec\x0e\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\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\x34\xf5\xd6\xdf\xf9"
      "\xf9\xe9\x5a\x4a\x97\xdf\x7e\xe3\xd8\x33\x27\xce\xcc\x2e\x2e\x79\xbc\x5d"
      "\xa2\xd9\xfa\x3b\xd9\x91\x6a\xb4\x9f\x97\xd2\x63\x39\x9e\xc8\xf1\xcf\xf2"
      "\x83\x1b\x1f\xbe\x7a\xaa\x33\xbe\x99\xe3\x5a\x9a\x4b\xb5\x54\x6b\x2f\x4f"
      "\x4f\x5f\x6f\xd7\xb4\x23\xa5\x74\x21\xed\x4f\x57\x52\x33\xed\xbd\x7c\xf5"
      "\xf5\x77\xe7\x9e\x3a\x71\xf1\xf8\xa5\x03\xef\xbd\x79\xe4\xda\xed\x7b\x07"
      "\x00\x00\x00\x60\xeb\xfb\x6f\x00\x00\x00\xff\xff\x5f\xd2\x0c\x7c",
      2626);
  syz_mount_image(0x20000a40, 0x20000a80, 0x2000008, 0x20000080, 0xfd, 0xa42,
                  0x20000ac0);
  memcpy((void*)0x20000040, "./bus\000", 6);
  syscall(__NR_open, 0x20000040ul, 0x147042ul, 0ul);
}
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);
  do_sandbox_none();
  return 0;
}