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

#define _GNU_SOURCE

#include <endian.h>
#include <errno.h>
#include <fcntl.h>
#include <setjmp.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/stat.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>

#include <linux/loop.h>

#ifndef __NR_memfd_create
#define __NR_memfd_create 319
#endif
#ifndef __NR_pwritev2
#define __NR_pwritev2 328
#endif

static unsigned long long procid;

//% 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) {
    if (strstr(opts, "errors=panic") || strstr(opts, "errors=remount-ro") == 0)
      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;
}

uint64_t r[1] = {0xffffffffffffffff};

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