// https://syzkaller.appspot.com/bug?id=d8c3ff8bbd3553eb4f63b542c8de7ad43d1892ce // 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_bpf #define __NR_bpf 280 #endif #ifndef __NR_connect #define __NR_connect 203 #endif #ifndef __NR_dup #define __NR_dup 23 #endif #ifndef __NR_io_uring_setup #define __NR_io_uring_setup 425 #endif #ifndef __NR_ioctl #define __NR_ioctl 29 #endif #ifndef __NR_memfd_create #define __NR_memfd_create 279 #endif #ifndef __NR_mkdirat #define __NR_mkdirat 34 #endif #ifndef __NR_mmap #define __NR_mmap 222 #endif #ifndef __NR_openat #define __NR_openat 56 #endif #ifndef __NR_prctl #define __NR_prctl 167 #endif #ifndef __NR_read #define __NR_read 63 #endif #ifndef __NR_sendmmsg #define __NR_sendmmsg 269 #endif #ifndef __NR_socket #define __NR_socket 198 #endif #ifndef __NR_write #define __NR_write 64 #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 void netlink_nest(struct nlmsg* nlmsg, int typ) { struct nlattr* attr = (struct nlattr*)nlmsg->pos; attr->nla_type = typ; nlmsg->pos += sizeof(*attr); nlmsg->nested[nlmsg->nesting++] = attr; } static void netlink_done(struct nlmsg* nlmsg) { struct nlattr* attr = nlmsg->nested[--nlmsg->nesting]; attr->nla_len = nlmsg->pos - (char*)attr; } 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 int netlink_next_msg(struct nlmsg* nlmsg, unsigned int offset, unsigned int total_len) { struct nlmsghdr* hdr = (struct nlmsghdr*)(nlmsg->buf + offset); if (offset == total_len || offset + hdr->nlmsg_len > total_len) return -1; return hdr->nlmsg_len; } static void netlink_add_device_impl(struct nlmsg* nlmsg, const char* type, const char* name, bool up) { struct ifinfomsg hdr; memset(&hdr, 0, sizeof(hdr)); if (up) hdr.ifi_flags = hdr.ifi_change = IFF_UP; netlink_init(nlmsg, RTM_NEWLINK, NLM_F_EXCL | NLM_F_CREATE, &hdr, sizeof(hdr)); if (name) netlink_attr(nlmsg, IFLA_IFNAME, name, strlen(name)); netlink_nest(nlmsg, IFLA_LINKINFO); netlink_attr(nlmsg, IFLA_INFO_KIND, type, strlen(type)); } static void netlink_add_device(struct nlmsg* nlmsg, int sock, const char* type, const char* name) { netlink_add_device_impl(nlmsg, type, name, false); netlink_done(nlmsg); int err = netlink_send(nlmsg, sock); if (err < 0) { } } static void netlink_add_veth(struct nlmsg* nlmsg, int sock, const char* name, const char* peer) { netlink_add_device_impl(nlmsg, "veth", name, false); netlink_nest(nlmsg, IFLA_INFO_DATA); netlink_nest(nlmsg, VETH_INFO_PEER); nlmsg->pos += sizeof(struct ifinfomsg); netlink_attr(nlmsg, IFLA_IFNAME, peer, strlen(peer)); netlink_done(nlmsg); netlink_done(nlmsg); netlink_done(nlmsg); int err = netlink_send(nlmsg, sock); if (err < 0) { } } static void netlink_add_xfrm(struct nlmsg* nlmsg, int sock, const char* name) { netlink_add_device_impl(nlmsg, "xfrm", name, true); netlink_nest(nlmsg, IFLA_INFO_DATA); int if_id = 1; netlink_attr(nlmsg, 2, &if_id, sizeof(if_id)); netlink_done(nlmsg); netlink_done(nlmsg); int err = netlink_send(nlmsg, sock); if (err < 0) { } } static void netlink_add_hsr(struct nlmsg* nlmsg, int sock, const char* name, const char* slave1, const char* slave2) { netlink_add_device_impl(nlmsg, "hsr", name, false); netlink_nest(nlmsg, IFLA_INFO_DATA); int ifindex1 = if_nametoindex(slave1); netlink_attr(nlmsg, IFLA_HSR_SLAVE1, &ifindex1, sizeof(ifindex1)); int ifindex2 = if_nametoindex(slave2); netlink_attr(nlmsg, IFLA_HSR_SLAVE2, &ifindex2, sizeof(ifindex2)); netlink_done(nlmsg); netlink_done(nlmsg); int err = netlink_send(nlmsg, sock); if (err < 0) { } } static void netlink_add_linked(struct nlmsg* nlmsg, int sock, const char* type, const char* name, const char* link) { netlink_add_device_impl(nlmsg, type, name, false); netlink_done(nlmsg); int ifindex = if_nametoindex(link); netlink_attr(nlmsg, IFLA_LINK, &ifindex, sizeof(ifindex)); int err = netlink_send(nlmsg, sock); if (err < 0) { } } static void netlink_add_vlan(struct nlmsg* nlmsg, int sock, const char* name, const char* link, uint16_t id, uint16_t proto) { netlink_add_device_impl(nlmsg, "vlan", name, false); netlink_nest(nlmsg, IFLA_INFO_DATA); netlink_attr(nlmsg, IFLA_VLAN_ID, &id, sizeof(id)); netlink_attr(nlmsg, IFLA_VLAN_PROTOCOL, &proto, sizeof(proto)); netlink_done(nlmsg); netlink_done(nlmsg); int ifindex = if_nametoindex(link); netlink_attr(nlmsg, IFLA_LINK, &ifindex, sizeof(ifindex)); int err = netlink_send(nlmsg, sock); if (err < 0) { } } static void netlink_add_macvlan(struct nlmsg* nlmsg, int sock, const char* name, const char* link) { netlink_add_device_impl(nlmsg, "macvlan", name, false); netlink_nest(nlmsg, IFLA_INFO_DATA); uint32_t mode = MACVLAN_MODE_BRIDGE; netlink_attr(nlmsg, IFLA_MACVLAN_MODE, &mode, sizeof(mode)); netlink_done(nlmsg); netlink_done(nlmsg); int ifindex = if_nametoindex(link); netlink_attr(nlmsg, IFLA_LINK, &ifindex, sizeof(ifindex)); int err = netlink_send(nlmsg, sock); if (err < 0) { } } static void netlink_add_geneve(struct nlmsg* nlmsg, int sock, const char* name, uint32_t vni, struct in_addr* addr4, struct in6_addr* addr6) { netlink_add_device_impl(nlmsg, "geneve", name, false); netlink_nest(nlmsg, IFLA_INFO_DATA); netlink_attr(nlmsg, IFLA_GENEVE_ID, &vni, sizeof(vni)); if (addr4) netlink_attr(nlmsg, IFLA_GENEVE_REMOTE, addr4, sizeof(*addr4)); if (addr6) netlink_attr(nlmsg, IFLA_GENEVE_REMOTE6, addr6, sizeof(*addr6)); netlink_done(nlmsg); netlink_done(nlmsg); int err = netlink_send(nlmsg, sock); if (err < 0) { } } #define IFLA_IPVLAN_FLAGS 2 #define IPVLAN_MODE_L3S 2 #undef IPVLAN_F_VEPA #define IPVLAN_F_VEPA 2 static void netlink_add_ipvlan(struct nlmsg* nlmsg, int sock, const char* name, const char* link, uint16_t mode, uint16_t flags) { netlink_add_device_impl(nlmsg, "ipvlan", name, false); netlink_nest(nlmsg, IFLA_INFO_DATA); netlink_attr(nlmsg, IFLA_IPVLAN_MODE, &mode, sizeof(mode)); netlink_attr(nlmsg, IFLA_IPVLAN_FLAGS, &flags, sizeof(flags)); netlink_done(nlmsg); netlink_done(nlmsg); int ifindex = if_nametoindex(link); netlink_attr(nlmsg, IFLA_LINK, &ifindex, sizeof(ifindex)); int err = netlink_send(nlmsg, sock); if (err < 0) { } } 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 initialize_tun(void) { 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); } #define DEVLINK_FAMILY_NAME "devlink" #define DEVLINK_CMD_PORT_GET 5 #define DEVLINK_ATTR_BUS_NAME 1 #define DEVLINK_ATTR_DEV_NAME 2 #define DEVLINK_ATTR_NETDEV_NAME 7 static struct nlmsg nlmsg2; static void initialize_devlink_ports(const char* bus_name, const char* dev_name, const char* netdev_prefix) { struct genlmsghdr genlhdr; int len, total_len, id, err, offset; uint16_t netdev_index; int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC); if (sock == -1) exit(1); int rtsock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); if (rtsock == -1) exit(1); id = netlink_query_family_id(&nlmsg, sock, DEVLINK_FAMILY_NAME, true); if (id == -1) goto error; memset(&genlhdr, 0, sizeof(genlhdr)); genlhdr.cmd = DEVLINK_CMD_PORT_GET; netlink_init(&nlmsg, id, NLM_F_DUMP, &genlhdr, sizeof(genlhdr)); netlink_attr(&nlmsg, DEVLINK_ATTR_BUS_NAME, bus_name, strlen(bus_name) + 1); netlink_attr(&nlmsg, DEVLINK_ATTR_DEV_NAME, dev_name, strlen(dev_name) + 1); err = netlink_send_ext(&nlmsg, sock, id, &total_len, true); if (err < 0) { goto error; } offset = 0; netdev_index = 0; while ((len = netlink_next_msg(&nlmsg, offset, total_len)) != -1) { struct nlattr* attr = (struct nlattr*)(nlmsg.buf + offset + NLMSG_HDRLEN + NLMSG_ALIGN(sizeof(genlhdr))); for (; (char*)attr < nlmsg.buf + offset + len; attr = (struct nlattr*)((char*)attr + NLMSG_ALIGN(attr->nla_len))) { if (attr->nla_type == DEVLINK_ATTR_NETDEV_NAME) { char* port_name; char netdev_name[IFNAMSIZ]; port_name = (char*)(attr + 1); snprintf(netdev_name, sizeof(netdev_name), "%s%d", netdev_prefix, netdev_index); netlink_device_change(&nlmsg2, rtsock, port_name, true, 0, 0, 0, netdev_name); break; } } offset += len; netdev_index++; } error: close(rtsock); close(sock); } #define WIFI_INITIAL_DEVICE_COUNT 2 #define WIFI_MAC_BASE \ { \ 0x08, 0x02, 0x11, 0x00, 0x00, 0x00 \ } #define WIFI_IBSS_BSSID \ { \ 0x50, 0x50, 0x50, 0x50, 0x50, 0x50 \ } #define WIFI_IBSS_SSID \ { \ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10 \ } #define WIFI_DEFAULT_FREQUENCY 2412 #define WIFI_DEFAULT_SIGNAL 0 #define WIFI_DEFAULT_RX_RATE 1 #define HWSIM_CMD_REGISTER 1 #define HWSIM_CMD_FRAME 2 #define HWSIM_CMD_NEW_RADIO 4 #define HWSIM_ATTR_SUPPORT_P2P_DEVICE 14 #define HWSIM_ATTR_PERM_ADDR 22 #define IF_OPER_UP 6 struct join_ibss_props { int wiphy_freq; bool wiphy_freq_fixed; uint8_t* mac; uint8_t* ssid; int ssid_len; }; static int set_interface_state(const char* interface_name, int on) { struct ifreq ifr; int sock = socket(AF_INET, SOCK_DGRAM, 0); if (sock < 0) { return -1; } memset(&ifr, 0, sizeof(ifr)); strcpy(ifr.ifr_name, interface_name); int ret = ioctl(sock, SIOCGIFFLAGS, &ifr); if (ret < 0) { close(sock); return -1; } if (on) ifr.ifr_flags |= IFF_UP; else ifr.ifr_flags &= ~IFF_UP; ret = ioctl(sock, SIOCSIFFLAGS, &ifr); close(sock); if (ret < 0) { return -1; } return 0; } static int nl80211_set_interface(struct nlmsg* nlmsg, int sock, int nl80211_family, uint32_t ifindex, uint32_t iftype, bool dofail) { struct genlmsghdr genlhdr; memset(&genlhdr, 0, sizeof(genlhdr)); genlhdr.cmd = NL80211_CMD_SET_INTERFACE; netlink_init(nlmsg, nl80211_family, 0, &genlhdr, sizeof(genlhdr)); netlink_attr(nlmsg, NL80211_ATTR_IFINDEX, &ifindex, sizeof(ifindex)); netlink_attr(nlmsg, NL80211_ATTR_IFTYPE, &iftype, sizeof(iftype)); int err = netlink_send_ext(nlmsg, sock, 0, NULL, dofail); if (err < 0) { } return err; } static int nl80211_join_ibss(struct nlmsg* nlmsg, int sock, int nl80211_family, uint32_t ifindex, struct join_ibss_props* props, bool dofail) { struct genlmsghdr genlhdr; memset(&genlhdr, 0, sizeof(genlhdr)); genlhdr.cmd = NL80211_CMD_JOIN_IBSS; netlink_init(nlmsg, nl80211_family, 0, &genlhdr, sizeof(genlhdr)); netlink_attr(nlmsg, NL80211_ATTR_IFINDEX, &ifindex, sizeof(ifindex)); netlink_attr(nlmsg, NL80211_ATTR_SSID, props->ssid, props->ssid_len); netlink_attr(nlmsg, NL80211_ATTR_WIPHY_FREQ, &(props->wiphy_freq), sizeof(props->wiphy_freq)); if (props->mac) netlink_attr(nlmsg, NL80211_ATTR_MAC, props->mac, ETH_ALEN); if (props->wiphy_freq_fixed) netlink_attr(nlmsg, NL80211_ATTR_FREQ_FIXED, NULL, 0); int err = netlink_send_ext(nlmsg, sock, 0, NULL, dofail); if (err < 0) { } return err; } static int get_ifla_operstate(struct nlmsg* nlmsg, int ifindex, bool dofail) { struct ifinfomsg info; memset(&info, 0, sizeof(info)); info.ifi_family = AF_UNSPEC; info.ifi_index = ifindex; int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); if (sock == -1) { return -1; } netlink_init(nlmsg, RTM_GETLINK, 0, &info, sizeof(info)); int n; int err = netlink_send_ext(nlmsg, sock, RTM_NEWLINK, &n, dofail); close(sock); if (err) { return -1; } struct rtattr* attr = IFLA_RTA(NLMSG_DATA(nlmsg->buf)); for (; RTA_OK(attr, n); attr = RTA_NEXT(attr, n)) { if (attr->rta_type == IFLA_OPERSTATE) return *((int32_t*)RTA_DATA(attr)); } return -1; } static int await_ifla_operstate(struct nlmsg* nlmsg, char* interface, int operstate, bool dofail) { int ifindex = if_nametoindex(interface); while (true) { usleep(1000); int ret = get_ifla_operstate(nlmsg, ifindex, dofail); if (ret < 0) return ret; if (ret == operstate) return 0; } return 0; } static int nl80211_setup_ibss_interface(struct nlmsg* nlmsg, int sock, int nl80211_family_id, char* interface, struct join_ibss_props* ibss_props, bool dofail) { int ifindex = if_nametoindex(interface); if (ifindex == 0) { return -1; } int ret = nl80211_set_interface(nlmsg, sock, nl80211_family_id, ifindex, NL80211_IFTYPE_ADHOC, dofail); if (ret < 0) { return -1; } ret = set_interface_state(interface, 1); if (ret < 0) { return -1; } ret = nl80211_join_ibss(nlmsg, sock, nl80211_family_id, ifindex, ibss_props, dofail); if (ret < 0) { return -1; } return 0; } static int hwsim80211_create_device(struct nlmsg* nlmsg, int sock, int hwsim_family, uint8_t mac_addr[ETH_ALEN]) { struct genlmsghdr genlhdr; memset(&genlhdr, 0, sizeof(genlhdr)); genlhdr.cmd = HWSIM_CMD_NEW_RADIO; netlink_init(nlmsg, hwsim_family, 0, &genlhdr, sizeof(genlhdr)); netlink_attr(nlmsg, HWSIM_ATTR_SUPPORT_P2P_DEVICE, NULL, 0); netlink_attr(nlmsg, HWSIM_ATTR_PERM_ADDR, mac_addr, ETH_ALEN); int err = netlink_send(nlmsg, sock); if (err < 0) { } return err; } static void initialize_wifi_devices(void) { int rfkill = open("/dev/rfkill", O_RDWR); if (rfkill == -1) exit(1); struct rfkill_event event = {0}; event.type = RFKILL_TYPE_ALL; event.op = RFKILL_OP_CHANGE_ALL; if (write(rfkill, &event, sizeof(event)) != (ssize_t)(sizeof(event))) exit(1); close(rfkill); uint8_t mac_addr[6] = WIFI_MAC_BASE; int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC); if (sock < 0) exit(1); int hwsim_family_id = netlink_query_family_id(&nlmsg, sock, "MAC80211_HWSIM", true); int nl80211_family_id = netlink_query_family_id(&nlmsg, sock, "nl80211", true); if (hwsim_family_id < 0 || nl80211_family_id < 0) exit(1); uint8_t ssid[] = WIFI_IBSS_SSID; uint8_t bssid[] = WIFI_IBSS_BSSID; struct join_ibss_props ibss_props = {.wiphy_freq = WIFI_DEFAULT_FREQUENCY, .wiphy_freq_fixed = true, .mac = bssid, .ssid = ssid, .ssid_len = sizeof(ssid)}; for (int device_id = 0; device_id < WIFI_INITIAL_DEVICE_COUNT; device_id++) { mac_addr[5] = device_id; int ret = hwsim80211_create_device(&nlmsg, sock, hwsim_family_id, mac_addr); if (ret < 0) exit(1); char interface[6] = "wlan0"; interface[4] += device_id; if (nl80211_setup_ibss_interface(&nlmsg, sock, nl80211_family_id, interface, &ibss_props, true) < 0) exit(1); } for (int device_id = 0; device_id < WIFI_INITIAL_DEVICE_COUNT; device_id++) { char interface[6] = "wlan0"; interface[4] += device_id; int ret = await_ifla_operstate(&nlmsg, interface, IF_OPER_UP, true); if (ret < 0) exit(1); } close(sock); } static int runcmdline(char* cmdline) { int ret = system(cmdline); if (ret) { } return ret; } #define DEV_IPV4 "172.20.20.%d" #define DEV_IPV6 "fe80::%02x" #define DEV_MAC 0x00aaaaaaaaaa static void netdevsim_add(unsigned int addr, unsigned int port_count) { write_file("/sys/bus/netdevsim/del_device", "%u", addr); if (write_file("/sys/bus/netdevsim/new_device", "%u %u", addr, port_count)) { char buf[32]; snprintf(buf, sizeof(buf), "netdevsim%d", addr); initialize_devlink_ports("netdevsim", buf, "netdevsim"); } } #define WG_GENL_NAME "wireguard" enum wg_cmd { WG_CMD_GET_DEVICE, WG_CMD_SET_DEVICE, }; enum wgdevice_attribute { WGDEVICE_A_UNSPEC, WGDEVICE_A_IFINDEX, WGDEVICE_A_IFNAME, WGDEVICE_A_PRIVATE_KEY, WGDEVICE_A_PUBLIC_KEY, WGDEVICE_A_FLAGS, WGDEVICE_A_LISTEN_PORT, WGDEVICE_A_FWMARK, WGDEVICE_A_PEERS, }; enum wgpeer_attribute { WGPEER_A_UNSPEC, WGPEER_A_PUBLIC_KEY, WGPEER_A_PRESHARED_KEY, WGPEER_A_FLAGS, WGPEER_A_ENDPOINT, WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL, WGPEER_A_LAST_HANDSHAKE_TIME, WGPEER_A_RX_BYTES, WGPEER_A_TX_BYTES, WGPEER_A_ALLOWEDIPS, WGPEER_A_PROTOCOL_VERSION, }; enum wgallowedip_attribute { WGALLOWEDIP_A_UNSPEC, WGALLOWEDIP_A_FAMILY, WGALLOWEDIP_A_IPADDR, WGALLOWEDIP_A_CIDR_MASK, }; static void netlink_wireguard_setup(void) { const char ifname_a[] = "wg0"; const char ifname_b[] = "wg1"; const char ifname_c[] = "wg2"; const char private_a[] = "\xa0\x5c\xa8\x4f\x6c\x9c\x8e\x38\x53\xe2\xfd\x7a\x70\xae\x0f\xb2\x0f\xa1" "\x52\x60\x0c\xb0\x08\x45\x17\x4f\x08\x07\x6f\x8d\x78\x43"; const char private_b[] = "\xb0\x80\x73\xe8\xd4\x4e\x91\xe3\xda\x92\x2c\x22\x43\x82\x44\xbb\x88\x5c" "\x69\xe2\x69\xc8\xe9\xd8\x35\xb1\x14\x29\x3a\x4d\xdc\x6e"; const char private_c[] = "\xa0\xcb\x87\x9a\x47\xf5\xbc\x64\x4c\x0e\x69\x3f\xa6\xd0\x31\xc7\x4a\x15" "\x53\xb6\xe9\x01\xb9\xff\x2f\x51\x8c\x78\x04\x2f\xb5\x42"; const char public_a[] = "\x97\x5c\x9d\x81\xc9\x83\xc8\x20\x9e\xe7\x81\x25\x4b\x89\x9f\x8e\xd9\x25" "\xae\x9f\x09\x23\xc2\x3c\x62\xf5\x3c\x57\xcd\xbf\x69\x1c"; const char public_b[] = "\xd1\x73\x28\x99\xf6\x11\xcd\x89\x94\x03\x4d\x7f\x41\x3d\xc9\x57\x63\x0e" "\x54\x93\xc2\x85\xac\xa4\x00\x65\xcb\x63\x11\xbe\x69\x6b"; const char public_c[] = "\xf4\x4d\xa3\x67\xa8\x8e\xe6\x56\x4f\x02\x02\x11\x45\x67\x27\x08\x2f\x5c" "\xeb\xee\x8b\x1b\xf5\xeb\x73\x37\x34\x1b\x45\x9b\x39\x22"; const uint16_t listen_a = 20001; const uint16_t listen_b = 20002; const uint16_t listen_c = 20003; const uint16_t af_inet = AF_INET; const uint16_t af_inet6 = AF_INET6; const struct sockaddr_in endpoint_b_v4 = { .sin_family = AF_INET, .sin_port = htons(listen_b), .sin_addr = {htonl(INADDR_LOOPBACK)}}; const struct sockaddr_in endpoint_c_v4 = { .sin_family = AF_INET, .sin_port = htons(listen_c), .sin_addr = {htonl(INADDR_LOOPBACK)}}; struct sockaddr_in6 endpoint_a_v6 = {.sin6_family = AF_INET6, .sin6_port = htons(listen_a)}; endpoint_a_v6.sin6_addr = in6addr_loopback; struct sockaddr_in6 endpoint_c_v6 = {.sin6_family = AF_INET6, .sin6_port = htons(listen_c)}; endpoint_c_v6.sin6_addr = in6addr_loopback; const struct in_addr first_half_v4 = {0}; const struct in_addr second_half_v4 = {(uint32_t)htonl(128 << 24)}; const struct in6_addr first_half_v6 = {{{0}}}; const struct in6_addr second_half_v6 = {{{0x80}}}; const uint8_t half_cidr = 1; const uint16_t persistent_keepalives[] = {1, 3, 7, 9, 14, 19}; struct genlmsghdr genlhdr = {.cmd = WG_CMD_SET_DEVICE, .version = 1}; int sock; int id, err; sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC); if (sock == -1) { return; } id = netlink_query_family_id(&nlmsg, sock, WG_GENL_NAME, true); if (id == -1) goto error; netlink_init(&nlmsg, id, 0, &genlhdr, sizeof(genlhdr)); netlink_attr(&nlmsg, WGDEVICE_A_IFNAME, ifname_a, strlen(ifname_a) + 1); netlink_attr(&nlmsg, WGDEVICE_A_PRIVATE_KEY, private_a, 32); netlink_attr(&nlmsg, WGDEVICE_A_LISTEN_PORT, &listen_a, 2); netlink_nest(&nlmsg, NLA_F_NESTED | WGDEVICE_A_PEERS); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGPEER_A_PUBLIC_KEY, public_b, 32); netlink_attr(&nlmsg, WGPEER_A_ENDPOINT, &endpoint_b_v4, sizeof(endpoint_b_v4)); netlink_attr(&nlmsg, WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL, &persistent_keepalives[0], 2); netlink_nest(&nlmsg, NLA_F_NESTED | WGPEER_A_ALLOWEDIPS); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGALLOWEDIP_A_FAMILY, &af_inet, 2); netlink_attr(&nlmsg, WGALLOWEDIP_A_IPADDR, &first_half_v4, sizeof(first_half_v4)); netlink_attr(&nlmsg, WGALLOWEDIP_A_CIDR_MASK, &half_cidr, 1); netlink_done(&nlmsg); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGALLOWEDIP_A_FAMILY, &af_inet6, 2); netlink_attr(&nlmsg, WGALLOWEDIP_A_IPADDR, &first_half_v6, sizeof(first_half_v6)); netlink_attr(&nlmsg, WGALLOWEDIP_A_CIDR_MASK, &half_cidr, 1); netlink_done(&nlmsg); netlink_done(&nlmsg); netlink_done(&nlmsg); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGPEER_A_PUBLIC_KEY, public_c, 32); netlink_attr(&nlmsg, WGPEER_A_ENDPOINT, &endpoint_c_v6, sizeof(endpoint_c_v6)); netlink_attr(&nlmsg, WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL, &persistent_keepalives[1], 2); netlink_nest(&nlmsg, NLA_F_NESTED | WGPEER_A_ALLOWEDIPS); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGALLOWEDIP_A_FAMILY, &af_inet, 2); netlink_attr(&nlmsg, WGALLOWEDIP_A_IPADDR, &second_half_v4, sizeof(second_half_v4)); netlink_attr(&nlmsg, WGALLOWEDIP_A_CIDR_MASK, &half_cidr, 1); netlink_done(&nlmsg); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGALLOWEDIP_A_FAMILY, &af_inet6, 2); netlink_attr(&nlmsg, WGALLOWEDIP_A_IPADDR, &second_half_v6, sizeof(second_half_v6)); netlink_attr(&nlmsg, WGALLOWEDIP_A_CIDR_MASK, &half_cidr, 1); netlink_done(&nlmsg); netlink_done(&nlmsg); netlink_done(&nlmsg); netlink_done(&nlmsg); err = netlink_send(&nlmsg, sock); if (err < 0) { } netlink_init(&nlmsg, id, 0, &genlhdr, sizeof(genlhdr)); netlink_attr(&nlmsg, WGDEVICE_A_IFNAME, ifname_b, strlen(ifname_b) + 1); netlink_attr(&nlmsg, WGDEVICE_A_PRIVATE_KEY, private_b, 32); netlink_attr(&nlmsg, WGDEVICE_A_LISTEN_PORT, &listen_b, 2); netlink_nest(&nlmsg, NLA_F_NESTED | WGDEVICE_A_PEERS); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGPEER_A_PUBLIC_KEY, public_a, 32); netlink_attr(&nlmsg, WGPEER_A_ENDPOINT, &endpoint_a_v6, sizeof(endpoint_a_v6)); netlink_attr(&nlmsg, WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL, &persistent_keepalives[2], 2); netlink_nest(&nlmsg, NLA_F_NESTED | WGPEER_A_ALLOWEDIPS); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGALLOWEDIP_A_FAMILY, &af_inet, 2); netlink_attr(&nlmsg, WGALLOWEDIP_A_IPADDR, &first_half_v4, sizeof(first_half_v4)); netlink_attr(&nlmsg, WGALLOWEDIP_A_CIDR_MASK, &half_cidr, 1); netlink_done(&nlmsg); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGALLOWEDIP_A_FAMILY, &af_inet6, 2); netlink_attr(&nlmsg, WGALLOWEDIP_A_IPADDR, &first_half_v6, sizeof(first_half_v6)); netlink_attr(&nlmsg, WGALLOWEDIP_A_CIDR_MASK, &half_cidr, 1); netlink_done(&nlmsg); netlink_done(&nlmsg); netlink_done(&nlmsg); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGPEER_A_PUBLIC_KEY, public_c, 32); netlink_attr(&nlmsg, WGPEER_A_ENDPOINT, &endpoint_c_v4, sizeof(endpoint_c_v4)); netlink_attr(&nlmsg, WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL, &persistent_keepalives[3], 2); netlink_nest(&nlmsg, NLA_F_NESTED | WGPEER_A_ALLOWEDIPS); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGALLOWEDIP_A_FAMILY, &af_inet, 2); netlink_attr(&nlmsg, WGALLOWEDIP_A_IPADDR, &second_half_v4, sizeof(second_half_v4)); netlink_attr(&nlmsg, WGALLOWEDIP_A_CIDR_MASK, &half_cidr, 1); netlink_done(&nlmsg); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGALLOWEDIP_A_FAMILY, &af_inet6, 2); netlink_attr(&nlmsg, WGALLOWEDIP_A_IPADDR, &second_half_v6, sizeof(second_half_v6)); netlink_attr(&nlmsg, WGALLOWEDIP_A_CIDR_MASK, &half_cidr, 1); netlink_done(&nlmsg); netlink_done(&nlmsg); netlink_done(&nlmsg); netlink_done(&nlmsg); err = netlink_send(&nlmsg, sock); if (err < 0) { } netlink_init(&nlmsg, id, 0, &genlhdr, sizeof(genlhdr)); netlink_attr(&nlmsg, WGDEVICE_A_IFNAME, ifname_c, strlen(ifname_c) + 1); netlink_attr(&nlmsg, WGDEVICE_A_PRIVATE_KEY, private_c, 32); netlink_attr(&nlmsg, WGDEVICE_A_LISTEN_PORT, &listen_c, 2); netlink_nest(&nlmsg, NLA_F_NESTED | WGDEVICE_A_PEERS); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGPEER_A_PUBLIC_KEY, public_a, 32); netlink_attr(&nlmsg, WGPEER_A_ENDPOINT, &endpoint_a_v6, sizeof(endpoint_a_v6)); netlink_attr(&nlmsg, WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL, &persistent_keepalives[4], 2); netlink_nest(&nlmsg, NLA_F_NESTED | WGPEER_A_ALLOWEDIPS); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGALLOWEDIP_A_FAMILY, &af_inet, 2); netlink_attr(&nlmsg, WGALLOWEDIP_A_IPADDR, &first_half_v4, sizeof(first_half_v4)); netlink_attr(&nlmsg, WGALLOWEDIP_A_CIDR_MASK, &half_cidr, 1); netlink_done(&nlmsg); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGALLOWEDIP_A_FAMILY, &af_inet6, 2); netlink_attr(&nlmsg, WGALLOWEDIP_A_IPADDR, &first_half_v6, sizeof(first_half_v6)); netlink_attr(&nlmsg, WGALLOWEDIP_A_CIDR_MASK, &half_cidr, 1); netlink_done(&nlmsg); netlink_done(&nlmsg); netlink_done(&nlmsg); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGPEER_A_PUBLIC_KEY, public_b, 32); netlink_attr(&nlmsg, WGPEER_A_ENDPOINT, &endpoint_b_v4, sizeof(endpoint_b_v4)); netlink_attr(&nlmsg, WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL, &persistent_keepalives[5], 2); netlink_nest(&nlmsg, NLA_F_NESTED | WGPEER_A_ALLOWEDIPS); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGALLOWEDIP_A_FAMILY, &af_inet, 2); netlink_attr(&nlmsg, WGALLOWEDIP_A_IPADDR, &second_half_v4, sizeof(second_half_v4)); netlink_attr(&nlmsg, WGALLOWEDIP_A_CIDR_MASK, &half_cidr, 1); netlink_done(&nlmsg); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGALLOWEDIP_A_FAMILY, &af_inet6, 2); netlink_attr(&nlmsg, WGALLOWEDIP_A_IPADDR, &second_half_v6, sizeof(second_half_v6)); netlink_attr(&nlmsg, WGALLOWEDIP_A_CIDR_MASK, &half_cidr, 1); netlink_done(&nlmsg); netlink_done(&nlmsg); netlink_done(&nlmsg); netlink_done(&nlmsg); err = netlink_send(&nlmsg, sock); if (err < 0) { } error: close(sock); } static void initialize_netdevices(void) { char netdevsim[16]; sprintf(netdevsim, "netdevsim%d", (int)procid); struct { const char* type; const char* dev; } devtypes[] = { {"ip6gretap", "ip6gretap0"}, {"bridge", "bridge0"}, {"vcan", "vcan0"}, {"bond", "bond0"}, {"team", "team0"}, {"dummy", "dummy0"}, {"nlmon", "nlmon0"}, {"caif", "caif0"}, {"batadv", "batadv0"}, {"vxcan", "vxcan1"}, {"veth", 0}, {"wireguard", "wg0"}, {"wireguard", "wg1"}, {"wireguard", "wg2"}, }; const char* devmasters[] = {"bridge", "bond", "team", "batadv"}; struct { const char* name; int macsize; bool noipv6; } devices[] = { {"lo", ETH_ALEN}, {"sit0", 0}, {"bridge0", ETH_ALEN}, {"vcan0", 0, true}, {"tunl0", 0}, {"gre0", 0}, {"gretap0", ETH_ALEN}, {"ip_vti0", 0}, {"ip6_vti0", 0}, {"ip6tnl0", 0}, {"ip6gre0", 0}, {"ip6gretap0", ETH_ALEN}, {"erspan0", ETH_ALEN}, {"bond0", ETH_ALEN}, {"veth0", ETH_ALEN}, {"veth1", ETH_ALEN}, {"team0", ETH_ALEN}, {"veth0_to_bridge", ETH_ALEN}, {"veth1_to_bridge", ETH_ALEN}, {"veth0_to_bond", ETH_ALEN}, {"veth1_to_bond", ETH_ALEN}, {"veth0_to_team", ETH_ALEN}, {"veth1_to_team", ETH_ALEN}, {"veth0_to_hsr", ETH_ALEN}, {"veth1_to_hsr", ETH_ALEN}, {"hsr0", 0}, {"dummy0", ETH_ALEN}, {"nlmon0", 0}, {"vxcan0", 0, true}, {"vxcan1", 0, true}, {"caif0", ETH_ALEN}, {"batadv0", ETH_ALEN}, {netdevsim, ETH_ALEN}, {"xfrm0", ETH_ALEN}, {"veth0_virt_wifi", ETH_ALEN}, {"veth1_virt_wifi", ETH_ALEN}, {"virt_wifi0", ETH_ALEN}, {"veth0_vlan", ETH_ALEN}, {"veth1_vlan", ETH_ALEN}, {"vlan0", ETH_ALEN}, {"vlan1", ETH_ALEN}, {"macvlan0", ETH_ALEN}, {"macvlan1", ETH_ALEN}, {"ipvlan0", ETH_ALEN}, {"ipvlan1", ETH_ALEN}, {"veth0_macvtap", ETH_ALEN}, {"veth1_macvtap", ETH_ALEN}, {"macvtap0", ETH_ALEN}, {"macsec0", ETH_ALEN}, {"veth0_to_batadv", ETH_ALEN}, {"veth1_to_batadv", ETH_ALEN}, {"batadv_slave_0", ETH_ALEN}, {"batadv_slave_1", ETH_ALEN}, {"geneve0", ETH_ALEN}, {"geneve1", ETH_ALEN}, {"wg0", 0}, {"wg1", 0}, {"wg2", 0}, }; int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); if (sock == -1) exit(1); unsigned i; for (i = 0; i < sizeof(devtypes) / sizeof(devtypes[0]); i++) netlink_add_device(&nlmsg, sock, devtypes[i].type, devtypes[i].dev); for (i = 0; i < sizeof(devmasters) / (sizeof(devmasters[0])); i++) { char master[32], slave0[32], veth0[32], slave1[32], veth1[32]; sprintf(slave0, "%s_slave_0", devmasters[i]); sprintf(veth0, "veth0_to_%s", devmasters[i]); netlink_add_veth(&nlmsg, sock, slave0, veth0); sprintf(slave1, "%s_slave_1", devmasters[i]); sprintf(veth1, "veth1_to_%s", devmasters[i]); netlink_add_veth(&nlmsg, sock, slave1, veth1); sprintf(master, "%s0", devmasters[i]); netlink_device_change(&nlmsg, sock, slave0, false, master, 0, 0, NULL); netlink_device_change(&nlmsg, sock, slave1, false, master, 0, 0, NULL); } netlink_add_xfrm(&nlmsg, sock, "xfrm0"); netlink_device_change(&nlmsg, sock, "bridge_slave_0", true, 0, 0, 0, NULL); netlink_device_change(&nlmsg, sock, "bridge_slave_1", true, 0, 0, 0, NULL); netlink_add_veth(&nlmsg, sock, "hsr_slave_0", "veth0_to_hsr"); netlink_add_veth(&nlmsg, sock, "hsr_slave_1", "veth1_to_hsr"); netlink_add_hsr(&nlmsg, sock, "hsr0", "hsr_slave_0", "hsr_slave_1"); netlink_device_change(&nlmsg, sock, "hsr_slave_0", true, 0, 0, 0, NULL); netlink_device_change(&nlmsg, sock, "hsr_slave_1", true, 0, 0, 0, NULL); netlink_add_veth(&nlmsg, sock, "veth0_virt_wifi", "veth1_virt_wifi"); netlink_add_linked(&nlmsg, sock, "virt_wifi", "virt_wifi0", "veth1_virt_wifi"); netlink_add_veth(&nlmsg, sock, "veth0_vlan", "veth1_vlan"); netlink_add_vlan(&nlmsg, sock, "vlan0", "veth0_vlan", 0, htons(ETH_P_8021Q)); netlink_add_vlan(&nlmsg, sock, "vlan1", "veth0_vlan", 1, htons(ETH_P_8021AD)); netlink_add_macvlan(&nlmsg, sock, "macvlan0", "veth1_vlan"); netlink_add_macvlan(&nlmsg, sock, "macvlan1", "veth1_vlan"); netlink_add_ipvlan(&nlmsg, sock, "ipvlan0", "veth0_vlan", IPVLAN_MODE_L2, 0); netlink_add_ipvlan(&nlmsg, sock, "ipvlan1", "veth0_vlan", IPVLAN_MODE_L3S, IPVLAN_F_VEPA); netlink_add_veth(&nlmsg, sock, "veth0_macvtap", "veth1_macvtap"); netlink_add_linked(&nlmsg, sock, "macvtap", "macvtap0", "veth0_macvtap"); netlink_add_linked(&nlmsg, sock, "macsec", "macsec0", "veth1_macvtap"); char addr[32]; sprintf(addr, DEV_IPV4, 14 + 10); struct in_addr geneve_addr4; if (inet_pton(AF_INET, addr, &geneve_addr4) <= 0) exit(1); struct in6_addr geneve_addr6; if (inet_pton(AF_INET6, "fc00::01", &geneve_addr6) <= 0) exit(1); netlink_add_geneve(&nlmsg, sock, "geneve0", 0, &geneve_addr4, 0); netlink_add_geneve(&nlmsg, sock, "geneve1", 1, 0, &geneve_addr6); netdevsim_add((int)procid, 4); netlink_wireguard_setup(); for (i = 0; i < sizeof(devices) / (sizeof(devices[0])); i++) { char addr[32]; sprintf(addr, DEV_IPV4, i + 10); netlink_add_addr4(&nlmsg, sock, devices[i].name, addr); if (!devices[i].noipv6) { sprintf(addr, DEV_IPV6, i + 10); netlink_add_addr6(&nlmsg, sock, devices[i].name, addr); } uint64_t macaddr = DEV_MAC + ((i + 10ull) << 40); netlink_device_change(&nlmsg, sock, devices[i].name, true, 0, &macaddr, devices[i].macsize, NULL); } close(sock); } static void initialize_netdevices_init(void) { int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); if (sock == -1) exit(1); struct { const char* type; int macsize; bool noipv6; bool noup; } devtypes[] = { {"nr", 7, true}, {"rose", 5, true, true}, }; unsigned i; for (i = 0; i < sizeof(devtypes) / sizeof(devtypes[0]); i++) { char dev[32], addr[32]; sprintf(dev, "%s%d", devtypes[i].type, (int)procid); sprintf(addr, "172.30.%d.%d", i, (int)procid + 1); netlink_add_addr4(&nlmsg, sock, dev, addr); if (!devtypes[i].noipv6) { sprintf(addr, "fe88::%02x:%02x", i, (int)procid + 1); netlink_add_addr6(&nlmsg, sock, dev, addr); } int macsize = devtypes[i].macsize; uint64_t macaddr = 0xbbbbbb + ((unsigned long long)i << (8 * (macsize - 2))) + (procid << (8 * (macsize - 1))); netlink_device_change(&nlmsg, sock, dev, !devtypes[i].noup, 0, &macaddr, macsize, NULL); } close(sock); } 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; } #define SIZEOF_IO_URING_SQE 64 #define SIZEOF_IO_URING_CQE 16 #define SQ_HEAD_OFFSET 0 #define SQ_TAIL_OFFSET 64 #define SQ_RING_MASK_OFFSET 256 #define SQ_RING_ENTRIES_OFFSET 264 #define SQ_FLAGS_OFFSET 276 #define SQ_DROPPED_OFFSET 272 #define CQ_HEAD_OFFSET 128 #define CQ_TAIL_OFFSET 192 #define CQ_RING_MASK_OFFSET 260 #define CQ_RING_ENTRIES_OFFSET 268 #define CQ_RING_OVERFLOW_OFFSET 284 #define CQ_FLAGS_OFFSET 280 #define CQ_CQES_OFFSET 320 struct io_sqring_offsets { uint32_t head; uint32_t tail; uint32_t ring_mask; uint32_t ring_entries; uint32_t flags; uint32_t dropped; uint32_t array; uint32_t resv1; uint64_t resv2; }; struct io_cqring_offsets { uint32_t head; uint32_t tail; uint32_t ring_mask; uint32_t ring_entries; uint32_t overflow; uint32_t cqes; uint64_t resv[2]; }; struct io_uring_params { uint32_t sq_entries; uint32_t cq_entries; uint32_t flags; uint32_t sq_thread_cpu; uint32_t sq_thread_idle; uint32_t features; uint32_t resv[4]; struct io_sqring_offsets sq_off; struct io_cqring_offsets cq_off; }; #define IORING_OFF_SQ_RING 0 #define IORING_OFF_SQES 0x10000000ULL #define IORING_SETUP_SQE128 (1U << 10) #define IORING_SETUP_CQE32 (1U << 11) static long syz_io_uring_setup(volatile long a0, volatile long a1, volatile long a2, volatile long a3) { uint32_t entries = (uint32_t)a0; struct io_uring_params* setup_params = (struct io_uring_params*)a1; void** ring_ptr_out = (void**)a2; void** sqes_ptr_out = (void**)a3; setup_params->flags &= ~(IORING_SETUP_CQE32 | IORING_SETUP_SQE128); uint32_t fd_io_uring = syscall(__NR_io_uring_setup, entries, setup_params); uint32_t sq_ring_sz = setup_params->sq_off.array + setup_params->sq_entries * sizeof(uint32_t); uint32_t cq_ring_sz = setup_params->cq_off.cqes + setup_params->cq_entries * SIZEOF_IO_URING_CQE; uint32_t ring_sz = sq_ring_sz > cq_ring_sz ? sq_ring_sz : cq_ring_sz; *ring_ptr_out = mmap(0, ring_sz, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_POPULATE, fd_io_uring, IORING_OFF_SQ_RING); uint32_t sqes_sz = setup_params->sq_entries * SIZEOF_IO_URING_SQE; *sqes_ptr_out = mmap(0, sqes_sz, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_POPULATE, fd_io_uring, IORING_OFF_SQES); uint32_t* array = (uint32_t*)((uintptr_t)*ring_ptr_out + setup_params->sq_off.array); for (uint32_t index = 0; index < entries; index++) array[index] = index; return fd_io_uring; } 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"); } 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 mount_cgroups(const char* dir, const char** controllers, int count) { if (mkdir(dir, 0777)) { return; } char enabled[128] = {0}; int i = 0; for (; i < count; i++) { if (mount("none", dir, "cgroup", 0, controllers[i])) { continue; } umount(dir); strcat(enabled, ","); strcat(enabled, controllers[i]); } if (enabled[0] == 0) { if (rmdir(dir) && errno != EBUSY) exit(1); return; } if (mount("none", dir, "cgroup", 0, enabled + 1)) { if (rmdir(dir) && errno != EBUSY) exit(1); } if (chmod(dir, 0777)) { } } static void mount_cgroups2(const char** controllers, int count) { if (mkdir("/syzcgroup/unified", 0777)) { return; } if (mount("none", "/syzcgroup/unified", "cgroup2", 0, NULL)) { if (rmdir("/syzcgroup/unified") && errno != EBUSY) exit(1); return; } if (chmod("/syzcgroup/unified", 0777)) { } int control = open("/syzcgroup/unified/cgroup.subtree_control", O_WRONLY); if (control == -1) return; int i; for (i = 0; i < count; i++) if (write(control, controllers[i], strlen(controllers[i])) < 0) { } close(control); } static void setup_cgroups() { const char* unified_controllers[] = {"+cpu", "+io", "+pids"}; const char* net_controllers[] = {"net", "net_prio", "devices", "blkio", "freezer"}; const char* cpu_controllers[] = {"cpuset", "cpuacct", "hugetlb", "rlimit", "memory"}; if (mkdir("/syzcgroup", 0777)) { return; } mount_cgroups2(unified_controllers, sizeof(unified_controllers) / sizeof(unified_controllers[0])); mount_cgroups("/syzcgroup/net", net_controllers, sizeof(net_controllers) / sizeof(net_controllers[0])); mount_cgroups("/syzcgroup/cpu", cpu_controllers, sizeof(cpu_controllers) / sizeof(cpu_controllers[0])); write_file("/syzcgroup/cpu/cgroup.clone_children", "1"); write_file("/syzcgroup/cpu/cpuset.memory_pressure_enabled", "1"); } static void setup_cgroups_loop() { int pid = getpid(); char file[128]; char cgroupdir[64]; snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/unified/syz%llu", procid); if (mkdir(cgroupdir, 0777)) { } snprintf(file, sizeof(file), "%s/pids.max", cgroupdir); write_file(file, "32"); snprintf(file, sizeof(file), "%s/cgroup.procs", cgroupdir); write_file(file, "%d", pid); snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/cpu/syz%llu", procid); if (mkdir(cgroupdir, 0777)) { } snprintf(file, sizeof(file), "%s/cgroup.procs", cgroupdir); write_file(file, "%d", pid); snprintf(file, sizeof(file), "%s/memory.soft_limit_in_bytes", cgroupdir); write_file(file, "%d", 299 << 20); snprintf(file, sizeof(file), "%s/memory.limit_in_bytes", cgroupdir); write_file(file, "%d", 300 << 20); snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/net/syz%llu", procid); if (mkdir(cgroupdir, 0777)) { } snprintf(file, sizeof(file), "%s/cgroup.procs", cgroupdir); write_file(file, "%d", pid); } static void setup_cgroups_test() { char cgroupdir[64]; snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/unified/syz%llu", procid); if (symlink(cgroupdir, "./cgroup")) { } snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/cpu/syz%llu", procid); if (symlink(cgroupdir, "./cgroup.cpu")) { } snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/net/syz%llu", procid); if (symlink(cgroupdir, "./cgroup.net")) { } } static void initialize_cgroups() { if (mkdir("./syz-tmp/newroot/syzcgroup", 0700)) exit(1); if (mkdir("./syz-tmp/newroot/syzcgroup/unified", 0700)) exit(1); if (mkdir("./syz-tmp/newroot/syzcgroup/cpu", 0700)) exit(1); if (mkdir("./syz-tmp/newroot/syzcgroup/net", 0700)) exit(1); unsigned bind_mount_flags = MS_BIND | MS_REC | MS_PRIVATE; if (mount("/syzcgroup/unified", "./syz-tmp/newroot/syzcgroup/unified", NULL, bind_mount_flags, NULL)) { } if (mount("/syzcgroup/cpu", "./syz-tmp/newroot/syzcgroup/cpu", NULL, bind_mount_flags, NULL)) { } if (mount("/syzcgroup/net", "./syz-tmp/newroot/syzcgroup/net", NULL, bind_mount_flags, NULL)) { } } 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); initialize_cgroups(); 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); } static void setup_common() { 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); setsid(); 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); setup_common(); initialize_vhci(); sandbox_common(); drop_caps(); initialize_netdevices_init(); if (unshare(CLONE_NEWNET)) { } write_file("/proc/sys/net/ipv4/ping_group_range", "0 65535"); initialize_tun(); initialize_netdevices(); initialize_wifi_devices(); sandbox_common_mount_tmpfs(); setup_binderfs(); 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() { setup_cgroups_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(); setup_cgroups_test(); 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 const char* setup_usb() { if (chmod("/dev/raw-gadget", 0666)) return "failed to chmod /dev/raw-gadget"; 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[] = { {"/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 NL802154_CMD_SET_SHORT_ADDR 11 #define NL802154_ATTR_IFINDEX 3 #define NL802154_ATTR_SHORT_ADDR 10 static const char* setup_802154() { const char* error = NULL; int sock_generic = -1; int sock_route = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); if (sock_route == -1) { error = "socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE) failed"; goto fail; } sock_generic = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC); if (sock_generic == -1) { error = "socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC) failed"; goto fail; } { int nl802154_family_id = netlink_query_family_id(&nlmsg, sock_generic, "nl802154", true); if (nl802154_family_id < 0) { error = "netlink_query_family_id failed"; goto fail; } for (int i = 0; i < 2; i++) { char devname[] = "wpan0"; devname[strlen(devname) - 1] += i; uint64_t hwaddr = 0xaaaaaaaaaaaa0002 + (i << 8); uint16_t shortaddr = 0xaaa0 + i; int ifindex = if_nametoindex(devname); struct genlmsghdr genlhdr; memset(&genlhdr, 0, sizeof(genlhdr)); genlhdr.cmd = NL802154_CMD_SET_SHORT_ADDR; netlink_init(&nlmsg, nl802154_family_id, 0, &genlhdr, sizeof(genlhdr)); netlink_attr(&nlmsg, NL802154_ATTR_IFINDEX, &ifindex, sizeof(ifindex)); netlink_attr(&nlmsg, NL802154_ATTR_SHORT_ADDR, &shortaddr, sizeof(shortaddr)); if (netlink_send(&nlmsg, sock_generic) < 0) { error = "NL802154_CMD_SET_SHORT_ADDR failed"; goto fail; } netlink_device_change(&nlmsg, sock_route, devname, true, 0, &hwaddr, sizeof(hwaddr), 0); if (i == 0) { netlink_add_device_impl(&nlmsg, "lowpan", "lowpan0", false); netlink_done(&nlmsg); netlink_attr(&nlmsg, IFLA_LINK, &ifindex, sizeof(ifindex)); if (netlink_send(&nlmsg, sock_route) < 0) { error = "netlink: adding device lowpan0 type lowpan link wpan0"; goto fail; } } } } fail: close(sock_route); close(sock_generic); return error; } #define FUSE_MIN_READ_BUFFER 8192 enum fuse_opcode { FUSE_LOOKUP = 1, FUSE_FORGET = 2, FUSE_GETATTR = 3, FUSE_SETATTR = 4, FUSE_READLINK = 5, FUSE_SYMLINK = 6, FUSE_MKNOD = 8, FUSE_MKDIR = 9, FUSE_UNLINK = 10, FUSE_RMDIR = 11, FUSE_RENAME = 12, FUSE_LINK = 13, FUSE_OPEN = 14, FUSE_READ = 15, FUSE_WRITE = 16, FUSE_STATFS = 17, FUSE_RELEASE = 18, FUSE_FSYNC = 20, FUSE_SETXATTR = 21, FUSE_GETXATTR = 22, FUSE_LISTXATTR = 23, FUSE_REMOVEXATTR = 24, FUSE_FLUSH = 25, FUSE_INIT = 26, FUSE_OPENDIR = 27, FUSE_READDIR = 28, FUSE_RELEASEDIR = 29, FUSE_FSYNCDIR = 30, FUSE_GETLK = 31, FUSE_SETLK = 32, FUSE_SETLKW = 33, FUSE_ACCESS = 34, FUSE_CREATE = 35, FUSE_INTERRUPT = 36, FUSE_BMAP = 37, FUSE_DESTROY = 38, FUSE_IOCTL = 39, FUSE_POLL = 40, FUSE_NOTIFY_REPLY = 41, FUSE_BATCH_FORGET = 42, FUSE_FALLOCATE = 43, FUSE_READDIRPLUS = 44, FUSE_RENAME2 = 45, FUSE_LSEEK = 46, FUSE_COPY_FILE_RANGE = 47, FUSE_SETUPMAPPING = 48, FUSE_REMOVEMAPPING = 49, CUSE_INIT = 4096, CUSE_INIT_BSWAP_RESERVED = 1048576, FUSE_INIT_BSWAP_RESERVED = 436207616, }; struct fuse_in_header { uint32_t len; uint32_t opcode; uint64_t unique; uint64_t nodeid; uint32_t uid; uint32_t gid; uint32_t pid; uint32_t padding; }; struct fuse_out_header { uint32_t len; uint32_t error; uint64_t unique; }; struct syz_fuse_req_out { struct fuse_out_header* init; struct fuse_out_header* lseek; struct fuse_out_header* bmap; struct fuse_out_header* poll; struct fuse_out_header* getxattr; struct fuse_out_header* lk; struct fuse_out_header* statfs; struct fuse_out_header* write; struct fuse_out_header* read; struct fuse_out_header* open; struct fuse_out_header* attr; struct fuse_out_header* entry; struct fuse_out_header* dirent; struct fuse_out_header* direntplus; struct fuse_out_header* create_open; struct fuse_out_header* ioctl; }; static int fuse_send_response(int fd, const struct fuse_in_header* in_hdr, struct fuse_out_header* out_hdr) { if (!out_hdr) { return -1; } out_hdr->unique = in_hdr->unique; if (write(fd, out_hdr, out_hdr->len) == -1) { return -1; } return 0; } static volatile long syz_fuse_handle_req(volatile long a0, volatile long a1, volatile long a2, volatile long a3) { struct syz_fuse_req_out* req_out = (struct syz_fuse_req_out*)a3; struct fuse_out_header* out_hdr = NULL; char* buf = (char*)a1; int buf_len = (int)a2; int fd = (int)a0; if (!req_out) { return -1; } if (buf_len < FUSE_MIN_READ_BUFFER) { return -1; } int ret = read(fd, buf, buf_len); if (ret == -1) { return -1; } if ((size_t)ret < sizeof(struct fuse_in_header)) { return -1; } const struct fuse_in_header* in_hdr = (const struct fuse_in_header*)buf; if (in_hdr->len > (uint32_t)ret) { return -1; } switch (in_hdr->opcode) { case FUSE_GETATTR: case FUSE_SETATTR: out_hdr = req_out->attr; break; case FUSE_LOOKUP: case FUSE_SYMLINK: case FUSE_LINK: case FUSE_MKNOD: case FUSE_MKDIR: out_hdr = req_out->entry; break; case FUSE_OPEN: case FUSE_OPENDIR: out_hdr = req_out->open; break; case FUSE_STATFS: out_hdr = req_out->statfs; break; case FUSE_RMDIR: case FUSE_RENAME: case FUSE_RENAME2: case FUSE_FALLOCATE: case FUSE_SETXATTR: case FUSE_REMOVEXATTR: case FUSE_FSYNCDIR: case FUSE_FSYNC: case FUSE_SETLKW: case FUSE_SETLK: case FUSE_ACCESS: case FUSE_FLUSH: case FUSE_RELEASE: case FUSE_RELEASEDIR: case FUSE_UNLINK: case FUSE_DESTROY: out_hdr = req_out->init; if (!out_hdr) { return -1; } out_hdr->len = sizeof(struct fuse_out_header); break; case FUSE_READ: out_hdr = req_out->read; break; case FUSE_READDIR: out_hdr = req_out->dirent; break; case FUSE_READDIRPLUS: out_hdr = req_out->direntplus; break; case FUSE_INIT: out_hdr = req_out->init; break; case FUSE_LSEEK: out_hdr = req_out->lseek; break; case FUSE_GETLK: out_hdr = req_out->lk; break; case FUSE_BMAP: out_hdr = req_out->bmap; break; case FUSE_POLL: out_hdr = req_out->poll; break; case FUSE_GETXATTR: case FUSE_LISTXATTR: out_hdr = req_out->getxattr; break; case FUSE_WRITE: case FUSE_COPY_FILE_RANGE: out_hdr = req_out->write; break; case FUSE_FORGET: case FUSE_BATCH_FORGET: return 0; case FUSE_CREATE: out_hdr = req_out->create_open; break; case FUSE_IOCTL: out_hdr = req_out->ioctl; break; default: return -1; } return fuse_send_response(fd, in_hdr, out_hdr); } #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 < 25; 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 == 20 ? 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[7] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: syscall(__NR_prctl, /*option=*/0x37ul, /*arg2=PR_TAGGED_ADDR_ENABLE*/ 1ul, 0, 0, 0); break; case 1: res = syscall(__NR_socket, /*domain=*/0x18ul, /*type=*/1ul, /*proto=*/0); if (res != -1) r[0] = res; break; case 2: NONFAILING(*(uint16_t*)0x200001c0 = 0x18); NONFAILING(*(uint32_t*)0x200001c2 = 0); NONFAILING(*(uint16_t*)0x200001c6 = 9); NONFAILING(memset((void*)0x200001c8, 187, 6)); NONFAILING(memcpy((void*)0x200001ce, "macvlan0\000\000\000\000\000\000\000\000", 16)); syscall(__NR_connect, /*fd=*/r[0], /*addr=*/0x200001c0ul, /*addrlen=*/0x1eul); break; case 3: res = syscall(__NR_socket, /*domain=*/0x18ul, /*type=*/1ul, /*proto=*/0); if (res != -1) r[1] = res; break; case 4: NONFAILING(*(uint16_t*)0x20000400 = 0x18); NONFAILING(*(uint32_t*)0x20000402 = 0); NONFAILING(*(uint16_t*)0x20000406 = 2); NONFAILING(memset((void*)0x20000408, 170, 5)); NONFAILING(*(uint8_t*)0x2000040d = 0xa); NONFAILING(memcpy( (void*)0x2000040e, "lo\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 16)); syscall(__NR_connect, /*fd=*/r[1], /*addr=*/0x20000400ul, /*addrlen=*/0x1eul); break; case 5: NONFAILING(*(uint32_t*)0x20000180 = 1); NONFAILING(*(uint32_t*)0x20000184 = 0); NONFAILING(*(uint64_t*)0x20000188 = 0); NONFAILING(*(uint64_t*)0x20000190 = 0); NONFAILING(*(uint32_t*)0x20000198 = 0); NONFAILING(*(uint32_t*)0x2000019c = 0); NONFAILING(*(uint64_t*)0x200001a0 = 0); NONFAILING(*(uint32_t*)0x200001a8 = 0); NONFAILING(*(uint32_t*)0x200001ac = 0); NONFAILING(memset((void*)0x200001b0, 0, 16)); NONFAILING(*(uint32_t*)0x200001c0 = 0); NONFAILING(*(uint32_t*)0x200001c4 = 0); NONFAILING(*(uint32_t*)0x200001c8 = -1); NONFAILING(*(uint32_t*)0x200001cc = 8); NONFAILING(*(uint64_t*)0x200001d0 = 0); NONFAILING(*(uint32_t*)0x200001d8 = 0); NONFAILING(*(uint32_t*)0x200001dc = 0x10); NONFAILING(*(uint64_t*)0x200001e0 = 0); NONFAILING(*(uint32_t*)0x200001e8 = 0); NONFAILING(*(uint32_t*)0x200001ec = 0); NONFAILING(*(uint32_t*)0x200001f0 = -1); NONFAILING(*(uint32_t*)0x200001f4 = 0); NONFAILING(*(uint64_t*)0x200001f8 = 0); NONFAILING(*(uint64_t*)0x20000200 = 0); NONFAILING(*(uint32_t*)0x20000208 = 0x10); NONFAILING(*(uint32_t*)0x2000020c = 0); NONFAILING(*(uint32_t*)0x20000210 = 0); syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x20000180ul, /*size=*/0x94ul); break; case 6: NONFAILING(memcpy((void*)0x20000040, "/dev/ppp\000", 9)); res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x20000040ul, /*flags=*/0ul, /*mode=*/0ul); if (res != -1) r[2] = res; break; case 7: syscall(__NR_ioctl, /*fd=*/r[2], /*cmd=*/0x40047438, /*arg=*/0x20000180ul); break; case 8: res = syscall(__NR_dup, /*oldfd=*/r[2]); if (res != -1) r[3] = res; break; case 9: NONFAILING(*(uint32_t*)0x200002c0 = 2); syscall(__NR_ioctl, /*fd=*/r[3], /*cmd=*/0x40047435, /*arg=*/0x200002c0ul); break; case 10: syscall(__NR_ioctl, /*fd=*/r[1], /*cmd=*/0x80047437, /*arg=*/0x20001f00ul); break; case 11: NONFAILING(memcpy((void*)0x20002040, "./file0\000", 8)); syscall(__NR_mkdirat, /*fd=*/0xffffff9c, /*path=*/0x20002040ul, /*mode=*/0ul); break; case 12: NONFAILING(memcpy((void*)0x20000300, "/dev/fuse\000", 10)); res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x20000300ul, /*flags=*/2ul, /*mode=*/0ul); if (res != -1) r[4] = res; break; case 13: syscall(__NR_read, /*fd=*/r[4], /*buf=*/0x20002140ul, /*len=*/0x2020ul); break; case 14: NONFAILING(memcpy( (void*)0x20008400, "\x92\x75\x6f\x43\xb3\x1f\xfe\x54\x27\x88\xef\x58\x6b\x7c\x5a\x34\x44" "\x24\xe3\xac\xac\x25\x90\xbe\x6b\xbe\x37\xad\xfa\xce\x4a\x8f\x2e\x53" "\x4f\xfe\x76\xa8\x3a\x93\xf0\xb3\x68\x0a\x72\xfd\xdf\xde\x83\xf9\x6d" "\x01\x98\x23\x84\xe8\xd6\x89\x21\x9c\xb9\x66\x9b\x14\xdb\xaa\x1b\x79" "\x9f\x82\xea\x1f\xc9\x26\x12\x6a\x41\x63\x61\x8e\x16\xd4\xf9\x41\x43" "\xa4\xe0\xf2\x7c\x44\xfc\xef\x39\x20\xa0\xb3\x80\x5e\xd4\xe7\x80\x98" "\xd8\x68\x9c\xc7\x79\x1b\xd8\x66\x48\x07\x07\x18\xd2\x38\x66\x43\x32" "\x94\x8d\x87\x86\x6c\x8d\x25\x90\xfc\x0f\x01\x7f\x98\x53\xab\xd9\xed" "\x60\xb9\x9f\x1a\xa6\xae\x2d\xbd\x24\xab\x6d\xbc\xeb\xdb\x05\x52\x46" "\x81\x5a\xce\x14\x7c\xc5\x0f\xa3\xb2\x86\x11\x48\xfc\xda\x37\x4d\x5b" "\x20\x3e\x51\xd7\x2c\x45\xe4\xdd\xe3\xe9\xee\x9a\x47\xff\xe4\x58\xba" "\xf7\xbb\x49\x03\x51\x35\xa8\x19\x4a\xa1\xf0\xa8\x3f\xa2\xab\xed\x56" "\x39\x8f\x90\xda\xff\x67\x96\x34\x61\x94\x53\xf5\x33\xf2\x25\x83\xa6" "\xe0\xa4\xdc\x09\xe9\xde\x46\x68\x4d\x5e\x01\x36\xe2\x29\x51\x0f\x37" "\x02\xcf\x3a\x4c\xd0\x06\x5d\x3e\x5d\x3c\x41\x9e\x38\xa8\x0b\x07\x0c" "\xa5\x50\x10\xe0\x82\xa9\xc5\x10\xfd\x18\xcc\x0b\x26\xbb\x5e\x8e\x45" "\x9e\x74\x7b\xef\xbc\x5c\x6b\x60\xac\xe8\x0b\xf4\x14\x17\xb7\xb7\x8c" "\xf5\x7e\x5b\x39\x84\xf0\xcd\xdd\xc6\x15\xc5\xe0\x00\x04\x54\xd3\xf4" "\xa1\x96\xfb\x6d\x18\xaa\x62\x9c\xf0\xb0\x24\x5f\x95\xba\x95\x8d\x86" "\xdc\x17\x56\x16\xf8\xcd\x3a\xc4\x73\x05\x7d\xc3\xa5\xff\x71\x07\x97" "\x33\x26\x35\x01\x07\xf4\x46\x8e\x7e\xcd\x48\xd6\x89\xb8\x2c\x12\xd2" "\x2a\xe5\xf1\x85\x83\x02\xa1\xb4\xcf\xde\x8f\xd3\x47\xa9\x9d\xdc\xde" "\x40\xd1\xc4\x9d\x9b\x50\x99\xfb\xcc\xf0\x9e\x78\x22\x12\xbe\x4b\x2c" "\xe3\x6a\x2b\xc3\xc9\xee\x79\x4a\xbf\xfe\x72\xa5\x50\x1e\x6c\x4f\x3f" "\x7f\x68\xb7\x47\x61\xff\xd6\x62\x06\x09\x22\x4a\x3b\xf1\x1f\x65\x5d" "\xad\xb5\xc8\xa5\x81\x3b\x02\xfb\x46\x83\x0e\x9a\xc6\x82\x5f\x5d\x0e" "\x89\x91\x03\x52\xeb\x3a\x58\xc0\xdd\x82\xd0\x94\xf9\x4d\xd2\xc8\x56" "\x66\xf6\x84\xa8\xf4\x37\xbb\xd0\xe6\x6b\x9f\x4d\x36\x61\x17\xb6\x7a" "\x05\x4d\x21\x2c\x4f\xbc\x28\x78\x48\xcb\x05\x78\x39\x13\x35\xd5\xd6" "\x16\xb1\x4d\x99\xa2\xe3\xdf\x8e\x8a\x15\x2d\x5d\xe9\x9b\xce\xfc\xaa" "\xb5\xbb\x5c\xc7\x1f\x3d\xdd\x66\xb3\x79\xc1\x04\x64\x8e\x19\x0e\x0b" "\x28\xa1\x80\xd3\xae\xcc\x54\x23\x57\x5d\x4b\xa7\xdb\xf3\x12\x15\xc7" "\x17\xda\x7b\x87\xdd\x45\x4b\x6e\xfc\xd3\x6c\x91\xaa\xa6\x31\x12\x7f" "\x5b\xd8\x87\x23\xd2\x21\x75\x2f\x10\x2b\xc0\xc7\xac\x6c\x5c\x7a\x1a" "\xd6\x74\x7a\xf4\x0d\x01\xb6\xd3\x9e\xab\x7b\x0e\x12\x92\xb4\x46\x83" "\xc5\x86\x38\x6a\xd0\x0a\xcf\x60\xfb\x8f\x9b\xac\x55\x1a\x6e\xb5\xba" "\xb7\x31\x7b\x5d\x89\xf6\x4d\xb1\x0b\xd9\x01\x8d\xfa\x6d\x65\xd9\x38" "\x62\xe8\x51\xaf\xbc\x30\xfd\x70\xfe\x5f\x0d\xe3\x22\x46\x20\x45\x17" "\x72\x31\x85\x2c\xa8\x0e\x4e\x78\xda\x4f\xea\x0c\x79\xba\x35\x43\x33" "\x02\x6c\x8b\xc7\x7d\x30\x8a\x8d\x25\x6a\x19\xec\x45\xd2\x08\x8c\x19" "\x66\x91\xd3\xf9\xaa\xc2\x8d\xed\x36\x00\x4a\x65\xee\x1c\xe4\x9b\xa9" "\x59\x9c\xee\xe8\x45\x34\xbb\x61\xd0\x2d\x04\xa6\x73\x2f\x1e\x27\xd7" "\x29\x62\xf7\x4b\x59\xf3\x52\x2b\xf8\x44\xc5\x02\x29\x86\xd5\x59\x34" "\xe4\x8b\x86\x81\xb7\xf5\xb7\x53\x23\x91\x44\x8c\xae\xef\x00\x31\x5d" "\x28\x32\x0a\x46\xd8\xbd\x78\x13\x54\x4e\x1e\x4b\xf9\x94\xe1\x4a\x51" "\x9c\x26\x54\xff\x20\xb4\x2b\xdb\x69\xc2\x62\x89\x7e\x28\xec\xa5\x28" "\xf0\x99\x98\x40\xb0\x0e\xd8\x25\x65\x97\xd2\x7c\xfc\x20\xd7\x1d\x5f" "\x40\xd0\xbb\xca\x75\x9f\x75\x94\xc6\x03\x4a\xa1\xe1\x6a\x84\xed\x15" "\x2f\xad\x0f\xdc\x1c\x30\x3a\x7f\x61\x22\x57\x12\x71\x4f\x82\x3a\xfc" "\x5e\xa2\x41\xd4\x82\xd3\x58\x57\x59\x62\x3a\xf8\xc9\x7c\xa6\xa8\x4a" "\x20\x33\xb3\xd7\x31\x4e\xa0\xef\x7b\xa9\xb2\x88\xb3\x62\xa2\x94\xc9" "\x2c\x8b\x97\x36\x82\x9c\x16\xf6\x1c\x5a\x1e\xe0\x4a\xca\x96\x5d\x71" "\x16\x22\x92\x27\x45\x95\xea\x62\xc9\xc2\x91\x8e\x82\x79\xc9\x9f\x5d" "\x28\x30\xc6\x17\xc5\x82\x11\xfd\x74\x52\x33\x01\x84\xb9\x42\x8d\x5e" "\xc1\xd5\xcd\x75\xdd\xcc\x6d\xe3\x32\x6f\xdc\x70\xe8\x91\x10\x4b\x3b" "\x01\x3c\x30\xff\xcc\xfa\xf3\x30\x8d\x96\x71\xb0\x1f\x6b\x08\x0a\x93" "\x0d\xac\x20\x52\xc6\xf3\x98\x17\xa6\x62\x12\x1d\x90\xd4\x0d\x6a\x1f" "\xac\xfb\x50\xbe\xc7\xd4\x08\x03\x0b\x6d\x0a\xe3\xe7\x44\xf3\xbc\xc3" "\x27\xc3\x5d\xc4\x3c\xf8\x6b\x74\x3d\xb7\x8f\xf2\xe5\x93\xb1\x99\x23" "\x23\x5e\xd6\x46\x7f\x29\x9b\x08\x71\x8f\xe1\x84\x0c\x16\xa7\x48\x93" "\x5d\xff\x94\x11\x50\xfb\x08\xb3\x05\x73\xb3\x7b\xf9\xaf\x5c\x86\xcc" "\x8d\x9e\x22\x9a\x83\x2e\x4e\xf2\x5e\xc9\x1f\x71\x12\x0f\x2b\x3e\x90" "\x62\x48\x59\x76\xc2\x80\xa2\xd1\x72\x38\x60\x29\xe2\xf2\xa4\x80\x11" "\x97\xfc\xa0\xa1\x35\x14\xed\xac\xf5\xdd\xba\xc5\xa6\x2e\x8b\xb1\x3d" "\xd1\x57\x26\x57\xa8\x21\xa8\x73\x92\x97\xf7\x2e\x29\x23\x9d\x1c\xdd" "\xdf\x3e\x30\xcb\xe9\xaf\x31\x41\xf2\x27\x5e\xe4\xae\x85\xd8\x6e\xc8" "\x88\xfe\x9a\x67\x51\xf2\x52\x05\x7e\x95\xb8\xbe\xb0\x55\xe2\x76\x43" "\x95\x81\xaf\xee\x93\xcd\x44\xf1\xe9\x2f\x70\xe5\xf7\x25\x45\x1d\x3a" "\xb6\x62\x91\x8f\xfb\xb1\x26\x95\x09\xfb\xd5\x11\xe9\x5a\x00\xec\x71" "\x7f\x9d\x60\xd6\x43\x86\x4a\xbd\x6a\xd1\xcc\x4d\xd7\xf9\x33\x37\x9a" "\x60\x78\xa8\x6c\x21\x58\xdb\x80\x76\xe7\xb6\x60\x36\x6f\xca\x7b\x1c" "\x46\xd0\x9d\x2c\x8e\x67\xa6\x49\x4b\xfb\x4c\x2c\x67\x50\xe7\x65\x93" "\x89\x5b\x5e\x2b\x2b\xc7\x80\x93\x84\x0c\x3c\x4a\x80\x78\x26\xbc\x27" "\x50\xa9\x6b\x4e\x1d\xd5\xb8\x2b\x49\x2b\xb2\x21\x55\x18\xc9\x20\x64" "\xd1\x76\x3c\x37\x13\x26\x04\xe5\x2e\x73\xfa\xc3\xf4\x51\x1f\x79\x17" "\x53\xae\xec\xfb\xb1\x98\x16\xe0\xda\x7a\x1b\xfb\xea\x9e\xea\xa0\xf2" "\x56\xea\xed\xcb\x11\x9a\x61\xf7\xd0\xea\x0f\x5c\xd4\x96\x9d\x45\xcb" "\x01\x48\x00\xf2\xc8\x88\xd5\xc2\x21\x7c\xf0\xf6\x9a\x75\x07\x77\x98" "\x83\xb5\x73\x52\xbb\x88\x83\xcc\x58\x48\x91\x95\x0d\x6e\x79\x25\x37" "\x07\x4f\x4f\xc4\x33\x7a\xa1\x9b\x9b\xf6\x0e\x18\xed\xd9\x39\xd2\x89" "\xfb\x4a\x6b\x7a\xa6\xc6\x6d\xa2\x07\x74\xe2\x49\xca\x4f\x77\x9d\x3c" "\x91\x0b\x1a\x9a\x8e\x4c\x38\xaf\x6a\xde\xcc\x87\xd5\x48\x1d\x18\x1f" "\xd6\x60\x23\xff\xff\x24\x6f\x4e\x25\x56\xb2\x18\xfe\x81\x10\xac\xeb" "\xe2\x0b\x16\x75\xf1\xde\x6f\x26\x5b\x6d\x1d\x85\x14\xa5\x35\x22\x39" "\x6b\xf0\xe2\xf2\xb1\x53\xc4\x98\xe4\x8b\x36\xd1\x6f\x8b\x9b\xd5\x6f" "\x45\xd7\xf5\xb9\x39\x7d\x7f\x13\x39\x11\x7a\x17\x6d\x0b\xad\x0b\x68" "\xe8\x00\x68\x24\x16\xd3\xe1\x8f\xe2\x19\x7c\x7f\x8d\xc2\x06\x00\xfe" "\xb9\x5c\xc6\xba\x86\xad\x47\xf1\x13\xe1\x59\xbd\x43\x89\xe3\x0e\xab" "\x28\x74\xbd\x27\xee\xbc\x56\x02\x0c\x4d\xab\x99\x73\xb1\x3f\x3e\x82" "\xaa\x62\xa7\xe0\xa1\x51\xd7\x3d\xe4\x8c\xb8\x11\xe3\x2b\xe6\x3f\xfd" "\x30\x3f\x5a\x6e\xa6\xf0\x97\xed\x76\x3f\xbf\x36\xc4\x30\x82\x1e\x45" "\x11\x46\xde\x79\x92\x23\x48\x35\x4c\xe2\x85\xaf\x09\x97\xbf\x3c\x66" "\xe6\xef\x02\x94\x2e\x24\xb8\xf1\xcc\xdd\x54\x2f\x09\xcf\xe6\x5c\x0d" "\xa0\x09\x4c\x0b\x5f\xd2\x6b\xbc\x06\x15\x38\xb4\x1e\x5e\xd2\xcb\xb3" "\x90\xee\x29\xb1\x0a\x4b\x7a\x69\x60\x09\xe1\xb5\xb8\x6c\x44\xc0\xa5" "\x61\xa2\x57\xc1\x54\x15\xfe\xae\xb1\x43\x3e\xa2\x75\xed\x6e\x4b\x22" "\x85\x03\xfe\x71\xee\x59\x42\x66\x51\x64\xfa\xae\xd6\x69\x71\x12\x20" "\x6b\xe0\xfe\x78\x63\xae\xbd\x4b\xbe\x95\x1d\x5d\xea\x1d\xa2\x94\xdb" "\xa0\x79\x31\x96\x38\x5f\x4d\x51\x41\xc9\xd6\xc4\xb0\xfa\x22\xb2\xe2" "\x00\xcf\xb7\x0b\x52\xac\xa3\x16\x55\xe7\x1e\x5a\x57\x6c\xcb\x8c\xcb" "\x5b\x13\x64\x74\x8a\xa9\x81\xed\xbb\x81\xa8\x13\xb1\xae\xbc\x67\xbe" "\x1f\x76\x19\xe7\xe1\x97\x62\x2d\x98\x12\x80\x42\x9f\x6c\xa5\x14\x5c" "\x5b\x3b\x05\xe6\xba\xce\x91\x91\xe5\xc5\x8f\xbf\x14\x0f\x71\xf5\x94" "\xcb\xfd\x4d\xb0\xe9\xf6\x92\x3f\x17\x58\xff\x94\x64\xa6\x1a\x72\x0a" "\x5d\x4f\x09\xc6\x22\xc3\xce\x3f\x5d\x0d\x3a\x1d\x19\x11\x11\x16\x81" "\x08\xf4\x1f\x12\xb1\x6e\x9e\xaf\x36\x17\xc3\x53\x71\x5c\xd3\x52\x60" "\x56\x0c\xbf\xd0\x55\x5d\x51\xce\x5c\x40\xbb\xdb\x7c\x95\xce\xae\xad" "\xad\xb8\x90\x29\x74\xde\x50\xb0\x86\x33\x48\x18\x38\x64\xf5\xea\x68" "\x2e\x67\x82\x86\xa0\x6a\x6f\x39\x6a\xf2\x9a\x7c\x7f\xb3\x3a\x35\x79" "\xe2\x58\x35\x96\x36\x12\xf3\xc0\xd4\xcf\x36\x9d\x85\x95\x9a\x0a\xde" "\xda\x94\xd3\x58\x24\x05\x0e\x6f\xba\x7f\x83\xf9\x08\x67\x58\x3f\x71" "\x3d\x77\x83\x32\x3c\x70\x10\xe9\x4c\x9b\xe3\x31\xf8\x60\xdb\x39\x5d" "\xbd\xe6\xfa\xce\x5b\xfd\xb6\x16\xfc\xef\xa9\xc6\xb0\x1f\x69\x63\xda" "\xa8\x40\xa3\x1f\xf5\x54\xa4\x58\xc0\xc5\x0c\xb5\xe0\x9f\x91\xf5\x4f" "\x63\x23\x45\x89\xde\xca\xf4\x5b\xbf\xba\xef\x0d\xcb\xff\x4a\xe6\xe6" "\x5c\xa2\x6a\x53\x02\x61\xc4\x91\xef\x8e\xb9\xa8\x55\xa1\xd7\x46\x33" "\x91\xc9\xb6\x6b\xe9\x6c\xf2\x4c\x3c\x32\x1e\xe5\xa5\xbd\xc8\x57\xf6" "\x0b\x58\x26\x83\xc6\xae\x1e\x37\x75\xb6\x2a\x9f\x19\xff\x8f\xa5\x13" "\x80\xca\x8a\x2a\x3c\x6d\xe7\x90\x12\xf5\x72\x7b\xa1\x20\x25\xe7\xe6" "\x72\x3a\x23\xa8\x1e\x06\x7c\xa6\xe5\x4c\x7b\x38\xff\x64\x88\x0d\x23" "\x5d\x21\xe7\xee\x52\x58\x95\x3d\xcb\xf9\xe2\xa9\x62\xf0\x06\xca\x4f" "\xfe\x87\x08\x59\x24\x2c\x85\x0c\xba\xe4\x22\x2b\x3b\x72\xc4\xf8\x69" "\x34\x37\x9b\xa2\xea\xd1\xdc\xde\x90\x62\x41\xb9\x94\xd9\x5c\x88\x35" "\x5a\xf5\xa9\xa3\x0a\xce\x9c\x93\x3a\x69\x42\xf3\x41\xad\x22\x1d\xd8" "\x25\x84\x6a\x8f\xd4\x4c\x03\xe2\xea\xa9\x31\x1c\x26\xe1\x5a\x1b\xd7" "\xcb\xba\x96\x1a\x22\xef\x23\xd7\xeb\xba\x0e\x34\xce\xc5\xef\x09\xb1" "\xce\x72\x81\x4a\x97\xe3\x3b\xd2\x9f\x3d\x9e\xc8\x0a\x4f\x45\xd1\xd2" "\x94\x86\xac\xcf\x15\xc1\x1f\x1a\x80\x0b\xd8\x49\x18\xe7\x62\x6f\x67" "\x82\x75\xd7\xc7\xac\xb0\x2c\xc0\xe6\xe3\x4b\xb7\x66\xba\x6b\x75\xc3" "\xad\x14\xfc\xa9\x35\x2e\x09\xc3\xb6\x93\x90\xc0\x45\xcf\xc8\x42\xff" "\x9a\xde\x8c\xa6\x93\xc0\x7f\xad\xc7\x04\x7a\x94\x6e\x6e\x57\x0c\x3a" "\xfc\x5b\x50\x1c\x96\x41\x03\x39\x7f\x5d\xda\xdc\x2d\x59\xa0\x48\x34" "\x8d\xd4\x2f\x07\xcf\xe3\x1b\xc9\xb5\xae\x45\x3f\x50\x86\xbb\x41\xbb" "\xa4\xc8\xa3\xe5\x18\xe3\x0b\x08\x55\x18\x4b\x05\x3f\x92\x30\x25\xdd" "\x72\xce\x1b\xcb\xf4\x12\x31\x97\x8b\x34\xa8\x54\x7c\x71\xd7\x31\x39" "\x92\x16\x50\x78\x90\x3c\x61\xd3\x12\xb0\xd9\x46\x94\x13\xc9\xfd\x97" "\xcc\xdf\x0e\xa2\x70\xfb\x6c\x47\xec\x88\x61\xa1\xc8\xd9\x09\xee\xac" "\xe7\x61\xb5\xa0\x6b\xa4\x6e\x25\x78\x5f\xf8\x7f\x86\x77\x77\xab\xb2" "\x37\xc6\xc9\x80\x68\x79\x91\xf1\xed\x01\x57\xd5\x84\x92\x26\x0c\x71" "\x2c\xec\x34\xc1\xfc\x09\x62\x10\x39\x55\xdb\x4d\x50\x90\xb6\xe8\x40" "\x9c\xf3\xc3\xc7\x9d\x0e\x69\x1c\xf4\xfb\xc0\xb2\x25\x1a\x01\x6d\xcd" "\x45\x69\x69\xcd\x32\xe5\x42\x95\x33\xbf\x0d\x6f\x8b\xda\x84\xc0\x5f" "\x0e\x20\x40\xde\x8b\x53\xbf\xb8\x67\x6e\xec\x4b\x76\xc3\xdf\x6f\x46" "\xb1\xe4\x37\x32\x03\x5d\xda\x57\x7e\x75\xf6\x40\x77\x7f\x6a\xe9\x0f" "\xd2\xf1\xaf\x42\xba\x46\x2d\xac\x73\x20\x19\xc5\x99\xbf\xef\x01\xac" "\xd6\xa0\xd4\xd1\x79\x6b\xcb\x8f\x58\x51\x9d\x6f\x9a\xd9\xa3\x20\x67" "\x04\xa9\x4d\x47\x25\x16\xb9\x88\x14\x1f\x44\xec\xd2\xe6\xf2\x8a\x49" "\xaa\x0c\x44\x9d\xb8\x79\x72\xfc\x99\x5a\x97\x37\x99\x14\x54\x6e\xa4" "\x31\x43\xea\x2c\xf7\x79\xa9\xcb\xe8\x1f\x11\x1f\xe8\x91\x29\xdb\x36" "\x10\x49\x21\x64\xab\x25\x98\xec\xa7\xe6\x0d\x9a\x69\x63\xd8\xba\x03" "\xa8\x67\x29\xdb\x86\xe4\x20\xfd\x96\xd6\x1b\x8f\xb1\x1e\xdc\x2b\x33" "\x9b\x57\xa7\x40\x07\x4a\xe5\xb7\x75\xea\xf6\x0c\xd8\x5d\xc9\x34\xe6" "\x04\xbf\x2b\x4b\xd5\x8e\xe0\x12\x05\xb4\xdf\x57\xac\x20\xff\x8d\xb4" "\x5a\x05\x98\x2b\x57\x96\x43\x88\x24\x07\x05\x0c\x00\x51\x02\xa2\xe7" "\x1f\x1e\x56\xdc\x76\xdb\xf5\x33\x11\x12\xe8\x3e\x48\xbf\xb5\xcf\x2a" "\x78\xa8\x93\x19\x0d\x78\x42\x61\x75\xc1\x62\xff\xaa\x72\x78\xa4\x3b" "\x99\x32\x31\x8f\xc1\x7f\xb8\xcb\x0d\xfa\xc6\x10\xb1\xad\x23\x5b\x91" "\xf9\xcb\x76\x23\xb1\x55\x11\x7e\x07\xf7\xb8\x76\xa3\xc3\x76\x27\xaa" "\x31\xea\xfe\xd1\x41\xcc\x0c\x54\x91\xc4\xf6\x21\xa6\x6b\x6d\x83\x7a" "\x14\x4d\x78\x71\x9c\x46\x51\x1c\x04\xa0\x93\xcf\x65\xfc\xe9\xfa\xbe" "\x5b\xd6\xd4\x99\xec\xeb\x63\x53\x8e\xce\x3c\xf1\x90\x53\x55\x0a\x23" "\x9b\xf9\x78\xc0\x8c\x87\x9f\x99\x54\x48\x5a\x4e\x3e\x0d\x5b\xed\xb8" "\x4b\x40\x7c\xed\x85\xc4\xdf\xc4\xd7\x5a\xf1\x16\x81\x59\x92\xc2\x9f" "\x0b\xc9\x27\xc4\xa9\x90\xc3\x8a\xe4\xfc\xc9\xfe\xb9\x0f\xec\x1b\x1b" "\x55\x5e\x04\xd0\x10\x42\x30\x10\x85\x53\x94\xd5\xcc\xfc\x8e\xd2\x11" "\x64\x19\x0c\xd8\xf8\x3b\xe5\xde\xbb\x70\x29\x0c\x35\x47\xf0\x7e\x4d" "\xc4\x28\x14\xf1\xe0\x01\x79\x8e\x6c\xee\xe2\x55\x8b\x0c\x6f\xf8\xc1" "\x75\x9f\x90\x26\x9e\xe2\x26\x13\x11\x16\x33\x2b\x99\xac\x8d\xd1\x04" "\xc9\x20\x88\xe1\xf9\x1a\xce\x31\x98\xc0\xf5\x9b\xfb\x75\xc4\xe4\xa6" "\x97\x66\x0e\xed\x43\xa2\x9c\x83\x1a\x55\x2d\xe3\x7f\xce\x6d\xce\x96" "\xfa\x51\xb6\xe2\x11\x1f\x30\x71\xa4\xe9\x44\x22\xd1\x5e\x10\x2e\x5f" "\x67\xda\x7c\xa6\xca\xe6\xbe\xd7\x74\x3e\xbf\xfa\xcb\x8a\x81\x1a\x14" "\x36\x05\x79\x1d\x17\x23\x21\x81\xa5\x17\xe8\x72\xf7\x12\x62\xc3\xc7" "\x36\x68\xf0\xef\x83\xaa\xd4\x98\xf6\x7f\xa2\x6b\xae\x69\x8c\xf7\x8f" "\x24\xc2\xdb\xec\xd3\x99\xa1\x90\xe6\xb8\xd0\x68\x4e\x92\x9f\x2e\x80" "\x83\x76\x5e\xb2\xc6\x77\x93\xa1\xad\xbb\x89\xd3\x6b\x58\xbf\xb1\x97" "\xcd\xc5\xf3\xc8\x94\xac\x9d\x88\x6e\x8f\x3b\x09\x36\xfa\xbd\x23\x3c" "\x09\xde\x8f\xab\x80\x99\xf7\x2a\x74\xd9\x08\xba\x5c\x5e\x4d\x39\x79" "\x0b\x0b\xf9\xe4\x5b\x71\x0f\x55\x87\xb7\xc9\x37\xc7\x66\x90\xc5\xc5" "\xfc\xe6\x21\xa5\x3a\x9f\xd0\x3b\x0a\x4e\xe6\xd8\xd1\xab\xbe\x2e\xd5" "\x61\x82\x0a\x77\xf1\x2a\x08\xca\xd0\x75\x55\x40\xab\x6d\xd1\x60\x4b" "\x7c\x30\xa8\x65\x29\x95\xab\x80\xb8\x5e\x91\x90\x11\xde\x94\x38\xa4" "\x63\x7e\xb0\x29\x11\x24\xed\x4b\x74\x5e\x78\x2c\xff\x98\x51\x0c\xb0" "\x3b\xe7\x9c\x2a\x81\x35\x1a\xbf\x27\x65\x84\xd7\x5c\xdd\x96\xb9\xc9" "\x7e\x73\xeb\x71\x00\x0b\x3a\xb7\xc3\xc1\x9c\x2c\xab\x44\x97\x29\x8f" "\xcb\x30\x52\xb5\xd4\x50\x3d\x05\xe7\xf3\x10\x31\x8b\xe6\xf8\x48\x54" "\x7b\x1a\x4f\x4d\xb8\x2c\xae\xe1\x90\x80\x14\x78\xbe\x28\x06\x50\x36" "\xaa\x4d\x91\xf2\x90\xc1\xf3\x96\x34\x3e\x73\xa5\xfe\x8b\xb5\xcc\xf0" "\xa3\x17\x17\x7e\xd1\xf7\x7a\xcd\xa1\xa4\xa4\x9d\xcc\xfc\xab\x8d\x1b" "\x5d\x79\xf0\x15\xf7\x88\xb6\xd5\xe9\xf8\x22\x8a\x8b\xcd\xc0\x69\x6e" "\x6b\x19\xf5\xed\xff\xbc\xd7\xe9\x50\x9c\x87\xfb\xe1\xf7\x26\xb9\x3b" "\xf8\xc6\xd8\xd3\x74\x28\x76\x3e\x14\x25\x60\xc4\x6c\x9e\x89\x4f\x73" "\x17\x85\x90\x00\xc2\x5a\xbc\x4f\x36\x91\xeb\xcd\x02\x01\x71\xe0\xd4" "\x91\x1b\x5d\x97\xa2\x38\x10\x9a\xed\xeb\x00\xb2\xeb\x47\x5c\x1e\x7b" "\x45\x17\x5f\x8a\xa8\x51\x93\xb5\xc0\xf4\x3b\x43\x4c\x15\xde\x01\x61" "\x0c\x4d\x02\x26\x46\xcd\x6e\x36\x37\xf3\x49\xa4\x34\xa7\x7f\x57\x1a" "\xc1\xc5\xd6\x98\x45\x2d\x1b\x99\x1e\x26\x7f\x78\xdc\xa5\xe5\x92\xec" "\xd3\x1c\xca\xfc\xad\x84\xe4\xe9\x8d\x13\x4b\x4a\xdc\x52\x5b\x81\xbd" "\x68\x43\x42\x88\x83\x02\x3a\x6e\xa4\x07\x20\x17\x38\xc8\xbf\x16\xb5" "\x41\xff\x72\x80\x27\x4a\x34\xd4\xcf\x14\x81\x9f\x2d\xba\xe1\x67\xca" "\x0c\xae\x84\x71\xc4\x95\xe0\x06\xb4\x51\x94\xad\x91\xc4\x51\x6f\x21" "\xcb\xb1\x0e\x0d\x26\xfd\x5d\x73\x4c\xd7\x72\x5d\xf5\xb3\xfb\xe9\x29" "\x55\xf4\xa9\xbb\x3b\x9b\x81\x3a\xee\xff\x79\xd6\xed\x5d\xb9\x2d\xef" "\x19\xd0\x60\xa2\x08\xc3\xec\x8c\x42\xc1\x10\x78\x6f\x1e\x14\x96\xc5" "\x0a\x72\x49\xb0\x3f\xc7\x92\x76\x43\x66\x89\x4a\x35\x32\x0b\x99\xd0" "\xbe\xf9\xfd\x0b\x6a\x24\x6c\x36\xa3\x57\xc6\xb9\x85\xdc\x83\xa3\x7a" "\x8d\x9b\x8b\x9a\xd6\x43\xde\xa9\x48\x60\xcb\xe7\x63\xbb\x73\xcc\x84" "\x22\xb6\x9d\x4d\x12\x33\x22\x42\xc8\x95\x40\x75\xfb\x71\x17\xa6\x67" "\x96\x38\x07\x36\x17\xab\xcd\xb4\x61\x98\x55\xb2\x03\x6a\xf1\x60\x64" "\x7f\x66\xb3\x53\x16\x45\xa3\xbf\x04\x7a\xe2\x90\xd6\xae\x22\x49\xf1" "\x14\xe7\xa8\x46\x42\x78\xba\xe1\x48\x60\x22\xbc\xc7\xc3\x73\x90\xc8" "\xd9\xa0\xef\xb0\xe1\xcf\xa0\xda\x8e\xf7\xa5\xe0\x72\xf9\x9a\x47\xec" "\xc7\x5e\x4e\x44\x28\x80\x37\x51\x93\xdb\x49\xbb\x82\xba\x34\x90\x12" "\x86\xca\x47\x3e\xd5\xb6\x3e\x40\x48\xdb\x4d\xc4\x55\xe7\x4b\x3f\xdd" "\x2e\x78\x98\xca\x3f\x4c\x3a\x02\xd4\x35\xcd\xe6\x14\x1e\xea\x64\x50" "\x55\x12\x3a\x7d\xcf\x0d\x22\x05\x7f\x8d\x42\x57\x01\xaf\xc5\x58\x59" "\xf5\x14\x79\x54\xe7\x19\xd5\x8c\x74\x86\xb1\xe0\x2a\xc1\x6c\xb7\x99" "\xb7\x76\x32\xc6\x6b\xb7\x8e\x6e\x52\xe1\x10\x17\xc1\x73\x64\x24\xfa" "\x4d\x43\x3f\x1e\x19\xb4\xc8\x81\xd2\x3f\x0b\x2a\x12\xd5\xfa\xe3\xae" "\x24\x33\x90\x88\x08\x8d\x9b\x49\x6a\xd9\x7b\xd9\xf6\xe2\x0a\x85\x97" "\xd1\x45\x2a\x0c\x72\xdc\xf4\x3d\xbb\xda\x8f\x18\x16\x65\x85\xc0\x6d" "\x21\xfb\xff\xe5\xfe\x7b\x55\xf7\x1c\x9b\x9f\x1b\x34\xa0\x2b\xd0\x5c" "\xa6\x3c\x7c\x1b\x1b\xeb\xbb\x9d\xd2\x4f\xb1\x02\x91\xb0\x4c\x66\x5d" "\x45\x15\x4d\xd2\x8b\x85\xd8\x21\xce\x7e\x61\x31\x19\x12\x89\x96\x78" "\x5e\x10\x06\xa8\xda\xbc\x48\x99\xb1\x0d\x26\x71\x10\x7d\x5a\x06\x58" "\xed\x36\x3b\x9d\x4b\x39\xd0\x2f\x8c\xc5\xe3\x50\xfb\xf0\xa3\x10\x48" "\xad\xec\xd1\xf9\xe2\xca\x74\x9b\xd8\x6f\x19\x5e\xb4\x8e\x9b\x46\x05" "\xf0\x50\xde\x03\xd6\x42\x94\x0d\x79\x18\x46\x18\xf7\xf8\x8a\x9a\x0a" "\x46\x83\xad\x84\xd6\x13\x4e\x39\x53\x05\xbc\x1d\x4d\x9d\x17\xcc\x33" "\x4b\x97\x65\x35\x29\xd6\x68\x2a\x87\xa5\xfa\xc8\x0a\x6d\x46\xd6\xe7" "\x2f\xc2\x2e\x58\xbe\x7b\x8f\x86\x17\xb3\x37\x2e\xf2\x62\x21\x10\xab" "\x1e\xc4\x48\x71\x71\x18\xb2\x57\xac\xff\xe5\x5d\x18\xc7\x85\x5e\x9e" "\x87\x10\xad\x97\x7a\x67\x92\xb2\x31\x5a\x18\x9e\xb4\x46\x8c\x68\x64" "\x1e\x9b\x60\xc0\xda\xb7\x01\x6a\xc1\xad\x63\xcd\x80\x04\xb6\xec\xa8" "\xfc\x88\xb1\xe4\x26\x3a\xcc\x00\x49\x92\x55\xc1\x6b\x11\x48\x7a\x0a" "\xf8\x58\x07\x5f\x9c\x89\x2d\xc8\x04\x4c\x41\x46\xe5\xa5\x67\x7c\x4a" "\x2c\xb2\x4b\xde\x5e\x07\x89\x85\x02\x0d\x4a\xb1\xe4\xc8\x74\x92\xe7" "\x6b\x7e\x6f\x4b\xbd\x71\xd8\x4b\xab\x18\x85\xc9\x70\x28\x49\xe7\x0c" "\xf7\x28\x77\x6b\x1a\x94\xc2\xa8\xfb\x8c\x7c\xa0\x1b\x61\x11\xef\x6f" "\x20\x32\xa2\x90\x94\x9b\xfe\x47\x3f\xe2\x15\x27\x3b\x8b\x5b\x3a\xd5" "\x40\xf1\x87\x49\x0f\x63\x07\x7d\xcc\xbc\xa6\xf6\x2f\x0a\x7a\x66\x71" "\x7c\x59\x6c\xde\xf4\x12\xf2\x56\x0b\x10\x68\x5e\xde\x96\x7b\x3e\xe6" "\x8b\x8c\x95\x19\x59\xae\xb1\xd7\x56\x4c\x3b\x9d\x80\x6b\x2c\xe8\x58" "\x38\x13\x93\xa7\x99\x16\xb7\x8f\x7e\x90\xbe\xad\xae\x30\xff\xc0\xb2" "\xb6\x14\x38\x0f\x1c\x2c\xc5\x51\xa4\x45\x65\x20\x9d\xb3\x51\x6b\xe3" "\x79\xef\x56\x6a\xb0\x0c\x67\x3f\xd8\xaa\xee\xec\xdc\xf1\x16\x8c\x19" "\x60\xe9\xa4\x77\xb9\xe1\x37\x57\x49\x8a\x44\xff\x08\x93\x51\xd1\xf2" "\x7a\xbf\x9f\xd7\x68\x16\xf9\x24\x50\x46\x47\xd1\x24\x77\x15\xca\x86" "\x1e\xbe\x62\x41\x72\xc3\x22\x14\x6d\x66\xeb\x2b\x24\x7f\x8e\xcb\x3e" "\x1b\x5d\xdc\xa8\x9b\x28\x7c\x57\x51\x0c\xec\x40\xfc\xf8\x9d\x80\x2c" "\xf4\x36\x8a\x86\x1a\xf3\x20\xe0\x1e\x34\xf7\xa6\x17\x7d\x4b\xc5\x49" "\x18\x1b\x5e\x87\xec\xdf\xe0\x2f\x78\xc9\xa5\x9a\x3b\xf9\x1e\xbb\x63" "\x64\x02\x3e\xc0\x64\x10\xe7\xb4\x47\x6e\xc4\xe3\x68\x5b\xfa\x3b\xfe" "\x9e\xf9\xec\xc1\x2d\xcd\x89\x9a\xbe\x0f\x3c\x7f\x16\xb4\x68\x68\x01" "\xc0\xc0\xa9\x49\xaa\x26\xbe\xd5\x7d\xf5\x6f\x2b\xc5\x4e\xf1\x9a\xf7" "\xfc\xbc\x7b\x0d\x69\x10\x75\xf4\x2a\x4a\x67\xac\xf9\x80\xb5\x68\xac" "\xb2\x34\x2f\x42\x24\x9f\x7c\x1e\xe3\x52\x7c\x13\x18\x2b\x09\x60\x64" "\xec\xd2\x50\x88\x7a\x94\x2d\x26\xf6\x37\xe1\xc4\x04\x1b\x13\x96\x59" "\xd2\x46\x2a\x68\x68\x0b\xb0\x43\x87\xa3\xb3\x99\xe3\x96\xb9\xfe\x74" "\xde\x10\x35\x61\x25\xfa\x47\xd0\xa2\x08\x27\x37\x0c\xbf\x36\xa7\x9b" "\x6f\xff\xad\xe9\x1c\x43\x9d\xd6\xcf\xff\x4b\xbe\x0d\xd3\xef\xef\xb6" "\x1c\x49\x1e\xe3\x2f\x93\x5d\x62\x30\x7c\xba\x36\x9a\xc8\xc2\x0f\x6f" "\xe3\xd4\x85\x7c\xe6\xd2\x40\xec\xe5\xe4\xd1\x49\xf0\x58\x71\x55\xa8" "\x35\x0f\xcc\x18\xef\xae\x2f\xf1\x1c\xdb\xe1\x52\x18\xa8\x24\x99\xa1" "\x99\x6d\xf8\xb5\x46\x2e\xe1\x70\xb2\x84\x32\x1e\x76\xbb\xe5\xc3\xf4" "\x15\x83\x87\x64\x4d\x95\xf0\x87\xc5\x98\xe3\xd4\x6f\xbe\x27\xf6\x3f" "\xa7\x84\xbd\xa2\x39\x51\x21\x13\x42\x40\x45\xa2\xc5\xdb\xc6\xbc\x36" "\x62\xca\x73\x0a\x86\xd1\x3c\xf8\xf6\xfe\x27\x43\x22\x4c\xa7\xb5\x35" "\xca\xf6\xb4\x70\x1a\x7d\xae\x9c\xfa\xd3\xd7\x29\x01\x04\xbb\xba\x15" "\xb6\xa0\x64\xae\x6e\x90\x9a\x09\x9f\x75\xfb\xe4\x7c\x9e\x65\x4d\x8e" "\x3b\x8d\xc0\xf3\xdb\xff\xe8\x29\xe6\xc5\x6f\x7a\x24\x1e\x56\x51\x36" "\x81\x2a\x85\x7f\x59\xab\x56\x5a\x99\x91\xc6\xb1\xd8\xab\xcc\x94\xc6" "\xb3\x3b\xba\x31\x4f\x6e\x50\x60\xe6\x57\xe4\x64\x7f\x96\x9a\x55\x1d" "\xd6\xc5\x1d\xfc\xa0\xff\x5d\x9e\x4f\x40\x1f\xed\xbc\x2c\x92\x7e\xb1" "\xed\x95\xef\x25\xf4\xe5\xac\xcb\xa4\x99\x93\x22\xba\x15\x39\x49\x93" "\x10\xdd\x58\x75\x43\x3a\x22\x83\x5c\xfd\x42\xfd\x77\xfd\x46\x80\xb7" "\xfe\x76\x7d\x7a\xa5\xc3\x3a\xcd\xe0\x4a\x65\xbd\x3a\x66\x3f\xcd\xe4" "\xc8\x0e\x9f\x2a\xf4\x98\xf1\x3b\xf9\xab\xba\xa1\xc1\x26\x5e\xdc\x69" "\x1e\x94\xab\xdc\xc9\x22\x70\xc0\x58\x11\xcd\x2a\x81\x04\xeb\x18\xef" "\xbf\xec\x9e\x4b\xa9\xae\x5c\xde\x21\x1b\x9b\x93\x08\x2c\xe0\x34\xb6" "\xcd\x5f\xbe\x9c\xfb\xac\x4f\x7e\x24\x04\xef\x15\x97\x66\x12\x4f\x73" "\x01\x7c\xc3\x60\x0f\x3c\x81\xcd\x78\xdb\x25\xfc\x34\x59\x62\x9e\xaf" "\x20\xdf\xdb\x06\x2c\x7e\x50\x2a\xa6\x94\x12\x38\x1d\x84\x7a\x9d\x25" "\x4d\x5b\xef\xc4\x51\xcd\xa3\x60\x6f\x0b\xc8\xae\x62\xe0\xae\xe9\x28" "\xf9\xed\x0b\x21\xd7\x05\xa8\xd3\x1b\x89\x9e\x16\x44\x5e\xe0\x64\x56" "\x3d\x32\xf7\xb6\xbb\x5a\xd1\x97\x02\x3c\xf5\x28\xd9\xb3\x29\xec\x67" "\x81\x5c\x6d\xdf\x27\xd2\xa6\xff\xa7\x32\x8b\xb9\x93\x40\x7c\xde\x3d" "\x16\x61\x59\xfd\x49\xfe\x46\x92\x54\xb8\x4c\x29\x16\xda\xea\x8d\xf9" "\xd6\x9b\xef\x01\x9f\x13\x51\xb9\xbc\xe1\x93\xe3\x02\x78\x83\x5b\x82" "\xea\x5f\x60\xdc\x0b\xdd\x7f\x74\x52\xb7\xa8\x20\xae\x7c\xd6\xdc\x29" "\xd7\xac\x6a\x6c\x1b\x64\x11\x71\x1a\x96\x33\x8b\x1e\x76\x91\x46\xb2" "\xa3\x85\xd2\x82\xbf\xaa\xe6\x1b\x04\x11\x66\xef\xaf\xab\x2d\x89\xa4" "\x56\x7b\x94\x60\xcc\x22\xd7\x52\xf8\xe9\xaa\xca\xaa\x0d\xb7\xc8\x48" "\x79\xf5\x35\x96\x62\xd5\x5d\xf6\x57\x0d\x42\x14\x74\x08\x51\xc7\x45" "\x74\xce\xd7\x33\x80\x7c\xbb\x54\x57\x11\x10\x41\x08\x92\x39\x4c\x3d" "\xea\x07\xbd\x41\x54\xd0\xe5\x68\x9d\x57\xc3\x36\x02\x07\xda\xc9\x51" "\xf9\x6a\x35\x8e\x9c\x46\x6a\x5c\x51\x13\xf3\xa6\x32\xe1\x84\xf5\x7f" "\x07\x5e\xde\xf4\xdc\xc9\x72\x1b\x96\x3b\xeb\x95\xdf\x09\xde\xdf\x84" "\x82\x60\xcb\xc1\xeb\xfd\xc7\x40\x82\x18\xea\xba\x6d\x2c\x51\x92\x8c" "\xd3\x7c\x4c\x0c\x9f\x32\x1f\xbb\x09\x94\xa5\x69\x47\xcf\xd9\x64\x30" "\x56\xdb\x5d\xbe\xa6\x0a\x24\x1f\x8f\x00\x4c\x93\x2b\xc8\xe6\x45\xb2" "\xec\x2e\xb9\xbc\x4e\x9e\x2f\x41\x56\x29\x32\x34\xd0\x5e\x70\xcb\x26" "\xb8\xa3\x70\xb0\x20\x6c\x75\x6b\xda\x6d\xef\xc1\x1c\x5e\xb3\x86\x64" "\x0f\x53\x5a\x4f\xfb\x71\x41\x68\xde\xfc\x6d\x82\xf4\x0d\x8f\x5b\xa8" "\x76\x85\x37\xea\xd5\x77\x3c\x53\xbd\x77\x9c\xa8\x99\xa2\xdd\x31\xc9" "\x13\x85\x69\xff\x51\x07\xc2\xfb\x12\xb8\x04\x37\x5c\x3b\x3d\xc9\xb8" "\x28\xbf\xd5\x50\x32\x8a\xdf\x35\x8f\x71\xe8\x6a\x0c\x49\xfb\x11\x9f" "\x5e\xf9\xe0\x6c\x13\x85\x5c\xbf\xc7\xd1\xa6\x2c\xa2\xea\x65\x5e\xd9" "\x12\xa6\xdc\x7b\xb8\xb1\x86\x56\xe8\x92\x3f\xc7\xa1\x70\x2a\xb3\x69" "\x47\xd7\x93\x84\xd6\x81\xc3\x19\x23\xe9\x8c\xf4\x02\x09\xf7\x76\xbc" "\x2b\x21\x9a\x7c\xcd\x13\x9e\x75\x6a\x90\x5a\xa3\x51\xe6\xea\xae\x90" "\x77\x0c\x8a\x19\x3f\x96\xcd\x5c\x66\xe4\xd7\x7a\x35\x79\x85\x55\x6e" "\x14\x33\x37\x16\xd8\x02\x04\xa5\xc3\x90\xe0\xd7\x6f\x40\x81\xaf\xe9" "\x17\xf9\x9a\xd8\xa0\x97\x6b\x33\x42\xf5\x18\x54\xb3\x74\xb4\xba\xa9" "\xa7\xf2\x21\x24\xd2\xb8\x27\x49\x44\x6e\x30\xd9\x79\x5a\xcb\x9c\x3c" "\x3a\x30\x5a\x6d\x27\x3a\xc5\x28\xe8\xe9\xc9\x5c\x37\xa7\x8e\x76\x5f" "\xdd\xa5\x59\x82\xc2\x96\x1f\xbc\x85\xa1\x4f\xc0\x95\xa7\x8b\x46\x54" "\xee\x6d\xfc\x32\x98\x74\x9a\x63\x9a\xb9\xc8\xe1\x55\xaf\x3a\x77\xf8" "\xa4\x09\xce\x17\x45\x32\xa4\x92\xef\x55\x0a\x14\x0f\x77\x4d\x77\xd7" "\x32\xb3\xb4\xca\x5b\xc4\x1f\xa4\x48\x8c\xe5\x95\x7c\xe2\x19\xb0\x32" "\xae\x1f\x58\x52\x73\x74\x8d\x81\xb1\x9e\xdc\xf3\xe6\xcb\x9a\x93\xec" "\x24\xe4\x1c\x6b\x3c\x47\x2f\x9b\xaf\x3c\xa4\x6c\xb8\xb9\xa9\x1d\xf1" "\x8a\xce\xbe\x7d\x83\xbd\x44\x73\x75\x0c\x4f\x26\x80\x6d\xa2\xf9\x5b" "\x9e\xa4\x8b\x34\x24\x60\xaf\x72\x9a\xb1\x5e\x9f\x03\x3e\xda\x67\xfe" "\xec\x64\x5f\x98\x5d\x4b\x94\x89\xcf\x6c\xee\xc1\xb1\x00\xd0\x07\xbf" "\x46\xc7\x4b\xe5\x3c\x7e\xa1\x72\x96\xf9\xc5\xb5\xcb\xae\x73\x64\x91" "\x21\x3c\x93\xb5\x13\x00\x9e\xbd\xec\xfc\xd6\x0d\x46\xd7\xb8\x6c\x6e" "\x3b\x5e\x28\x8f\x2b\xa5\x86\x7c\x07\x93\x6e\x7b\xd1\xb0\x0d\xe5\x21" "\x91\xeb\x86\x30\xff\x82\xcc\xaf\xb2\x7a\x59\x29\x51\x64\x75\x18\x11" "\xbf\x74\xef\xf1\xe5\xe2\xab\xdf\x3c\x93\xbc\x5d\xc9\x81\x4b\xe8\x3b" "\x25\x62\x47\x79\x35\xe2\xfa\x30\xdb\x7e\xbb\x6e\xc3\x80\x17\x0c\xf1" "\x0c\x1f\x98\xf8\xc5\xeb\x71\xc7\x30\xc2\xb3\x1b\x55\xa1\xdd\x1c\x12" "\xa6\x48\x02\xab\x95\xb6\x3c\x52\x9e\x0a\x96\xce\xc8\xf3\x86\x80\x22" "\x1d\x60\x89\x92\x6d\x83\x09\x79\x6c\x79\x99\x4d\x63\xb6\x7b\xfb\x62" "\xf6\x6b\x4a\x50\x2f\x30\xed\x12\xbe\x41\xe8\x96\xe8\x8b\xc4\x5a\x16" "\x0a\x52\x6f\xbd\x5f\x00\x2e\x67\x73\x22\xf1\x16\xec\x57\x40\xd7\x56" "\x3c\xd2\x3e\xe8\x53\xc0\x08\xb8\x49\x98\xe3\x8f\xdf\x15\x85\x56\xe2" "\x8a\x53\x25\x73\x95\x6e\x7c\x00\xf9\x1f\x08\xca\x24\x5c\x29\x5a\x3d" "\x5e\x00\x3a\x99\xea\x72\x7f\x61\xd1\x28\x93\xb4\x35\xd4\xc8\xf2\xf5" "\xcc\xe0\x0c\x6a\x30\x91\xe2\xa4\x7f\x29\x0c\x07\x16\x89\x75\xc5\x3d" "\x75\x29\xb7\x1d\x10\xfa\xf4\x2d\x2b\xac\x9d\xb8\xd5\x36\x69\xcf\x59" "\xc7\x09\xc2\x5e\x9e\x40\xb5\xfe\xae\xd4\xc3\x7d\xde\x8b\x84\xc4\x96" "\x1c\x00\x71\x23\x26\xfb\x6a\xaa\x06\xe8\x0d\x76\x6b\x40\xb7\x24\x80" "\xf3\x97\x1d\xef\x61\xd1\xd1\x29\x67\x6d\xf2\x47\x8e\x77\x8d\x89\x9e" "\xd3\x17\x42\x6e\xc3\x3e\x49\x6d\x1f\xdd\x2e\xc2\x71\x28\xf8\xfa\xee" "\x92\x82\x8e\x13\xda\x72\xd6\xae\xe8\x33\x0a\x79\x88\xea\x1c\xc8\xb6" "\x4e\xc4\xd8\xb2\x09\x90\x86\x4c\x16\xc5\x2c\x4b\xe6\xd0\x0b\x30\x4b" "\x87\xd9\x7b\xff\xdd\x9c\x66\xa7\x40\xb5\x17\x22\x30\x89\xd9\xf3\xf4" "\x14\xab\xed\xc5\x3c\x76\x8d\xab\x92\x20\xb9\x80\xe6\xc1\x8d\x5f\x20" "\xba\x89\x94\xcc\x88\x86\xd7\xbd\xee\x21\x34\x42\xf4\x56\xd7\x9f\xce" "\x1b\x1e\xb4\x8f\xbf\x60\x0a\x66\x6c\x8a\xde\x24\xd1\x18\xe6\x32\x82" "\x51\xcf\x7b\x57\xa6\x28\x5c\x65\x0e\x01\x98\x50\xf3\x92\xb1\xc2\x9a" "\xec\x5c\x8f\xc4\x89\xa3\x81\x9d\x60\xd5\xde\x37\x7d\x4c\x11\xb8\xee" "\x56\x25\xb7\xc0\x2c\x5d\x50\xd2\xaf\x33\x97\x00\x6f\x2e\x2a\x41\xa0" "\x6f\x03\x92\x29\xee\xf5\x87\x8e\xd9\x1f\x9f\x6b\xe7\xe9\x88\x92\x4d" "\xba\xeb\x84\x55\xf6\x16\x27\x5e\x86\x98\xd9\x3f\xb5\x36\xe2\xc8\x39" "\xb2\x03\xaa\x69\xbc\xec\xed\xdb\xf9\xc5\x3f\x8a\xdd\xba\x53\xd5\x0c" "\xa0\xf7\xa4\x72\x9a\x42\xac\x6e\xb7\x57\xf1\xb4\x08\xad\x4a\x01\x47" "\x54\x61\x73\xe6\x2f\x76\x21\xeb\x18\xa9\xe1\x68\x15\x10\xcc\xeb\x48" "\xe0\xa3\x0a\xb7\xa1\xbf\x71\xd5\x67\x42\xd5\xf0\x34\xf2\xd7\x25\xe7" "\xea\x68\xa0\x11\xdb\xb1\x00\xfa\x6e\xef\xe4\xee\x09\x38\x73\xde\x36" "\x6d\x34\xf4\x24\x0c\xa0\x27\xa2\x5c\x5b\x97\x9c\x9a\xc4\x7d\xd1\xdc" "\xb6\xed\x82\xc4\xae\xe0\x9d\xcc\x23\xcf\x32\x9a\x86\x44\xf8\x9b\x5c" "\xf0\x0e\x56\x83\x93\x4b\x18\x37\x57\x4e\x9b\x39\xb3\x1b\x10\x09\xf2" "\x76\xe1\x5a\xa0\x40\x95\x9f\xdf\x10\x08\x38\xca\x3f\x5a\xb1\x7e\x45" "\x03\x66\x68\xd0\x60\x44\xe3\xa1\x3f\x3a\x0a\x6f\x68\x57\x9e\x50\xd5" "\xb0\x16\x4f\x90\x0d\x7b\xcf\xcd\xe7\x83\x96\xcf\x30\xf0\xb1\xdf\xf7" "\x6d\xc3\x97\xab\x1a\x5a\x44\xb2\x07\xeb\x1e\xaa\xf7\x3b\x94\x5c\x57" "\x50\x29\xae\x2d\xce\x20\x72\x49\x91\xe6\x55\x01\x55\xde\xd6\xa4\x26" "\x72\x60\x9f\x24\x39\xc5\xaa\xb4\x88\x2b\x2f\xfa\xf7\xda\x78\x7b\x71" "\xd0\x5d\x15\x51\x6b\xd6\x8c\x6f\x1a\x9d\x79\xb6\x75\x39\x58\x45\xf2" "\x4e\xe8\x53\xf8\x77\xe7\x2c\x14\xb6\xc6\x70\x2f\x7b\x87\x75\xca\x1b" "\xfa\xbb\xbc\xf4\x01\x9f\x7b\xcc\xf0\x7f\x1c\x21\x15\x31\xdf\xc6\x6a" "\x7a\x1d\xf7\x9e\x92\xa2\x0d\xd1\xcb\xe1\xb2\x2e\x12\x09\xe7\xe3\xec" "\xb9\xd3\xc2\x45\x0f\xc2\x2a\x57\xbf\xe0\x9b\xd7\x35\xf6\x1c\x36\x1c" "\xda\xc2\x48\x8a\xe0\xad\xc7\x88\x5e\xdc\x07\x12\x65\x5d\xaa\xf5\x35" "\xe1\xde\x96\xcc\xbe\x78\x69\xd5\x31\xd8\xbf\x3d\xb5\x12\xfb\xd1\x7c" "\x77\x23\x32\xa3\xf8\xcf\x1e\x05\x2e\xe0\x20\x2e\xb9\x9a\x36\xa0\xf8" "\xd7\x21\x98\x88\xac\xbb\x57\x09\x0c\xda\xf3\xb2\x8e\x1e\x62\xe8\xfc" "\x2e\xc2\x37\xbd\xf1\x85\x92\xa7\xaf\xe4\xd8\x39\x0d\xcb\x5e\x7f\xcc" "\x31\xbf\x4f\x79\x7e\x6f\x57\x10\x07\x09\x02\x26\x5c\xc2\xe8\xc4\x59" "\xb7\xda\x14\x51\x04\x6a\xbd\x6c\x8c\x5b\x02\xc0\xbe\x2d\x2f\x50\x5a" "\x65\x37\x62\x66\x56\x3a\xc7\xb5\x9e\xf3\xb4\xe2\x57\x0a\x6c\xb0\xbd" "\x94\xd4\x6a\xd8\x61\x31\x7c\x74\x3c\xe1\xde\x12\xbf\xa2\x29\x5a\x98" "\xcd\xde\xd4\x41\x4d\x87\xa1\x58\x0b\x1e\x46\x75\xbb\xdf\x73\xa2\x2c" "\xac\x4a\x1d\x8d\x45\x6d\x08\x9e\x0b\x60\xcb\xfd\x16\x15\x8f\x07\x3b" "\xd1\xda\xc4\x81\xdb\x49\xfa\x5d\x88\x01\xd0\xfb\x08\x44\xb4\xaf\xec" "\x1b\xab\x4e\x61\xfa\x0f\x38\x1f\xa6\x67\x88\x0a\x1c\xd8\x16\x39\x53" "\xbe\x7b\x59\x1c\xc9\xdf\xd7\xf9\x19\x02\x37\x0b\x78\x3a\xe8\xa0\xf3" "\xc7\xcb\xef\xa7\xd2\x29\xa3\x7c\x00\xf5\x23\x52\x9e\x15\x9b\x11\xd2" "\xe2\x40\x62\x9b\x64\xaf\x2d\x11\x40\x47\x73\xe9\x91\x20\x7a\x72\x2c" "\x32\x02\x21\xce\x23\xba\xed\x7c\xbe\x40\xa4\x40\xc5\x68\x08\x14\xb1" "\x22\xcf\xba\x90\x92\xfe\x03\x47\x8f\x85\xad\xcb\xde\xac\xb7\x6d\x6c" "\xbf\x24\x91\xea\xfa\xe9\x83\x27\xb2\x78\xe2\x67\x82\x1a\x0e\x1c\xd0" "\x6e\xf9\x0c\xb0\x32\x8e\x24\x6c\x19\xd8\xc6\x3b\x93\x32\x29\x1a\x89" "\xbc\x9f\x98\x9e\xff\xc6\x75\xc7\x9a\x87\x0a\xc0\x24\x75\x6c\x6f\x5a" "\x7e\x32\xba\xbd\x69\x62\x5d\x61\x48\x7a\xe7\x39\x94\x90\xb7\x0d\xd0" "\xfa\xde\x7d\x70\xad\x9b\x07\x57\x30\x0a\x2d\xde\x77\xab\xaf\xf4\xf6" "\x3a\x03\x03\x85\x35\x89\xd4\x4e\xfa\x96\x8e\x10\xd3\x65\x61\xf0\x44" "\x08\xad\x0c\xc2\x27\xfc\x6b\x2f\x90\x4c\xea\xd1\x89\xa0\xfc\xca\x9b" "\x2e\x6c\xbd\xe5\x49\x86\x52\xe0\xb3\xbc\x9d\x8b\x79\x21\x47\x44\x03" "\x71\x8f\xeb\x5c\xc7\x50\xdc\x70\xf5\xa9\xb1\xa0\xae\x2c\x64\x20\x15" "\xb6\xa1\xa8\xab\x05\x72\x18\x2b\x4e\x39\xe0\xc8\x69\xcb\xdc\x60\xc9" "\x46\x5f\x5d\x56\x4d\x18\xba\x2f\x5b\x3b\xc3\xe0\x5a\x45\x87\x44\x07" "\x74\x30\xc5\xea\x03\x1e\xe0\x2d\xd8\xf0\xa6\x5d\x7d\xd8\xd9\x0d\xd9" "\xb8\x71\x7f\x77\xd2\x02\x23\x9a\x57\x78\x71\x94\x23\xfb\x2a\xec\x7c" "\xa8\x6e\xb0\x7c\x39\xde\x65\xa3\x4b\x98\x8d\x65\x37\x7a\x74\x73\xe9" "\x14\x5f\x16\xd7\x95\x93\xe9\x69\x03\x33\x0b\xbf\x3a\x80\x24\xfc\x15" "\x51\x9d\x9b\xaa\x0f\xae\x20\x18\x78\x6f\x4b\x18\x46\xfc\xa3\x55\xff" "\x0f\xcc\xf6\x5c\xcc\xad\x18\x96\x30\x9a\x5c\xcf\x20\x56\xdd\x54\x2c" "\x92\x98\x50\xcc\x91\xcd\x65\x59\x62\x36\x0f\xe3\x16\x55\x7a\xb3\xfb" "\x37\x83\x28\xf7\x7a\x07\xd9\xda\x24\x44\x7d\x3f\xa2\x02\x0b\x38\x2e" "\xd2\xe8\x08\xec\x95\x29\xa0\x12\x73\x43\x4c\x64\xb0\xb7\xc3\x5a\x06" "\xa0\x19\xe4\xab\x51\xcd\xc9\xc0\xf2\x66\xab\x25\xb6\x98\x43\x38\xa0" "\xba\x91\x0d\x10\x60\x28\x3b\x63\x6c\x5d\x7e\x8a\x3f\x96\x9c\x1e\xe1" "\xc9\x9b\x54\xbb\xa7\xff\x36\x79\xfb\xee\xcb\xb7\x03\x49\xf0\x76\x48" "\x0a\x86\x7c\xc4\xee\x4c\xac\xae\xa3\x9c\x80\xf6\x42\x53\x35\x99\x48" "\x6d\x2f\xfb\x77\xb8\xc9\x10\x9a\x9d\x25\xfa\x0b\x06\xe5\x8e\xca\x76" "\x4f\x7d\x56\x46\x9e\xb9\x54\x70\x36\xbb\xea\x9d\x5c\x3d\x35\xb4\xc1" "\xfb\xc3\xd3\x9a\x37\x2c\x2b\x7a\xd1\x84\x96\x5c\xad\x38\x19\xc8\x92" "\x8f\x15\x88\xd0\x09\x49\x94\x9c\x0c\x4c\x93\xd3\x0a\xc7\xf6\x66\x52" "\x47\xc0\x10\x8b\xd8\x9d\xff\x3a\xaf\xe7\x80\xac\x66\xfe\xbf\xac\xc8" "\xc6\xa3\xcc\x38\x7d\x09\xda\x6d\xe7\x00\x48\x7a\x80\xe2\xc8\xd5\x6d" "\xf9\x4d\x7e\xbd\x3e\x1d\x9e\x06\x41\x1a\x6c\x5f\x7e\xb6\xda\x41\xc6" "\xf5\x29\x97\xb5\xad\x47\xba\x98\x52\x61\x10\x3f\xdf\x12\xeb\x4a\x28" "\x28\xb2\x48\xf6\x52\xef\x00\xb6\xab\xcc\xab\x2e\xb1\x61\xb8\x78\xb9" "\xdb\xc0\xaa\x91\x14\x05\xb6\xf6\x7a\xdd\xa8\x3c\x16\x18\x77\x48\xd7" "\xb5\x24\xff\xe6\x38\x1f\x48\x9f\x43\x2d\x59\x2e\x61\x71\xbd\x9c\xcb" "\x2c\xd5\x2f\x97\x71\x43\xf5\x7f\xbf\x2a\xb0\xb8\x23\xd4\x49\xae\x55" "\xf0\x24\x40\x97\x23\x34\x34\x4c\xda\x01\x83\x7b\x93\xaf\xa4\xf4\x6a" "\x2f\xde\xfe\x27\xe9\x27\x64\xcf\x95\x96\x78\x08\x46\xde\x2e\x3b\x1e" "\xa8\x3e\x62\xee\x43\xb1\xc0\x5a\xee\x67\x5e\x25\x36\x35\x04\xad\xdf" "\xaa\x68\xe7\xc5\x3e\xd6\x85\x41\x3f\x5b\xa9\x51\xf1\x20\xd0\xa6\x46" "\xe4\x74\x87\x2c\x81\xe5\xa8\x87\x46\x4c\x19\xf8\x46\x0a\xe8\x14\xff" "\xff\x24\xcb\x51\xdd\x2d\xca\x28\xd5\x97\xab\x2e\xa6\x09\x49\xf8\xdb" "\xbe\x67\xf2\x63\xe7\x22\xfd\xb5\x1b\xce\x4e\x32\x8a\x19\xf5\xff\x12" "\x18\xe1\xf6\x3b\x8d\xa6\xd4\x0d\xbd\x54\x90\x96\x44\x99\xb2\x52\x2e" "\xa3\x23\x31\x06\x34\x89\x3e\xad\x66\x14\x07\x96\x62\x07\xa6\x6a\xb1" "\x3a\xdf\xcf\x1a\x72\x5e\xd1\x43\x39\xc4\x60\x11\xc0\xe0\x40\x1f\x23" "\x86\xb4\x7c\xd9\xf9\x02\xfd\xf8\x4b\xc8\x5e\x74\xd3\xae\x7c\xc5\x44" "\xe4\xd6\x56\x70\xa5\x54\xa5\x37\x71\x2c\x6e\xe9\xf7\x51\x91\x63\x1d" "\x2a\x4c\x4d\xa0\x6f\xc3\x84\x23\xb1\xd5\xb8\x28\xd7\x20\x12\x35\xb2" "\x97\x41\x64\xf5\x2a\xa1\x6b\xee\x70\xee\x50\x92\x50\x75\x2f\x4f\xdd" "\x6b\x9f\x8d\x02\x19\x43\xdf\x83\x20\x68\x2a\x6f\x80\xff\x0d\x67\xab" "\x7a\x4c\xee\xa8\x07\xbd\x5b\x3b\x7b\x63\x80\xb0\xc7\xf0\xca\xa6\x7b" "\x02\x08\xba\x71\x31\x7f\x03\x55\xa3\xb7\x55\xaf\x0e\x2c\x00\x71\x86" "\x38\x94\x38\x61\x5d\xf8\x0b\x7b\x25\x10\x4a\x73\x3f\xc9\x06\x25\xb6" "\x26\x82\x19\x87\x33\xc0\xf1\x62\x5d\xfa\xa0\x8c\xf8\x1e\x3d\xf0\x43" "\x09\x4b\x7b\x5a\x09\x8b\x3b\x36\xf8\x03\xb5\xb0\xf1\x0a\x05\x7b\xf8" "\x14\xae\x35\x79\x93\x2c\x0a\x5f\x20\x89\x85\xba\xb3\xd8\x17\xf9\x75" "\x28\x3b\x88\x38\xae\x5c\xb7\x09\xbe\x72\xb5\x8d\xf7\x42\x5e\x05\x9f" "\xdb\xf4\xe0\xee\x51\xb3\xda\x01\xfe\x0b\x44\x96\x3c\x11\x96\xba\xee" "\x5e\xc5\x90\x9a\xd8\x0d\x9d\x16\x60\xf3\xed\xd9\x03\x74\x95\x2a\x0b" "\xf8\xb3\xbe\xce\x2c\x2f\x94\x45\x93\xf4\xde\x7d\xe5\xe0\x5d\xed\x09" "\x6b\x8f\x4f\x05\xd6\x5d\xfc\x2e\x80\x6f\x78\x22\x0d\x84\xb3\xdb\x56" "\x4f\xb1\x2f\x4e\x5e\x8f\x5e\xab\x31\x65\x91\xf0\x04\xe9\x37\x4c\xce" "\x8e\x78\x72\x63\xbc\x38\x27\xaf\xfe\x67\x93\xc1\x30\xb8\x62\x1d\x3b" "\xbb\x2a\x86\xfd\x87\xf0\x70\xea\x21\x71\x82\x81\xee\x7a\xec\x4b\xb3" "\xbb\x71\xaf\x4b\xf5\x72\x1c\xec\xd1\x39\xc4\xbe\x8c\x9d\xf4\xec\x8d" "\xfb\x09\xa5\xcf\x1d\x86\xa2\x5d\x39\xfa\xa9\xf0\x64\xa9\x97\xc2\x14" "\xf3\x34\xe4\x41\x09\x17\xfc\x3b\x4d\x67\xad\xa8\xd8\x7a\x38\xc0\xf8" "\x6b\x02\xbf\x65\x3d\xdd\xae\xb5\xb7\x5b\x30\x0f\x8b\xcf\xd7\x92\x85" "\x8b\xef\x8a\xb2\x3e\x06\x34\x21\x93\x9c\x59\x21\x29\x64\xc9\xed\x5d" "\xd5\x6e\x21\x5d\xb5\x8c\xef\x53\xd3\x1a\x96\x6b\xb8\xce\x4e\xd5\x62" "\x87\xfe\xcb\x3a\x85\xba\x43\x5e\x0b\x41\xb2\x0b\xa1\x16\x4b\x9c\x9f" "\x2c\x49\xfa\x0f\x7b\x17\xa8\x9e\x0e\xc4\x7e\xef\xe9\x92\xd6\x3e\xe2" "\x9c\x8c\x0a\x1e\xce\x26\x64\xfe\xe8\xed\xad\xd4\x36\x36\xa5\x4c\x48" "\x51\x9b\x4f\xcf\x55\xb0\xd9\x10\x36\x02\xb9\x24\x41\xa5\xf8\x5c\xf8" "\xc5\xe4\x06\xd0\xf5\x81\x5f\x8f\x37\x30\x99\x34\xbd\x78\xfb\xc2\xac" "\xf0\xa0\x3b\x05\x1b\x45\x28\xdb\x4f\x7c\x09\xde\x7d\x0a\xab\xaf\xca" "\x37\x36\xb8\x25\x9c\x81\x8c\xa3\x38\xca\x67\x54\xe0\x74\x77\x17\xc2" "\x79\x4d\x66\x4a\x1c\xac\xc1\xe9\xc5\x27\x64\xa3\x08\xe6\xdf\x73\xd9" "\x75\x63\x86\x30\xb7\x4c\xce\x6c\x49\xb1\xba\xc1\x64\x54\xe9\x68\x52" "\xc4\xf9\xd8\xed\x11\x8e\x86\xd2\xf1\xc8\xdc\x33\xbc\xcd\x4a\x07\xbe" "\x12\x8d\xb5\xe8\x0f\x56\x84\xdd\xcc\x11\x58\xe7\x44\x41\x1a\xcd\xe5" "\x90\xf9\x02\xf0\x98\x7c\xfb\x75\x0b\xb5\xbf\xee\xd5\x3b\xff\x07\x68" "\x68\x98\x6b\x56\x6d\x77\x01\xf4\x8d\xdf\xca\xcb\xd3\x25\xc8\xd9\x30" "\xbc\xef\x26\x71\x3b\xf6\x05\x85\xd5\xc9\x91\xe2\xa6\xcc\x33\xcc\xbc" "\x27\xf7\xdd\xfb\xa1\x8f\x99\x84\x97\xc2\xeb\x37\x8c\xc8\xf2\xcc\x07" "\xa1\xb4\xf1\x41\xc5\xe0\xfb\x6f\x52\xe1\x82\x42\xe5\x05\xbc\xf6\xdd" "\x20\xe3\x3a\x46\x9d\x05\x6a\x0b\x4f\xd5\xe7\x2d\x0d\xa9\xd0\xbc\xce" "\x1e\x2f\x9e\x9d\xc7\xd1\xc7\xb6\xcb\x0f\x36\x04\x28\x7e\xca", 8192)); NONFAILING(*(uint64_t*)0x200000c0 = 0); NONFAILING(*(uint64_t*)0x200000c8 = 0); NONFAILING(*(uint64_t*)0x200000d0 = 0); NONFAILING(*(uint64_t*)0x200000d8 = 0); NONFAILING(*(uint64_t*)0x200000e0 = 0); NONFAILING(*(uint64_t*)0x200000e8 = 0); NONFAILING(*(uint64_t*)0x200000f0 = 0); NONFAILING(*(uint64_t*)0x200000f8 = 0); NONFAILING(*(uint64_t*)0x20000100 = 0); NONFAILING(*(uint64_t*)0x20000108 = 0); NONFAILING(*(uint64_t*)0x20000110 = 0); NONFAILING(*(uint64_t*)0x20000118 = 0x200004c0); NONFAILING(*(uint32_t*)0x200004c0 = 0x90); NONFAILING(*(uint32_t*)0x200004c4 = 0); NONFAILING(*(uint64_t*)0x200004c8 = 0); NONFAILING(*(uint64_t*)0x200004d0 = -1); NONFAILING(*(uint64_t*)0x200004d8 = 3); NONFAILING(*(uint64_t*)0x200004e0 = 0); NONFAILING(*(uint64_t*)0x200004e8 = 0); NONFAILING(*(uint32_t*)0x200004f0 = 0); NONFAILING(*(uint32_t*)0x200004f4 = 0); NONFAILING(*(uint64_t*)0x200004f8 = 0); NONFAILING(*(uint64_t*)0x20000500 = 0); NONFAILING(*(uint64_t*)0x20000508 = 4); NONFAILING(*(uint64_t*)0x20000510 = 0xffff); NONFAILING(*(uint64_t*)0x20000518 = 0); NONFAILING(*(uint64_t*)0x20000520 = 0); NONFAILING(*(uint32_t*)0x20000528 = 0); NONFAILING(*(uint32_t*)0x2000052c = 0); NONFAILING(*(uint32_t*)0x20000530 = 0x3ff); NONFAILING(*(uint32_t*)0x20000534 = 0x6000); NONFAILING(*(uint32_t*)0x20000538 = 0); NONFAILING(*(uint32_t*)0x2000053c = 0); NONFAILING(*(uint32_t*)0x20000540 = 0); NONFAILING(*(uint32_t*)0x20000544 = 0x400902); NONFAILING(*(uint32_t*)0x20000548 = 0); NONFAILING(*(uint32_t*)0x2000054c = 0); NONFAILING(*(uint64_t*)0x20000120 = 0); NONFAILING(*(uint64_t*)0x20000128 = 0); NONFAILING(*(uint64_t*)0x20000130 = 0); NONFAILING(*(uint64_t*)0x20000138 = 0); NONFAILING(syz_fuse_handle_req(/*fd=*/r[4], /*buf=*/0x20008400, /*len=*/0x2055, /*res=*/0x200000c0)); break; case 15: NONFAILING(memcpy((void*)0x20000a80, "./file0/file0\000", 14)); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x20000a80ul, /*flags=*/0ul, /*mode=*/0ul); if (res != -1) r[5] = res; break; case 16: syscall(__NR_ioctl, /*fd=*/r[5], /*cmd=*/0x301, /*arg=*/0x20000001ul); break; case 17: syscall(__NR_sendmmsg, /*fd=*/r[1], /*mmsg=*/0x20001cc0ul, /*vlen=*/0x400000000000026ul, /*f=*/0ul); break; case 18: NONFAILING(*(uint32_t*)0x20000304 = 0); NONFAILING(*(uint32_t*)0x20000308 = 0x800); NONFAILING(*(uint32_t*)0x2000030c = 0); NONFAILING(*(uint32_t*)0x20000310 = 0); NONFAILING(*(uint32_t*)0x20000318 = -1); NONFAILING(memset((void*)0x2000031c, 0, 12)); NONFAILING(syz_io_uring_setup(/*entries=*/0x339e, /*params=*/0x20000300, /*ring_ptr=*/0x20002480, /*sqes_ptr=*/0x200024c0)); break; case 19: syscall(__NR_prctl, /*option=*/0x37ul, /*arg2=PR_MTE_TAG_MASK*/ 0x7fff8ul, 0, 0, 0); break; case 20: NONFAILING(memcpy((void*)0x20000040, "minix\000", 6)); NONFAILING(memcpy((void*)0x20000140, "./file1\000", 8)); NONFAILING(memcpy( (void*)0x20000640, "\x78\x9c\xec\xdb\xbd\x6e\xda\x50\x14\xc0\xf1\x63\xec\x62\xa0\x5f\xb4" "\xb4\x1d\xaa\x4a\x45\xea\xd0\x2e\xc5\x40\x5b\xa4\x6e\xed\xa3\x50\x70" "\x11\xaa\x69\xa2\x90\x05\xc4\x40\xf2\x02\x79\x86\xbc\x5f\x18\xa2\x2c" "\x99\x42\xe4\xeb\x8f\x28\x06\x83\x42\x00\x83\xfc\xff\x0d\xd8\xdc\x73" "\x3f\xce\x05\xae\x74\x84\x64\x01\x90\x5a\xbf\xa4\x2c\x9a\x68\x92\x71" "\xdf\x7c\xc8\x15\xcf\x4a\x5a\xd2\x29\x01\xd8\x92\xa9\x7f\xbd\x99\x02" "\x48\x1f\xfd\xda\xbb\x96\x93\x4e\x04\xc0\x96\x4d\x7e\x8b\xaa\xfd\x2f" "\x2e\x47\x2d\xd1\xb3\x61\x5d\x10\xdc\xb9\xf1\x71\x10\xcf\x98\x33\xf5" "\xc3\xe4\x44\xe4\xbd\xe1\xc7\xb5\x9c\xe4\xa3\xf5\xc5\xb9\xc8\xe7\x60" "\xbc\x56\x88\x0e\xbf\x72\x5b\x0a\x61\xfc\x69\x24\x9c\x55\xf3\x7f\xf9" "\x14\xac\xff\x4c\x9e\xcb\x0b\x79\x29\x45\x79\x25\xaf\xa5\xe4\xaf\xdf" "\x0e\xc7\xbf\x7b\x68\xf9\x33\xbb\x21\x00\x00\x52\x40\x93\xca\xb2\x78" "\x4c\x87\x27\xea\x35\x2f\x7f\xbb\x8e\x5d\x55\x3d\x23\xfe\x7c\x57\xbd" "\xdc\x78\x2d\x76\xfe\xac\x8a\xd7\x17\xc6\xf5\x8f\xf1\xf9\x99\x6a\x7c" "\xa5\x75\xe0\xb4\x17\xee\x03\xc0\xac\xcc\xca\xe7\xdf\xa3\x87\xe7\x7f" "\x3e\x63\xc9\xf9\x07\x90\x9c\xfe\x60\xf8\xaf\xe9\x38\xf6\xd1\x0e\xdc" "\xe4\xee\xe7\x33\x35\x45\x36\xb8\xa8\xb9\x0b\x5b\xde\xdf\x1b\x53\xa2" "\x2d\xc6\x5a\x66\xce\xc7\x86\x4e\x65\x5e\xc8\xfd\xd1\xac\x73\x5f\x23" "\xff\x60\x6c\xf6\x33\x1c\x47\x5b\xdc\x6a\x3a\xc9\xef\xd4\xf0\x56\xd7" "\xfd\x34\xf8\x5f\x0c\x48\x01\xeb\xb8\x77\x68\xf5\x07\xc3\xaf\xdd\x5e" "\xb3\x63\x77\xec\xff\xf5\x6a\xf5\x67\xe3\xc7\xb7\x5a\xa3\x6e\xa9\xca" "\xde\x5a\x5c\xdf\x03\xd8\x5f\x77\x65\x40\xd2\x99\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x80\x55\xbd\x91\xb7\x49\xa7\x00\x00\x00\x00" "\x60\x4b\x96\x3e\x18\x24\x86\xd7\xf1\x11\x0f\x18\x25\xbd\x47\x00\x00" "\x76\xce\x6d\x00\x00\x00\xff\xff\x18\x07\x0d\xd5", 420)); NONFAILING(syz_mount_image(/*fs=*/0x20000040, /*dir=*/0x20000140, /*flags=MS_NOSUID|MS_MANDLOCK*/ 0x42, /*opts=*/0x20000540, /*chdir=*/0xd, /*size=*/0x1a4, /*img=*/0x20000640)); break; case 21: NONFAILING(memcpy((void*)0x20000340, "#! ", 3)); NONFAILING(memcpy((void*)0x20000343, "./file0", 7)); NONFAILING(*(uint8_t*)0x2000034a = 0xa); syscall(__NR_write, /*fd=*/-1, /*data=*/0x20000340ul, /*len=*/0xbul); break; case 22: syscall(__NR_mmap, /*addr=*/0x20000000ul, /*len=*/0xb36000ul, /*prot=PROT_WRITE*/ 2ul, /*flags=MAP_STACK|MAP_POPULATE|MAP_FIXED|MAP_SHARED*/ 0x28011ul, /*fd=*/-1, /*offset=*/0ul); break; case 23: NONFAILING(memcpy((void*)0x20000040, "/dev/mISDNtimer\000", 16)); res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x20000040ul, /*flags=*/0ul, /*mode=*/0ul); if (res != -1) r[6] = res; break; case 24: syscall(__NR_ioctl, /*fd=*/r[6], /*cmd=*/0x80044940, /*arg=*/0x200030c0ul); break; } } 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); setup_sysctl(); setup_cgroups(); 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_usb())) printf("the reproducer may not work as expected: USB injection setup " "failed: %s\n", reason); if ((reason = setup_802154())) printf("the reproducer may not work as expected: 802154 injection 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(); for (procid = 0; procid < 5; procid++) { if (fork() == 0) { use_temporary_dir(); do_sandbox_none(); } } sleep(1000000); return 0; }