// https://syzkaller.appspot.com/bug?id=47ca2ff42f9c5d5d353149ecc97f29de7828bbfd // 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 #include #ifndef SYS_mmap #define SYS_mmap 197 #endif static unsigned long long procid; static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { pthread_mutex_t mu; pthread_cond_t cv; int state; } event_t; static void event_init(event_t* ev) { if (pthread_mutex_init(&ev->mu, 0)) exit(1); if (pthread_cond_init(&ev->cv, 0)) exit(1); ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { pthread_mutex_lock(&ev->mu); if (ev->state) exit(1); ev->state = 1; pthread_mutex_unlock(&ev->mu); pthread_cond_broadcast(&ev->cv); } static void event_wait(event_t* ev) { pthread_mutex_lock(&ev->mu); while (!ev->state) pthread_cond_wait(&ev->cv, &ev->mu); pthread_mutex_unlock(&ev->mu); } static int event_isset(event_t* ev) { pthread_mutex_lock(&ev->mu); int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; pthread_mutex_lock(&ev->mu); for (;;) { if (ev->state) break; uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); now = current_time_ms(); if (now - start > timeout) break; } int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } struct usb_endpoint_descriptor { uint8_t bLength; uint8_t bDescriptorType; uint8_t bEndpointAddress; uint8_t bmAttributes; uint16_t wMaxPacketSize; uint8_t bInterval; uint8_t bRefresh; uint8_t bSynchAddress; } __attribute__((packed)); struct usb_device_descriptor { uint8_t bLength; uint8_t bDescriptorType; uint16_t bcdUSB; uint8_t bDeviceClass; uint8_t bDeviceSubClass; uint8_t bDeviceProtocol; uint8_t bMaxPacketSize0; uint16_t idVendor; uint16_t idProduct; uint16_t bcdDevice; uint8_t iManufacturer; uint8_t iProduct; uint8_t iSerialNumber; uint8_t bNumConfigurations; } __attribute__((packed)); struct usb_config_descriptor { uint8_t bLength; uint8_t bDescriptorType; uint16_t wTotalLength; uint8_t bNumInterfaces; uint8_t bConfigurationValue; uint8_t iConfiguration; uint8_t bmAttributes; uint8_t bMaxPower; } __attribute__((packed)); struct usb_interface_descriptor { uint8_t bLength; uint8_t bDescriptorType; uint8_t bInterfaceNumber; uint8_t bAlternateSetting; uint8_t bNumEndpoints; uint8_t bInterfaceClass; uint8_t bInterfaceSubClass; uint8_t bInterfaceProtocol; uint8_t iInterface; } __attribute__((packed)); struct usb_ctrlrequest { uint8_t bRequestType; uint8_t bRequest; uint16_t wValue; uint16_t wIndex; uint16_t wLength; } __attribute__((packed)); struct usb_qualifier_descriptor { uint8_t bLength; uint8_t bDescriptorType; uint16_t bcdUSB; uint8_t bDeviceClass; uint8_t bDeviceSubClass; uint8_t bDeviceProtocol; uint8_t bMaxPacketSize0; uint8_t bNumConfigurations; uint8_t bRESERVED; } __attribute__((packed)); #define USB_TYPE_MASK (0x03 << 5) #define USB_TYPE_STANDARD (0x00 << 5) #define USB_TYPE_CLASS (0x01 << 5) #define USB_TYPE_VENDOR (0x02 << 5) #define USB_TYPE_RESERVED (0x03 << 5) #define USB_DT_DEVICE 0x01 #define USB_DT_CONFIG 0x02 #define USB_DT_STRING 0x03 #define USB_DT_INTERFACE 0x04 #define USB_DT_ENDPOINT 0x05 #define USB_DT_DEVICE_QUALIFIER 0x06 #define USB_DT_OTHER_SPEED_CONFIG 0x07 #define USB_DT_INTERFACE_POWER 0x08 #define USB_DT_OTG 0x09 #define USB_DT_DEBUG 0x0a #define USB_DT_INTERFACE_ASSOCIATION 0x0b #define USB_DT_SECURITY 0x0c #define USB_DT_KEY 0x0d #define USB_DT_ENCRYPTION_TYPE 0x0e #define USB_DT_BOS 0x0f #define USB_DT_DEVICE_CAPABILITY 0x10 #define USB_DT_WIRELESS_ENDPOINT_COMP 0x11 #define USB_DT_WIRE_ADAPTER 0x21 #define USB_DT_RPIPE 0x22 #define USB_DT_CS_RADIO_CONTROL 0x23 #define USB_DT_PIPE_USAGE 0x24 #define USB_DT_SS_ENDPOINT_COMP 0x30 #define USB_DT_SSP_ISOC_ENDPOINT_COMP 0x31 #define USB_REQ_GET_STATUS 0x00 #define USB_REQ_CLEAR_FEATURE 0x01 #define USB_REQ_SET_FEATURE 0x03 #define USB_REQ_SET_ADDRESS 0x05 #define USB_REQ_GET_DESCRIPTOR 0x06 #define USB_REQ_SET_DESCRIPTOR 0x07 #define USB_REQ_GET_CONFIGURATION 0x08 #define USB_REQ_SET_CONFIGURATION 0x09 #define USB_REQ_GET_INTERFACE 0x0A #define USB_REQ_SET_INTERFACE 0x0B #define USB_REQ_SYNCH_FRAME 0x0C #define USB_REQ_SET_SEL 0x30 #define USB_REQ_SET_ISOCH_DELAY 0x31 #define USB_REQ_SET_ENCRYPTION 0x0D #define USB_REQ_GET_ENCRYPTION 0x0E #define USB_REQ_RPIPE_ABORT 0x0E #define USB_REQ_SET_HANDSHAKE 0x0F #define USB_REQ_RPIPE_RESET 0x0F #define USB_REQ_GET_HANDSHAKE 0x10 #define USB_REQ_SET_CONNECTION 0x11 #define USB_REQ_SET_SECURITY_DATA 0x12 #define USB_REQ_GET_SECURITY_DATA 0x13 #define USB_REQ_SET_WUSB_DATA 0x14 #define USB_REQ_LOOPBACK_DATA_WRITE 0x15 #define USB_REQ_LOOPBACK_DATA_READ 0x16 #define USB_REQ_SET_INTERFACE_DS 0x17 #define USB_REQ_GET_PARTNER_PDO 20 #define USB_REQ_GET_BATTERY_STATUS 21 #define USB_REQ_SET_PDO 22 #define USB_REQ_GET_VDM 23 #define USB_REQ_SEND_VDM 24 #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 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; } 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; } 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, 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) { struct usb_qualifier_descriptor* qual = (struct usb_qualifier_descriptor*)response_data; 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_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; } static int vhci_open(void) { char path[1024]; snprintf(path, sizeof(path), "/dev/vhci%llu", procid); return open(path, O_RDWR); } static int vhci_setport(int fd, u_int port) { struct vhci_ioc_set_port args; args.port = port; return ioctl(fd, VHCI_IOC_SET_PORT, &args); } static int vhci_usb_attach(int fd) { return ioctl(fd, VHCI_IOC_USB_ATTACH, NULL); } static int vhci_usb_recv(int fd, void* buf, size_t size) { uint8_t* ptr = (uint8_t*)buf; while (1) { ssize_t done = read(fd, ptr, size); if (done < 0) return -1; if ((size_t)done == size) return 0; size -= done; ptr += done; } } static int vhci_usb_send(int fd, void* buf, size_t size) { uint8_t* ptr = (uint8_t*)buf; while (1) { ssize_t done = write(fd, ptr, size); if (done <= 0) return -1; if ((size_t)done == size) return 0; size -= done; ptr += done; } } static volatile long syz_usb_connect_impl(int fd, 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) { struct usb_device_index* index = add_usb_index(fd, dev, dev_len); if (!index) { return -1; } if (vhci_setport(fd, 1)) exit(1); if (vhci_usb_attach(fd)) { return -1; } bool done = false; while (!done) { vhci_request_t req; if (vhci_usb_recv(fd, &req, sizeof(req))) { return -1; } if (req.type != VHCI_REQ_CTRL) { return -1; } char* response_data = NULL; uint32_t response_length = 0; char data[4096]; if (req.u.ctrl.bmRequestType & UE_DIR_IN) { if (!lookup_connect_response_in( fd, descs, (const struct usb_ctrlrequest*)&req.u.ctrl, &response_data, &response_length)) { return -1; } } else { if (!lookup_connect_response_out( fd, descs, (const struct usb_ctrlrequest*)&req.u.ctrl, &done)) { return -1; } response_data = NULL; response_length = UGETW(req.u.ctrl.wLength); } if ((req.u.ctrl.bmRequestType & USB_TYPE_MASK) == USB_TYPE_STANDARD && req.u.ctrl.bRequest == USB_REQ_SET_CONFIGURATION) { } if (response_length > sizeof(data)) response_length = 0; if ((uint32_t)UGETW(req.u.ctrl.wLength) < response_length) response_length = UGETW(req.u.ctrl.wLength); if (response_data) memcpy(data, response_data, response_length); else memset(data, 0, response_length); int rv = 0; if (req.u.ctrl.bmRequestType & UE_DIR_IN) { if (response_length > 0) { vhci_response_t res; res.size = response_length; rv = vhci_usb_send(fd, &res, sizeof(res)); if (rv == 0) rv = vhci_usb_send(fd, data, response_length); } } else { rv = vhci_usb_recv(fd, data, response_length); } if (rv < 0) { return -1; } } 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; if (!dev) { return -1; } int fd = vhci_open(); if (fd < 0) exit(1); long res = syz_usb_connect_impl(fd, speed, dev_len, dev, descs, &lookup_connect_response_out_generic); close(fd); return res; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 2; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 0) break; event_timedwait(&th->done, 50 + (call == 0 ? 3000 : 0) + (call == 1 ? 3000 : 0)); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); #define WAIT_FLAGS 0 static void loop(void) { int iter = 0; for (;; iter++) { int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5000) continue; kill_and_wait(pid, &status); break; } } } void execute_call(int call) { switch (call) { case 0: syz_usb_connect(0, 0x36, 0x20000040, 0); { int i; for (i = 0; i < 64; i++) { syz_usb_connect(0, 0x36, 0x20000040, 0); } } break; case 1: *(uint8_t*)0x200005c0 = 0x12; *(uint8_t*)0x200005c1 = 1; *(uint16_t*)0x200005c2 = 0x110; *(uint8_t*)0x200005c4 = 0; *(uint8_t*)0x200005c5 = 0; *(uint8_t*)0x200005c6 = 0; *(uint8_t*)0x200005c7 = 8; *(uint16_t*)0x200005c8 = 0; *(uint16_t*)0x200005ca = 0; *(uint16_t*)0x200005cc = 0; *(uint8_t*)0x200005ce = 1; *(uint8_t*)0x200005cf = 2; *(uint8_t*)0x200005d0 = 3; *(uint8_t*)0x200005d1 = 1; *(uint8_t*)0x200005d2 = 9; *(uint8_t*)0x200005d3 = 2; *(uint16_t*)0x200005d4 = 0x2b1; *(uint8_t*)0x200005d6 = 3; *(uint8_t*)0x200005d7 = 9; *(uint8_t*)0x200005d8 = 0x7f; *(uint8_t*)0x200005d9 = 0xa0; *(uint8_t*)0x200005da = 1; *(uint8_t*)0x200005db = 9; *(uint8_t*)0x200005dc = 4; *(uint8_t*)0x200005dd = 0; *(uint8_t*)0x200005de = 0x1f; *(uint8_t*)0x200005df = 9; *(uint8_t*)0x200005e0 = 0; *(uint8_t*)0x200005e1 = 0; *(uint8_t*)0x200005e2 = 0; *(uint8_t*)0x200005e3 = 3; *(uint8_t*)0x200005e4 = 9; *(uint8_t*)0x200005e5 = 5; *(uint8_t*)0x200005e6 = 5; *(uint8_t*)0x200005e7 = 0; *(uint16_t*)0x200005e8 = 0x20; *(uint8_t*)0x200005ea = 7; *(uint8_t*)0x200005eb = 0x81; *(uint8_t*)0x200005ec = 9; *(uint8_t*)0x200005ed = 0x16; *(uint8_t*)0x200005ee = 0; memcpy((void*)0x200005ef, "\xf4\x9c\xae\xdf\x94\x54\x82\xd4\xe0\x2b\x04\x9b\xe2\x9e\x12\x3c" "\xd2\xe8\x94\x7c", 20); *(uint8_t*)0x20000603 = 2; *(uint8_t*)0x20000604 = 9; *(uint8_t*)0x20000605 = 9; *(uint8_t*)0x20000606 = 5; *(uint8_t*)0x20000607 = 0; *(uint8_t*)0x20000608 = 0x10; *(uint16_t*)0x20000609 = 0x3ff; *(uint8_t*)0x2000060b = 0xbb; *(uint8_t*)0x2000060c = 0x81; *(uint8_t*)0x2000060d = 6; *(uint8_t*)0x2000060e = 2; *(uint8_t*)0x2000060f = 1; *(uint8_t*)0x20000610 = 9; *(uint8_t*)0x20000611 = 5; *(uint8_t*)0x20000612 = 5; *(uint8_t*)0x20000613 = 0; *(uint16_t*)0x20000614 = 0x448; *(uint8_t*)0x20000616 = 4; *(uint8_t*)0x20000617 = -1; *(uint8_t*)0x20000618 = 4; *(uint8_t*)0x20000619 = 2; *(uint8_t*)0x2000061a = 8; *(uint8_t*)0x2000061b = 7; *(uint8_t*)0x2000061c = 0x25; *(uint8_t*)0x2000061d = 1; *(uint8_t*)0x2000061e = 3; *(uint8_t*)0x2000061f = 1; *(uint16_t*)0x20000620 = 0x8000; *(uint8_t*)0x20000622 = 9; *(uint8_t*)0x20000623 = 5; *(uint8_t*)0x20000624 = 9; *(uint8_t*)0x20000625 = 0; *(uint16_t*)0x20000626 = 0x200; *(uint8_t*)0x20000628 = 0x16; *(uint8_t*)0x20000629 = 6; *(uint8_t*)0x2000062a = 0x3b; *(uint8_t*)0x2000062b = 7; *(uint8_t*)0x2000062c = 0x25; *(uint8_t*)0x2000062d = 1; *(uint8_t*)0x2000062e = 0x80; *(uint8_t*)0x2000062f = 7; *(uint16_t*)0x20000630 = 0x8001; *(uint8_t*)0x20000632 = 7; *(uint8_t*)0x20000633 = 0x25; *(uint8_t*)0x20000634 = 1; *(uint8_t*)0x20000635 = 3; *(uint8_t*)0x20000636 = 9; *(uint16_t*)0x20000637 = 8; *(uint8_t*)0x20000639 = 9; *(uint8_t*)0x2000063a = 5; *(uint8_t*)0x2000063b = 0xe; *(uint8_t*)0x2000063c = 0; *(uint16_t*)0x2000063d = 8; *(uint8_t*)0x2000063f = 4; *(uint8_t*)0x20000640 = 1; *(uint8_t*)0x20000641 = 0x3f; *(uint8_t*)0x20000642 = 9; *(uint8_t*)0x20000643 = 5; *(uint8_t*)0x20000644 = 3; *(uint8_t*)0x20000645 = 0xc; *(uint16_t*)0x20000646 = 0x40; *(uint8_t*)0x20000648 = 0x81; *(uint8_t*)0x20000649 = 0; *(uint8_t*)0x2000064a = 4; *(uint8_t*)0x2000064b = 9; *(uint8_t*)0x2000064c = 5; *(uint8_t*)0x2000064d = 8; *(uint8_t*)0x2000064e = 2; *(uint16_t*)0x2000064f = 0x400; *(uint8_t*)0x20000651 = 4; *(uint8_t*)0x20000652 = 1; *(uint8_t*)0x20000653 = 0xf7; *(uint8_t*)0x20000654 = 2; *(uint8_t*)0x20000655 = 0xe; *(uint8_t*)0x20000656 = 9; *(uint8_t*)0x20000657 = 5; *(uint8_t*)0x20000658 = 0xe; *(uint8_t*)0x20000659 = 0x10; *(uint16_t*)0x2000065a = 0x200; *(uint8_t*)0x2000065c = 0x7d; *(uint8_t*)0x2000065d = 2; *(uint8_t*)0x2000065e = 1; *(uint8_t*)0x2000065f = 9; *(uint8_t*)0x20000660 = 5; *(uint8_t*)0x20000661 = 0x80; *(uint8_t*)0x20000662 = 0xa; *(uint16_t*)0x20000663 = 0x400; *(uint8_t*)0x20000665 = 2; *(uint8_t*)0x20000666 = 0x7f; *(uint8_t*)0x20000667 = 1; *(uint8_t*)0x20000668 = 9; *(uint8_t*)0x20000669 = 4; *(uint8_t*)0x2000066a = 6; *(uint8_t*)0x2000066b = 0xcd; *(uint8_t*)0x2000066c = 8; *(uint8_t*)0x2000066d = 0; *(uint8_t*)0x2000066e = 0; *(uint8_t*)0x2000066f = 0; *(uint8_t*)0x20000670 = 0xe0; *(uint8_t*)0x20000671 = 9; *(uint8_t*)0x20000672 = 5; *(uint8_t*)0x20000673 = 0x80; *(uint8_t*)0x20000674 = 3; *(uint16_t*)0x20000675 = 0x400; *(uint8_t*)0x20000677 = 0x10; *(uint8_t*)0x20000678 = 7; *(uint8_t*)0x20000679 = 2; *(uint8_t*)0x2000067a = 7; *(uint8_t*)0x2000067b = 0x25; *(uint8_t*)0x2000067c = 1; *(uint8_t*)0x2000067d = 0; *(uint8_t*)0x2000067e = 0xe1; *(uint16_t*)0x2000067f = 2; *(uint8_t*)0x20000681 = 9; *(uint8_t*)0x20000682 = 5; *(uint8_t*)0x20000683 = 0x80; *(uint8_t*)0x20000684 = 2; *(uint16_t*)0x20000685 = 0x200; *(uint8_t*)0x20000687 = 0xf5; *(uint8_t*)0x20000688 = 8; *(uint8_t*)0x20000689 = 0x1f; *(uint8_t*)0x2000068a = 2; *(uint8_t*)0x2000068b = 9; *(uint8_t*)0x2000068c = 7; *(uint8_t*)0x2000068d = 0x25; *(uint8_t*)0x2000068e = 1; *(uint8_t*)0x2000068f = 2; *(uint8_t*)0x20000690 = 0xc0; *(uint16_t*)0x20000691 = 7; *(uint8_t*)0x20000693 = 9; *(uint8_t*)0x20000694 = 5; *(uint8_t*)0x20000695 = 9; *(uint8_t*)0x20000696 = 0; *(uint16_t*)0x20000697 = 0x10; *(uint8_t*)0x20000699 = 0x3f; *(uint8_t*)0x2000069a = 4; *(uint8_t*)0x2000069b = 9; *(uint8_t*)0x2000069c = 2; *(uint8_t*)0x2000069d = 0xc; *(uint8_t*)0x2000069e = 9; *(uint8_t*)0x2000069f = 5; *(uint8_t*)0x200006a0 = 6; *(uint8_t*)0x200006a1 = 0; *(uint16_t*)0x200006a2 = 0x10; *(uint8_t*)0x200006a4 = 0x32; *(uint8_t*)0x200006a5 = 1; *(uint8_t*)0x200006a6 = 0x80; *(uint8_t*)0x200006a7 = 2; *(uint8_t*)0x200006a8 = 0x24; *(uint8_t*)0x200006a9 = 9; *(uint8_t*)0x200006aa = 5; *(uint8_t*)0x200006ab = 0x80; *(uint8_t*)0x200006ac = 0x10; *(uint16_t*)0x200006ad = 0x400; *(uint8_t*)0x200006af = 8; *(uint8_t*)0x200006b0 = 0x81; *(uint8_t*)0x200006b1 = 0x80; *(uint8_t*)0x200006b2 = 9; *(uint8_t*)0x200006b3 = 5; *(uint8_t*)0x200006b4 = 5; *(uint8_t*)0x200006b5 = 1; *(uint16_t*)0x200006b6 = 8; *(uint8_t*)0x200006b8 = 1; *(uint8_t*)0x200006b9 = 0; *(uint8_t*)0x200006ba = 3; *(uint8_t*)0x200006bb = 7; *(uint8_t*)0x200006bc = 0x25; *(uint8_t*)0x200006bd = 1; *(uint8_t*)0x200006be = 0x80; *(uint8_t*)0x200006bf = 0x20; *(uint16_t*)0x200006c0 = 0xe96; *(uint8_t*)0x200006c2 = 2; *(uint8_t*)0x200006c3 = 0xf; *(uint8_t*)0x200006c4 = 9; *(uint8_t*)0x200006c5 = 5; *(uint8_t*)0x200006c6 = 0; *(uint8_t*)0x200006c7 = 0; *(uint16_t*)0x200006c8 = 0; *(uint8_t*)0x200006ca = 0x20; *(uint8_t*)0x200006cb = 0x65; *(uint8_t*)0x200006cc = 2; *(uint8_t*)0x200006cd = 9; *(uint8_t*)0x200006ce = 5; *(uint8_t*)0x200006cf = 0xa; *(uint8_t*)0x200006d0 = 0; *(uint16_t*)0x200006d1 = 0x400; *(uint8_t*)0x200006d3 = 1; *(uint8_t*)0x200006d4 = 0x3f; *(uint8_t*)0x200006d5 = 0; *(uint8_t*)0x200006d6 = 9; *(uint8_t*)0x200006d7 = 4; *(uint8_t*)0x200006d8 = 8; *(uint8_t*)0x200006d9 = 3; *(uint8_t*)0x200006da = 9; *(uint8_t*)0x200006db = 0; *(uint8_t*)0x200006dc = 0; *(uint8_t*)0x200006dd = 0; *(uint8_t*)0x200006de = -1; *(uint8_t*)0x200006df = 5; *(uint8_t*)0x200006e0 = 0x24; *(uint8_t*)0x200006e1 = 6; *(uint8_t*)0x200006e2 = 0; *(uint8_t*)0x200006e3 = 1; *(uint8_t*)0x200006e4 = 5; *(uint8_t*)0x200006e5 = 0x24; *(uint8_t*)0x200006e6 = 0; *(uint16_t*)0x200006e7 = 0x14; *(uint8_t*)0x200006e9 = 0xd; *(uint8_t*)0x200006ea = 0x24; *(uint8_t*)0x200006eb = 0xf; *(uint8_t*)0x200006ec = 1; *(uint32_t*)0x200006ed = 9; *(uint16_t*)0x200006f1 = 0x45; *(uint16_t*)0x200006f3 = 5; *(uint8_t*)0x200006f5 = 0x80; *(uint8_t*)0x200006f6 = 6; *(uint8_t*)0x200006f7 = 0x24; *(uint8_t*)0x200006f8 = 0x1a; *(uint16_t*)0x200006f9 = 0x200; *(uint8_t*)0x200006fb = 1; *(uint8_t*)0x200006fc = 4; *(uint8_t*)0x200006fd = 0x24; *(uint8_t*)0x200006fe = 0x13; *(uint8_t*)0x200006ff = 0xf5; *(uint8_t*)0x20000700 = 5; *(uint8_t*)0x20000701 = 0x24; *(uint8_t*)0x20000702 = 1; *(uint8_t*)0x20000703 = 1; *(uint8_t*)0x20000704 = 1; *(uint8_t*)0x20000705 = 9; *(uint8_t*)0x20000706 = 0x24; *(uint8_t*)0x20000707 = 2; *(uint8_t*)0x20000708 = 2; *(uint16_t*)0x20000709 = 1; *(uint16_t*)0x2000070b = 0; *(uint8_t*)0x2000070d = 0x52; *(uint8_t*)0x2000070e = 7; *(uint8_t*)0x2000070f = 0x24; *(uint8_t*)0x20000710 = 1; *(uint8_t*)0x20000711 = 0x81; *(uint8_t*)0x20000712 = 0xa9; *(uint16_t*)0x20000713 = 3; *(uint8_t*)0x20000715 = 7; *(uint8_t*)0x20000716 = 0x24; *(uint8_t*)0x20000717 = 1; *(uint8_t*)0x20000718 = -1; *(uint8_t*)0x20000719 = 0x1f; *(uint16_t*)0x2000071a = 2; *(uint8_t*)0x2000071c = 8; *(uint8_t*)0x2000071d = 0x24; *(uint8_t*)0x2000071e = 2; *(uint8_t*)0x2000071f = 1; *(uint8_t*)0x20000720 = 0xa1; *(uint8_t*)0x20000721 = 1; *(uint8_t*)0x20000722 = 8; *(uint8_t*)0x20000723 = 7; *(uint8_t*)0x20000724 = 8; *(uint8_t*)0x20000725 = 0x24; *(uint8_t*)0x20000726 = 2; *(uint8_t*)0x20000727 = 1; *(uint8_t*)0x20000728 = 0x80; *(uint8_t*)0x20000729 = 4; *(uint8_t*)0x2000072a = 0x7d; *(uint8_t*)0x2000072b = -1; *(uint8_t*)0x2000072c = 9; *(uint8_t*)0x2000072d = 5; *(uint8_t*)0x2000072e = 0xa; *(uint8_t*)0x2000072f = 0; *(uint16_t*)0x20000730 = 0x10; *(uint8_t*)0x20000732 = 0x20; *(uint8_t*)0x20000733 = 8; *(uint8_t*)0x20000734 = 0x45; *(uint8_t*)0x20000735 = 7; *(uint8_t*)0x20000736 = 0x25; *(uint8_t*)0x20000737 = 1; *(uint8_t*)0x20000738 = 2; *(uint8_t*)0x20000739 = 0; *(uint16_t*)0x2000073a = 2; *(uint8_t*)0x2000073c = 7; *(uint8_t*)0x2000073d = 0x25; *(uint8_t*)0x2000073e = 1; *(uint8_t*)0x2000073f = 0; *(uint8_t*)0x20000740 = 0x1a; *(uint16_t*)0x20000741 = 5; *(uint8_t*)0x20000743 = 9; *(uint8_t*)0x20000744 = 5; *(uint8_t*)0x20000745 = 0xb; *(uint8_t*)0x20000746 = 0x10; *(uint16_t*)0x20000747 = 0x420; *(uint8_t*)0x20000749 = 6; *(uint8_t*)0x2000074a = 0; *(uint8_t*)0x2000074b = 7; *(uint8_t*)0x2000074c = 9; *(uint8_t*)0x2000074d = 5; *(uint8_t*)0x2000074e = 0xb; *(uint8_t*)0x2000074f = 0; *(uint16_t*)0x20000750 = 0x3ff; *(uint8_t*)0x20000752 = 0xc0; *(uint8_t*)0x20000753 = 7; *(uint8_t*)0x20000754 = 9; *(uint8_t*)0x20000755 = 9; *(uint8_t*)0x20000756 = 5; *(uint8_t*)0x20000757 = 0x30; *(uint8_t*)0x20000758 = 0x10; *(uint16_t*)0x20000759 = 0x20; *(uint8_t*)0x2000075b = 0x28; *(uint8_t*)0x2000075c = 4; *(uint8_t*)0x2000075d = 0x10; *(uint8_t*)0x2000075e = 2; *(uint8_t*)0x2000075f = 4; *(uint8_t*)0x20000760 = 2; *(uint8_t*)0x20000761 = 0x11; *(uint8_t*)0x20000762 = 9; *(uint8_t*)0x20000763 = 5; *(uint8_t*)0x20000764 = 8; *(uint8_t*)0x20000765 = 2; *(uint16_t*)0x20000766 = 0; *(uint8_t*)0x20000768 = 0x40; *(uint8_t*)0x20000769 = 9; *(uint8_t*)0x2000076a = 0; *(uint8_t*)0x2000076b = 9; *(uint8_t*)0x2000076c = 5; *(uint8_t*)0x2000076d = 1; *(uint8_t*)0x2000076e = 8; *(uint16_t*)0x2000076f = 0x20; *(uint8_t*)0x20000771 = 9; *(uint8_t*)0x20000772 = 6; *(uint8_t*)0x20000773 = 0x3d; *(uint8_t*)0x20000774 = 0xe0; *(uint8_t*)0x20000775 = 0xb; memcpy((void*)0x20000776, "\x22\x95\x01\x38\xd7\xfb\x0f\xaf\xcb\x89\x84\x5f\xc2\xef\x23\xea" "\xd6\xe1\x03\xef\xbf\x1a\x9b\x8d\x67\xf7\xcc\xd0\x8d\xc5\x26\x1d" "\x17\x34\x66\x7a\x3a\x7b\x36\xa5\x30\x19\xba\xcf\x1f\x4b\xf7\x27" "\x40\x14\x27\xd7\x69\x03\x21\x79\x1c\x82\x64\xb4\xaf\xd8\xd2\x39" "\x2f\xe6\xe3\xd0\x2e\xc8\x60\x8f\x4f\xeb\x6b\x26\x34\xd2\x8f\x64" "\x26\xd9\x3c\x9f\xaf\x43\xdb\x23\xf1\x7f\xf0\xfd\x10\xed\x88\xf8" "\xaa\x35\xce\x6b\x85\xb4\xf1\x60\x20\xdb\x42\xa2\xe5\x3b\x2d\xc1" "\xe5\x07\xfa\x9b\x64\x66\xc3\xcd\x9e\x5e\xbb\x1f\xfb\x7a\x94\x5e" "\x74\x29\x76\xa3\x91\xc6\xdd\xdf\x72\x97\x3a\xb8\xe4\xd5\x8e\x92" "\x8b\x18\x44\xc0\x67\x37\xeb\x61\x3c\x20\x9e\x5d\x84\x66\x9b\x66" "\xa1\x6d\x19\x9d\xeb\xf3\xd1\xea\x1e\xa2\x6b\xda\xeb\xa0\x07\x14" "\xa3\xd0\x55\xe3\xa3\xde\x8e\x4e\x1b\x14\xad\x18\x01\xb4\x96\x5f" "\x77\x5b\xc6\x69\x5d\x8c\xaf\x3e\x6e\x70\x25\xb1\x94\x7a\x8f\xd1" "\x51\x4f\x8f\x1c\x22\xd7\xbc\x04\x50\x24\x8e\x36\x70\x5a", 222); *(uint8_t*)0x20000854 = 9; *(uint8_t*)0x20000855 = 5; *(uint8_t*)0x20000856 = 8; *(uint8_t*)0x20000857 = 0; *(uint16_t*)0x20000858 = 0x20; *(uint8_t*)0x2000085a = 2; *(uint8_t*)0x2000085b = 8; *(uint8_t*)0x2000085c = 0x80; *(uint8_t*)0x2000085d = 2; *(uint8_t*)0x2000085e = 1; *(uint8_t*)0x2000085f = 9; *(uint8_t*)0x20000860 = 5; *(uint8_t*)0x20000861 = 0x8a; *(uint8_t*)0x20000862 = 8; *(uint16_t*)0x20000863 = 0x10; *(uint8_t*)0x20000865 = 3; *(uint8_t*)0x20000866 = 4; *(uint8_t*)0x20000867 = 3; *(uint8_t*)0x20000868 = 7; *(uint8_t*)0x20000869 = 0x25; *(uint8_t*)0x2000086a = 1; *(uint8_t*)0x2000086b = 0x81; *(uint8_t*)0x2000086c = 3; *(uint16_t*)0x2000086d = 0x20; *(uint8_t*)0x2000086f = 7; *(uint8_t*)0x20000870 = 0x25; *(uint8_t*)0x20000871 = 1; *(uint8_t*)0x20000872 = 2; *(uint8_t*)0x20000873 = 0; *(uint16_t*)0x20000874 = 0x1a; *(uint8_t*)0x20000876 = 9; *(uint8_t*)0x20000877 = 5; *(uint8_t*)0x20000878 = 3; *(uint8_t*)0x20000879 = 0; *(uint16_t*)0x2000087a = 0x20; *(uint8_t*)0x2000087c = 1; *(uint8_t*)0x2000087d = 0x40; *(uint8_t*)0x2000087e = 3; *(uint8_t*)0x2000087f = 2; *(uint8_t*)0x20000880 = 1; *(uint8_t*)0x20000881 = 2; *(uint8_t*)0x20000882 = 0xc; syz_usb_connect(3, 0x2c3, 0x200005c0, 0); break; } } int main(void) { syscall(SYS_mmap, 0x20000000ul, 0x1000000ul, 3ul, 0x1012ul, -1, 0ul, 0ul); for (procid = 0; procid < 6; procid++) { if (fork() == 0) { loop(); } } sleep(1000000); return 0; }