// https://syzkaller.appspot.com/bug?id=f34aaaca22b6590b45be3c10114cf04f402cfdc0 // 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 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifndef __NR_memfd_create #define __NR_memfd_create 319 #endif #ifndef __NR_pwritev2 #define __NR_pwritev2 328 #endif static unsigned long long procid; static __thread int clone_ongoing; static __thread int skip_segv; static __thread jmp_buf segv_env; static void segv_handler(int sig, siginfo_t* info, void* ctx) { if (__atomic_load_n(&clone_ongoing, __ATOMIC_RELAXED) != 0) { exit(sig); } uintptr_t addr = (uintptr_t)info->si_addr; const uintptr_t prog_start = 1 << 20; const uintptr_t prog_end = 100 << 20; int skip = __atomic_load_n(&skip_segv, __ATOMIC_RELAXED) != 0; int valid = addr < prog_start || addr > prog_end; if (skip && valid) { _longjmp(segv_env, 1); } exit(sig); } static void install_segv_handler(void) { struct sigaction sa; memset(&sa, 0, sizeof(sa)); sa.sa_handler = SIG_IGN; syscall(SYS_rt_sigaction, 0x20, &sa, NULL, 8); syscall(SYS_rt_sigaction, 0x21, &sa, NULL, 8); memset(&sa, 0, sizeof(sa)); sa.sa_sigaction = segv_handler; sa.sa_flags = SA_NODEFER | SA_SIGINFO; sigaction(SIGSEGV, &sa, NULL); sigaction(SIGBUS, &sa, NULL); } #define NONFAILING(...) \ ({ \ int ok = 1; \ __atomic_fetch_add(&skip_segv, 1, __ATOMIC_SEQ_CST); \ if (_setjmp(segv_env) == 0) { \ __VA_ARGS__; \ } else \ ok = 0; \ __atomic_fetch_sub(&skip_segv, 1, __ATOMIC_SEQ_CST); \ ok; \ }) 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 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 { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); syscall(SYS_futex, &ev->state, FUTEX_WAKE | FUTEX_PRIVATE_FLAG, 1000000); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, 0); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; for (;;) { uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, &ts); if (__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) return 1; now = current_time_ms(); if (now - start > timeout) return 0; } } 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; } struct nlmsg { char* pos; int nesting; struct nlattr* nested[8]; char buf[4096]; }; static void netlink_init(struct nlmsg* nlmsg, int typ, int flags, const void* data, int size) { memset(nlmsg, 0, sizeof(*nlmsg)); struct nlmsghdr* hdr = (struct nlmsghdr*)nlmsg->buf; hdr->nlmsg_type = typ; hdr->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK | flags; memcpy(hdr + 1, data, size); nlmsg->pos = (char*)(hdr + 1) + NLMSG_ALIGN(size); } static void netlink_attr(struct nlmsg* nlmsg, int typ, const void* data, int size) { struct nlattr* attr = (struct nlattr*)nlmsg->pos; attr->nla_len = sizeof(*attr) + size; attr->nla_type = typ; if (size > 0) memcpy(attr + 1, data, size); nlmsg->pos += NLMSG_ALIGN(attr->nla_len); } static int netlink_send_ext(struct nlmsg* nlmsg, int sock, uint16_t reply_type, int* reply_len, bool dofail) { if (nlmsg->pos > nlmsg->buf + sizeof(nlmsg->buf) || nlmsg->nesting) exit(1); struct nlmsghdr* hdr = (struct nlmsghdr*)nlmsg->buf; hdr->nlmsg_len = nlmsg->pos - nlmsg->buf; struct sockaddr_nl addr; memset(&addr, 0, sizeof(addr)); addr.nl_family = AF_NETLINK; ssize_t n = sendto(sock, nlmsg->buf, hdr->nlmsg_len, 0, (struct sockaddr*)&addr, sizeof(addr)); if (n != (ssize_t)hdr->nlmsg_len) { if (dofail) exit(1); return -1; } n = recv(sock, nlmsg->buf, sizeof(nlmsg->buf), 0); if (reply_len) *reply_len = 0; if (n < 0) { if (dofail) exit(1); return -1; } if (n < (ssize_t)sizeof(struct nlmsghdr)) { errno = EINVAL; if (dofail) exit(1); return -1; } if (hdr->nlmsg_type == NLMSG_DONE) return 0; if (reply_len && hdr->nlmsg_type == reply_type) { *reply_len = n; return 0; } if (n < (ssize_t)(sizeof(struct nlmsghdr) + sizeof(struct nlmsgerr))) { errno = EINVAL; if (dofail) exit(1); return -1; } if (hdr->nlmsg_type != NLMSG_ERROR) { errno = EINVAL; if (dofail) exit(1); return -1; } errno = -((struct nlmsgerr*)(hdr + 1))->error; return -errno; } static int netlink_send(struct nlmsg* nlmsg, int sock) { return netlink_send_ext(nlmsg, sock, 0, NULL, true); } static int netlink_query_family_id(struct nlmsg* nlmsg, int sock, const char* family_name, bool dofail) { struct genlmsghdr genlhdr; memset(&genlhdr, 0, sizeof(genlhdr)); genlhdr.cmd = CTRL_CMD_GETFAMILY; netlink_init(nlmsg, GENL_ID_CTRL, 0, &genlhdr, sizeof(genlhdr)); netlink_attr(nlmsg, CTRL_ATTR_FAMILY_NAME, family_name, strnlen(family_name, GENL_NAMSIZ - 1) + 1); int n = 0; int err = netlink_send_ext(nlmsg, sock, GENL_ID_CTRL, &n, dofail); if (err < 0) { return -1; } uint16_t id = 0; struct nlattr* attr = (struct nlattr*)(nlmsg->buf + NLMSG_HDRLEN + NLMSG_ALIGN(sizeof(genlhdr))); for (; (char*)attr < nlmsg->buf + n; attr = (struct nlattr*)((char*)attr + NLMSG_ALIGN(attr->nla_len))) { if (attr->nla_type == CTRL_ATTR_FAMILY_ID) { id = *(uint16_t*)(attr + 1); break; } } if (!id) { errno = EINVAL; return -1; } recv(sock, nlmsg->buf, sizeof(nlmsg->buf), 0); return id; } static void netlink_device_change(struct nlmsg* nlmsg, int sock, const char* name, bool up, const char* master, const void* mac, int macsize, const char* new_name) { struct ifinfomsg hdr; memset(&hdr, 0, sizeof(hdr)); if (up) hdr.ifi_flags = hdr.ifi_change = IFF_UP; hdr.ifi_index = if_nametoindex(name); netlink_init(nlmsg, RTM_NEWLINK, 0, &hdr, sizeof(hdr)); if (new_name) netlink_attr(nlmsg, IFLA_IFNAME, new_name, strlen(new_name)); if (master) { int ifindex = if_nametoindex(master); netlink_attr(nlmsg, IFLA_MASTER, &ifindex, sizeof(ifindex)); } if (macsize) netlink_attr(nlmsg, IFLA_ADDRESS, mac, macsize); int err = netlink_send(nlmsg, sock); if (err < 0) { } } static int netlink_add_addr(struct nlmsg* nlmsg, int sock, const char* dev, const void* addr, int addrsize) { struct ifaddrmsg hdr; memset(&hdr, 0, sizeof(hdr)); hdr.ifa_family = addrsize == 4 ? AF_INET : AF_INET6; hdr.ifa_prefixlen = addrsize == 4 ? 24 : 120; hdr.ifa_scope = RT_SCOPE_UNIVERSE; hdr.ifa_index = if_nametoindex(dev); netlink_init(nlmsg, RTM_NEWADDR, NLM_F_CREATE | NLM_F_REPLACE, &hdr, sizeof(hdr)); netlink_attr(nlmsg, IFA_LOCAL, addr, addrsize); netlink_attr(nlmsg, IFA_ADDRESS, addr, addrsize); return netlink_send(nlmsg, sock); } static void netlink_add_addr4(struct nlmsg* nlmsg, int sock, const char* dev, const char* addr) { struct in_addr in_addr; inet_pton(AF_INET, addr, &in_addr); int err = netlink_add_addr(nlmsg, sock, dev, &in_addr, sizeof(in_addr)); if (err < 0) { } } static void netlink_add_addr6(struct nlmsg* nlmsg, int sock, const char* dev, const char* addr) { struct in6_addr in6_addr; inet_pton(AF_INET6, addr, &in6_addr); int err = netlink_add_addr(nlmsg, sock, dev, &in6_addr, sizeof(in6_addr)); if (err < 0) { } } static void netlink_add_neigh(struct nlmsg* nlmsg, int sock, const char* name, const void* addr, int addrsize, const void* mac, int macsize) { struct ndmsg hdr; memset(&hdr, 0, sizeof(hdr)); hdr.ndm_family = addrsize == 4 ? AF_INET : AF_INET6; hdr.ndm_ifindex = if_nametoindex(name); hdr.ndm_state = NUD_PERMANENT; netlink_init(nlmsg, RTM_NEWNEIGH, NLM_F_EXCL | NLM_F_CREATE, &hdr, sizeof(hdr)); netlink_attr(nlmsg, NDA_DST, addr, addrsize); netlink_attr(nlmsg, NDA_LLADDR, mac, macsize); int err = netlink_send(nlmsg, sock); if (err < 0) { } } static struct nlmsg nlmsg; static int tunfd = -1; #define TUN_IFACE "syz_tun" #define LOCAL_MAC 0xaaaaaaaaaaaa #define REMOTE_MAC 0xaaaaaaaaaabb #define LOCAL_IPV4 "172.20.20.170" #define REMOTE_IPV4 "172.20.20.187" #define LOCAL_IPV6 "fe80::aa" #define REMOTE_IPV6 "fe80::bb" #define IFF_NAPI 0x0010 static void correct_dev_net_tun(void) { struct stat st; if (stat("/dev/net/tun", &st) == 0) { if (S_ISCHR(st.st_mode) && major(st.st_rdev) == 10 && minor(st.st_rdev) == 200) return; if (unlink("/dev/net/tun")) { } } if (mkdir("/dev/net", 0755) && errno != EEXIST) { } if (mknod("/dev/net/tun", S_IFCHR | 0666, makedev(10, 200))) { } if (chmod("/dev/net/tun", 0666)) { } } static void initialize_tun(void) { correct_dev_net_tun(); tunfd = open("/dev/net/tun", O_RDWR | O_NONBLOCK); if (tunfd == -1) { printf("tun: can't open /dev/net/tun: please enable CONFIG_TUN=y\n"); printf("otherwise fuzzing or reproducing might not work as intended\n"); return; } const int kTunFd = 200; if (dup2(tunfd, kTunFd) < 0) exit(1); close(tunfd); tunfd = kTunFd; struct ifreq ifr; memset(&ifr, 0, sizeof(ifr)); strncpy(ifr.ifr_name, TUN_IFACE, IFNAMSIZ); ifr.ifr_flags = IFF_TAP | IFF_NO_PI; if (ioctl(tunfd, TUNSETIFF, (void*)&ifr) < 0) { exit(1); } char sysctl[64]; sprintf(sysctl, "/proc/sys/net/ipv6/conf/%s/accept_dad", TUN_IFACE); write_file(sysctl, "0"); sprintf(sysctl, "/proc/sys/net/ipv6/conf/%s/router_solicitations", TUN_IFACE); write_file(sysctl, "0"); int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); if (sock == -1) exit(1); netlink_add_addr4(&nlmsg, sock, TUN_IFACE, LOCAL_IPV4); netlink_add_addr6(&nlmsg, sock, TUN_IFACE, LOCAL_IPV6); uint64_t macaddr = REMOTE_MAC; struct in_addr in_addr; inet_pton(AF_INET, REMOTE_IPV4, &in_addr); netlink_add_neigh(&nlmsg, sock, TUN_IFACE, &in_addr, sizeof(in_addr), &macaddr, ETH_ALEN); struct in6_addr in6_addr; inet_pton(AF_INET6, REMOTE_IPV6, &in6_addr); netlink_add_neigh(&nlmsg, sock, TUN_IFACE, &in6_addr, sizeof(in6_addr), &macaddr, ETH_ALEN); macaddr = LOCAL_MAC; netlink_device_change(&nlmsg, sock, TUN_IFACE, true, 0, &macaddr, ETH_ALEN, NULL); close(sock); } static int runcmdline(char* cmdline) { int ret = system(cmdline); if (ret) { } return ret; } static int read_tun(char* data, int size) { if (tunfd < 0) return -1; int rv = read(tunfd, data, size); if (rv < 0) { if (errno == EAGAIN || errno == EBADF || errno == EBADFD) return -1; exit(1); } return rv; } static void flush_tun() { char data[1000]; while (read_tun(&data[0], sizeof(data)) != -1) { } } #define MAX_FDS 30 #define BTPROTO_HCI 1 #define ACL_LINK 1 #define SCAN_PAGE 2 typedef struct { uint8_t b[6]; } __attribute__((packed)) bdaddr_t; #define HCI_COMMAND_PKT 1 #define HCI_EVENT_PKT 4 #define HCI_VENDOR_PKT 0xff struct hci_command_hdr { uint16_t opcode; uint8_t plen; } __attribute__((packed)); struct hci_event_hdr { uint8_t evt; uint8_t plen; } __attribute__((packed)); #define HCI_EV_CONN_COMPLETE 0x03 struct hci_ev_conn_complete { uint8_t status; uint16_t handle; bdaddr_t bdaddr; uint8_t link_type; uint8_t encr_mode; } __attribute__((packed)); #define HCI_EV_CONN_REQUEST 0x04 struct hci_ev_conn_request { bdaddr_t bdaddr; uint8_t dev_class[3]; uint8_t link_type; } __attribute__((packed)); #define HCI_EV_REMOTE_FEATURES 0x0b struct hci_ev_remote_features { uint8_t status; uint16_t handle; uint8_t features[8]; } __attribute__((packed)); #define HCI_EV_CMD_COMPLETE 0x0e struct hci_ev_cmd_complete { uint8_t ncmd; uint16_t opcode; } __attribute__((packed)); #define HCI_OP_WRITE_SCAN_ENABLE 0x0c1a #define HCI_OP_READ_BUFFER_SIZE 0x1005 struct hci_rp_read_buffer_size { uint8_t status; uint16_t acl_mtu; uint8_t sco_mtu; uint16_t acl_max_pkt; uint16_t sco_max_pkt; } __attribute__((packed)); #define HCI_OP_READ_BD_ADDR 0x1009 struct hci_rp_read_bd_addr { uint8_t status; bdaddr_t bdaddr; } __attribute__((packed)); #define HCI_EV_LE_META 0x3e struct hci_ev_le_meta { uint8_t subevent; } __attribute__((packed)); #define HCI_EV_LE_CONN_COMPLETE 0x01 struct hci_ev_le_conn_complete { uint8_t status; uint16_t handle; uint8_t role; uint8_t bdaddr_type; bdaddr_t bdaddr; uint16_t interval; uint16_t latency; uint16_t supervision_timeout; uint8_t clk_accurancy; } __attribute__((packed)); struct hci_dev_req { uint16_t dev_id; uint32_t dev_opt; }; struct vhci_vendor_pkt_request { uint8_t type; uint8_t opcode; } __attribute__((packed)); struct vhci_pkt { uint8_t type; union { struct { uint8_t opcode; uint16_t id; } __attribute__((packed)) vendor_pkt; struct hci_command_hdr command_hdr; }; } __attribute__((packed)); #define HCIDEVUP _IOW('H', 201, int) #define HCISETSCAN _IOW('H', 221, int) static int vhci_fd = -1; static void rfkill_unblock_all() { int fd = open("/dev/rfkill", O_WRONLY); if (fd < 0) exit(1); struct rfkill_event event = {0}; event.idx = 0; event.type = RFKILL_TYPE_ALL; event.op = RFKILL_OP_CHANGE_ALL; event.soft = 0; event.hard = 0; if (write(fd, &event, sizeof(event)) < 0) exit(1); close(fd); } static void hci_send_event_packet(int fd, uint8_t evt, void* data, size_t data_len) { struct iovec iv[3]; struct hci_event_hdr hdr; hdr.evt = evt; hdr.plen = data_len; uint8_t type = HCI_EVENT_PKT; iv[0].iov_base = &type; iv[0].iov_len = sizeof(type); iv[1].iov_base = &hdr; iv[1].iov_len = sizeof(hdr); iv[2].iov_base = data; iv[2].iov_len = data_len; if (writev(fd, iv, sizeof(iv) / sizeof(struct iovec)) < 0) exit(1); } static void hci_send_event_cmd_complete(int fd, uint16_t opcode, void* data, size_t data_len) { struct iovec iv[4]; struct hci_event_hdr hdr; hdr.evt = HCI_EV_CMD_COMPLETE; hdr.plen = sizeof(struct hci_ev_cmd_complete) + data_len; struct hci_ev_cmd_complete evt_hdr; evt_hdr.ncmd = 1; evt_hdr.opcode = opcode; uint8_t type = HCI_EVENT_PKT; iv[0].iov_base = &type; iv[0].iov_len = sizeof(type); iv[1].iov_base = &hdr; iv[1].iov_len = sizeof(hdr); iv[2].iov_base = &evt_hdr; iv[2].iov_len = sizeof(evt_hdr); iv[3].iov_base = data; iv[3].iov_len = data_len; if (writev(fd, iv, sizeof(iv) / sizeof(struct iovec)) < 0) exit(1); } static bool process_command_pkt(int fd, char* buf, ssize_t buf_size) { struct hci_command_hdr* hdr = (struct hci_command_hdr*)buf; if (buf_size < (ssize_t)sizeof(struct hci_command_hdr) || hdr->plen != buf_size - sizeof(struct hci_command_hdr)) exit(1); switch (hdr->opcode) { case HCI_OP_WRITE_SCAN_ENABLE: { uint8_t status = 0; hci_send_event_cmd_complete(fd, hdr->opcode, &status, sizeof(status)); return true; } case HCI_OP_READ_BD_ADDR: { struct hci_rp_read_bd_addr rp = {0}; rp.status = 0; memset(&rp.bdaddr, 0xaa, 6); hci_send_event_cmd_complete(fd, hdr->opcode, &rp, sizeof(rp)); return false; } case HCI_OP_READ_BUFFER_SIZE: { struct hci_rp_read_buffer_size rp = {0}; rp.status = 0; rp.acl_mtu = 1021; rp.sco_mtu = 96; rp.acl_max_pkt = 4; rp.sco_max_pkt = 6; hci_send_event_cmd_complete(fd, hdr->opcode, &rp, sizeof(rp)); return false; } } char dummy[0xf9] = {0}; hci_send_event_cmd_complete(fd, hdr->opcode, dummy, sizeof(dummy)); return false; } static void* event_thread(void* arg) { while (1) { char buf[1024] = {0}; ssize_t buf_size = read(vhci_fd, buf, sizeof(buf)); if (buf_size < 0) exit(1); if (buf_size > 0 && buf[0] == HCI_COMMAND_PKT) { if (process_command_pkt(vhci_fd, buf + 1, buf_size - 1)) break; } } return NULL; } #define HCI_HANDLE_1 200 #define HCI_HANDLE_2 201 #define HCI_PRIMARY 0 #define HCI_OP_RESET 0x0c03 static void initialize_vhci() { int hci_sock = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI); if (hci_sock < 0) exit(1); vhci_fd = open("/dev/vhci", O_RDWR); if (vhci_fd == -1) exit(1); const int kVhciFd = 202; if (dup2(vhci_fd, kVhciFd) < 0) exit(1); close(vhci_fd); vhci_fd = kVhciFd; struct vhci_vendor_pkt_request vendor_pkt_req = {HCI_VENDOR_PKT, HCI_PRIMARY}; if (write(vhci_fd, &vendor_pkt_req, sizeof(vendor_pkt_req)) != sizeof(vendor_pkt_req)) exit(1); struct vhci_pkt vhci_pkt; if (read(vhci_fd, &vhci_pkt, sizeof(vhci_pkt)) != sizeof(vhci_pkt)) exit(1); if (vhci_pkt.type == HCI_COMMAND_PKT && vhci_pkt.command_hdr.opcode == HCI_OP_RESET) { char response[1] = {0}; hci_send_event_cmd_complete(vhci_fd, HCI_OP_RESET, response, sizeof(response)); if (read(vhci_fd, &vhci_pkt, sizeof(vhci_pkt)) != sizeof(vhci_pkt)) exit(1); } if (vhci_pkt.type != HCI_VENDOR_PKT) exit(1); int dev_id = vhci_pkt.vendor_pkt.id; pthread_t th; if (pthread_create(&th, NULL, event_thread, NULL)) exit(1); int ret = ioctl(hci_sock, HCIDEVUP, dev_id); if (ret) { if (errno == ERFKILL) { rfkill_unblock_all(); ret = ioctl(hci_sock, HCIDEVUP, dev_id); } if (ret && errno != EALREADY) exit(1); } struct hci_dev_req dr = {0}; dr.dev_id = dev_id; dr.dev_opt = SCAN_PAGE; if (ioctl(hci_sock, HCISETSCAN, &dr)) exit(1); struct hci_ev_conn_request request; memset(&request, 0, sizeof(request)); memset(&request.bdaddr, 0xaa, 6); *(uint8_t*)&request.bdaddr.b[5] = 0x10; request.link_type = ACL_LINK; hci_send_event_packet(vhci_fd, HCI_EV_CONN_REQUEST, &request, sizeof(request)); struct hci_ev_conn_complete complete; memset(&complete, 0, sizeof(complete)); complete.status = 0; complete.handle = HCI_HANDLE_1; memset(&complete.bdaddr, 0xaa, 6); *(uint8_t*)&complete.bdaddr.b[5] = 0x10; complete.link_type = ACL_LINK; complete.encr_mode = 0; hci_send_event_packet(vhci_fd, HCI_EV_CONN_COMPLETE, &complete, sizeof(complete)); struct hci_ev_remote_features features; memset(&features, 0, sizeof(features)); features.status = 0; features.handle = HCI_HANDLE_1; hci_send_event_packet(vhci_fd, HCI_EV_REMOTE_FEATURES, &features, sizeof(features)); struct { struct hci_ev_le_meta le_meta; struct hci_ev_le_conn_complete le_conn; } le_conn; memset(&le_conn, 0, sizeof(le_conn)); le_conn.le_meta.subevent = HCI_EV_LE_CONN_COMPLETE; memset(&le_conn.le_conn.bdaddr, 0xaa, 6); *(uint8_t*)&le_conn.le_conn.bdaddr.b[5] = 0x11; le_conn.le_conn.role = 1; le_conn.le_conn.handle = HCI_HANDLE_2; hci_send_event_packet(vhci_fd, HCI_EV_LE_META, &le_conn, sizeof(le_conn)); pthread_join(th, NULL); close(hci_sock); } //% This code is derived from puff.{c,h}, found in the zlib development. The //% original files come with the following copyright notice: //% Copyright (C) 2002-2013 Mark Adler, all rights reserved //% version 2.3, 21 Jan 2013 //% This software is provided 'as-is', without any express or implied //% warranty. In no event will the author be held liable for any damages //% arising from the use of this software. //% Permission is granted to anyone to use this software for any purpose, //% including commercial applications, and to alter it and redistribute it //% freely, subject to the following restrictions: //% 1. The origin of this software must not be misrepresented; you must not //% claim that you wrote the original software. If you use this software //% in a product, an acknowledgment in the product documentation would be //% appreciated but is not required. //% 2. Altered source versions must be plainly marked as such, and must not be //% misrepresented as being the original software. //% 3. This notice may not be removed or altered from any source distribution. //% Mark Adler madler@alumni.caltech.edu //% BEGIN CODE DERIVED FROM puff.{c,h} #define MAXBITS 15 #define MAXLCODES 286 #define MAXDCODES 30 #define MAXCODES (MAXLCODES + MAXDCODES) #define FIXLCODES 288 struct puff_state { unsigned char* out; unsigned long outlen; unsigned long outcnt; const unsigned char* in; unsigned long inlen; unsigned long incnt; int bitbuf; int bitcnt; jmp_buf env; }; static int puff_bits(struct puff_state* s, int need) { long val = s->bitbuf; while (s->bitcnt < need) { if (s->incnt == s->inlen) longjmp(s->env, 1); val |= (long)(s->in[s->incnt++]) << s->bitcnt; s->bitcnt += 8; } s->bitbuf = (int)(val >> need); s->bitcnt -= need; return (int)(val & ((1L << need) - 1)); } static int puff_stored(struct puff_state* s) { s->bitbuf = 0; s->bitcnt = 0; if (s->incnt + 4 > s->inlen) return 2; unsigned len = s->in[s->incnt++]; len |= s->in[s->incnt++] << 8; if (s->in[s->incnt++] != (~len & 0xff) || s->in[s->incnt++] != ((~len >> 8) & 0xff)) return -2; if (s->incnt + len > s->inlen) return 2; if (s->outcnt + len > s->outlen) return 1; for (; len--; s->outcnt++, s->incnt++) { if (s->in[s->incnt]) s->out[s->outcnt] = s->in[s->incnt]; } return 0; } struct puff_huffman { short* count; short* symbol; }; static int puff_decode(struct puff_state* s, const struct puff_huffman* h) { int first = 0; int index = 0; int bitbuf = s->bitbuf; int left = s->bitcnt; int code = first = index = 0; int len = 1; short* next = h->count + 1; while (1) { while (left--) { code |= bitbuf & 1; bitbuf >>= 1; int count = *next++; if (code - count < first) { s->bitbuf = bitbuf; s->bitcnt = (s->bitcnt - len) & 7; return h->symbol[index + (code - first)]; } index += count; first += count; first <<= 1; code <<= 1; len++; } left = (MAXBITS + 1) - len; if (left == 0) break; if (s->incnt == s->inlen) longjmp(s->env, 1); bitbuf = s->in[s->incnt++]; if (left > 8) left = 8; } return -10; } static int puff_construct(struct puff_huffman* h, const short* length, int n) { int len; for (len = 0; len <= MAXBITS; len++) h->count[len] = 0; int symbol; for (symbol = 0; symbol < n; symbol++) (h->count[length[symbol]])++; if (h->count[0] == n) return 0; int left = 1; for (len = 1; len <= MAXBITS; len++) { left <<= 1; left -= h->count[len]; if (left < 0) return left; } short offs[MAXBITS + 1]; offs[1] = 0; for (len = 1; len < MAXBITS; len++) offs[len + 1] = offs[len] + h->count[len]; for (symbol = 0; symbol < n; symbol++) if (length[symbol] != 0) h->symbol[offs[length[symbol]]++] = symbol; return left; } static int puff_codes(struct puff_state* s, const struct puff_huffman* lencode, const struct puff_huffman* distcode) { static const short lens[29] = {3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258}; static const short lext[29] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0}; static const short dists[30] = { 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577}; static const short dext[30] = {0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13}; int symbol; do { symbol = puff_decode(s, lencode); if (symbol < 0) return symbol; if (symbol < 256) { if (s->outcnt == s->outlen) return 1; if (symbol) s->out[s->outcnt] = symbol; s->outcnt++; } else if (symbol > 256) { symbol -= 257; if (symbol >= 29) return -10; int len = lens[symbol] + puff_bits(s, lext[symbol]); symbol = puff_decode(s, distcode); if (symbol < 0) return symbol; unsigned dist = dists[symbol] + puff_bits(s, dext[symbol]); if (dist > s->outcnt) return -11; if (s->outcnt + len > s->outlen) return 1; while (len--) { if (dist <= s->outcnt && s->out[s->outcnt - dist]) s->out[s->outcnt] = s->out[s->outcnt - dist]; s->outcnt++; } } } while (symbol != 256); return 0; } static int puff_fixed(struct puff_state* s) { static int virgin = 1; static short lencnt[MAXBITS + 1], lensym[FIXLCODES]; static short distcnt[MAXBITS + 1], distsym[MAXDCODES]; static struct puff_huffman lencode, distcode; if (virgin) { lencode.count = lencnt; lencode.symbol = lensym; distcode.count = distcnt; distcode.symbol = distsym; short lengths[FIXLCODES]; int symbol; for (symbol = 0; symbol < 144; symbol++) lengths[symbol] = 8; for (; symbol < 256; symbol++) lengths[symbol] = 9; for (; symbol < 280; symbol++) lengths[symbol] = 7; for (; symbol < FIXLCODES; symbol++) lengths[symbol] = 8; puff_construct(&lencode, lengths, FIXLCODES); for (symbol = 0; symbol < MAXDCODES; symbol++) lengths[symbol] = 5; puff_construct(&distcode, lengths, MAXDCODES); virgin = 0; } return puff_codes(s, &lencode, &distcode); } static int puff_dynamic(struct puff_state* s) { static const short order[19] = {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; int nlen = puff_bits(s, 5) + 257; int ndist = puff_bits(s, 5) + 1; int ncode = puff_bits(s, 4) + 4; if (nlen > MAXLCODES || ndist > MAXDCODES) return -3; short lengths[MAXCODES]; int index; for (index = 0; index < ncode; index++) lengths[order[index]] = puff_bits(s, 3); for (; index < 19; index++) lengths[order[index]] = 0; short lencnt[MAXBITS + 1], lensym[MAXLCODES]; struct puff_huffman lencode = {lencnt, lensym}; int err = puff_construct(&lencode, lengths, 19); if (err != 0) return -4; index = 0; while (index < nlen + ndist) { int symbol; int len; symbol = puff_decode(s, &lencode); if (symbol < 0) return symbol; if (symbol < 16) lengths[index++] = symbol; else { len = 0; if (symbol == 16) { if (index == 0) return -5; len = lengths[index - 1]; symbol = 3 + puff_bits(s, 2); } else if (symbol == 17) symbol = 3 + puff_bits(s, 3); else symbol = 11 + puff_bits(s, 7); if (index + symbol > nlen + ndist) return -6; while (symbol--) lengths[index++] = len; } } if (lengths[256] == 0) return -9; err = puff_construct(&lencode, lengths, nlen); if (err && (err < 0 || nlen != lencode.count[0] + lencode.count[1])) return -7; short distcnt[MAXBITS + 1], distsym[MAXDCODES]; struct puff_huffman distcode = {distcnt, distsym}; err = puff_construct(&distcode, lengths + nlen, ndist); if (err && (err < 0 || ndist != distcode.count[0] + distcode.count[1])) return -8; return puff_codes(s, &lencode, &distcode); } static int puff(unsigned char* dest, unsigned long* destlen, const unsigned char* source, unsigned long sourcelen) { struct puff_state s = { .out = dest, .outlen = *destlen, .outcnt = 0, .in = source, .inlen = sourcelen, .incnt = 0, .bitbuf = 0, .bitcnt = 0, }; int err; if (setjmp(s.env) != 0) err = 2; else { int last; do { last = puff_bits(&s, 1); int type = puff_bits(&s, 2); err = type == 0 ? puff_stored(&s) : (type == 1 ? puff_fixed(&s) : (type == 2 ? puff_dynamic(&s) : -1)); if (err != 0) break; } while (!last); } *destlen = s.outcnt; return err; } //% END CODE DERIVED FROM puff.{c,h} #define ZLIB_HEADER_WIDTH 2 static int puff_zlib_to_file(const unsigned char* source, unsigned long sourcelen, int dest_fd) { if (sourcelen < ZLIB_HEADER_WIDTH) return 0; source += ZLIB_HEADER_WIDTH; sourcelen -= ZLIB_HEADER_WIDTH; const unsigned long max_destlen = 132 << 20; void* ret = mmap(0, max_destlen, PROT_WRITE | PROT_READ, MAP_PRIVATE | MAP_ANON, -1, 0); if (ret == MAP_FAILED) return -1; unsigned char* dest = (unsigned char*)ret; unsigned long destlen = max_destlen; int err = puff(dest, &destlen, source, sourcelen); if (err) { munmap(dest, max_destlen); errno = -err; return -1; } if (write(dest_fd, dest, destlen) != (ssize_t)destlen) { munmap(dest, max_destlen); return -1; } return munmap(dest, max_destlen); } static int setup_loop_device(unsigned char* data, unsigned long size, const char* loopname, int* loopfd_p) { int err = 0, loopfd = -1; int memfd = syscall(__NR_memfd_create, "syzkaller", 0); if (memfd == -1) { err = errno; goto error; } if (puff_zlib_to_file(data, size, memfd)) { err = errno; goto error_close_memfd; } loopfd = open(loopname, O_RDWR); if (loopfd == -1) { err = errno; goto error_close_memfd; } if (ioctl(loopfd, LOOP_SET_FD, memfd)) { if (errno != EBUSY) { err = errno; goto error_close_loop; } ioctl(loopfd, LOOP_CLR_FD, 0); usleep(1000); if (ioctl(loopfd, LOOP_SET_FD, memfd)) { err = errno; goto error_close_loop; } } close(memfd); *loopfd_p = loopfd; return 0; error_close_loop: close(loopfd); error_close_memfd: close(memfd); error: errno = err; return -1; } static void reset_loop_device(const char* loopname) { int loopfd = open(loopname, O_RDWR); if (loopfd == -1) { return; } if (ioctl(loopfd, LOOP_CLR_FD, 0)) { } close(loopfd); } static long syz_mount_image(volatile long fsarg, volatile long dir, volatile long flags, volatile long optsarg, volatile long change_dir, volatile unsigned long size, volatile long image) { unsigned char* data = (unsigned char*)image; int res = -1, err = 0, need_loop_device = !!size; char* mount_opts = (char*)optsarg; char* target = (char*)dir; char* fs = (char*)fsarg; char* source = NULL; char loopname[64]; if (need_loop_device) { int loopfd; memset(loopname, 0, sizeof(loopname)); snprintf(loopname, sizeof(loopname), "/dev/loop%llu", procid); if (setup_loop_device(data, size, loopname, &loopfd) == -1) return -1; close(loopfd); source = loopname; } mkdir(target, 0777); char opts[256]; memset(opts, 0, sizeof(opts)); if (strlen(mount_opts) > (sizeof(opts) - 32)) { } strncpy(opts, mount_opts, sizeof(opts) - 32); if (strcmp(fs, "iso9660") == 0) { flags |= MS_RDONLY; } else if (strncmp(fs, "ext", 3) == 0) { bool has_remount_ro = false; char* remount_ro_start = strstr(opts, "errors=remount-ro"); if (remount_ro_start != NULL) { char after = *(remount_ro_start + strlen("errors=remount-ro")); char before = remount_ro_start == opts ? '\0' : *(remount_ro_start - 1); has_remount_ro = ((before == '\0' || before == ',') && (after == '\0' || after == ',')); } if (strstr(opts, "errors=panic") || !has_remount_ro) strcat(opts, ",errors=continue"); } else if (strcmp(fs, "xfs") == 0) { strcat(opts, ",nouuid"); } else if (strncmp(fs, "gfs2", 4) == 0 && (strstr(opts, "errors=panic") || strstr(opts, "debug"))) { strcat(opts, ",errors=withdraw"); } res = mount(source, target, fs, flags, opts); if (res == -1) { err = errno; goto error_clear_loop; } res = open(target, O_RDONLY | O_DIRECTORY); if (res == -1) { err = errno; goto error_clear_loop; } if (change_dir) { res = chdir(target); if (res == -1) { err = errno; } } error_clear_loop: if (need_loop_device) reset_loop_device(loopname); errno = err; return res; } #define XT_TABLE_SIZE 1536 #define XT_MAX_ENTRIES 10 struct xt_counters { uint64_t pcnt, bcnt; }; struct ipt_getinfo { char name[32]; unsigned int valid_hooks; unsigned int hook_entry[5]; unsigned int underflow[5]; unsigned int num_entries; unsigned int size; }; struct ipt_get_entries { char name[32]; unsigned int size; uint64_t entrytable[XT_TABLE_SIZE / sizeof(uint64_t)]; }; struct ipt_replace { char name[32]; unsigned int valid_hooks; unsigned int num_entries; unsigned int size; unsigned int hook_entry[5]; unsigned int underflow[5]; unsigned int num_counters; struct xt_counters* counters; uint64_t entrytable[XT_TABLE_SIZE / sizeof(uint64_t)]; }; struct ipt_table_desc { const char* name; struct ipt_getinfo info; struct ipt_replace replace; }; static struct ipt_table_desc ipv4_tables[] = { {.name = "filter"}, {.name = "nat"}, {.name = "mangle"}, {.name = "raw"}, {.name = "security"}, }; static struct ipt_table_desc ipv6_tables[] = { {.name = "filter"}, {.name = "nat"}, {.name = "mangle"}, {.name = "raw"}, {.name = "security"}, }; #define IPT_BASE_CTL 64 #define IPT_SO_SET_REPLACE (IPT_BASE_CTL) #define IPT_SO_GET_INFO (IPT_BASE_CTL) #define IPT_SO_GET_ENTRIES (IPT_BASE_CTL + 1) struct arpt_getinfo { char name[32]; unsigned int valid_hooks; unsigned int hook_entry[3]; unsigned int underflow[3]; unsigned int num_entries; unsigned int size; }; struct arpt_get_entries { char name[32]; unsigned int size; uint64_t entrytable[XT_TABLE_SIZE / sizeof(uint64_t)]; }; struct arpt_replace { char name[32]; unsigned int valid_hooks; unsigned int num_entries; unsigned int size; unsigned int hook_entry[3]; unsigned int underflow[3]; unsigned int num_counters; struct xt_counters* counters; uint64_t entrytable[XT_TABLE_SIZE / sizeof(uint64_t)]; }; struct arpt_table_desc { const char* name; struct arpt_getinfo info; struct arpt_replace replace; }; static struct arpt_table_desc arpt_tables[] = { {.name = "filter"}, }; #define ARPT_BASE_CTL 96 #define ARPT_SO_SET_REPLACE (ARPT_BASE_CTL) #define ARPT_SO_GET_INFO (ARPT_BASE_CTL) #define ARPT_SO_GET_ENTRIES (ARPT_BASE_CTL + 1) static void checkpoint_iptables(struct ipt_table_desc* tables, int num_tables, int family, int level) { int fd = socket(family, SOCK_STREAM, IPPROTO_TCP); if (fd == -1) { switch (errno) { case EAFNOSUPPORT: case ENOPROTOOPT: case ENOENT: return; } exit(1); } for (int i = 0; i < num_tables; i++) { struct ipt_table_desc* table = &tables[i]; strcpy(table->info.name, table->name); strcpy(table->replace.name, table->name); socklen_t optlen = sizeof(table->info); if (getsockopt(fd, level, IPT_SO_GET_INFO, &table->info, &optlen)) { switch (errno) { case EPERM: case ENOENT: case ENOPROTOOPT: continue; } exit(1); } if (table->info.size > sizeof(table->replace.entrytable)) exit(1); if (table->info.num_entries > XT_MAX_ENTRIES) exit(1); struct ipt_get_entries entries; memset(&entries, 0, sizeof(entries)); strcpy(entries.name, table->name); entries.size = table->info.size; optlen = sizeof(entries) - sizeof(entries.entrytable) + table->info.size; if (getsockopt(fd, level, IPT_SO_GET_ENTRIES, &entries, &optlen)) exit(1); table->replace.valid_hooks = table->info.valid_hooks; table->replace.num_entries = table->info.num_entries; table->replace.size = table->info.size; memcpy(table->replace.hook_entry, table->info.hook_entry, sizeof(table->replace.hook_entry)); memcpy(table->replace.underflow, table->info.underflow, sizeof(table->replace.underflow)); memcpy(table->replace.entrytable, entries.entrytable, table->info.size); } close(fd); } static void reset_iptables(struct ipt_table_desc* tables, int num_tables, int family, int level) { int fd = socket(family, SOCK_STREAM, IPPROTO_TCP); if (fd == -1) { switch (errno) { case EAFNOSUPPORT: case ENOPROTOOPT: case ENOENT: return; } exit(1); } for (int i = 0; i < num_tables; i++) { struct ipt_table_desc* table = &tables[i]; if (table->info.valid_hooks == 0) continue; struct ipt_getinfo info; memset(&info, 0, sizeof(info)); strcpy(info.name, table->name); socklen_t optlen = sizeof(info); if (getsockopt(fd, level, IPT_SO_GET_INFO, &info, &optlen)) exit(1); if (memcmp(&table->info, &info, sizeof(table->info)) == 0) { struct ipt_get_entries entries; memset(&entries, 0, sizeof(entries)); strcpy(entries.name, table->name); entries.size = table->info.size; optlen = sizeof(entries) - sizeof(entries.entrytable) + entries.size; if (getsockopt(fd, level, IPT_SO_GET_ENTRIES, &entries, &optlen)) exit(1); if (memcmp(table->replace.entrytable, entries.entrytable, table->info.size) == 0) continue; } struct xt_counters counters[XT_MAX_ENTRIES]; table->replace.num_counters = info.num_entries; table->replace.counters = counters; optlen = sizeof(table->replace) - sizeof(table->replace.entrytable) + table->replace.size; if (setsockopt(fd, level, IPT_SO_SET_REPLACE, &table->replace, optlen)) exit(1); } close(fd); } static void checkpoint_arptables(void) { int fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (fd == -1) { switch (errno) { case EAFNOSUPPORT: case ENOPROTOOPT: case ENOENT: return; } exit(1); } for (unsigned i = 0; i < sizeof(arpt_tables) / sizeof(arpt_tables[0]); i++) { struct arpt_table_desc* table = &arpt_tables[i]; strcpy(table->info.name, table->name); strcpy(table->replace.name, table->name); socklen_t optlen = sizeof(table->info); if (getsockopt(fd, SOL_IP, ARPT_SO_GET_INFO, &table->info, &optlen)) { switch (errno) { case EPERM: case ENOENT: case ENOPROTOOPT: continue; } exit(1); } if (table->info.size > sizeof(table->replace.entrytable)) exit(1); if (table->info.num_entries > XT_MAX_ENTRIES) exit(1); struct arpt_get_entries entries; memset(&entries, 0, sizeof(entries)); strcpy(entries.name, table->name); entries.size = table->info.size; optlen = sizeof(entries) - sizeof(entries.entrytable) + table->info.size; if (getsockopt(fd, SOL_IP, ARPT_SO_GET_ENTRIES, &entries, &optlen)) exit(1); table->replace.valid_hooks = table->info.valid_hooks; table->replace.num_entries = table->info.num_entries; table->replace.size = table->info.size; memcpy(table->replace.hook_entry, table->info.hook_entry, sizeof(table->replace.hook_entry)); memcpy(table->replace.underflow, table->info.underflow, sizeof(table->replace.underflow)); memcpy(table->replace.entrytable, entries.entrytable, table->info.size); } close(fd); } static void reset_arptables() { int fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (fd == -1) { switch (errno) { case EAFNOSUPPORT: case ENOPROTOOPT: case ENOENT: return; } exit(1); } for (unsigned i = 0; i < sizeof(arpt_tables) / sizeof(arpt_tables[0]); i++) { struct arpt_table_desc* table = &arpt_tables[i]; if (table->info.valid_hooks == 0) continue; struct arpt_getinfo info; memset(&info, 0, sizeof(info)); strcpy(info.name, table->name); socklen_t optlen = sizeof(info); if (getsockopt(fd, SOL_IP, ARPT_SO_GET_INFO, &info, &optlen)) exit(1); if (memcmp(&table->info, &info, sizeof(table->info)) == 0) { struct arpt_get_entries entries; memset(&entries, 0, sizeof(entries)); strcpy(entries.name, table->name); entries.size = table->info.size; optlen = sizeof(entries) - sizeof(entries.entrytable) + entries.size; if (getsockopt(fd, SOL_IP, ARPT_SO_GET_ENTRIES, &entries, &optlen)) exit(1); if (memcmp(table->replace.entrytable, entries.entrytable, table->info.size) == 0) continue; } else { } struct xt_counters counters[XT_MAX_ENTRIES]; table->replace.num_counters = info.num_entries; table->replace.counters = counters; optlen = sizeof(table->replace) - sizeof(table->replace.entrytable) + table->replace.size; if (setsockopt(fd, SOL_IP, ARPT_SO_SET_REPLACE, &table->replace, optlen)) exit(1); } close(fd); } #define NF_BR_NUMHOOKS 6 #define EBT_TABLE_MAXNAMELEN 32 #define EBT_CHAIN_MAXNAMELEN 32 #define EBT_BASE_CTL 128 #define EBT_SO_SET_ENTRIES (EBT_BASE_CTL) #define EBT_SO_GET_INFO (EBT_BASE_CTL) #define EBT_SO_GET_ENTRIES (EBT_SO_GET_INFO + 1) #define EBT_SO_GET_INIT_INFO (EBT_SO_GET_ENTRIES + 1) #define EBT_SO_GET_INIT_ENTRIES (EBT_SO_GET_INIT_INFO + 1) struct ebt_replace { char name[EBT_TABLE_MAXNAMELEN]; unsigned int valid_hooks; unsigned int nentries; unsigned int entries_size; struct ebt_entries* hook_entry[NF_BR_NUMHOOKS]; unsigned int num_counters; struct ebt_counter* counters; char* entries; }; struct ebt_entries { unsigned int distinguisher; char name[EBT_CHAIN_MAXNAMELEN]; unsigned int counter_offset; int policy; unsigned int nentries; char data[0] __attribute__((aligned(__alignof__(struct ebt_replace)))); }; struct ebt_table_desc { const char* name; struct ebt_replace replace; char entrytable[XT_TABLE_SIZE]; }; static struct ebt_table_desc ebt_tables[] = { {.name = "filter"}, {.name = "nat"}, {.name = "broute"}, }; static void checkpoint_ebtables(void) { int fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (fd == -1) { switch (errno) { case EAFNOSUPPORT: case ENOPROTOOPT: case ENOENT: return; } exit(1); } for (size_t i = 0; i < sizeof(ebt_tables) / sizeof(ebt_tables[0]); i++) { struct ebt_table_desc* table = &ebt_tables[i]; strcpy(table->replace.name, table->name); socklen_t optlen = sizeof(table->replace); if (getsockopt(fd, SOL_IP, EBT_SO_GET_INIT_INFO, &table->replace, &optlen)) { switch (errno) { case EPERM: case ENOENT: case ENOPROTOOPT: continue; } exit(1); } if (table->replace.entries_size > sizeof(table->entrytable)) exit(1); table->replace.num_counters = 0; table->replace.entries = table->entrytable; optlen = sizeof(table->replace) + table->replace.entries_size; if (getsockopt(fd, SOL_IP, EBT_SO_GET_INIT_ENTRIES, &table->replace, &optlen)) exit(1); } close(fd); } static void reset_ebtables() { int fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (fd == -1) { switch (errno) { case EAFNOSUPPORT: case ENOPROTOOPT: case ENOENT: return; } exit(1); } for (unsigned i = 0; i < sizeof(ebt_tables) / sizeof(ebt_tables[0]); i++) { struct ebt_table_desc* table = &ebt_tables[i]; if (table->replace.valid_hooks == 0) continue; struct ebt_replace replace; memset(&replace, 0, sizeof(replace)); strcpy(replace.name, table->name); socklen_t optlen = sizeof(replace); if (getsockopt(fd, SOL_IP, EBT_SO_GET_INFO, &replace, &optlen)) exit(1); replace.num_counters = 0; table->replace.entries = 0; for (unsigned h = 0; h < NF_BR_NUMHOOKS; h++) table->replace.hook_entry[h] = 0; if (memcmp(&table->replace, &replace, sizeof(table->replace)) == 0) { char entrytable[XT_TABLE_SIZE]; memset(&entrytable, 0, sizeof(entrytable)); replace.entries = entrytable; optlen = sizeof(replace) + replace.entries_size; if (getsockopt(fd, SOL_IP, EBT_SO_GET_ENTRIES, &replace, &optlen)) exit(1); if (memcmp(table->entrytable, entrytable, replace.entries_size) == 0) continue; } for (unsigned j = 0, h = 0; h < NF_BR_NUMHOOKS; h++) { if (table->replace.valid_hooks & (1 << h)) { table->replace.hook_entry[h] = (struct ebt_entries*)table->entrytable + j; j++; } } table->replace.entries = table->entrytable; optlen = sizeof(table->replace) + table->replace.entries_size; if (setsockopt(fd, SOL_IP, EBT_SO_SET_ENTRIES, &table->replace, optlen)) exit(1); } close(fd); } static void checkpoint_net_namespace(void) { checkpoint_ebtables(); checkpoint_arptables(); checkpoint_iptables(ipv4_tables, sizeof(ipv4_tables) / sizeof(ipv4_tables[0]), AF_INET, SOL_IP); checkpoint_iptables(ipv6_tables, sizeof(ipv6_tables) / sizeof(ipv6_tables[0]), AF_INET6, SOL_IPV6); } static void reset_net_namespace(void) { reset_ebtables(); reset_arptables(); reset_iptables(ipv4_tables, sizeof(ipv4_tables) / sizeof(ipv4_tables[0]), AF_INET, SOL_IP); reset_iptables(ipv6_tables, sizeof(ipv6_tables) / sizeof(ipv6_tables[0]), AF_INET6, SOL_IPV6); } static void setup_gadgetfs(); static void setup_binderfs(); static void setup_fusectl(); static void sandbox_common_mount_tmpfs(void) { write_file("/proc/sys/fs/mount-max", "100000"); if (mkdir("./syz-tmp", 0777)) exit(1); if (mount("", "./syz-tmp", "tmpfs", 0, NULL)) exit(1); if (mkdir("./syz-tmp/newroot", 0777)) exit(1); if (mkdir("./syz-tmp/newroot/dev", 0700)) exit(1); unsigned bind_mount_flags = MS_BIND | MS_REC | MS_PRIVATE; if (mount("/dev", "./syz-tmp/newroot/dev", NULL, bind_mount_flags, NULL)) exit(1); if (mkdir("./syz-tmp/newroot/proc", 0700)) exit(1); if (mount("syz-proc", "./syz-tmp/newroot/proc", "proc", 0, NULL)) exit(1); if (mkdir("./syz-tmp/newroot/selinux", 0700)) exit(1); const char* selinux_path = "./syz-tmp/newroot/selinux"; if (mount("/selinux", selinux_path, NULL, bind_mount_flags, NULL)) { if (errno != ENOENT) exit(1); if (mount("/sys/fs/selinux", selinux_path, NULL, bind_mount_flags, NULL) && errno != ENOENT) exit(1); } if (mkdir("./syz-tmp/newroot/sys", 0700)) exit(1); if (mount("/sys", "./syz-tmp/newroot/sys", 0, bind_mount_flags, NULL)) exit(1); if (mount("/sys/kernel/debug", "./syz-tmp/newroot/sys/kernel/debug", NULL, bind_mount_flags, NULL) && errno != ENOENT) exit(1); if (mount("/sys/fs/smackfs", "./syz-tmp/newroot/sys/fs/smackfs", NULL, bind_mount_flags, NULL) && errno != ENOENT) exit(1); if (mount("/proc/sys/fs/binfmt_misc", "./syz-tmp/newroot/proc/sys/fs/binfmt_misc", NULL, bind_mount_flags, NULL) && errno != ENOENT) exit(1); if (mkdir("./syz-tmp/newroot/syz-inputs", 0700)) exit(1); if (mount("/syz-inputs", "./syz-tmp/newroot/syz-inputs", NULL, bind_mount_flags | MS_RDONLY, NULL) && errno != ENOENT) exit(1); if (mkdir("./syz-tmp/pivot", 0777)) exit(1); if (syscall(SYS_pivot_root, "./syz-tmp", "./syz-tmp/pivot")) { if (chdir("./syz-tmp")) exit(1); } else { if (chdir("/")) exit(1); if (umount2("./pivot", MNT_DETACH)) exit(1); } if (chroot("./newroot")) exit(1); if (chdir("/")) exit(1); setup_gadgetfs(); setup_binderfs(); setup_fusectl(); } static void setup_gadgetfs() { if (mkdir("/dev/gadgetfs", 0777)) { } if (mount("gadgetfs", "/dev/gadgetfs", "gadgetfs", 0, NULL)) { } } static void setup_fusectl() { if (mount(0, "/sys/fs/fuse/connections", "fusectl", 0, 0)) { } } static void setup_binderfs() { if (mkdir("/dev/binderfs", 0777)) { } if (mount("binder", "/dev/binderfs", "binder", 0, NULL)) { } } static void loop(); static void sandbox_common() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); if (getppid() == 1) exit(1); struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = (200 << 20); setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 32 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 136 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); if (unshare(CLONE_NEWNS)) { } if (mount(NULL, "/", NULL, MS_REC | MS_PRIVATE, NULL)) { } if (unshare(CLONE_NEWIPC)) { } if (unshare(0x02000000)) { } if (unshare(CLONE_NEWUTS)) { } if (unshare(CLONE_SYSVSEM)) { } typedef struct { const char* name; const char* value; } sysctl_t; static const sysctl_t sysctls[] = { {"/proc/sys/kernel/shmmax", "16777216"}, {"/proc/sys/kernel/shmall", "536870912"}, {"/proc/sys/kernel/shmmni", "1024"}, {"/proc/sys/kernel/msgmax", "8192"}, {"/proc/sys/kernel/msgmni", "1024"}, {"/proc/sys/kernel/msgmnb", "1024"}, {"/proc/sys/kernel/sem", "1024 1048576 500 1024"}, }; unsigned i; for (i = 0; i < sizeof(sysctls) / sizeof(sysctls[0]); i++) write_file(sysctls[i].name, sysctls[i].value); } static int wait_for_loop(int pid) { if (pid < 0) exit(1); int status = 0; while (waitpid(-1, &status, __WALL) != pid) { } return WEXITSTATUS(status); } static void drop_caps(void) { struct __user_cap_header_struct cap_hdr = {}; struct __user_cap_data_struct cap_data[2] = {}; cap_hdr.version = _LINUX_CAPABILITY_VERSION_3; cap_hdr.pid = getpid(); if (syscall(SYS_capget, &cap_hdr, &cap_data)) exit(1); const int drop = (1 << CAP_SYS_PTRACE) | (1 << CAP_SYS_NICE); cap_data[0].effective &= ~drop; cap_data[0].permitted &= ~drop; cap_data[0].inheritable &= ~drop; if (syscall(SYS_capset, &cap_hdr, &cap_data)) exit(1); } static int do_sandbox_none(void) { if (unshare(CLONE_NEWPID)) { } int pid = fork(); if (pid != 0) return wait_for_loop(pid); initialize_vhci(); sandbox_common(); drop_caps(); if (unshare(CLONE_NEWNET)) { } write_file("/proc/sys/net/ipv4/ping_group_range", "0 65535"); initialize_tun(); sandbox_common_mount_tmpfs(); loop(); exit(1); } #define FS_IOC_SETFLAGS _IOW('f', 2, long) static void remove_dir(const char* dir) { int iter = 0; DIR* dp = 0; const int umount_flags = MNT_FORCE | UMOUNT_NOFOLLOW; retry: while (umount2(dir, umount_flags) == 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, umount_flags) == 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, umount_flags)) 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, umount_flags)) 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_loop() { checkpoint_net_namespace(); } static void reset_loop() { char buf[64]; snprintf(buf, sizeof(buf), "/dev/loop%llu", procid); int loopfd = open(buf, O_RDWR); if (loopfd != -1) { ioctl(loopfd, LOOP_CLR_FD, 0); close(loopfd); } reset_net_namespace(); } static void setup_test() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setpgrp(); write_file("/proc/self/oom_score_adj", "1000"); flush_tun(); if (symlink("/dev/binderfs", "./binderfs")) { } } static void close_fds() { for (int fd = 3; fd < MAX_FDS; fd++) close(fd); } static const char* setup_binfmt_misc() { if (mount(0, "/proc/sys/fs/binfmt_misc", "binfmt_misc", 0, 0) && errno != EBUSY) { return NULL; } if (!write_file("/proc/sys/fs/binfmt_misc/register", ":syz0:M:0:\x01::./file0:") || !write_file("/proc/sys/fs/binfmt_misc/register", ":syz1:M:1:\x02::./file0:POC")) return "write(/proc/sys/fs/binfmt_misc/register) failed"; return NULL; } static void setup_sysctl() { int cad_pid = fork(); if (cad_pid < 0) exit(1); if (cad_pid == 0) { for (;;) sleep(100); } char tmppid[32]; snprintf(tmppid, sizeof(tmppid), "%d", cad_pid); struct { const char* name; const char* data; } files[] = { {"/sys/kernel/debug/x86/nmi_longest_ns", "10000000000"}, {"/proc/sys/kernel/hung_task_check_interval_secs", "20"}, {"/proc/sys/net/core/bpf_jit_kallsyms", "1"}, {"/proc/sys/net/core/bpf_jit_harden", "0"}, {"/proc/sys/kernel/kptr_restrict", "0"}, {"/proc/sys/kernel/softlockup_all_cpu_backtrace", "1"}, {"/proc/sys/fs/mount-max", "100"}, {"/proc/sys/vm/oom_dump_tasks", "0"}, {"/proc/sys/debug/exception-trace", "0"}, {"/proc/sys/kernel/printk", "7 4 1 3"}, {"/proc/sys/kernel/keys/gc_delay", "1"}, {"/proc/sys/vm/oom_kill_allocating_task", "1"}, {"/proc/sys/kernel/ctrl-alt-del", "0"}, {"/proc/sys/kernel/cad_pid", tmppid}, }; for (size_t i = 0; i < sizeof(files) / sizeof(files[0]); i++) { if (!write_file(files[i].name, files[i].data)) { } } kill(cad_pid, SIGKILL); while (waitpid(cad_pid, NULL, 0) != cad_pid) ; } #define SWAP_FILE "./swap-file" #define SWAP_FILE_SIZE (128 * 1000 * 1000) static const char* setup_swap() { swapoff(SWAP_FILE); unlink(SWAP_FILE); int fd = open(SWAP_FILE, O_CREAT | O_WRONLY | O_CLOEXEC, 0600); if (fd == -1) return "swap file open failed"; fallocate(fd, FALLOC_FL_ZERO_RANGE, 0, SWAP_FILE_SIZE); close(fd); char cmdline[64]; sprintf(cmdline, "mkswap %s", SWAP_FILE); if (runcmdline(cmdline)) return "mkswap failed"; if (swapon(SWAP_FILE, SWAP_FLAG_PREFER) == 1) return "swapon failed"; return NULL; } 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) { if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } int i, call, thread; for (call = 0; call < 5; 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); event_timedwait(&th->done, 50 + (call == 0 ? 4000 : 0)); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); close_fds(); } static void execute_one(void); #define WAIT_FLAGS __WALL static void loop(void) { setup_loop(); int iter = 0; for (;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); reset_loop(); 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 (;;) { sleep_ms(10); if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; if (current_time_ms() - start < 5000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[2] = {0xffffffffffffffff, 0xffffffffffffffff}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: // syz_mount_image$exfat arguments: [ // fs: ptr[in, buffer] { // buffer: {65 78 66 61 74 00} (length 0x6) // } // dir: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 32 00} (length 0x8) // } // flags: mount_flags = 0x1000000 (8 bytes) // opts: ptr[inout, array[ANYUNION]] { // array[ANYUNION] { // } // } // chdir: int8 = 0xfd (1 bytes) // size: len = 0x1507 (8 bytes) // img: ptr[in, buffer] { // buffer: (compressed buffer with length 0x1507) // } // ] // returns fd_dir NONFAILING(memcpy((void*)0x200000000280, "exfat\000", 6)); NONFAILING(memcpy((void*)0x200000001cc0, "./file2\000", 8)); NONFAILING(memcpy( (void*)0x200000001d00, "\x78\x9c\xec\xdc\x09\xb8\x4f\x55\xf7\x38\xf0\xb5\xf6\xde\x87\xeb\x66" "\xf8\x26\x99\xcf\xda\xeb\xf0\x4d\x86\x6d\x48\x12\x4a\x92\x21\x49\x92" "\x90\xcc\x09\x49\x92\x24\x49\xe2\x92\x29\x09\x49\xc8\x78\x93\xcc\x21" "\x73\xba\xe9\x9a\xe7\x21\x73\xd2\xcd\x2b\x49\x92\x90\x90\x64\xff\x9f" "\xdb\xf0\xf7\xf6\x4e\xbd\xbf\xf7\xd7\xef\xaf\xff\xef\xae\xcf\xf3\x9c" "\xc7\x5e\xce\x59\xfb\xac\x7d\xd7\xf3\xbd\x67\x78\x9e\xfb\xfd\xaa\xdb" "\xf0\x1a\x8d\x6b\x56\x6d\xc0\xcc\xf0\x9f\xd0\xbf\x0e\xf0\xe7\x7f\x92" "\x00\x20\x01\x00\x06\x01\x40\x0e\x00\x08\x00\xa0\x5c\xce\x72\x39\xd3" "\xf7\x67\xd1\x98\xf4\x1f\x9d\x44\xfc\x0f\x69\x38\xf3\x4a\x57\x20\xae" "\x24\xe9\x7f\xc6\x26\xfd\xcf\xd8\xa4\xff\x19\x9b\xf4\x3f\x63\x93\xfe" "\x67\x6c\xd2\xff\x8c\x4d\xfa\x9f\xb1\x49\xff\x85\xc8\xd0\x66\xe7\xbb" "\x5a\xb6\x8c\xbb\xc9\xfb\xff\xff\xcf\xa9\xff\x4e\xb2\x5c\xff\x33\x04" "\xfc\x67\x3b\xa4\xff\xff\xdb\xe8\xff\xd2\xd1\xd2\xff\x8c\x4d\xfa\x9f" "\xb1\x49\xff\x33\x36\xe9\x7f\x46\x16\x5c\xe9\x02\xc4\x15\x26\x9f\xff" "\x8c\x4d\xfa\x2f\x44\x86\xf6\x87\xbf\x53\xde\x78\xfe\x5f\xec\xcf\x0c" "\x00\x57\xfc\x9d\xb7\x6c\x7f\xb5\x09\x21\x84\x10\x42\x08\x21\x84\x10" "\x42\x08\x21\x84\x10\x42\x08\x21\x84\x10\x42\x08\x21\x84\x10\x42\x08" "\x21\x84\x10\x42\x08\x21\x84\x10\x42\x08\x21\x84\x10\x42\x08\x21\x84" "\x10\x42\x08\x21\x84\x10\x42\x08\x21\x84\x10\x42\x08\x21\x84\x10\x42" "\x08\x21\x84\x10\x42\x08\x21\x84\x10\x42\x08\x21\x84\x10\x42\x08\x21" "\x84\x10\x42\x08\x21\x84\x10\x42\x08\x21\x84\x10\x42\x08\x21\x84\x10" "\x42\x08\x21\x84\x10\x42\x08\x21\x84\x10\x42\x08\x21\x84\x10\x42\x08" "\x21\x84\x10\x42\x08\x21\x84\x10\x42\x08\x21\x84\x10\x42\x08\x21\x84" "\x10\xff\x0f\x9c\xf7\x97\x19\x00\xf8\x75\x7c\xa5\xeb\x12\x42\x08\x21" "\x84\x10\x42\x08\x21\xc4\x1f\xc7\xbf\x73\xa5\x2b\x10\x42\x08\x21\x84" "\x10\x42\x08\x21\xc4\xff\x3c\x04\x05\x1a\x0c\x04\x90\x09\x32\x43\x02" "\x64\x81\x44\xb8\x0a\xb2\x42\x36\xc8\x0e\x39\x20\x06\x57\x43\x4e\xb8" "\x06\x72\xc1\xb5\x90\x1b\xf2\x40\x5e\xc8\x07\xf9\xa1\x00\x14\x84\x10" "\x08\x2c\x30\x44\x50\x08\x0a\x43\x1c\xae\x83\x22\x70\x3d\x14\x85\x62" "\x50\x1c\x4a\x80\x83\x92\x50\x0a\x4a\x43\x19\xb8\x01\xca\xc2\x8d\x50" "\x0e\x6e\x82\xf2\x70\x33\x54\x80\x8a\x3f\x9d\x33\xdd\x6d\x50\x05\x6e" "\x87\xaa\x70\x07\x54\x83\xea\x50\x03\x6a\xc2\x9d\x50\x0b\xee\x82\xda" "\x70\x37\xd4\x81\x7b\xa0\x2e\xdc\x0b\xf5\xe0\x3e\xa8\x0f\xf7\x43\x03" "\x68\x08\x8d\xe0\x01\x68\x0c\x0f\x42\x13\x68\x0a\xcd\xa0\x39\xb4\x80" "\x96\xd0\xea\x77\xf2\x93\x73\xfc\xa3\xfc\xe7\xa0\x27\x3c\x0f\xbd\xa0" "\x37\x24\x41\x1f\xe8\x0b\x2f\x40\x3f\xe8\x0f\x03\x60\x20\x0c\x82\x17" "\x61\x30\xbc\x04\x43\xe0\x65\x18\x0a\xc3\x60\x38\xbc\x02\x23\xe0\x55" "\x18\x09\xaf\xc1\x28\x18\x0d\x63\xe0\x75\x18\x0b\xe3\x60\x3c\x4c\x80" "\x89\x30\x09\x92\xe1\x0d\x98\x0c\x6f\xc2\x14\x78\xeb\xc1\x6c\x30\x0d" "\xa6\xc3\x0c\x98\x09\xb3\x60\x36\xbc\x0d\x73\x60\x2e\xcc\x83\x77\x60" "\x3e\x2c\x80\x85\x90\x9c\x65\x31\x2c\x81\xa5\xf0\x2e\x2c\x83\xf7\x20" "\x05\xde\x87\xe5\xf0\x01\xa4\xc2\x0a\x58\x09\xab\x60\x35\xac\x81\xb5" "\xb0\x0e\xd6\xc3\x06\xd8\x08\x9b\x60\x33\x6c\x81\xad\xb0\x0d\xb6\xc3" "\x87\xb0\x03\x76\xc2\x2e\xd8\x0d\x7b\x60\x2f\xec\x83\x8f\x60\x3f\x7c" "\x0c\x07\xe0\x13\x48\xc3\x4f\xff\x8b\xf9\xe7\x7e\x9b\x0f\xdd\x11\x10" "\x50\xa1\x42\x83\x06\x33\x61\x26\x4c\xc0\x04\x4c\xc4\x44\xcc\x8a\x59" "\x31\x3b\x66\xc7\x18\xc6\x30\x27\xe6\xc4\x5c\x98\x0b\x73\x63\x6e\xcc" "\x8b\x79\x31\x09\xf3\x63\x41\x2c\x88\x84\x84\x8c\x8c\x85\xb0\x10\xc6" "\x31\x8e\x45\xb0\x08\x16\xc5\xa2\x58\x1c\x8b\xa3\x43\x87\xa5\xb0\x14" "\x96\xc1\x1b\xb0\x2c\x96\xc5\x72\x58\x0e\xcb\x63\x79\xac\x80\x15\xb1" "\x22\xde\x82\xb7\x60\x65\xac\x8c\x55\xb0\x0a\x56\xc5\xaa\x58\x0d\xab" "\x61\x0d\xac\x81\x77\xe2\x9d\x78\x17\xd6\xc6\xda\x58\x07\xeb\x60\x5d" "\xac\x8b\xf5\xb0\x1e\xd6\xc7\xfa\xd8\x00\x1b\x60\x23\x6c\x84\x8d\xb1" "\x31\x36\xc1\x26\xd8\x0c\x9b\x61\x0b\x6c\x81\xad\xb0\x15\xb6\xc6\xd6" "\xd8\x06\xdb\x60\x3b\x6c\x87\xed\xb1\x3d\x76\xc0\x0e\xd8\x11\x3b\x62" "\x27\xec\x84\x9d\xb1\x33\x76\xc1\x2e\xd8\x15\xbb\x62\x37\xec\x86\xdd" "\xf1\x59\x7c\x16\x9f\xc3\xe7\xf0\x79\x7c\x1e\x7b\x63\x35\xd5\x07\xfb" "\x62\x5f\xec\x87\xfd\x70\x00\x0e\xc4\x81\xf8\x22\x0e\xc6\x97\xf0\x25" "\x7c\x19\x87\xe2\x30\x1c\x8e\xaf\xe0\x2b\xf8\x2a\x8e\xc4\xb3\x38\x0a" "\x47\xe3\x18\x1c\x83\x95\xd5\x38\x1c\x8f\x13\x90\xd5\x24\x4c\xc6\x64" "\xcc\x0c\x93\x71\x0a\x4e\xc1\xa9\x38\x0d\xa7\xe1\x0c\x9c\x89\xb3\x70" "\x36\xce\xc6\x39\x38\x17\xe7\xe2\x3b\x38\x1f\x17\xe0\x02\x5c\x84\x8b" "\x70\x09\x2e\xc5\xa5\xb8\x0c\xdf\xc3\x14\x4c\xc1\xe5\x78\x0e\x53\x71" "\x05\xae\xc4\x55\xb8\x1a\xd7\xe0\x6a\x5c\x87\xeb\x71\x1d\x6e\xc4\x4d" "\xb8\x11\xb7\xe0\x16\xdc\x86\xdb\xf0\x43\xfc\x10\x77\xe2\x4e\xdc\x8d" "\xbb\x71\x2f\xee\xc5\x8f\xf0\x23\xfc\x18\x3f\xc6\xa1\x98\x86\x69\x78" "\x10\x0f\xe2\x21\x3c\x84\x87\xf1\x30\x1e\xc1\x23\x78\x14\x8f\xe2\x31" "\x3c\x86\xc7\xf1\x38\x9e\xc0\x13\x78\x12\x4f\xe1\x69\x3c\x85\x67\xf0" "\x0c\x9e\xc5\x73\x78\x1e\x00\x2e\xe0\x05\xbc\x88\x17\xf1\x12\x5e\x4a" "\xff\xf0\xab\x74\x46\x19\x95\x49\x65\x52\x09\x2a\x41\x25\xaa\x44\x95" "\x55\x65\x55\xd9\x55\x76\x15\x53\x31\x95\x53\xe5\x54\xb9\x54\x2e\x95" "\x5b\xe5\x56\x79\x55\x5e\x95\x5f\xe5\x57\x05\x55\x41\x45\x8a\x14\xab" "\x48\x15\x52\x85\x54\x5c\xc5\x55\x11\x55\x44\x15\x55\x45\x55\x71\x55" "\x5c\x39\xe5\x54\x29\x55\x4a\x95\x51\x65\x54\x59\x55\x56\x95\x53\x37" "\xa9\xf2\xea\x66\x55\x41\x55\x54\x6d\xdd\x2d\xea\x16\x55\x59\xb5\x73" "\x55\xd4\xed\xaa\xaa\xaa\xaa\xaa\xa9\xea\xaa\x86\xaa\xa9\x6a\xaa\x5a" "\xaa\x96\xaa\xad\x6a\xab\x3a\xaa\x8e\xaa\xab\xea\xaa\x7a\xea\x3e\x55" "\x5f\xf5\xc1\x01\xd8\x50\xa5\x77\xa6\xb1\x1a\x86\x4d\xd4\x70\x6c\xa6" "\x9a\xab\x16\xaa\xa5\x7a\x15\x1f\x52\xad\xd5\x48\x6c\xa3\xda\xaa\x76" "\xea\x11\x35\x1a\x47\x61\x07\xd5\xda\x75\x54\x8f\xab\x4e\x6a\x3c\x76" "\x56\x4f\xaa\x09\xf8\x94\xea\xaa\x26\x61\x37\xf5\x8c\xea\xae\x9e\x55" "\x3d\xd4\x73\xaa\xa7\x6a\xe3\x7a\xa9\xde\x6a\x2a\xf6\x51\x7d\xd5\x0c" "\xec\xa7\xfa\xab\x01\x6a\xa0\x9a\x83\xd5\x55\x7a\xc7\x6a\xa8\x97\xd5" "\x73\x99\x87\xa9\xe1\xea\x15\xb5\x04\x5f\x55\x23\xd5\x6b\x6a\x94\x1a" "\xad\xc6\xa8\xd7\xd5\x58\x35\x4e\x8d\x57\x13\xd4\x44\x35\x49\x25\xab" "\x37\xd4\x64\xf5\xa6\x9a\xa2\xde\x52\x53\xd5\x34\x35\x5d\xcd\x50\x33" "\xd5\x2c\x35\x5b\xbd\xad\xe6\xa8\xb9\x6a\x9e\x7a\x47\xcd\x57\x0b\xd4" "\x42\xb5\x48\x2d\x56\x4b\xd4\x52\xf5\xae\x5a\xa6\xde\x53\x29\xea\x7d" "\xb5\x5c\x7d\xa0\x52\xd5\x0a\xb5\x52\xad\x52\xab\xd5\x1a\xb5\x56\xad" "\x53\xeb\xd5\x06\xb5\x51\x6d\x52\x9b\xd5\x16\xb5\x55\x6d\x53\xdb\xd5" "\x87\x6a\x87\xda\xa9\x76\xa9\xdd\x6a\x8f\xda\xab\xf6\xa9\x8f\xd4\x7e" "\xf5\xb1\x3a\xa0\x3e\x51\x69\xea\x53\x75\x50\xfd\x45\x1d\x52\x9f\xa9" "\xc3\xea\x73\x75\x44\x7d\xa1\x8e\xaa\x2f\xd5\x31\xf5\x95\x3a\xae\xbe" "\x56\x27\xd4\x37\xea\xa4\x3a\xa5\x4e\xab\x6f\xd5\x19\xf5\x9d\x3a\xab" "\xce\xa9\xf3\xea\x7b\x75\x41\xfd\xa0\x2e\xaa\x1f\xd5\x25\xe5\x15\x68" "\xd4\x4a\x6b\x6d\x74\xa0\x33\xe9\xcc\x3a\x41\x67\xd1\x89\xfa\x2a\x9d" "\x55\x67\xd3\xd9\x75\x0e\x1d\xd3\x57\xeb\x9c\xfa\x1a\x9d\x4b\x5f\xab" "\x73\xeb\x3c\x3a\xaf\xc9\xa7\xf3\xeb\x02\xba\xa0\x0e\x35\x69\xab\x59" "\x47\xba\x90\x2e\xac\xe3\xfa\x3a\x5d\x44\x5f\xaf\x8b\xea\x62\xba\xb8" "\x2e\xa1\x9d\x2e\xa9\x4b\xe9\xd2\xba\x8c\xbe\x41\x97\xd5\x37\xea\x72" "\xfa\x26\x5d\x5e\xdf\xac\x2b\xe8\x8a\xba\x92\x07\x7d\xab\xae\xac\x6f" "\xd3\x55\xf4\xed\xba\xaa\xbe\x43\x57\xd3\xd5\x75\x0d\x5d\x53\xdf\xa9" "\x6b\xe9\xbb\x74\x6d\x7d\xb7\xae\xa3\xef\xd1\x75\xf5\xbd\xba\x9e\xbe" "\x4f\xd7\xd7\xf7\xeb\x06\xba\xa1\x6e\xa4\x1f\xd0\x8d\xf5\x83\xba\x89" "\x6e\xaa\x9b\xe9\xe6\xba\x85\x6e\xa9\x5b\xe9\x87\x74\x6b\xfd\xb0\x6e" "\xa3\xdb\xea\x76\xfa\x11\xdd\x5e\x3f\xaa\x3b\xe8\xc7\x74\x47\xfd\xb8" "\xee\xa4\x9f\xd0\x9d\xf5\x93\xba\x8b\x7e\x4a\x77\xd5\x4f\xeb\x6e\xfa" "\x19\xdd\x5d\x3f\xab\x7b\xe8\x1f\xf5\x25\xed\x75\x2f\xdd\x5b\x27\xe9" "\x3e\xba\xaf\x7e\x41\xf7\xd3\xfd\xf5\x00\x3d\x50\x0f\xd2\x2f\xea\xc1" "\xfa\x25\x3d\x44\xbf\xac\x87\xea\x61\x7a\xb8\x7e\x45\x8f\xd0\xaf\xea" "\x91\xfa\x35\x3d\x4a\x8f\xd6\x63\xf4\xeb\x7a\xac\x1e\xa7\xc7\xeb\x09" "\x7a\xa2\x9e\xa4\x93\xf5\x1b\x7a\xb2\x7e\x53\x4f\xd1\x6f\xe9\xa9\x7a" "\x9a\x9e\xae\x67\xe8\x99\x7a\x96\x1e\xf0\xcb\x4c\xf3\xfe\x8d\xfc\x37" "\xff\x41\xfe\x90\x9f\xce\xbe\x4d\x6f\xd7\x1f\xea\x1d\x7a\xa7\xde\xa5" "\x77\xeb\x3d\x7a\xaf\xde\xa7\xf7\xe9\xfd\x7a\xbf\x3e\xa0\x0f\xe8\x34" "\x9d\xa6\x0f\xea\x83\xfa\x90\x3e\xa4\x0f\xeb\xc3\xfa\x88\x3e\xa2\x8f" "\xea\xa3\xfa\x98\x3e\xa6\x8f\xeb\xe3\xfa\x84\x3e\xa1\x4f\xea\x53\xfa" "\x7b\xfd\xad\x3e\xa3\xbf\xd3\x67\xf5\x39\x7d\x4e\x7f\xaf\x2f\xe8\x0b" "\xfa\xe2\x2f\x3f\x03\x30\x68\x94\xd1\xc6\x98\xc0\x64\x32\x99\x4d\x82" "\xc9\x62\x12\xcd\x55\x26\xab\xc9\x66\xb2\x9b\x1c\x26\x66\xae\x36\x39" "\xcd\x35\x26\x97\xb9\xd6\xe4\x36\x79\x4c\x5e\x93\xcf\xe4\x37\x05\x4c" "\x41\x13\x1a\x32\xd6\xb0\x89\x4c\x21\x53\xd8\xc4\xcd\x75\xa6\x88\xb9" "\xde\x14\x35\xc5\x4c\x71\x53\xc2\x38\x53\xd2\x94\x32\xa5\xff\x7b\xf9" "\xaa\xb4\xf9\xbd\xfa\x5a\x99\x56\xa6\xb5\x69\x6d\xda\x98\x36\xa6\x9d" "\x69\x67\xda\x9b\xf6\xa6\x83\xe9\x60\x3a\x9a\x8e\xa6\x93\xe9\x64\x3a" "\x9b\xce\xa6\x8b\xe9\x62\xba\x9a\xae\xa6\x9b\xe9\x66\xba\x9b\xee\xa6" "\x87\xe9\x61\x7a\x9a\x9e\xa6\x97\xe9\x65\x92\x4c\x92\xe9\x6b\x5e\x30" "\xfd\x4c\x7f\x33\xc0\x0c\x34\x83\xcc\x8b\x66\xb0\x19\x6c\x86\x98\x21" "\x66\xa8\x19\x6a\x86\x9b\xe1\x66\x84\x19\x61\x46\x9a\x91\x66\x94\x19" "\x65\xc6\x98\x31\x66\xac\x19\x6b\xc6\x9b\xf1\x66\xa2\x99\x68\x92\x7d" "\x0e\x33\xd9\x4c\x36\x53\xcc\x14\x33\xd5\x4c\x35\xd3\x07\xe5\x30\x33" "\xcd\x4c\x33\xdb\xcc\x36\x73\xcc\x1c\x33\xcf\xcc\x33\xf3\xcd\x7c\xb3" "\xd0\x2c\x34\x8b\xcd\x62\xb3\xd4\x2c\x35\xcb\xcc\x32\x93\x62\x52\xcc" "\x72\xb3\xdc\xa4\x9a\x15\x66\x85\x59\x65\x56\x99\x35\x66\x8d\x59\x67" "\xd6\x99\x0d\x66\x83\xd9\x64\x36\x99\x2d\x66\x8b\x49\x35\xdb\xcd\x76" "\xb3\xc3\xec\x30\xbb\xcc\x2e\xb3\xc7\xec\x31\xfb\xcc\x3e\xb3\xdf\xec" "\x37\x07\xcc\x01\x93\x66\xd2\xcc\x41\x73\xd0\x1c\x32\x87\xcc\x61\x73" "\xd8\x1c\x31\x47\xcc\x51\x73\xd4\x1c\x33\xc7\xcc\x71\x73\xdc\x9c\x30" "\x27\xcc\x49\x73\xd2\x9c\x36\xa7\xcd\x19\x73\xc6\x9c\x35\x67\xcd\x79" "\x73\xde\x5c\x30\x17\xcc\x45\x73\xd1\x5c\x32\x97\xd2\x6f\xfb\x02\x15" "\xa8\xc0\x04\x26\xc8\x14\x64\x0a\x12\x82\x84\x20\x31\x48\x0c\xb2\x06" "\x59\x83\xec\x41\xf6\x20\x16\xc4\x82\x9c\x41\xce\x20\x57\x70\x6d\x90" "\x3b\xc8\x13\xe4\x0d\xf2\x05\xf9\x83\x02\x41\xc1\x20\x0c\x28\xb0\x01" "\x07\x51\x50\x28\x28\x1c\xc4\x83\xeb\x82\x22\xc1\xf5\x41\xd1\xa0\x58" "\x50\x3c\x28\x11\xb8\xa0\x64\x50\x2a\x28\x1d\x94\x09\x6e\x08\xca\x06" "\x37\x06\xe5\x82\x9b\x82\xf2\xc1\xcd\x41\x85\xa0\x62\x50\x29\xb8\x25" "\xb8\x35\xa8\x1c\xdc\x16\x54\x09\x6e\x0f\xaa\x06\x77\x04\xd5\x82\xea" "\x41\x8d\xa0\x66\x70\x67\x50\x2b\xb8\x2b\xa8\x1d\xdc\x1d\xd4\x09\xee" "\x09\xea\x06\xf7\x06\xf5\x82\xfb\x82\xfa\xc1\xfd\x41\x83\xa0\x61\xd0" "\x28\x78\x20\x68\x1c\x3c\x18\x34\x09\x9a\x06\xcd\x82\xe6\x41\x8b\xa0" "\x65\xd0\xea\x0f\x9d\xdf\xfb\xb3\x79\x1e\x76\xbd\xc2\xde\x61\x52\xd8" "\x27\xec\x1b\xbe\x10\xf6\x0b\xfb\x87\x03\xc2\x81\xe1\xa0\xf0\xc5\x70" "\x70\xf8\x52\x38\x24\x7c\x39\x1c\x1a\x0e\x0b\x87\x87\xaf\x84\x23\xc2" "\x57\xc3\x91\xe1\x6b\xe1\xa8\x70\x74\x38\x26\x7c\x3d\x1c\x1b\x8e\x0b" "\xc7\x87\x13\xc2\x89\xe1\xa4\x30\x39\x7c\x23\x9c\x1c\xbe\x19\x4e\x09" "\xdf\x0a\xa7\x86\xd3\xc2\xe9\xc1\x8c\x70\x66\x38\x2b\x9c\x1d\xbe\x1d" "\xce\x09\xe7\x86\xf3\xc2\x77\xc2\xf9\xe1\x82\x70\x61\xb8\x28\x5c\x1c" "\x2e\x09\xf1\xe7\x5b\x62\x48\x09\xdf\x0f\x97\x87\x1f\x84\xa9\xe1\x8a" "\x70\x65\xb8\x2a\x5c\x1d\xae\x09\xd7\x86\xeb\xc2\xf5\xe1\x86\x70\x63" "\xb8\x29\xdc\x1c\x6e\x29\x37\xf8\xe7\x43\xc3\x1d\xe1\xce\x70\x57\xb8" "\x3b\xdc\x13\xee\x0d\xf7\x85\x1f\x85\xfb\xc3\x8f\xc3\x03\xe1\x27\x61" "\x5a\xf8\x69\x78\x30\xfc\x4b\x78\x28\xfc\x2c\x3c\x1c\x7e\x1e\x1e\x09" "\xbf\x08\x8f\x86\x5f\x86\xc7\xc2\xaf\xc2\xe3\xe1\xd7\xe1\x89\xf0\x9b" "\xf0\x64\x78\x2a\x3c\x1d\x7e\x1b\x9e\x09\xbf\x0b\xcf\x86\xe7\xc2\xf3" "\xe1\xf7\xe1\x85\xf0\x87\xf0\x62\xf8\x63\x78\x29\xf4\xe9\x37\xf7\xe9" "\x97\x77\x32\x64\x28\x13\x65\xa2\x04\x4a\xa0\x44\x4a\xa4\xac\x94\x95" "\xb2\x53\x76\x8a\x51\x8c\x72\x52\x4e\xca\x45\xb9\x28\x37\xe5\xa6\xbc" "\x94\x97\xf2\x53\x7e\x2a\x48\x05\x29\x1d\x13\x53\x21\x2a\x44\x71\x8a" "\x53\x11\x2a\x42\x45\xa9\x28\x15\xa7\xe2\xe4\xc8\x51\x29\x2a\x45\x65" "\xa8\x0c\x95\xa5\xb2\x54\x8e\xca\x51\x79\x2a\x4f\x15\xa8\x02\x55\xa2" "\x4a\x74\x2b\xdd\x4a\xb7\xd1\x6d\x74\x3b\xdd\x4e\x77\xd0\x1d\x54\x9d" "\xaa\x53\x4d\xaa\x49\xb5\xa8\x16\xd5\xa6\xda\x54\x87\xea\x50\x5d\xaa" "\x4b\xf5\xa8\x1e\xd5\xa7\xfa\xd4\x80\x1a\x50\x23\x6a\x44\x8d\xa9\x31" "\x35\xa1\x26\xd4\x8c\x9a\x51\x0b\x6a\x41\xad\xa8\x15\xb5\xa6\xd6\xd4" "\x86\xda\x50\x3b\x6a\x47\xed\xa9\x3d\x75\xa0\x0e\xd4\x91\x3a\x52\x27" "\xea\x44\x9d\xa9\x33\x75\xa1\x2e\xd4\x95\xba\x52\x37\xea\x46\xdd\xa9" "\x3b\xf5\xa0\x1e\xd4\x93\x7a\x52\x2f\xea\x45\x49\x94\x44\x7d\xa9\x2f" "\xf5\xa3\x7e\x34\x80\x06\xd0\x20\x1a\x44\x83\x69\x30\x0d\xa1\x21\x34" "\x94\x86\xd2\x70\x1a\x4e\x23\x68\x04\x8d\xa4\x91\x34\x8a\x46\xd3\x18" "\x7a\x9d\xc6\xd2\x38\x1a\x4f\x13\x68\x22\x4d\xa2\x64\x4a\xa6\xc9\x34" "\x99\xa6\xd0\x14\x9a\x4a\x53\x69\x3a\x4d\xa7\x99\x34\x93\x66\xd3\x6c" "\x9a\x43\x73\x68\x1e\xcd\xa3\xf9\x34\x9f\x16\xd2\x42\x5a\x4c\x8b\x69" "\x29\x2d\xa5\x65\xb4\x8c\x52\x28\x85\x96\xd3\x72\x4a\xa5\x54\x5a\x49" "\x2b\x69\x35\xad\xa6\xb5\xb4\x96\xd6\xd3\x7a\xda\x48\x1b\x69\x33\x6d" "\xa6\xad\xb4\x95\xb6\xd3\x76\xda\x41\x3b\x68\x17\xed\xa2\x3d\xb4\x87" "\xf6\xd1\x3e\xda\x4f\xfb\xe9\x00\x1d\xa0\x34\x4a\xa3\x83\x74\x90\x0e" "\xd1\x21\x3a\x4c\x87\xe9\x08\x1d\xa1\xa3\x74\x94\x8e\xd1\x31\x3a\x4e" "\xc7\xe9\x04\x9d\xa0\x93\x74\x92\x4e\xd3\x69\x3a\x43\x67\xe8\x2c\x9d" "\xa5\xf3\x74\x9e\x2e\xd0\x0f\x74\x91\x7e\xa4\x4b\xe4\x29\xc1\x66\xb1" "\x89\xf6\x2a\x9b\xd5\x66\xb3\xd9\x6d\x0e\xfb\xb7\x71\x5e\x9b\xcf\xe6" "\xb7\x05\x6c\x41\x1b\xda\xdc\x36\xcf\x6f\x62\xb2\xd6\x16\xb5\xc5\x6c" "\x71\x5b\xc2\x3a\x5b\xd2\x96\xb2\xa5\xff\x2e\xae\x60\x2b\xda\x4a\xf6" "\x16\x7b\xab\xad\x6c\x6f\xb3\x55\x6c\x05\x9b\x05\xfe\x3a\xae\x65\xef" "\xb2\xb5\xed\xdd\xb6\x8e\xbd\xc7\xd6\xb4\x77\xfe\x26\xae\x6b\xef\xb5" "\xf5\xec\x83\xb6\xbe\x6d\x6a\x1b\xd8\xe6\xb6\x91\x6d\x69\x1b\xdb\x07" "\x6d\x13\xdb\xd4\x36\xb3\xcd\x6d\x0b\xdb\xd2\xb6\xb7\x8f\xda\x0e\xf6" "\x31\xdb\xd1\x3e\x6e\x3b\xd9\x27\xfe\x2e\x5e\x66\xdf\xb3\xeb\xed\x06" "\xbb\xd1\x6e\xb2\xfb\xed\xc7\xf6\xbc\xfd\xde\x1e\xb3\x5f\xd9\x0b\xf6" "\x07\xdb\xcb\xf6\xb6\x83\xec\x8b\x76\xb0\x7d\xc9\x0e\xb1\x2f\xdb\xa1" "\x76\xd8\x6f\x63\x00\x3b\xc6\xbe\x6e\xc7\xda\x71\x76\xbc\x9d\x60\x27" "\xda\x49\x7f\x17\x4f\xb7\x33\xec\x4c\x3b\xcb\xce\xb6\x6f\xdb\x39\x76" "\xee\xdf\xc5\x4b\xed\xbb\x76\xbe\x4d\xb1\x0b\xed\x22\xbb\xd8\x2e\xf9" "\x29\x4e\xaf\x29\xc5\xbe\x6f\x97\xdb\x0f\x6c\xaa\x5d\x61\x57\xda\x55" "\x76\xb5\x5d\x63\xd7\xda\x75\xff\xb7\xd6\x55\x76\x8b\xdd\x6a\xb7\xd9" "\x7d\xf6\x23\xbb\xc3\xee\xb4\xbb\xec\x6e\xbb\xc7\xee\xfd\x29\x4e\x5f" "\xc7\x01\xfb\x89\x4d\xb3\x9f\xda\xa3\xf6\x4b\x7b\xc8\x7e\x66\x0f\xdb" "\xe3\xf6\x88\xfd\xe2\xa7\x38\x7d\x7d\xc7\xed\xd7\xf6\x84\xfd\xc6\x9e" "\xb4\xa7\xec\x69\xfb\xad\x3d\x63\xbf\xb3\x67\xed\xb9\x9f\xd6\x9f\xbe" "\xf6\x6f\xed\x8f\xf6\x92\xf5\x16\x18\x59\xb1\x66\xc3\x01\x67\xe2\xcc" "\x9c\xc0\x59\x38\x91\xaf\xe2\xac\x9c\x8d\xb3\x73\x0e\x8e\xf1\xd5\x9c" "\x93\xaf\xe1\x5c\x7c\x2d\xe7\xe6\x3c\x9c\x97\xf3\x71\x7e\x2e\xc0\x05" "\x39\x64\x62\xcb\xcc\x11\x17\xe2\xc2\x1c\xe7\xeb\xb8\x08\x5f\xcf\x45" "\xb9\x18\x17\xe7\x12\xec\xb8\x24\x97\xe2\xd2\x5c\x86\x6f\xe0\xb2\x7c" "\x23\x97\xe3\x9b\xb8\x3c\xdf\xcc\x15\xb8\x22\x57\xe2\x5b\xf8\x56\xae" "\xcc\xb7\x71\x15\xbe\x9d\xab\xf2\x1d\x5c\x8d\xab\x73\x0d\xae\xc9\x77" "\x72\x2d\xbe\x8b\x6b\xf3\xdd\x5c\x87\xef\xe1\xba\x7c\x2f\xd7\xe3\xfb" "\xb8\x3e\xdf\xcf\x0d\xb8\x21\x37\xe2\x07\xb8\x31\x3f\xc8\x4d\xb8\x29" "\x37\xe3\xe6\xdc\x82\x5b\x72\x2b\x7e\x88\x5b\xf3\xc3\xdc\x86\xdb\x72" "\x3b\x7e\x84\xdb\xf3\xa3\xdc\x81\x1f\xe3\x8e\xfc\x38\x77\xe2\x27\xb8" "\x33\x3f\xc9\x5d\xf8\x29\xee\xca\x4f\x73\x37\x7e\x86\xbb\xf3\xb3\xdc" "\x83\x9f\xe3\x9e\xfc\x3c\xf7\xe2\xde\x9c\xc4\x7d\xb8\x2f\xbf\xc0\xfd" "\xb8\x3f\x0f\xe0\x81\x3c\x88\x5f\xe4\xc1\xfc\x12\x0f\xe1\x97\x79\x28" "\x0f\xe3\xe1\xfc\x0a\x8f\xe0\x57\x79\x24\xbf\xc6\xa3\x78\x34\x8f\xe1" "\xd7\x79\x2c\x8f\xe3\xf1\x3c\x81\x27\xf2\x24\x4e\xe6\x37\x78\x32\xbf" "\xc9\x53\xf8\x2d\x9e\xca\xd3\x78\x3a\xcf\xe0\x99\x3c\x8b\x67\xf3\xdb" "\x3c\x87\xe7\xf2\x3c\x7e\x87\xe7\xf3\x02\x5e\xc8\x8b\x78\x31\x2f\xe1" "\xa5\xfc\x2e\x2f\xe3\xf7\x38\x85\xdf\xe7\xe5\xfc\x01\xa7\xf2\x0a\x5e" "\xc9\xab\x78\x35\xaf\xe1\xb5\xbc\x8e\xd7\xf3\x06\xde\xc8\x9b\x78\x33" "\x6f\xe1\xad\xbc\x8d\xb7\xf3\x87\xbc\x83\x77\xf2\x2e\xde\xcd\x7b\x78" "\x2f\xef\xe3\x8f\x78\x3f\x7f\xcc\x07\xf8\x13\x4e\xe3\x4f\xf9\x20\xff" "\x85\x0f\xf1\x67\x7c\x98\x3f\xe7\x23\xfc\x05\x1f\xe5\x2f\xf9\x18\x7f" "\xc5\xc7\xf9\x6b\x3e\xc1\xdf\xf0\x49\x3e\xc5\xa7\xf9\x5b\x3e\xc3\xdf" "\xf1\x59\x3e\xc7\xe7\xf9\x7b\xbe\xc0\x3f\xf0\x45\xfe\x91\x2f\xb1\x67" "\x88\x30\x52\x91\x8e\x4c\x14\x44\x99\xa2\xcc\x51\x42\x94\x25\x4a\x8c" "\xae\x8a\xb2\x46\xd9\xa2\xec\x51\x8e\x28\x16\x5d\x1d\xe5\x8c\xae\x89" "\x72\x45\xd7\x46\xb9\xa3\x3c\x51\xde\x28\x5f\x94\x3f\x2a\x10\x15\x8c" "\xc2\x88\x22\x1b\x71\x14\x45\x85\xa2\xc2\x51\x3c\xba\x2e\x2a\x12\x5d" "\x1f\x15\x8d\x8a\x45\xc5\xa3\x12\x91\x8b\x4a\x46\xa5\xa2\xd2\x51\x99" "\xe8\x86\xa8\x6c\x74\x63\x54\x2e\xba\x29\x2a\x1f\xdd\x1c\x55\x88\x2a" "\x46\x95\xa2\x5b\xa2\x5b\xa3\xca\xd1\x6d\x51\x95\xe8\xf6\xa8\x6a\x74" "\x47\x54\x2d\xaa\x1e\xd5\x88\x6a\x46\x77\x46\xb5\xa2\xbb\xa2\xda\xd1" "\xdd\x51\x9d\xe8\x9e\xa8\x6c\x74\x6f\x54\x2f\xba\x2f\xaa\x1f\xdd\x1f" "\x35\x88\x1a\x46\x8d\xa2\x07\xa2\xc6\xd1\x83\x51\x93\xa8\x69\xd4\x2c" "\x6a\x1e\xb5\x88\x5a\x46\xad\xa2\x87\xa2\xd6\xd1\xc3\x51\x9b\xa8\x6d" "\xd4\x2e\x7a\x24\x6a\x1f\x3d\x1a\x75\x88\x1e\x8b\x3a\x46\x8f\x47\x9d" "\xa2\x27\x2e\xef\x2f\x16\xfc\x7c\x35\xfd\x9b\xfd\x49\x51\x9f\x48\xff" "\xf2\x86\xec\x6e\xbd\x38\xbe\x24\xbe\x34\xfe\x6e\x7c\x59\xfc\xbd\x78" "\x4a\xfc\xfd\xf8\xf2\xf8\x07\xf1\xd4\xf8\x8a\xf8\xca\xf8\xaa\xf8\xea" "\xf8\x9a\xf8\xda\xf8\xba\xf8\xfa\xf8\x86\xf8\xc6\xf8\xa6\xf8\xe6\xf8" "\x96\xf8\xd6\xf8\xb6\xb8\xf7\x35\x33\x83\xc3\xf4\x07\x61\x30\x2e\x70" "\x99\x5c\x66\x97\xe0\xb2\xb8\x44\x77\x95\xcb\xea\xb2\xb9\xec\x2e\x87" "\x8b\xb9\xab\x5d\x4e\x77\x8d\xcb\xe5\xae\x75\xb9\x5d\x1e\x97\xd7\xe5" "\x73\xf9\x5d\x01\x57\xd0\x85\x8e\x9c\x75\xec\x22\x57\xc8\x15\x76\x71" "\x77\x9d\x2b\xe2\xae\x77\x45\x5d\x31\x57\xdc\x95\x70\xce\x95\x74\xa5" "\x5c\x4b\xd7\xca\xb5\x72\xad\xdd\xc3\xae\x8d\x6b\xeb\xda\xb9\x47\xdc" "\x23\xee\x51\xf7\xa8\x7b\x2c\xe1\x97\xc2\x5d\x67\xf7\xa4\xeb\xe2\x9e" "\x72\x5d\xdd\xd3\xee\x69\xf7\x8c\xeb\xee\x9e\x75\x3d\xdc\x73\xae\xa7" "\x7b\xde\xf5\x72\xbd\x5d\x92\x4b\x72\x7d\x5d\x5f\xd7\xcf\xf5\x73\x03" "\xdc\x00\x37\xc8\x0d\x72\x83\xdd\x60\x37\xc4\x0d\x71\x43\xdd\x50\x37" "\xdc\x0d\x07\x70\x23\xdc\x48\x37\xd2\x8d\x72\xa3\xdc\x18\x37\xc6\x8d" "\x75\x63\xdd\x78\x37\xde\x4d\x74\x13\x5d\xb2\x4b\x76\x93\xdd\x64\x37" "\xc5\x4d\x71\x53\xdd\x54\x37\xdd\x4d\x77\x33\xdd\x4c\x37\xdb\xcd\x76" "\x73\xdc\x1c\x37\xcf\xcd\x73\xf3\xdd\x7c\xb7\xd0\x2d\x74\x8b\xdd\x62" "\xb7\xd4\x2d\x75\xcb\xdc\x32\x97\xe2\x52\xdc\x72\xb7\xdc\xa5\xba\x54" "\xb7\xd2\xad\x74\xab\xdd\x6a\xb7\xd6\xad\x75\xeb\xdd\x7a\xb7\xd1\x6d" "\x74\x9b\xdd\x66\xb7\xd5\x6d\x75\xdb\xdd\x76\xb7\xc3\xed\x70\xbb\xdc" "\x2e\xb7\xc7\xed\x71\xfb\xdc\x3e\xb7\xdf\xed\x77\x07\xdc\x01\x97\xe6" "\xd2\xdc\x41\x77\xd0\x1d\x72\x87\xdc\x61\xf7\xb9\x3b\xe2\xbe\x70\x47" "\xdd\x97\xee\x98\xfb\xca\x1d\x77\x5f\xbb\x13\xee\x1b\x77\xd2\x9d\x72" "\xa7\x9d\xd7\x67\xdc\x77\xee\xac\x3b\xe7\xce\xbb\xef\xdd\x05\xf7\x83" "\xbb\xe8\x7e\x74\x97\x9c\x77\xc9\xb1\x37\x62\x93\x63\x6f\xc6\xa6\xc4" "\xde\x8a\x4d\x8d\x4d\x8b\x4d\x8f\xcd\x88\xcd\x8c\xcd\x8a\xcd\x8e\xbd" "\x1d\x9b\x13\x9b\x1b\x9b\x17\x7b\x27\x36\x3f\xb6\x20\xb6\x30\xb6\x28" "\xb6\x38\xb6\x24\xb6\x34\xf6\x6e\x6c\x59\xec\xbd\x58\x4a\xec\xfd\xd8" "\xf2\xd8\x07\xb1\xd4\xd8\x8a\xd8\xca\xd8\xaa\xd8\xea\xd8\x9a\x98\xf7" "\x05\x76\x44\xbe\x90\x2f\xec\xe3\xfe\x3a\x5f\xc4\x5f\xef\x8b\xfa\x62" "\xbe\xb8\x2f\xe1\x9d\x2f\xe9\x4b\xf9\xd2\xbe\x8c\xbf\xc1\x97\xf5\x37" "\xfa\x72\xfe\x26\x5f\xde\xdf\xec\x2b\xf8\x8a\xbe\x92\x6f\xea\x9b\xf9" "\xe6\xbe\x85\x6f\xe9\x5b\xf9\x87\x7c\x6b\xff\xb0\x6f\xe3\xdb\xfa\x76" "\xfe\x11\xdf\xde\x3f\xea\x3b\xf8\xc7\x7c\x47\xff\xb8\xef\xe4\x9f\xf0" "\x9d\xfd\x93\xbe\x8b\x7f\xca\x77\xf5\x4f\xfb\x6e\xfe\x99\x05\xbf\x74" "\xd9\xf7\xf4\xcf\xfb\x5e\xbe\xb7\x4f\xf2\x7d\x7c\x5f\xff\x82\xef\xe7" "\xfb\xfb\x01\x7e\xa0\x1f\xe4\x5f\xf4\x83\xfd\x4b\x7e\x88\x7f\xd9\x0f" "\xf5\xc3\xfc\x70\xff\x8a\x1f\xe1\x5f\xf5\x23\xfd\x6b\x7e\x94\x1f\xed" "\xc7\xf8\xd7\xfd\x58\x3f\xce\x8f\xf7\x13\xfc\x44\x3f\xc9\x27\xfb\x37" "\xfc\x64\xff\xa6\x9f\xe2\xdf\xf2\x53\xfd\x34\x3f\xdd\xcf\xf0\x33\xfd" "\x2c\x3f\xdb\xbf\xed\xe7\xf8\xb9\x7e\x9e\x7f\xc7\xcf\xf7\x0b\xfc\x42" "\xbf\xc8\x2f\xf6\x4b\xfc\x52\xff\xae\x5f\xe6\xdf\xf3\x29\xfe\x7d\xbf" "\xdc\x7f\xe0\x53\xfd\x0a\xbf\xd2\xaf\xf2\xab\xfd\x1a\xbf\xd6\xaf\xf3" "\xeb\xfd\x06\xbf\xd1\x6f\xf2\x9b\xfd\x16\xbf\xd5\x6f\xf3\xdb\xfd\x87" "\x7e\x87\xdf\xe9\x77\xf9\xdd\x7e\x8f\xdf\xeb\xf7\xf9\x8f\xfc\x7e\xff" "\xb1\x3f\xe0\x3f\xf1\x69\xfe\x53\x7f\xd0\xff\xc5\x1f\xf2\x9f\xf9\xc3" "\xfe\x73\x7f\xc4\x7f\xe1\x8f\xfa\x2f\xfd\x31\xff\x95\x3f\xee\xbf\xf6" "\x27\xfc\x37\xfe\xa4\x3f\xe5\x4f\xfb\x6f\xfd\x19\xff\x9d\x3f\xeb\xcf" "\xf9\xf3\xfe\x7b\x7f\xc1\xff\xe0\x2f\xfa\x1f\xfd\x25\xf9\x9b\x35\x21" "\x84\x10\x42\x88\x7f\x8b\xfe\x9d\xfd\x7d\xfe\xc1\xff\xa9\x5f\xb6\x74" "\x7d\x01\x20\xdb\xce\x7c\x47\xfe\x76\xce\xcd\xb9\x7f\x1e\xf7\x57\xfb" "\x3b\xc5\x00\xe0\xf1\xde\xdd\x1a\xfe\xba\x35\x6c\x98\x94\x94\xf4\xcb" "\xb1\xa9\x1a\x82\xc2\x8b\x00\x20\x76\x39\xff\xa7\xef\x1f\xf8\x25\x5e" "\x01\xed\xe0\x51\xe8\x08\x6d\xa1\xcc\x3f\xac\xaf\xbf\xaa\xf4\xd3\x7d" "\xdf\xbf\x9a\x3f\x7e\x13\x40\x22\x40\x96\x5f\x73\xd2\x1f\x8f\x12\xe1" "\x6f\xe7\xbf\xe1\x9f\xcc\xdf\xf4\x5d\xfe\xbd\xf9\x17\x01\x14\x2d\x7c" "\x39\x27\xfd\x44\xbf\xc6\x97\xe7\x2f\xfb\x4f\xe6\xdf\xdb\xfe\x77\xe6" "\xcf\xf2\x59\x32\x40\x9b\xbf\xca\xc9\x0a\x97\xe3\xcb\xf3\x97\x82\x87" "\xe1\x09\xe8\xf8\x9b\x23\x85\x10\x42\x08\x21\x84\x10\x42\x88\x9f\xf5" "\x57\x17\xba\xff\xde\xf3\x6d\xfa\xf3\x79\x7e\x73\x39\x27\x33\x5c\x8e" "\x7f\xef\xf9\xfc\x77\x54\xf9\x23\xd6\x20\x84\x10\x42\x08\x21\x84\x10" "\x42\x88\x7f\xed\xa9\x67\x7b\x3c\xf6\x50\xc7\x8e\x6d\xbb\xfc\x6f\x1e" "\x64\xfe\x73\x94\xf1\x27\x18\x20\x00\xfc\x09\xca\x90\xc1\x9f\x7f\x70" "\xa5\x7f\x33\x09\x21\x84\x10\x42\x08\x21\xfe\x68\x97\x6f\xfa\xaf\x74" "\x25\x42\x08\x21\x84\x10\x42\x08\x21\x84\x10\x42\x08\x21\x84\x10\x42" "\x08\x21\x84\x10\x42\x08\x21\x84\x10\x42\x08\x21\x84\x10\x42\x08\x21" "\x84\x10\x42\x08\x21\x44\xc6\xf5\x9f\x7f\x43\x98\xfa\xb7\x0f\xbe\xd2" "\x6b\x14\x42\x08\x21\x84\x10\x42\x08\x21\x84\x10\x42\x08\x21\x84\x10" "\x42\x08\x21\x84\x10\x42\x08\x21\x84\x10\x42\x08\x21\x84\x10\x42\x08" "\x21\x84\x10\x42\x08\x21\x84\x10\x42\x08\x21\x84\x10\x42\x08\x21\xae" "\xb4\xff\x13\x00\x00\xff\xff\x56\xbc\x54\x44", 5383)); NONFAILING(syz_mount_image(/*fs=*/0x200000000280, /*dir=*/0x200000001cc0, /*flags=MS_STRICTATIME*/ 0x1000000, /*opts=*/0x2000000018c0, /*chdir=*/0xfd, /*size=*/0x1507, /*img=*/0x200000001d00)); break; case 1: // open arguments: [ // file: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 32 00} (length 0x8) // } // flags: open_flags = 0x24842 (8 bytes) // mode: open_mode = 0x80 (8 bytes) // ] // returns fd NONFAILING(memcpy((void*)0x2000000000c0, "./file2\000", 8)); res = syscall( __NR_open, /*file=*/0x2000000000c0ul, /*flags=O_NONBLOCK|O_NOFOLLOW|O_DIRECT|O_CREAT|O_RDWR*/ 0x24842ul, /*mode=S_IWUSR*/ 0x80ul); if (res != -1) r[0] = res; break; case 2: // pwritev2 arguments: [ // fd: fd (resource) // vec: ptr[in, array[iovec[in, array[int8]]]] { // array[iovec[in, array[int8]]] { // iovec[in, array[int8]] { // addr: ptr[in, buffer] { // buffer: {85} (length 0x1) // } // len: len = 0xfffffdd6 (8 bytes) // } // } // } // vlen: len = 0x1 (8 bytes) // off_low: int32 = 0x9c00 (4 bytes) // off_high: int32 = 0x0 (4 bytes) // flags: rwf_flags = 0x3 (8 bytes) // ] NONFAILING(*(uint64_t*)0x200000000240 = 0x200000000000); NONFAILING(memset((void*)0x200000000000, 133, 1)); NONFAILING(*(uint64_t*)0x200000000248 = 0xfffffdd6); syscall(__NR_pwritev2, /*fd=*/r[0], /*vec=*/0x200000000240ul, /*vlen=*/1ul, /*off_low=*/0x9c00, /*off_high=*/0, /*flags=RWF_HIPRI|RWF_DSYNC*/ 3ul); break; case 3: // openat arguments: [ // fd: fd_dir (resource) // file: ptr[in, buffer] { // buffer: {2e 00} (length 0x2) // } // flags: open_flags = 0x100 (4 bytes) // mode: open_mode = 0x52 (2 bytes) // ] // returns fd NONFAILING(memcpy((void*)0x200000000140, ".\000", 2)); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000140ul, /*flags=O_NOCTTY*/ 0x100, /*mode=S_IWOTH|S_IWGRP|S_IXUSR*/ 0x52); if (res != -1) r[1] = res; break; case 4: // ioctl$FS_IOC_REMOVE_ENCRYPTION_KEY arguments: [ // fd: fd_dir (resource) // cmd: const = 0x8004587d (4 bytes) // arg: ptr[inout, fscrypt_remove_key_arg] { // fscrypt_remove_key_arg { // key_spec: union fscrypt_key_specifier { // desc: fscrypt_key_specifier__by_descriptor { // type: const = 0x1 (4 bytes) // reserved: const = 0x0 (4 bytes) // descriptor: union fscrypt_key_descriptor { // desc3: buffer: {e8 da b9 92 34 bb 31 2e} (length 0x8) // } // reserved2: buffer: {00 00 00 00 00 00 00 00 00 00 00 00 00 00 // 00 00 00 00 00 00 00 00 00 00} (length 0x18) // } // } // removal_status_flags: int32 = 0x0 (4 bytes) // reserved: buffer: {00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // 00 00 00 00} (length 0x14) // } // } // ] NONFAILING(*(uint32_t*)0x200000000080 = 1); NONFAILING(*(uint32_t*)0x200000000084 = 0); NONFAILING(memcpy((void*)0x200000000088, "\350\332\271\2224\2731.", 8)); NONFAILING(memset((void*)0x200000000090, 0, 24)); NONFAILING(memset((void*)0x2000000000ac, 0, 20)); syscall(__NR_ioctl, /*fd=*/r[1], /*cmd=*/0x8004587d, /*arg=*/0x200000000080ul); break; } } int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0x1000000ul, /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/ 7ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x200001000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); setup_sysctl(); const char* reason; (void)reason; if ((reason = setup_binfmt_misc())) printf("the reproducer may not work as expected: binfmt_misc setup failed: " "%s\n", reason); if ((reason = setup_swap())) printf("the reproducer may not work as expected: swap setup failed: %s\n", reason); install_segv_handler(); use_temporary_dir(); do_sandbox_none(); return 0; }