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

uint64_t r[1] = {0xffffffffffffffff};

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);
  intptr_t res = 0;
  memcpy((void*)0x20000040, "hfsplus\000", 8);
  memcpy((void*)0x20000640, "./bus\000", 6);
  *(uint16_t*)0x20000940 = 0;
  sprintf((char*)0x20000942, "%023llo", (long long)0);
  *(uint32_t*)0x20000959 = -1;
  sprintf((char*)0x2000095d, "%020llu", (long long)0);
  *(uint8_t*)0x20000971 = -1;
  memcpy((void*)0x20000972,
         "\x80\x49\x7b\xa6\x42\xf0\xe3\x22\x80\xc1\xc4\x17\xde\x8a\x71\xf0\xf9"
         "\xde\x4a\x08\x64\xe5\xda\x32\x99\xbb\xd7\x40\x66\x94\x8f\x35\x42\x2e"
         "\xf3\xbd\x81\xe1\x83\x67\x6e\x36\xf8\x2a\x64\x1f\x47\x9b\x00\x28\xe2"
         "\x18\x1a\x22\xc8\xa7\x92\x69\x4c\xfa\x0c\x2d\x09\xa5\x1a\xa4\x9d\xf6"
         "\xf9\x5e\x8f\x50\x2c\xa4\xdc\x06\xfb\x43\x43\x9c\xaf\xdb\xe7\x76\xe8"
         "\x7f\x36\x9f\xe1\x6d\x37\x70\x2b\x47\x82\xf2\xdf\x69\x46\x8e\x86\xe0"
         "\x39\xc2\x0d\x2a\x14\xbb\x17\xc9\xc1\x05\x26\xea\xac\xec\x78\x28\x73"
         "\x9d\x6b\xfa\x67\x7f\xab\x99\x8d\xeb\x96\x9c\xc0\x9b\xde\xc7\x70\x3e"
         "\x0c\xd5\xae\x92\x79\xa5\x5c\xe6\xc6\x48\xfc\x57\x3f\x6d\x07\xc3\xc8"
         "\x22\x7b\x13\xe5\x4f\x0e\xe7\xf4\x16\xf8\x39\x55\x24\xc3\xb2\x9f\xd6"
         "\x3f\xb5\xf9\x96\x52\xf5\xbb\x2d\x57\xb1\x2f\xe6\xe2",
         183);
  memcpy(
      (void*)0x20000a29,
      "\xbc\x4a\x6f\x50\x3c\x3b\xae\x29\x49\x64\x7d\x5c\x7d\x11\xdd\x32\x9c\x5e"
      "\x7d\xf5\x5e\x25\x9e\x01\x81\x3a\x41\x1f\xa3\xdb\x5e\x7d\x66\xad\x80\x66"
      "\xc9\x36\xb2\xf7\xf5\x9c\x02\x41\x75\xcc\x0f\x30\xa7\x79\x27\xd0\x4a\x9c"
      "\x64\x94\x04\x03\x2b\x42\xaa\x17\x4d\xbe\x31\x30\x52\x8b\x21\x29\xdf\x7a"
      "\x1b\xa5\x83\xd5\xac\xd4\x41\x4f\x80\x9c\xf5\x6f\x46\x3a\xca\x49\x24\x63"
      "\xae\xf8\x28\xce\xca\x5d\x4c\x28\xe8\x35\xec\x9a\xdc\x34\xfc\x4f\x82\x73"
      "\x5a\x63\x3f\x45\xf5\x6b\x3e\x2a\xff\x00\x00\x00\x00\x00\x00\x00\x00",
      125);
  *(uint8_t*)0x20000aa6 = 0;
  memcpy(
      (void*)0x20001300,
      "\x78\x9c\xec\xdd\xcd\x6b\x1c\xe7\x1d\x07\xf0\xef\xac\x56\xb2\xd7\x01\x47"
      "\x49\x6c\xc7\x2d\x81\x8a\x18\xd2\x50\x51\x5b\xb2\x50\x5a\xe5\x52\xb7\x94"
      "\xa2\x42\x28\x21\x3d\xf4\x2c\x6c\x39\x16\x5e\x2b\xa9\xa4\x14\x25\x94\x5a"
      "\x7d\xa3\xd7\x16\xf2\x07\xa4\x07\xdd\x7a\x2a\x94\xd2\x42\xc1\x90\xf6\xd8"
      "\xf6\x96\xab\x8e\x81\x42\x2f\xb9\x54\xbd\x74\xcb\xcc\xce\x4a\x6b\x5b\x92"
      "\x25\xdb\xf2\x4a\xce\xe7\x63\x66\x9f\xe7\x99\x67\xe6\x99\xdf\xfc\xe6\x6d"
      "\x77\x8d\xd8\x00\x9f\x5b\xb3\xe3\x69\xde\x49\x91\xd9\xf1\x37\x56\xcb\xf6"
      "\xc6\xfa\x54\x7b\x63\x7d\xea\x56\xaf\x9e\xe4\x44\x92\x46\xd2\xec\x16\x29"
      "\x16\x93\xe2\xe3\xe4\x4a\xba\x53\xbe\x50\xce\xac\x87\x2b\x76\xdb\xce\x87"
      "\x0b\x33\x6f\x7d\xf2\xd9\xc6\xa7\xdd\x56\xb3\x9e\xaa\xe5\x1b\x49\xeb\x11"
      "\xf7\x62\xad\x9e\x32\x96\x64\xa8\x2e\x1f\xd7\x78\x57\x1f\x79\xbc\x62\x2b"
      "\x33\x65\xc2\x2e\xf4\x12\x07\x83\x36\x9c\xa4\x73\x97\x1f\x9e\xdb\xee\xd9"
      "\x49\x67\xa8\xaf\xb1\xeb\xf5\x0e\x1c\x1f\x45\xf5\xdc\xfc\xd3\xab\xf7\xce"
      "\x1f\x4d\x4e\x25\x39\x59\xbd\x0f\x58\xab\x9f\x8a\xdd\x37\x02\xc7\xda\xda"
      "\xa0\x03\x00\x00\x00\x80\x87\xf0\xc7\x03\x2e\xff\xec\x66\x36\xb3\x9a\xd3"
      "\x87\x14\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3c\x95\xba\xbf\xff\x5f"
      "\x16\xd5\xd4\xe8\xd5\xc7\x52\xf4\x7e\xff\x7f\xa4\x9e\x97\xba\x7e\x34\xed"
      "\x33\xb2\x3b\x8d\xc3\x0e\x04\x00\x00\x00\x00\x00\x00\x00\x0e\xdf\x97\x36"
      "\x93\xac\x6d\xb7\x3b\x45\xf5\x7f\xfe\x2f\x57\x8d\x33\xd5\xeb\x33\x79\x2f"
      "\xcb\x99\xcf\x52\x2e\x66\x35\x73\x59\xc9\x4a\x96\x32\x99\x0c\x8f\xf6\x0d"
      "\x34\xb2\x3a\xb7\xb2\xb2\x34\x99\xe6\x03\xd7\xbc\x9c\xe4\xfe\x35\x2f\xef"
      "\x33\xe0\xd6\xa3\xee\x31\x00\x00\x00\x00\x00\x00\x00\x3c\x95\x7e\x96\xd9"
      "\x9c\x1e\x74\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd0\xaf\x48"
      "\x86\xba\x45\x35\x9d\xe9\xd5\x47\xd3\x68\x26\x39\x99\x64\xa4\x5c\x6e\x2d"
      "\xf9\x67\xaf\x7e\x9c\xdd\x19\x74\x00\x00\x00\x00\xf0\x04\x3c\xbb\x99\xcd"
      "\xac\xe6\x74\xaf\xdd\x29\xaa\xcf\xfc\xe7\xaa\xcf\xfd\x27\xf3\x5e\x16\xb3"
      "\x92\x85\xac\xa4\x9d\xf9\x5c\xab\xbe\x0b\xe8\x7e\xea\x6f\x6c\xac\x4f\xb5"
      "\x37\xd6\xa7\x6e\x95\xd3\xfd\xe3\x7e\xf3\xdf\x07\x0a\xa3\x1a\x31\xdd\xef"
      "\x1e\x76\xde\xf2\xf9\x6a\x89\x56\xae\x67\xa1\x9a\x73\x31\x57\xf3\x4e\xda"
      "\xb9\x96\x46\xb5\x66\xe9\x7c\x2f\x9e\x9d\xe3\xfa\x69\x19\x53\xf1\x8d\xda"
      "\x3e\x23\xbb\x56\x97\xe5\x9e\xff\xba\x2e\x8f\x86\xd1\x2a\x23\xc3\x5b\x19"
      "\x99\xa8\x63\x2b\xb3\xf1\xdc\xde\x99\x38\xe0\xd1\xb9\x77\x4b\x93\x69\x6c"
      "\x7d\xf3\x73\x66\xff\x39\x3f\xb9\xf7\x56\x8a\xff\x75\x3a\xdd\xda\xa9\xde"
      "\x9c\xe4\x99\xef\x1e\xe9\x9c\x5f\xee\x3b\xfb\xce\xed\x9d\x89\xe4\xcb\x7f"
      "\xf8\xdd\x0f\x6e\xb4\x17\x6f\xde\xb8\xbe\x3c\x7e\x74\x76\xe9\x00\x4e\x74"
      "\x7a\x47\xe8\xfe\x4c\x4c\xf5\x65\xe2\xc5\xa7\x3e\x13\xfd\x26\x32\x9c\x46"
      "\xce\x6e\xb5\x67\xf3\x9d\x7c\x3f\xe3\x19\xcb\x9b\x59\xca\x42\x7e\x94\xb9"
      "\xac\x64\x3e\x63\xf9\x76\x55\x9b\xab\xcf\xe7\xf2\x75\x74\xef\x4c\x5d\xb9"
      "\xab\xf5\xe6\x83\x22\x19\xa9\x8f\x4b\xf7\x2e\x7a\xb0\x98\x5e\xae\xd6\x3d"
      "\x9d\x85\x7c\x2f\xef\xe4\x5a\xe6\xf3\x5a\xf5\xef\x72\x26\xf3\xb5\x4c\x67"
      "\x3a\x33\x7d\x47\xf8\xec\x3e\xae\xfa\xc6\xc1\xee\xb4\x17\x5e\xad\x2b\xad"
      "\x24\xbf\xaa\xcb\xa3\xa1\xcc\xeb\x73\x7d\x79\xed\xbf\xe7\x8e\x56\x7d\xfd"
      "\x73\xb6\xb3\xf4\xfc\xe3\x7f\x1e\x35\xbf\x58\x57\xca\x6d\xfc\x3c\xc9\xdf"
      "\xff\xf6\x18\x77\xf4\x91\xdc\x9b\x89\xc9\xbe\x4c\xbc\xb0\x6b\x26\x6e\x97"
      "\x2f\xbf\xad\x6e\x2b\xcb\xed\xc5\x9b\x4b\x37\xe6\xde\xdd\xe7\xf6\x5e\xa9"
      "\xcb\xf2\x3a\xfa\xe5\x91\x7a\x4a\x94\xe7\xcb\xf3\xe5\xc1\xaa\x5a\x77\x9f"
      "\x1d\x65\xdf\x0b\x3b\xf6\x4d\x6e\x5d\xbf\x5d\xe5\x79\x36\x54\xd7\xbb\x7d"
      "\x67\xb7\xd6\x7b\xd0\x95\x3a\x52\xbf\x87\x6b\x6e\x8d\xb4\xfd\xc4\x2a\xfb"
      "\x5e\xdc\xb1\x6f\xaa\xea\x3b\xdf\xd7\xb7\xd3\xfb\x2d\x00\x8e\xbc\x53\x5f"
      "\x39\x35\xd2\xfa\x57\xeb\x1f\xad\x8f\x5a\xbf\x68\xdd\x68\xbd\x71\xf2\x5b"
      "\x27\xbe\x7e\xe2\xa5\x91\x0c\xff\x75\xf8\xf5\xe6\xc4\xd0\x2b\x8d\x97\x8a"
      "\xdf\xe7\xa3\xfc\x64\xfb\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\xf0\x96\xdf\xff"
      "\xe0\xe6\x5c\xbb\x3d\xbf\x74\x4f\xa5\xd3\xe9\xdc\xde\xa5\xeb\xc9\x54\xfe"
      "\xf2\xe7\xbe\x39\x49\xd6\xca\x68\x07\x18\xcf\x31\xa9\xdc\xae\x8f\xeb\x51"
      "\x89\xa7\x57\xf9\x6f\xa7\xd3\x39\xc8\x5a\xaf\xff\x27\x19\x5c\xcc\x9d\xda"
      "\x91\x48\xdd\x80\x2a\x77\xdd\x26\x86\x07\x71\x6f\x02\x0e\xd7\xa5\x95\x5b"
      "\xef\x5e\x5a\x7e\xff\x83\xaf\x2e\xdc\x9a\x7b\x7b\xfe\xed\xf9\xc5\x99\xe9"
      "\xe9\x99\x89\x99\xe9\xd7\xa6\x2e\x5d\x5f\x68\xcf\x4f\x74\x5f\x07\x1d\x25"
      "\x70\x18\xb6\x1f\xfa\x83\x8e\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd8"
      "\xaf\x27\xf1\xe7\x04\x83\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\x78\x9b\x1d\x4f\xf3\x4e"
      "\x8a\x4c\x4e\x5c\x9c\xc8\x6f\xea\x99\xeb\x53\xed\xb2\xd8\xa8\xcb\xae\x66"
      "\x92\x46\x92\xe2\xc7\x49\xf1\x71\x72\x25\xdd\x29\xa3\x7d\xc3\x15\xbb\x6d"
      "\xe7\xc3\x85\x99\xb7\x3e\xf9\x6c\xe3\xd3\xed\xb1\x9a\xbd\xe5\x1b\x7b\xad"
      "\xb7\x3f\x6b\xf5\x94\xb1\x24\x43\x75\xb9\x93\xc6\x43\x8c\x77\x75\x8f\xf1"
      "\xf6\xa7\xd8\xda\xc3\x32\x61\x17\x7a\x89\x83\x41\xfb\x7f\x00\x00\x00\xff"
      "\xff\x21\xd6\x13\xde",
      1607);
  syz_mount_image(/*fs=*/0x20000040, /*dir=*/0x20000640,
                  /*flags=MS_SYNCHRONOUS|MS_MANDLOCK*/ 0x50,
                  /*opts=*/0x20000940, /*chdir=*/2, /*size=*/0x647,
                  /*img=*/0x20001300);
  memcpy((void*)0x20000000, "./bus\000", 6);
  res = syscall(__NR_creat, /*file=*/0x20000000ul, /*mode=*/0ul);
  if (res != -1)
    r[0] = res;
  memcpy((void*)0x20000200, "threaded\000", 9);
  syscall(__NR_write, /*fd=*/r[0], /*buf=*/0x20000200ul, /*len=*/0x175d9003ul);
  memcpy((void*)0x20000000, "./bus\000", 6);
  syscall(__NR_creat, /*file=*/0x20000000ul, /*mode=*/0ul);
  return 0;
}