// https://syzkaller.appspot.com/bug?id=ef8004af3600e0d97374f1f6b47b610dce42d697 // 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 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 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 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); 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_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_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 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(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); } #define FS_IOC_SETFLAGS _IOW('f', 2, long) static void remove_dir(const char* dir) { int iter = 0; DIR* dp = 0; retry: while (umount2(dir, MNT_DETACH | UMOUNT_NOFOLLOW) == 0) { } dp = opendir(dir); if (dp == NULL) { if (errno == EMFILE) { exit(1); } 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); while (umount2(filename, MNT_DETACH | UMOUNT_NOFOLLOW) == 0) { } struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } int i; for (i = 0;; i++) { if (unlink(filename) == 0) break; if (errno == EPERM) { int fd = open(filename, O_RDONLY); if (fd != -1) { long flags = 0; if (ioctl(fd, FS_IOC_SETFLAGS, &flags) == 0) { } close(fd); continue; } } if (errno == EROFS) { break; } if (errno != EBUSY || i > 100) exit(1); if (umount2(filename, MNT_DETACH | UMOUNT_NOFOLLOW)) exit(1); } } closedir(dp); for (int i = 0;; i++) { if (rmdir(dir) == 0) break; if (i < 100) { if (errno == EPERM) { int fd = open(dir, O_RDONLY); if (fd != -1) { long flags = 0; if (ioctl(fd, FS_IOC_SETFLAGS, &flags) == 0) { } close(fd); continue; } } if (errno == EROFS) { break; } if (errno == EBUSY) { if (umount2(dir, MNT_DETACH | UMOUNT_NOFOLLOW)) exit(1); continue; } if (errno == ENOTEMPTY) { if (iter < 100) { iter++; goto retry; } } } exit(1); } } 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"); if (symlink("/dev/binderfs", "./binderfs")) { } } static void execute_one(void); #define WAIT_FLAGS __WALL 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); 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; } remove_dir(cwdbuf); } } void execute_one(void) { *(uint8_t*)0x20000140 = 0x12; *(uint8_t*)0x20000141 = 1; *(uint16_t*)0x20000142 = 0x300; *(uint8_t*)0x20000144 = 0xc4; *(uint8_t*)0x20000145 = 0x28; *(uint8_t*)0x20000146 = 0xa0; *(uint8_t*)0x20000147 = 0x10; *(uint16_t*)0x20000148 = 0x50d; *(uint16_t*)0x2000014a = 0x7051; *(uint16_t*)0x2000014c = 0x605a; *(uint8_t*)0x2000014e = 1; *(uint8_t*)0x2000014f = 2; *(uint8_t*)0x20000150 = 3; *(uint8_t*)0x20000151 = 1; *(uint8_t*)0x20000152 = 9; *(uint8_t*)0x20000153 = 2; *(uint16_t*)0x20000154 = 0x4a4; *(uint8_t*)0x20000156 = 2; *(uint8_t*)0x20000157 = 3; *(uint8_t*)0x20000158 = 0x7f; *(uint8_t*)0x20000159 = 0x20; *(uint8_t*)0x2000015a = 4; *(uint8_t*)0x2000015b = 9; *(uint8_t*)0x2000015c = 4; *(uint8_t*)0x2000015d = 5; *(uint8_t*)0x2000015e = 6; *(uint8_t*)0x2000015f = 0xc; *(uint8_t*)0x20000160 = 0x27; *(uint8_t*)0x20000161 = 0xee; *(uint8_t*)0x20000162 = 0x3b; *(uint8_t*)0x20000163 = 0x7f; *(uint8_t*)0x20000164 = 0x9f; *(uint8_t*)0x20000165 = 1; memcpy( (void*)0x20000166, "\x39\x1e\x8b\xf1\xc6\xb3\x13\x9c\x4f\xe9\xda\x29\x79\x97\x8e\x80\xef\x9c" "\x04\xed\x85\x19\xfb\x56\x0d\x1e\x0c\x44\x56\xc6\x94\x15\xa4\xf1\x1c\xed" "\xe9\x48\xcb\xd3\x67\x14\x93\xd4\x35\xe9\x24\x52\x3f\x14\x55\xaf\x65\xb6" "\xb5\x98\x48\xb6\x63\x1d\xb3\x56\xbf\xf5\x84\x01\x64\x75\x39\x28\x09\xce" "\x20\xba\x5b\xe0\x0c\x0f\xbf\x78\x3a\x11\x2b\x70\x78\x6a\x6e\xdc\xfa\x0d" "\xf4\x5f\x85\x54\x2d\x87\x18\x63\x78\xca\x17\xdf\xe3\x76\x3c\x78\x9c\x60" "\xe5\x7e\xba\x2a\xf5\x69\xb9\x8b\x77\xa0\x13\xd4\x1e\x44\xb1\x91\xe1\x45" "\x39\x5d\x27\xd6\xfd\xd7\x2d\x98\x5e\x0e\x6c\x15\xe4\x4c\xad\x04\xaa\xd3" "\x4e\x2a\x4d\x8f\x31\x7d\xe5\xf3\x99\xb4\xfa\xca\x48", 157); *(uint8_t*)0x20000203 = 7; *(uint8_t*)0x20000204 = 0x24; *(uint8_t*)0x20000205 = 6; *(uint8_t*)0x20000206 = 0; *(uint8_t*)0x20000207 = 1; memcpy((void*)0x20000208, "\xec\x84", 2); *(uint8_t*)0x2000020a = 5; *(uint8_t*)0x2000020b = 0x24; *(uint8_t*)0x2000020c = 0; *(uint16_t*)0x2000020d = 7; *(uint8_t*)0x2000020f = 0xd; *(uint8_t*)0x20000210 = 0x24; *(uint8_t*)0x20000211 = 0xf; *(uint8_t*)0x20000212 = 1; *(uint32_t*)0x20000213 = 0x82c1; *(uint16_t*)0x20000217 = 0x200; *(uint16_t*)0x20000219 = 2; *(uint8_t*)0x2000021b = 0; *(uint8_t*)0x2000021c = 6; *(uint8_t*)0x2000021d = 0x24; *(uint8_t*)0x2000021e = 0x1a; *(uint16_t*)0x2000021f = 8; *(uint8_t*)0x20000221 = 0x2f; *(uint8_t*)0x20000222 = 5; *(uint8_t*)0x20000223 = 0x24; *(uint8_t*)0x20000224 = 1; *(uint8_t*)0x20000225 = 2; *(uint8_t*)0x20000226 = 7; *(uint8_t*)0x20000227 = 4; *(uint8_t*)0x20000228 = 0x24; *(uint8_t*)0x20000229 = 0x13; *(uint8_t*)0x2000022a = 0x81; *(uint8_t*)0x2000022b = 0xc; *(uint8_t*)0x2000022c = 0x24; *(uint8_t*)0x2000022d = 0x1b; *(uint16_t*)0x2000022e = 9; *(uint16_t*)0x20000230 = 0x8000; *(uint8_t*)0x20000232 = 5; *(uint8_t*)0x20000233 = 0xfb; *(uint16_t*)0x20000234 = 6; *(uint8_t*)0x20000236 = 0x83; *(uint8_t*)0x20000237 = 0x15; *(uint8_t*)0x20000238 = 0x24; *(uint8_t*)0x20000239 = 0x12; *(uint16_t*)0x2000023a = 1; *(uint64_t*)0x2000023c = 0x14f5e048ba817a3; *(uint64_t*)0x20000244 = 0x2a397ecbffc007a6; *(uint8_t*)0x2000024c = 7; *(uint8_t*)0x2000024d = 0x24; *(uint8_t*)0x2000024e = 0x14; *(uint16_t*)0x2000024f = 0x1f; *(uint16_t*)0x20000251 = 0xa2b; *(uint8_t*)0x20000253 = 9; *(uint8_t*)0x20000254 = 5; *(uint8_t*)0x20000255 = 0x8b; *(uint8_t*)0x20000256 = 2; *(uint16_t*)0x20000257 = 0x20; *(uint8_t*)0x20000259 = 0x39; *(uint8_t*)0x2000025a = 8; *(uint8_t*)0x2000025b = 0; *(uint8_t*)0x2000025c = 0xb2; *(uint8_t*)0x2000025d = 5; memcpy( (void*)0x2000025e, "\x42\xe4\x6f\x7e\xbf\x49\xe4\x44\x5d\x6c\x48\x38\xb2\x49\x2b\x56\x49\x47" "\x11\x9d\x08\x55\xdd\x07\x0e\x4a\x1a\xeb\x9d\x20\x73\x25\x1c\xf2\x6d\x92" "\x74\xb5\x32\x53\xc9\x90\xae\x8f\xa0\xc4\xea\x32\xf4\x4b\xa5\x6b\x08\x1d" "\xa8\x6d\x81\x44\x57\x63\x70\x45\x6a\x77\x99\x82\x71\x97\x35\x9c\xc8\x28" "\xa5\xa5\xd7\x1a\x07\xbe\xa7\xa5\xb0\xb4\xb2\x16\xe4\x3d\xb8\xb0\xac\x66" "\x70\x32\xed\x19\xda\x54\xfe\xd6\xd9\x86\x50\xc3\x0b\x95\x2f\xe1\x7d\xe4" "\x3f\x2e\x31\x9b\x68\xda\x8a\x6b\x89\x5c\x27\xe6\xbf\xa2\x34\xa0\x1e\xb8" "\x60\x0f\xf3\x8b\xf7\xfc\x98\xde\xb1\x60\x1f\x22\xd4\x41\xbc\x5b\x8a\x87" "\xa3\x5c\x27\x2a\xa5\xf8\x67\xaf\x68\xa4\x38\x78\x36\x57\x4b\xce\x34\xf0" "\xb1\xfe\x4c\x49\xa4\x85\x33\x77\xf0\xb9\x8c\x71\x5a\xac", 176); *(uint8_t*)0x2000030e = 0x35; *(uint8_t*)0x2000030f = 0x22; memcpy((void*)0x20000310, "\x42\xcd\x3e\xd2\xa4\xb5\x22\x2c\x2b\xd3\xe4\xd1\xca\xfa\x66\x39\xb8" "\x35\x2a\x12\xbe\x15\xad\x58\x63\x42\x4a\xe1\x3a\x37\x74\x74\xfa\xbb" "\x29\x70\xdb\xe2\xcb\x8c\x99\x8c\x12\xc1\x98\xff\x6d\xca\x07\xc0\xe6", 51); *(uint8_t*)0x20000343 = 9; *(uint8_t*)0x20000344 = 5; *(uint8_t*)0x20000345 = 0xa; *(uint8_t*)0x20000346 = 8; *(uint16_t*)0x20000347 = 0x40; *(uint8_t*)0x20000349 = 0x10; *(uint8_t*)0x2000034a = 0xc7; *(uint8_t*)0x2000034b = 3; *(uint8_t*)0x2000034c = 2; *(uint8_t*)0x2000034d = 0x11; *(uint8_t*)0x2000034e = 9; *(uint8_t*)0x2000034f = 5; *(uint8_t*)0x20000350 = 4; *(uint8_t*)0x20000351 = 0; *(uint16_t*)0x20000352 = 8; *(uint8_t*)0x20000354 = 1; *(uint8_t*)0x20000355 = 0; *(uint8_t*)0x20000356 = 0x1a; *(uint8_t*)0x20000357 = 7; *(uint8_t*)0x20000358 = 0x25; *(uint8_t*)0x20000359 = 1; *(uint8_t*)0x2000035a = 0x80; *(uint8_t*)0x2000035b = 3; *(uint16_t*)0x2000035c = 0x400; *(uint8_t*)0x2000035e = 7; *(uint8_t*)0x2000035f = 0x25; *(uint8_t*)0x20000360 = 1; *(uint8_t*)0x20000361 = 3; *(uint8_t*)0x20000362 = 0x7f; *(uint16_t*)0x20000363 = 0x100; *(uint8_t*)0x20000365 = 9; *(uint8_t*)0x20000366 = 5; *(uint8_t*)0x20000367 = 3; *(uint8_t*)0x20000368 = 0xc; *(uint16_t*)0x20000369 = 0x400; *(uint8_t*)0x2000036b = 0x81; *(uint8_t*)0x2000036c = 2; *(uint8_t*)0x2000036d = 1; *(uint8_t*)0x2000036e = 0xc6; *(uint8_t*)0x2000036f = 7; memcpy( (void*)0x20000370, "\x9b\xbb\x42\x9f\xbe\x8a\x07\xe9\xb4\x14\x5d\x77\x21\x8d\xdf\x8e\x15\x1b" "\x06\x1f\xd8\x57\x19\xaf\xe7\x34\x90\x1b\x65\xdc\x6a\x80\x88\x56\xba\x9c" "\xb8\xc3\xa2\x17\x95\xfa\x13\xb5\x10\x42\xe2\x11\xa2\x26\x0a\x40\x6c\x1f" "\xa8\x68\x87\x1f\xf4\x36\x5f\x21\xfb\x52\x6d\xe7\x8b\xd1\x09\xac\xb6\x93" "\x22\x07\xf6\x5c\xe8\xe4\x93\xb3\xf9\x54\x08\xdf\x2a\x87\xe9\x25\xcd\xe7" "\x36\xfc\xc0\x9f\xf9\xfc\x1d\x3f\x3e\x6f\x5a\x2c\xe0\x03\x7d\xd2\xa3\xc1" "\x95\xbc\x50\xee\x4d\x1f\xf2\x1b\x12\xe2\x44\xd4\xe9\x49\xc2\xfe\x6d\xf7" "\xf6\x9b\xa7\x55\x0e\x5a\xf8\x10\x0a\x44\xe6\xf2\xd9\x81\x53\xb6\x01\xb2" "\x60\xc8\x69\xa6\xf7\xc1\x0f\x45\x89\x18\xf3\xe5\xa2\xed\xf9\x59\xc9\x54" "\x5d\x7a\x60\x6f\x2e\x56\xb1\x95\x82\xff\x03\xb6\x45\x9b\xb8\x76\x10\xf5" "\x57\x07\xd9\x44\xa5\x88\xaf\x8f\x4e\x1c\x21\x35\x04\x82\xec\x83", 196); *(uint8_t*)0x20000434 = 9; *(uint8_t*)0x20000435 = 5; *(uint8_t*)0x20000436 = 0x80; *(uint8_t*)0x20000437 = 0; *(uint16_t*)0x20000438 = 8; *(uint8_t*)0x2000043a = 1; *(uint8_t*)0x2000043b = 0; *(uint8_t*)0x2000043c = 5; *(uint8_t*)0x2000043d = 7; *(uint8_t*)0x2000043e = 0x25; *(uint8_t*)0x2000043f = 1; *(uint8_t*)0x20000440 = 0x81; *(uint8_t*)0x20000441 = 1; *(uint16_t*)0x20000442 = 0xf9; *(uint8_t*)0x20000444 = 7; *(uint8_t*)0x20000445 = 0x25; *(uint8_t*)0x20000446 = 1; *(uint8_t*)0x20000447 = 0x80; *(uint8_t*)0x20000448 = 0; *(uint16_t*)0x20000449 = 2; *(uint8_t*)0x2000044b = 9; *(uint8_t*)0x2000044c = 5; *(uint8_t*)0x2000044d = 4; *(uint8_t*)0x2000044e = 0xa; *(uint16_t*)0x2000044f = 0x400; *(uint8_t*)0x20000451 = 0x20; *(uint8_t*)0x20000452 = 9; *(uint8_t*)0x20000453 = 7; *(uint8_t*)0x20000454 = 7; *(uint8_t*)0x20000455 = 0x25; *(uint8_t*)0x20000456 = 1; *(uint8_t*)0x20000457 = 0x81; *(uint8_t*)0x20000458 = 9; *(uint16_t*)0x20000459 = 0xfffd; *(uint8_t*)0x2000045b = 9; *(uint8_t*)0x2000045c = 5; *(uint8_t*)0x2000045d = 9; *(uint8_t*)0x2000045e = 0x10; *(uint16_t*)0x2000045f = 0x400; *(uint8_t*)0x20000461 = 1; *(uint8_t*)0x20000462 = 0x11; *(uint8_t*)0x20000463 = 0x40; *(uint8_t*)0x20000464 = 0xd; *(uint8_t*)0x20000465 = 0x13; memcpy((void*)0x20000466, "\x2c\x25\x0f\x21\xbd\x36\xf9\x29\x20\x66\x76", 11); *(uint8_t*)0x20000471 = 2; *(uint8_t*)0x20000472 = 0x2a; *(uint8_t*)0x20000473 = 9; *(uint8_t*)0x20000474 = 5; *(uint8_t*)0x20000475 = 8; *(uint8_t*)0x20000476 = 0xc; *(uint16_t*)0x20000477 = 0x200; *(uint8_t*)0x20000479 = 0xf1; *(uint8_t*)0x2000047a = 2; *(uint8_t*)0x2000047b = 0x3f; *(uint8_t*)0x2000047c = 2; *(uint8_t*)0x2000047d = 7; *(uint8_t*)0x2000047e = 2; *(uint8_t*)0x2000047f = 0x21; *(uint8_t*)0x20000480 = 9; *(uint8_t*)0x20000481 = 5; *(uint8_t*)0x20000482 = 8; *(uint8_t*)0x20000483 = 4; *(uint16_t*)0x20000484 = 0x200; *(uint8_t*)0x20000486 = 0xe1; *(uint8_t*)0x20000487 = 6; *(uint8_t*)0x20000488 = 0x7f; *(uint8_t*)0x20000489 = 7; *(uint8_t*)0x2000048a = 0x25; *(uint8_t*)0x2000048b = 1; *(uint8_t*)0x2000048c = 0x80; *(uint8_t*)0x2000048d = 0; *(uint16_t*)0x2000048e = 0x8000; *(uint8_t*)0x20000490 = 2; *(uint8_t*)0x20000491 = 0xa; *(uint8_t*)0x20000492 = 9; *(uint8_t*)0x20000493 = 5; *(uint8_t*)0x20000494 = 9; *(uint8_t*)0x20000495 = 0x10; *(uint16_t*)0x20000496 = 0x200; *(uint8_t*)0x20000498 = 0xbf; *(uint8_t*)0x20000499 = 0x7f; *(uint8_t*)0x2000049a = 7; *(uint8_t*)0x2000049b = 7; *(uint8_t*)0x2000049c = 0x25; *(uint8_t*)0x2000049d = 1; *(uint8_t*)0x2000049e = 3; *(uint8_t*)0x2000049f = 1; *(uint16_t*)0x200004a0 = 8; *(uint8_t*)0x200004a2 = 7; *(uint8_t*)0x200004a3 = 0x25; *(uint8_t*)0x200004a4 = 1; *(uint8_t*)0x200004a5 = 2; *(uint8_t*)0x200004a6 = 7; *(uint16_t*)0x200004a7 = 0; *(uint8_t*)0x200004a9 = 9; *(uint8_t*)0x200004aa = 5; *(uint8_t*)0x200004ab = 3; *(uint8_t*)0x200004ac = 0x10; *(uint16_t*)0x200004ad = 0x20; *(uint8_t*)0x200004af = 0; *(uint8_t*)0x200004b0 = 1; *(uint8_t*)0x200004b1 = 7; *(uint8_t*)0x200004b2 = 2; *(uint8_t*)0x200004b3 = 1; *(uint8_t*)0x200004b4 = 9; *(uint8_t*)0x200004b5 = 5; *(uint8_t*)0x200004b6 = 0xc; *(uint8_t*)0x200004b7 = 4; *(uint16_t*)0x200004b8 = 0x40; *(uint8_t*)0x200004ba = 1; *(uint8_t*)0x200004bb = 0x1f; *(uint8_t*)0x200004bc = 0xf7; *(uint8_t*)0x200004bd = 7; *(uint8_t*)0x200004be = 0x25; *(uint8_t*)0x200004bf = 1; *(uint8_t*)0x200004c0 = 1; *(uint8_t*)0x200004c1 = 7; *(uint16_t*)0x200004c2 = 0xf737; *(uint8_t*)0x200004c4 = 2; *(uint8_t*)0x200004c5 = 0x23; *(uint8_t*)0x200004c6 = 9; *(uint8_t*)0x200004c7 = 4; *(uint8_t*)0x200004c8 = 0xcc; *(uint8_t*)0x200004c9 = 0xc0; *(uint8_t*)0x200004ca = 3; *(uint8_t*)0x200004cb = 0x2e; *(uint8_t*)0x200004cc = 0x5a; *(uint8_t*)0x200004cd = 0x5e; *(uint8_t*)0x200004ce = 0x40; *(uint8_t*)0x200004cf = 0xf; *(uint8_t*)0x200004d0 = 0x24; *(uint8_t*)0x200004d1 = 2; *(uint8_t*)0x200004d2 = 2; *(uint16_t*)0x200004d3 = 0x81; *(uint16_t*)0x200004d5 = 7; *(uint8_t*)0x200004d7 = 6; memcpy((void*)0x200004d8, "\x7c\x3c\xee\x59\x82\x17", 6); *(uint8_t*)0x200004de = 9; *(uint8_t*)0x200004df = 5; *(uint8_t*)0x200004e0 = 0xf; *(uint8_t*)0x200004e1 = 0x10; *(uint16_t*)0x200004e2 = 0x20; *(uint8_t*)0x200004e4 = 1; *(uint8_t*)0x200004e5 = 9; *(uint8_t*)0x200004e6 = 0x20; *(uint8_t*)0x200004e7 = 0xe1; *(uint8_t*)0x200004e8 = 7; memcpy( (void*)0x200004e9, "\xda\x91\xaa\xb3\x0a\xa8\x54\x5f\x30\xbb\xf5\x86\x0c\x26\x40\x10\x68\x22" "\x1e\x6e\x76\x53\x76\x88\x37\xa0\xcf\x35\x00\x81\x01\xb5\x16\x5c\x19\x9f" "\x08\x65\x6d\xfe\x96\x99\x25\xc4\xe7\x97\x6b\x6a\xff\x07\xb5\x14\xc3\x62" "\x22\x6f\x68\x20\x98\xfb\xb6\xa7\x11\x85\xb7\xd7\x98\x21\xe3\x3e\xde\xde" "\x10\x41\xa0\x6f\x07\x18\xde\x56\xb2\xe5\xc1\xc1\x28\xa6\x9b\x8c\xd6\x42" "\xb7\xa0\x53\xbf\xfc\xcb\xc5\x9b\x83\x3e\x35\x2c\x0f\xdc\x5f\x24\xb7\x0c" "\xbb\x3c\xfb\xdf\xe7\x3b\xe6\x9c\x48\x42\xde\xd4\xc4\x7b\x1a\xee\x42\x5d" "\xb2\x91\xe9\x7f\xee\x00\x79\x6c\x12\x9d\xaf\xea\xf3\x6f\xfc\xc5\xb5\x55" "\x12\xf6\xd0\xe6\x26\x71\xe8\x02\xca\x89\x86\xb1\x69\x2c\x16\x2c\xfd\x38" "\x47\xe7\x09\x04\x01\xca\x3c\x11\x4a\x31\x07\xb4\xab\xdb\x75\x64\xe7\x09" "\x31\x6f\x30\x26\x97\xe6\xb2\x2b\x6c\xa1\x7c\xb7\x94\xb4\x3a\xca\x8a\x19" "\x14\x83\x98\x74\x25\xa2\xae\x0d\x20\xcb\x20\xa8\xac\xda\x23\xdd\x9b\x5e" "\x36\xb5\x5d\x6b\x02\xb6\x13", 223); *(uint8_t*)0x200005c8 = 9; *(uint8_t*)0x200005c9 = 5; *(uint8_t*)0x200005ca = 0xe; *(uint8_t*)0x200005cb = 0; *(uint16_t*)0x200005cc = 0x10; *(uint8_t*)0x200005ce = 0x3e; *(uint8_t*)0x200005cf = 6; *(uint8_t*)0x200005d0 = 0x8a; *(uint8_t*)0x200005d1 = 7; *(uint8_t*)0x200005d2 = 0x25; *(uint8_t*)0x200005d3 = 1; *(uint8_t*)0x200005d4 = 4; *(uint8_t*)0x200005d5 = 0x60; *(uint16_t*)0x200005d6 = 0x5a6a; *(uint8_t*)0x200005d8 = 7; *(uint8_t*)0x200005d9 = 0x25; *(uint8_t*)0x200005da = 1; *(uint8_t*)0x200005db = 2; *(uint8_t*)0x200005dc = 9; *(uint16_t*)0x200005dd = 7; *(uint8_t*)0x200005df = 9; *(uint8_t*)0x200005e0 = 5; *(uint8_t*)0x200005e1 = 4; *(uint8_t*)0x200005e2 = 0; *(uint16_t*)0x200005e3 = 0x3ff; *(uint8_t*)0x200005e5 = 0xf8; *(uint8_t*)0x200005e6 = 0; *(uint8_t*)0x200005e7 = 0x1f; *(uint8_t*)0x200005e8 = 7; *(uint8_t*)0x200005e9 = 0x25; *(uint8_t*)0x200005ea = 1; *(uint8_t*)0x200005eb = 0x81; *(uint8_t*)0x200005ec = 7; *(uint16_t*)0x200005ed = 9; *(uint8_t*)0x200005ef = 7; *(uint8_t*)0x200005f0 = 0x25; *(uint8_t*)0x200005f1 = 1; *(uint8_t*)0x200005f2 = 2; *(uint8_t*)0x200005f3 = 0; *(uint16_t*)0x200005f4 = 0x40; *(uint32_t*)0x20000d00 = 0; *(uint64_t*)0x20000d04 = 0; *(uint32_t*)0x20000d0c = 0; *(uint64_t*)0x20000d10 = 0; *(uint32_t*)0x20000d18 = 3; *(uint32_t*)0x20000d1c = 0; *(uint64_t*)0x20000d20 = 0; *(uint32_t*)0x20000d28 = 0xff; *(uint64_t*)0x20000d2c = 0x20000b80; *(uint8_t*)0x20000b80 = -1; *(uint8_t*)0x20000b81 = 3; memcpy((void*)0x20000b82, "\x42\xcc\xd4\xcb\xce\xa5\x22\xae\x95\x83\x7e\xc6\x02\x01\x24\x7b\xc0" "\xf8\x7d\x18\x67\xca\x83\xd8\x86\x34\x1f\x76\x00\x73\xae\x19\x17\x06" "\xa2\x4c\x37\xa6\x67\xed\xca\xd1\x3a\x55\x79\x68\xf8\x64\xb4\xd8\x37" "\xc4\x13\x26\x2a\x2b\xc3\x3d\xed\x2b\xa9\xaf\x33\x4f\x82\xac\x8e\x90" "\x4e\xee\x19\xc0\x9b\xd9\x86\x77\xb6\x85\x41\x25\x56\x5c\x47\xbd\xeb" "\x25\x75\x65\xb8\x19\x6a\x99\xe5\x81\x37\x40\xa9\xa3\xaf\x04\x5f\xf8" "\x71\x59\x7c\x29\x36\xca\x8a\x18\x32\x72\xdc\xfb\xbf\xf5\xa0\x8a\x68" "\x29\x48\x52\xe1\xf8\x36\x14\x03\xbf\xd6\xfb\xf3\x71\xa9\xbe\x3d\x03" "\x37\x32\xd1\x99\x0e\x3b\x44\x58\x74\x00\x06\x81\xe4\x62\x0f\xc9\x7c" "\xed\xcd\xe6\xd5\x86\x40\xd7\x09\x44\x53\x02\x63\x39\x64\x28\x5f\xfe" "\x07\xa6\x92\xc6\x1e\xf9\x27\x84\xb9\x51\xad\x36\x08\xf0\xe1\x51\xee" "\x89\xbb\x6b\xd4\xc7\x64\x47\xe8\x27\xca\x34\x18\xf4\xce\x9a\x3d\xb6" "\xf0\x00\x25\x6f\x81\x5c\x8c\x6e\x7f\x77\x2c\x3d\x49\x06\xf6\xcc\x20" "\x03\x6b\x79\x83\x0e\xf8\xb8\xd9\x54\xe5\xb5\xca\x1a\xa0\x31\xf3\xd3" "\x4c\xd0\x10\x93\x9a\xc7\x5d\xa4\xb7\x28\xb9\x62\x1b\x44\xae", 253); *(uint32_t*)0x20000d34 = 0x6d; *(uint64_t*)0x20000d38 = 0x20000c80; *(uint8_t*)0x20000c80 = 0x6d; *(uint8_t*)0x20000c81 = 3; memcpy( (void*)0x20000c82, "\x64\xfc\x00\xa3\x60\x54\x70\xf3\x72\x41\x13\xbb\xc6\x3c\xd1\xfc\x44\x3c" "\xf6\x3a\x29\x2e\x56\xf1\x0a\x48\x84\x74\x07\x0f\x8b\x4a\x44\xeb\xd7\xc8" "\x4a\xc6\xf0\x31\xd7\x61\xb8\x02\x55\xa9\x59\x07\xfb\xa3\xd2\x74\x5e\x5a" "\xbf\xba\x12\x33\x39\xb9\xc0\x85\xab\x6e\xbc\x80\x0a\x26\xf0\xa4\xcb\x10" "\xae\xd6\x06\x9b\x47\xdd\x7c\x8c\xd9\x55\x91\x05\xef\x63\xd1\x1e\xb9\x2f" "\xac\x78\x55\xaa\xdb\x6c\xb8\x66\xa6\x3e\x0d\x98\x20\x45\xc5\x5b\x81", 107); syz_usb_connect(2, 0x4b6, 0x20000140, 0x20000d00); } 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); for (procid = 0; procid < 6; procid++) { if (fork() == 0) { use_temporary_dir(); loop(); } } sleep(1000000); return 0; }