// https://syzkaller.appspot.com/bug?id=0518799fc2250353125d212fc510c44adbde73c3 // 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 static unsigned long long procid; 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 bool write_file(const char* file, const char* what, ...) { char buf[1024]; va_list args; va_start(args, what); vsnprintf(buf, sizeof(buf), what, args); va_end(args); buf[sizeof(buf) - 1] = 0; int len = strlen(buf); int fd = open(file, O_WRONLY | O_CLOEXEC); if (fd == -1) return false; if (write(fd, buf, len) != len) { int err = errno; close(fd); errno = err; return false; } close(fd); return true; } #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 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, 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); #define ATH9K_FIRMWARE_DOWNLOAD 0x30 #define ATH9K_FIRMWARE_DOWNLOAD_COMP 0x31 static bool lookup_connect_response_out_ath9k( 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: return true; default: break; } break; case USB_TYPE_VENDOR: switch (ctrl->bRequest) { case ATH9K_FIRMWARE_DOWNLOAD: return true; case ATH9K_FIRMWARE_DOWNLOAD_COMP: *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_event_fetch(int fd, struct usb_raw_event* event) { return ioctl(fd, USB_RAW_IOCTL_EVENT_FETCH, event); } 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_ep_write(int fd, struct usb_raw_ep_io* io) { return ioctl(fd, USB_RAW_IOCTL_EP_WRITE, io); } 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_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_stall(int fd) { return ioctl(fd, USB_RAW_IOCTL_EP0_STALL, 0); } static int lookup_endpoint(int fd, uint8_t bEndpointAddress) { struct usb_device_index* index = lookup_usb_index(fd); if (!index) return -1; if (index->iface_cur < 0) return -1; for (int ep = 0; index->ifaces[index->iface_cur].eps_num; ep++) if (index->ifaces[index->iface_cur].eps[ep].desc.bEndpointAddress == bEndpointAddress) return index->ifaces[index->iface_cur].eps[ep].handle; return -1; } 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; } #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 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_ath9k(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_ath9k); } static volatile long syz_usb_ep_write(volatile long a0, volatile long a1, volatile long a2, volatile long a3) { int fd = a0; uint8_t ep = a1; uint32_t len = a2; char* data = (char*)a3; int ep_handle = lookup_endpoint(fd, ep); if (ep_handle < 0) { return -1; } struct usb_raw_ep_io_data io_data; io_data.inner.ep = ep_handle; io_data.inner.flags = 0; if (len > sizeof(io_data.data)) len = sizeof(io_data.data); io_data.inner.length = len; memcpy(&io_data.data[0], data, len); int rv = usb_raw_ep_write(fd, (struct usb_raw_ep_io*)&io_data); if (rv < 0) { return rv; } sleep_ms(200); return 0; } static void kill_and_wait(int pid, int* status) { kill(-pid, SIGKILL); kill(pid, SIGKILL); for (int i = 0; i < 100; i++) { if (waitpid(-1, status, WNOHANG | __WALL) == pid) return; usleep(1000); } DIR* dir = opendir("/sys/fs/fuse/connections"); if (dir) { for (;;) { struct dirent* ent = readdir(dir); if (!ent) break; if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) continue; char abort[300]; snprintf(abort, sizeof(abort), "/sys/fs/fuse/connections/%s/abort", ent->d_name); int fd = open(abort, O_WRONLY); if (fd == -1) { continue; } if (write(fd, abort, 1) < 0) { } close(fd); } closedir(dir); } else { } while (waitpid(-1, status, __WALL) != pid) { } } static void setup_test() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setpgrp(); write_file("/proc/self/oom_score_adj", "1000"); } #define KMEMLEAK_FILE "/sys/kernel/debug/kmemleak" static void setup_leak() { if (!write_file(KMEMLEAK_FILE, "scan")) exit(1); sleep(5); if (!write_file(KMEMLEAK_FILE, "scan")) exit(1); if (!write_file(KMEMLEAK_FILE, "clear")) exit(1); } static void check_leaks(void) { int fd = open(KMEMLEAK_FILE, O_RDWR); if (fd == -1) exit(1); uint64_t start = current_time_ms(); if (write(fd, "scan", 4) != 4) exit(1); sleep(1); while (current_time_ms() - start < 4 * 1000) sleep(1); if (write(fd, "scan", 4) != 4) exit(1); static char buf[128 << 10]; ssize_t n = read(fd, buf, sizeof(buf) - 1); if (n < 0) exit(1); int nleaks = 0; if (n != 0) { sleep(1); if (write(fd, "scan", 4) != 4) exit(1); if (lseek(fd, 0, SEEK_SET) < 0) exit(1); n = read(fd, buf, sizeof(buf) - 1); if (n < 0) exit(1); buf[n] = 0; char* pos = buf; char* end = buf + n; while (pos < end) { char* next = strstr(pos + 1, "unreferenced object"); if (!next) next = end; char prev = *next; *next = 0; fprintf(stderr, "BUG: memory leak\n%s\n", pos); *next = prev; pos = next; nleaks++; } } if (write(fd, "clear", 5) != 5) exit(1); close(fd); if (nleaks) exit(1); } static void execute_one(void); #define WAIT_FLAGS __WALL static void loop(void) { int iter = 0; for (;; iter++) { int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { setup_test(); 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; } check_leaks(); } } uint64_t r[1] = {0xffffffffffffffff}; void execute_one(void) { intptr_t res = 0; *(uint8_t*)0x20000180 = 0x12; *(uint8_t*)0x20000181 = 1; *(uint16_t*)0x20000182 = 0x200; *(uint8_t*)0x20000184 = -1; *(uint8_t*)0x20000185 = -1; *(uint8_t*)0x20000186 = -1; *(uint8_t*)0x20000187 = 0x40; *(uint16_t*)0x20000188 = 0xcf3; *(uint16_t*)0x2000018a = 0x9271; *(uint16_t*)0x2000018c = 0x108; *(uint8_t*)0x2000018e = 1; *(uint8_t*)0x2000018f = 2; *(uint8_t*)0x20000190 = 3; *(uint8_t*)0x20000191 = 1; *(uint8_t*)0x20000192 = 9; *(uint8_t*)0x20000193 = 2; *(uint16_t*)0x20000194 = 0x48; *(uint8_t*)0x20000196 = 1; *(uint8_t*)0x20000197 = 1; *(uint8_t*)0x20000198 = 0; *(uint8_t*)0x20000199 = 0x80; *(uint8_t*)0x2000019a = 0xfa; *(uint8_t*)0x2000019b = 9; *(uint8_t*)0x2000019c = 4; *(uint8_t*)0x2000019d = 0; *(uint8_t*)0x2000019e = 0; *(uint8_t*)0x2000019f = 6; *(uint8_t*)0x200001a0 = -1; *(uint8_t*)0x200001a1 = 0; *(uint8_t*)0x200001a2 = 0; *(uint8_t*)0x200001a3 = 0; *(uint8_t*)0x200001a4 = 9; *(uint8_t*)0x200001a5 = 5; *(uint8_t*)0x200001a6 = 1; *(uint8_t*)0x200001a7 = 2; *(uint16_t*)0x200001a8 = 0x200; *(uint8_t*)0x200001aa = 0; *(uint8_t*)0x200001ab = 0; *(uint8_t*)0x200001ac = 0; *(uint8_t*)0x200001ad = 9; *(uint8_t*)0x200001ae = 5; *(uint8_t*)0x200001af = 0x82; *(uint8_t*)0x200001b0 = 2; *(uint16_t*)0x200001b1 = 0x200; *(uint8_t*)0x200001b3 = 0; *(uint8_t*)0x200001b4 = 0; *(uint8_t*)0x200001b5 = 0; *(uint8_t*)0x200001b6 = 9; *(uint8_t*)0x200001b7 = 5; *(uint8_t*)0x200001b8 = 0x83; *(uint8_t*)0x200001b9 = 3; *(uint16_t*)0x200001ba = 0x40; *(uint8_t*)0x200001bc = 1; *(uint8_t*)0x200001bd = 0; *(uint8_t*)0x200001be = 0; *(uint8_t*)0x200001bf = 9; *(uint8_t*)0x200001c0 = 5; *(uint8_t*)0x200001c1 = 4; *(uint8_t*)0x200001c2 = 3; *(uint16_t*)0x200001c3 = 0x40; *(uint8_t*)0x200001c5 = 1; *(uint8_t*)0x200001c6 = 0; *(uint8_t*)0x200001c7 = 0; *(uint8_t*)0x200001c8 = 9; *(uint8_t*)0x200001c9 = 5; *(uint8_t*)0x200001ca = 5; *(uint8_t*)0x200001cb = 2; *(uint16_t*)0x200001cc = 0x200; *(uint8_t*)0x200001ce = 0; *(uint8_t*)0x200001cf = 0; *(uint8_t*)0x200001d0 = 0; *(uint8_t*)0x200001d1 = 9; *(uint8_t*)0x200001d2 = 5; *(uint8_t*)0x200001d3 = 6; *(uint8_t*)0x200001d4 = 2; *(uint16_t*)0x200001d5 = 0x200; *(uint8_t*)0x200001d7 = 0; *(uint8_t*)0x200001d8 = 0; *(uint8_t*)0x200001d9 = 0; res = -1; res = syz_usb_connect_ath9k(3, 0x5a, 0x20000180, 0); if (res != -1) r[0] = res; *(uint16_t*)0x20000200 = 0; *(uint16_t*)0x20000202 = 0x4e00; *(uint16_t*)0x20000204 = 0x7ca; *(uint16_t*)0x20000206 = 0x4e00; memcpy( (void*)0x20000208, "\x0b\xdc\x97\xf9\x33\xba\xc9\xe9\xc7\xd8\x83\x45\x6b\x95\xba\x2f\x17\xf2" "\x8e\xa5\xa0\x4b\x04\x68\x15\xc5\x75\xd9\x28\x50\xb3\x7c\x3b\xb6\xad\x92" "\x8c\xc1\x86\xf9\x24\x57\xe2\xd4\xda\x05\x3f\x3c\xe2\x2a\x2b\x09\xce\x0f" "\x87\xdd\x9c\xb9\x7c\xbb\x62\x65\xe5\xb5\x17\x29\x99\x00\xa1\x42\x37\xa1" "\x25\xe3\x82\x08\x7e\x04\xa7\xe2\x2d\x39\xcf\x93\xd3\x46\xc3\xf0\x45\x4b" "\xbc\x98\xec\x8b\xc1\xf9\x6a\x24\xc5\x53\x40\x74\x40\x32\xbe\x1b\xdd\xd7" "\xbb\x4a\xa3\xc3\x64\x74\x62\x81\x0c\xf6\x53\x6f\x61\x48\x7c\x46\xe6\x68" "\xc7\xfd\xc5\xcf\x01\x1d\x69\x70\x0f\xc4\x69\x29\x01\x10\xc8\x54\xf1\xfd" "\xc9\xf1\x96\xfe\x17\x3e\xcd\x51\x17\x53\x9c\x8f\x84\xe0\x81\x51\x55\x49" "\x6a\x5c\x17\x32\x06\xae\x9b\x26\xfc\x47\x8f\xe2\xf1\xb1\x18\x04\x0d\x14" "\x1d\xe1\xc4\xd7\x46\xdf\xa2\x17\xad\x15\x12\x6a\xda\xd3\x2f\x68\x37\x48" "\xcd\x4f\x60\xfe\x47\xa8\xf2\x62\xd2\x12\xd9\xaa\xda\x3e\xf4\x7a\xec\xbd" "\x9a\x70\x6e\x9e\xe0\x85\x6b\x8c\xde\xf5\x78\x53\x33\xba\x6f\x65\x17\x9b" "\xa9\xd5\x52\x6e\xd1\x3b\x9b\xcb\x74\x38\xab\x12\x4c\xf0\xa1\x3a\x4b\x60" "\xa6\x08\x76\x39\x63\xe5\x2a\xce\xd3\xd8\xf5\x1f\x00\xc3\x84\xb2\x9c\x9e" "\x1d\xbd\xd8\x24\xf9\x7e\xff\x93\x37\x61\x9b\x54\xe8\x12\x4c\x7f\x93\xdc" "\x52\x51\xfc\x0d\x2a\x67\x36\xae\x54\x80\x6a\xcb\x5f\x82\xba\x90\xf9\xc5" "\x3e\xc5\xac\x2a\x8f\xfe\x60\xd5\xa6\x2f\x95\x77\x1f\xd6\x1b\xe9\xa6\xa4" "\x6f\x5e\x06\xbc\xd5\x56\x8d\x6f\x6d\x53\x4f\xb9\xbf\x9b\xbc\x80\x13\x77" "\xdd\xc6\xcb\xca\xc4\xf9\x2c\x3b\x24\x32\xa1\x76\x7b\x8a\xa7\xff\x64\x0f" "\xb3\x07\x18\x6d\x52\xb0\x7a\x6d\x24\x0a\xce\x6d\x95\xd3\x27\xf4\x06\xd1" "\xa9\xff\x7c\x37\x0f\xe3\xfa\x71\x41\xe6\xc3\xf6\x6f\x38\xc7\x9b\x1a\x1a" "\x27\xb9\x72\xcc\x6e\xe7\x66\xbb\xe5\x73\x47\x06\xde\xd3\xab\x8f\x6d\x04" "\x87\x56\x6a\x01\xdb\xa7\xaf\xf3\x4d\x1d\x99\x3f\x3d\xab\x25\xd7\x29\x41" "\xb5\xa6\xfa\xee\xdf\x07\xd1\xb0\xbd\x13\x2f\x14\xbb\xac\x01\xea\x2d\x8b" "\xb3\x14\xf7\x51\xbe\x06\x39\x18\x89\xea\x68\x33\x70\x92\x4e\x89\x3b\x0b" "\x0f\x3a\xc2\xfc\x93\x05\xda\xc6\x8d\x21\x39\x66\xd4\x30\x68\xf6\x8d\x00" "\x58\xca\xda\x23\xc0\xaa\xf2\xea\x8d\xd7\x88\x26\xe7\x98\x79\xf9\x1c\x99" "\x20\x64\xf9\x49\x20\x01\x2d\x51\x11\xfe\x21\x5c\x08\x1d\xfa\x28\x0a\x39" "\xac\x60\x28\x00\x4d\x57\xe5\xa5\xb0\xd2\x30\x64\xfd\xbc\xa4\x98\xfa\x6c" "\x7e\x21\xff\x0f\x96\x68\x0b\x83\x7e\x13\x0c\x88\x58\xaa\x82\x13\xfa\x04" "\xad\x75\x0c\x91\x83\x43\x00\x45\x11\xe9\xa1\x5f\x10\xde\x4e\x6b\xb7\xd3" "\x06\x81\x23\xf3\xc2\xab\x63\x98\xbb\xe3\x95\xa0\xf2\xec\x9a\x46\x23\x42" "\xb6\xce\x33\x6d\x95\xd4\x36\x62\x95\x47\x73\x70\x94\x5a\x95\x56\x95\xef" "\x3b\xdd\x60\xa5\x9f\x4e\x10\x2f\x8e\xe6\x6b\x3b\x24\x2f\x1c\x1c\xd6\xab" "\x67\x7a\xd5\x29\xe0\x40\xbe\x05\x2c\xb5\x23\xd1\x9c\x5a\x2e\x1c\xcc\x4c" "\x4b\xe9\xa5\x83\x04\xbc\x74\xf1\x0e\x25\x7b\x10\xf5\x4a\xd4\x0c\xf1\x44" "\x57\x7d\x7f\x0d\x6f\x89\xf6\x07\xe7\x08\xfe\x1c\x15\x6c\xe9\x60\xdc\x2a" "\x93\x14\xe7\xb5\x90\x3a\x94\xae\xee\x72\xe3\x93\x68\x55\xd7\x2a\x37\xe6" "\xd1\x94\x66\x7b\xf9\x3b\x62\x1f\x3a\x90\xcb\x9a\xeb\xea\x5e\x5e\x6f\x66" "\x5e\x8f\x0c\xc0\x0a\x4a\xc1\x20\x4f\xb6\x5f\x6f\x53\x2f\x30\x36\x62\x4f" "\xa6\xa4\x7b\x1f\xff\x2b\x25\x94\x16\xa2\x1a\x7e\x1e\x02\x58\x6b\x2e\x7f" "\x35\x5b\x51\x70\x1e\x77\xb3\x44\x8a\x74\x3c\xe2\x20\xf2\x83\xfe\xca\x7f" "\xa8\xb8\xc0\x1c\xab\x88\x2b\x12\xb2\x45\x55\x1e\x12\x3f\x3d\xcc\xf4\x41" "\x07\xad\x51\x5a\x76\x3a\x6a\x28\x2b\x15\x0d\xe7\x1b\xfe\xb3\x5e\xba\xeb" "\x41\xed\xcf\x51\x33\xd8\xba\x70\xa7\xff\xfe\x6b\xd1\xa7\xf9\xc6\x49\x62" "\x99\x66\x91\x8c\x6b\x84\xe5\xb6\xfe\x70\xaa\x28\x84\x4a\x34\x63\x4d\x1f" "\xa6\x53\x9e\x7a\xb9\xcf\x05\x0f\x9b\x05\xd2\x07\x43\x3b\xa9\x69\x25\xfe" "\x2c\x4d\x11\x8a\xa6\x28\x8c\x96\x98\xbb\x14\x32\xe5\x90\x2e\x6c\x7e\x8e" "\xd5\x94\x82\x73\x3e\xfb\xf9\x87\x61\x5c\xaf\x22\xc2\xbd\x8d\x21\x3c\x46" "\x83\x0c\x59\xbc\xfb\x40\xf4\x40\xc3\x78\x95\x25\x7a\x62\x96\x49\x85\xbe" "\x1a\x2c\x22\xf2\x19\x3a\xfa\x23\x92\x8f\xdb\xb4\xca\xea\x6e\xfb\x07\xaa" "\x62\x7e\xb3\xc5\xd1\xcf\xc6\x2e\x24\xb2\x87\xfb\x7f\xdb\xe2\xe0\x37\xae" "\x5a\x08\x65\xb8\x47\x88\x2c\x0b\xc4\x3c\xae\x53\x82\x97\x9a\x81\xc3\x2a" "\xda\xb1\x53\xf5\x9e\x34\xe8\x8f\x0e\x8a\x13\x41\x61\x75\x9a\x68\x22\x6d" "\x42\x69\xd8\xa0\x75\xd0\xb6\x7a\x82\x88\xbc\x6a\xd0\x86\x29\xc5\xfb\x9e" "\x1d\xc8\x0b\x8b\x18\xc3\x26\xdd\xff\xd1\x24\x83\xa7\xa2\xd5\x89\x04\x33" "\x13\xdd\x73\x82\x79\xeb\xaf\x5b\x22\xd8\x1c\xb4\xb6\xf2\x88\x1b\xe0\x62" "\x06\x9b\x2f\x65\xcc\xef\x30\x66\x34\x2d\xfc\xdf\xd0\x09\x32\x09\x90\xfc" "\xd3\x2d\x5a\x90\x98\xb9\x8d\xe7\xcd\xb8\xb1\x66\x21\x1d\x22\xdd\xfa\x47" "\x63\x95\xb1\xce\x0e\x08\xb8\x08\x08\x22\x67\x35\xff\x56\x36\xab\xcb\xb9" "\x71\x3b\x4d\x26\x3d\x19\xb2\x52\x1c\x5e\xb0\x1b\x0a\xcb\x8c\x7e\x93\x55" "\x64\x7a\x71\xb8\x52\xc0\xd7\xc2\xec\x00\x37\xa6\x3e\x7f\x67\x6b\x3b\xf7" "\xc1\x0b\xa3\xdc\x1f\x42\xee\xa4\xe5\x30\x2e\x93\x27\x93\x54\xe5\xa0\xc5" "\xd5\x8a\x12\x54\xa8\x8f\xfc\x97\xa6\x7b\x9a\x5b\x61\x5d\x97\xce\x4f\x10" "\x64\x3d\x8b\x95\xf5\xfb\x1c\x0b\x1f\x43\xab\x7b\x4b\x9c\xa7\x9e\x55\x59" "\xf4\xe8\x56\xd5\x0f\xb7\x93\x0c\x27\x95\x6a\xb5\xd2\x92\x82\xfd\x58\x03" "\xd0\x3d\x0c\xf8\xc5\x27\x36\x65\x2a\x5b\x85\xba\xa1\xc3\xd8\xe0\x80\x81" "\x2f\x48\xde\xe8\xef\xd0\xf3\x6c\xb7\x48\x28\x9a\xe7\x15\xcd\x57\xc0\x7a" "\xc2\x81\x2f\x07\x67\x77\xc7\x3a\x8f\x17\xab\xda\xd7\x5f\x2a\x06\xf8\x9f" "\x24\x96\x5e\x51\x8f\x53\xb0\x6b\x1a\x8b\x86\x73\xcc\x13\xe8\x50\x93\x98" "\x4f\xf2\xa6\x05\xd0\x09\xa7\x2d\x30\x0f\x3e\xdb\xfb\xb8\x98\x8f\x58\x65" "\xc3\x98\xe1\x02\x4f\x57\x15\xe2\x41\x87\x85\x59\xbe\xed\x48\x1c\x6d\x82" "\x56\x43\x81\x40\x2b\xfb\xff\xb8\xd9\x8f\xc5\xa4\x93\x5b\x6f\xdd\xc9\x3c" "\x53\x52\x1d\x23\xe4\xb9\x00\xeb\xe9\xbe\x1d\x2f\x08\x58\x0a\x9c\x3d\x22" "\x09\x1f\xdb\x79\x38\xcc\x4d\x2d\x0b\x10\x74\x37\xa2\x9c\x91\x51\xc7\x54" "\x22\x7e\xfe\xfc\xaf\x89\x09\x5d\x0c\x36\x50\xe7\xde\x58\xd3\xca\xe7\x37" "\x06\xbf\x67\x17\xc0\xc7\xd6\x64\xff\x15\x8f\xe0\x42\x3f\x54\x8f\xd9\xde" "\xa6\xa6\x1f\xec\x20\xb1\xc4\x3a\x40\xa2\x02\xa0\x1c\x70\x80\xf7\xe4\x88" "\xbd\x5a\x35\x7d\x8a\x11\xc0\x79\x36\xf5\x5d\xef\xde\x34\xc1\xf2\xe9\x03" "\x53\x34\xc7\x63\xae\x36\xbe\x7a\x45\x50\x6f\x6d\x63\x52\xcf\xea\x16\x61" "\x6d\x5a\x69\x90\xed\x29\xdc\x53\xf3\x3d\x75\x4d\x94\x96\x02\xe4\x1c\x29" "\x26\xe5\x99\x69\xf8\x21\x2b\xab\xb7\x64\xd2\xa8\xea\x5b\x4f\x24\x37\x17" "\xdc\x79\x08\x90\xa4\x8d\x0a\xb2\x8e\x81\x8d\xf4\x8e\xab\xa7\x41\xd2\xc8" "\x98\xb5\xba\x85\xf9\xc5\x2d\xe2\xd9\x5e\x84\x14\xd5\xc5\x06\xf9\x52\x43" "\x41\xf3\xc2\xb7\x26\x3a\x06\x5a\x3e\x1e\x67\x21\x35\xe9\xf2\x80\xd8\xb9" "\x1f\x59\xc7\x74\xa4\x2e\x00\x50\xe5\x8a\x0e\x67\xbe\x98\xe4\x61\x70\xe0" "\x18\x84\x71\x88\xd4\x90\x55\xd2\xee\xaf\x64\x04\xb1\x60\x0b\x12\xe3\xe6" "\x50\x55\x11\x64\xcd\x95\x81\x8c\x70\x9a\x21\xfc\xfc\x08\x0e\x6b\xfb\xe4" "\xad\x80\xb7\xd6\xda\xd9\x8d\xb4\x40\x29\xb0\xe5\x5d\x3a\xf8\x14\xe4\x23" "\x60\x63\x00\x08\xf0\x00\xfd\xdf\x6f\x23\xb6\x0f\x43\x88\x15\x15\x1e\x0a" "\x3d\x77\xb0\x45\x56\x1b\xb0\x66\x7b\x92\x78\xec\x98\x56\x82\x0d\xbd\xa0" "\xb9\x18\x9e\x3b\xec\x64\xf7\x90\xd0\x09\x6d\x90\x11\x62\x0e\x9c\xd0\xed" "\x49\x67\xc5\x73\x5f\xd1\x52\x41\xce\xe6\x17\x3b\xe9\x65\x35\xce\x3f\x8f" "\x00\x9c\x91\xc6\x7d\x9d\xb2\x8a\x67\xf6\x25\x01\xaf\xcf\x2b\x2b\x5a\xfe" "\x0c\x9c\x55\x70\x92\x77\x7e\xb8\x01\x4a\xf8\xd9\xa6\xd4\xe8\xd4\x0a\x21" "\xaa\xee\x23\x5a\x5b\xa1\x37\x2b\xa8\x44\xbe\x2f\x34\x36\x58\x38\x73\x21" "\x26\x0b\xce\x0c\x15\xc8\xfc\x20\xb4\x80\x90\x58\x2a\xa8\x33\xfc\xaf\xf7" "\xb3\x33\xae\x82\xf5\xa3\xec\x06\xeb\xa2\x81\xdd\x92\xf2\x32\x1a\x41\x9c" "\x3d\xee\xd4\xb8\xf8\x66\x01\x45\x61\xd5\x80\x2e\xb8\x78\xfc\x2c\x9b\x16" "\xb1\xe5\x4f\x69\x89\x2d\x6c\xf9\xcc\x89\x58\x96\x22\x38\x5f\x41\xe2\xb7" "\xa7\x0e\x1f\x4a\xb5\x4d\x2e\x45\xf1\xd9\x30\x65\x0b\x3d\xaf\x9c\x81\xd4" "\x32\x64\x4c\xd0\xcc\x99\x23\xbc\xa5\x22\x29\xae\x2a\x26\x85\xe1\x68\x72" "\x8a\xab\x21\xe0\x6d\xbd\x3f\xa4\xf5\xac\x93\x69\x39\x45\x93\x5b\x59\x9e" "\xbe\xac\x50\xc7\x0b\x3d\x49\xa7\xed\x76\x05\xd3\xc2\xff\xd7\x03\x3f\xc8" "\x1d\x8c\x50\x90\x73\x3e\xe4\xec\xb8\x96\x6e\xc7\x88\x7a\xa8\x25\x8a\x64" "\x6d\x34\xec\x7e\xfe\x35\x9f\x15\x09\xf9\x82\xe8\x15\xce\x30\x1a\x97\xad" "\x09\xbd\x58\x93\xa7\x63\xdf\x7f\xc0\x66\x6d\x9a\x46\xc1\xe2\x2f\x85\xf2" "\x56\xd0\xd8\x33\x25\xe2\xa3\x68\x29\x5d\xde\x0b\x09\x21\x5a\xc5\xdf\x6d" "\x9b\x8c\xbc\x0b\xad\x05\xfe\x1f\x39\x44\xdc\x2f\x4b\x47\x80\xad\xcb\xdb" "\xb4\x64\x5c\x18\xd2\xa6\x57\x70\xd0\x52\x83\xe9\x82\xff", 1994); syz_usb_ep_write(r[0], 0x82, 0x7d4, 0x20000200); } int main(void) { syscall(__NR_mmap, 0x1ffff000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul); syscall(__NR_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x32ul, -1, 0ul); syscall(__NR_mmap, 0x21000000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul); setup_leak(); loop(); return 0; }