// https://syzkaller.appspot.com/bug?id=c2fe1403d829cf5c2110804d8e90123502249963
// 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, 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;
}

uint64_t r[2] = {0xffffffffffffffff, 0xffffffffffffffff};

int main(void)
{
  syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000ul, /*prot=*/0ul,
          /*flags=*/0x32ul, /*fd=*/-1, /*offset=*/0ul);
  syscall(__NR_mmap, /*addr=*/0x20000000ul, /*len=*/0x1000000ul, /*prot=*/7ul,
          /*flags=*/0x32ul, /*fd=*/-1, /*offset=*/0ul);
  syscall(__NR_mmap, /*addr=*/0x21000000ul, /*len=*/0x1000ul, /*prot=*/0ul,
          /*flags=*/0x32ul, /*fd=*/-1, /*offset=*/0ul);
  intptr_t res = 0;
  memcpy((void*)0x20000040, "ext4\000", 5);
  memcpy((void*)0x20000500, "./file1\000", 8);
  memcpy((void*)0x20000100, "discard", 7);
  *(uint8_t*)0x20000107 = 0x2c;
  memcpy((void*)0x20000108, "noquota", 7);
  *(uint8_t*)0x2000010f = 0x2c;
  memcpy((void*)0x20000110, "dioread_lock", 12);
  *(uint8_t*)0x2000011c = 0x2c;
  memcpy((void*)0x2000011d, "grpquota", 8);
  *(uint8_t*)0x20000125 = 0x2c;
  memcpy((void*)0x20000126, "auto_da_alloc", 13);
  *(uint8_t*)0x20000133 = 0x2c;
  memcpy((void*)0x20000134, "grpjquota=", 10);
  *(uint8_t*)0x2000013e = 0x2c;
  memcpy((void*)0x2000013f, "quota", 5);
  *(uint8_t*)0x20000144 = 0x2c;
  memcpy((void*)0x20000145, "init_itable", 11);
  *(uint8_t*)0x20000150 = 0x3d;
  sprintf((char*)0x20000151, "0x%016llx", (long long)0xc202);
  *(uint8_t*)0x20000163 = 0x2c;
  memcpy((void*)0x20000164, "usrquota", 8);
  *(uint8_t*)0x2000016c = 0x2c;
  *(uint8_t*)0x2000016d = 0;
  memcpy(
      (void*)0x20000600,
      "\x78\x9c\xec\xdd\x51\x6b\x5b\xd7\x1d\x00\xf0\xff\xbd\xb6\x32\x27\x71\x66"
      "\x67\xdb\x43\x16\x58\x16\x96\x0c\x27\x6c\x91\xec\x78\x49\xcc\x1e\xb2\x0c"
      "\xc6\xf2\x14\xd8\x96\xbd\x67\x9e\x2d\x1b\x63\xd9\x32\x96\x9c\xc4\x26\x0c"
      "\x87\x7d\x80\xc1\x18\xdb\x60\x4f\x7b\xda\xcb\xa0\x1f\xa0\x50\xf2\x11\x4a"
      "\x21\xd0\xbe\x97\xb6\xb4\x94\x36\x69\x1f\xfa\xd0\x56\x45\xd2\x55\x9a\xb8"
      "\x92\xed\x50\xd9\x17\xec\xdf\x0f\xae\xef\x39\xf7\x4a\xfa\xff\x8f\x8d\xae"
      "\xee\x39\xf7\xf8\x2a\x80\x43\xeb\x6c\x44\xdc\x88\x88\x81\x88\xb8\x18\x11"
      "\x23\xd9\xf6\x34\x5b\x6e\x36\x2b\x9b\xed\xc7\x3d\x7d\xf2\x60\xa6\xb9\x24"
      "\xd1\x68\xdc\xfe\x28\x89\x24\xdb\xd6\x79\xad\x24\x5b\x1f\x6f\x3f\x25\x86"
      "\x22\xe2\x0f\x37\x23\xfe\x9c\x7c\x33\x6e\x6d\x7d\x63\x71\xba\x52\x29\xaf"
      "\x66\xf5\x52\x7d\x69\xa5\x54\x5b\xdf\xb8\xb4\xb0\x34\x3d\x5f\x9e\x2f\x2f"
      "\x4f\x4e\x4e\x5c\x9d\xba\x36\x75\x65\x6a\xbc\x2f\xed\x1c\x8d\x88\xeb\xbf"
      "\x79\xef\x9f\x7f\xfb\xdf\x6f\xaf\xbf\xf6\xf3\x7b\x6f\xdf\xf9\xe0\xc2\x5f"
      "\x9a\x69\x0d\x67\xfb\x9f\x6f\x47\x3f\xb5\x9b\x5e\x68\xfd\x2e\x3a\x06\x23"
      "\x62\x75\x2f\x82\xe5\x60\x20\x5b\x17\x72\xce\x03\x00\x80\xdd\x69\x9e\xe3"
      "\x7f\x2f\x22\x7e\xd2\x3a\xff\x1f\x89\x81\xd6\xd9\x29\x00\x00\x00\x70\x90"
      "\x34\x7e\x35\x1c\x9f\x27\x11\x0d\x00\x00\x00\xe0\xc0\x4a\x5b\x73\x60\x93"
      "\xb4\x98\xcd\x05\x18\x8e\x34\x2d\x16\xdb\x73\x78\x7f\x10\xc7\xd2\x4a\xb5"
      "\x56\xff\xd9\x5c\x75\x6d\x79\xb6\x3d\x57\x76\x34\x0a\xe9\xdc\x42\xa5\x3c"
      "\x9e\xcd\x15\x1e\x8d\x42\xd2\xac\x4f\x64\x73\x6c\x3b\xf5\xcb\x5b\xea\x93"
      "\x11\x71\x32\x22\xfe\x31\x72\xb4\x55\x2f\xce\x54\x2b\xb3\x79\x0f\x7e\x00"
      "\x00\x00\xc0\x21\x71\x7c\x4b\xff\xff\xd3\x91\x76\xff\x1f\x00\x00\x00\x38"
      "\x60\x46\xf3\x4e\x00\x00\x00\x00\xd8\x73\xfa\xff\x00\x00\x00\x70\xf0\xe9"
      "\xff\x03\x00\x00\xc0\x81\xf6\xbb\x5b\xb7\x9a\x4b\xa3\xf3\xfd\xd7\xb3\x77"
      "\xd7\xd7\x16\xab\x77\x2f\xcd\x96\x6b\x8b\xc5\xa5\xb5\x99\xe2\x4c\x75\x75"
      "\xa5\x38\x5f\xad\xce\xb7\xee\xd9\xb7\xb4\xd3\xeb\x55\xaa\xd5\x95\x5f\xc4"
      "\xf2\xda\xfd\x52\xbd\x5c\xab\x97\x6a\xeb\x1b\x77\x96\xaa\x6b\xcb\xf5\x3b"
      "\x0b\x2f\x7c\x05\x36\x00\x00\x00\xb0\x8f\x4e\xfe\xf8\xd1\x5b\x49\x44\x6c"
      "\xfe\xf2\x68\x6b\x69\x3a\x92\x77\x52\xc0\xbe\x48\x5e\xe6\xc1\xef\xee\x5d"
      "\x1e\xc0\xfe\x1b\xc8\x3b\x01\x20\x37\x83\x79\x27\x00\xe4\xa6\x90\x77\x02"
      "\x40\xee\x5a\xe3\x00\xdb\x0c\xfc\x0d\x45\x8f\xc1\x82\xd7\xf7\x2e\x27\x00"
      "\x00\xa0\xbf\xc6\x7e\xd8\xfb\xfa\xbf\xb1\x01\x38\xd8\xd2\xbc\x13\x00\x00"
      "\xf6\x9d\xeb\xff\x70\x78\x15\xcc\x00\x84\x43\xef\xbb\x3b\xec\xef\x79\xf3"
      "\x8e\x5d\x5f\xff\x6f\x34\x5e\x2a\x21\x00\x00\xa0\xef\x86\x5b\x4b\x92\x16"
      "\xb3\x6b\x81\xc3\x91\xa6\xc5\x62\xc4\x89\xd6\xd7\x02\x14\x92\xb9\x85\x4a"
      "\x79\x3c\xeb\x1f\xbc\x39\x52\xf8\x4e\xb3\x3e\xd1\x7a\x66\xf2\x72\xff\x3b"
      "\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x87\x58\xa3\x91\x44\x03\x00\x00\x00\x38\xd0\x22\xd2\xf7\x93\xd6"
      "\xdd\xfc\x23\xc6\x46\xce\x0f\x6f\x1d\x1f\x38\x92\x7c\x36\xd2\x5a\x47\xc4"
      "\xbd\xff\xdc\xfe\xd7\xfd\xe9\x7a\x7d\x75\xa2\xb9\xfd\xe3\x67\xdb\xeb\xff"
      "\xce\xb6\x5f\xce\x63\x04\x03\x00\x00\x00\xd8\xaa\xd3\x4f\xef\xf4\xe3\x01"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\xa0\x9f\x9e\x3e\x79\x30\xd3\x59\xf6\x33\xee\x87\xbf\x8e\x88\xd1\x6e\xf1"
      "\x07\x63\xa8\xb5\x1e\x8a\x42\x44\x1c\xfb\x24\x89\xc1\xe7\x9e\x97\x44\xc4"
      "\x40\x1f\xe2\x6f\x3e\x8c\x88\x53\xdd\xe2\x27\xcd\xb4\x62\x34\xcb\xa2\x5b"
      "\xfc\xa3\x39\xc6\x4f\x23\xe2\x78\x1f\xe2\xc3\x61\xf6\xa8\x79\xfc\xb9\xd1"
      "\xed\xfd\x97\xc6\xd9\xd6\xba\xfb\xfb\x6f\x30\x5b\xbe\xad\xde\xc7\xbf\xf4"
      "\xd9\xf1\x6f\xa0\xc7\xf1\xe7\xc4\x2e\x63\x9c\x7e\xfc\x4a\xa9\x67\xfc\x87"
      "\x11\xa7\x07\xbb\x1f\x7f\x3a\xf1\x93\x1e\xf1\xcf\xed\x32\xfe\x9f\xfe\xb8"
      "\xb1\xd1\x6b\x5f\xe3\xbf\x11\x63\x5d\x3f\x7f\x92\x17\x62\x95\xea\x4b\x2b"
      "\xa5\xda\xfa\xc6\xa5\x85\xa5\xe9\xf9\xf2\x7c\x79\x79\x72\x72\xe2\xea\xd4"
      "\xb5\xa9\x2b\x53\xe3\xa5\xb9\x85\x4a\x39\xfb\xd9\x35\xc6\xdf\x7f\xf4\xea"
      "\x97\xdb\xb5\xff\x58\x8f\xf8\xa3\x3b\xb4\xff\xfc\x2e\xdb\xff\xc5\xe3\xfb"
      "\x4f\xbe\xdf\x2e\x16\xba\xc5\xbf\x70\xae\xfb\xe7\xef\xa9\x1e\xf1\xd3\xec"
      "\xb3\xef\xa7\x59\xb9\xb9\x7f\xac\x53\xde\x6c\x97\x9f\x77\xe6\xff\x6f\x9c"
      "\xd9\xae\xfd\xb3\x3d\xda\xbf\xd3\xdf\xff\xc2\x2e\xdb\x7f\xf1\xf7\x7f\x7d"
      "\x67\x97\x0f\x05\x00\xf6\x41\x6d\x7d\x63\x71\xba\x52\x29\xaf\x2a\x28\x28"
      "\x28\x3c\x2b\xe4\x7d\x64\x02\x00\x00\xfa\xed\xeb\x93\xfe\xbc\x33\x01\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\xc3\x6b\x3f\x6e"
      "\x27\xb6\x35\xe6\x66\x3e\x4d\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd8\xd6\x57\x01\x00\x00"
      "\xff\xff\x7c\x8d\xd4\xf4",
      1212);
  syz_mount_image(/*fs=*/0x20000040, /*dir=*/0x20000500, /*flags=*/0x4500,
                  /*opts=*/0x20000100, /*chdir=*/0x13, /*size=*/0x4bc,
                  /*img=*/0x20000600);
  memcpy((void*)0x20000180, "./bus\000", 6);
  syscall(__NR_open, /*file=*/0x20000180ul, /*flags=*/0x14d27eul, /*mode=*/0ul);
  memcpy((void*)0x20000380, "/dev/loop", 9);
  *(uint8_t*)0x20000389 = 0x30;
  *(uint8_t*)0x2000038a = 0;
  memcpy((void*)0x200000c0, "./bus\000", 6);
  syscall(__NR_mount, /*src=*/0x20000380ul, /*dst=*/0x200000c0ul, /*type=*/0ul,
          /*flags=*/0x1010ul, /*data=*/0ul);
  memcpy((void*)0x20000080, "./bus\000", 6);
  res = syscall(__NR_open, /*file=*/0x20000080ul, /*flags=*/0x14113eul,
                /*mode=*/0ul);
  if (res != -1)
    r[0] = res;
  syscall(__NR_write, /*fd=*/r[0], /*data=*/0x200001c0ul, /*len=*/0x208e24bul);
  memcpy((void*)0x20000040, ".\000", 2);
  res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x20000040ul,
                /*flags=*/0ul, /*mode=*/0ul);
  if (res != -1)
    r[1] = res;
  *(uint64_t*)0x20000000 = 0;
  *(uint64_t*)0x20000008 = 0x100000000;
  *(uint64_t*)0x20000010 = 0;
  syscall(__NR_ioctl, /*fd=*/r[1], /*cmd=*/0xc0185879, /*arg=*/0x20000000ul);
  return 0;
}