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