// 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 321 #endif #ifndef __NR_memfd_create #define __NR_memfd_create 319 #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); 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; } 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 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(); 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; retry: const int umount_flags = MNT_FORCE | UMOUNT_NOFOLLOW; 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 void setup_binfmt_misc() { if (mount(0, "/proc/sys/fs/binfmt_misc", "binfmt_misc", 0, 0)) { return; } 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")) exit(1); } static void setup_usb() { if (chmod("/dev/raw-gadget", 0666)) exit(1); } static void setup_sysctl() { char mypid[32]; snprintf(mypid, sizeof(mypid), "%d", getpid()); struct { const char* name; const char* data; } files[] = { {"/sys/kernel/debug/x86/nmi_longest_ns", "10000000000"}, {"/proc/sys/kernel/hung_task_check_interval_secs", "20"}, {"/proc/sys/net/core/bpf_jit_kallsyms", "1"}, {"/proc/sys/net/core/bpf_jit_harden", "0"}, {"/proc/sys/kernel/kptr_restrict", "0"}, {"/proc/sys/kernel/softlockup_all_cpu_backtrace", "1"}, {"/proc/sys/fs/mount-max", "100"}, {"/proc/sys/vm/oom_dump_tasks", "0"}, {"/proc/sys/debug/exception-trace", "0"}, {"/proc/sys/kernel/printk", "7 4 1 3"}, {"/proc/sys/kernel/keys/gc_delay", "1"}, {"/proc/sys/vm/oom_kill_allocating_task", "1"}, {"/proc/sys/kernel/ctrl-alt-del", "0"}, {"/proc/sys/kernel/cad_pid", mypid}, }; for (size_t i = 0; i < sizeof(files) / sizeof(files[0]); i++) { if (!write_file(files[i].name, files[i].data)) printf("write to %s failed: %s\n", files[i].name, strerror(errno)); } } #define NL802154_CMD_SET_SHORT_ADDR 11 #define NL802154_ATTR_IFINDEX 3 #define NL802154_ATTR_SHORT_ADDR 10 static void setup_802154() { int sock_route = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); if (sock_route == -1) exit(1); int sock_generic = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC); if (sock_generic < 0) exit(1); int nl802154_family_id = netlink_query_family_id(&nlmsg, sock_generic, "nl802154", true); 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)); int err = netlink_send(&nlmsg, sock_generic); if (err < 0) exit(1); 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)); int err = netlink_send(&nlmsg, sock_route); if (err < 0) exit(1); } } close(sock_route); close(sock_generic); } #define SWAP_FILE "./swap-file" #define SWAP_FILE_SIZE (128 * 1000 * 1000) static void setup_swap() { swapoff(SWAP_FILE); unlink(SWAP_FILE); int fd = open(SWAP_FILE, O_CREAT | O_WRONLY | O_CLOEXEC, 0600); if (fd == -1) exit(1); fallocate(fd, FALLOC_FL_ZERO_RANGE, 0, SWAP_FILE_SIZE); close(fd); char cmdline[64]; sprintf(cmdline, "mkswap %s", SWAP_FILE); if (runcmdline(cmdline)) exit(1); if (swapon(SWAP_FILE, SWAP_FLAG_PREFER) == 1) exit(1); } 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 < 9; 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 == 1 ? 4000 : 0) + (call == 4 ? 4000 : 0) + (call == 8 ? 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 (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[2] = {0xffffffffffffffff, 0xffffffffffffffff}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: NONFAILING(*(uint32_t*)0x200000c0 = -1); NONFAILING(*(uint64_t*)0x200000c8 = 0); NONFAILING(*(uint64_t*)0x200000d0 = 0); NONFAILING(*(uint64_t*)0x200000d8 = 0); syscall(__NR_bpf, /*cmd=*/2ul, /*arg=*/0x200000c0ul, /*size=*/0x20ul); break; case 1: NONFAILING(memcpy((void*)0x20000080, "nilfs2\000", 7)); NONFAILING(memcpy((void*)0x20000040, "./file2\000", 8)); NONFAILING(memcpy( (void*)0x20001c80, "\x78\x9c\xec\xdd\x4d\x8c\x5b\x47\xe1\x00\xf0\x79\xde\xf5\x26\x9b\xa4" "\xff\x38\xfd\x27\x74\x49\x42\x9b\xf0\xd1\x96\x8f\xee\x36\x9b\x25\x7c" "\x44\xd0\x54\xcd\x85\xa8\xa9\xb8\x55\xaa\xb8\x44\x69\x5a\x22\xd2\x80" "\x48\x25\x68\x55\x89\x24\x27\x6e\xb4\xaa\xc2\x95\x0f\x71\x2a\x87\x0a" "\x10\x52\x7b\x41\x51\x4f\x5c\x2a\xd1\x48\x5c\x7a\x2a\x1c\x38\x10\x05" "\xa9\x12\x07\x28\x24\x46\xb1\x67\xbc\xf6\xac\xad\x67\xef\x97\xed\xf5" "\xef\x27\xcd\x8e\xe7\xcd\xb3\x67\xde\xdb\xe7\xe7\xf7\x35\x33\x01\x98" "\x58\x95\xc6\xdf\xa5\xa5\xb9\x22\x84\x6b\x6f\xbf\x7e\xf2\xef\x0f\xfe" "\x6d\xf6\xee\x94\xc7\x5a\x73\xd4\x1a\x7f\xa7\xdb\x52\xd5\x10\x42\x11" "\xd3\xd3\xd9\xe7\x7d\x30\xd5\x8c\x6f\x7f\xf8\xca\xd9\x6e\x71\x11\x16" "\x1b\x7f\x53\x3a\x3c\x75\xab\xf5\xde\x9d\x21\x84\xcb\xe1\x50\xb8\x1e" "\x6a\x61\xff\xb5\x1b\xaf\xbd\xbb\xf8\xe4\xe9\x2b\xa7\xae\x1e\x7e\xef" "\x8d\xe3\x37\x37\x66\xe9\x01\x00\x60\xb2\x7c\xf3\xfa\xf1\xa5\x7d\x7f" "\xf9\xd3\x81\x3d\x1f\xbd\x79\xff\x89\xb0\xad\x35\x3d\x1d\x9f\xd7\x62" "\x7a\x57\x3c\xee\x3f\x11\x0f\xfc\xd3\xf1\x7f\x25\x74\xa6\x8b\xb6\xd0" "\x6e\x26\x9b\x6f\x3a\x86\x4a\x36\xdf\x54\x97\xf9\xda\xcb\xa9\x66\xf3" "\x4d\xf7\x28\x7f\x26\xfb\xdc\x6a\x2b\xff\x40\xc7\x7c\xdb\x4a\xca\x9f" "\x6a\x9b\xd6\x6d\xb9\x61\x9c\xa5\xed\xb8\x16\x8a\xca\x7c\x47\xba\x52" "\x99\x9f\x6f\x9e\x93\x87\xc6\x79\xfd\x4c\x31\x7f\xf1\xfc\x85\xe7\x2e" "\x0d\xa9\xa2\xc0\xba\xfb\xe7\x03\x21\x84\x43\xc2\xa0\xa1\x5e\xaf\xff" "\xa8\xb1\x02\x47\xa0\x2e\x82\xb0\xda\x50\xdf\x3d\xec\x3d\x10\x40\x53" "\x7e\xbf\x70\x85\xcb\xf9\x95\x85\xb5\x69\x7d\xda\x74\x7f\xe5\xdf\x7a" "\xbc\xd2\xfd\xfd\xb0\x0e\x36\x7b\xfb\x57\xfe\x78\x95\xff\xab\x2b\xf6" "\x38\xac\x9f\xad\xba\x35\xa5\xe5\x4a\xdf\xa3\x5d\x31\x9d\xdf\x47\xc8" "\x9f\x5f\x1a\xf4\xfb\x9f\x3e\x2f\xbf\x1f\x51\xed\xb3\x9e\xbd\xee\x23" "\x8c\xcb\xfd\x85\x5e\xf5\x9c\xda\xe4\x7a\xac\x56\xaf\xfa\xe7\xdb\xc5" "\x56\xf5\xb5\x18\xa7\xf5\xf0\xf5\x2c\xbf\xfd\xfb\x93\xff\x4f\xc7\xe5" "\x7f\x0c\x74\xf7\xaf\x09\xbb\xfe\x7f\x68\x04\xea\xb0\xa5\x43\x75\x04" "\xea\x20\xf4\x1d\xea\xc3\xde\x01\x01\x23\x6b\xf9\xb9\xb9\xa6\x7a\x94" "\xf2\xf3\xe7\xfa\xf2\xfc\x6d\x25\xf9\xdb\x4b\xf2\x67\x4b\xf2\x77\x94" "\xe4\xef\x2c\xc9\x87\x49\xf6\xbb\x17\x7f\x12\x5e\x2d\x96\xcf\xf3\xf3" "\x73\xfa\x41\xaf\x87\xa5\xeb\x6c\xf7\xc4\xf8\xff\x06\xac\x4f\x7e\x3d" "\x72\xd0\xf2\xf3\xe7\x7e\x07\xb5\xd6\xf2\xf3\xe7\x89\x61\x94\xbd\x75" "\xe6\xe9\x73\x5f\x7e\xf6\x99\x1b\xcd\xe7\xff\x8b\xd6\xf6\x7f\x27\x6e" "\xef\x87\x62\xba\x16\xbf\x5b\xd7\xe3\x0c\xe9\x7a\x61\x7e\x5d\xbd\xf5" "\xec\x7f\xad\xb3\x9c\x4a\x8f\xf9\xee\xcd\xea\x73\xcf\x8a\xf9\xeb\xcd" "\x12\xf7\x76\xce\x57\xec\x5d\xfe\x9c\xd0\xb6\x9f\x59\x51\x8f\xb9\xce" "\xf7\xed\xee\x35\xdf\xc1\xce\xf9\x6a\xd9\x7c\xb3\x31\x6c\xcf\xea\x9b" "\x1f\x9f\xec\xc8\xde\x97\x8e\x3f\xd2\x7e\x35\xad\xaf\xe9\x6c\x79\xab" "\xd9\x72\xcc\x64\xf5\x48\xfb\x95\x3d\x31\xce\xeb\x01\xab\x91\xb6\xc7" "\x5e\xcf\xff\xa7\xed\x73\x2e\x54\x8b\xe7\xce\x5f\x38\xf7\x68\x4c\xa7" "\xed\xf4\x8f\x53\xd5\x6d\x77\xa7\x1f\x69\xff\xd0\x5f\x6f\x4e\xdd\x81" "\xb5\xe9\xb7\xfd\xcf\x5c\xe8\x6c\xff\xb3\xab\x35\xbd\x5a\x69\xdf\x2f" "\xec\x5e\x9e\x5e\xb4\xef\x17\x6a\xd9\xf4\xc5\x66\xb2\x75\x9b\x3c\x4d" "\x3f\x1a\xd3\xe9\x77\xee\xdb\x53\xb3\x8d\xe9\xf3\x67\xbf\x7b\xe1\xd9" "\xf5\x5e\x78\x98\x70\x97\x5e\x7a\xf9\x3b\x67\x2e\x5c\x38\xf7\x7d\x2f" "\xd2\x8b\x59\xab\xc5\x0b\x2f\x86\xbd\x67\x02\x36\xda\xc2\x8b\x2f\x7c" "\x6f\xe1\xd2\x4b\x2f\x3f\x72\xfe\x85\x33\xcf\x9f\x7b\xfe\xdc\xc5\xa3" "\xc7\x8e\x1d\x5d\x5c\x3c\xf6\x95\xa3\x4b\x0b\x8d\xe3\xfa\x85\xf6\xa3" "\x7b\x60\x2b\x59\xfe\xd1\x1f\x76\x4d\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x80\x7e\xfd\xe0\xd4\xc9\x1b\x7f\x7e\xe7\x4b\xef\x37\xdb\xff\x2f" "\xb7\xff\x4b\xed\xff\xd3\x93\xbf\xa9\xfd\xff\x8f\xb3\xf6\xff\x79\x3b" "\xf9\xd4\x0e\x3e\xb5\x03\xdc\xd3\x25\xbf\x31\xee\xde\x5b\x9d\xf5\x98" "\xc9\xe6\xab\xc6\xf0\xff\x59\x7d\xf7\x66\xe5\xec\xcb\xde\xf7\xb1\x18" "\xb7\xc6\xf1\x8b\xed\xff\x53\x7b\xfb\xbc\x5f\xd7\x54\x9f\xfb\xb2\xe9" "\x79\xff\xbd\x69\xbe\xac\x3b\x81\x15\xfd\xa5\xcc\x64\x7d\x90\xe4\xe3" "\x05\x7e\x32\xc6\x57\x63\xfc\xcb\x00\x43\x54\xcc\x76\x9f\x1c\xe3\xb2" "\xfe\xad\xd3\xb6\x9e\xfa\xa7\xd0\x2f\xc5\x78\x4a\xff\xb7\xb4\x35\xa4" "\x7e\x4c\x52\xfb\xef\x5e\xfd\x3a\xa5\xfd\xff\x9e\x4d\xa8\x23\xeb\x6f" "\x33\x9a\x13\x0e\x7b\x19\x81\xee\xfe\x31\xf2\xfd\x7f\xb7\x1d\x89\x0f" "\xbd\x2e\x13\x10\xac\xe7\x89\x0a\xf5\xba\x51\x3c\x80\xd1\x30\xec\xf1" "\x3f\xd3\x75\xcf\x14\x5f\xfc\xc3\x37\xb6\xdf\x0d\x69\xb6\x5b\x8f\x77" "\xee\x2f\xf3\xfe\x4b\x61\x2d\x46\x7d\xfc\x49\xe5\x6f\xad\xf1\x3f\x5b" "\xe3\xdf\xf5\xb5\xff\xeb\xd2\xbb\x7a\x47\x3f\xcf\xfd\x8f\xae\xf0\xef" "\x9f\xdd\x7c\xbf\xad\xd8\xb0\xbf\xdf\xfd\x6f\xbe\xfc\xa9\x1f\xe8\xbd" "\xe5\x65\xb6\xfb\x28\x96\x9f\x96\xff\xa1\xd0\x5f\xf9\xf5\x5f\x64\xe5" "\xe7\x37\x84\xfa\xf4\x9f\xac\xfc\x1d\x7d\x96\xbf\x62\xf9\x0f\xae\xae" "\xfc\xff\xc6\xf2\xd3\x6a\x7b\xf8\x53\xfd\x96\xdf\xac\x71\x51\xe9\xac" "\x47\x7e\xdd\x38\xdd\xff\xcb\xaf\x1b\x27\xb7\xb3\xe5\x4f\x7d\x7b\x0e" "\xbc\xfc\xab\x1c\xa8\xf1\x4e\x2c\x1f\x26\x59\xef\x71\x66\xfb\x1d\xc1" "\x76\x34\x8d\xcb\xf8\xbf\xbd\xe4\xcf\x61\x7c\x31\xa6\xd3\x8e\x30\x3d" "\xe7\x90\xff\x22\x0f\x5a\xff\xf4\x7c\x45\xfa\x1d\xd8\x97\x7d\x7e\x51" "\xf2\xfb\x36\x2e\xe3\x14\xf7\x32\xe9\xe3\xff\x7e\x35\xc6\x65\xdf\x87" "\x34\xfe\x6f\xda\x1e\x6b\x5d\xd2\x95\xb6\x74\xb5\xcb\xba\x1d\xf7\x6d" "\x05\xb6\x9a\x0f\x46\xfe\xfe\xdf\x98\x85\xcb\x23\x50\x07\x61\x44\xc3" "\xec\x08\xd4\xa1\x33\xd4\xeb\xf5\x8d\xbd\xa0\x55\x62\xa8\x85\x33\xf4" "\xf5\x3f\xec\xbb\xcf\xc3\x2e\x7f\xd8\xeb\xbf\x4c\x3e\xfe\x6f\x7e\x0c" "\x9f\x8f\xff\x5b\xc9\x4e\x20\xf2\xf1\x7f\xf3\xf7\xe7\xe3\xff\xe6\xf9" "\xf9\xf8\x7a\x79\x7e\x3e\xfe\x6f\xbe\x3e\xf3\xf1\x7f\xf3\xfc\xfb\xb2" "\xcf\xcd\xaf\x60\xcf\x95\xe4\x7f\xbc\x24\x7f\x7f\x49\xfe\x81\xe5\xfc" "\xd9\x6e\xf9\x07\x4b\xde\xff\x89\x92\xfc\xc3\x25\xf9\xf7\x97\xe4\x3f" "\x50\x92\x7f\x6f\x49\xfe\x54\x49\xfe\xa7\x4b\xf2\x3f\x53\x92\xff\x60" "\x49\xfe\xc3\x25\xf9\x9f\x2d\xc9\xdf\xea\x52\x7b\x94\x49\x5d\x7e\x98" "\x64\x79\xfb\x3c\xdf\x7f\x98\x1c\xe9\xfe\x4f\xaf\xef\xff\xde\x92\x7c" "\x60\x7c\xfd\xf4\xcd\x23\x4f\x3c\xf3\xdb\x6f\xd5\x9a\xed\xff\x67\x5a" "\xe7\x6b\xe9\x3e\xde\x89\x98\xae\xc6\x73\xe7\x1f\xc6\x74\x7e\xdf\x3b" "\xb4\xa5\xef\xe6\xbd\x13\xd3\x7f\xcd\xf2\x47\xfd\x7a\x07\x4c\x92\xbc" "\xff\x8c\xfc\xf7\xfd\xa1\x92\x7c\x60\x7c\xa5\xe7\xbc\x7c\xbf\x61\x02" "\x15\xdd\x7b\xec\xe9\xb7\xdf\xaa\x5e\xc7\xf9\x8c\x97\xcf\xc5\xf8\xf3" "\x31\xfe\x42\x8c\x1f\x89\xf1\x7c\x8c\x17\x62\x7c\x24\xc6\x8b\x9b\x54" "\x3f\x36\xc6\x13\xbf\xf9\xfd\xf1\x57\x8b\xe5\xf3\xfd\xdd\x59\x7e\xbf" "\xcf\x93\xe7\xed\x81\xf2\x7e\xa2\x8e\xf6\x59\x9f\xfc\xfa\xc0\xa0\xcf" "\xb3\xe7\xfd\xf8\x0d\x6a\xad\xe5\xaf\xb2\x39\x18\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\xc0\xd0\x54\x1a\x7f\x97\x96\xe6\x8a\x10\xae\xbd\xfd\xfa\xc9" "\xa7\x4f\x9f\x5f\xb8\x3b\xe5\xb1\xd6\x1c\xb5\xc6\xdf\xe9\xb6\x54\xb5" "\xf5\xbe\x10\x1e\x8d\xf1\x54\x8c\x7f\x1e\x5f\xdc\xfe\xf0\x95\xb3\xed" "\xf1\x9d\x18\x17\x61\x31\x14\xa1\x68\x4d\x0f\x4f\xdd\x6a\x95\xb4\x33" "\x84\x70\x39\x1c\x0a\xd7\x43\x2d\xec\xbf\x76\xe3\xb5\x77\x17\x9f\x3c" "\x7d\xe5\xd4\xd5\xc3\xef\xbd\x71\xfc\xe6\xc6\xad\x01\x00\x00\x00\xd8" "\xfa\xfe\x17\x00\x00\xff\xff\x41\x14\x18\x77", 2646)); res = -1; NONFAILING(res = syz_mount_image( /*fs=*/0x20000080, /*dir=*/0x20000040, /*flags=MS_LAZYTIME|MS_STRICTATIME|MS_RELATIME|MS_NOATIME*/ 0x3200400, /*opts=*/0x20000c00, /*chdir=*/1, /*size=*/0xa56, /*img=*/0x20001c80)); if (res != -1) r[0] = res; break; case 2: NONFAILING(memcpy((void*)0x200000c0, "./bus\000", 6)); syscall(__NR_creat, /*file=*/0x200000c0ul, /*mode=*/0ul); break; case 3: NONFAILING(memcpy((void*)0x20000380, "/dev/loop", 9)); NONFAILING(*(uint8_t*)0x20000389 = 0x30 + procid * 1); NONFAILING(*(uint8_t*)0x2000038a = 0); NONFAILING(memcpy((void*)0x20000340, "./bus\000", 6)); syscall(__NR_mount, /*src=*/0x20000380ul, /*dst=*/0x20000340ul, /*type=*/0ul, /*flags=MS_BIND*/ 0x1000ul, /*data=*/0ul); break; case 4: NONFAILING(memcpy((void*)0x200003c0, "vfat\000", 5)); NONFAILING(memcpy((void*)0x20000040, "./bus\000", 6)); NONFAILING(memcpy( (void*)0x200009c0, "\xdc\xea\x62\x0d\x0d\xa8\x5a\x72\x0a\xab\x5a\xc4\x71\x29\x64\x2c\xf6" "\x0a\xdb\x57\x86\x47\x80\x0f\x96\xde\xbd\x03\xd8\xe4\x4a\x28\x21\x09" "\xa0\xce\x4c\xd3\x89\x44\x99\x4f\xd5\x8f\x77\x0b\x5c\x98\x31\xa2\xd3" "\xc3\xbb\xeb\x76\xec\x49\x65\xc4\x85\xad\xbc\x9f\xdd\xad\xc9\x0d\x59" "\x40\xe7\xa6\x5e\x24\x00\x32\x18\xe2\xdb\x22\x83\x98\x94\x3b\x4a\x09" "\xa4\x33\x08\x5c\x23\x61\x90\x78\x27\xcf\x00\xdf\xd6\x15\x98\x83\xbf" "\xaa\xc8\x20\xe7\x39\x81\x11\xec\x62\x9f\x8a\xb2\x96\x5b\xec\x42\x8d" "\x57\x4e\x69\x4f\xe6\x19\x44\x62\x01\xd6\x55\x8d\x2a\x34\x45\x05\x6e" "\x69\xef\x11\x8f\xbb\xe0\x19\xe0\x99\x21\x5d\xbb\x9b\x94\x19\x90\x0c" "\x07\x85\x97\xdc\x71\x59\xd3\xb3\x9d\x27\x16\xbf\x4d\x21\x24\xd1\x3d" "\xc4\x95\xd7\xee\xf1\xf9\x2c\x69\xd4\x3c\xba\x06\x8a\xa4\x68\x89\xc6" "\xac\x8e\x64\x39\x43\x75\xea\x5e\xd3\x60\x85\x82\x26\xc3\xb1\x51\x2b" "\x6f\x6b\xbb\x7e\x80\xb0\x68\x8b\x83\x45\xc2\xfc\x4f\x3f\x30\x88\xb1" "\xc5\xdc\x80\x7e\x7b\x29\xf1\xdb\x48\x56\x44\x9a\xca\xc6\x0c\x38\xbc" "\x94\xbd\x69\x32\x4a\xcb\x1b\x3d\xb8\x35\xa9\x1a\x97\xbb\x6a\xa3\x0b" "\x44\xc3\x51\xa6\x5e\x23\x92\xa5\x62\x9c\x16\x44\xc1\x43\x57\x87\x29" "\x01\xed\xe1\x7b\x77\x05\x55\x5f\x6f\x18\x63\xcd\x11\x59\x02\xbc\x01" "\x80\xc9\x53\xca\xaa\xa2\xab\xe2\x76\x59\x6b\xcc\xe4\x6a\xf3\xca\xf5" "\x39\x35\x39\x8d\x41\x68\x99\x62\x85\xb7\x71\x90\xf7\x29\x80\x07\x7a" "\x53\xf5\xe0\x75\xaf\xff\xa6\xcd\x9c\x2d\xe4\x1d\xbc\x88\x0f\x00\x9c" "\x4e\x0b\x75\x66\x26\xec\x13\x90\xad\x87\x93\xdd\xcd\x7e\x2d\x9e\x96" "\x80\x87\xb3\x82\x36\xc1\x4d\x39\x98\xb8\x1a\x90\x29\x7b\xcf\xad\x26" "\xea\x86\x15\xaa\x76\x0b\x46\xed\x92\xde\xa1\xa3\x01\x7d\x84\x7f\x80" "\x16\x5c\x54\x9a\x1b\xbc\xb7\xbd\x2d\x6e\x30\xf1\x13\x3d\xda\xee\xb9" "\x02\xb2\x82\xc8\x62\x98\x1c\x51\xfd\x21\x68\xd9\xbb\x58\xac\x7c\xad" "\x10", 426)); NONFAILING(*(uint32_t*)0x20000b6a = -1); NONFAILING(*(uint64_t*)0x20000b6e = -1); NONFAILING(memcpy( (void*)0x20000b76, "\x6b\x85\x42\xda\x47\x10\x92\x66\xa2\xae\x2b\x12\x8e\xf2\xc5\xa5\x9a" "\x58\xbe\x60\x3c\xa2\x3d\x10\x2f\xfc\x87\x17\xee\x3b\xad\x90\x9d\x8f" "\x87\x6d\x55\x59\xc6\x22\xe5\xd8\xfe\x40\x52\xf5\x15\x5d\x3b\x33\x50" "\x17\x96\xf5\x16\x54\x4e\xee\x24\x4f\xad\xfe\xf7\xed\xdc\x3d\x28\x59" "\x7b\xf1\xce\x76\xb4\x46\x8f\x59\x8a\x12\x60\xee\x1a\x80\xa1\xf7\x12" "\x55\x52\x38\x6b\x6e\x4d\x25\x41\xfe\xe2\xc0\xca\x58\xc4\x51\xd4\xd2" "\x96\xd9\x7b\xac\x48\x2d\xc2\x4a\x1b\xfd\x43\x19\x8f\x90\xa4\xc0\xe6" "\xd9\xc6\x6c\x10\xca\x35\x47\x9a\x17\xfe\xc3\xd6\x37\xb0\xca\x1d\x3a" "\x64\xe4\x13\xf4\x09\x83\x43\xac\x04\x6e\x2b\xd4\x91\x0d\xae\xef\x27" "\xf1\x13\x68\xe4\x94\xba\x31\x97\x9f\x91\xba\xaa\x4b\x19\xad\x41\xbb" "\x34\x15\x6a\x57\x6f\x9c\xc1\x4a\x3e\xe8\x98\x4b\xf6\x6f\x56\xbb\x67" "\xc3\x17\x9c\xb7\x06\x85\xcd\xdc\xe5\x46\xcb\x3d\xd3\x4b\x61\x21\x7b" "\xdf\x8e\x3e\xa8\xf7\xbe\x1a\x54\x6c\xe5\x30\xd3\x0f\x87\x80\x15\xb6" "\xc1\xb0\xb0\x6b\xf0\x84\xf1\x26\xc2\x3e\x0c\x3d\x72\x92\xd6\x0d\xdd" "\x43\x51\xbc\xb5\x01\x04\xdf\x55\x7d\x52\xee\x02\x30\xb8\x9f\x4b\x3d" "\x7b\x68\xa6\x56\xc3\x78\x7e\xd4\xad\x70\xa4\xc9\xec\xf0\xf5\x40\xdf" "\x09\xc3\x34\x83\x9a\x7b\x58\xa0\x2d\x8d\x7e\x2b\x44\x43\xc5\x51\x6b" "\xd6\xf2\x5e\xc1\x6b\xc5\xf3\x4e\x3b\x12\x42\x70\x76\x59\x0b\x99\x7f" "\x16\xa6\x79\x6e\xcf\x84\x78\x6a\x32\x47\xd0\x66\x26\x82\x00\x63\xa5" "\xfa\x5e\x78\x62\xcc\xa4\x0b\x8c\x8a\x28\x10\x9f\x77\xe6\xf7\x15\x2f" "\xa4\x7c\x53\xcd\x52\x9f\xa9\x9d\x66\x32\x6c\xd3\xf9\xc6\xdb\x65\x69" "\x3b\xb9\x7e\x2e\x76\x49\xa5\xab\x88\x7f\xf1\x57\xa8\x15\xc8\x2a\xb8" "\x1d\xbf\xfb\x84\x4c\x17\x79\x96\xd3\x60\x96\x92\xef\x1f\x07\xb0\x1d" "\x7f\x0a\x68\x3f\xd3\x86\x21\xbd\x87\x60\x64\x87\x5c\xe4\x6c\x6a\xfa" "\xe8\x2e\xf2\x6d\x35\xf0\x29\xa1\xd1\x04\xa0\x44\xb6\x6c\x30\x32\x87" "\xbc\x2d\x76\x72\x88\xc7\xc3\x8e\xbb\x01\x21\x32\xd2\x1b\x19\x8c\x17" "\xd1\xcc\x98\x2a\x02\x37\xbd\xa9\x84\xc0\xf9\x85\xae\x95\xf9\x08\x52" "\xc3\xaf\x59\x2a\x0e\x54\xee\x1d\xc2\xff\x8a\x2d\x3f\xc5\xa0\xee\x4b" "\xb0\x24\x93\xad\x12\xe6\xcf\xa9\x10\x4d\xff\x10\x6c\x31\xe4\x3c\xb0" "\x4b\xda\x40\xbc\x72\x76\x1c\xce\x97\x1c\x12\xbf\xdb\x9a\xa9\x95\x5b" "\xfe\x67\x22\xf9\x7a\x97\xdb\xcd\x46\x76\x7f\x58\xd6\x6d\x72\xa6\xd5" "\xe2\xe4\xf2\x6c\x03\x52\xdd\xb7\x17\x22\x5b\x02\x9c\x4c\x75\x78\x66" "\xa3\xba\x15\x60\xf3\x06\x37\xd6\x20\xde\xf5\x09\xaf\x89\x05\xc2\xa1" "\xaa\x07\x7b\x10\x86\x48\x45\x71\xc9\x64\x03\x1d\xb8\xcd\x9e\xa5\x63" "\x45\x22\xde\x35\x02\x8d\xed\xab\xb4\xfd\x63\x0e\x1f\x5b\x2b\x1a\xfb" "\x61\x65\x02\x8c\xf5\xe1\xf0\x5f\xd7\x73\x95\x91\x0a\xfc\x29\xd1\x5c" "\x3f\x36\xe2\xf5\x7c\x7d\xb2\x37\x90\x2c\xd7\x07\x2c\xb7\x27\x17\x07" "\xa7\x4c\xe9\x7b\xb6\x8e\x38\xe0\x59\x19\x1c\x81\xdf\x15\x6a\x21\xf0" "\xda\x02\x97\xfa\xc4\x9f\x0d\x8f\xf4\x0f\x93\xe6\xaa\x85\x14\x1e\x04" "\x6b\x6d\x2e\xb8\xec\xd1\x7d\x0f\x9a\xc4\x88\xbd\x03\x4d\xb3\xe2\x1f" "\x41\x77\x87\x7c\x7f\x96\xdf\x44\x22\x73\xfc\xb3\x99\x09\xa5\x9c\xa0" "\xd5\xe1\x6e\x75\x54\x49\x92\x1b\x53\x0c\xd5\xf4\xc8\xac\x96\xc6\xd5" "\x44\x94\x17\xb4\x27\x45\x51\x4c\x39\x29\x80\xe0\x5e\x74\x02\x09\xd3" "\x88\x0a\x4a\x71\x29\xd2\x2b\x26\xcd\x8c\x1c\xc4\x91\x24\xd9\x95\xf8" "\xcf\xf3\xd1\x97\x1b\x3e\xba\x61\xb7\xbf\x3c\x27\x02\x7f\x9a\xc9\xd0" "\x6b\x7d\x71\xe0\x4e\x2d\x20\x68\xe7\x44\x5d\xce\xf3\xf1\x05\x00\x04" "\xf7\xbf\xb2\x61\xe2\x13\xe2\xd1\x3d\x9d\x31\xe7\x1c\xed\x0a\x2a\xac" "\x5b\xaf\xc0\xd8\xb2\xce\x90\xb0\x02\x78\x44\xd7\xe1\x2a\x8a\x1e\x6f" "\x24\xbd\x0f\x81\x46\x23\xd9\x46\x5e\xa1\xf3\xac\xcb\x5f\x3a\x70\xb3" "\x25\x9c\x2d\x3e\x4f\x92\x85\xb8\x04\x9f\x72\xe0\x61\x0a\x89\x54\xa7" "\x68\x25\x77\x5b\x88\xf1\x8f\x1e\x63\x54\x48\xa0\x89\x88\x01\x82\xdd" "\x73\xe0\x39\xaf\xfc\x99\xaa\xdc\x4f\xcd\xb3\x75\x9b\xcd\x31\xad\x6c" "\xd7\x98\xd6\x0f\x83\xfb\xa8\xf6\x7a\x56\x7d\x42\xde\x1f\x16\xe8\x83" "\xcd\x9a\x9a\x24\x8d\xf9\xfe\xae\x3a\x64\xb2\x9c\x98\x85\x8f\xd8\xf1" "\x75\x53\x6d\xc9\x42\x95\x06\x34\x11\xf4\x73\x39\xe1\x09\xfe\x77\xea" "\xa8\x77\xfa\xb9\xe0\xfd\x71\xf4\xf6\x91\xd9\xb8\x61\x80\xa1\x81\x35" "\xbe\xea\x15\xee\xaf\xec\x69\xd8\x0b\xfe\xd9\x65\xee\x53\x88\xd4\x12" "\xea\x7a\x8c\xf7\xf5\x45\xa0\x3a\x31\x1b\x37\x8d\x11\x87\xa7\x1b\x13" "\xec\xbe\x2a\xea\x15\xbd\xd8\x40\x6c\x41\xd9\x9d\x60\x68\xdd\x42\xdd" "\x59\xa9\xc8\xd1\xd1\x8d\x59\x88\x0b\x39\xf7\x16\xad\xbf\x16\x47\xca" "\xe8\xf8\x95\xa3\x9c\xbc\x82\x71\xce\xe7\xf2\xc4\xe3\x2f\xf6\x0c\x52" "\x98\x2e\x0c\x2c\xe1\x6f\x5f\xf2\x83\x01\xd0\x75\x9f\xc0\x8a\x2f\x02" "\x3c\xb5\x68\x36\x21\xdb\x98\x91\x67\x36\xa6\x84\xaa\xcc\x47\x34\x38" "\x01\x4a\xcc\x83\xd7\x3c\xfb\xcf\x76\xa3\x67\x90\x87\x06\xbd\x38\x31" "\x56\xf4\x67\x1f\xce\x46\x33\x45\x78\x43\xdd\xa4\xf7\xa5\xa0\xf6\xe3" "\x29\x42\x6a\xc4\x5a\x61\x52\x61\x52\xad\x35\xcd\xde\xc8\x2d\x83\xcf" "\x3e\x43\xf3\xbe\xd2\x08\x49\x65\x8c\xd6\xfa\x1e\x82\x6e\x7a\x6e\x85" "\x30\x50\x97\x50\xd2\x58\x9b\x46\x29\xc5\x45\x19\x18\x55\xe3\x92\xa0" "\x72\x0e\x6e\xf7\xed\x79\x05\x58\x7f\x7f\x18\x1e\xed\xe5\x9a\x26\x6f" "\xcb\x12\x0c\x64\x89\x91\x16\xb7\x7b\xd8\x0a\x15\xe2\xbb\x63\xc5\xdb" "\x7f\x63\xfe\x21\xc7\xa5\xa3\x26\x90\x3d\x0e\x6e\x9b\x46\x0b\x8a\x6d" "\xcb\x99\xd7\xd2\x2c\x76\x8e\x7b\xf1\x1f\x63\x35\xf8\x97\x63\x97\xfd" "\xb3\x70\x21\xa5\x1a\x87\xf4\x96\x8f\x32\x15\xe1\x0c\x3b\x3c\x03\x8b" "\xa0\x22\x5a\xe5\x10\x11\xc7\x7f\x50\x9c\x3d\x28\x68\x14\x1f\xa1\xdf" "\xb2\xfa\x4e\x1f\xfa\xa9\xa3\x82\xc5\x81\x5f\xde\x09\xcd\x97\x95\x2f" "\xaf\xd6\xb9\x62\x96\x5a\x4b\x5d\xd5\xbe\x1c\x16\x58\x24\x47\x92\xc6" "\x60\xc8\x3d\xb8\x16\x98\x6f\x1b\x7b\x73\x84\x92\x99\xc5\x9d\x6c\x60" "\x9b\x2a\x4a\x5f\x39\xb6\x64\x28\x9e\x1a\xc7\xa6\xba\x33\xd7\x3e\x56" "\x47\x8d\x02\xa2\x60\xa2\xbc\xf7\x05\x6a\x40\x79\x0c\xb5\x16\xb8\x5e" "\x0b\x2d\x70\x99\x10\xf3\x01\x8d\xf4\x50\x38\x5f\x5f\x7b\xd7\x55\x53" "\x6f\x11\x56\x1f\xdf\x0b\x6e\x36\xc5\x12\x0d\xad\x0f\x75\x16\x80\x45" "\x10\x4a\xaa\x52\x08\xb8\x30\x46\x52\x57\xae\x3a\xc5\x9e\x7a\x8e\x65" "\xe2\x21\x15\x30\x5b\x03\xef\x65\x53\x96\x00\xa7\x79\x32\x2e\x52\x21" "\x53\xc0\x01\x9a\xc9\x16\x30\x7c\x71\xb4\xe4\xb5\x3e\xd6\x64\x64\xd9" "\xc3\x4b\x55\xcd\x98\xe1\x26\xd0\xb7\xb9\xf0\xcb\x44\x89\x13\xd8\x75" "\x01\x51\xcb\x11\x03\xfb\x71\x77\xc1\x05\x2d\xb1\x7d\x07\x33\xbf\x4d" "\xcc\x0e\x82\x62\x76\x10\x46\x2d\xae\x91\xbf\xec\xe1\x7b\x7f\xba\x87" "\x06\x76\x76\x26\x9f\xe0\xeb\x2a\x49\x22\xcc\xcf\x0d\x90\x6e\x72\x1a" "\xf8\x5c\x66\x9c\xfb\x98\xc9\xd3\xb5\xa5\x1b\x99\xae\xa7\xd6\x61\x91" "\x84\x9f\xd0\x94\x4a\xc2\xad\x5f\x05\xdf\x74\x2f\x9e\xbb\x81\xe9\xe4" "\x75\xb9\x2e\x60\x13\x6d\xe2\x85\x8b\xc4\xf8\x4a\x87\x81\xc7\x51\x76" "\x2c\x20\xcb\xaf\xf4\x70\x12\xac\xde\x77\x40\x51\xd4\x43\x39\x35\x42" "\xb3\xca\xa0\x49\xb6\xf0\xfe\x5e\x6f\x03\x48\x96\x7c\x13\x51\x94\x61" "\xa6\x3c\x64\x7b\x7a\x71\x43\x75\xb0\x46\x35\xdb\x93\x78\x5e\xc2\x54" "\x13\x20\xcd\x6e\xe4\x3a\x40\x1c\x5f\xe3\xac\x1e\xd2\xb6\x7d\xe7\x8a" "\xeb\x64\xb5\x7b\xd3\x07\x0a\xae\x4d\x0a\x97\x03\x48\x58\x11\x7b\xf2" "\x10\xf1\x83\x24\x07\xd1\xcf\x51\x65\xbb\x1e\x5f\x46\x3e\x81\x43\x62" "\xb4\x6f\x3d\x2e\x53\xd9\x2e\xd0\x07\xdc\x87\xb0\x76\x7a\x07\xb1\xb0" "\x41\x7b\xb2\x7d\x67\x01\x88\x9a\x31\x9a\xcb\x39\xa9\xc3\xff\xb2\x29" "\x5d\x4f\x90\x78\x3e\x31\xa7\xb7\x83\x2f\xec\x15\x0c\x33\x3e\x84\x33" "\x1f\xf7\x91\xce\x11\x76\x85\x1e\x75\x58\xb0\xd4\xf5\x86\xf4\xd7\x33" "\xd7\x54\xb3\x1e\xbf\x39\xc8\x50\x40\xee\x88\xfc\xef\xc1\xfb\xf1\x91" "\x56\x15\x74\x0e\x38\x70\x2e\xc9\x9b\x29\x00\x45\x1c\x32\x13\xd0\x8d" "\xe0\xa2\xbd\x9f\xec\xe5\xf9\x04\x7f\x2c\xb4\x6c\x41\x1c\xff\x66\x60" "\x94\xfd\xb4\xe6\x1c\x14\xb7\xb7\xb8\x50\xcc\x8a\x64\xc1\xb4\x3a\xea" "\x22\x9b\x56\x4c\x6d\x54\xd8\x90\x1b\x69\xa5\x50\xae\x01\xba\xa2\xb0" "\x89\x19\xe0\xbe\x9d\x21\xdb\x7d\xcb\x97\x4e\x66\x15\x20\x58\x99\x7d" "\xec\xba\x9c\xbc\xcf\x57\xa6\x0a\x44\x41\x0e\x3e\x05\x44\x65\xdf\x50" "\xc9\xa8\x60\x30\x7b\xcc\xd1\x0b\x99\xab\x07\xd3\x37\x9f\x6d\x37\xa5" "\x73\x6e\xbc\xb5\x17\xb7\x99\xac\x89\xcf\xe8\x15\x8d\x8d\xc7\x7d\xbd" "\xfd\xb7\xa3\x93\xef\x44\x18\x4a\xea\xf7\x79\xdb\xcd\xa9\x6f\xe0\x7e" "\xe4\x37\xc2\x8b\x3a\xef\x1d\x62\xd3\x95\x9d\x5e\x63\x11\x96\xc9\x92" "\x8b\x80\x0d\xff\x98\x8b\x63\x68\x16\x02\x28\x7f\xfb\x71\x89\xe0\x7d" "\x18\x19\x97\xdc\x48\x1b\x80\xe8\x04\xdf\x1b\xdd\xf8\x03\x7c\xaa\x11" "\x53\xfd\x72\xb7\xe7\xa8\x7b\x95\x4f\x47\x53\x29\x44\xd7\x33\x99\xc2" "\x1d\x5f\xdd\x84\xc8\x77\x91\x07\x32\x5a\x84\x40\x84\x1e\x89\x5d\x63" "\x3e\x8d\x2d\x56\xe0\x1e\x24\x94\x93\x8c\xd9\xf5\xe4\x3f\x31\x46\xe0" "\xec\x07\x9a\x06\x75\x6d\x73\x8e\xee\xbb\x7d\xee\xdf\x10\xd6\x2c\x4d" "\x95\x46\x7b\xc8\xa4\x39\x18\xa8\xfc\xca\x7c\x21\x99\xdc\x34\xad\x9a" "\xa4\x10\x1f\x2e\x54\xd1\x9b\x38\xdb\xe4\x91\x8d\x30\x8d\x72\xcd\xfe" "\x41\xba\xce\x6c\x9f\x0c\xdf\xfb\x41\xcc\x29\x41\x8c\xb6\x8c\xc5\x3e" "\xe6\x93\x12\x18\x51\x9a\x05\x56\x97\x4e\x28\xf3\x1c\xbd\x83\x1c\x18" "\xc1\xd0\x46\x8e\x50\x5c\x0e\xbd\xf9\x4a\x51\xd6\x6d\x8c\x97\x7f\x39" "\x5e\xd8\xe5\xe6\xde\x9b\x27\xb3\x9b\xb3\xb4\x29\x37\x61\xab\x01\xda" "\xe8\x93\x7b\x16\xd6\x97\x65\x80\xb2\x70\x0d\x98\x57\xd7\x70\x02\x81" "\x67\x21\xcd\xc1\x95\x8c\xe6\x38\x67\x0a\xb9\xcc\x8a\x47\xbb\x27\x91" "\x2a\xe0\x3c\x2f\x58\xe8\x8e\xa0\xcb\xb2\x48\xef\x07\xee\x75\x1f\xd4" "\xee\xf7\xe3\xa0\x03\x7a\x41\xf2\xa5\x0d\xca\xdf\x11\x2e\xb2\xdf\x7f" "\x82\x89\xde\x7c\x03\xe0\x21\xe0\x7b\x68\x97\x89\x25\x37\xd6\x04\x5b" "\xee\x5c\x8e\x48\x22\x7d\xf6\x13\x61\x62\xa1\x6f\xf1\x18\xd1\xeb\x8e" "\x4c\x93\x1a\xd2\x9b\x93\xc6\x4d\x4b\xcd\x2f\xdd\x15\xa9\x8d\xaf\x6c" "\xc9\x27\x0d\x2b\x8e\x5f\x7a\xda\x5f\x43\xd6\x77\x50\x76\xa2\xad\x64" "\x35\x0d\xdf\x93\x12\xff\x7e\x6a\xd3\x14\xd0\x3b\xaa\x54\x7c\x5f\x9a" "\xba\x1a\xd7\xa1\xe3\xfc\x1d\xe9\x08\xf6\x6c\x2e\x2f\x5b\xc2\x54\x93" "\x4f\x1d\xe0\xac\x63\x6f\x72\xc1\x6c\xfb\x7c\xa6\x7f\xe8\x6d\xac\xec" "\xcb\x4b\xc7\xa2\x5d\x40\xe6\xa8\x6c\x19\x69\xc4\xad\x28\x1e\x40\xde" "\x74\xc7\xd8\x43\xc4\x50\xe0\xd5\x82\x35\xa4\x5d\x18\xe0\x69\xaa\x84" "\x77\xae\xe4\x53\x07\xda\x97\xf5\x18\x92\x3f\xba\x49\x32\x32\x92\x55" "\x89\xf0\x99\xe2\xb8\x50\xa2\x2a\xf0\x0c\x1b\xde\xb6\x0f\x49\x37\x6c" "\x1f\x57\xdc\x64\x13\x93\x08\x68\xd0\x9a\x19\x14\xbd\x35\x15\x91\x1d" "\xee\x9f\x4a\x34\x67\xa2\x21\xca\x41\x66\xaa\xf7\xba\xf2\x2d\xbc\x70" "\xd6\x40\xb1\xe9\x2a\x3a\xdc\x95\x39\x22\xad\x6a\x56\xa4\x27\x79\xc5" "\xb2\x06\x5e\x07\xc6\xa7\x4e\xa4\xc1\x24\x4c\xc6\xdc\xc2\x8b\x31\xee" "\x2c\x94\x02\x28\xe2\x11\xb8\x47\x36\x0a\xec\x1b\xa8\xba\x8e\xe3\x5b" "\x4b\x54\x94\x78\x28\x0a\xb3\x59\x80\xe9\xa0\x3c\xfd\x93\xf4\x8b\x1c" "\x12\x88\x08\x18\x17\x0a\x92\x84\xa0\x28\xe0\x5f\x6c\xa8\xbc\x65\xda" "\xd2\x64\xde\x04\xc9\x15\x6f\x93\xf7\xbb\xad\xae\xc2\x4c\x6c\x19\xe9" "\x5c\xe7\x8a\xe1\xc0\x2b\xbd\xde\xeb\xf6\x0d\x68\x02\xd0\x83\xa1\x46" "\xef\x99\x75\xf6\x95\x3b\x7e\x7a\xdb\x5c\xf5\x4d\x54\xc3\xec\x58\xa7" "\xb6\x3b\x02\xdb\x81\xfe\xda\x15\xed\x85\xa0\x7e\x81\x2d\xcd\x7a\x3b" "\x3b\xca\xb2\x30\xf4\xb6\x99\xb7\x99\x9f\x94\x3f\xc3\xde\xc6\xf1\x74" "\x63\x5c\x52\xfa\xfd\xe2\x80\x6b\xc6\xf5\x77\xcc\x02\x3b\x55\x75\x21" "\xfd\x98\x5c\x6b\xd0\x9d\x46\xc5\x14\xb4\x7b\x85\x49\x1f\x7b\x70\x20" "\xf2\xea\x3d\xd2\x0e\x85\xc8\x77\x06\xee\xbf\x8d\x4f\x8f\xad\xfa\x36" "\x8e\xa1\x98\x95\xad\x34\x72\x3b\x07\x24\xb9\xb5\x82\xc7\x2f\x78\x8b" "\x3d\xbb\x90\xb7\x49\xa4\x21\x39\xf6\x43\x67\x17\x56\x77\x03\x81\x31" "\x2a\xce\x9b\x8b\x00\x90\xe3\xae\x80\xce\x2c\xe8\xdd\x4e\x05\x46\x0d" "\x0a\xdb\x96\x49\x37\x53\x2d\xf9\x52\xbd\x3f\xc6\x2b\x26\xeb\xb6\xc9" "\x22\xc0\xc4\x57\x52\x17\x7d\xbb\x30\x58\xa3\x85\x24\xb4\xa7\x71\x10" "\x8a\x53\x48\x9d\xdb\x96\x3a\xf0\xa8\xe2\x0c\xc7\x03\x3b\x35\xa5\xb9" "\xf2\xb1\xd4\x47\xe8\x35\xa2\x0b\x30\xf0\xeb\x21\xa4\x1e\x61\xb5\x20" "\xa8\xf9\xc0\x70\x22\xd0\xd7\x1d\xcc\x5b\x50\x71\x89\x4d\xe5\xeb\xbd" "\xc2\x60\x05\xa9\xb7\x12\x04\x76\x82\x6c\xdb\x82\x9c\xb9\x30\x0d\x1c" "\x64\x9e\xd9\x30\xee\x8b\x0a\xcf\x0c\x9d\xd5\x8c\xea\x8c\xaf\x00\xa4" "\x26\x11\x79\xf0\x5f\x2d\xc4\xa4\xb2\xb1\x61\x50\x3b\xb0\x52\x34\x7b" "\x25\xad\x4e\x64\x3e\x22\x6e\xcb\x2e\xbf\x70\x2f\xca\x15\x48\x9f\x16" "\xcf\x01\x18\xfe\xfd\x24\x94\xae\x60\x26\x4f\x01\x09\xeb\xeb\xf2\x80" "\xd3\xde\x37\xb2\x3e\xd3\x59\xd0\xe2\x68\xa3\xdb\x01\x10\x1b\xe8\x88" "\x21\x7b\x03\x2f\x80\xa0\xd8\xf1\x19\x91\x13\x16\x40\x64\xf7\x1d\x53" "\x1d\x0f\xd4\x45\xc9\x7a\xb3\xf8\xd2\xc9\x43\x52\xdc\x6d\x6f\x5a\x5d" "\xa6\x01\x63\x05\x91\x2a\xda\xf1\x24\x74\xd0\xa6\x81\xce\x8f\xd2\xd6" "\xcb\x24\x63\xfc\xd1\xb2\x69\xce\x61\x14\x83\x46\x8c\x1d\x50\x47\x45" "\x82\x0b\xa3\x1e\xc0\xa4\xee\xfc\x8e\xea\x79\xb1\x5f\x8c\x32\x58\x4d" "\xe8\xa2\xd1\xae\xdc\x77\x0d\x76\x2b\x84\x4f\x94\x4f\x1c\xc0\xcd\x6e" "\x1a\xc4\xeb\xb5\x63\x6e\xf6\x34\xca\x7a\x90\x0f\xa5\x7c\x90\x0c\x84" "\xa3\x92\xbc\x18\x38\xf4\xab\xf7\x25\xbd\x73\x2a\xb5\xa3\x85\x69\x0c" "\x5c\x14\x7b\x16\xad\x93\x2c\x5d\xfe\x5e\xac\x5b\xf7\xe4\xcf\x4a\xdf" "\x5a\x85\x8e\xf9\x92\xd0\x3b\x2e\xc1\xf4\xd5\x15\x24\x90\xab\xed\xb1" "\x64\x10\x04\xc6\xcd\x03\xd9\xe0\x38\x0d\x9e\xc9\xae\x31\xbc\x58\xef" "\x2d\x1d\xe5\x10\x3a\xdb\xa6\xb3\x89\x9b\x80\x30\xd8\x3f\x20\x28\x28" "\xae\xda\x6a\xf9\xda\xff\x69\xc1\x38\xa6\x3d\x7d\x63\xc3\xb9\x6a\x4c" "\x86\xb8\x32\xee\x8c\x1f\x81\xdb\x74\xea\x24\x4b\x02\x2f\xf3\x4d\x69" "\x2b\x3e\x95\x10\xba\xab\xd2\x57\xfa\xcd\x3f\x39\x5d\xf0\x75\xcd\xb2" "\xac\x91\xbc\x22\xa8\x4b\x3c\x5c\xa1\x65\x09\xe9\xcb\x9b\x85\x12\x7e" "\xc3\x9f\xf5\xdf\x8c\x75\xed\x2c\xb4\x06\xea\xbb\xcc\x7b\x66\xd3\x9e" "\x52\xf8\x25\xc1\xcb\x69\xf9\x34\x26\xa0\x44\x7e\x8e\xa7\x20\xa0\x4e" "\x14\x3f\xb9\xfc\xa5\x25\x69\x9e\xcf\xea\x66\x45\x09\xdd\x21\x89\xcf" "\xb8\x4c\x8f\x29\xf2\x48\x7f\x6c\x09\xb7\x8a\xa5\x43\x25\x79\xbc\x17" "\xe3\xc8\xd1\xb8\xd2\x3c\x2a\x37\x1c\x0a\x5a\x99\xa3\x4a\xc9\x05\x66" "\xd2\xb0\x1a\xd7\x9d\x9b\x04\x5c\x05\xd8\x7f\x86\x23\xf1\xb5\x55\x7b" "\xa3\x8c\xff\xf2\xd9\x1d\x23\x79\xfb\xfa\xf2\x1c\x4d\x60\x0d\x48\x55" "\x29\xc5\xcc\xb2\x5c\xa0\x0c\x01\x6f\x28\x3e\xa5\x54\x84\x3f\x10\x6a" "\x9d\x40\xc2\xfc\xe4\xd9\x7b\x0a\xab\x03\xa4\xba\x66\xd3\x7b\x18\x82" "\x32\x87\x7e\xe1\xb7\xd2\x96\x66\x54\xad\xaa\x9e\x37\xe5\x54\x02\x40" "\xc9\xe2\xcb\x35\x1f\x71\x89\xfd\x95\xe0\x7e\xae\x53\x01\x79\x59\x34" "\x85\x68\x0d\x8d\xf2\x47\xa3\xaa\xee\xbe\x40\x3a\x23\x89\x13\x67\x11" "\x5d\x51\xe5\x9b\xea\xc5\x21\x0e\xe0\x99\x5b\x5d\x25\x5c\x83\x2a\x8d" "\x1c\x5d\xd6\xfe\x4a\xdd\x90\x0b\x28\x59\xd5\xe2\x0d\x63\x34\x9c\x04" "\x7b\x30\xb4\x17\x7c\x95\x2d\x6f\x10\x2b\xda\x5b\x9e\xfc\xca\xa5\xbc" "\x3d\xb6\x60\xc9\xc0\x7e\xd8\x27\xe8\x51\x66\xae\x10\xdd\x14\x76\x71" "\xac\x87\x44\xa7\x90\xed\xc6\x29\xdd\x07\x3a\x65\xe1\x7a\xc9\xcb\x11" "\xc1\xc0\xc3\x54\x80\x3b\x99\xc3\x4a\x6e\x3f\x5a\x4d\x90\xbf\x1e\x9d" "\x73\xa9\xee\x1a\x23\xf4\x26\x72\x89\xbb\xdc\xe6\x18\xe8\x14\xd4\xc8" "\xa3\x12\x1d\x72\x92\x96\x24\x81\x7c\x25\xa0\x12\xc6\xbe\x28\xa9\x3c" "\xb8\xbc\xb9\xeb\x4a\xe6\x52\x6a\x9b\x13\x28\xae\xb7\xb3\x1e\x0f\xce" "\xe1\x86\xa9\xec\xa1\xe0\xed\xe1\xc9\x75\x32\xdd\x2c\x25\x55\xba\xe6" "\xa5\x7e\x7d\x23\x67\xaa\xc3\xa4\x48\x8b\xcc\xc8\xe7\x71\xc3\x0a\x19" "\x07\x92\x93\x2d\xc7\xe0\xe6\x99\x1f\xc0\x6f\x84\x27\x60\x28\x5d\xd1" "\x0f\x8b\x3c\x51\xe6\x5d\x8a\xdb\x97\xde\x5c\xf2\xa2\x09\xa5\x2a\xf4" "\xf9\x3f\xfe\xa9\x66\x06\x66\xe5\x83\x15\x7a\x19\xb8\xfc\xd0\x0a\x65" "\xae\xc0\x16\x96\xaf\xaf\x81\x2e\x7a\x25\xec\x03\x52\xe6\xbd\x92\x92" "\x29\x30\x5f\x32\x4b\x66\x71\x58\x4d\x73\x28\x4c\x96\x37\x04\x2a\x15" "\xa4\x8a\xaf\xe4\xf9\x96\x21\x19\xf2\xaf\xe4\x3b\xb8\xab\xeb\x7d\xbd" "\x5e\x58\x8b\x98\xf3\x1f\xf3\xb5\x9c\xd4\x47\x87\x47\x1e\x68\xfa\x6a" "\x08\x55\x11\xed\x25\x1a\x5f\xdc\xa0\xcd\x84\xc9\x89\xbb\xe2\xda\xe0" "\x97\xe4\x69\xe9\x64\x41\xaf\xb0\x66\x09\x79\x8e\x5d\xea\x48\x0e\x50" "\x71\x15\x49\x7c\x4e\xce\x6b\x29\xec\x97\x72\x86\xeb\x99\xac\xb8\x58" "\x31\x43\x9c\x38\x3f\xa5\x87\x9b\xf2\x3d\xbb\xa9\x86\x8c\x25\xcf\xd9" "\x48\x46\x00\xe9\xe7\x62\x2d\x84\x63\xfe\x88\x8f\x92\xaa\xa4\x37\x7d" "\x13\xdf\x6f\xbe\xd7\x9c\x80\xef\x1c\x01\x37\x1f\xd5\x66\xb4\x07\x36" "\xb2\xa5\xe8\x6e\xf1\x34\xa2\x1f\xe5\x02\xe6\xc6\x00\xaf\xd9\xe0\xda" "\x38\xda\xbb\xcf\x8d\xe5\x5f\x7c\x88\xe9\x16\x81\xf1\x6c\xde\x51\x5f" "\x0c\x0e\x1c\x4d\x0d\xcd\xef\xcd\x82\x69\x15\x9c\x81\x34\x01\xed\xfd" "\x62\x87\xfe\x9d\xe5\x51\x85\x29\xbe\x99\x7c\x86\x68\xf0\x31\xe0\x30" "\x0d\x39\xc2\x58\x5b\x41\xf7\x2e\x25\x60\xe3\xc3\xc5\x53\x23\x7d\xc8" "\x90\xfd\x9c\x04\x82\xe5\x8d\x8a\xd7\x38\x6a\xf5\xbc\x45\xfb\xc3\xe3" "\x83\xd2\x39\x12\x90\xa2\xcb\xce\x8e\x87\x6e\x42\x2d\x17\xb3\x70\xee" "\x32\x35\x32\xcf\x5b\x8a\x0b\xc5\xdc\x8c\x84\x92\xe9\xd6\xf9\x01\x0e" "\xef\x20\x94\x5b\xe7\x9d\x51\x88\xec\x6e\xc8\x66\x6e\x40\x29\xcd\x35" "\x8f\xf4\xbf\xe0\x45\x9d\xbe\x2a\x9a\xf1\xd6\x87\x50\x29\xea\x9d\x19" "\xdc\x91\x53\xa6\xce\xa3\xc9\xb3\xde\x1a\x26\xb8\x4f\xf1\xc9\x6f\xcd" "\x27\x3b\x8e\x58\xa8\xa4\x7b\xd2\x3a\x7a\x71\x8a\xeb\xae\xd0\xe3\xf8" "\x16\x92\x23\x2a\x16\xa9\x2c\x90\x86\x70\xc1\x00\xa3\x49\x70\xab\x02" "\x35\xc1\x4f\xc4\x92\x15\x87\x95\xfe\x27\xda\xc0\x25\xb7\x40\x3d\x4c" "\x6f\x76\xb6\x11\x14\xc1\xbd\xcc\x81\x2d\xa4\x44\xcd\x49\x0a\x6e\xf7" "\xfb\xeb\x06\x57\x0f\x3d\x4a\x90\xcd\x31\x78\xa9\xcb\x5d\xab\x5c\x98" "\x23\x79\xce\xc6\x76\x2b\x9a\x83\x9a\xae\xcd\xf8\x88\xc1\x73\x2d\x60" "\x16\xd1\x9e\x05\x3d\xcc\x40\xad\x0c\x47\x08\xb3\xf5\x9b\x5a\xf8\x74" "\x53\x33\x80\xa6\x08\xea\xb3\x08\xb5\x97\x3d\xdd\x3f\x93\x51\x73\x7f" "\x93\x86\x08\x7b\xc2\x85\x63\x4c\xe8\xe7\x42\xb9\x3f\x24\xaa\x1c\x2b" "\x17\x60\xa3\x5e\x6c\x83\xf0\xaf\xe1\x44\x70\xb2\xa4\x4b\xfc\x10", 4096)); NONFAILING(*(uint64_t*)0x20001b76 = r[0]); NONFAILING(memcpy( (void*)0x20002a80, "\x78\x9c\xec\xdc\x4f\x8b\x1b\x65\x1c\x07\xf0\xdf\xc6\xad\xdd\x6e\xdd" "\x3f\xd6\x5a\x6d\x0f\xfa\xa0\x17\x4f\x43\x77\x0f\x9e\x04\x59\x64\x0b" "\xb2\x01\xa5\x76\x85\x56\x10\xa6\xee\x44\x43\xc6\x24\x64\xc2\x42\x44" "\xac\x9e\xbc\xfa\x3a\xc4\xa3\x37\x41\x7c\x03\x7b\xe9\x6b\xf0\xb6\x17" "\x8f\x3d\x88\x23\x4d\xb6\xb6\x69\xd3\xca\xc2\xd6\x80\xfd\x7c\x2e\xf3" "\x23\xcf\xf3\xcd\x3c\x93\x90\x81\x09\xf3\x9b\xc3\x77\x7e\xf8\xb2\xd3" "\xaa\xb2\x56\x3e\x8c\xc6\xc2\x42\x34\xfa\x11\xe9\x4e\x8a\x14\x8d\xb8" "\xe7\xb5\x9d\xc9\xf6\xfa\x8d\x9d\xad\x66\x73\xfb\x6a\x4a\x57\xb6\xae" "\x6d\xbc\x9d\x52\x5a\x7d\xfd\xd7\x4f\xbe\xfe\xe9\x8d\xdf\x86\x67\x3f" "\xfe\x79\xf5\x97\xd3\x71\xb0\xfe\xe9\xe1\x1f\x9b\xbf\x1f\x5c\x38\xb8" "\x78\xf8\xd7\xb5\x2f\xda\x55\x6a\x57\xa9\xdb\x1b\xa6\x3c\xdd\xec\xf5" "\x86\xf9\xcd\xb2\x48\x7b\xed\xaa\x93\xa5\xf4\x61\x59\xe4\x55\x91\xda" "\xdd\xaa\x18\x4c\x8d\xb7\xca\x5e\xbf\x3f\x4a\x79\x77\x6f\x65\xb9\x3f" "\x28\xaa\x2a\xe5\xdd\x51\xea\x14\xa3\x34\xec\xa5\xe1\x60\x94\xf2\xcf" "\xf3\x76\x37\x65\x59\x96\x56\x96\x83\xc7\x3a\xf5\xef\x53\x76\x7f\xbc" "\x53\xd7\x75\x44\x5d\x9f\x8a\xe7\xa3\xae\xeb\xfa\x4c\x2c\xc7\xd9\x78" "\x21\x56\x62\x35\xbe\x8d\x88\x17\xe3\x5c\xbc\x14\xe7\xe3\xe5\xb8\x10" "\xaf\xc4\xab\x71\x31\x16\xe2\x6e\x02\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x38\x39\x4f\xea\xff\x5f\x8b\xf5\x19\xfd" "\xff\x75\xad\xff\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x4e\xd6\x47\xd7\x6f\xec\x6c\x35\x9b\xdb\x57\x53\x5a\x8a" "\x28\xbf\xdf\xdf\xdd\xdf\x9d\x6c\x27\xe3\x5b\xad\x68\x47\x19\x45\x5c" "\x8e\xb5\xf8\x33\xc6\xdd\xff\x13\x93\xfa\xca\xfb\xcd\xed\xcb\x69\x6c" "\x3d\xbe\x2b\x6f\x1d\xe5\x6f\xed\xef\x3e\x37\x9d\xdf\x18\x3f\x4e\xe0" "\x28\xbf\x38\x1e\xbb\x97\xdf\x98\xe4\xd3\x74\xfe\x74\x2c\x3f\x98\xdf" "\x8c\xb5\x38\x3f\x7b\xff\x9b\x33\xf3\x4b\xf1\xd6\x9b\x0f\xe4\xb3\x58" "\x8b\xdb\x9f\x45\x2f\xca\xd8\x1b\xef\xfb\x7e\xfe\x9b\x8d\x94\xde\xfb" "\xa0\xf9\x50\xfe\xd2\x78\x1e\x00\x00\x00\xfc\x1f\x64\xe9\x1f\x33\xaf" "\xdf\xb3\xec\x71\xe3\x93\xfc\x31\xfe\x1f\x78\xe8\xfa\x7a\x31\x2e\x2d" "\xce\xf7\xd8\x89\xa8\x46\x5f\x75\xf2\xb2\x2c\x06\xd3\xc5\xd2\x23\xaf" "\x3c\x23\x45\x1d\x27\xf0\x3e\x8d\xa7\xb4\xc2\x46\xcc\xfd\xf3\x79\xa6" "\x8b\x33\x47\x3f\x9a\x63\xc6\xef\x9e\xe6\xe6\xbf\xf8\x47\x8a\xdb\xe7" "\x9e\x38\x67\xce\x27\x26\xfe\x13\xf7\xbf\xf4\x79\xaf\x04\x00\x00\x00" "\x00\x00\x00\x00\x00\x80\xe3\x78\xca\x77\x1a\x2e\xc6\x8c\x3b\xcb\xde" "\x9d\xcf\xa1\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfc\xcd\x0e\x1c\x0b\x00\x00\x00" "\x00\x08\xf3\xb7\x4e\xa3\x63\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x60\xa8\x00\x00\x00\xff\xff\xb2\x2b\xc6\x6e", 4623)); NONFAILING(syz_mount_image( /*fs=*/0x200003c0, /*dir=*/0x20000040, /*flags=MS_I_VERSION|MS_REC|MS_SYNCHRONOUS|MS_SILENT|MS_RELATIME|0x2d4e*/ 0xa0ed5e, /*opts=*/0x200009c0, /*chdir=*/1, /*size=*/0x120f, /*img=*/0x20002a80)); break; case 5: NONFAILING(memcpy((void*)0x200005c0, "./bus\000", 6)); syscall( __NR_open, /*file=*/0x200005c0ul, /*flags=O_SYNC|O_NONBLOCK|O_NOATIME|O_DIRECT|O_CREAT|0x2*/ 0x145842ul, /*mode=*/0ul); break; case 6: NONFAILING(memcpy((void*)0x20000100, "./bus\000", 6)); res = syscall(__NR_creat, /*file=*/0x20000100ul, /*mode=*/0ul); if (res != -1) r[1] = res; break; case 7: syscall(__NR_write, /*fd=*/r[1], /*data=*/0x20000300ul, /*len=*/0xfd14ul); break; case 8: NONFAILING(memcpy((void*)0x20000180, "msdos\000", 6)); NONFAILING(memcpy((void*)0x20000100, ".\000", 2)); NONFAILING(*(uint16_t*)0x200003c0 = -1); NONFAILING(sprintf((char*)0x200003c2, "0x%016llx", (long long)-1)); NONFAILING(sprintf((char*)0x200003d4, "%023llo", (long long)-1)); NONFAILING(memcpy( (void*)0x200003eb, "\xf1\xbc\xca\x05\xed\x58\x8d\x63\xa5\x76\xcc\x3a\xfd\x51\xba\xf2\x9c" "\xde\x22\x81\xa8\x43\x92\xf4\xe6\x6f\xf7\xef\x22\xaa\x9a\xf7\x27\xce" "\xae\x8a\x8e\xc9\x5f\xc1\xb7\x30\x83\xde\x2d\xe8\x25\xa0\xcb\x2b\x0b" "\xe7\x74\xfd\xb3\x36\x50\xd7\xda\xce\x27\xc1\x6b\xc2\x3b\x2f\x7c\x7f" "\xb7\x25\x85\x54\x89\x39\x69\x8f\x28\x0d\x13\x8a\xa9\x25\x5a\x8a\x92" "\x40\x08\xf8\x47\x7e\x82\xba\x11\xcd\xb1\x1e\xfd\x5c\xa2\xf1\xab\x04" "\x9c\xe2\xcc\xc4\x15\xd2\xda\xf8\xda\xc7\x25\x53\x3a\x55\x8d\x56\x16" "\x54\xfa\xf5\xe0\x92\x4f\x13\x76\x17\x4f\x37\x4d\x66\x4f\xad\x4a\x6a" "\xb2\x4e\xc0\xe8\x22\xe7\xf9\x42\x6e\x8e\x5d\xe1\xfe\x58\x08\x5a\x0a" "\xe8\x6f\xd0\x2a\x11\x8b\x93\x65\x96\x18\x34\xd4\x62\x08\xb9\xfb\x4c" "\xb1\xb1\xfa\x96\x2a\x02\x5a\x00\xdc\x2e\x31\x93\x79\x11\xea\x1e\x5a" "\x07\xae\xb3\xf9\xcd\x4e\x64\x8d\xf4\xdd\x18\xe6\x25\x3e\x7b\x6e\xd4" "\x87\x5a\x63\xa2\x32\xa2\xa4\x07\x58\x02\x60\x6e\x70\x1c\x63\xa8\x86" "\x37\x87\x88\x9b\xf1\xc9\x0f\xcc\xf3\x19\x54\xa9\x40\xc8\xb5\x84\xca" "\x89\xa5\x12\xf2\x8e\xde\xc0\x86\xb1\xc0\x82\x3c\x02\x88\x40\xee\xaf" "\x3f\x5d\x87\x69\x02\x3c\x01\x21\x86\x14\xf4\xfa\x40\xbe\x98\x92\xe7" "\xa2\x85\xac\x63\xf7\xf9\x7a\xaa\x5b\x8e\xcc\x86\xe2\x8c\x61\x93\xbc" "\x21\xa2\xb8\x33\x07\x00\x00\x00\xc4\xcf\xa0\x63\x3d\x7a\xc3\x73\xab" "\x04\xb6\x2b\x41\x11\xb5\x9e\xab\xd4\x36\xdd\x97\xe7\x88\xa3\x6e\xf2" "\x5b\xad\x99\xbe\x2a\xa9\x24\x94\x95\x58\xc8\xc7\x04\xa7\x2a\x61\x43" "\x8a\x7e\x52\x46\x74\x94\xff\x1b\x53\xd1\x5f\xd8\x81\x76\xef\xc3\xf8" "\x0b\x30\x22\x8d\x11\x4f\x46\xcb\x17\x71\xbe\xae\xbd\x5f\x25\xa9\xe9" "\xe8\xb7\x5c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7e\xf3\x35\xd4" "\x3a", 392)); NONFAILING(sprintf((char*)0x20000573, "0x%016llx", (long long)-1)); NONFAILING(*(uint8_t*)0x20000585 = -1); NONFAILING(*(uint64_t*)0x20000586 = -1); NONFAILING(*(uint32_t*)0x2000058e = -1); NONFAILING(*(uint32_t*)0x20000592 = -1); NONFAILING(sprintf((char*)0x20000596, "%020llu", (long long)-1)); NONFAILING(syz_mount_image( /*fs=*/0x20000180, /*dir=*/0x20000100, /*flags=MS_I_VERSION|MS_PRIVATE|MS_SYNCHRONOUS|MS_SILENT|MS_REMOUNT|MS_RELATIME|0x240c*/ 0xa4a43c, /*opts=*/0x200003c0, /*chdir=*/1, /*size=*/0, /*img=*/0x20000000)); 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(); setup_binfmt_misc(); setup_usb(); setup_802154(); setup_swap(); install_segv_handler(); for (procid = 0; procid < 4; procid++) { if (fork() == 0) { use_temporary_dir(); do_sandbox_none(); } } sleep(1000000); return 0; }