// https://syzkaller.appspot.com/bug?id=56bb7262d36e541407f3ba2df289c8921f5e3470 // 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 #ifndef __NR_bpf #define __NR_bpf 321 #endif static unsigned long long procid; static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static 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); } #define BITMASK(bf_off, bf_len) (((1ull << (bf_len)) - 1) << (bf_off)) #define STORE_BY_BITMASK(type, htobe, addr, val, bf_off, bf_len) \ *(type*)(addr) = \ htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | \ (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len)))) 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); } 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 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(); 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(); 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() { reset_net_namespace(); } static void setup_test() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setpgrp(); setup_cgroups_test(); write_file("/proc/self/oom_score_adj", "1000"); flush_tun(); if (symlink("/dev/binderfs", "./binderfs")) { } } static void close_fds() { for (int fd = 3; fd < MAX_FDS; fd++) close(fd); } static const char* setup_binfmt_misc() { if (mount(0, "/proc/sys/fs/binfmt_misc", "binfmt_misc", 0, 0)) { return NULL; } if (!write_file("/proc/sys/fs/binfmt_misc/register", ":syz0:M:0:\x01::./file0:") || !write_file("/proc/sys/fs/binfmt_misc/register", ":syz1:M:1:\x02::./file0:POC")) return "write(/proc/sys/fs/binfmt_misc/register) failed"; return NULL; } static const char* setup_usb() { if (chmod("/dev/raw-gadget", 0666)) return "failed to chmod /dev/raw-gadget"; return NULL; } static void setup_sysctl() { 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)) { } } } #define SWAP_FILE "./swap-file" #define SWAP_FILE_SIZE (128 * 1000 * 1000) static const char* setup_swap() { swapoff(SWAP_FILE); unlink(SWAP_FILE); int fd = open(SWAP_FILE, O_CREAT | O_WRONLY | O_CLOEXEC, 0600); if (fd == -1) return "swap file open failed"; fallocate(fd, FALLOC_FL_ZERO_RANGE, 0, SWAP_FILE_SIZE); close(fd); char cmdline[64]; sprintf(cmdline, "mkswap %s", SWAP_FILE); if (runcmdline(cmdline)) return "mkswap failed"; if (swapon(SWAP_FILE, SWAP_FLAG_PREFER) == 1) return "swapon failed"; return NULL; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } int i, call, thread; for (call = 0; call < 27; 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 == 11 ? 500 : 0) + (call == 14 ? 500 : 0) + (call == 18 ? 500 : 0)); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); close_fds(); } static void execute_one(void); #define WAIT_FLAGS __WALL static void loop(void) { setup_loop(); int iter = 0; for (;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); reset_loop(); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); setup_test(); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { sleep_ms(10); if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; if (current_time_ms() - start < 5000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[7] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: *(uint32_t*)0x200000c0 = 0; *(uint32_t*)0x200000c4 = 0xc; *(uint64_t*)0x200000c8 = 0x20000440; memcpy((void*)0x20000440, "\x18\x00\x00\x00\x01\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x18\x11\x00\x00", 20); *(uint32_t*)0x20000454 = -1; memcpy( (void*)0x20000458, "\x00\x00\x00\x00\x00\x00\x00\x00\xb7\x08\x00\x00\x00\x00\x00\x00\x7b" "\x8a\xf8\xff\x00\x00\x00\x00\xbf\xa2\x00\x00\x00\x00\x00\x00\x07\x02" "\x00\x00\xf8\xff\xff\xff\xb7\x03\x00\x00\x08\x00\x00\x00\xb7\x04\x00" "\x00\x00\x00\x00\x00\x85\x00\x00\x00\x23\x00\x00\x00\x95", 65); *(uint64_t*)0x200000d0 = 0; *(uint32_t*)0x200000d8 = 0; *(uint32_t*)0x200000dc = 0; *(uint64_t*)0x200000e0 = 0; *(uint32_t*)0x200000e8 = 0; *(uint32_t*)0x200000ec = 0; memset((void*)0x200000f0, 0, 16); *(uint32_t*)0x20000100 = 0; *(uint32_t*)0x20000104 = 0; *(uint32_t*)0x20000108 = -1; *(uint32_t*)0x2000010c = 0; *(uint64_t*)0x20000110 = 0; *(uint32_t*)0x20000118 = 0; *(uint32_t*)0x2000011c = 0; *(uint64_t*)0x20000120 = 0; *(uint32_t*)0x20000128 = 0; *(uint32_t*)0x2000012c = 0; *(uint32_t*)0x20000130 = 0; *(uint32_t*)0x20000134 = 0; *(uint64_t*)0x20000138 = 0; *(uint64_t*)0x20000140 = 0; *(uint32_t*)0x20000148 = 0; *(uint32_t*)0x2000014c = 0; syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x200000c0ul, /*size=*/0x90ul); break; case 1: syscall(__NR_bpf, /*cmd=*/0ul, /*arg=*/0ul, /*size=*/0ul); break; case 2: *(uint32_t*)0x200000c0 = 0x1b; *(uint32_t*)0x200000c4 = 0x300; *(uint32_t*)0x200000c8 = 0; *(uint32_t*)0x200000cc = 0x80008000; *(uint32_t*)0x200000d0 = 0x3461; *(uint32_t*)0x200000d4 = 1; *(uint32_t*)0x200000d8 = 0; memset((void*)0x200000dc, 0, 16); *(uint32_t*)0x200000ec = 0; *(uint32_t*)0x200000f0 = -1; *(uint32_t*)0x200000f4 = 0; *(uint32_t*)0x200000f8 = 4; *(uint32_t*)0x200000fc = 0; *(uint64_t*)0x20000100 = 0; syscall(__NR_bpf, /*cmd=*/0ul, /*arg=*/0x200000c0ul, /*size=*/0x48ul); break; case 3: *(uint32_t*)0x20000a40 = 3; *(uint32_t*)0x20000a44 = 0xc; *(uint64_t*)0x20000a48 = 0x20000440; memcpy((void*)0x20000440, "\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x18\x11\x00\x00", 20); *(uint32_t*)0x20000454 = -1; memcpy( (void*)0x20000458, "\x00\x00\x00\x00\x00\x00\x00\x00\xb7\x08\x00\x00\x00\x00\x00\x00\x7b" "\x8a\xf8\xff\x00\x00\x00\x00\xbf\xa2\x00\x00\x00\x00\x00\x00\x07\x02" "\x00\x00\xf8\xff\xff\xff\xb7\x03\x00\x00\x00\x00\x00\x00\xb7\x04\x00" "\x00\x00\x00\x00\x00\x85\x00\x00\x00\x57\x00\x00\x00\x95", 65); *(uint64_t*)0x20000a50 = 0; *(uint32_t*)0x20000a58 = 0; *(uint32_t*)0x20000a5c = 0; *(uint64_t*)0x20000a60 = 0; *(uint32_t*)0x20000a68 = 0; *(uint32_t*)0x20000a6c = 0; memset((void*)0x20000a70, 0, 16); *(uint32_t*)0x20000a80 = 0; *(uint32_t*)0x20000a84 = 0x25; *(uint32_t*)0x20000a88 = -1; *(uint32_t*)0x20000a8c = 8; *(uint64_t*)0x20000a90 = 0; *(uint32_t*)0x20000a98 = 0; *(uint32_t*)0x20000a9c = 0x10; *(uint64_t*)0x20000aa0 = 0; *(uint32_t*)0x20000aa8 = 0; *(uint32_t*)0x20000aac = 0; *(uint32_t*)0x20000ab0 = 0; *(uint32_t*)0x20000ab4 = 0; *(uint64_t*)0x20000ab8 = 0; *(uint64_t*)0x20000ac0 = 0; *(uint32_t*)0x20000ac8 = 0x10; *(uint32_t*)0x20000acc = 0; syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x20000a40ul, /*size=*/0x90ul); break; case 4: *(uint32_t*)0x200000c0 = 0xb; *(uint32_t*)0x200000c4 = 7; *(uint32_t*)0x200000c8 = 0x10001; *(uint32_t*)0x200000cc = 8; *(uint32_t*)0x200000d0 = 1; *(uint32_t*)0x200000d4 = -1; *(uint32_t*)0x200000d8 = 0; memset((void*)0x200000dc, 0, 16); *(uint32_t*)0x200000ec = 0; *(uint32_t*)0x200000f0 = -1; *(uint32_t*)0x200000f4 = 0; *(uint32_t*)0x200000f8 = 0; *(uint32_t*)0x200000fc = 0; *(uint64_t*)0x20000100 = 0; res = syscall(__NR_bpf, /*cmd=*/0ul, /*arg=*/0x200000c0ul, /*size=*/0x48ul); if (res != -1) r[0] = res; break; case 5: *(uint32_t*)0x20000200 = 0; *(uint32_t*)0x20000204 = 0xc; *(uint64_t*)0x20000208 = 0x20000440; memcpy((void*)0x20000440, "\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x18\x11\x00\x00", 20); *(uint32_t*)0x20000454 = r[0]; *(uint64_t*)0x20000210 = 0; *(uint32_t*)0x20000218 = 0; *(uint32_t*)0x2000021c = 0; *(uint64_t*)0x20000220 = 0; *(uint32_t*)0x20000228 = 0; *(uint32_t*)0x2000022c = 0; memset((void*)0x20000230, 0, 16); *(uint32_t*)0x20000240 = 0; *(uint32_t*)0x20000244 = 0; *(uint32_t*)0x20000248 = -1; *(uint32_t*)0x2000024c = 0; *(uint64_t*)0x20000250 = 0; *(uint32_t*)0x20000258 = 0xffffffc4; *(uint32_t*)0x2000025c = 0; *(uint64_t*)0x20000260 = 0; *(uint32_t*)0x20000268 = 0; *(uint32_t*)0x2000026c = 0; *(uint32_t*)0x20000270 = -1; *(uint32_t*)0x20000274 = 0; *(uint64_t*)0x20000278 = 0; *(uint64_t*)0x20000280 = 0; *(uint32_t*)0x20000288 = 0; *(uint32_t*)0x2000028c = 0; syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x20000200ul, /*size=*/0x90ul); break; case 6: *(uint32_t*)0x200000c0 = 0; *(uint32_t*)0x200000c4 = 4; *(uint64_t*)0x200000c8 = 0x20000480; memcpy((void*)0x20000480, "\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x85\x00\x00\x00\x6d", 21); *(uint64_t*)0x200000d0 = 0; *(uint32_t*)0x200000d8 = 0; *(uint32_t*)0x200000dc = 0; *(uint64_t*)0x200000e0 = 0; *(uint32_t*)0x200000e8 = 0; *(uint32_t*)0x200000ec = 0; memset((void*)0x200000f0, 0, 16); *(uint32_t*)0x20000100 = 0; *(uint32_t*)0x20000104 = 0; *(uint32_t*)0x20000108 = -1; *(uint32_t*)0x2000010c = 0; *(uint64_t*)0x20000110 = 0; *(uint32_t*)0x20000118 = 0; *(uint32_t*)0x2000011c = 0; *(uint64_t*)0x20000120 = 0; *(uint32_t*)0x20000128 = 0; *(uint32_t*)0x2000012c = -1; *(uint32_t*)0x20000130 = 0; *(uint32_t*)0x20000134 = 0; *(uint64_t*)0x20000138 = 0; *(uint64_t*)0x20000140 = 0; *(uint32_t*)0x20000148 = 0; *(uint32_t*)0x2000014c = 0; syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x200000c0ul, /*size=*/0x90ul); break; case 7: *(uint32_t*)0x200005c0 = 0x18; *(uint32_t*)0x200005c4 = 0xc; *(uint64_t*)0x200005c8 = 0x20000440; *(uint64_t*)0x200005d0 = 0x20000240; memcpy((void*)0x20000240, "GPL\000", 4); *(uint32_t*)0x200005d8 = 0; *(uint32_t*)0x200005dc = 0; *(uint64_t*)0x200005e0 = 0; *(uint32_t*)0x200005e8 = 0; *(uint32_t*)0x200005ec = 0; memset((void*)0x200005f0, 0, 16); *(uint32_t*)0x20000600 = 0; *(uint32_t*)0x20000604 = 0; *(uint32_t*)0x20000608 = -1; *(uint32_t*)0x2000060c = 0; *(uint64_t*)0x20000610 = 0; *(uint32_t*)0x20000618 = 0; *(uint32_t*)0x2000061c = 0; *(uint64_t*)0x20000620 = 0; *(uint32_t*)0x20000628 = 0; *(uint32_t*)0x2000062c = 0; *(uint32_t*)0x20000630 = 0; *(uint32_t*)0x20000634 = 0; *(uint64_t*)0x20000638 = 0; *(uint64_t*)0x20000640 = 0; *(uint32_t*)0x20000648 = 0; *(uint32_t*)0x2000064c = 0; syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x200005c0ul, /*size=*/0x90ul); break; case 8: *(uint32_t*)0x20000180 = 2; *(uint32_t*)0x20000184 = 4; *(uint32_t*)0x20000188 = 0x2300; *(uint32_t*)0x2000018c = 0x20; *(uint32_t*)0x20000190 = 0; *(uint32_t*)0x20000194 = -1; *(uint32_t*)0x20000198 = 0; memset((void*)0x2000019c, 0, 16); *(uint32_t*)0x200001ac = 0; *(uint32_t*)0x200001b0 = -1; *(uint32_t*)0x200001b4 = 0; *(uint32_t*)0x200001b8 = 0; *(uint32_t*)0x200001bc = 0; *(uint64_t*)0x200001c0 = 0; res = syscall(__NR_bpf, /*cmd=*/0ul, /*arg=*/0x20000180ul, /*size=*/0x48ul); if (res != -1) r[1] = res; break; case 9: *(uint64_t*)0x200016c0 = 0; *(uint64_t*)0x200016c8 = 0x20000600; *(uint64_t*)0x200016d0 = 0x20000640; *(uint64_t*)0x200016d8 = 0x200006c0; *(uint32_t*)0x200016e0 = 1; *(uint32_t*)0x200016e4 = r[1]; *(uint64_t*)0x200016e8 = 0; *(uint64_t*)0x200016f0 = 0; syscall(__NR_bpf, /*cmd=*/0x18ul, /*arg=*/0x200016c0ul, /*size=*/0x38ul); break; case 10: *(uint32_t*)0x200000c0 = 0x11; *(uint32_t*)0x200000c4 = 0xc; *(uint64_t*)0x200000c8 = 0x20000440; *(uint64_t*)0x200000d0 = 0x20000240; memcpy((void*)0x20000240, "GPL\000", 4); *(uint32_t*)0x200000d8 = 0; *(uint32_t*)0x200000dc = 0; *(uint64_t*)0x200000e0 = 0; *(uint32_t*)0x200000e8 = 0; *(uint32_t*)0x200000ec = 0; memset((void*)0x200000f0, 0, 16); *(uint32_t*)0x20000100 = 0; *(uint32_t*)0x20000104 = 0; *(uint32_t*)0x20000108 = -1; *(uint32_t*)0x2000010c = 0; *(uint64_t*)0x20000110 = 0; *(uint32_t*)0x20000118 = 0; *(uint32_t*)0x2000011c = 0; *(uint64_t*)0x20000120 = 0; *(uint32_t*)0x20000128 = 0; *(uint32_t*)0x2000012c = 0; *(uint32_t*)0x20000130 = 0; *(uint32_t*)0x20000134 = 0; *(uint64_t*)0x20000138 = 0; *(uint64_t*)0x20000140 = 0; *(uint32_t*)0x20000148 = 0; *(uint32_t*)0x2000014c = 0; res = syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x200000c0ul, /*size=*/0x90ul); if (res != -1) r[2] = res; break; case 11: *(uint64_t*)0x20000040 = 0x20000080; memcpy((void*)0x20000080, "ext4_da_update_reserve_space\000", 29); *(uint32_t*)0x20000048 = r[2]; syscall(__NR_bpf, /*cmd=*/0x11ul, /*arg=*/0x20000040ul, /*size=*/0x10ul); break; case 12: memcpy((void*)0x200001c0, "memory.current\000", 15); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200001c0ul, /*flags=*/0x275aul, /*mode=*/0ul); if (res != -1) r[3] = res; break; case 13: *(uint32_t*)0x200000c0 = 0x11; *(uint32_t*)0x200000c4 = 0xc; *(uint64_t*)0x200000c8 = 0x20000440; *(uint64_t*)0x200000d0 = 0x20000240; memcpy((void*)0x20000240, "GPL\000", 4); *(uint32_t*)0x200000d8 = 0; *(uint32_t*)0x200000dc = 0; *(uint64_t*)0x200000e0 = 0; *(uint32_t*)0x200000e8 = 0; *(uint32_t*)0x200000ec = 0; memset((void*)0x200000f0, 0, 16); *(uint32_t*)0x20000100 = 0; *(uint32_t*)0x20000104 = 0; *(uint32_t*)0x20000108 = -1; *(uint32_t*)0x2000010c = 0; *(uint64_t*)0x20000110 = 0; *(uint32_t*)0x20000118 = 0; *(uint32_t*)0x2000011c = 0; *(uint64_t*)0x20000120 = 0; *(uint32_t*)0x20000128 = 0; *(uint32_t*)0x2000012c = 0; *(uint32_t*)0x20000130 = 0; *(uint32_t*)0x20000134 = 0; *(uint64_t*)0x20000138 = 0; *(uint64_t*)0x20000140 = 0; *(uint32_t*)0x20000148 = 0; *(uint32_t*)0x2000014c = 0; res = syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x200000c0ul, /*size=*/0x90ul); if (res != -1) r[4] = res; break; case 14: *(uint64_t*)0x20000040 = 0x20000080; memcpy((void*)0x20000080, "ext4_da_update_reserve_space\000", 29); *(uint32_t*)0x20000048 = r[4]; syscall(__NR_bpf, /*cmd=*/0x11ul, /*arg=*/0x20000040ul, /*size=*/0x10ul); break; case 15: *(uint32_t*)0x20000080 = 8; *(uint32_t*)0x20000084 = 0xe; *(uint64_t*)0x20000088 = 0x20000880; memcpy( (void*)0x20000880, "\xb7\x02\x00\x00\x00\x00\x00\x00\xbf\xa3\x00\x00\x00\x00\x00\x00\x07" "\x03\x00\x00\x00\xfe\xff\xff\x7a\x0a\xf0\xff\x11\x00\x00\x1f\x79\xa4" "\xf0\xff\x00\x00\x00\x00\xb7\x06\x00\x00\x00\x00\x00\x81\xad\x64\x02" "\x00\x00\x00\x00\x00\x45\x04\x04\x00\x01\x00\xff\x0f\x17\x04\x00\x00" "\x01\x13\x0a\x00\xb7\x04\x00\x00\x05\x00\x00\x00\x6a\x0a\xf2\xfe\x00" "\x00\x00\x00\x85\x00\x00\x00\x1a\x00\x00\x00\xb7\x00\x00\x00\x00\x00" "\x00\x00\x95\x00\x00\x00\x00\x00\x00\x00\x00\xe1\x54\xcd\x84\x4a\x95" "\x4b\x26\xc9\x33\xf7\xff\xff\xff\xff\xff\xff\xff\x55\xbb\x20\x07\xee" "\x51\x05\x05\x12\xda\x90\xb5\xb4\x21\x28\xaa\x09\x0a\x79\x50\x7d\xf7" "\x19\xaf\x36\x34\x9f\x29\x81\x29\xda\x48\x71\x30\x7b\x53\x4b\xf9\x01" "\x11\x5e\x17\x39\x2a\xc6\x6a\xd0\x22\x18\x6a\x89\x29\xd1\xc0\x00\x00" "\x61\x46\x00\x1e\x04\xae\xac\xea\x79\x9a\x22\xa2\xfa\x03\x00\x00\xc4" "\x12\xf6\xca\xe8\x00\x43\xeb\x27\xd5\x33\x19\xd0\xad\x22\x9e\x57\x52" "\x54\x83\x00\x00\x00\x00\xdb\xc2\x77\x7d\xf1\x50\x95\x16\xf0\x6f\x13" "\x30\xcf\x8c\x3a\x8b\x1f\xf7\x2e\x61\x27\xb0\xdd\x48\x83\x18\xb5\x79" "\x0b\xee\x7e\xbd\x47\x45\xb7\xcd\xd7\x7b\x85\xb9\x41\x09\x23\x14\xfd" "\x08\x5f\x02\x8f\x4e\x09\xd6\x37\x81\x98\x7a\xf2\xab\xd5\x5a\x87\xac" "\x03\x94\xb2\xf9\x2f\xfa\xb7\xd1\x53\xd6\x20\x58\xd0\xa4\x13\xb2\x17" "\x36\x9c\xa8\xb6\x71\x2f\x00\x00\x00\x00\x1b\x1d\xf6\x5b\x3e\x1b\x9b" "\xf1\x15\x64\x69\x14\xce\x53\xd1\x3d\x0c\xca\xcd\xa1\xef\x16\xfd\xcc" "\xea\xed\xe3\xfa\xed\xc5\x1d\x29\xa4\x7f\xc8\x13\xce\x3d\x32\xcf\xc7" "\xa5\x04\xc2\x71\xd6\xd6\xf4\xea\x6b\xf9\x7f\x2f\x1b\xe2\xea\x2e\x53" "\x43\x00\xbc\xb3\xfd\xc4\xb4\x86\x10\x04\xee\xfb\xda\x7f\x54\xf8\x2a" "\x80\x4d\x4a\x69\xbf\x9b\xc5\xfa\x77\xee\x29\x3f\xbd\x16\x5a\x5a\x68" "\x48\x8e\x40\xb0\x30\x16\x65\x65\xa0\x97\xb1\xb4\x4b\x45\x1d\xe7\x94" "\x0b\x00\x00\xdb\x8d\xb0\x3d\x4b\x77\x45\xfe\xf1\xd0\x4e\xc6\x33\xde" "\xe2\x54\xa6\xd4\x91\xb8\x49\x6d\xa7\x87\xe8\x14\xc4\xfd\xf0\xb4\xa3" "\x87\xb4\xc8\x14\x9d\x18\xc1\x02\x00\x29\xa1\x89\x86\x25\x2a\x70\xf8" "\xf9\x2e\xb6\xf0\xe8\xc7\xdb\x00\x00\x68\xfb\xaa\x2e\x2a\x27\xef\xd9" "\x10\x42\x97\xf2\xc5\x81\x59\xf0\x2d\x1b\x72\x18\x3a\xac\xf4\xa8\x4f" "\x91\x30\xb7\x75\xdd\x4e\x9e\x30\x70\x75\x6f\x97\xad\x79\x1f\xa9\x09" "\xac\x06\xb5\x74\x79\x32\x1a\x05\x74\xfb\x30\x4b\xc2\xa1\x68\x19\x89" "\x32\x8c\x8d\xdc\x20\xea\x01\x1b\xf5\x74\x2e\x0e\xf9\x42\x34\xdb\x1f" "\x00\x00\x00\x00\x00\x00\x00\xc2\x0f\xb4\x79\x1e\xc8\x58\x21\xd0\xc4" "\x8f\xb6\x57\xc2\x9b\x30\x9c\x73\xf0\x97\x7e\x7c\xde\x65\xa8\x2b\x94" "\xc4\x61\xd7\x96\x2b\x35\xf4\x21\xc3\x55\x27\x72\xca\x7f\x3e\x2c\x25" "\xa6\x5f\x75\xca\x13\xfb\x7c\x8b\xbd\x6f\xf4\x3c\xb7\x8b\x6e\x7d\xac" "\x1a\xba\x4b\x20\xdc\x7d\xe0\x58\xa4\xdf\xa7\xe8\x5a\x8b\xdf\x1d\x41" "\xaa\xd8\xbd\xa7\x4d\x66\xf4\x7c\xc1\x7d\x8b\xa3\xee\xc0\xfd\x80\xf8" "\x2c\x5f\x57\x3c\x6d\x29\x4d\x36\x65\x05\x00\x00\x00\xda\x0f\xde\x07" "\x45\xdb\x06\x75\x3a\x7a\xc7\xfe\x13\xca\xb6\x69\x24\x22\xa4\x6e\x9f" "\xfe\x2d\x4a\x2d\x32\xf7\x52\x87\x51\x31\x36\x94\xbf\x57\x00\xb2\x0e" "\xf0\xc2\x48\xdd\xd3\xda\x32\x39\x47\x00\x4c\xac\xad\xca\xff\x20\x66" "\xbb\x5d\x40\x45\xc9\x58\x56\x38\xc2\x15\x3a\x6e\xee\x01\x73\x8b\x0c" "\x10\x67\x1f\x4f\x55\x9b\x7d\xcb\x98\xa6\x27\x3b\x8c\x5f\x1e\x24\xd9" "\xf6\x79\xe4\xfb\xe9\x48\xdf\xb4\xcc\x4a\x38\x94\x85\xee\x7a\xf1\xf0" "\x38\x7c\x93\x55\x96\x53\xf5\x0a\x47\x1c\x69\x60\x82\x41\x73\x04\x59" "\xf0\x12\xb0\x60\xe7\xd2\x3f\xd3\x92\x06\x00\x00\x00\x00\x00\x00\xeb" "\x55\xd0\x01\x62\x32\x5b\xa1\x41\xbd\x58\x7c\xc9\xda\xd4\x6d\xe5\x6e" "\xf9\x07\xb0\x59\xb9\x9a\x79\xae\x54\x98\xf6\x58\x98\x80\xed\x6e\xea" "\x7b\x9c\x67\x00\x12\xf8\x0c\xd6\xa1\x39\x79\x53\xba\x58\x70\x78\x65" "\x54\xdf\x26\x23\x6e\xbc\xed\x93\x90\xcb\x69\x41\xb8\x36\x5d\x93\x6a" "\x7d\x21\x20\xec\xa2\x91\x96\x3e\xb2\xd5\x37\xd8\x7c\xbb\x54\xe5\x88" "\xee\x5d\x69\x44\xee\x4d\xe5\xc1\x83\xc9\x60\x11\x94\x51\xc3\x15\x39" "\xb2\x28\x09\xe1\xd7\xf0\xc7\xa0\x6a\x9f\xa8\x7d\x64\xcb\x77\x87\x2a" "\x0a\xa9\xa1\x04\xe1\x6b\x3b\x8c\x6e\x64\x83\x6a\xc3\xf3\x2f\x53\xc9" "\xa2\xba\xe5\x13\x46\x4c\xa0\x3a\xff\x14\xb9\xaa\x4b\xd9\x53\x9f\x50" "\x96\x41\x2b\x92\x01\x2e\x09\x5b\x84\xc2\x02\x06\x00\x98\xdf\x33\x14" "\xf0\xe3\x99\xd1\xb9\xf2\x7e\x3c\x33\x26\x9c\x0e\x15\x3b\x28\xb2\xd4" "\x41\x05\x72\xbc\x45\xb9\xd3\xfa\x02\x20\x8d\x30\x4d\x45\x5c\x36\x30" "\x00\x00\x00\x00\x22\x32\x01\x78\x02\x00\xc6\xed\x79\x66\x13\x0b\x54" "\x7d\xbf\x8b\x49\x7a\xf0\xa7\x7f\x52\xf2\xcd\x39\x00\x00\x00\x20\x00" "\x00\xe8\x1c\x23\xcf\x14\x15\x69\x51\x21\x00\x01\xc8\x00\x00\x00\x00" "\x00\x15\x00\x00\x00\x00\x00\x09\x28\xee\x53\x59\x5a\x77\x9d\x24\x3a" "\x48\xce\xa7\x69\x47\x04\x24\xd2\x88\x04\xc0\x26\xab\x7f\x4a\x5c\x81" "\x92\x1e\x01\x28\xdf\xd7\x0b\x43\x8a\xf6\x0b\x06\x00\x00\x00\x00\x00" "\x00\x00\x56\x64\x2b\x49\xb7\x45\xf3\xbf\x2c\x01\x80\x8b\x6d\x7d\x74" "\x83\x08\xee\xa0\x9f\x01\x61\xb4\x73\x5e\xfb\xf3\x41\x17\x38\xd6\xee" "\x7a\xeb\xf9\xef\x40\x66\x2d\x78\x36\xd2\x52\xc5\x66\xe1\xee\x93\x8a" "\x9a\x68\x04\xed\x3a\x10\x79\xb0\x28\x2a\x12\x04\x34\x08\xcd\x60\xb9" "\xe5\x39\x78\xc8\x18\x39\xbe\x00\x00\x00\x00\x00\x45\x6f\x7d\x2a\x42" "\xcb\x13\xda\x20\x22\xf2\x3e\xae\xc6\x18\x54\xf6\x40\xf7\x01\xdb\x02" "\x76\x65\x2f\x6c\x74\xf2\x06\x75\xeb\x78\x19\x25\x44\x15\x78\xe9\x30" "\x46\xaa\xdd\xea\x39\x4c\xd8\xff\xd3\xd6\x28\x29\x3e\x59\x1d\xc6\xf7" "\x1c\x27\x10\xa7\xea\x8a\x4f\xdc\x21\x4e\x1c\xc2\x75\xb2\x6a\xdf\xa8" "\x92\xe6\xde\x92\x00\x00\x00\x00\xe5\x0e\x5b\xaf\xec\xea\x4d\x41\x34" "\xf9\xd0\x06\xc8\xd6\x88\x3e\xca\x5c\x9c\x58\xc9\xe9\x33\x11\xab\x50" "\xfe\x82\xd5\xa9\x6b\x09\xc6\x8c\x73\xde\x2f\x04\xf1\x5d\x00\x53\x87" "\x57\x7f\x48\x00\x00\xea\x65\x55\x9e\xb0\x0e\x01\x4d\xf2\x0f\xa2\x09" "\xbc\xbb\x5c\x25\x2b\x11\xa6\x0c\xa7\x70\x66\x3d\xa4\x51\x79\x0c\xc3" "\x60\x00\x90\x6d\x5a\x9f\xad\x98\xc3\x08\xe3\x9b\xd5\xff\xb6\x15\x1d" "\x79\xc1\xce\xe1\xcd\xfb\xa0\x5e\x36\x33\xc2\x6d\x39\x27\xae\x1b\xeb" "\x06\x5f\x5a\xc3\x3f\xdb\xe2\x8a\x5f\xfc\x83\xf2\xf0\x85\x18\x5c\xc9" "\x2f\xe7\xf7\x91\xe8\xf6\x42\x93\x09\xd6\xad\xab\x4b\x7e\x50\x8e\x5b" "\xf0\x24\xed\x8f\x8a\x00\x5f\x2b\x2b\xdc\x0a\xf7\xc4\xc6\x12\x41\x75" "\x0d\x50\x51\x5a\x59\xa3\xad\x09\xe8\x80\x2e\x8f\x4f\x53\x54\x47\xdc" "\x0f\xc9\xd5\xf9\x9a\x14\x5d\xfc\xed\xad\x69\xda\x9c\xd4\xb7\x5c\x62" "\x46\x00\xe7\x8f\x44\x58\x54\x2b\x14\xf2\x96\x11\xf9\x5d\x4a\x31\x83" "\x84\xeb\x20\xc2\x0b\xb8\x2a\xa3\x17\x71\xcd\x37\x9e\xc8\x35\x54\xce" "\xa5\xe6\x53\x9d\xb7\x38\x4e\x1f\x58\xd8\x1f\x2f\x26\x53\xc4\xd9\x81" "\x87\x08\xe2\x7c\x89\xb5\x52\xd5\x83\xf4\x36\x13\x7a\x3c\x5d\xc7\x14" "\xc9\x40\x2c\x21\xd1\x81\xaa\xe5\x9e\xfb\x28\xd4\xf9\x16\x52\xf6\x75" "\x0b\x91\x95\x59\x9d\x60\xc5\x34\xee\x8e\x8f\xf0\x75\x5b\x09\x00\x4c" "\x25\xed\xb8\x5b\xcf\xf2\x4c\x75\x7a\xa8\x09\x00\x00\x00\x00\xb6\x63" "\x8c\x42\x0e\xb4\x30\x4f\x66\xe3\xa3\x7a\xaf\x00\x00\x00\xc4\x2a\x57" "\x0f\x0e\x9d\x76\xfd\x54\x54\x70\xf8\x62\xf8\xc3\xc1\x4f\xa9\xec\xd1" "\xe8\x77\xb0\xd8\xca\x84\xc0\x44\x85\x9e\x85\xe6\x15\x8f\x91\x84\xbc" "\x61\xa9\xa2\x84\xdf\x80\xe4\x63\x6c\x25\xb9\x61\x74\x32\x6d\x82\x76" "\x1c\x26\xe3\x29\x55\x5f\x92\x90\xaf\x40\x00\x00\x00\x00\x00\x00\x10" "\x00\x00\xfd\x37\x63\x65\x55\x00\x34\x4b\xae\x34\x34\x7f\x5a\xb0\xd5" "\x34\xb8\xd6\x3e\x4c\xa3\xb6\x71\xf2\xde\x1c\xdf\x51\x91\x92\xc6\xb5" "\x9a\x60\x1f\xd4\x19\xa5\xc1\x6e\x20\x55\xb8\x50\x58\x09\xed\x2e\xe9" "\x64\x7c\x5d\x3b\x00\x00\xbc\x00\xed\xf5\xe9\x02\x0c\x09\xab\x00\x43" "\x21\x61\x0b\x85\x7e\x87\x17\x97\x4b\x63\x3b\x21\xcb\x32\xf0\xe0\x32" "\x80\xe0\x97\x58\xbd\x44\x5a\xb9\x1d\x20\x17\x82\xd6\x56\xab\x09\xf5" "\x08\xbb\xba\xca\x00\x54\x52\xb7\x9d\x7b\x57\x4a\x24\x7f\x1d\x2f\xe4" "\x5b\x3c\x4e\x93\xda\x3d\x51\xde\x64\x7c\x10\xdd\x49\x94\x4d\xc8\x7c" "\x92\xb3\x2a\xf0\x0f\x19\x1b\x66\xb6\xa6\xf7\x32\xa9\x1f\x0a\x2e\x91" "\x20\xbe\x61\xe5\x8c\x79\xd4\x97\x24\x7d\x27\x88\x88\x90\x1d\x44\xbf" "\x77\xe8\x24\x66\x05\xa6\x44\xe9\xe3\xd7\x69\xdb\x49\x7c\x39\x60\xdf" "\x05\xca\xee\x99\x4a\xdc\x38\xa4\x36\x36\x7a\x54\xb9\xe1\x82\xb7\x8e" "\x9a\x0c\xeb\x9a\x2c\x4f\x63\x90\x2c\x1a\xd1\xa7\xc5\xa0\x8d\x09\x20" "\xa2\x3c\x2a\x86\xab\xbd\xf3\x57\x84\x9a\x65\x17\x33\xe5\x7f\x31\x01" "\x98\x56\x02\x68\x88\x88\xcc\xb8\x5c\x87\xb4\xf8\xff\xff\xff\x7f\x00" "\x00\x00\x00\x2c\x33\x1f\xca\x28\x54\x1b\x7c\xa2\x11\x11\x5b\x43\xf8" "\xb1\x89\x4c\x8f\xa8\xa1\x4d\xc4\x81\x0f\x61\xae\x96\xc1\x8c\xc7\x13" "\x00\x00\x00\x00\x00\x00\x01\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x27\xc9\x58\x5c\x0c\xea\xd5\xd6\x19\xd1\x84\x75\xcc\xde\x28" "\x57\x27\x9a\x93\x75\xde\x58\x58\x81\x8f\x3c\x4a\x4f\xa6\xce\x46\xf4" "\xd4\x2b\x07\x19\x9d\xe8\xb9\x92\x31\xac\xe5\x8c\x77\xa2\x3b\x00\x00" "\xe4\x96\x66\xc4\x64\xd3\x5c\xa9\xb5\x0f\x3e\xd3\xb3\xda\x8c\x17\xa2" "\x36\x92\x75\x9c\xcf\x5a\x20\x53\x11\xb7\xd1\x22\x53\x26\x97\xb8\x61" "\xdf\xb5\x46\x09\xfd\x88\xe6\x04\x3b\xd5\x2a\xe8\x4c\x1b\xb0\xc8\xa6" "\xc7\x69\xda\x52\xb3\xd4\x2c\x68\xa3\x10\x2f\xa1\x29\x6d\xff\xf4\xa9" "\x79\x36\x9b\x0e\x8e\xbc\x62\x88\x7a\xa4\x6e\x82\x0a\x74\xf9\x13\x81" "\xdc\xc1\x98\xe3\x53\x04\x7d\xb7\x06\x86\xd1\x47\x35\x70\x24\xeb\x3c" "\xb9\x4f\x1e\x89\x18\xa0\xd6\xe2\x94\x9a\xff\xca\xcb\x5b\xa0\xa5\x6a" "\xa0\x63\xb4\xdc\x52\x1a\x3d\x93\x56\xb4\xb8\xb5\x91\x7c\x4c\x86\x04" "\x95\xb2\x40\xe8\x00\x63\xbd\xe2\x61\xfd\x00\x00\x00\x00\x00\x72\x71" "\xe2\x8e\xf6\x80\x6b\xc8\xe1\x39\xc4\x9b\x91\xc7\x6b\x0d\x39\x58\x32" "\xf1\xe2\xaa\xd3\xe5\x19\xf1\x63\x4e\x8f\xbd\x8d\x31\x33\x0d\x89\x06" "\x9f\x94\x48\xa2\xff\x93\x06\x0f\xf0\x73\xb3\xa1\x13\xe4\x7e\xdf\x76" "\xf7\xd1\xb8\xb9\x0b\xc0\xdf\x4c\xfb\x0b\x9c\x8c\x80\x15\x8b\x44\xec" "\xae\x94\x20\x65\x4f\x70\x16\xb0\xaa\xc1\x17\x08\x74\x06\xd3\x43\xe2" "\x7b\x37\x2d\x60\x27\xab\x2a\xec\x8f\x2b\xca\xd7\xfe\x6b\xb9\x32\xbc" "\x57\x51\xd2\x97\x4e\x95\x45\x5a\x27\x7f\xa3\xb4\x72\xbc\x7b\xbd\xd2" "\xac\x5a\x1e\xa6\x08\xe8\x13\x7a\xce\x03\x36\x16\x07\xcc\x1a\x84\xbe" "\x65\x93\x55\x62\x9a\xb1\x3a\xd4\x90\x08\xc3\xfc\xfa\x24\x23\x43\x9a" "\x36\x07\x96\x1d\x5b\x59\xda\x48\xa0\x15\x5e\x8e\x42\xcc\x13\xc7\x02" "\xcc\x40\xc9\x9c\xf8\x6c\x20\x21\xd7\x2f\x9f\x4a\xb1\xb0\x0d\xe5\x55" "\xa5\xa3\x95\x93\xc9\x38\x71\xff\x7e\xb5\xec\xad\xb6\x48\x37\xa2\xd8" "\x87\x23\xef\x65\xaa\x51\x52\xe3\xd5\x5e\x5c\x66\x58\x5e\x21\x12\xf5" "\xec\x64\xb6\x39\xa9\x86\x4e\x57\x58\x1b\x61\xf2\xb0\x96\x06\x00\x00" "\x00\x00\x00\x00\x00\x26\x5f\x09\x1e\x7b\xce\x17\xd2\x06\x04\xc5\xab" "\x75\x17\x73\xa5\xcf\x8a\x71\x9a\x7a\xda\x06\xed\x03\x83\x2b\xf2\x74" "\x70\x7c\x7c\x97\x0e\xdc\x20\xf4\xa1\xea\xa3\xb6\x10\x45\xa2\x00\x97" "\x20\x8d\x03\xf7\xa1\x46\xa6\x90\x19\x13\x61\x87\x38\x67\x9d\x4e\x0a" "\xf5\x3e\xae\x99\x7e\xec\xfa\x0d\xc3\xdc\xec\x19\xd3\xd9\x20\x54\x50" "\x76\x5d\x65\x92\x00\xc9\x27\x01\xee\x75\xc8\x71\x04\x70\xd9\xeb\x6f" "\x62\xc5\xc7\x21\x88\x3f\x15\x44\xba\x66\x27\x1c\x8d\xab\x05\xa9\x33" "\x74\x6c\x16\xb6\xe9\x32\x94\xb5\x61\xc6\x71\x5a\x32\xa3\x94\xed\x1e" "\x6c\x01\x67\x0c\x93\x1b\xfa\x76\xc5\x8c\x6f\x34\xd6\x4e\x75\x8a\x7a" "\x7f\x7d\x33\xc4\x93\x36\xd4\xcb\xa2\xcb\xb1\x70\xad\x75\x39\xa4\x57" "\x74\xdf\xcc\x55\x25\x72\x15\xc8\xae\x71\x9d\xc1\xc2\x32\xfc\x66\x99" "\xef\x01\x00\x58\x87\xd0\x4a\x54\x30\x30\xb4\x32\x8a\xb4\x87\x44\xac" "\x23\xff\x56\xfd\x2d\xa5\x2e\xb9\xfb\x2e\xef\xcd\xd2\xd9\x2d\x73\xac" "\x1b\x11\x1e\xa8\x95\xe1\xfe\xc3\x6a\x35\x79\x87\x9a\xcf\xe3\x66\xd3" "\x93\xf1\xfa\x9c\xbe\x08\xd9\xba\x57\xa4\x43\x64\x3e\x9c\xd2\x51\xdc" "\x88\xe9\x1a\x5e\x45\x8e\x66\xea\x1e\x82\x2d\x55\xd4\xdd\x91\x9a\x95" "\xeb\x4c\x25\xa0\x8c\xb6\xe1\x07\x00\x00\x00\x3a\x0f\xd0\x7a\x4a\xd9" "\xdf\x24\x0e\x00\x00\x6a\xaa\x2d\xb0\xdf\xe4\x16\x14\x68\x40\xd8\x8b" "\xd0\x83\x65\xe5\x47\xc9\x70\xe2\x98\x32\x00\x70\x38\x64\xa3\xb9\xc4" "\x68\x2c\xb4\x79\xda\xd6\xd3\x4d\x21\x1b\x05\x26\x7e\xb1\x35\x55\x20" "\xe9\xec\x0c\x50\x14\xb0\x83\x2f\x7f\xb3\x57\x82\xfd\xbf\xcb\xf5\xe2" "\x3a\x7f\x5d\x51\xea\x48\x03\x71\x74\x8d\x18\xd8\xe1\x06\x08\xab\x82" "\x61\xfe\x05\x8d\x17\x32\xf2\x88\x14\xa9\x98\x1d\x84\xa0\x4a\x2b\xb3" "\x6c\x89\xbd\xd2\x45\xe3\x29\x3a\x14\xdf\x1a\xc5\x67\x30\x1a\x79\x51" "\x4f\x10\x3a\xbd\x38\x7d\x6e\xf2\xd9\xd9\x45\x08\xac\x0f\x61\x35\xc8" "\x92\x12\x79\x57\x3e\xef\xd5\xd4\xe3\x3b\x9e\xf5\x85\x98\x07\x89\xa9" "\x4d\x98\x48\x90\x6f\x54\x55\x59\xd3\x00\x00\xb5\x04\x0f\x07\x76\x70" "\x33\x63\x24\x9c\xa9\x84\xcb\xb0\x97\x52\xf0\x99\xef\xbb\x9e\x73\x62" "\xe4\x99\x95\x94\xc1\x08\x6d\x89\x58\xe9\x46\x9d\xb0\x1d\x85\xfb\x0b" "\x9b\x31\x48\x66\x3e\x9e\xa2\xe7\x55\xd9\x6c\x70\xe5\x40\xb4\x20\x0e" "\x4c\xf8\x29\x86\x71\x2d\xd7\x33\xb2\x6d\x00\xe9\x47\xd0\x3c\x42\x21" "\x51\x18\x42\x6d\x54\x8c\xb2\x07\x7b\x43\xb8\x9e\x41\x63\xd2\x60\xfa" "\xea\x1d\xb5\x3e\x2c\xf3\x42\x7c\x90\xae\xfa\x26\x62\xa1\xc2\xb2\x8b" "\x0e\x02\x0e\x87\x2b\xda\x1d\x39\xda\x50\x8d\xe5\xdb\xc3\x7d\x03\xee" "\x05\x6b\x25\x79\xa1\xd1\x67\x99\x58\x9a\x26\x00\x00\x00\x00\xaa\x00" "\x00\x6c\x94\xbc\xaf\x11\x5f\xbb\xcb\x21\x6e\x3c\xb7\xfd\x9a\xfe\x16" "\xd1\xff\xf2\xd0\x47\xe5\x08\xaa\x5f\x6d\xe0\xea\x4e\x9e\xc1\xb3\xa4" "\xab\x1f\x8b\x5f\x31\x2f\xc5\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x42\x70\x9d\xb6\xde\x7e\x96\x9a\xc0\xce\x18\xb4\x72\x80" "\xfb\x1b\x1b\x15\x31\x64\x81\x22\xfe\xd3\xe2\x5e\xde\xcb\x52\x00\xf5" "\x00\x00\x00\x00\x00\x00\x16\x6f\x7d\x36\xb2\x96\x6c\x19\xaf\x7f\xfa" "\x6a\xfa\x69\xe5\x08\x21\xc9\xaa\x3a\xe6\x0f\xbc\x19\x6c\xf8\xad\x2f" "\x7f\x86\xd7\x9d\xb1\xbb\x0e\xcb\xf9\xc3\xd0\xd3\xd4\x07\x57\x4d\xef" "\x83\x8e\x4d\xef\x26\xed\x9c\x7e\x6c\x69\x85\x8f\x78\x13\xbe\x8f\xfc" "\x56\x55\x83\x66\x3b\xeb\xfe\x74\x85\x66\x0b\x67\xe1\x43\x6c\xbc\x6d" "\x4d\x3c\x48\xab\x7b\x03\x3d\x7d\x11\x95\x17\x3e\xdb\x16\x64\x3f\x69" "\xcb\x77\x98\x02\x83\x9d\x49\x0a\x4d\xf9\x4e\x5e\xa8\x9c\x19\x2a\xf2" "\xae\x83\x87\x6e\xdd\x59\xc9\xa7\x14\x0e\x12\xba\x59\x1f\x07\x3e\xc6" "\x04\xf7\xe8\xf1\xe1\x00\xcd\x41\x4e\x92\x37\xec\xfc\x05\x2d\x9a\x73" "\xa8\x68\xcd\x0e\x4b\x06\xda\x04\x35\xaf\x72\xfb\x0d\x25\x65\x7e\x8f" "\x54\x64\xb1\x9f\xa8\x3f\x97\x7e\x69\x00\x00\x00\x00\x36\x78\x71\xfa" "\x37\x42\x0e\x7a\x23\x2e\xf9\xb4\x40\xbb\x06\x39\x99\x4c\x65\x5d\x14" "\x4c\x57\x86\x93\x9d\x6a\x18\x7b\x81\xf9\xdd\xd2\xbe\xc3\x6c\xd2\x83" "\x71\xb1\x75\x4c\xb6\xc5\x36\x97\xfb\x23\x57\x6e\xe0\xd3\xfd\x0a\x58" "\x03\xc9\xbe\x9f\xe3\x64\x80\x31\x84\xf1\xa7\xa9\xa8\xeb\x64\xd1\x7d" "\x23\x8f\xa3\x23\x8a\x00\x1a\xa8\xed\x04\x0a\x69\xe9\xec\x0a\x62\x7e" "\x3b\x3c\xa6\x4d\x46\x80\xd8\x19\xc1\x4c\x71\x68\x45\x81\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc6\xa6" "\x58\x77\x15\x86\x5f\xe1\x45\x58\x96\x0b\xc9\x36\xbc\x83\x8b\xd1\xf2" "\xa0\x0b\x17\xa4\x07\x45\x76\x81\xd0\x76\x00\x00\x00\x00\x00\x00\x00" "\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x4f\xae\xab\xea\x6d\xe4" "\x0a\xe3\x02\x91\x66\x25\x94\xc9\x93\x09\x9e\xf0\x41\xc2\x64\xa6\x4d" "\x77\xd6\x9e\x0c\xdf\xa6\x20\xa1\x91\x70\x4c\xef\x91\xe2\x69\x04\x4a" "\xcf\x84\x4d\xe6\x5a\x09\x92\x00\x26\x5e\x13\xc2\xa8\xf9\xb7\x17\x88" "\x6d\xea\x8e\x79\x40\x7e\x34\xbc\x26\x8a\x17\x96\x50\x33\xca\x1d\xfe" "\xea\xf9\xb4\x9b\xc6\x8f\x15\x46\x59\x56\x42\xf9\xfc\x00\x88\x75\xdd" "\xb7\xae\xbd\xa7\xa1\x6b\x1d\x20\xdd\x8b\x65\xbc\xda\xc8\xcd\xc7\x5a" "\x17\x3f\xd2\xe5\x7a\x9c\x37\xbf\x5a\x52\xea\x00\x1e\xc9\x81\xdd\x7a" "\xd4\xe5\x94\x45\x75\xce\xd3\x92\x33\xad\xa8\xf3\xc1\xb8\x56\x64\x48" "\x12\x82\x8b\xb7\x95\x36\xa5\x18\x8d\x14\xfe\x53\x72\x50\xdc\x10\x71" "\x21\x53\x4c\xbb\xc7\x59\x8f\x48\xaa\x23\x35\x61\x6a\xe8\xeb\x72\xac" "\xf6\x98\x20\x48\xe5\x68\xe3\x7f\x1f\x58\xe9\x71\x43\x43\x58\x77\x34" "\xc7\xec\x0f\xa5\xc4\x4d\x13\x16\x5d\x63\x84\xbf\x95\x00\x75\x7b\x4b" "\x02\x75\x95\x0d\x6e\x7c\x45\x1e\xef\x3f\xd3\x53\xd4\x7c\x54\xc4\xc2" "\xcf\x73\x18\xe6\xc2\x45\x83\xba\x09\x66\x22\x52\x84\xd1\xab\xac\x80" "\x78\x65\x19\xc5\x63\xdd\xf0\xe6\xc0\x23\xd5\x37\xca\x6e\x0d\x6d\x4e" "\x07\x2c\x98\xf4\x54\x15\xd1\x3f\x0d\xce\xa1\x74\xf1\x62\xeb\xd0\x0b" "\x42\x26\x4f\x6f\xa3\xdc\xcd\x09\xf4\x10\x1d\xd2\x54\xe5\x44\x23\xb3" "\x0e\x06\x71\x3e\xcc\xfa\xcb\x6f\xfb\x38\xaf\xff\x92\x09\x80\xaf\x93" "\x8a\x4d\x78\xf4\xb9\xa6\xb5\xc7\x42\x4e\x91\x12\x1c\xda\x78\x91\x04" "\xee\x49\x0d\x25\x84\x3f\x16\x22\xbb\xa9\x32\x57\xcc\x23\xe4\x5c\xd7" "\xed\x42\xab\xdb\x99\x1d\x51\x80\x4e\x67\x4e\x50\x7d\xfd\x53\xb5\xab" "\x69\x44\xdf\x33\xf4\xf4\x94\xb9\x26\xf2\xce\xb3\x29\x55\x0b\x46\xe8" "\x2a\x93\x9a\xd8\x2b\x38\x5e\x66\x80\x9d\x7d\x4d\x36\x30\xb6\xf2\x2c" "\x2f\x41\xfd\xaa\x0f\xad\xee\xa0\x9f\xa4\xf7\x00\x58\x13\x64\x3c\x2d" "\x63\x07\xd5\x56\x89\xfa\xf6\xf6\x56\x32\x7a\xc5\x87\x2a\x3b\xd4\xc1" "\x13\x63\x90\x9a\x8b\x9f\x30\xe5\x40\x19\x93\xa0\xf6\xe1\xa9\xb4\x22" "\x87\x54\x26\x47\xd1\xe8\x6b\x02\xb7\xe3\x63\x19\x41\x46\x29\xac\x1f" "\x35\xe1\x45\x7f\x92\x2d\xa0\xc2\xde\x76\xc9\xe9\x79\x44\xef\xad\x0a" "\x3a\xd7\x8c\xda\x81\xc5\xb8\x27\x09\xd6\x96\xe8\x5b\xbf\x45\x95\xef" "\x96\x64\xa6\xaf\xf8\xcf\x96\x44\x6c\xb6\xc2\x65\x95\xf4\xeb\x65\x9d" "\x26\xc8\x46\x47\x1f\x65\x51\xdb\xb2\x4f\xc6\xc0\x3a\x01\xe3\x3e\xfc" "\xd5\x93\x94\x72\xb6\x87\xd3\x1b\xe9\xbd\x9b\xd1\xbc\xda\x45\xbd\x22" "\x36\xf0\x6c\x00\x00\x00\x00\x7d\x34\x8e\xbc\xb9\xd8\x10\xd4\xdc\x3d" "\x55\xbb\xe4\x05\x5c\xe9\xc4\x52\x67\xda\xee\xc7\xa7\xd8\xb4\x98\xf5" "\x07\xe9\x33\xcc\x02\xfb\x53\xc2\xc2\x8f\xa0\x9c\xe5\xad\xa5\xde\x14" "\x15\x30\x97\x61\xf6\x37\x8c\x79\x4f\x8c\xe2\x3c\x1f\x7a\xdd\x4f\x65" "\x28\x0a\xb4\x46\xea\x2d\x13\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\xd1\xa0\x31\x3f\xf6\x3b\xc4\xe4\x46\x36\x88\xdb\x1d\x6a\xc7\xf4" "\x59\x5a\x02\xc8\x93\x49\xa9\x73\xf1\x18\xd9\x36\xf3\x3e\xa1\x8e\x69" "\xd7\x73\x9f\x45\x32\xe1\xb8\x58\x0e\xf1\x25\xb4\x7c\xf5\xb4\x02\xb6" "\xf2\xbe\xff\xed\x6c\xc9\xaf\xe2\xb5\x48\xc4\xdb\xc7\x83\x63\x11\x88" "\x18\xd9\x47\x3f\x29\xd5\x24\x44\x68\x5c\x41\x62\x0e\xea\xeb\x1f\x87" "\x86\xe8\x7a\xea\xf2\x87\xfb\x9b\x63\xb3\x0e\x67\x61\x50\x75\x03\xdc" "\xd4\x7b\x64\xf0\xb6\x15\x79\x99\xc8\x2b\xd1\x51\xbe\xe0\xc6\x7f\x3e" "\x66\x42\x25\xbd\x91\x7b\x38\xae\xae\x1d\xa5\x52\x4e\xef\xef\x17\x72" "\xd7\x59\xdf\x9e\xc9\xb4\x19\x73\x83\xf9\xa6\x62\x17\xe1\x80\xe4\x34" "\xe6\x50\xdd\x56\x0a\xa3\xed\x42\xac\xdd\xd4\x4d\x6f\x45\x80\x7a\x3c" "\x63\xe1\x59\x29\xcf\xbe\xbc\x7e\xef\x1a\x31\x9d\x31\x47\xa6\xc0\x6b" "\xd9\x74\x16\x8a\xc6\x89\x39\x2f\xa8\x51\xeb\xdf\x52\x4c\xa2\x33\x11" "\x48\xff\x7e\x85\x5c\xcc\xc1\x06\x07\x4c\xa9\x21\x53\x73\x4d\x5c\x5e" "\x3f\x9e\xfc\x65\x92\xb0\x8e\x0c\x07\xc7\xb5\xd4\x2e\xc7\x14\x84\xbb" "\x2a\x4c\x0f\x42\x93\x13\x83\x69\xf3\x9f\x9f\xa4\xa9\xcc\x60\x7b\x42" "\xba\x61\x02\xf9\x18\xce\x4e\x76\xd6\x6f\xba\x45\x0e\x94\x0e\xd6\xa6" "\xa3\x01\xa0\xb7\x61\xa9\xcd\x84\x99\x62\xfa\xe5\x05\x9b\xda\x41\x9f" "\xd2\xa1\x70\xea\x38\x7c\x10\xa4\xad\xa5\x89\x3f\x38\x48\x60\x69\xef" "\x1b\xfd\xbb\x43\x2a\xb3\x22\xc8\x87\xd7\xa9\x4f\xa9\x67\x13\x58\x33" "\x15\x7b\xaf\xbe\xd3\xb4\x8b\xb2\x67\xfc\x3a\xa5\x6d\x1e\x5b\x66\x41" "\x7a\x67\x3b\x40\x88\x4f\xc9\x1e\xc9\x55\x8e\xab\x6a\x08\x22\x2d\xfe" "\x37\x76\x70\x95\xb2\xd9\x4c\xda\x88\x12\x90\xd6\x01\x71\x37\x59\x5c" "\xdd\x53\x97\x23\x53\xf4\x85\xad\xfd\xe8\x01\x5c\xac\x0e\x1a\xcd\x64" "\xca\x97\xd6\x70\x23\xf7\x5a\x54\xb1\xeb\xe5\x50\x53\x65\x2a\xd1\x62" "\x92\xa1\x5e\x79\xdc\x58\xba\x08\x0f\x79\x5f\x1a\x54\x8d\xa6\xf6\x69" "\xe5\xc3\x4a\xfc\x27\x2e\x5a\x32\xe8\x5d\x5f\x44\x97\x94\x31\xea\xb3" "\xfc\xd8\xd3\x3d\x54\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\x1f\x3f" "\x6f\x4b\x33\xad\xcb\xee\x66\x73\x6b\x4b\x35\xb5\xb9\x09\xbc\x7d\xdd" "\x03\xf1\x7f\x5f\x64\x36\x15\x6a\x56\xc7\xe7\x7e\x08\x08\x70\x3b\x37" "\x0f\x0c\xb4\xf0\x00\x74\x20\x0a\xe3\xe4\xea\x06\x11\xd5\x48\xf3\x45" "\x82\x84\x89\x03\xe4\x45\x9d\x0a\x18\xab\x9b\x11\x3e\xbc\x61\x4f\xaf" "\xe4\xbd\x03\xcb\x1a\x88\x43\xe5\x92\xf1\xb1\x02\xb1\xbb\x87\xf1\x3c" "\x50\xa1\xdc\x5d\xf2\x23\xe5\xbb\xcd\x06\xc5\x53\x93\xf9\xc0\xe0\x8a" "\xb6\x50\x9b\xbe\xd0\xdf\xed\xbf\x37\x30\x9c\x99\xbf\x1e\x1f\xc7\x51" "\x2a\xfb\x7b\xd3\x34\x65\x33\x56\x41\x9f\x8a\xa5\x7f\x12\x24\xa5\x4a" "\x85\xa3\x04\x16\x57\xfb\x50\x37\xdd\xa5\xb0\xf2\xe6\xa9\x67\x3c\xc0" "\xd5\x1b\x28\x95\x4e\xf8\xc0\xca\x82\xe6\x9d\x19\x87\x29\xb2\xc9\x84" "\xa0\x4b\x0f\x6e\xf9\x48\x67\x67\xf5\x92\x84\x61\xdf\x5b\x8f\x84\xe0" "\xb7\x90\xfa\x7d\x90\x88\xfd\xb7\xb7\xe6\xf0\x20\xd4\xea\xe4\x20\x15" "\x5f\x17\x39\x30\x74\x21\xfc\x3e\x9d\x4f\xfa\xff\xff\x24\x34\xf3\xd1" "\x67\xd2\x4b\xea\xd3\xc6\xce\xdb\x2d\xd4\x80\xd5\xc8\xb2\x1c\x0e\xdb" "\x06\x89\x3c\x1f\xb1\x8e\x9e\x71\x65\x25\xf1\x15\x05\x5a\x84\xda\xca" "\x13\x5d\x89\x72\x28\x03\x24\xa9\xff\xd4\xe6\x36\xc8\x72\x25\xc2\x51" "\x2e\xb3\xe0\xfe\x65\x97\x2c\x84\x36\x15\x36\xe5\x2a\x6e\xa6\x77\xff" "\xcb\x4b\xf8\xfa\xc2\x00\x9f\x24\xc0\x1b\x7c\x86\xc2\x03\xce\x90\x93" "\xdd\x53\xb1\x54\x11\x0f\x03\x3a\x25\x03\x47\x52\xdc\x85\x61\xed\x7b" "\xb7\x34\x3e\x06\x9b\xa1\xad\x6f\x1d\x74\x37\xb5\x84\xd2\xc2\x92\x08" "\x8d\x3d\x80\xe8\x83\x4a\xe8\x76\x0c\xc0\x21\x1c\xb0\x3f\x3e\xd1\x68" "\x13\x1e\xba\x4c\x8a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x19\xc2\xdb\xe8\x35\x23\xa5\x8f\x68\xe6\x6f\xa9\xfd\xf1\xd2\x87" "\x8b\xf2\xff\x52\x4e\x6d\xa7\xf9\x18\xe8\x7c\x1b\x1d\xe1\x7f\xf8\x07" "\x7b\xa2\x47\xfd\x54\x98\x31\x0a\xe5\x32\xb9\xbc\x6c\x58\x3e\xdf\xa9" "\x7f\x7a\x4c\x00\xcc\xe8\x55\xa2\x25\xdc\x01\x7a\xfc\x3c\x06\xe8\xa7" "\x2b\x62\xbd\xb6\x4e\x83\xcb\x6a\x31\x9e\xb5\x51\x34\x5c\xfb\x24\xaa" "\xa0\x2d\xdc\x4e\xc2\xda\xa9\x42\xdc\x6e\x23\x32\xd7\x24\xb1\x1c\x0d" "\x9c\x8f\xf4\xee\x94\x84\x99\x38\xf5\xd2\x31\xfd\xb5\x98\x4d\x54\x42" "\xb5\x64\xc0\x79\xfc\xe7\x0a\xc6\x20\xdc\xf7\x73\x96\x93\xbe\xca\x9d" "\xff\x66\xe9\x57\xdd\x2f\xc0\x3c\xe4\x62\xda\x31\xe7\xf7\xa6\x57\x11" "\x83\x87\x72\x7e\x85\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00", 5107); *(uint64_t*)0x20000090 = 0x20000100; memcpy((void*)0x20000100, "GPL\000", 4); *(uint32_t*)0x20000098 = 0; *(uint32_t*)0x2000009c = 0; *(uint64_t*)0x200000a0 = 0; *(uint32_t*)0x200000a8 = 0; *(uint32_t*)0x200000ac = 0; memset((void*)0x200000b0, 0, 16); *(uint32_t*)0x200000c0 = 0; *(uint32_t*)0x200000c4 = 0; *(uint32_t*)0x200000c8 = -1; *(uint32_t*)0x200000cc = 8; *(uint64_t*)0x200000d0 = 0; *(uint32_t*)0x200000d8 = 0; *(uint32_t*)0x200000dc = 0x10; *(uint64_t*)0x200000e0 = 0; *(uint32_t*)0x200000e8 = 0; *(uint32_t*)0x200000ec = 0; *(uint32_t*)0x200000f0 = -1; *(uint32_t*)0x200000f4 = 0; *(uint64_t*)0x200000f8 = 0; *(uint64_t*)0x20000100 = 0; *(uint32_t*)0x20000108 = 0x10; *(uint32_t*)0x2000010c = 0; res = syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x20000080ul, /*size=*/0x48ul); if (res != -1) r[5] = res; break; case 16: syscall(__NR_close, /*fd=*/-1); break; case 17: *(uint32_t*)0x20000040 = 9; syscall(__NR_bpf, /*cmd=*/0x1ful, /*arg=*/0x20000040ul, /*size=*/8ul); break; case 18: syscall(__NR_bpf, /*cmd=*/0x11ul, /*arg=*/0ul, /*size=*/0ul); break; case 19: syscall(__NR_sendmsg, /*fd=*/-1, /*msg=*/0ul, /*f=*/0ul); break; case 20: *(uint32_t*)0x20000240 = r[5]; *(uint32_t*)0x20000244 = 0; *(uint32_t*)0x20000248 = 0x32; *(uint32_t*)0x2000024c = 0; *(uint64_t*)0x20000250 = 0x20000140; memcpy((void*)0x20000140, "\xd5\x10\xfa\xff\xff\xdb\x67\x4c\x5a\xe4\x00\x0b\x00\x94", 14); *(uint64_t*)0x20000258 = 0; *(uint32_t*)0x20000260 = 0xf000; *(uint32_t*)0x20000264 = 0; *(uint32_t*)0x20000268 = 0; *(uint32_t*)0x2000026c = 0; *(uint64_t*)0x20000270 = 0; *(uint64_t*)0x20000278 = 0; *(uint32_t*)0x20000280 = 0; *(uint32_t*)0x20000284 = 0; *(uint32_t*)0x20000288 = 0; syscall(__NR_bpf, /*cmd=*/0xaul, /*arg=*/0x20000240ul, /*size=*/0x50ul); break; case 21: syscall(__NR_write, /*fd=*/r[3], /*buf=*/0ul, /*len=*/0x37ul); break; case 22: *(uint32_t*)0x20000080 = 1; *(uint32_t*)0x20000084 = 0x80; *(uint8_t*)0x20000088 = 0; *(uint8_t*)0x20000089 = 0; *(uint8_t*)0x2000008a = 0; *(uint8_t*)0x2000008b = 0; *(uint32_t*)0x2000008c = 0; *(uint64_t*)0x20000090 = 2; *(uint64_t*)0x20000098 = 0; *(uint64_t*)0x200000a0 = 0; STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 0, 1); STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 1, 1); STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 2, 1); STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 3, 1); STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 4, 1); STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 5, 1); STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 6, 1); STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 7, 1); STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 8, 1); STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 9, 1); STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 10, 1); STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 11, 1); STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 12, 1); STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 13, 1); STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 14, 1); STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 15, 2); STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 17, 1); STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 18, 1); STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 19, 1); STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 20, 1); STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 21, 1); STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 22, 1); STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 23, 1); STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 24, 1); STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 25, 1); STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 26, 1); STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 27, 1); STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 28, 1); STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 29, 1); STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 30, 1); STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 31, 1); STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 32, 1); STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 33, 1); STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 34, 1); STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 35, 1); STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 36, 1); STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 37, 1); STORE_BY_BITMASK(uint64_t, , 0x200000a8, 0, 38, 26); *(uint32_t*)0x200000b0 = 0; *(uint32_t*)0x200000b4 = 0; *(uint64_t*)0x200000b8 = 0; *(uint64_t*)0x200000c0 = 0; *(uint64_t*)0x200000c8 = 0; *(uint64_t*)0x200000d0 = 0; *(uint32_t*)0x200000d8 = 0; *(uint32_t*)0x200000dc = 0; *(uint64_t*)0x200000e0 = 0; *(uint32_t*)0x200000e8 = 0; *(uint16_t*)0x200000ec = 0; *(uint16_t*)0x200000ee = 0; *(uint32_t*)0x200000f0 = 0; *(uint32_t*)0x200000f4 = 0; *(uint64_t*)0x200000f8 = 0; syscall(__NR_perf_event_open, /*attr=*/0x20000080ul, /*pid=*/0, /*cpu=*/-1, /*group=*/-1, /*flags=*/0ul); break; case 23: syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0ul, /*size=*/0ul); break; case 24: *(uint32_t*)0x20000180 = 1; *(uint32_t*)0x20000184 = 0x80; *(uint8_t*)0x20000188 = 0; *(uint8_t*)0x20000189 = 0; *(uint8_t*)0x2000018a = 0; *(uint8_t*)0x2000018b = 0; *(uint32_t*)0x2000018c = 0; *(uint64_t*)0x20000190 = 0x1ff; *(uint64_t*)0x20000198 = 0; *(uint64_t*)0x200001a0 = 0; STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 0, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 1, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 2, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 3, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 4, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 5, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 6, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 7, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 8, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 9, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 10, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 11, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 12, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 13, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 14, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 15, 2); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 17, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 18, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 19, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 20, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 21, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 22, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 23, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 24, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 25, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 26, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 27, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 28, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 29, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 30, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 31, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 32, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 33, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 34, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 35, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 36, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 37, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 38, 26); *(uint32_t*)0x200001b0 = 0; *(uint32_t*)0x200001b4 = 0; *(uint64_t*)0x200001b8 = 0; *(uint64_t*)0x200001c0 = 0; *(uint64_t*)0x200001c8 = 0; *(uint64_t*)0x200001d0 = 0; *(uint32_t*)0x200001d8 = 0; *(uint32_t*)0x200001dc = 0; *(uint64_t*)0x200001e0 = 0; *(uint32_t*)0x200001e8 = 0; *(uint16_t*)0x200001ec = 0; *(uint16_t*)0x200001ee = 0; *(uint32_t*)0x200001f0 = 0; *(uint32_t*)0x200001f4 = 0; *(uint64_t*)0x200001f8 = 0; res = syscall(__NR_perf_event_open, /*attr=*/0x20000180ul, /*pid=*/0, /*cpu=*/0xaffffffffffffffful, /*group=*/-1, /*flags=*/0ul); if (res != -1) r[6] = res; break; case 25: memcpy((void*)0x200004c0, "\002;\345\b\000\000\234\000\000\000\000\000\000", 13); syscall(__NR_ioctl, /*fd=*/r[6], /*cmd=*/0x5452, /*filter=*/0x200004c0ul); break; case 26: *(uint32_t*)0x200000c0 = 6; *(uint32_t*)0x200000c4 = 0xb; *(uint64_t*)0x200000c8 = 0x200002c0; memcpy((void*)0x200002c0, "\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x18\x01\x00\x00\x20\x20\x70\x25\x00\x00\x00\x00\x00\x20\x20\x20" "\x7b\x1a\xf8\xff\x00\x55\x00\x00\xbf\xa1\x00\x00\x00\x00\x00\x00" "\x07\x01\x00\x00\xf8\xff\xff\xff\xb7\x02\x00\x00\x08\x00\x00\x00" "\xb7\x03\x00\x00\x69\x00\x00\x00\x85\x00\x00\x00\x06\x00\x80\x00" "\x95\x00\x00\x00\x00\x00\x00\x00\x56\x4b", 90); *(uint64_t*)0x200000d0 = 0x20000200; memcpy((void*)0x20000200, "GPL\000", 4); *(uint32_t*)0x200000d8 = 0; *(uint32_t*)0x200000dc = 0; *(uint64_t*)0x200000e0 = 0; *(uint32_t*)0x200000e8 = 0; *(uint32_t*)0x200000ec = 0; memset((void*)0x200000f0, 0, 16); *(uint32_t*)0x20000100 = 0; *(uint32_t*)0x20000104 = 0x4000000; *(uint32_t*)0x20000108 = -1; *(uint32_t*)0x2000010c = 0; *(uint64_t*)0x20000110 = 0; *(uint32_t*)0x20000118 = 0; *(uint32_t*)0x2000011c = 0; *(uint64_t*)0x20000120 = 0; *(uint32_t*)0x20000128 = 0; *(uint32_t*)0x2000012c = 0; *(uint32_t*)0x20000130 = 0; *(uint32_t*)0x20000134 = 0; *(uint64_t*)0x20000138 = 0; *(uint64_t*)0x20000140 = 0; *(uint32_t*)0x20000148 = 0; *(uint32_t*)0x2000014c = 0; syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x200000c0ul, /*size=*/0x90ul); break; } } int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x20000000ul, /*len=*/0x1000000ul, /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/ 7ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x21000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1, /*offset=*/0ul); setup_sysctl(); setup_cgroups(); const char* reason; (void)reason; if ((reason = setup_binfmt_misc())) printf("the reproducer may not work as expected: binfmt_misc setup failed: " "%s\n", reason); if ((reason = setup_usb())) printf("the reproducer may not work as expected: USB injection setup " "failed: %s\n", reason); if ((reason = setup_swap())) printf("the reproducer may not work as expected: swap setup failed: %s\n", reason); for (procid = 0; procid < 5; procid++) { if (fork() == 0) { use_temporary_dir(); do_sandbox_none(); } } sleep(1000000); return 0; }