// https://syzkaller.appspot.com/bug?id=bb8b52472a49063c95dea4a29b7243aab8d025ca // 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 #include #include 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 use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void __attribute__((noinline)) remove_dir(const char* dir) { DIR* dp = opendir(dir); if (dp == NULL) { if (errno == EACCES) { if (rmdir(dir)) exit(1); return; } exit(1); } struct dirent* ep = 0; while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } if (unlink(filename)) exit(1); } closedir(dp); if (rmdir(dir)) exit(1); } 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 < 7; 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 == 2 || call == 3 || call == 4 || call == 6) break; event_timedwait(&th->done, 50 + (call == 1 ? 3000 : 0) + (call == 2 ? 3000 : 0) + (call == 3 ? 3000 : 0) + (call == 4 ? 3000 : 0) + (call == 5 ? 3000 : 0) + (call == 6 ? 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++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); 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; } remove_dir(cwdbuf); } } #ifndef SYS_getsockopt #define SYS_getsockopt 118 #endif #ifndef SYS_mmap #define SYS_mmap 197 #endif void execute_call(int call) { switch (call) { case 0: syscall(SYS_getsockopt, -1, 3, 2, 0ul, 0ul); break; case 1: syz_usb_connect(0, 0, 0, 0); break; case 2: syz_usb_connect(0, 0, 0, 0); break; case 3: *(uint8_t*)0x200011c0 = 0x12; *(uint8_t*)0x200011c1 = 1; *(uint16_t*)0x200011c2 = 0x200; *(uint8_t*)0x200011c4 = 0; *(uint8_t*)0x200011c5 = 0; *(uint8_t*)0x200011c6 = 0; *(uint8_t*)0x200011c7 = 0x10; *(uint16_t*)0x200011c8 = 0; *(uint16_t*)0x200011ca = 0; *(uint16_t*)0x200011cc = 0; *(uint8_t*)0x200011ce = 1; *(uint8_t*)0x200011cf = 2; *(uint8_t*)0x200011d0 = 3; *(uint8_t*)0x200011d1 = 1; *(uint8_t*)0x200011d2 = 9; *(uint8_t*)0x200011d3 = 2; *(uint16_t*)0x200011d4 = 0x422; *(uint8_t*)0x200011d6 = 2; *(uint8_t*)0x200011d7 = 0x4d; *(uint8_t*)0x200011d8 = 4; *(uint8_t*)0x200011d9 = 0; *(uint8_t*)0x200011da = 8; *(uint8_t*)0x200011db = 9; *(uint8_t*)0x200011dc = 4; *(uint8_t*)0x200011dd = 0; *(uint8_t*)0x200011de = 2; *(uint8_t*)0x200011df = 9; *(uint8_t*)0x200011e0 = 0; *(uint8_t*)0x200011e1 = 0; *(uint8_t*)0x200011e2 = 0; *(uint8_t*)0x200011e3 = 4; *(uint8_t*)0x200011e4 = 9; *(uint8_t*)0x200011e5 = 5; *(uint8_t*)0x200011e6 = 5; *(uint8_t*)0x200011e7 = 0x20; *(uint16_t*)0x200011e8 = 0x20; *(uint8_t*)0x200011ea = 0; *(uint8_t*)0x200011eb = 7; *(uint8_t*)0x200011ec = 6; *(uint8_t*)0x200011ed = 9; *(uint8_t*)0x200011ee = 5; *(uint8_t*)0x200011ef = 0xe; *(uint8_t*)0x200011f0 = 0; *(uint16_t*)0x200011f1 = 0x40; *(uint8_t*)0x200011f3 = 1; *(uint8_t*)0x200011f4 = 0x3f; *(uint8_t*)0x200011f5 = 1; *(uint8_t*)0x200011f6 = 2; *(uint8_t*)0x200011f7 = 0xf; *(uint8_t*)0x200011f8 = 9; *(uint8_t*)0x200011f9 = 5; *(uint8_t*)0x200011fa = 6; *(uint8_t*)0x200011fb = 3; *(uint16_t*)0x200011fc = 8; *(uint8_t*)0x200011fe = 6; *(uint8_t*)0x200011ff = 0; *(uint8_t*)0x20001200 = 0x80; *(uint8_t*)0x20001201 = 7; *(uint8_t*)0x20001202 = 0x25; *(uint8_t*)0x20001203 = 1; *(uint8_t*)0x20001204 = 1; *(uint8_t*)0x20001205 = 0x1f; *(uint16_t*)0x20001206 = 0x1000; *(uint8_t*)0x20001208 = 0x72; *(uint8_t*)0x20001209 = 0x23; memcpy((void*)0x2000120a, "\x31\x7a\xae\xa1\x8d\xdb\xa9\x99\xab\x40\xc3\x8e\x79\xf1\x8f\x04" "\x09\x83\x42\x4b\x1b\x42\x32\x9e\xeb\x64\xd0\xda\x50\x2c\x88\x81" "\xd5\xc4\xd0\xee\x26\x24\x03\x69\x29\xda\xbb\x07\xc5\x12\x47\x05" "\x63\xc1\xe8\xbc\xdf\x10\xa2\x2c\xdc\xb1\x86\x85\x8c\x5a\x2d\xe2" "\x6a\x64\xb5\x20\x63\x8e\x9a\xbf\xa7\x75\x03\xee\x61\x9c\x0f\x9b" "\x5c\x70\xe4\x88\x63\xdd\x3b\xd2\x97\x3f\x8e\x00\x19\x93\x66\x0e" "\x16\x44\xe9\x88\x29\x5f\xf4\x8d\x8b\x77\x39\xad\x4f\x61\x08\xc6", 112); *(uint8_t*)0x2000127a = 9; *(uint8_t*)0x2000127b = 5; *(uint8_t*)0x2000127c = 0xd; *(uint8_t*)0x2000127d = 0x10; *(uint16_t*)0x2000127e = 0x40; *(uint8_t*)0x20001280 = 7; *(uint8_t*)0x20001281 = 6; *(uint8_t*)0x20001282 = 8; *(uint8_t*)0x20001283 = 7; *(uint8_t*)0x20001284 = 0x25; *(uint8_t*)0x20001285 = 1; *(uint8_t*)0x20001286 = 0; *(uint8_t*)0x20001287 = 8; *(uint16_t*)0x20001288 = 0x306; *(uint8_t*)0x2000128a = 9; *(uint8_t*)0x2000128b = 5; *(uint8_t*)0x2000128c = 9; *(uint8_t*)0x2000128d = 0xc; *(uint16_t*)0x2000128e = 0x10; *(uint8_t*)0x20001290 = 0x20; *(uint8_t*)0x20001291 = 0x7f; *(uint8_t*)0x20001292 = 0x7f; *(uint8_t*)0x20001293 = 9; *(uint8_t*)0x20001294 = 5; *(uint8_t*)0x20001295 = 0xc; *(uint8_t*)0x20001296 = 0x10; *(uint16_t*)0x20001297 = 0x3ff; *(uint8_t*)0x20001299 = 1; *(uint8_t*)0x2000129a = 3; *(uint8_t*)0x2000129b = 0; *(uint8_t*)0x2000129c = 2; *(uint8_t*)0x2000129d = 0x22; *(uint8_t*)0x2000129e = 0xb9; *(uint8_t*)0x2000129f = 0xa; memcpy( (void*)0x200012a0, "\x65\x01\x9c\x64\x83\x60\x95\xc4\x9c\xc5\x56\xb0\x3f\xd0\x29\x48\x01" "\x96\x90\x0f\x20\x00\x2a\x46\xdf\xed\x58\xe0\x58\x04\x7a\x09\xf2\x0f" "\xe1\x12\xaf\xe2\x0c\x8f\xf6\x1e\x63\xf5\x45\x5e\x81\xb3\x4a\x87\xef" "\xc1\x02\x0b\x5d\xab\xa1\xab\xa3\xd9\x34\x5a\x6f\xf5\x00\xc6\xc2\x95" "\x24\xf7\x20\xa5\xa8\xa9\xe1\xaf\x2c\xb4\x27\x1d\xa4\x6b\x05\x2d\xdb" "\xf3\xb1\x90\x13\x11\x92\x9f\x75\x2f\x90\xaa\x2f\xe2\x82\x27\x81\x95" "\x2e\xe4\xa0\xbb\x46\xca\x60\xa3\xaf\x60\xd8\xed\x54\x48\x99\x09\x8f" "\x31\x5c\xf3\x33\xa8\x38\x39\x7b\x1b\xe4\x31\xfb\xaf\xbb\x75\xaf\xc8" "\xcb\x10\x78\xfd\x5c\x0e\x07\x3e\xc5\xfa\x31\xa3\xd8\x9f\x43\x2e\x2a" "\xd0\x60\x88\x7f\xc3\xe9\x9e\xf1\xeb\x79\x78\xf6\xb9\x53\x0e\xc9\xb5" "\x5d\xcf\x89\x45\xfb\x08\x4b\x66\x0d\xf2\x31\x39\x2c", 183); *(uint8_t*)0x20001357 = 9; *(uint8_t*)0x20001358 = 5; *(uint8_t*)0x20001359 = 1; *(uint8_t*)0x2000135a = 0x10; *(uint16_t*)0x2000135b = 8; *(uint8_t*)0x2000135d = 1; *(uint8_t*)0x2000135e = 0x2e; *(uint8_t*)0x2000135f = 5; *(uint8_t*)0x20001360 = 0x67; *(uint8_t*)0x20001361 = 3; memcpy( (void*)0x20001362, "\xfc\xb9\x91\x7d\x55\x4c\x0b\x6d\xee\x99\xdb\x74\x07\x45\x29\x55\x95" "\xed\x82\x27\xe7\x31\xd4\xbb\xf4\x92\xd7\x0a\xc1\x7b\x6a\x78\x22\x61" "\x6d\xc3\x3b\x99\xb7\xd2\x12\x37\xe2\xaf\xd6\x37\xd8\x2b\xf1\xe8\xb6" "\x48\x1b\xd6\x21\xef\x0b\xc2\x9a\x21\x2d\x5f\x3d\xc6\x57\x81\x54\x1c" "\x5b\xf3\xcd\xdc\x49\xf4\xe3\x4f\x6c\x6d\x1a\x44\x98\xf7\x12\x8d\x5d" "\x84\x9a\x6b\x9f\xb8\x0f\x35\x08\xec\xfb\xa5\xda\x8b\xf8\x45\x44", 101); *(uint8_t*)0x200013c7 = 9; *(uint8_t*)0x200013c8 = 5; *(uint8_t*)0x200013c9 = 0xd; *(uint8_t*)0x200013ca = 0; *(uint16_t*)0x200013cb = 0x40; *(uint8_t*)0x200013cd = 0x1f; *(uint8_t*)0x200013ce = 9; *(uint8_t*)0x200013cf = 2; *(uint8_t*)0x200013d0 = 9; *(uint8_t*)0x200013d1 = 5; *(uint8_t*)0x200013d2 = 0xb; *(uint8_t*)0x200013d3 = 0x10; *(uint16_t*)0x200013d4 = 0x20; *(uint8_t*)0x200013d6 = 0xf0; *(uint8_t*)0x200013d7 = 0xec; *(uint8_t*)0x200013d8 = 0x40; *(uint8_t*)0x200013d9 = 9; *(uint8_t*)0x200013da = 4; *(uint8_t*)0x200013db = 5; *(uint8_t*)0x200013dc = 4; *(uint8_t*)0x200013dd = 6; *(uint8_t*)0x200013de = 0; *(uint8_t*)0x200013df = 0; *(uint8_t*)0x200013e0 = 0; *(uint8_t*)0x200013e1 = 0x3f; *(uint8_t*)0x200013e2 = 7; *(uint8_t*)0x200013e3 = 0x24; *(uint8_t*)0x200013e4 = 6; *(uint8_t*)0x200013e5 = 0; *(uint8_t*)0x200013e6 = 1; memcpy((void*)0x200013e7, "\xd8\x27", 2); *(uint8_t*)0x200013e9 = 5; *(uint8_t*)0x200013ea = 0x24; *(uint8_t*)0x200013eb = 0; *(uint16_t*)0x200013ec = 0xb94d; *(uint8_t*)0x200013ee = 0xd; *(uint8_t*)0x200013ef = 0x24; *(uint8_t*)0x200013f0 = 0xf; *(uint8_t*)0x200013f1 = 1; *(uint32_t*)0x200013f2 = 0x10001; *(uint16_t*)0x200013f6 = 0x1f; *(uint16_t*)0x200013f8 = 0x80; *(uint8_t*)0x200013fa = 0x81; *(uint8_t*)0x200013fb = 6; *(uint8_t*)0x200013fc = 0x24; *(uint8_t*)0x200013fd = 0x1a; *(uint16_t*)0x200013fe = 2; *(uint8_t*)0x20001400 = 0xa; *(uint8_t*)0x20001401 = 4; *(uint8_t*)0x20001402 = 0x24; *(uint8_t*)0x20001403 = 2; *(uint8_t*)0x20001404 = 0; *(uint8_t*)0x20001405 = 8; *(uint8_t*)0x20001406 = 0x24; *(uint8_t*)0x20001407 = 7; *(uint8_t*)0x20001408 = 2; *(uint16_t*)0x20001409 = 0x7f36; *(uint16_t*)0x2000140b = 2; *(uint8_t*)0x2000140d = 9; *(uint8_t*)0x2000140e = 5; *(uint8_t*)0x2000140f = 3; *(uint8_t*)0x20001410 = 0x10; *(uint16_t*)0x20001411 = 0x200; *(uint8_t*)0x20001413 = 0x1f; *(uint8_t*)0x20001414 = 6; *(uint8_t*)0x20001415 = 0; *(uint8_t*)0x20001416 = 0xa; *(uint8_t*)0x20001417 = 1; memcpy((void*)0x20001418, "\xab\x11\x23\x56\xa2\x67\xa3\xbe", 8); *(uint8_t*)0x20001420 = 0xa9; *(uint8_t*)0x20001421 = 1; memcpy( (void*)0x20001422, "\x19\x3a\xd5\xa9\x47\xb5\x09\xf4\x68\x0d\x05\xf2\x3b\x5f\x15\x5b\x75" "\xa5\xa3\x71\x41\x07\x47\x32\x0d\x7f\x6c\x47\x0e\xea\x07\x70\x92\x8f" "\x98\xfa\xea\xf9\xb0\x94\x11\x40\x20\x98\x7e\x60\x50\xbf\xf3\x9a\xc1" "\xbf\xee\xcb\xf9\xee\xba\x83\x0b\x21\x5b\x52\xdc\xb3\x31\xbc\x83\xc0" "\xfc\x90\x69\x19\x0a\x8f\x7f\xf9\x96\x97\x73\xcb\x04\xa7\x2c\xe6\x6f" "\x73\xd0\x98\xc6\xac\xb0\xd7\x30\xc0\x4c\xc1\x17\xdc\x98\xec\xa9\x8a" "\xbd\x15\x29\x33\x9e\xb1\x72\xfa\x26\x58\xbc\x3a\x5b\x71\xe0\x64\x09" "\x15\x4a\xa5\x82\x09\x6f\xcb\xb8\x9c\xb3\x60\xc2\xa5\xfb\x9c\x5e\xe2" "\xf2\x27\x9e\xc4\x85\x95\x55\xac\x8a\x1a\x77\x88\xe9\xc0\x4a\xee\xc1" "\xaa\xb9\x28\x63\xce\x6f\x0d\x3c\x7b\x36\xcd\x4a\xb4\xdf", 167); *(uint8_t*)0x200014c9 = 9; *(uint8_t*)0x200014ca = 5; *(uint8_t*)0x200014cb = 3; *(uint8_t*)0x200014cc = 3; *(uint16_t*)0x200014cd = 0x40; *(uint8_t*)0x200014cf = 0xfd; *(uint8_t*)0x200014d0 = 0x3f; *(uint8_t*)0x200014d1 = 0x20; *(uint8_t*)0x200014d2 = 7; *(uint8_t*)0x200014d3 = 0x25; *(uint8_t*)0x200014d4 = 1; *(uint8_t*)0x200014d5 = 3; *(uint8_t*)0x200014d6 = 5; *(uint16_t*)0x200014d7 = 9; *(uint8_t*)0x200014d9 = 0x49; *(uint8_t*)0x200014da = 0xc; memcpy((void*)0x200014db, "\x3f\x61\x1e\xf9\x42\x25\x19\xef\x25\xf3\x32\x8b\x0b\x2e\xc7\xaf" "\xd4\x09\x66\x9a\xb7\x9a\x01\xfd\x5f\x69\xbf\x45\xa5\x4e\xac\xc9" "\xa2\xc8\x1b\x3d\xe4\xfe\xd1\x65\x31\x6e\xdf\x17\x1a\x5b\x7c\xe1" "\x0c\xd4\x09\x37\x8e\x3b\xc4\x0b\x56\x00\xd5\xfc\x9e\xcd\xb0\x67" "\x5b\x85\xca\x3a\x91\xf3\x68", 71); *(uint8_t*)0x20001522 = 9; *(uint8_t*)0x20001523 = 5; *(uint8_t*)0x20001524 = 5; *(uint8_t*)0x20001525 = 0; *(uint16_t*)0x20001526 = 0x400; *(uint8_t*)0x20001528 = 3; *(uint8_t*)0x20001529 = 6; *(uint8_t*)0x2000152a = 3; *(uint8_t*)0x2000152b = 9; *(uint8_t*)0x2000152c = 5; *(uint8_t*)0x2000152d = 0xa; *(uint8_t*)0x2000152e = 4; *(uint16_t*)0x2000152f = 0x30; *(uint8_t*)0x20001531 = 0x1f; *(uint8_t*)0x20001532 = 0xbe; *(uint8_t*)0x20001533 = 0x40; *(uint8_t*)0x20001534 = 9; *(uint8_t*)0x20001535 = 5; *(uint8_t*)0x20001536 = 0; *(uint8_t*)0x20001537 = 0x10; *(uint16_t*)0x20001538 = 8; *(uint8_t*)0x2000153a = 3; *(uint8_t*)0x2000153b = 2; *(uint8_t*)0x2000153c = 0; *(uint8_t*)0x2000153d = 7; *(uint8_t*)0x2000153e = 0x25; *(uint8_t*)0x2000153f = 1; *(uint8_t*)0x20001540 = 2; *(uint8_t*)0x20001541 = 0x7f; *(uint16_t*)0x20001542 = 0xc26; *(uint8_t*)0x20001544 = 9; *(uint8_t*)0x20001545 = 5; *(uint8_t*)0x20001546 = 5; *(uint8_t*)0x20001547 = 0xa; *(uint16_t*)0x20001548 = 8; *(uint8_t*)0x2000154a = 2; *(uint8_t*)0x2000154b = 3; *(uint8_t*)0x2000154c = 2; *(uint8_t*)0x2000154d = 0xa7; *(uint8_t*)0x2000154e = 0x22; memcpy( (void*)0x2000154f, "\x23\x3e\x83\x68\xe6\xf2\x22\xc9\x86\x62\x78\xba\x7a\xd9\x03\xb1\xc9" "\xbf\x36\xca\x0b\xd3\xbb\x6c\x94\xee\x5c\x2f\x27\xd6\x2b\x9a\x2f\xa3" "\x6a\x88\xda\x20\x13\x18\xc0\xa0\x95\x17\x6b\x68\xcc\x66\x7d\xc7\x53" "\x4c\x41\x91\x0f\x60\xa8\xa6\xd1\xe7\x9b\x6f\x91\x5e\x58\xb5\x27\x09" "\xf4\xcc\x64\xa9\xe8\xeb\x2e\x43\x99\x03\x77\xa2\xa6\xe4\x01\x9e\x11" "\x64\x53\x28\x18\xfc\x7e\x5d\x70\xd7\x3a\x21\x12\x09\x3a\xed\xba\xfd" "\x22\x46\xec\xb6\x3f\xad\xe1\x0c\xb1\x52\x20\xc0\x62\xab\xaf\x1b\x0c" "\x2b\xf4\x9c\x04\xd7\x28\x29\xdf\xca\xfe\x16\xe2\x99\xbb\x76\x2f\x12" "\x19\xf4\xd5\x9b\x79\x39\xf1\x0f\x69\xdb\x99\x76\xc6\xa1\x5b\xba\x1e" "\x0c\x54\x6b\xec\xd9\x14\xd3\xf2\x41\x79\x86\x89", 165); syz_usb_connect(4, 0x434, 0x200011c0, 0); break; case 4: *(uint8_t*)0x200027c0 = 0x12; *(uint8_t*)0x200027c1 = 1; *(uint16_t*)0x200027c2 = 0; *(uint8_t*)0x200027c4 = 2; *(uint8_t*)0x200027c5 = 0; *(uint8_t*)0x200027c6 = 0; *(uint8_t*)0x200027c7 = 0; *(uint16_t*)0x200027c8 = 0x525; *(uint16_t*)0x200027ca = 0xa4a1; *(uint16_t*)0x200027cc = 0x40; *(uint8_t*)0x200027ce = 1; *(uint8_t*)0x200027cf = 2; *(uint8_t*)0x200027d0 = 3; *(uint8_t*)0x200027d1 = 1; *(uint8_t*)0x200027d2 = 9; *(uint8_t*)0x200027d3 = 2; *(uint16_t*)0x200027d4 = 0x3b; *(uint8_t*)0x200027d6 = 1; *(uint8_t*)0x200027d7 = 1; *(uint8_t*)0x200027d8 = 0; *(uint8_t*)0x200027d9 = 0; *(uint8_t*)0x200027da = 0; *(uint8_t*)0x200027db = 9; *(uint8_t*)0x200027dc = 4; *(uint8_t*)0x200027dd = 0; *(uint8_t*)0x200027de = 0; *(uint8_t*)0x200027df = 0; *(uint8_t*)0x200027e0 = 2; *(uint8_t*)0x200027e1 = 6; *(uint8_t*)0x200027e2 = 0; *(uint8_t*)0x200027e3 = 0; *(uint8_t*)0x200027e4 = 5; *(uint8_t*)0x200027e5 = 0x24; *(uint8_t*)0x200027e6 = 6; *(uint8_t*)0x200027e7 = 0; *(uint8_t*)0x200027e8 = 0; *(uint8_t*)0x200027e9 = 5; *(uint8_t*)0x200027ea = 0x24; *(uint8_t*)0x200027eb = 0; *(uint16_t*)0x200027ec = 0; *(uint8_t*)0x200027ee = 0xd; *(uint8_t*)0x200027ef = 0x24; *(uint8_t*)0x200027f0 = 0xf; *(uint8_t*)0x200027f1 = 1; *(uint32_t*)0x200027f2 = 0; *(uint16_t*)0x200027f6 = 0; *(uint16_t*)0x200027f8 = 0; *(uint8_t*)0x200027fa = 0; *(uint8_t*)0x200027fb = 9; *(uint8_t*)0x200027fc = 5; *(uint8_t*)0x200027fd = 0x82; *(uint8_t*)0x200027fe = 2; *(uint16_t*)0x200027ff = 0; *(uint8_t*)0x20002801 = 0; *(uint8_t*)0x20002802 = 0; *(uint8_t*)0x20002803 = 0; *(uint8_t*)0x20002804 = 9; *(uint8_t*)0x20002805 = 5; *(uint8_t*)0x20002806 = 3; *(uint8_t*)0x20002807 = 2; *(uint16_t*)0x20002808 = 0; *(uint8_t*)0x2000280a = 0; *(uint8_t*)0x2000280b = 0; *(uint8_t*)0x2000280c = 0; syz_usb_connect(0, 0x4d, 0x200027c0, 0); break; case 5: syz_usb_connect(0, 0, 0, 0); break; case 6: *(uint8_t*)0x20002f80 = 0x12; *(uint8_t*)0x20002f81 = 1; *(uint16_t*)0x20002f82 = 0; *(uint8_t*)0x20002f84 = 0; *(uint8_t*)0x20002f85 = 0; *(uint8_t*)0x20002f86 = 0; *(uint8_t*)0x20002f87 = 0; *(uint16_t*)0x20002f88 = 0x1b96; *(uint16_t*)0x20002f8a = 6; *(uint16_t*)0x20002f8c = 0x40; *(uint8_t*)0x20002f8e = 1; *(uint8_t*)0x20002f8f = 2; *(uint8_t*)0x20002f90 = 3; *(uint8_t*)0x20002f91 = 1; *(uint8_t*)0x20002f92 = 9; *(uint8_t*)0x20002f93 = 2; *(uint16_t*)0x20002f94 = 0x24; *(uint8_t*)0x20002f96 = 1; *(uint8_t*)0x20002f97 = 1; *(uint8_t*)0x20002f98 = 0; *(uint8_t*)0x20002f99 = 0; *(uint8_t*)0x20002f9a = 0; *(uint8_t*)0x20002f9b = 9; *(uint8_t*)0x20002f9c = 4; *(uint8_t*)0x20002f9d = 0; *(uint8_t*)0x20002f9e = 0; *(uint8_t*)0x20002f9f = 0; *(uint8_t*)0x20002fa0 = 3; *(uint8_t*)0x20002fa1 = 1; *(uint8_t*)0x20002fa2 = 0; *(uint8_t*)0x20002fa3 = 0; *(uint8_t*)0x20002fa4 = 9; *(uint8_t*)0x20002fa5 = 0x21; *(uint16_t*)0x20002fa6 = 0; *(uint8_t*)0x20002fa8 = 0; *(uint8_t*)0x20002fa9 = 1; *(uint8_t*)0x20002faa = 0x22; *(uint16_t*)0x20002fab = 0; *(uint8_t*)0x20002fad = 9; *(uint8_t*)0x20002fae = 5; *(uint8_t*)0x20002faf = 0x81; *(uint8_t*)0x20002fb0 = 3; *(uint16_t*)0x20002fb1 = 0; *(uint8_t*)0x20002fb3 = 0; *(uint8_t*)0x20002fb4 = 0; *(uint8_t*)0x20002fb5 = 0; syz_usb_connect(0, 0x36, 0x20002f80, 0); { int i; for (i = 0; i < 64; i++) { syz_usb_connect(0, 0x36, 0x20002f80, 0); } } break; } } int main(void) { syscall(SYS_mmap, 0x20000000ul, 0x1000000ul, 3ul, 0x1012ul, -1, 0ul, 0ul); for (procid = 0; procid < 6; procid++) { if (fork() == 0) { use_temporary_dir(); loop(); } } sleep(1000000); return 0; }