// https://syzkaller.appspot.com/bug?id=761b111fb9d95335cd1b9e308b1fb1d51b3ee621 // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifndef __NR_memfd_create #define __NR_memfd_create 279 #endif #ifndef __NR_mmap #define __NR_mmap 222 #endif static unsigned long long procid; static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } #define MAX_FDS 30 #define USB_MAX_IFACE_NUM 4 #define USB_MAX_EP_NUM 32 #define USB_MAX_FDS 6 struct usb_endpoint_index { struct usb_endpoint_descriptor desc; int handle; }; struct usb_iface_index { struct usb_interface_descriptor* iface; uint8_t bInterfaceNumber; uint8_t bAlternateSetting; uint8_t bInterfaceClass; struct usb_endpoint_index eps[USB_MAX_EP_NUM]; int eps_num; }; struct usb_device_index { struct usb_device_descriptor* dev; struct usb_config_descriptor* config; uint8_t bDeviceClass; uint8_t bMaxPower; int config_length; struct usb_iface_index ifaces[USB_MAX_IFACE_NUM]; int ifaces_num; int iface_cur; }; struct usb_info { int fd; struct usb_device_index index; }; static struct usb_info usb_devices[USB_MAX_FDS]; static struct usb_device_index* lookup_usb_index(int fd) { for (int i = 0; i < USB_MAX_FDS; i++) { if (__atomic_load_n(&usb_devices[i].fd, __ATOMIC_ACQUIRE) == fd) return &usb_devices[i].index; } return NULL; } static int usb_devices_num; static bool parse_usb_descriptor(const char* buffer, size_t length, struct usb_device_index* index) { if (length < sizeof(*index->dev) + sizeof(*index->config)) return false; memset(index, 0, sizeof(*index)); index->dev = (struct usb_device_descriptor*)buffer; index->config = (struct usb_config_descriptor*)(buffer + sizeof(*index->dev)); index->bDeviceClass = index->dev->bDeviceClass; index->bMaxPower = index->config->bMaxPower; index->config_length = length - sizeof(*index->dev); index->iface_cur = -1; size_t offset = 0; while (true) { if (offset + 1 >= length) break; uint8_t desc_length = buffer[offset]; uint8_t desc_type = buffer[offset + 1]; if (desc_length <= 2) break; if (offset + desc_length > length) break; if (desc_type == USB_DT_INTERFACE && index->ifaces_num < USB_MAX_IFACE_NUM) { struct usb_interface_descriptor* iface = (struct usb_interface_descriptor*)(buffer + offset); index->ifaces[index->ifaces_num].iface = iface; index->ifaces[index->ifaces_num].bInterfaceNumber = iface->bInterfaceNumber; index->ifaces[index->ifaces_num].bAlternateSetting = iface->bAlternateSetting; index->ifaces[index->ifaces_num].bInterfaceClass = iface->bInterfaceClass; index->ifaces_num++; } if (desc_type == USB_DT_ENDPOINT && index->ifaces_num > 0) { struct usb_iface_index* iface = &index->ifaces[index->ifaces_num - 1]; if (iface->eps_num < USB_MAX_EP_NUM) { memcpy(&iface->eps[iface->eps_num].desc, buffer + offset, sizeof(iface->eps[iface->eps_num].desc)); iface->eps_num++; } } offset += desc_length; } return true; } static struct usb_device_index* add_usb_index(int fd, const char* dev, size_t dev_len) { int i = __atomic_fetch_add(&usb_devices_num, 1, __ATOMIC_RELAXED); if (i >= USB_MAX_FDS) return NULL; if (!parse_usb_descriptor(dev, dev_len, &usb_devices[i].index)) return NULL; __atomic_store_n(&usb_devices[i].fd, fd, __ATOMIC_RELEASE); return &usb_devices[i].index; } struct vusb_connect_string_descriptor { uint32_t len; char* str; } __attribute__((packed)); struct vusb_connect_descriptors { uint32_t qual_len; char* qual; uint32_t bos_len; char* bos; uint32_t strs_len; struct vusb_connect_string_descriptor strs[0]; } __attribute__((packed)); static const char default_string[] = {8, USB_DT_STRING, 's', 0, 'y', 0, 'z', 0}; static const char default_lang_id[] = {4, USB_DT_STRING, 0x09, 0x04}; static bool lookup_connect_response_in(int fd, const struct vusb_connect_descriptors* descs, const struct usb_ctrlrequest* ctrl, struct usb_qualifier_descriptor* qual, char** response_data, uint32_t* response_length) { struct usb_device_index* index = lookup_usb_index(fd); uint8_t str_idx; if (!index) return false; switch (ctrl->bRequestType & USB_TYPE_MASK) { case USB_TYPE_STANDARD: switch (ctrl->bRequest) { case USB_REQ_GET_DESCRIPTOR: switch (ctrl->wValue >> 8) { case USB_DT_DEVICE: *response_data = (char*)index->dev; *response_length = sizeof(*index->dev); return true; case USB_DT_CONFIG: *response_data = (char*)index->config; *response_length = index->config_length; return true; case USB_DT_STRING: str_idx = (uint8_t)ctrl->wValue; if (descs && str_idx < descs->strs_len) { *response_data = descs->strs[str_idx].str; *response_length = descs->strs[str_idx].len; return true; } if (str_idx == 0) { *response_data = (char*)&default_lang_id[0]; *response_length = default_lang_id[0]; return true; } *response_data = (char*)&default_string[0]; *response_length = default_string[0]; return true; case USB_DT_BOS: *response_data = descs->bos; *response_length = descs->bos_len; return true; case USB_DT_DEVICE_QUALIFIER: if (!descs->qual) { qual->bLength = sizeof(*qual); qual->bDescriptorType = USB_DT_DEVICE_QUALIFIER; qual->bcdUSB = index->dev->bcdUSB; qual->bDeviceClass = index->dev->bDeviceClass; qual->bDeviceSubClass = index->dev->bDeviceSubClass; qual->bDeviceProtocol = index->dev->bDeviceProtocol; qual->bMaxPacketSize0 = index->dev->bMaxPacketSize0; qual->bNumConfigurations = index->dev->bNumConfigurations; qual->bRESERVED = 0; *response_data = (char*)qual; *response_length = sizeof(*qual); return true; } *response_data = descs->qual; *response_length = descs->qual_len; return true; default: break; } break; default: break; } break; default: break; } return false; } typedef bool (*lookup_connect_out_response_t)( int fd, const struct vusb_connect_descriptors* descs, const struct usb_ctrlrequest* ctrl, bool* done); static bool lookup_connect_response_out_generic( int fd, const struct vusb_connect_descriptors* descs, const struct usb_ctrlrequest* ctrl, bool* done) { switch (ctrl->bRequestType & USB_TYPE_MASK) { case USB_TYPE_STANDARD: switch (ctrl->bRequest) { case USB_REQ_SET_CONFIGURATION: *done = true; return true; default: break; } break; } return false; } #define UDC_NAME_LENGTH_MAX 128 struct usb_raw_init { __u8 driver_name[UDC_NAME_LENGTH_MAX]; __u8 device_name[UDC_NAME_LENGTH_MAX]; __u8 speed; }; enum usb_raw_event_type { USB_RAW_EVENT_INVALID = 0, USB_RAW_EVENT_CONNECT = 1, USB_RAW_EVENT_CONTROL = 2, }; struct usb_raw_event { __u32 type; __u32 length; __u8 data[0]; }; struct usb_raw_ep_io { __u16 ep; __u16 flags; __u32 length; __u8 data[0]; }; #define USB_RAW_EPS_NUM_MAX 30 #define USB_RAW_EP_NAME_MAX 16 #define USB_RAW_EP_ADDR_ANY 0xff struct usb_raw_ep_caps { __u32 type_control : 1; __u32 type_iso : 1; __u32 type_bulk : 1; __u32 type_int : 1; __u32 dir_in : 1; __u32 dir_out : 1; }; struct usb_raw_ep_limits { __u16 maxpacket_limit; __u16 max_streams; __u32 reserved; }; struct usb_raw_ep_info { __u8 name[USB_RAW_EP_NAME_MAX]; __u32 addr; struct usb_raw_ep_caps caps; struct usb_raw_ep_limits limits; }; struct usb_raw_eps_info { struct usb_raw_ep_info eps[USB_RAW_EPS_NUM_MAX]; }; #define USB_RAW_IOCTL_INIT _IOW('U', 0, struct usb_raw_init) #define USB_RAW_IOCTL_RUN _IO('U', 1) #define USB_RAW_IOCTL_EVENT_FETCH _IOR('U', 2, struct usb_raw_event) #define USB_RAW_IOCTL_EP0_WRITE _IOW('U', 3, struct usb_raw_ep_io) #define USB_RAW_IOCTL_EP0_READ _IOWR('U', 4, struct usb_raw_ep_io) #define USB_RAW_IOCTL_EP_ENABLE _IOW('U', 5, struct usb_endpoint_descriptor) #define USB_RAW_IOCTL_EP_DISABLE _IOW('U', 6, __u32) #define USB_RAW_IOCTL_EP_WRITE _IOW('U', 7, struct usb_raw_ep_io) #define USB_RAW_IOCTL_EP_READ _IOWR('U', 8, struct usb_raw_ep_io) #define USB_RAW_IOCTL_CONFIGURE _IO('U', 9) #define USB_RAW_IOCTL_VBUS_DRAW _IOW('U', 10, __u32) #define USB_RAW_IOCTL_EPS_INFO _IOR('U', 11, struct usb_raw_eps_info) #define USB_RAW_IOCTL_EP0_STALL _IO('U', 12) #define USB_RAW_IOCTL_EP_SET_HALT _IOW('U', 13, __u32) #define USB_RAW_IOCTL_EP_CLEAR_HALT _IOW('U', 14, __u32) #define USB_RAW_IOCTL_EP_SET_WEDGE _IOW('U', 15, __u32) static int usb_raw_open() { return open("/dev/raw-gadget", O_RDWR); } static int usb_raw_init(int fd, uint32_t speed, const char* driver, const char* device) { struct usb_raw_init arg; strncpy((char*)&arg.driver_name[0], driver, sizeof(arg.driver_name)); strncpy((char*)&arg.device_name[0], device, sizeof(arg.device_name)); arg.speed = speed; return ioctl(fd, USB_RAW_IOCTL_INIT, &arg); } static int usb_raw_run(int fd) { return ioctl(fd, USB_RAW_IOCTL_RUN, 0); } static int usb_raw_configure(int fd) { return ioctl(fd, USB_RAW_IOCTL_CONFIGURE, 0); } static int usb_raw_vbus_draw(int fd, uint32_t power) { return ioctl(fd, USB_RAW_IOCTL_VBUS_DRAW, power); } static int usb_raw_ep0_write(int fd, struct usb_raw_ep_io* io) { return ioctl(fd, USB_RAW_IOCTL_EP0_WRITE, io); } static int usb_raw_ep0_read(int fd, struct usb_raw_ep_io* io) { return ioctl(fd, USB_RAW_IOCTL_EP0_READ, io); } static int usb_raw_event_fetch(int fd, struct usb_raw_event* event) { return ioctl(fd, USB_RAW_IOCTL_EVENT_FETCH, event); } static int usb_raw_ep_enable(int fd, struct usb_endpoint_descriptor* desc) { return ioctl(fd, USB_RAW_IOCTL_EP_ENABLE, desc); } static int usb_raw_ep_disable(int fd, int ep) { return ioctl(fd, USB_RAW_IOCTL_EP_DISABLE, ep); } static int usb_raw_ep0_stall(int fd) { return ioctl(fd, USB_RAW_IOCTL_EP0_STALL, 0); } #define USB_MAX_PACKET_SIZE 4096 struct usb_raw_control_event { struct usb_raw_event inner; struct usb_ctrlrequest ctrl; char data[USB_MAX_PACKET_SIZE]; }; struct usb_raw_ep_io_data { struct usb_raw_ep_io inner; char data[USB_MAX_PACKET_SIZE]; }; static void set_interface(int fd, int n) { struct usb_device_index* index = lookup_usb_index(fd); if (!index) return; if (index->iface_cur >= 0 && index->iface_cur < index->ifaces_num) { for (int ep = 0; ep < index->ifaces[index->iface_cur].eps_num; ep++) { int rv = usb_raw_ep_disable( fd, index->ifaces[index->iface_cur].eps[ep].handle); if (rv < 0) { } else { } } } if (n >= 0 && n < index->ifaces_num) { for (int ep = 0; ep < index->ifaces[n].eps_num; ep++) { int rv = usb_raw_ep_enable(fd, &index->ifaces[n].eps[ep].desc); if (rv < 0) { } else { index->ifaces[n].eps[ep].handle = rv; } } index->iface_cur = n; } } static int configure_device(int fd) { struct usb_device_index* index = lookup_usb_index(fd); if (!index) return -1; int rv = usb_raw_vbus_draw(fd, index->bMaxPower); if (rv < 0) { return rv; } rv = usb_raw_configure(fd); if (rv < 0) { return rv; } set_interface(fd, 0); return 0; } static volatile long syz_usb_connect_impl(uint64_t speed, uint64_t dev_len, const char* dev, const struct vusb_connect_descriptors* descs, lookup_connect_out_response_t lookup_connect_response_out) { if (!dev) { return -1; } int fd = usb_raw_open(); if (fd < 0) { return fd; } if (fd >= MAX_FDS) { close(fd); return -1; } struct usb_device_index* index = add_usb_index(fd, dev, dev_len); if (!index) { return -1; } char device[32]; sprintf(&device[0], "dummy_udc.%llu", procid); int rv = usb_raw_init(fd, speed, "dummy_udc", &device[0]); if (rv < 0) { return rv; } rv = usb_raw_run(fd); if (rv < 0) { return rv; } bool done = false; while (!done) { struct usb_raw_control_event event; event.inner.type = 0; event.inner.length = sizeof(event.ctrl); rv = usb_raw_event_fetch(fd, (struct usb_raw_event*)&event); if (rv < 0) { return rv; } if (event.inner.type != USB_RAW_EVENT_CONTROL) continue; char* response_data = NULL; uint32_t response_length = 0; struct usb_qualifier_descriptor qual; if (event.ctrl.bRequestType & USB_DIR_IN) { if (!lookup_connect_response_in(fd, descs, &event.ctrl, &qual, &response_data, &response_length)) { usb_raw_ep0_stall(fd); continue; } } else { if (!lookup_connect_response_out(fd, descs, &event.ctrl, &done)) { usb_raw_ep0_stall(fd); continue; } response_data = NULL; response_length = event.ctrl.wLength; } if ((event.ctrl.bRequestType & USB_TYPE_MASK) == USB_TYPE_STANDARD && event.ctrl.bRequest == USB_REQ_SET_CONFIGURATION) { rv = configure_device(fd); if (rv < 0) { return rv; } } struct usb_raw_ep_io_data response; response.inner.ep = 0; response.inner.flags = 0; if (response_length > sizeof(response.data)) response_length = 0; if (event.ctrl.wLength < response_length) response_length = event.ctrl.wLength; response.inner.length = response_length; if (response_data) memcpy(&response.data[0], response_data, response_length); else memset(&response.data[0], 0, response_length); if (event.ctrl.bRequestType & USB_DIR_IN) { rv = usb_raw_ep0_write(fd, (struct usb_raw_ep_io*)&response); } else { rv = usb_raw_ep0_read(fd, (struct usb_raw_ep_io*)&response); } if (rv < 0) { return rv; } } sleep_ms(200); return fd; } static volatile long syz_usb_connect(volatile long a0, volatile long a1, volatile long a2, volatile long a3) { uint64_t speed = a0; uint64_t dev_len = a1; const char* dev = (const char*)a2; const struct vusb_connect_descriptors* descs = (const struct vusb_connect_descriptors*)a3; return syz_usb_connect_impl(speed, dev_len, dev, descs, &lookup_connect_response_out_generic); } //% 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); memcpy((void*)0x20000140, "nilfs2\000", 7); memcpy((void*)0x20000000, "./file0\000", 8); *(uint64_t*)0x20000200 = 0; *(uint8_t*)0x20000208 = 0; sprintf((char*)0x20000209, "%023llo", (long long)-1); memcpy((void*)0x20000220, "\xd1\x79\x4d\xa8\xc0\xcc\xda\x03\x42\x76\xe2\x8a\x25\xc4\x5c\x8e\x1e" "\xb8\xb5\x95\xa3\x7f\xfd\xfe\x7d\x2a\x8c\x39\x72\xa6\x93\x1d\x2c\xbb" "\x0d\x8d\xc9\x20\xbb\xde\x15\xd8\x79\x0d\x46\xcc\xb3\xa5\xf3\x6f\xf4" "\x12\x23\x62\x51\xd8\x63\x34\xf1\x75\x45\xcc\xae\x88", 64); *(uint32_t*)0x20000260 = -1; *(uint32_t*)0x20000264 = -1; *(uint32_t*)0x20000268 = -1; sprintf((char*)0x2000026c, "%023llo", (long long)0); sprintf((char*)0x20000283, "%020llu", (long long)0); sprintf((char*)0x20000297, "%023llo", (long long)-1); sprintf((char*)0x200002ae, "%023llo", (long long)-1); memcpy( (void*)0x20000980, "\x78\x9c\xec\xdd\x4b\x8c\x1c\x47\x19\x00\xe0\xee\xdd\x9d\xb5\x9d\x38\x78" "\x1c\x6c\x62\x9c\x90\xd8\x04\x92\x08\xc8\x6e\xbc\x6b\xcc\xc3\x82\x38\x8a" "\x2f\x58\x31\xe2\x16\x29\xe2\x62\x39\x4e\xb0\x70\x0c\xc2\x91\x20\x51\x24" "\x6c\x9f\xb8\x91\xc8\x32\x37\xc4\x43\x9c\x72\x89\x00\x21\x91\x0b\xb2\x72" "\xe2\x12\x89\x58\xe2\x92\x53\xe0\xc0\x01\xcb\x48\x91\x38\x40\x82\x3d\x68" "\x67\xab\x66\x67\x7e\xcf\xa4\x67\xbd\x8f\xde\xd9\xf9\x3e\xa9\xa6\xa6\xbb" "\x6a\xba\xaa\x67\x7b\x7a\xfb\x55\x55\x05\x30\xb6\x26\xda\xaf\x8d\xf6\xeb" "\xe5\x37\x2f\x1d\xfd\xe7\x43\xff\xd8\xb6\xf0\xfe\xf1\x4e\x8e\x66\xfb\x75" "\xaa\x6b\x6a\x21\x77\x99\xa6\xa7\xc2\xf2\xde\x9b\x5c\x8c\x6f\xbc\xff\xca" "\xc9\x7e\x71\x59\xcc\xb5\x5f\xf3\xf4\x64\xd7\x67\xef\x2c\x8a\xe2\x7c\xb1" "\xaf\xb8\x52\x34\x8b\xbd\x97\xaf\xbe\xf6\xf6\xdc\x53\xc7\x2f\x1c\xbb\xb8" "\xff\x9d\xd7\x0f\x5f\x5b\x83\x55\x07\x00\x80\xb1\xf3\xad\x2b\x87\x0f\xee" "\xfe\xdb\x5f\xee\xdd\xf9\xc1\x1b\xf7\x1f\x29\xb6\x74\xe6\xe7\xe3\xf3\x66" "\x9a\xde\x9e\x8e\xfb\x8f\xa4\x03\xff\x85\x68\xaa\xcc\xe7\x0f\x4b\xe7\x03" "\x65\x57\xe8\x36\x1d\xf2\x4d\xa5\x30\x11\xf2\x4d\xf6\xc9\x57\x74\xe5\x6b" "\xe4\x7c\x5b\x7b\x3f\x17\xcb\x9f\x0e\xcb\x6d\x0c\xc8\xb7\xa5\xa2\xfc\xc9" "\x70\x8e\x52\x86\xfa\xc0\x28\xcb\xdb\x71\xb3\x28\x27\x66\x7a\xa6\x27\x26" "\x66\x66\x16\xcf\xc9\x8b\xf6\x79\xfd\x74\x39\x73\xf6\xf4\x99\xe7\xce\xd5" "\x54\x51\x60\xd5\xfd\xfb\x81\xa2\x28\xf6\x09\xc2\xb8\x85\xd6\x8e\xce\x8f" "\xa0\xf6\xba\xd4\x17\xba\xbe\x05\x80\x5a\xc5\xfb\x85\xb7\x38\x1f\xaf\x2c" "\xac\x4c\x67\x69\x53\xc3\x95\x7f\xfd\x89\x89\xfe\x9f\xef\xd5\x58\xcd\x3a" "\x32\x3e\xd6\x7b\xfb\x57\x7e\x5c\x7e\x6f\x3d\xd6\xbb\xfc\xaa\xf5\xff\xcd" "\x85\x35\x5e\x7f\xc6\xca\xf0\x5b\xd3\xd6\x35\xad\xc7\x6a\xcb\xeb\x95\x7f" "\x47\xdb\xd3\x74\xbc\x8f\x10\x9f\x5f\x5a\xee\xfe\x27\x2f\x6f\x32\x2c\x6f" "\xd8\x03\x80\x41\xf7\x11\x46\xe5\xfe\xc2\xa0\x7a\x4e\xae\x73\x3d\x6e\xd7" "\xa0\xfa\xc7\xed\x62\xb3\xfa\x5a\x8a\xf3\xf7\xf0\xf5\x90\xde\xfd\xfb\x89" "\x7f\xd3\x51\xf9\x1b\x03\xfd\xfd\x67\xc3\x5d\xff\xdf\xb6\x54\xb9\xda\xeb" "\x22\x08\x9b\x3b\xb4\xea\xdc\xf9\x00\xf5\xaa\x38\xad\x8f\xcf\xcd\xb5\x92" "\x9c\x1e\x9f\xeb\x8b\xe9\x5b\x2a\xd2\xb7\x56\xa4\x6f\xab\x48\xbf\xa3\x22" "\xfd\xce\x8a\x74\x18\x67\xbf\x7f\xf1\xa7\xc5\xab\x65\xd1\xb7\x3d\x5e\xb1" "\x78\xfe\xdf\xfe\xb1\x0c\x7b\x3d\x2c\x5f\x67\xbb\x2b\xc5\x1f\x5b\x66\x7d" "\xe2\xf5\xc8\xe5\x5e\x8f\x8b\xcf\xfd\x2e\xd7\x4a\xcb\x8f\xcf\x13\xc3\x46" "\xf6\xc7\x13\x4f\x9f\xfa\xf2\xb3\xcf\x5c\x5d\x7c\xfe\xbf\xec\x6c\xff\x37" "\xd3\xf6\xbe\x2f\x4d\x37\xd3\x6f\xeb\x4a\xca\x90\xaf\x17\xc6\xeb\xea\x9d" "\x67\xff\x9b\xbd\xe5\x4c\x0c\xc8\x77\x77\xa8\xcf\x5d\x7d\xf2\xb7\xdf\xef" "\xea\xcd\x57\xee\x5a\x5a\x4e\xd1\xb5\x9f\xb9\xa5\x1e\x7b\x7a\x3f\xb7\x63" "\x50\xbe\xfb\x7a\xf3\x35\x43\xbe\x6d\x29\xc4\xc3\xa5\x78\x7c\x72\x47\xf8" "\x5c\x3e\xfe\xc8\xfb\xd5\xfc\x7d\x4d\x85\xf5\x6d\x84\xf5\x98\x0e\xf5\xc8" "\xfb\x95\x9d\x29\x1e\xad\xbb\x31\x6c\x54\x79\x7b\x1c\xf4\xfc\x7f\xde\x3e" "\xf7\x14\x8d\xf2\xb9\xd3\x67\x4e\x3d\x96\xa6\xf3\x76\xfa\xe7\xc9\xc6\x96" "\x85\xf9\x07\xd6\xb9\xde\xc0\xca\x0d\xdb\xfe\x67\x4f\xd1\xdb\xfe\x67\x7b" "\x67\x7e\x63\xa2\x7b\xbf\xb0\x63\x69\x7e\xd9\xbd\x5f\x68\x86\xf9\x73\x03" "\xe6\xcf\xa7\xe9\xfc\x7f\xee\x3b\x93\xdb\xda\xf3\x67\x4e\x7e\xef\xcc\xb3" "\xab\xbd\xf2\x30\xe6\xce\xbd\xf4\xf2\x77\x4f\x9c\x39\x73\xea\x07\xde\x78" "\xe3\x8d\x37\x9d\x37\x75\xef\x99\x80\xb5\x36\xfb\xe2\x0b\xdf\x9f\x3d\xf7" "\xd2\xcb\x8f\x9e\x7e\xe1\xc4\xf3\xa7\x9e\x3f\x75\x76\xfe\xd0\xa1\xf9\xb9" "\xb9\x43\x5f\x99\x3f\x38\xdb\x3e\xae\x9f\xed\x3e\xba\x07\x36\x93\xa5\x7f" "\xfa\x75\xd7\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x18\xd6\x0f\x8f\x1d" "\xbd\xfa\xd7\xb7\xbe\xf4\xee\x62\xfb\xff\xa5\xf6\x7f\xb9\xfd\x7f\x7e\xf2" "\x37\xb7\xff\xff\x49\x68\xff\x1f\xdb\xc9\xe7\x76\xf0\xb9\x1d\xe0\xce\x3e" "\xe9\xed\x3c\xa1\x83\xd5\xe9\x90\xaf\x91\xc2\xc7\x43\x7d\x77\x85\x72\x76" "\x87\xcf\x7d\x22\xc5\x9d\x71\xfc\x52\xfb\xff\x5c\x5c\xec\xd7\x35\xd7\xe7" "\x9e\x30\x3f\xf6\xdf\x9b\xf3\x85\xee\x04\x6e\xe9\x2f\x65\x3a\xf4\x41\x12" "\xc7\x0b\xfc\x74\x8a\x2f\xa6\xf8\xd7\x05\xd4\xa8\xfc\x79\xff\xd9\x29\xae" "\xea\xdf\x3a\x6f\xeb\xb9\x7f\x0a\xfd\x52\x8c\xa6\xfc\x77\xcb\xfd\x99\xe4" "\x7e\x4c\x72\xfb\xef\x41\xfd\x3a\xe5\xfd\xff\xce\xfe\x8b\xfd\xf1\x6a\xd7" "\x93\xd5\xb5\x1e\xcd\x09\xeb\x5e\x47\xa0\xbf\x7f\x6d\xb8\xfe\xbf\xd7\x24" "\x2c\x75\xf8\x59\x7b\x5d\xba\xce\x18\x6a\xaf\x8b\xb0\xd1\xc2\x8d\x56\xab" "\xb5\x9e\xe5\xb5\x5a\x1f\x35\x8a\x87\xb1\xa6\x80\xf5\x53\xf7\xf8\x9f\xf9" "\xba\x67\x8e\xcf\xfe\xe9\x1b\x5b\x17\x42\xce\x76\xfd\x89\xde\xfd\x65\xec" "\xbf\x14\x56\xa2\xee\xf1\x2f\x6b\x2b\x3f\x5f\x58\x1c\xd7\xf5\x1f\xb2\xfc" "\xd5\x1e\xff\xb3\x33\xfe\xdd\xd0\xfb\xbf\x30\x62\x5e\xf3\xf6\xca\xfd\xef" "\x2f\xae\xbd\xdb\x55\x6c\xb1\x77\x60\xf9\x5b\x8a\x9e\xf2\xe3\xfa\xe7\x7e" "\xa0\x77\x2d\xaf\xfc\x0f\x52\xf9\x79\x6d\x1e\x2e\x06\x95\xdf\xbb\xfe\xad" "\x5f\x85\xf2\xe3\x0d\xa1\x21\x7d\x18\xca\xbf\x63\xc8\xf2\xe3\xfa\x5f\x5a" "\x6e\xc1\xa9\xc0\xff\xa5\xf2\xf3\xd7\xf6\xc8\x83\xc3\x96\xbf\xb8\x80\x72" "\xa2\xb7\x1e\xf1\xba\x71\xbe\xff\x17\xaf\x1b\x67\x37\xc2\xfa\xe7\xbe\x3d" "\x97\xbb\xfe\xb7\x3b\x50\xe3\xcd\x54\x3e\x8c\xb3\x51\x19\x67\x76\xb9\x7a" "\xc6\xff\xbd\xd0\x5a\xff\xf1\x7f\x57\x38\xc2\x50\x7c\x0e\xe3\x8b\x69\x3a" "\xef\x08\xf3\x73\x0e\x71\xbc\x93\xe5\xd6\x3f\x3f\x5f\x91\xff\x0f\xec\x0e" "\xcb\x2f\x2b\xfe\xbf\x19\xff\x77\xb4\x7d\x35\xc5\x55\xbf\x87\x3c\xfe\x6f" "\xde\x1e\x9b\x7d\xa6\x27\xba\xa6\x1b\x7d\xbe\xdb\xcd\xba\xaf\x81\x51\xf5" "\xde\xaa\xdd\xff\xeb\x7a\x62\x6e\x03\xdc\x47\x11\xc6\x27\x94\xb6\xb9\xdb" "\x0e\xad\x56\xab\xd6\x9b\x7c\xee\x30\xd6\xab\xee\xef\xbf\xee\xf3\x84\xba" "\xcb\xaf\xfb\xfb\xaf\x12\xc7\xff\x8d\xc7\xf0\x71\xfc\xdf\x98\x1e\xc7\xff" "\x8d\xe9\x71\xfc\xdf\x98\xde\xbe\xae\xf8\xe1\xd2\xa0\xbd\xf1\xfb\x8a\xe3" "\xff\xc6\xf4\x38\xfe\x6f\x4c\xbf\x27\x94\x1b\xc7\x07\xde\x53\x91\xfe\xc9" "\x8a\xf4\xbd\x15\xe9\xf7\x56\xa4\xdf\x57\x91\xfe\xa9\x8a\xf4\xfd\x15\xe9" "\xf7\x57\xa4\x3f\x50\x91\x7e\x77\x45\xfa\x83\x15\xe9\x9f\x09\x7f\xf1\x98" "\xfe\xd9\x8a\xcf\x3f\x54\x91\xfe\xc8\x47\xa7\xcf\xff\xa8\xe2\xf3\x9b\x5d" "\x6e\x8f\x32\xae\xeb\x0f\xe3\x2c\xb6\xcf\xf3\xfb\x87\xf1\x91\xef\xff\x0c" "\xfa\xfd\xef\xaa\x48\x07\x46\xd7\xcf\xde\x38\xf0\xe4\x33\xbf\xfb\x76\x73" "\xb1\xfd\xff\x74\xe7\x7a\x48\xbe\x8f\x77\x24\x4d\x37\xd2\xb9\x73\x3c\x5f" "\x8a\xd7\x4f\x26\x53\xda\x5b\x69\xfa\xef\x21\x7d\xa3\x5f\xef\x80\x71\x12" "\xfb\xcf\x88\xff\xdf\x1f\xae\x48\x07\x46\x57\x7e\xce\xcb\xef\x1b\xc6\x50" "\xd9\xbf\xc7\x9e\x61\xfb\xad\x1a\x74\x9c\xcf\x68\xf9\x5c\x8a\x3f\x9f\xe2" "\x2f\xa4\xf8\xd1\x14\xcf\xa4\x78\x36\xc5\x07\x52\x3c\xb7\x4e\xf5\x63\x6d" "\x3c\xf9\xdb\x3f\x1c\x7e\xb5\x5c\x3a\xdf\xdf\x11\xd2\x87\x7d\x9e\x3c\xb6" "\x07\x8a\xfd\x44\xcd\x0f\x59\x9f\x78\x7d\x60\xb9\xcf\xb3\xc7\x7e\xfc\x96" "\x6b\xa5\xe5\xdf\x66\x73\x30\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\xda\x4c\xb4\x5f\x0f" "\x1e\xdc\x53\x16\xc5\xe5\x37\x2f\x1d\x7d\xfa\xf8\xe9\xd9\x85\x39\x8f\x77" "\x72\x34\xdb\xaf\x53\x5d\x53\x8d\xce\xe7\x8a\xe2\xb1\x14\x4f\xa6\xf8\x97" "\xe9\xcd\x8d\xf7\x5f\x39\xd9\x1d\xdf\x4c\x71\x59\xcc\x15\x65\x51\x76\xe6" "\x17\xdf\xbc\xde\x29\xe9\xce\xa2\x28\xce\x17\xfb\x8a\x2b\x45\xb3\xd8\x7b" "\xf9\xea\x6b\x6f\xcf\x3d\x75\xfc\xc2\xb1\x8b\xfb\xdf\x79\xfd\xf0\xb5\xb5" "\xfb\x06\x00\x00\x00\x60\xf3\xfb\x7f\x00\x00\x00\xff\xff\x4d\xda\x1c" "\x2a", 2682); syz_mount_image( /*fs=*/0x20000140, /*dir=*/0x20000000, /*flags=MS_POSIXACL|MS_NOEXEC|MS_NODIRATIME|MS_NODEV*/ 0x1080c, /*opts=*/0x20000200, /*chdir=*/1, /*size=*/0xa7a, /*img=*/0x20000980); memcpy((void*)0x20000200, "\x12\x01\x00\x00\xfa\x5f\x1c\x08\x90\x16\x12\x07\x9d\x78\x01\x02\x03" "\x01\x09\x02\x1b\x00\x01\x00\x00\x00\x00\x09\x04\x00\x00\x01\x95\x10" "\x46\x00\x09\x05\x81", 39); syz_usb_connect(/*speed=*/0, /*dev_len=*/0x2d, /*dev=*/0x20000200, /*conn_descs=*/0); return 0; }