// https://syzkaller.appspot.com/bug?id=45705298ba02f0e3f1b99cddfa115a58e0cfa3cb // 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 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 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) { struct ifinfomsg hdr; memset(&hdr, 0, sizeof(hdr)); 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); 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); 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_hsr(struct nlmsg* nlmsg, int sock, const char* name, const char* slave1, const char* slave2) { netlink_add_device_impl(nlmsg, "hsr", name); 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); 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); 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); 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); 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); 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 struct nlmsg nlmsg; #define DEVLINK_FAMILY_NAME "devlink" #define DEVLINK_CMD_PORT_GET 5 #define DEVLINK_ATTR_BUS_NAME 1 #define DEVLINK_ATTR_DEV_NAME 2 #define DEVLINK_ATTR_NETDEV_NAME 7 static struct nlmsg nlmsg2; static void initialize_devlink_ports(const char* bus_name, const char* dev_name, const char* netdev_prefix) { struct genlmsghdr genlhdr; int len, total_len, id, err, offset; uint16_t netdev_index; int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC); if (sock == -1) exit(1); int rtsock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); if (rtsock == -1) exit(1); id = netlink_query_family_id(&nlmsg, sock, DEVLINK_FAMILY_NAME, true); if (id == -1) goto error; memset(&genlhdr, 0, sizeof(genlhdr)); genlhdr.cmd = DEVLINK_CMD_PORT_GET; netlink_init(&nlmsg, id, NLM_F_DUMP, &genlhdr, sizeof(genlhdr)); netlink_attr(&nlmsg, DEVLINK_ATTR_BUS_NAME, bus_name, strlen(bus_name) + 1); netlink_attr(&nlmsg, DEVLINK_ATTR_DEV_NAME, dev_name, strlen(dev_name) + 1); err = netlink_send_ext(&nlmsg, sock, id, &total_len, true); if (err < 0) { goto error; } offset = 0; netdev_index = 0; while ((len = netlink_next_msg(&nlmsg, offset, total_len)) != -1) { struct nlattr* attr = (struct nlattr*)(nlmsg.buf + offset + NLMSG_HDRLEN + NLMSG_ALIGN(sizeof(genlhdr))); for (; (char*)attr < nlmsg.buf + offset + len; attr = (struct nlattr*)((char*)attr + NLMSG_ALIGN(attr->nla_len))) { if (attr->nla_type == DEVLINK_ATTR_NETDEV_NAME) { char* port_name; char netdev_name[IFNAMSIZ]; port_name = (char*)(attr + 1); snprintf(netdev_name, sizeof(netdev_name), "%s%d", netdev_prefix, netdev_index); netlink_device_change(&nlmsg2, rtsock, port_name, true, 0, 0, 0, netdev_name); break; } } offset += len; netdev_index++; } error: close(rtsock); close(sock); } #define 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) { char buf[16]; sprintf(buf, "%u %u", addr, port_count); if (write_file("/sys/bus/netdevsim/new_device", buf)) { 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"}, {"netdevsim", netdevsim}, {"veth", 0}, {"xfrm", "xfrm0"}, {"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_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); } #define MAX_FDS 30 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 = 0; 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_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: while (umount2(dir, MNT_DETACH | UMOUNT_NOFOLLOW) == 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, MNT_DETACH | UMOUNT_NOFOLLOW) == 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, MNT_DETACH | UMOUNT_NOFOLLOW)) 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, MNT_DETACH | UMOUNT_NOFOLLOW)) exit(1); continue; } if (errno == ENOTEMPTY) { if (iter < 100) { iter++; goto retry; } } } exit(1); } } static int inject_fault(int nth) { int fd; fd = open("/proc/thread-self/fail-nth", O_RDWR); if (fd == -1) exit(1); char buf[16]; sprintf(buf, "%d", nth); if (write(fd, buf, strlen(buf)) != (ssize_t)strlen(buf)) exit(1); return fd; } static void kill_and_wait(int pid, int* status) { kill(-pid, SIGKILL); kill(pid, SIGKILL); for (int i = 0; i < 100; i++) { if (waitpid(-1, status, WNOHANG | __WALL) == pid) return; usleep(1000); } DIR* dir = opendir("/sys/fs/fuse/connections"); if (dir) { for (;;) { struct dirent* ent = readdir(dir); if (!ent) break; if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) continue; char abort[300]; snprintf(abort, sizeof(abort), "/sys/fs/fuse/connections/%s/abort", ent->d_name); int fd = open(abort, O_WRONLY); if (fd == -1) { continue; } if (write(fd, abort, 1) < 0) { } close(fd); } closedir(dir); } else { } while (waitpid(-1, status, __WALL) != pid) { } } static void setup_test() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setpgrp(); write_file("/proc/self/oom_score_adj", "1000"); if (symlink("/dev/binderfs", "./binderfs")) { } } static void close_fds() { for (int fd = 3; fd < MAX_FDS; fd++) close(fd); } static void setup_fault() { static struct { const char* file; const char* val; bool fatal; } files[] = { {"/sys/kernel/debug/failslab/ignore-gfp-wait", "N", true}, {"/sys/kernel/debug/fail_futex/ignore-private", "N", false}, {"/sys/kernel/debug/fail_page_alloc/ignore-gfp-highmem", "N", false}, {"/sys/kernel/debug/fail_page_alloc/ignore-gfp-wait", "N", false}, {"/sys/kernel/debug/fail_page_alloc/min-order", "0", false}, }; unsigned i; for (i = 0; i < sizeof(files) / sizeof(files[0]); i++) { if (!write_file(files[i].file, files[i].val)) { if (files[i].fatal) exit(1); } } } static void execute_one(void); #define WAIT_FLAGS __WALL static void loop(void) { int iter = 0; for (;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); setup_test(); execute_one(); close_fds(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[1] = {0xffffffffffffffff}; void execute_one(void) { intptr_t res = 0; memcpy((void*)0x20000100, "/dev/net/tun\000", 13); res = syscall(__NR_openat, 0xffffffffffffff9cul, 0x20000100ul, 6ul, 0ul); if (res != -1) r[0] = res; memset((void*)0x20000000, 0, 16); *(uint16_t*)0x20000010 = 0x7132; syscall(__NR_ioctl, r[0], 0x400454ca, 0x20000000ul); *(uint64_t*)0x20001600 = 0x20000140; memcpy((void*)0x20000140, "\x3a\xa3\xb4\x10\xa6\x64\x8e\x00\x68\xc8\xb8\x58\x48\x22\xb8\xce\x5d" "\x9b\x1f\xcc\x1e\x9a\x06\x98\x04\xed\x37\x99\x9d\xdd\x7b\x56\x84\xc9" "\x37\xa3\xfa\xfd\xdf\x1f\x02\xb4\x13\x1f\x53\xd4\xf2\x27\xaa\xf3\xaa" "\x54\x0c\x46\xa9\xdf\x88\x67\xb9\xcc\x99\xac\x2f\xfc\x8d\x19\xa1\x28" "\xd3\xd4\x4e\xc4\x41\x24\x6c\x11\x5f\xb5\x2b\xe8\x26\xc3\x56\x50\x00" "\x75\xb3\xc8\x1d\xdd\x00\x46\xbc\xb6\xbb\x9b\x3c\xe1\xfa\xe7\x14\xda" "\x19\x87\x9b\x0b\xb7\xda\xe8\xab\x47\x54\x41\xfb\x67\x65\xcb\xd2\xb0" "\x0e\xd0\x75\x3a\x81\x56\x9c\xfd\x4a\xf1\x1b\xef\x1c\xc6\x27\x07\xa7" "\x09\x74\x10\xb3\x11\xbe\xb7\xeb\x57\xf4\xf5\x2a\xdb\xa0\x52\xfc\x45" "\x82\xe2\x42\xcf\x0f\x5a\xcf\xa7\xeb\xb7\x00\xdb", 165); *(uint64_t*)0x20001608 = 0x7ffff000; *(uint64_t*)0x20001610 = 0x20000380; memcpy( (void*)0x20000380, "\xa8\xe6\x05\x21\x97\x3b\x23\xac\x64\xd9\x77\x6a\x4e\x3f\x95\x1c\x80\x59" "\xce\xff\x67\x23\x10\x9e\x72\x3d\x1d\xf1\xf1\x66\x4b\x4c\x39\xcb\x00\x4a" "\x04\x40\x6c\xe5\xd0\x2a\x50\x53\xfd\x3a\x82\x55\xfc\x13\xe7\xdb\x21\x14" "\xe5\xf9\x4e\xcd\x14\xfc\xaf\x6d\x23\x45\x63\xea\x0c\x6a\x59\xf3\x92\x2b" "\xab\xe3\xb1\x13\xa6\xf1\x3f\xb4\x06\x0f\x87\xb6\x07\x39\x7f\x3b\x7a\xd5" "\x7b\x57\xf9\x67\x04\x25\xf9\x57\x9e\xf0\x87\x60\x53\x6c", 104); *(uint64_t*)0x20001618 = 0x68; *(uint64_t*)0x20001620 = 0x20000280; memcpy((void*)0x20000280, "\x69\x2f\xb2\x65\x5d\x75\x66\xe5\x1f\xb4\xc7\xa8\xd3\x42\x1c\x97\x57" "\xde\x9d\x4e\x3b\xe6\xfc\xbd\x28\x65\x25\x73\xbd\xf5\xe8\x99\x14\x3a" "\x7f\x03\x23\xf2\xa3\x0f\xd9\x23\xac\x79\x2b\xa0\x9e\x41\xcc\x36\xe3" "\xfd\x35\x7e\xa6\xe1\x34\xf2\x48\xb0\xc6\xd6\xa9\x10\xc5\x30\xa0\xb1" "\x0b\x47\x7f\x8c\x79\x4b\x8b\x32\xae\xb4\xfe\x29\x87\xb4\x07\xa9\x2b" "\x4e\xad\xb6\x88\xb5\x89\xa1\x24\x25\xe2\x06\xab\x2d\xd7\xd1\x8a\xfa" "\x93\x24\x61\x9f\x69\x44\xb2\x39\xc5\xd4\x4e\xac\x8c\xf1", 116); *(uint64_t*)0x20001628 = 0x74; *(uint64_t*)0x20001630 = 0x20000200; memcpy((void*)0x20000200, "\x65\xe7\x26\x8f\x39\xcd\x10\x42\x07\x16\xfa\xce\x5e\xe3\x09\x35\xa1" "\xc6\xa9\xac\x1f\x9e\x7e\xf6\x4d\x73\xac\x32\xdf\x42\xcf\x94\x93\x9d" "\x10\xce\xa7\xd4\x72\x2e\x14\xb9\x25\xb4\x6d\xb6\x5b\x58", 48); *(uint64_t*)0x20001638 = 0x30; *(uint64_t*)0x20001640 = 0x20000300; memcpy((void*)0x20000300, "\xf2\xc5\xd1\x88\x00\x1a\x91\xdf\x08\x4f\xf0\xb9\x7e\xc9\x7f\xbd\x58" "\x85\x64\x5e\xa6\x25\x6f\x9b\x5b\xcc\x47\xc7\x73\xae\x99\x68\x0a\xfc" "\x70\xae\x9f\xe9\x10\x67\x08\xb8\xc8\xae\xde\x43\xe6\x3d\xcb\x98\x06" "\xc6\x22\x93\x8b\x4f\x25\xe6\x8b\x86\xce\x99\xe2\x29\x13\x38\x9a\x51" "\x45\x4b\x07\xba\x6d\x49\x2b\x48\x2a\xe7\xfa\xf9\x05\xaf\x94\xb4\xe6" "\x3a\xfe\x2a\x68\x63\x6a\xda\xf6\x56\x46\xba\x1b\x35\xcc\xd1\xf0\x10" "\xf0\xce\xa1\x91\x5b\x5d\xe6\x76\xd8\x3f\xeb\x5b\x5c\xbe\x1a", 117); *(uint64_t*)0x20001648 = 0x75; *(uint64_t*)0x20001650 = 0x20000080; memcpy((void*)0x20000080, "\x78\x87\x2b\x96\x4c\x8b\x9e\x62\x96\xe2\x80\xca\x5a\x3b\x86\x68\xb5" "\x41\xdc\x13\xb1\xbc\xb7\x87\xc7\x6c\x97\x0d\xe6\xb5\x48\x1b\xe6\x4e" "\x13\xd1\x8f\xe2\x4e\xd7\x81\xed\xeb\x6a\x8b\xba\xb7\x29\xbe\xa1\x9b" "\x6a\x00\xb5\xd4\x9b\x03\x5a\x8f\x4a\xd4\xca\x48\x22\xba\xa0", 66); *(uint64_t*)0x20001658 = 0x42; *(uint64_t*)0x20001660 = 0x20001380; memcpy( (void*)0x20001380, "\x46\x54\x65\x30\xdf\x26\xed\x5c\x86\x01\xa8\x0d\xf6\xd4\x3e\x0e\xb3\x77" "\x35\x91\x90\xee\xa6\xe3\x1a\xe1\x95\x55\x6c\x79\x95\x30\xfd\xff\x94\x56" "\x8b\xc7\xe6\xb1\x6a\xda\xeb\x48\x92\xa0\x07\x76\x46\x01\x7c\xd5\x94\x45" "\x62\xd4\x46\x4e\xe8\x5f\xfb\xfc\x20\xcf\xdb\x50\x54\xcb\x4d\xe4\xb5\x6c" "\x15\x29\x94\x3e\x3c\x09\xc2\x12\x32\x2f\x8c\xbd\x47\x06\xcd\xef\x66\xcb" "\xa0\xaf\x7d\x63\x62\x23\x9c\xc7\xca\xae\x74\x74\x81\x24\xcd\x2c\x16\xa4" "\xcf\xdc\xfb\xd9\x32\xa6\x85\xbf\xfe\xf2\x9b\x89\x40\x3b\x0c\xac\x8b\x9b" "\x0b\x7e\xed\x31\x8c\x9e\xb5\xac\x93\xc1\xd8\x3b\x57\x3b\x7a\xaa\x8c\x9b" "\x3a\xa6\xa6\x53\xc2\x58\x98\xa2\x52\x2d\x95\x53\x42\x9b\x35\xcf\xd6\xa0" "\x56\x2f\x47\x7d\xaa\x76\x45\x3e\xab\xa0\x81\x8a\xdf\xa4\x4c\xb1\xce\xda" "\x84\xfd\x6b\x9d\x90\x72\xcd\xca\xf6\x40\x12\x29\x33\x2e\xf4\xc7\xc8\x3f" "\x4d\xbf\x8f\x21\xe1\xdd\x6e\x76\xc9\x04\x4b\x7f\x86\x21\x0f\x04\x46\xe8" "\xd4\x4d\xe0\xdd\xcb\xd7\xf2\xea\x0e\x71\x65\xc1\x74\x4c\x79\xe6\x95\x3a" "\x6b\x2f\x74\x7a\x38\x35\x9b\xce\x31\xa0\xf0\x27\x35\x76\xe3\x7f\x1b\xb1" "\xad\x39\x11\x68\x4f\x84\xba\xe6\xc2\x64\xbd\x39\x8e\x8d\xb4\x4a\x30\x7e" "\xe5\x09\x3a\x2b\x8f\xe3\x9d\x45\x6d\xdb\xdb\x2f\x37\x05\x91\x61\x3d\x18" "\x4b\x3b\xb5\xd6\x5d\xb9\xa8\x2d\xc3\x1b\x77\xd6\x81\x79\x53\xc0\x1f\x76" "\x9c\xc5\x85\xba\x2b\x27\xec\xc8\x4d\x90\x7a\x42\x77\x7e\xf2\x65", 322); *(uint64_t*)0x20001668 = 0x142; *(uint64_t*)0x20001670 = 0x20001200; memcpy((void*)0x20001200, "\x13\xa4\xd1\xac\x8e\x8f\x72\x8b\xf0\x31\x1d\x4d\x8a\xb1\x1a\x6e\xea" "\x2d\xe2\xbf\x9d\xbf\xa6\x92\xe0\x47\x4f\x89\xca\x85\x16\x2a\x4f\x1e" "\x09\xa4\x21\xd1\xd1\xd7\x2c\x64\x76\xb4\x9d\x35\xda\x40\x5b\x87\x27" "\x01\x05\xf7\x22\x43\x0e\x2b\x51\xf7\x8e\x6f\x45\xc2\x97\xec\x24\xe5" "\xa9\x2a\xd2\x17\x6a\xd5\x66\xbe\xeb\x16\xa3\xb6\xe5\x91\xf5\xc2\x8e" "\x64\x7b\x6e\xe2\x77\xa7\x6a\x48\xec\x9a\x67\xc3\xf0\x06\x02\xe7\x6c" "\x89\x3e\xae\xaf\x20\x0b\x48\x6a\x6f\x7f\x69\xae\x2a\xee\xa2\x7f\xdf" "\xf5\xe9\x6a\x8f\x1b\x17\x01\x4f\x20\x69\x9c\x44\xd7\x9d\xab\xe1\x2b" "\xa8\xe5\x71\xf6\x87\xaa\xd6\xae\xac\x7a\xd9\xed\xd5\x0e\x87\x71\xc1" "\x80\xac\x31\xe9\x77\x4e\xe7\xd6\x24\xaf\xbd\x31\x8d\xe7\xb0", 168); *(uint64_t*)0x20001678 = 0xa8; *(uint64_t*)0x20001680 = 0x20000580; memcpy( (void*)0x20000580, "\x8a\xea\x20\x76\x65\xef\x47\x44\x1c\x62\x71\xf7\x76\x9b\x7b\x9d\x53\xda" "\xfd\x94\xef\x92\x8d\xae\x83\x49\x43\x8b\x5c\xfb\x56\x92\x8b\x49\xa9\xd6" "\x58\x90\xd9\xf5\xf0\x72\xc7\xbc\x18\x43\x00\x66\xc8\x37\x9d\xe7\x74\xd2" "\x98\xd1\x6f\x80\xcc\xa2\x3e\x12\x58\x91\xdc\xf5\x94\xc7\x0a\xc2\x56\x04" "\x7b\x84\xb7\x88\x3b\xc7\xfa\x75\x88\xd9\x11\x9c\x9f\xdb\x52\xa4\x5e\x7d" "\xe9\xe9\xfd\xec\x6e\xeb\xef\x5a\x2f\x9e\x1b\xfe\x6d\x5d\xb9\x29\x7f\x1c" "\x5b\x39\x59\x3e\x63\xe9\xe7\xb8\x6c\x66\x23\xe2\x1f\x47\x9d\xd9\x38\x72" "\xe8\x96\x40\x42\x49\x4e\x96\xe7\xa7\xa3\x6e\x02\xc7\xf6\x41\x72\x87\x31" "\xbd\x7c\x10\x24\x74\xa9\x65\x84\x98\xb0\xa5\xe1\x32\xab\x16\xe4\x1a\xa5" "\x6c\xb3\x2b\xff\x63\x85\x2b\xab\xcc\xbe\x5e\x67\x90\xbc\xf1\x45\xba\xaf" "\x85\xe0\xf8\xca\xda\xf1\xb7\xf6\x83\x28\x4f\xc1\xd3\xb3\x73\xd3\x95\x60" "\xc8\xa0\x9b\xb6\xcd\xa7\x87\x68\x16\x13\x8a\xe5\x3e\xc1\xb6\x3a\x85\xe4" "\xf7\xc0\x93\x90\xcf\xc3\x8b\xfb\xeb\x79\xfe\x78\x27\x5f\x55\xf7\xa1\x95" "\xb8\x66\x4a\x6e\x21\x6d\x9c\x8c\xd3\x35\x74\x10\x42\x5c\x59\xb8\x2f\x4a" "\x0d\xd9\x76\xc2\x89\x44\x9a\x33\x05\x6f\x9d\x91\x46\xca\x17\x42\x2f\xcb" "\x37\x13\xa5\x5b\x7a\x02\xc4\x3c\x71\x35\x30\x87\xed\x2b\xae\xa0\x5a\x1d" "\x38\xbe\xda\xb2\x68\x8a\x95\xe7\x3e\xce\x1d\x0d\xd4\x7f\xb6\xf7\x40\xa4" "\xcf\xf0\x2b\xbd\xc0\xb9\x1b\xdd\xcf\x4d\xbd\xc0\x50\xf7\x3a\x07\x45\x50" "\x5f\xa9\x64\x29\xbf\x15\x64\xe7\x83\xd4\x67\xc4\x0b\x71\x26\x92\xc7\x9e" "\x18\xe2\xcb\x62\x35\x22\x62\x26\x0f\x8c\x15\x8f\x4f\x58\x9d\x1b\xb0\xe7" "\xea\xc0\x52\x30\x37\xe6\x4c\x69\xe8\x0f\x2a\x0b\xef\x70\xc9\xba\x41\x6f" "\x96\x94\x45\xf0\x77\x95\x48\x26\xfc\x1a\xe8\xf9\x23\x6b\xe9\xec\x37\x03" "\xa4\xd8\x21\x66\xfa\xa2\x65\xe5\x16\x61\x96\x1b\x18\xef\x26\x95\x23\x58" "\x17\x57\x0d\xb8\x55\x42\xcb\xf9\x68\x64\x76\x33\x39\xe5\x1c\x3e\x58\xa1" "\x7f\x25\x23\x5a\x51\xe1\xe4\x1a\xd5\x33\x4d\xe0\x62\x2f\x14\x1f\x4c\x63" "\xd0\xaa\xe0\xa3\x2d\xb7\x67\x9a\x97\x49\xd7\xcb\x78\xd8\x8b\x58\xc9\x9d" "\x22\xb3\x6a\x6c\xc2\x6c\x88\xa5\xd3\xec\xde\xca\xb0\xc0\xbf\x7f\x1c\x3e" "\x62\x86\xea\xee\xe2\xd7\x9e\xfb\x15\x82\x89\x5a\xbf\xc0\x10\x14\x83\x3a" "\xa1\xcb\x67\xcf\xd1\x20\xd4\xe0\x58\xb3\x2f\x8a\x1a\x05\x05\x05\xeb\xbd" "\x33\x9d\x2c\x85\x81\xe1\x0b\x75\xde\x01\xf7\xf6\x76\xa0\x78\xb3\x54\x55" "\xf0\xdf\xeb\x43\x5b\x10\xcb\xfa\x6c\x73\x66\x5f\xd7\xaf\x66\xe2\x15\x18" "\x2f\x75\x34\x3a\x0e\xfa\x1c\x04\xcf\x6c\x85\xea\xaf\x49\xb6\xba\xf0\xac" "\x7e\xea\x7a\x7d\x9c\xa5\x97\xae\x8e\x2a\x65\x40\x0e\x3d\x6d\x81\xe1\xb2" "\x55\x2d\x26\x83\x59\x21\x5a\x4c\xfd\x15\x38\x48\x66\xf2\xae\x2c\xe7\x8b" "\x81\x0f\xe3\x35\x44\x3c\x59\xac\xbd\xde\xc3\x62\x66\x12\x24\x3e\xea\x2a" "\xca\x34\x30\x2d\x4c\xae\x2b\x8e\x78\xd7\xb2\x92\xe6\x82\x9b\xc8\x65\xba" "\x2c\x08\x2b\xae\xd8\x46\x56\x40\xcc\xe5\x0d\x71\xec\x80\xca\x93\xec\xb6" "\x8e\x76\x16\xfd\x6a\xfe\x5b\x8f\x6a\x70\xa8\x6c\x65\x11\x9f\xcf\x77\x61" "\x5c\x1d\xce\x9f\x31\x1f\x55\xf4\x1e\x1d\x9e\xc7\xe1\x5f\x1c\x37\xd1\x8b" "\x2a\x48\xfc\xaf\xc4\x3f\x58\xbf\x3f\x9d\x44\x54\x4f\xa8\x19\xbb\x6e\x77" "\x09\x33\x1c\x3d\x11\x04\x86\x4d\xff\x05\x73\xd0\xbb\xc0\x62\xb8\x1a\xd5" "\xa7\x60\x85\xca\x57\xd8\x6e\x8a\x63\xca\x18\x5b\x1d\x9c\x47\xc1\xe4\x33" "\x28\x82\xc2\xfa\x36\x8f\xcf\x14\x82\xb5\xdf\x2f\x28\xf6\x0d\xeb\xc0\x74" "\x99\xaf\xe6\x6d\x89\xc5\x36\x61\xdc\xc6\x25\x12\x62\xb5\x6a\x13\xd0\xe0" "\xf6\xa2\xb4\xb7\xc6\x7b\x46\x55\x94\x7e\x49\x73\x62\xc0\x97\x11\x57\x46" "\x5b\xdb\xbe\x06\xf3\x76\x28\x99\xd1\x82\x34\xf1\x57\x5e\x1f\x6b\x3f\x36" "\xa6\xa0\x14\x1b\xef\x33\xb2\x36\x5a\x71\xfc\x70\x02\x3d\x51\xfa\xb8\xd7" "\x27\x8d\x39\x52\x20\xee\x8e\xdf\x02\xf0\x66\xbe\x74\x72\x1a\x85\x00\xf7" "\xc6\x7b\xe6\x5b\x9c\xc4\x15\x9f\xec\x72\x8f\x2c\xe0\x70\x5b\x0c\x4e\x29" "\x2e\xac\xc7\xf2\x44\x13\xbc\x31\x68\x07\x4d\x17\xfb\xfc\x21\x41\xc5\x8c" "\xc9\x80\x12\x08\x03\x4e\x3b\x20\x2e\xe1\x85\xb8\x7b\x82\x82\x11\x40\x5c" "\x81\x81\x98\xfb\x56\xe8\x6f\x29\x3e\x91\x48\x11\x36\x6c\x1b\x50\xaa\x8a" "\xa9\x50\x9d\x12\x4a\x7e\xc1\x75\x6f\x82\x22\x31\x0e\xc0\x4f\x31\x73\xd5" "\xf2\xda\x88\x6b\xaa\xe3\x2f\x80\x78\xf3\x10\xcf\x04\x88\x87\x34\x90\x54" "\x1d\x1d\xf4\x13\x58\x26\xba\xb3\xaf\x22\x79\x80\x0d\xda\xe9\x94\x99\x91" "\x51\xb6\x9d\x05\x4d\x05\x36\x35\x6f\x6f\x39\x37\x09\x18\xa9\xdd\x27\x5c" "\x5a\x80\xba\xbe\xc1\x1b\xe6\x6f\xc8\x95\x1f\x86\x23\x2f\xb3\x2b\x55\x9d" "\x04\xb0\x2d\x91\xe6\x39\x2e\x70\x74\xec\x52\xdb\x56\x5e\x54\x4b\x50\x5f" "\xcd\xa4\x8e\x6f\xe2\x33\x4e\xeb\xf4\x4a\x80\x28\x2a\xf5\xbd\x43\x58\x98" "\xca\x37\x7a\x8d\xec\x8b\x82\x3e\x53\xd2\xae\x5e\x1c\x6c\x26\xcc\x2c\x59" "\x7d\xe0\xeb\x2f\xc8\x9c\xd1\xa4\x36\xe8\x18\xee\xc0\x97\x78\x42\x4c\x01" "\x42\xde\x31\xbb\x23\x9e\x75\xaf\xf3\xc3\x4a\xdd\xac\x9d\x3b\x69\x0c\x22" "\x1a\x8c\xb8\x7f\x40\x69\xdc\x3b\xf4\x94\xe4\xed\xae\x9a\x5c\xa0\xf8\x9b" "\x67\x0b\x6d\xa4\x7d\xdd\x52\x12\x65\x8d\x53\x40\xc8\x7f\x0c\xcc\xb3\xb6" "\x1c\x19\x23\x9a\x20\x2e\x52\x1c\xc3\x23\x14\x7d\x20\x7d\x8d\x2f\x36\x2f" "\x3c\xe1\x91\x98\xed\x98\xf2\xb3\x98\xf1\xda\x1e\x8e\x04\xa3\xf5\x00\x1f" "\xb7\xd7\x0b\x10\xab\xfd\x3c\x65\x26\xdd\xaa\x1f\x43\x9d\x3e\x5c\xf0\x74" "\x71\x05\xd7\xa6\x65\xd6\x5a\xb1\x71\x70\xa1\x57\x0d\xa3\x40\xf2\xf6\x93" "\x6e\xcd\x82\xaf\xb8\x4b\xce\x11\xf6\x53\xbf\x63\x1e\xda\x04\x35\xb6\xd4" "\xe3\xbb\xe2\x95\xf4\xa7\xa5\x3e\xa9\x55\x7b\x15\xdc\xa6\x89\x38\x88\xc2" "\xdb\xef\xd2\x1d\x9c\xab\x77\x3a\x86\x01\xc8\x5b\x26\xc8\xad\x1f\x15\x13" "\xdb\x82\xec\xc5\xf1\x62\x2b\x27\x2d\x86\x3f\x3f\xf6\x7b\xa4\xf1\xcf\xe4" "\x4b\xaa\x91\x22\xcd\xcc\x58\xc8\x99\x4a\xa7\x45\x77\x7d\x23\x53\x0d\x19" "\x8b\xa8\x1e\x0c\x42\xd3\xc4\x32\xdc\x67\xa7\x63\xc1\x8a\x5c\x47\x33\xce" "\x48\xdf\xe5\xc9\x3d\xee\x5e\xa7\x4c\xe4\xf6\x6e\xa8\x56\xbf\xa1\x36\x7d" "\xa4\x9b\xe3\xe1\xaa\x03\x8a\xe6\x39\x19\x65\x1b\x1b\x41\x70\x82\x92\xae" "\xd1\x1c\x15\xc5\x93\x10\xeb\x4b\x94\x82\x9a\xb4\x37\xe4\x8d\x93\x0a\xc4" "\x2f\x42\x84\xf6\x52\xdd\x92\xa3\x1e\x47\x4e\xc4\x74\xda\x90\x62\x52\x22" "\x1c\x3f\xf1\xfc\x8a\xb6\x18\xdf\x9d\xe9\x23\xbc\xd3\xae\x1c\x86\x86\xff" "\x43\xdb\x50\xee\x9b\x58\x8c\x78\x8c\x71\x87\x03\x59\xba\x1e\x35\x98\x7c" "\x63\xe9\x65\x96\x53\x8d\x08\xef\xd5\x44\xad\x50\xc9\x01\xac\xc7\x56\xc3" "\xe4\x8e\xff\xb9\xc8\x71\xcf\x20\x70\x56\xeb\x26\xd4\x70\x9a\x29\xf8\xdb" "\x21\x05\x13\x5e\x78\x66\xd3\x46\x46\xb5\xbd\xbf\x99\xd0\x04\xd4\x96\x85" "\x05\xb2\xc5\xd6\xd5\xcf\xc6\xb3\x48\xef\x53\xbb\xe0\x88\xe4\x31\xe2\x07" "\x84\xf1\xf4\x11\x9d\x68\x4e\x6f\x29\x28\x50\xe9\xb2\xfd\x96\x74\xa2\xdf" "\x21\xf7\xeb\x19\x80\x1a\x2f\xd2\x17\x92\x8a\x30\x8b\x71\xac\xc4\xda\xf8" "\x9e\xd7\x89\x4a\x04\x0e\xf6\xff\x23\x7a\x58\xa1\x5b\x31\x1a\x7e\xe7\x4f" "\xd4\xfe\x65\xc3\x9d\xa2\xf1\xd2\x54\xe0\xfc\x29\x9e\xc5\x62\x6c\x90\x7b" "\x7a\xc7\xcc\x3a\xca\x97\x8d\x4f\xad\xad\xc6\x75\xf9\xf8\x19\x5f\x90\xaa" "\x4c\x69\x03\xb7\x4e\x1f\x00\x46\x07\x07\x85\x73\x41\x51\xef\x62\x14\x81" "\xbd\x1c\xed\x6c\x30\x03\x67\xcd\x33\x3e\x11\x8e\xb6\x69\xcb\x49\xd2\x57" "\xbc\xc0\x1f\x45\x09\x68\xa0\xea\x6f\x40\x97\xe4\xe1\x67\x58\xc6\x53\x6f" "\xc6\x58\xb0\x24\x8d\x05\x1f\x7d\xd3\x4f\xe7\x77\xdf\x19\xfc\xef\x68\x7c" "\xee\xd5\x60\x70\x11\x9f\x5b\xa6\x22\x3e\xab\xca\x43\xa1\x9c\xbf\xde\xe5" "\x23\x57\xa3\x79\xc3\x69\xdc\x5c\xef\x04\xba\xd9\x72\xca\xe1\x8b\x76\x42" "\xd3\x0d\x2b\x56\xac\xaf\x74\x00\x2a\x44\x59\xe2\x66\xc7\xdc\x81\x81\xec" "\x30\x33\xff\xd9\x23\xe4\xa7\x76\x0c\x2b\xc0\x68\xf2\x52\x32\x41\x15\x17" "\x07\x4a\xed\x86\x93\x67\x9e\x40\xe5\xdf\x13\xfa\x6c\xda\xd9\xbd\x6b\x24" "\x02\xe8\xa1\xc9\xd6\xd9\x54\xf5\x4c\x54\xe3\x7e\x1e\x8f\x9d\x71\x21\xd2" "\xc9\xd5\xba\x1c\xe3\xcf\x30\x2b\x6c\xf1\x65\x29\x48\x07\xc1\xbd\x0e\x42" "\x71\xde\x45\x47\xd4\x95\x38\xc4\xb8\x6e\x2f\x07\x06\xfc\x36\x63\x18\x12" "\x9a\x35\xa9\x0f\x47\x2b\xa2\x12\xb2\x37\xf2\x19\x0d\xc6\x6e\xde\xe1\xd2" "\xca\xb5\x60\xcb\x51\x24\x26\xbc\x7c\xf5\x08\x0b\xb5\xdf\xe4\x81\x5b\x57" "\x13\x36\xba\x23\x1d\x48\x4f\xa7\x3e\x16\x88\x36\x6f\xa2\x65\xcb\x16\xb5" "\x0a\x07\xe4\xd2\x6a\xcc\x13\x75\xe7\xae\x66\x1d\x1a\x60\xf6\x2e\x16\xe0" "\xc5\x3f\xa8\xea\xa3\x2d\xac\x27\x7e\x0b\xbf\x02\x22\x5c\x38\x48\x8c\x99" "\x15\x2a\x1f\x55\x0a\xc6\x8b\x81\xe5\xc4\x3e\x7d\x59\x23\x8d\xff\x74\x9b" "\x99\x18\xa1\xa3\xc0\x58\x87\x4f\x8f\x7c\xc4\x06\x1e\x2f\x56\xc5\xe2\x3a" "\xde\xc6\x24\x3a\xba\x56\xdf\xb9\xf5\x1a\x48\x59\xbc\x50\x65\x27\x82\x47" "\xc2\x68\xcb\x5c\x71\x08\x95\xdf\xaa\x4c\xdf\x82\xb3\x8b\xf6\x88\x8f\x75" "\x9c\x61\x8e\x68\x8f\xc6\x0b\xe4\x94\x01\x93\x35\x08\x88\x24\xeb\xbe\x2f" "\x5f\x14\x90\x4f\x7a\x4d\x9d\x98\xbe\x37\xd8\x5f\x4d\xdc\xa7\xe3\x4e\xbc" "\xf8\x2d\xf7\xa4\x34\x11\x42\x67\x16\xbb\xc7\x6c\xde\x56\xd5\xbc\xc8\x75" "\x15\xf8\x9c\x8e\x5a\x28\xcc\x2f\x94\x73\x2b\xe4\xd0\x46\x68\x83\x26\xf0" "\xff\x2a\xc1\x9e\x19\x67\x6d\xad\xd1\xdc\xf2\xc3\xb5\x4a\xb8\x47\xc1\x89" "\x2f\xdd\x62\xe1\x35\x30\x6e\xa9\x06\xd3\xee\xb0\x49\x50\x0d\x1a\x5b\xae" "\xc9\xeb\x59\xe1\xea\x67\xce\xe0\xfb\xa6\xe6\x49\xbd\xf7\xcc\xd3\x9d\x43" "\xad\xa8\x86\x12\xa5\xb4\x87\x32\xad\x0b\xed\x5f\xfd\x8c\xfd\xa9\xf1\x81" "\xe9\xa9\xc7\x3d\x5e\x0a\x0d\xcf\x46\xe6\x1b\xe0\xf6\xa9\x2d\x5a\xbb\xe6" "\xe6\x46\x88\x22\x99\x6f\x02\xf6\x3d\xc0\x39\xc2\xa6\x04\xf4\xa4\xab\xfb" "\x3d\x0d\xe0\xe9\xb9\x01\x8b\xfe\x5f\xc6\xa6\x66\x5a\x94\x01\x87\x20\xd6" "\xea\x7d\x6b\x6a\x0b\x1c\x7e\xa9\x8c\xee\xed\x76\x3f\xb8\x45\x25\x5d\x57" "\x97\x01\xea\x46\xc6\x68\x19\xba\x50\xa0\xae\x1f\x26\x10\x70\x22\xe6\xa5" "\xe5\xe3\x80\xe5\xce\xa9\xad\xfb\xa7\xce\x1c\x09\x9b\x06\x76\xaa\xbd\x96" "\x2a\xe9\x15\xf5\xa6\xdd\xea\x27\x72\x60\x28\x7c\xa3\x9b\x42\xd2\xd1\xff" "\xf0\x30\x5f\x0b\xa1\x25\x4d\x71\x2e\x63\xaa\xe8\x71\x59\x8e\xb9\xac\xb2" "\xf0\xde\xad\x32\x63\x77\xc7\x5a\x66\x9a\x87\x27\xb3\xc6\x34\xae\x4c\xb9" "\x83\xa9\x63\x1b\x6c\xa2\x6e\x77\xb2\xdf\x26\xf4\xa0\xeb\xc4\x82\xd0\x99" "\x25\xa5\xd1\x05\xfc\x57\x67\xcc\xf3\xad\xbb\x0b\xb5\xff\xf2\xfc\x9d\x15" "\x33\x9a\xf1\x2a\x6e\x1b\x80\x80\x2f\x49\x2e\x53\xc9\x23\xf7\xb4\x23\xdb" "\x2b\x68\xff\x3b\x09\x23\x4a\x28\x82\xa0\xea\x1b\xea\xf5\xfb\x37\xd6\xa0" "\x81\xfa\xef\xaf\xcb\x6d\xdb\x57\x41\xa8\x9d\x67\xcb\xe8\x32\x5e\xc0\xa3" "\xac\xf1\x39\xfa\xfc\x6a\x91\xc3\x44\x25\xa3\xcf\xdd\xb6\x34\xb7\xa9\xe0" "\x79\x21\xac\x56\x9b\x2d\x67\xa6\x12\xcf\x8c\x55\x29\x8d\xbe\x3b\xf0\x02" "\xf0\xf3\xaa\x9e\xb4\xb7\x2a\x9f\x6c\x39\x59\x56\xd3\xd4\xf7\x50\x14\x3b" "\xcf\x4d\x0d\xf0\x45\xd2\x03\xc7\xc8\xfa\xdd\x40\x99\x71\x1b\xbb\x5f\x52" "\xac\x47\x92\x67\x73\x73\x75\xc0\xfc\x63\x2b\xe7\x46\x01\xac\xf9\xdc\x63" "\x6e\xad\xff\xd5\x18\x72\x7c\x35\x0a\x7f\x86\x67\x56\xb9\x26\x0a\xe2\xda" "\xee\xfa\x1a\xcd\x92\xe7\x02\xe8\x09\xa3\x2a\xbe\xaf\xe1\x48\x44\xf0\x19" "\xd8\x6a\xbe\xa9\xf5\xd4\xf8\xc9\x3a\x23\x70\xfe\xf9\x3d\xa7\xc3\xf0\x4d" "\x99\x5d\x80\xd6\xf4\x9d\x89\xfb\x49\xda\x71\xa2\xfe\x43\x00\x12\xfd\x4f" "\x11\x34\x01\x7f\x5a\x71\x38\x82\xa6\x1e\x1f\x49\xd4\x66\xee\xd7\x01\xee" "\x05\x2c\x73\x78\xc4\xab\x75\x29\xf3\xd4\x9e\x35\x27\xe8\x5d\x6b\x48\x35" "\x8b\x65\x79\xcf\xf1\xb0\x87\xaf\xe2\x5d\x54\x83\x22\x57\x6c\x43\x67\x82" "\xc3\xa9\xf9\xc7\x9c\x84\x60\x76\xa4\xa5\x6b\xed\x79\x8e\x67\x59\x73\x71" "\x01\xc1\x73\xea\x9f\xd8\x9b\x57\x00\xf1\x0b\xd1\x5d\xe3\x49\xe1\x99\x30" "\x49\x19\x07\x97\xb5\xb7\x1b\xaa\xc4\xb1\x13\x0a\x1d\xb3\x5f\x68\x77\x8c" "\x87\x8d\xd2\x41\x65\x65\xdf\xcd\xb1\xf9\x47\x6a\x16\xa3\xf9\x9e\x55\x4e" "\x1f\x16\x8d\x4a\xfe\x9f\x1a\x50\x77\x20\xee\xd3\x58\xbc\x33\x8b\x6f\xf3" "\x6b\x5f\xab\xf7\xc7\x98\x4f\xfe\x07\x37\xb9\xc7\xe7\x23\x41\x2c\xb6\xe2" "\xb7\xe3\x1c\xcb\xf4\xf3\x39\x02\xca\xcf\x9a\x65\x3d\x8b\xe8\x20\x84\xc0" "\x70\xe7\x85\x59\x52\x7f\xc6\x70\x00\x72\x6a\xee\xe4\x14\x90\x0d\x3f\x0a" "\x04\xe9\x32\xb4\x94\x1a\xb6\x0e\x1b\xaa\x90\xc6\x65\x6c\xad\xde\xdc\xbf" "\x7a\xe5\xd1\x2c\xba\x54\x8f\x39\xec\xf6\x8d\xb5\x9f\x67\xcb\x90\xcb\x02" "\x46\x7c\x18\x37\x30\x65\x0f\x50\x68\xf9\x51\x5a\xfa\x5a\x7c\x65\xa8\xb3" "\xe0\x6f\xf6\x25\x4c\x6e\x4c\x34\x56\xce\x20\xa6\x32\x09\xa3\xe9\x8a\xc6" "\x7b\x17\x09\x62\xd4\xb0\x9f\x81\x82\xa8\xa4\x8d\xc3\x05\x2d\x55\x4b\xbc" "\x81\xaf\xea\xac\xfa\x8f\x82\x60\xb1\xeb\xd3\xb0\x6b\xc9\x1f\x3d\xde\x03" "\x49\x33\x5d\xfd\xc6\xa1\x4c\x95\x4c\xca\x82\xb4\x5d\x45\xb3\x82\x63\x0e" "\x69\xb4\xf3\xf1\x0c\xa3\xaf\x0d\xdd\xee\x2f\x50\x58\x5b\xcb\x26\xc0\xcb" "\xd1\x3a\xcc\x68\x5b\xfb\x12\x52\x9f\xcf\x05\x4d\xab\x8f\x7b\xc0\xfe\xb5" "\x84\x08\xa7\xfc\xf8\x2e\x8b\x56\xa3\xe0\x2c\x94\x4b\x38\xaf\xee\xb9\x5c" "\xbf\xdf\x59\x7a\x3a\x8e\x4c\x1a\x64\xd1\xc9\x4f\x0f\x7b\x05\x07\xcd\x67" "\xba\xd6\xce\x4e\x60\xbc\x9e\xc7\xc2\x11\x04\x9a\xfb\x1a\x3b\x58\xf8\x3c" "\xaf\xb9\x1c\xee\x00\x96\x13\xb2\x8e\x4b\x36\xde\xd8\x3a\xc1\xd6\xd3\x0d" "\x9a\x92\x39\xf9\x8b\xb9\x32\xc0\xdc\x6c\x60\x8b\x72\x47\x57\x77\x85\xe5" "\x8b\x15\x84\xb4\x0c\x28\x29\x2f\x36\xfb\x28\xaa\x53\xe3\x0f\x91\x6b\x2b" "\x3a\xa6\xb1\x16\xb8\xbf\x09\xbd\xa7\x74\x4a\x0c\xad\x81\xba\x10\x0b\x62" "\x96\x06\x5f\xe6\x1e\x2b\x82\x8d\x29\x87\x89\x00\x32\x5c\x03\xac\x57\x10" "\x63\xce\xc9\x0e\x76\xf5\x78\xca\xd6\x2a\x0c\xc8\x4c\xfd\xa1\x8c\xc1\xf0" "\xd9\x1d\x73\xdd\xd2\x22\x0c\x92\x6f\xf9\x2d\x32\x31\x8f\x54\x31\xdf\xbc" "\x5c\x07\xfc\x86\x96\x8f\xc9\x2b\x6a\xc6\x8c\x64\x83\x92\x87\xde\xd2\xbf" "\x3c\x4e\xa5\x8a\x52\x14\x6b\xaa\x71\xcb\xa5\xa2\x05\xab\x1a\x29\x72\x15" "\x12\xd7\xcd\x83\x57\xcd\xfb\xc0\xdf\xf3\x59\x3d\x17\x1b\x12\xde\x1c\xa8" "\x20\xec\x09\xb2\x8f\x65\x93\x0b\xe7\xb0\x20\xdb\x3d\x41\x85\x59\xdb\x26" "\x98\xf9\x4d\x78\x58\xec\xb1\x30\x61\x00\x2a\xa0\xbe\x0a\x79\x1e\x07\x3f" "\x6c\x73\xde\x77\xdd\x46\x31\x20\x17\xe8\xc2\xeb", 3180); *(uint64_t*)0x20001688 = 0xc6c; inject_fault(5); syscall(__NR_writev, r[0], 0x20001600ul, 9ul); } int main(void) { syscall(__NR_mmap, 0x1ffff000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul); syscall(__NR_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x32ul, -1, 0ul); syscall(__NR_mmap, 0x21000000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; }