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

#define _GNU_SOURCE

#include <endian.h>
#include <errno.h>
#include <fcntl.h>
#include <setjmp.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/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

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, max_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 void reset_loop_device(const char* loopname)
{
  int loopfd = open(loopname, O_RDWR);
  if (loopfd == -1) {
    return;
  }
  if (ioctl(loopfd, LOOP_CLR_FD, 0)) {
  }
  close(loopfd);
}

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, 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) {
    int loopfd;
    memset(loopname, 0, sizeof(loopname));
    snprintf(loopname, sizeof(loopname), "/dev/loop%llu", procid);
    if (setup_loop_device(data, size, loopname, &loopfd) == -1)
      return -1;
    close(loopfd);
    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)
    reset_loop_device(loopname);
  errno = err;
  return res;
}

int main(void)
{
  syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000ul, /*prot=*/0ul,
          /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1,
          /*offset=*/0ul);
  syscall(__NR_mmap, /*addr=*/0x20000000ul, /*len=*/0x1000000ul,
          /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/ 7ul,
          /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1,
          /*offset=*/0ul);
  syscall(__NR_mmap, /*addr=*/0x21000000ul, /*len=*/0x1000ul, /*prot=*/0ul,
          /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1,
          /*offset=*/0ul);
  const char* reason;
  (void)reason;
  if (write(1, "executing program\n", sizeof("executing program\n") - 1)) {
  }
  memcpy((void*)0x200008c0, "hfsplus\000", 8);
  memcpy((void*)0x20000180,
         "\023\023w\305\3745\324\024T\325\324\035)\255\032`)"
         "Y\201F\346\276\026nA\255\r\275@T\003<\2373\273\332\202$"
         "\242\363\327r\347cnH\263<\277p\203r\350\361\271\223>"
         "\305\022wC\276\"\006 \236\360-\371\313\362\366\350\200\3238/\000",
         78);
  memcpy((void*)0x20000100, "nls=iso8859-4,nobarrier,gid=", 28);
  sprintf((char*)0x2000011c, "0x%016llx", (long long)0xee01);
  memcpy((void*)0x2000012e, ",uid=", 5);
  sprintf((char*)0x20000133, "0x%016llx", (long long)0);
  memcpy((void*)0x20000145,
         "\x00\x00\x00\x00\x61\x74\x6f\x36\x31\xff\x00\x00\x00\x00\x00\x00\x00"
         "\x00\x00\x00\x00\x00\x00\x00\x00",
         25);
  memcpy(
      (void*)0x20001000,
      "\x78\x9c\xec\xdd\x4d\x88\x1c\x69\xfd\x07\xf0\x6f\xf5\x74\x7a\xd2\xf9\x43"
      "\x76\xf6\x2d\x9b\xbf\x08\x19\x36\xb0\xe8\x06\x93\x99\x34\xeb\xae\x20\x24"
      "\x8a\x48\x0e\x41\x82\x5e\xf6\x3a\x24\x13\x32\x64\x92\x5d\x26\xb3\x92\x5d"
      "\xc4\x74\xd4\x5d\xc1\x93\x27\xd9\x83\x87\x15\x89\x87\x3d\x89\x88\xb0\x9e"
      "\xc4\xdd\xb3\x20\x78\xd1\x4b\xee\x0b\xde\x04\x73\x50\x5b\xaa\xba\xba\xa7"
      "\x67\xa6\x33\x2f\x9b\xcc\xf4\xb8\xfb\xf9\x40\x75\x3d\xd5\xcf\x53\xcf\xf3"
      "\x7b\x7e\xa9\xaa\x7e\xcb\x50\x01\x3e\xb3\x2e\xbc\x9a\x43\xdd\x14\xb9\x70"
      "\xea\xe2\xed\x72\xfb\xfe\xbd\xce\xf2\xfd\x7b\x9d\x1b\x83\x72\x92\xe9\x24"
      "\x8d\xa4\xd9\x5f\xa5\x68\x27\xc5\x87\xc9\xf9\xf4\x97\xfc\x7f\xf9\x64\xdd"
      "\x5d\xf1\xb0\x71\x5e\x2a\x3e\x28\x9a\xef\xbe\xdf\xe9\x6f\x35\xeb\xa5\x6a"
      "\xdf\xd8\x6a\xbf\x4d\xc6\xb6\xec\x26\x87\x87\x1b\x53\x49\x66\xfb\xc5\x7f"
      "\xed\xa0\xc3\xc6\xf8\xfe\xaa\xa5\xea\xe7\xf2\x5a\x7f\x9f\x50\x31\x8c\xbb"
      "\x4c\xd8\xc9\x41\xe2\x60\xd2\x7a\x9b\x74\xd7\x2a\xc7\x9d\x1a\xeb\xed\xfc"
      "\xbc\x05\x0e\xac\x3b\xfd\xd7\xcd\x4d\x66\x92\x23\xe9\xbf\xba\x96\xef\x03"
      "\x52\x5f\x1d\xb6\xbf\x32\x4c\xde\x96\xd7\xa6\xee\xfe\xc5\x01\x00\x00\x00"
      "\x7b\x65\xec\x67\xf9\x51\x4f\x3c\xc8\x83\xdc\xce\xd1\xfd\x09\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\x3e\x1d\x8a\xfe\x3d\x03\x8b\x7a\x69\x0c\xca"
      "\xb3\x29\x06\xf7\xff\x6f\x8d\xdc\x53\xbf\x35\xe1\x70\x1f\xd1\xdb\x57\xab"
      "\xd5\xb7\x9f\x98\x74\x20\x00\x00\x00\x00\x00\x00\x00\xf0\x48\x4e\x3c\xc8"
      "\x83\xdc\xce\xd1\xc1\x76\xaf\xa8\x7e\xf3\x7f\xbe\xda\x78\xa6\x7a\xfc\xbf"
      "\xbc\x91\x5b\x59\xcc\x4a\x4e\xe7\x76\x16\xb2\x9a\xd5\xac\x64\x3e\xc9\xcc"
      "\x48\x47\xad\xdb\x0b\xab\xab\x2b\xf3\x9b\xf7\xfc\x59\xca\x3d\x7b\xbd\xde"
      "\x9d\x7a\xcf\xb3\x63\xf7\x3c\xbb\x3e\xae\xee\xc6\x40\xc7\xfd\x4f\x83\x4d"
      "\x8d\x00\x00\x00\x00\x00\x00\x00\xe0\x33\xeb\x07\xb9\xb0\xf6\xfb\x3f\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1c\x04\x45\x32\xd5\x5f\x55\xcb"
      "\x33\x83\xf2\x4c\x1a\xcd\x24\x87\x93\xb4\x8a\xd9\x61\xf3\xd6\x44\x83\x7d"
      "\x0c\xfe\x30\xe9\x00\x00\x00\x00\x60\xef\xb5\xeb\xf5\xd1\xe2\x3f\xfd\x42"
      "\xaf\xa8\x3e\xf3\x1f\xab\x3e\xf7\x1f\xce\x1b\xb9\x99\xd5\x2c\x65\x35\xcb"
      "\x59\xcc\x95\xea\xbb\x80\xfe\xa7\xfe\xc6\x9f\xbb\x9d\xe5\xfb\xf7\x3a\x37"
      "\xca\x65\x73\xc7\x5f\xfb\xfb\xae\xe2\xa8\x7a\x4c\xff\xbb\x87\xf1\x23\xcf"
      "\x55\x2d\x9e\x1d\xee\x71\x21\xdf\xcc\x77\x72\x2a\xb3\xb9\x94\x95\x2c\xe5"
      "\xbb\x59\xc8\x6a\x16\x33\x9b\x6f\x54\xa5\x85\x14\x99\xa9\xbf\xbd\x98\xb9"
      "\x7f\xaf\x9d\x41\xac\x9b\xe3\x3d\xbf\x6e\xeb\xd2\xc6\xd8\x4e\x8c\x94\xcb"
      "\xf8\x8e\x57\x91\xb4\x73\x35\x4b\x55\x6c\xa7\x73\xb9\x35\x08\xbd\x51\xb7"
      "\x3b\x3e\x32\xda\xef\x5a\xc9\x86\x11\xef\x96\xd9\x29\xce\x9d\x3b\xd7\x4c"
      "\x72\x6e\xf8\xf4\xa1\x2d\x73\x74\xa5\x5e\x97\x33\xfa\x69\xbd\x3e\x18\x66"
      "\xaa\x99\x1f\x1a\x66\x64\xae\xce\x7d\x99\x8d\x27\x47\xf3\xbe\x39\xf7\xe5"
      "\x71\x72\x77\xe7\x73\xd9\x38\xd2\x7c\x1a\xc3\xef\xa0\x9e\x59\x1b\xa5\xdc"
      "\xdc\x38\xd2\x30\xe7\x95\x1d\x8e\x77\xa4\x7c\xf8\xdb\x54\x15\xdf\x3b\x7b"
      "\x9b\xf3\x5d\x7e\x95\xb6\x3e\x13\xdd\x9f\x94\x5b\x83\xa3\xef\xd8\xd6\x39"
      "\x4f\xbe\xf8\x97\x3f\x5e\xba\xd6\xb8\x79\xfd\xda\xd5\x5b\xa7\x0e\xce\x61"
      "\xf4\x09\x6d\x3c\x26\x3a\x23\x99\x78\x6e\x47\x99\x58\x2e\x33\xd1\x7d\x84"
      "\x4c\x1c\x7e\x94\xf8\x1f\x9f\x56\x9d\x8d\xfe\x55\xb4\xba\x5a\x36\xfb\x35"
      "\xdb\x5f\x2d\x9f\xaf\xf6\x3d\x9a\xa5\x7c\x2b\xaf\xe5\x4a\x16\xf3\x72\xe6"
      "\x32\x9f\x57\x32\x97\xaf\xe4\x6c\x3a\x39\x3b\x92\xd7\x67\xb7\xce\x6b\x75"
      "\xae\x35\x76\x77\xae\x9d\xfc\x42\x5d\x28\x5f\x93\x7e\x3c\xf2\xda\xb4\x6f"
      "\xa6\x1f\x56\x51\xe6\xf5\xc9\x91\xbc\x8e\x5e\xe9\x66\xaa\xba\xd1\x67\xd6"
      "\xb2\xf4\xd4\x0e\xb2\x54\xb4\x32\x3e\x4b\x7f\x1d\x1b\x4a\xf3\x73\x75\xa1"
      "\x1c\xe3\x87\x23\xaf\x38\x93\xb7\x31\x13\xf3\x23\x99\x78\x7a\xeb\x4c\xfc"
      "\xe2\xdf\xbd\x24\xb7\x96\x6f\x5e\x5f\xb9\xb6\xf0\xfa\x0e\xc7\x7b\xa1\x5e"
      "\x97\xa7\xed\xdb\xeb\xaf\xcd\xbf\x7c\x2c\x13\xda\xbd\x7a\xba\xe5\xf1\xf2"
      "\x54\xea\x93\xef\x9d\xac\x3b\x3a\xca\xba\xa7\x07\x75\x1b\xf2\xd5\xaa\x7f"
      "\x71\x69\xd6\x9d\xad\xab\x6b\xa5\x7a\xf7\xd3\xaf\xdb\xee\x4c\x2d\x7b\x3a"
      "\x76\x77\x5c\x4f\xfd\xba\xe7\xc6\x8e\xd2\xa9\xea\x8e\x8f\xd4\xad\x7b\x97"
      "\x93\xd7\xb2\x3c\x7c\x17\x52\xdb\xf7\x93\x14\x80\x1d\x38\xf2\xe2\x91\x56"
      "\xfb\xe3\xf6\x9f\xda\xef\xb5\x7f\xd4\xbe\xd6\xbe\x78\xf8\xeb\xd3\xaf\x4c"
      "\x7f\xbe\x95\x43\x1f\x35\x7f\x3f\xf5\xeb\xc6\xaf\x1a\x5f\x2d\x5e\xcc\x7b"
      "\xf9\x7e\x8e\x4e\x3a\x52\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf8\x34\xb8\xf5\xe6\x5b\xd7"
      "\x17\x96\x97\x17\x57\x0e\x60\x21\x8d\x5d\x34\x9e\xca\xf6\x6d\xee\x4e\x27"
      "\xd9\x54\x35\x48\x45\xff\x99\xd6\x98\xdd\x4f\x64\xaf\x66\x3a\xb8\x77\xd1"
      "\xe3\xec\x79\xaa\xee\x73\xbf\xff\xbd\x4e\x94\x85\xe9\x91\x23\xaa\xd8\xd8"
      "\xe6\x37\x5b\xcf\xb4\x35\x89\x83\xad\x3d\xee\x90\xd8\xd3\x42\x3b\x63\xab"
      "\xd2\x7c\xe4\x9e\xff\xd9\xdb\xae\xcd\x74\xc6\x54\x5d\x1c\x3e\xd3\x4e\x1a"
      "\xc3\x78\x92\x5c\x3f\x20\x37\xb8\x03\xf6\xc2\x99\xd5\x1b\xaf\x9f\xb9\xf5"
      "\xe6\x5b\x5f\x5a\xba\xb1\xf0\x51\xaf\xef\xdc\xcb\x9d\x2f\xcf\xdf\x39\x73"
      "\x75\x69\x79\x71\xae\xff\x38\xe9\x28\x81\xbd\xb0\xf6\x36\x60\xd2\x91\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3b\xb5\x1f\x7f\xf0\x30\x66\xd8\xa2"
      "\x3b\x81\xb9\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\xff\x9b\x2e\xbc\x9a\x43\xdd\x14\x99\x9f\x3b"
      "\x3d\x57\x6e\xdf\xbf\xd7\x59\x2e\x97\x41\x79\xad\x65\x33\x49\x23\x49\xf1"
      "\xbd\xa4\xf8\x30\x39\x9f\xfe\x92\x99\x91\xee\x8a\x87\x8d\xf3\xd2\xc7\x1f"
      "\xfc\xfc\x85\x77\xdf\xef\xac\xf5\xd5\x1c\xb4\x6f\x6c\xd8\xef\xb7\xff\xe8"
      "\xf5\x76\x39\x8b\x6e\xbd\x64\x36\xc9\x54\xbd\xde\xde\xf4\x8e\xfa\xbb\x3c"
      "\xd2\x5f\x77\x97\x81\xf5\x15\xc3\x19\x96\x09\x3b\x39\x48\x1c\x4c\xda\x7f"
      "\x03\x00\x00\xff\xff\x6b\x0e\x01\xab",
      1755);
  syz_mount_image(/*fs=*/0x200008c0, /*dir=*/0x20000180, /*flags=*/0,
                  /*opts=*/0x20000100, /*chdir=*/-1, /*size=*/0x6db,
                  /*img=*/0x20001000);
  memcpy((void*)0x20000440, "./file1\000", 8);
  syscall(__NR_creat, /*file=*/0x20000440ul, /*mode=S_IROTH|S_IXUSR*/ 0x44ul);
  memcpy((void*)0x20000400, "./file0/file0/..\000", 17);
  memcpy((void*)0x20000040, "./bus\000", 6);
  syscall(__NR_symlink, /*old=*/0x20000400ul, /*new=*/0x20000040ul);
  memcpy((void*)0x20000000, "./bus\000", 6);
  memcpy((void*)0x20000180, "./file1\000", 8);
  syscall(__NR_rename, /*old=*/0x20000000ul, /*new=*/0x20000180ul);
  memcpy((void*)0x200000c0, "./file1\000", 8);
  syscall(__NR_unlink, /*path=*/0x200000c0ul);
  return 0;
}