// https://syzkaller.appspot.com/bug?id=c3661bea11c68528ec23d72e3978497a2cfb301b // 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 __NR_ioctl #define __NR_ioctl 29 #endif #ifndef __NR_mmap #define __NR_mmap 222 #endif #ifndef __NR_openat #define __NR_openat 56 #endif #ifndef __NR_sendmsg #define __NR_sendmsg 211 #endif #ifndef __NR_setsockopt #define __NR_setsockopt 208 #endif #ifndef __NR_socket #define __NR_socket 198 #endif #ifndef __NR_timer_settime #define __NR_timer_settime 110 #endif 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 struct usb_device_index* lookup_usb_index(int fd) { for (int i = 0; i < USB_MAX_FDS; i++) { if (__atomic_load_n(&usb_devices[i].fd, __ATOMIC_ACQUIRE) == fd) return &usb_devices[i].index; } return NULL; } static int usb_devices_num; static bool parse_usb_descriptor(const char* buffer, size_t length, struct usb_device_index* index) { if (length < sizeof(*index->dev) + sizeof(*index->config)) return false; memset(index, 0, sizeof(*index)); index->dev = (struct usb_device_descriptor*)buffer; index->config = (struct usb_config_descriptor*)(buffer + sizeof(*index->dev)); index->bDeviceClass = index->dev->bDeviceClass; index->bMaxPower = index->config->bMaxPower; index->config_length = length - sizeof(*index->dev); index->iface_cur = -1; size_t offset = 0; while (true) { if (offset + 1 >= length) break; uint8_t desc_length = buffer[offset]; uint8_t desc_type = buffer[offset + 1]; if (desc_length <= 2) break; if (offset + desc_length > length) break; if (desc_type == USB_DT_INTERFACE && index->ifaces_num < USB_MAX_IFACE_NUM) { struct usb_interface_descriptor* iface = (struct usb_interface_descriptor*)(buffer + offset); index->ifaces[index->ifaces_num].iface = iface; index->ifaces[index->ifaces_num].bInterfaceNumber = iface->bInterfaceNumber; index->ifaces[index->ifaces_num].bAlternateSetting = iface->bAlternateSetting; index->ifaces[index->ifaces_num].bInterfaceClass = iface->bInterfaceClass; index->ifaces_num++; } if (desc_type == USB_DT_ENDPOINT && index->ifaces_num > 0) { struct usb_iface_index* iface = &index->ifaces[index->ifaces_num - 1]; if (iface->eps_num < USB_MAX_EP_NUM) { memcpy(&iface->eps[iface->eps_num].desc, buffer + offset, sizeof(iface->eps[iface->eps_num].desc)); iface->eps_num++; } } offset += desc_length; } return true; } static struct usb_device_index* add_usb_index(int fd, const char* dev, size_t dev_len) { int i = __atomic_fetch_add(&usb_devices_num, 1, __ATOMIC_RELAXED); if (i >= USB_MAX_FDS) return NULL; if (!parse_usb_descriptor(dev, dev_len, &usb_devices[i].index)) return NULL; __atomic_store_n(&usb_devices[i].fd, fd, __ATOMIC_RELEASE); return &usb_devices[i].index; } struct vusb_connect_string_descriptor { uint32_t len; char* str; } __attribute__((packed)); struct vusb_connect_descriptors { uint32_t qual_len; char* qual; uint32_t bos_len; char* bos; uint32_t strs_len; struct vusb_connect_string_descriptor strs[0]; } __attribute__((packed)); static const char default_string[] = {8, USB_DT_STRING, 's', 0, 'y', 0, 'z', 0}; static const char default_lang_id[] = {4, USB_DT_STRING, 0x09, 0x04}; static bool lookup_connect_response_in(int fd, const struct vusb_connect_descriptors* descs, const struct usb_ctrlrequest* ctrl, struct usb_qualifier_descriptor* qual, char** response_data, uint32_t* response_length) { struct usb_device_index* index = lookup_usb_index(fd); uint8_t str_idx; if (!index) return false; switch (ctrl->bRequestType & USB_TYPE_MASK) { case USB_TYPE_STANDARD: switch (ctrl->bRequest) { case USB_REQ_GET_DESCRIPTOR: switch (ctrl->wValue >> 8) { case USB_DT_DEVICE: *response_data = (char*)index->dev; *response_length = sizeof(*index->dev); return true; case USB_DT_CONFIG: *response_data = (char*)index->config; *response_length = index->config_length; return true; case USB_DT_STRING: str_idx = (uint8_t)ctrl->wValue; if (descs && str_idx < descs->strs_len) { *response_data = descs->strs[str_idx].str; *response_length = descs->strs[str_idx].len; return true; } if (str_idx == 0) { *response_data = (char*)&default_lang_id[0]; *response_length = default_lang_id[0]; return true; } *response_data = (char*)&default_string[0]; *response_length = default_string[0]; return true; case USB_DT_BOS: *response_data = descs->bos; *response_length = descs->bos_len; return true; case USB_DT_DEVICE_QUALIFIER: if (!descs->qual) { qual->bLength = sizeof(*qual); qual->bDescriptorType = USB_DT_DEVICE_QUALIFIER; qual->bcdUSB = index->dev->bcdUSB; qual->bDeviceClass = index->dev->bDeviceClass; qual->bDeviceSubClass = index->dev->bDeviceSubClass; qual->bDeviceProtocol = index->dev->bDeviceProtocol; qual->bMaxPacketSize0 = index->dev->bMaxPacketSize0; qual->bNumConfigurations = index->dev->bNumConfigurations; qual->bRESERVED = 0; *response_data = (char*)qual; *response_length = sizeof(*qual); return true; } *response_data = descs->qual; *response_length = descs->qual_len; return true; default: break; } break; default: break; } break; default: break; } return false; } typedef bool (*lookup_connect_out_response_t)( int fd, const struct vusb_connect_descriptors* descs, const struct usb_ctrlrequest* ctrl, bool* done); static bool lookup_connect_response_out_generic( int fd, const struct vusb_connect_descriptors* descs, const struct usb_ctrlrequest* ctrl, bool* done) { switch (ctrl->bRequestType & USB_TYPE_MASK) { case USB_TYPE_STANDARD: switch (ctrl->bRequest) { case USB_REQ_SET_CONFIGURATION: *done = true; return true; default: break; } break; } return false; } #define UDC_NAME_LENGTH_MAX 128 struct usb_raw_init { __u8 driver_name[UDC_NAME_LENGTH_MAX]; __u8 device_name[UDC_NAME_LENGTH_MAX]; __u8 speed; }; enum usb_raw_event_type { USB_RAW_EVENT_INVALID = 0, USB_RAW_EVENT_CONNECT = 1, USB_RAW_EVENT_CONTROL = 2, }; struct usb_raw_event { __u32 type; __u32 length; __u8 data[0]; }; struct usb_raw_ep_io { __u16 ep; __u16 flags; __u32 length; __u8 data[0]; }; #define USB_RAW_EPS_NUM_MAX 30 #define USB_RAW_EP_NAME_MAX 16 #define USB_RAW_EP_ADDR_ANY 0xff struct usb_raw_ep_caps { __u32 type_control : 1; __u32 type_iso : 1; __u32 type_bulk : 1; __u32 type_int : 1; __u32 dir_in : 1; __u32 dir_out : 1; }; struct usb_raw_ep_limits { __u16 maxpacket_limit; __u16 max_streams; __u32 reserved; }; struct usb_raw_ep_info { __u8 name[USB_RAW_EP_NAME_MAX]; __u32 addr; struct usb_raw_ep_caps caps; struct usb_raw_ep_limits limits; }; struct usb_raw_eps_info { struct usb_raw_ep_info eps[USB_RAW_EPS_NUM_MAX]; }; #define USB_RAW_IOCTL_INIT _IOW('U', 0, struct usb_raw_init) #define USB_RAW_IOCTL_RUN _IO('U', 1) #define USB_RAW_IOCTL_EVENT_FETCH _IOR('U', 2, struct usb_raw_event) #define USB_RAW_IOCTL_EP0_WRITE _IOW('U', 3, struct usb_raw_ep_io) #define USB_RAW_IOCTL_EP0_READ _IOWR('U', 4, struct usb_raw_ep_io) #define USB_RAW_IOCTL_EP_ENABLE _IOW('U', 5, struct usb_endpoint_descriptor) #define USB_RAW_IOCTL_EP_DISABLE _IOW('U', 6, __u32) #define USB_RAW_IOCTL_EP_WRITE _IOW('U', 7, struct usb_raw_ep_io) #define USB_RAW_IOCTL_EP_READ _IOWR('U', 8, struct usb_raw_ep_io) #define USB_RAW_IOCTL_CONFIGURE _IO('U', 9) #define USB_RAW_IOCTL_VBUS_DRAW _IOW('U', 10, __u32) #define USB_RAW_IOCTL_EPS_INFO _IOR('U', 11, struct usb_raw_eps_info) #define USB_RAW_IOCTL_EP0_STALL _IO('U', 12) #define USB_RAW_IOCTL_EP_SET_HALT _IOW('U', 13, __u32) #define USB_RAW_IOCTL_EP_CLEAR_HALT _IOW('U', 14, __u32) #define USB_RAW_IOCTL_EP_SET_WEDGE _IOW('U', 15, __u32) static int usb_raw_open() { return open("/dev/raw-gadget", O_RDWR); } static int usb_raw_init(int fd, uint32_t speed, const char* driver, const char* device) { struct usb_raw_init arg; strncpy((char*)&arg.driver_name[0], driver, sizeof(arg.driver_name)); strncpy((char*)&arg.device_name[0], device, sizeof(arg.device_name)); arg.speed = speed; return ioctl(fd, USB_RAW_IOCTL_INIT, &arg); } static int usb_raw_run(int fd) { return ioctl(fd, USB_RAW_IOCTL_RUN, 0); } static int usb_raw_configure(int fd) { return ioctl(fd, USB_RAW_IOCTL_CONFIGURE, 0); } static int usb_raw_vbus_draw(int fd, uint32_t power) { return ioctl(fd, USB_RAW_IOCTL_VBUS_DRAW, power); } static int usb_raw_ep0_write(int fd, struct usb_raw_ep_io* io) { return ioctl(fd, USB_RAW_IOCTL_EP0_WRITE, io); } static int usb_raw_ep0_read(int fd, struct usb_raw_ep_io* io) { return ioctl(fd, USB_RAW_IOCTL_EP0_READ, io); } static int usb_raw_event_fetch(int fd, struct usb_raw_event* event) { return ioctl(fd, USB_RAW_IOCTL_EVENT_FETCH, event); } static int usb_raw_ep_enable(int fd, struct usb_endpoint_descriptor* desc) { return ioctl(fd, USB_RAW_IOCTL_EP_ENABLE, desc); } static int usb_raw_ep_disable(int fd, int ep) { return ioctl(fd, USB_RAW_IOCTL_EP_DISABLE, ep); } static int usb_raw_ep0_stall(int fd) { return ioctl(fd, USB_RAW_IOCTL_EP0_STALL, 0); } #define USB_MAX_PACKET_SIZE 4096 struct usb_raw_control_event { struct usb_raw_event inner; struct usb_ctrlrequest ctrl; char data[USB_MAX_PACKET_SIZE]; }; struct usb_raw_ep_io_data { struct usb_raw_ep_io inner; char data[USB_MAX_PACKET_SIZE]; }; static void set_interface(int fd, int n) { struct usb_device_index* index = lookup_usb_index(fd); if (!index) return; if (index->iface_cur >= 0 && index->iface_cur < index->ifaces_num) { for (int ep = 0; ep < index->ifaces[index->iface_cur].eps_num; ep++) { int rv = usb_raw_ep_disable( fd, index->ifaces[index->iface_cur].eps[ep].handle); if (rv < 0) { } else { } } } if (n >= 0 && n < index->ifaces_num) { for (int ep = 0; ep < index->ifaces[n].eps_num; ep++) { int rv = usb_raw_ep_enable(fd, &index->ifaces[n].eps[ep].desc); if (rv < 0) { } else { index->ifaces[n].eps[ep].handle = rv; } } index->iface_cur = n; } } static int configure_device(int fd) { struct usb_device_index* index = lookup_usb_index(fd); if (!index) return -1; int rv = usb_raw_vbus_draw(fd, index->bMaxPower); if (rv < 0) { return rv; } rv = usb_raw_configure(fd); if (rv < 0) { return rv; } set_interface(fd, 0); return 0; } static volatile long syz_usb_connect_impl(uint64_t speed, uint64_t dev_len, const char* dev, const struct vusb_connect_descriptors* descs, lookup_connect_out_response_t lookup_connect_response_out) { if (!dev) { return -1; } int fd = usb_raw_open(); if (fd < 0) { return fd; } if (fd >= MAX_FDS) { close(fd); return -1; } struct usb_device_index* index = add_usb_index(fd, dev, dev_len); if (!index) { return -1; } char device[32]; sprintf(&device[0], "dummy_udc.%llu", procid); int rv = usb_raw_init(fd, speed, "dummy_udc", &device[0]); if (rv < 0) { return rv; } rv = usb_raw_run(fd); if (rv < 0) { return rv; } bool done = false; while (!done) { struct usb_raw_control_event event; event.inner.type = 0; event.inner.length = sizeof(event.ctrl); rv = usb_raw_event_fetch(fd, (struct usb_raw_event*)&event); if (rv < 0) { return rv; } if (event.inner.type != USB_RAW_EVENT_CONTROL) continue; char* response_data = NULL; uint32_t response_length = 0; struct usb_qualifier_descriptor qual; if (event.ctrl.bRequestType & USB_DIR_IN) { if (!lookup_connect_response_in(fd, descs, &event.ctrl, &qual, &response_data, &response_length)) { usb_raw_ep0_stall(fd); continue; } } else { if (!lookup_connect_response_out(fd, descs, &event.ctrl, &done)) { usb_raw_ep0_stall(fd); continue; } response_data = NULL; response_length = event.ctrl.wLength; } if ((event.ctrl.bRequestType & USB_TYPE_MASK) == USB_TYPE_STANDARD && event.ctrl.bRequest == USB_REQ_SET_CONFIGURATION) { rv = configure_device(fd); if (rv < 0) { return rv; } } struct usb_raw_ep_io_data response; response.inner.ep = 0; response.inner.flags = 0; if (response_length > sizeof(response.data)) response_length = 0; if (event.ctrl.wLength < response_length) response_length = event.ctrl.wLength; response.inner.length = response_length; if (response_data) memcpy(&response.data[0], response_data, response_length); else memset(&response.data[0], 0, response_length); if (event.ctrl.bRequestType & USB_DIR_IN) { rv = usb_raw_ep0_write(fd, (struct usb_raw_ep_io*)&response); } else { rv = usb_raw_ep0_read(fd, (struct usb_raw_ep_io*)&response); } if (rv < 0) { return rv; } } sleep_ms(200); return fd; } static volatile long syz_usb_connect(volatile long a0, volatile long a1, volatile long a2, volatile long a3) { uint64_t speed = a0; uint64_t dev_len = a1; const char* dev = (const char*)a2; const struct vusb_connect_descriptors* descs = (const struct vusb_connect_descriptors*)a3; return syz_usb_connect_impl(speed, dev_len, dev, descs, &lookup_connect_response_out_generic); } 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"); } 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 (;;) { sleep_ms(10); if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; if (current_time_ms() - start < 15000) continue; kill_and_wait(pid, &status); break; } } } uint64_t r[3] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; void execute_one(void) { intptr_t res = 0; if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } syscall(__NR_timer_settime, /*timerid=*/0, /*flags=TIMER_ABSTIME*/ 1ul, /*new=*/0ul, /*old=*/0ul); res = syscall(__NR_socket, /*domain=*/0xaul, /*type=*/2ul, /*proto=*/0); if (res != -1) r[0] = res; syscall(__NR_ioctl, /*fd=*/-1, /*cmd=*/0x8933, /*arg=*/0ul); *(uint8_t*)0x20000140 = 0x12; *(uint8_t*)0x20000141 = 1; *(uint16_t*)0x20000142 = 0x300; *(uint8_t*)0x20000144 = 0x3c; *(uint8_t*)0x20000145 = 0x3b; *(uint8_t*)0x20000146 = 0xa8; *(uint8_t*)0x20000147 = 0x20; *(uint16_t*)0x20000148 = 0x424; *(uint16_t*)0x2000014a = 0xcf30; *(uint16_t*)0x2000014c = 0xcff0; *(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 = 0x380; *(uint8_t*)0x20000156 = 1; *(uint8_t*)0x20000157 = 2; *(uint8_t*)0x20000158 = 7; *(uint8_t*)0x20000159 = 0x90; *(uint8_t*)0x2000015a = 0x75; *(uint8_t*)0x2000015b = 9; *(uint8_t*)0x2000015c = 4; *(uint8_t*)0x2000015d = 0xf0; *(uint8_t*)0x2000015e = 0x39; *(uint8_t*)0x2000015f = 0xc; *(uint8_t*)0x20000160 = 0xb5; *(uint8_t*)0x20000161 = 0x9d; *(uint8_t*)0x20000162 = 0x1f; *(uint8_t*)0x20000163 = 0xe; *(uint8_t*)0x20000164 = 0xa; *(uint8_t*)0x20000165 = 0x24; *(uint8_t*)0x20000166 = 1; *(uint16_t*)0x20000167 = 5; *(uint8_t*)0x20000169 = 8; *(uint8_t*)0x2000016a = 2; *(uint8_t*)0x2000016b = 1; *(uint8_t*)0x2000016c = 2; *(uint8_t*)0x2000016d = 5; *(uint8_t*)0x2000016e = 0x24; *(uint8_t*)0x2000016f = 6; *(uint8_t*)0x20000170 = 0; *(uint8_t*)0x20000171 = 1; *(uint8_t*)0x20000172 = 5; *(uint8_t*)0x20000173 = 0x24; *(uint8_t*)0x20000174 = 0; *(uint16_t*)0x20000175 = 3; *(uint8_t*)0x20000177 = 0xd; *(uint8_t*)0x20000178 = 0x24; *(uint8_t*)0x20000179 = 0xf; *(uint8_t*)0x2000017a = 1; *(uint32_t*)0x2000017b = 0; *(uint16_t*)0x2000017f = 1; *(uint16_t*)0x20000181 = 2; *(uint8_t*)0x20000183 = 8; *(uint8_t*)0x20000184 = 6; *(uint8_t*)0x20000185 = 0x24; *(uint8_t*)0x20000186 = 0x1a; *(uint16_t*)0x20000187 = 4; *(uint8_t*)0x20000189 = 0x12; *(uint8_t*)0x2000018a = 9; *(uint8_t*)0x2000018b = 5; *(uint8_t*)0x2000018c = 4; *(uint8_t*)0x2000018d = 0; *(uint16_t*)0x2000018e = 0x200; *(uint8_t*)0x20000190 = 0; *(uint8_t*)0x20000191 = 5; *(uint8_t*)0x20000192 = 0xf7; *(uint8_t*)0x20000193 = 2; *(uint8_t*)0x20000194 = 9; *(uint8_t*)0x20000195 = 9; *(uint8_t*)0x20000196 = 5; *(uint8_t*)0x20000197 = 0xb; *(uint8_t*)0x20000198 = 0; *(uint16_t*)0x20000199 = 0x200; *(uint8_t*)0x2000019b = 0x29; *(uint8_t*)0x2000019c = 0x12; *(uint8_t*)0x2000019d = 9; *(uint8_t*)0x2000019e = 7; *(uint8_t*)0x2000019f = 0x25; *(uint8_t*)0x200001a0 = 1; *(uint8_t*)0x200001a1 = 2; *(uint8_t*)0x200001a2 = 0xf8; *(uint16_t*)0x200001a3 = 1; *(uint8_t*)0x200001a5 = 9; *(uint8_t*)0x200001a6 = 5; *(uint8_t*)0x200001a7 = 0; *(uint8_t*)0x200001a8 = 3; *(uint16_t*)0x200001a9 = 8; *(uint8_t*)0x200001ab = 5; *(uint8_t*)0x200001ac = 4; *(uint8_t*)0x200001ad = 0; *(uint8_t*)0x200001ae = 7; *(uint8_t*)0x200001af = 0x25; *(uint8_t*)0x200001b0 = 1; *(uint8_t*)0x200001b1 = 0; *(uint8_t*)0x200001b2 = 0xe; *(uint16_t*)0x200001b3 = 0; *(uint8_t*)0x200001b5 = 0x70; *(uint8_t*)0x200001b6 = 0x21; memcpy((void*)0x200001b7, "\x15\x41\x2c\xb3\x21\xb2\xf0\x3c\xb3\xac\xf2\xbd\x9c\x46\x33\xcb\x01" "\xe4\x8e\x21\x26\x00\x6a\x2e\x30\x4d\xbb\x9f\x13\x44\xb2\xdd\xff\x3a" "\xf0\xc0\xc6\x0a\x70\x09\x5c\x6b\x86\x1d\x9e\x66\xa3\x42\xf9\x5b\x49" "\x43\xa5\x42\x5b\x84\xb8\xc4\x22\x4f\x51\x69\x78\x91\xda\x4f\x2b\x92" "\x11\xc0\xa8\x9e\xa3\xc0\xae\xfb\x12\x13\x40\xd8\x3b\xc2\x09\x4f\xfb" "\x68\xd2\xfd\xb5\xb8\x82\xd3\xeb\x5a\x4a\x64\x36\xde\xfe\x97\x83\x52" "\x21\x2e\x31\x9a\x31\x0e\x99\x54", 110); *(uint8_t*)0x20000225 = 9; *(uint8_t*)0x20000226 = 5; *(uint8_t*)0x20000227 = 9; *(uint8_t*)0x20000228 = 1; *(uint16_t*)0x20000229 = 0x20; *(uint8_t*)0x2000022b = 0x22; *(uint8_t*)0x2000022c = 0x9b; *(uint8_t*)0x2000022d = 4; *(uint8_t*)0x2000022e = 0x30; *(uint8_t*)0x2000022f = 0xf; memcpy((void*)0x20000230, "\x1f\xea\x84\xd7\x6e\x4e\xe6\x93\xd2\x20\x11\xf8\x69\x00\x63\x83\x54" "\xb1\x29\x4f\xef\xea\x27\x97\x60\x8f\x12\x63\x20\xa5\xd1\x86\xa1\xc4" "\x58\xa7\x75\xa0\x4d\x24\xe7\xd3\x37\xa4\xe3\xc7", 46); *(uint8_t*)0x2000025e = 9; *(uint8_t*)0x2000025f = 5; *(uint8_t*)0x20000260 = 6; *(uint8_t*)0x20000261 = 0; *(uint16_t*)0x20000262 = 0x40; *(uint8_t*)0x20000264 = 0x80; *(uint8_t*)0x20000265 = 4; *(uint8_t*)0x20000266 = 6; *(uint8_t*)0x20000267 = 7; *(uint8_t*)0x20000268 = 0x25; *(uint8_t*)0x20000269 = 1; *(uint8_t*)0x2000026a = 0x82; *(uint8_t*)0x2000026b = 3; *(uint16_t*)0x2000026c = 3; *(uint8_t*)0x2000026e = 9; *(uint8_t*)0x2000026f = 5; *(uint8_t*)0x20000270 = 2; *(uint8_t*)0x20000271 = 0x10; *(uint16_t*)0x20000272 = 0x40; *(uint8_t*)0x20000274 = 0x3f; *(uint8_t*)0x20000275 = 5; *(uint8_t*)0x20000276 = 7; *(uint8_t*)0x20000277 = 7; *(uint8_t*)0x20000278 = 0x25; *(uint8_t*)0x20000279 = 1; *(uint8_t*)0x2000027a = 0x40; *(uint8_t*)0x2000027b = 4; *(uint16_t*)0x2000027c = 0x40; *(uint8_t*)0x2000027e = 0x51; *(uint8_t*)0x2000027f = 0xb; memcpy((void*)0x20000280, "\xcb\xf5\xed\x64\xf9\x85\x55\x19\x4c\x7d\x4a\xca\xc6\x8d\xa2\xc1\x45" "\x50\x3d\x6d\x6f\xb3\x9e\x6c\x58\x1f\x75\x9f\x82\xb3\x10\x20\x1d\x6a" "\xe4\x49\x2b\xe9\xa2\x5c\xf4\xbb\x7d\x1c\x7d\xb3\xeb\x1a\x54\x89\x60" "\xfd\x73\x89\x4b\xfe\xc0\xcf\x0c\x13\xd0\x7f\xda\x66\xaf\x35\xc6\xf5" "\x18\x66\xb9\xb2\x2d\x63\x5c\xa7\xb0\xcc\xe3", 79); *(uint8_t*)0x200002cf = 9; *(uint8_t*)0x200002d0 = 5; *(uint8_t*)0x200002d1 = 6; *(uint8_t*)0x200002d2 = 4; *(uint16_t*)0x200002d3 = 0x10; *(uint8_t*)0x200002d5 = 6; *(uint8_t*)0x200002d6 = 4; *(uint8_t*)0x200002d7 = 9; *(uint8_t*)0x200002d8 = 9; *(uint8_t*)0x200002d9 = 5; *(uint8_t*)0x200002da = 0xb; *(uint8_t*)0x200002db = 0; *(uint16_t*)0x200002dc = 0x40; *(uint8_t*)0x200002de = 4; *(uint8_t*)0x200002df = 9; *(uint8_t*)0x200002e0 = 0x80; *(uint8_t*)0x200002e1 = 2; *(uint8_t*)0x200002e2 = 0x22; *(uint8_t*)0x200002e3 = 9; *(uint8_t*)0x200002e4 = 5; *(uint8_t*)0x200002e5 = 7; *(uint8_t*)0x200002e6 = 0x10; *(uint16_t*)0x200002e7 = 0x10; *(uint8_t*)0x200002e9 = 0x10; *(uint8_t*)0x200002ea = 0xfb; *(uint8_t*)0x200002eb = 6; *(uint8_t*)0x200002ec = 7; *(uint8_t*)0x200002ed = 0x25; *(uint8_t*)0x200002ee = 1; *(uint8_t*)0x200002ef = 3; *(uint8_t*)0x200002f0 = 0; *(uint16_t*)0x200002f1 = 0xfbff; *(uint8_t*)0x200002f3 = 9; *(uint8_t*)0x200002f4 = 5; *(uint8_t*)0x200002f5 = 7; *(uint8_t*)0x200002f6 = 0; *(uint16_t*)0x200002f7 = 0x10; *(uint8_t*)0x200002f9 = 8; *(uint8_t*)0x200002fa = 8; *(uint8_t*)0x200002fb = 6; *(uint8_t*)0x200002fc = 0xce; *(uint8_t*)0x200002fd = 5; memcpy((void*)0x200002fe, "\x5c\xb7\xa1\xc6\xbc\x54\xf6\xc8\xd4\x78\xa5\x88\x04\x41\xbd\xe2\x0f" "\x2e\x3c\x8c\xa7\x48\x6d\x61\xa2\x53\xa3\x66\x00\x5c\xd0\x17\xd6\x06" "\xc8\x2f\xd6\x28\xf5\x9f\x0b\x3d\xa4\xb3\x55\x48\x85\xd7\x1c\x9c\x86" "\xce\xfe\xdb\xc0\x0a\xfc\xd3\x96\x8a\x4b\x6f\x0c\xa1\x4c\x13\xb7\xcd" "\x5d\xf4\x26\xbe\xa6\xeb\x56\x0f\x3f\x8e\xf7\x6b\x10\x39\x5b\xe5\x20" "\x93\x67\x26\x02\xac\x84\x5f\x76\x06\x7e\xcc\x8f\xd9\x0b\xf1\x56\x18" "\x99\xa8\xd5\xf9\x23\xea\x52\x54\xec\x46\x04\xb4\x55\x98\x65\x59\xf2" "\x3e\x8d\xe0\x4e\xef\x5a\x29\x7e\xf9\xe8\xdb\x48\x7b\xfc\x11\xbc\x82" "\xf0\x3b\x02\x67\x00\x40\xe0\x6b\x83\x92\xff\xff\xc8\x80\x7c\xe3\xbf" "\x24\x49\x3e\xb8\x5b\xcc\x95\x3c\xeb\x8b\x42\x2a\x1f\xfe\x7c\xa2\x8f" "\xb1\x90\x79\x99\x98\xa6\xb2\xa2\x18\x28\xbf\x05\x0f\xe9\x0d\x01\x50" "\xd8\xac\x5d\xfc\xbc\x6d\xb7\xb6\xcc\xc5\xd2\x3e\x7d\x05\x18\xc1\x2c", 204); *(uint8_t*)0x200003ca = 9; *(uint8_t*)0x200003cb = 5; *(uint8_t*)0x200003cc = 9; *(uint8_t*)0x200003cd = 8; *(uint16_t*)0x200003ce = 0x10; *(uint8_t*)0x200003d0 = 6; *(uint8_t*)0x200003d1 = 4; *(uint8_t*)0x200003d2 = 1; *(uint8_t*)0x200003d3 = 9; *(uint8_t*)0x200003d4 = 5; *(uint8_t*)0x200003d5 = 0xc; *(uint8_t*)0x200003d6 = 0xc; *(uint16_t*)0x200003d7 = 0x40; *(uint8_t*)0x200003d9 = 0x80; *(uint8_t*)0x200003da = 4; *(uint8_t*)0x200003db = 0xf9; *(uint8_t*)0x200003dc = 0xf4; *(uint8_t*)0x200003dd = 6; memcpy( (void*)0x200003de, "\xe3\xb5\x22\x6f\xd7\x5a\x86\x00\xfe\x57\x2c\x56\xf6\x62\x44\xe6\x72\xb1" "\x63\x57\x3b\x5b\x02\xb8\x10\x98\x94\x9a\xa8\xbb\x92\xb2\x28\xaa\x62\x06" "\x7b\x41\x69\xbe\x19\x01\x9e\x97\xd1\x79\x46\xb3\x34\xaf\xc4\xa4\x6d\x92" "\xc0\x35\x06\x90\x2f\xe1\x96\x8e\x54\xbc\xec\xb2\x56\x41\x5d\x71\x9b\xd2" "\x68\xd1\x19\xda\x3f\xf1\x85\x33\x8d\x17\x54\x8f\xcc\x65\xda\xc4\xd7\xc7" "\x3d\x40\x09\x06\xa9\xb6\xbd\xa5\x7d\xe1\xea\xc7\xf8\x78\x7c\x67\xe5\x11" "\x96\xb6\x25\x88\xe4\x3e\x3f\xdc\xb5\xe9\xba\x8e\x00\x54\x58\x35\x66\x05" "\x0e\x0d\xba\xb4\x9f\x8f\xf0\x74\x12\x4f\x95\xfa\xa9\x5f\x6e\x64\x33\xbd" "\x1e\x0c\xa5\xa6\x2d\xca\x75\xfe\x3b\x02\x8c\x9f\x57\x96\x57\x5e\xf2\xb1" "\x18\xc4\x3c\xab\x8e\x1a\x01\xcb\xa0\x0f\xeb\xa8\xa4\x25\x0f\x09\xc7\x07" "\x1b\x7a\x10\xef\xbe\x0d\xe4\x1f\x95\x57\xb4\xaa\x3a\x4b\x25\x0c\x14\xc9" "\x6b\x95\xd0\xc5\x23\xf6\xf2\xcd\x1c\x7e\x3b\xf9\xe9\x00\xb9\xa2\xa3\xf0" "\x9b\x86\xfe\xde\xc8\xdd\xf2\xfd\xef\x5a\xd1\x8a\xb4\x04\x03\xcd\x21\x4f" "\x0f\x88\xca\x70\x1d\xbd\x18\xfc", 242); *(uint8_t*)0x200004d0 = 2; *(uint8_t*)0x200004d1 = 0xf; *(uint32_t*)0x20000740 = 0xa; *(uint64_t*)0x20000744 = 0x200006c0; *(uint8_t*)0x200006c0 = 0xa; *(uint8_t*)0x200006c1 = 6; *(uint16_t*)0x200006c2 = 0x200; *(uint8_t*)0x200006c4 = 2; *(uint8_t*)0x200006c5 = 0xb; *(uint8_t*)0x200006c6 = 8; *(uint8_t*)0x200006c7 = 0; *(uint8_t*)0x200006c8 = 0xa6; *(uint8_t*)0x200006c9 = 0; *(uint32_t*)0x2000074c = 5; *(uint64_t*)0x20000750 = 0x20000700; *(uint8_t*)0x20000700 = 5; *(uint8_t*)0x20000701 = 0xf; *(uint16_t*)0x20000702 = 5; *(uint8_t*)0x20000704 = 0; *(uint32_t*)0x20000758 = 0; syz_usb_connect(/*speed=USB_SPEED_HIGH*/ 3, /*dev_len=*/0x392, /*dev=*/0x20000140, /*conn_descs=*/0x20000740); syscall(__NR_ioctl, /*fd=*/-1, /*cmd=*/0x4b64, /*arg=*/0x200007c0ul); *(uint8_t*)0x20000800 = 0x12; *(uint8_t*)0x20000801 = 1; *(uint16_t*)0x20000802 = 0x110; *(uint8_t*)0x20000804 = 0; *(uint8_t*)0x20000805 = 0; *(uint8_t*)0x20000806 = 0; *(uint8_t*)0x20000807 = 0x10; *(uint16_t*)0x20000808 = 0x525; *(uint16_t*)0x2000080a = 0xa4a8; *(uint16_t*)0x2000080c = 0x40; *(uint8_t*)0x2000080e = 1; *(uint8_t*)0x2000080f = 2; *(uint8_t*)0x20000810 = 3; *(uint8_t*)0x20000811 = 1; *(uint8_t*)0x20000812 = 9; *(uint8_t*)0x20000813 = 2; *(uint16_t*)0x20000814 = 0x24; *(uint8_t*)0x20000816 = 1; *(uint8_t*)0x20000817 = 1; *(uint8_t*)0x20000818 = 6; *(uint8_t*)0x20000819 = 0x50; *(uint8_t*)0x2000081a = 0xea; *(uint8_t*)0x2000081b = 9; *(uint8_t*)0x2000081c = 4; *(uint8_t*)0x2000081d = 0; *(uint8_t*)0x2000081e = 0x7f; *(uint8_t*)0x2000081f = 5; *(uint8_t*)0x20000820 = 7; *(uint8_t*)0x20000821 = 1; *(uint8_t*)0x20000822 = 2; *(uint8_t*)0x20000823 = 0x34; *(uint8_t*)0x20000824 = 9; *(uint8_t*)0x20000825 = 5; *(uint8_t*)0x20000826 = 1; *(uint8_t*)0x20000827 = 2; *(uint16_t*)0x20000828 = 0x20; *(uint8_t*)0x2000082a = 0x10; *(uint8_t*)0x2000082b = 1; *(uint8_t*)0x2000082c = 0x80; *(uint8_t*)0x2000082d = 9; *(uint8_t*)0x2000082e = 5; *(uint8_t*)0x2000082f = 0x82; *(uint8_t*)0x20000830 = 2; *(uint16_t*)0x20000831 = 0x10; *(uint8_t*)0x20000833 = 9; *(uint8_t*)0x20000834 = 0; *(uint8_t*)0x20000835 = 0x28; *(uint32_t*)0x20000980 = 0; *(uint64_t*)0x20000984 = 0; *(uint32_t*)0x2000098c = 0; *(uint64_t*)0x20000990 = 0; *(uint32_t*)0x20000998 = 3; *(uint32_t*)0x2000099c = 0; *(uint64_t*)0x200009a0 = 0; *(uint32_t*)0x200009a8 = 0; *(uint64_t*)0x200009ac = 0; *(uint32_t*)0x200009b4 = 4; *(uint64_t*)0x200009b8 = 0x20000940; *(uint8_t*)0x20000940 = 4; *(uint8_t*)0x20000941 = 3; *(uint16_t*)0x20000942 = 0x1009; syz_usb_connect(/*speed=USB_SPEED_HIGH*/ 3, /*dev_len=*/0x36, /*dev=*/0x20000800, /*conn_descs=*/0x20000980); syscall(__NR_ioctl, /*fd=*/-1, /*cmd=*/0x4b3a, /*arg=*/1ul); syscall(__NR_ioctl, /*fd=*/-1, /*cmd=*/0x4b65, /*arg=*/3ul); syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x89f1, /*arg=*/0ul); memcpy((void*)0x20001080, "syztnl2\000\000\000\000\000\000\000\000\000", 16); *(uint64_t*)0x20001090 = 0x20001000; memcpy((void*)0x20001000, "syztnl2\000\000\000\000\000\000\000\000\000", 16); *(uint32_t*)0x20001010 = 0; *(uint8_t*)0x20001014 = 0x2f; *(uint8_t*)0x20001015 = 9; *(uint8_t*)0x20001016 = 9; *(uint32_t*)0x20001018 = htobe32(4); *(uint32_t*)0x2000101c = 0x2c; *(uint8_t*)0x20001020 = 0xfc; *(uint8_t*)0x20001021 = 0; memset((void*)0x20001022, 0, 13); *(uint8_t*)0x2000102f = 0; *(uint8_t*)0x20001030 = 0xfe; *(uint8_t*)0x20001031 = 0x80; memset((void*)0x20001032, 0, 13); *(uint8_t*)0x2000103f = 0xaa; *(uint16_t*)0x20001040 = htobe16(0x20); *(uint16_t*)0x20001042 = htobe16(0x80); *(uint32_t*)0x20001044 = htobe32(4); *(uint32_t*)0x20001048 = htobe32(1); syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x89f2, /*arg=*/0x20001080ul); syscall(__NR_socket, /*domain=*/2ul, /*type=*/1ul, /*proto=*/0); syscall(__NR_ioctl, /*fd=*/-1, /*cmd=*/0x5410, /*arg=*/0ul); *(uint16_t*)0x20001140 = 2; *(uint16_t*)0x20001142 = 7; syscall(__NR_setsockopt, /*fd=*/-1, /*level=*/0x107, /*optname=*/0x12, /*optval=*/0x20001140ul, /*optlen=*/4ul); *(uint32_t*)0x200011c0 = 1; *(uint32_t*)0x200011c4 = 1; *(uint32_t*)0x200011c8 = 0x18; *(uint32_t*)0x200011cc = r[0]; memcpy((void*)0x200011d8, "./file0\000", 8); res = syscall(__NR_ioctl, /*fd=*/-1, /*cmd=*/0xc0189379, /*arg=*/0x200011c0ul); if (res != -1) r[1] = *(uint32_t*)0x200011cc; *(uint64_t*)0x200012c0 = 0; *(uint32_t*)0x200012c8 = 0; *(uint64_t*)0x200012d0 = 0x20001280; *(uint64_t*)0x20001280 = 0x20001240; *(uint32_t*)0x20001240 = 0x14; *(uint8_t*)0x20001244 = 4; *(uint8_t*)0x20001245 = 1; *(uint16_t*)0x20001246 = 0x101; *(uint32_t*)0x20001248 = 0; *(uint32_t*)0x2000124c = 0; *(uint8_t*)0x20001250 = 9; *(uint8_t*)0x20001251 = 0; *(uint16_t*)0x20001252 = htobe16(3); *(uint64_t*)0x20001288 = 0x14; *(uint64_t*)0x200012d8 = 1; *(uint64_t*)0x200012e0 = 0; *(uint64_t*)0x200012e8 = 0; *(uint32_t*)0x200012f0 = 0x44000; syscall(__NR_sendmsg, /*fd=*/r[1], /*msg=*/0x200012c0ul, /*f=MSG_OOB|MSG_MORE*/ 0x8001ul); res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0ul, /*flags=O_LARGEFILE|O_DIRECT|O_APPEND*/ 0x30400, /*mode=*/0); if (res != -1) r[2] = res; syscall(__NR_ioctl, /*fd=*/r[2], /*cmd=*/0x127d, /*arg=*/0ul); syscall(__NR_ioctl, /*fd=*/r[1], /*cmd=*/0xae80, /*arg=*/0ul); } int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x20000000ul, /*len=*/0x1000000ul, /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/ 7ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x21000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1, /*offset=*/0ul); const char* reason; (void)reason; loop(); return 0; }