// https://syzkaller.appspot.com/bug?id=d10c7911a536f40b3401a3492b4563a08f2ed65b // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifndef __NR_memfd_create #define __NR_memfd_create 319 #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); } 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 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) { 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); } #define MAX_FDS 30 //% This code is derived from puff.{c,h}, found in the zlib development. The //% original files come with the following copyright notice: //% Copyright (C) 2002-2013 Mark Adler, all rights reserved //% version 2.3, 21 Jan 2013 //% This software is provided 'as-is', without any express or implied //% warranty. In no event will the author be held liable for any damages //% arising from the use of this software. //% Permission is granted to anyone to use this software for any purpose, //% including commercial applications, and to alter it and redistribute it //% freely, subject to the following restrictions: //% 1. The origin of this software must not be misrepresented; you must not //% claim that you wrote the original software. If you use this software //% in a product, an acknowledgment in the product documentation would be //% appreciated but is not required. //% 2. Altered source versions must be plainly marked as such, and must not be //% misrepresented as being the original software. //% 3. This notice may not be removed or altered from any source distribution. //% Mark Adler madler@alumni.caltech.edu //% BEGIN CODE DERIVED FROM puff.{c,h} #define MAXBITS 15 #define MAXLCODES 286 #define MAXDCODES 30 #define MAXCODES (MAXLCODES + MAXDCODES) #define FIXLCODES 288 struct puff_state { unsigned char* out; unsigned long outlen; unsigned long outcnt; const unsigned char* in; unsigned long inlen; unsigned long incnt; int bitbuf; int bitcnt; jmp_buf env; }; static int puff_bits(struct puff_state* s, int need) { long val = s->bitbuf; while (s->bitcnt < need) { if (s->incnt == s->inlen) longjmp(s->env, 1); val |= (long)(s->in[s->incnt++]) << s->bitcnt; s->bitcnt += 8; } s->bitbuf = (int)(val >> need); s->bitcnt -= need; return (int)(val & ((1L << need) - 1)); } static int puff_stored(struct puff_state* s) { s->bitbuf = 0; s->bitcnt = 0; if (s->incnt + 4 > s->inlen) return 2; unsigned len = s->in[s->incnt++]; len |= s->in[s->incnt++] << 8; if (s->in[s->incnt++] != (~len & 0xff) || s->in[s->incnt++] != ((~len >> 8) & 0xff)) return -2; if (s->incnt + len > s->inlen) return 2; if (s->outcnt + len > s->outlen) return 1; for (; len--; s->outcnt++, s->incnt++) { if (s->in[s->incnt]) s->out[s->outcnt] = s->in[s->incnt]; } return 0; } struct puff_huffman { short* count; short* symbol; }; static int puff_decode(struct puff_state* s, const struct puff_huffman* h) { int first = 0; int index = 0; int bitbuf = s->bitbuf; int left = s->bitcnt; int code = first = index = 0; int len = 1; short* next = h->count + 1; while (1) { while (left--) { code |= bitbuf & 1; bitbuf >>= 1; int count = *next++; if (code - count < first) { s->bitbuf = bitbuf; s->bitcnt = (s->bitcnt - len) & 7; return h->symbol[index + (code - first)]; } index += count; first += count; first <<= 1; code <<= 1; len++; } left = (MAXBITS + 1) - len; if (left == 0) break; if (s->incnt == s->inlen) longjmp(s->env, 1); bitbuf = s->in[s->incnt++]; if (left > 8) left = 8; } return -10; } static int puff_construct(struct puff_huffman* h, const short* length, int n) { int len; for (len = 0; len <= MAXBITS; len++) h->count[len] = 0; int symbol; for (symbol = 0; symbol < n; symbol++) (h->count[length[symbol]])++; if (h->count[0] == n) return 0; int left = 1; for (len = 1; len <= MAXBITS; len++) { left <<= 1; left -= h->count[len]; if (left < 0) return left; } short offs[MAXBITS + 1]; offs[1] = 0; for (len = 1; len < MAXBITS; len++) offs[len + 1] = offs[len] + h->count[len]; for (symbol = 0; symbol < n; symbol++) if (length[symbol] != 0) h->symbol[offs[length[symbol]]++] = symbol; return left; } static int puff_codes(struct puff_state* s, const struct puff_huffman* lencode, const struct puff_huffman* distcode) { static const short lens[29] = {3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258}; static const short lext[29] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0}; static const short dists[30] = { 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577}; static const short dext[30] = {0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13}; int symbol; do { symbol = puff_decode(s, lencode); if (symbol < 0) return symbol; if (symbol < 256) { if (s->outcnt == s->outlen) return 1; if (symbol) s->out[s->outcnt] = symbol; s->outcnt++; } else if (symbol > 256) { symbol -= 257; if (symbol >= 29) return -10; int len = lens[symbol] + puff_bits(s, lext[symbol]); symbol = puff_decode(s, distcode); if (symbol < 0) return symbol; unsigned dist = dists[symbol] + puff_bits(s, dext[symbol]); if (dist > s->outcnt) return -11; if (s->outcnt + len > s->outlen) return 1; while (len--) { if (dist <= s->outcnt && s->out[s->outcnt - dist]) s->out[s->outcnt] = s->out[s->outcnt - dist]; s->outcnt++; } } } while (symbol != 256); return 0; } static int puff_fixed(struct puff_state* s) { static int virgin = 1; static short lencnt[MAXBITS + 1], lensym[FIXLCODES]; static short distcnt[MAXBITS + 1], distsym[MAXDCODES]; static struct puff_huffman lencode, distcode; if (virgin) { lencode.count = lencnt; lencode.symbol = lensym; distcode.count = distcnt; distcode.symbol = distsym; short lengths[FIXLCODES]; int symbol; for (symbol = 0; symbol < 144; symbol++) lengths[symbol] = 8; for (; symbol < 256; symbol++) lengths[symbol] = 9; for (; symbol < 280; symbol++) lengths[symbol] = 7; for (; symbol < FIXLCODES; symbol++) lengths[symbol] = 8; puff_construct(&lencode, lengths, FIXLCODES); for (symbol = 0; symbol < MAXDCODES; symbol++) lengths[symbol] = 5; puff_construct(&distcode, lengths, MAXDCODES); virgin = 0; } return puff_codes(s, &lencode, &distcode); } static int puff_dynamic(struct puff_state* s) { static const short order[19] = {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; int nlen = puff_bits(s, 5) + 257; int ndist = puff_bits(s, 5) + 1; int ncode = puff_bits(s, 4) + 4; if (nlen > MAXLCODES || ndist > MAXDCODES) return -3; short lengths[MAXCODES]; int index; for (index = 0; index < ncode; index++) lengths[order[index]] = puff_bits(s, 3); for (; index < 19; index++) lengths[order[index]] = 0; short lencnt[MAXBITS + 1], lensym[MAXLCODES]; struct puff_huffman lencode = {lencnt, lensym}; int err = puff_construct(&lencode, lengths, 19); if (err != 0) return -4; index = 0; while (index < nlen + ndist) { int symbol; int len; symbol = puff_decode(s, &lencode); if (symbol < 0) return symbol; if (symbol < 16) lengths[index++] = symbol; else { len = 0; if (symbol == 16) { if (index == 0) return -5; len = lengths[index - 1]; symbol = 3 + puff_bits(s, 2); } else if (symbol == 17) symbol = 3 + puff_bits(s, 3); else symbol = 11 + puff_bits(s, 7); if (index + symbol > nlen + ndist) return -6; while (symbol--) lengths[index++] = len; } } if (lengths[256] == 0) return -9; err = puff_construct(&lencode, lengths, nlen); if (err && (err < 0 || nlen != lencode.count[0] + lencode.count[1])) return -7; short distcnt[MAXBITS + 1], distsym[MAXDCODES]; struct puff_huffman distcode = {distcnt, distsym}; err = puff_construct(&distcode, lengths + nlen, ndist); if (err && (err < 0 || ndist != distcode.count[0] + distcode.count[1])) return -8; return puff_codes(s, &lencode, &distcode); } static int puff(unsigned char* dest, unsigned long* destlen, const unsigned char* source, unsigned long sourcelen) { struct puff_state s = { .out = dest, .outlen = *destlen, .outcnt = 0, .in = source, .inlen = sourcelen, .incnt = 0, .bitbuf = 0, .bitcnt = 0, }; int err; if (setjmp(s.env) != 0) err = 2; else { int last; do { last = puff_bits(&s, 1); int type = puff_bits(&s, 2); err = type == 0 ? puff_stored(&s) : (type == 1 ? puff_fixed(&s) : (type == 2 ? puff_dynamic(&s) : -1)); if (err != 0) break; } while (!last); } *destlen = s.outcnt; return err; } //% END CODE DERIVED FROM puff.{c,h} #define ZLIB_HEADER_WIDTH 2 static int puff_zlib_to_file(const unsigned char* source, unsigned long sourcelen, int dest_fd) { if (sourcelen < ZLIB_HEADER_WIDTH) return 0; source += ZLIB_HEADER_WIDTH; sourcelen -= ZLIB_HEADER_WIDTH; const unsigned long max_destlen = 132 << 20; void* ret = mmap(0, max_destlen, PROT_WRITE | PROT_READ, MAP_PRIVATE | MAP_ANON, -1, 0); if (ret == MAP_FAILED) return -1; unsigned char* dest = (unsigned char*)ret; unsigned long destlen = max_destlen; int err = puff(dest, &destlen, source, sourcelen); if (err) { munmap(dest, max_destlen); errno = -err; return -1; } if (write(dest_fd, dest, destlen) != (ssize_t)destlen) { munmap(dest, max_destlen); return -1; } return munmap(dest, max_destlen); } static int setup_loop_device(unsigned char* data, unsigned long size, const char* loopname, int* loopfd_p) { int err = 0, loopfd = -1; int memfd = syscall(__NR_memfd_create, "syzkaller", 0); if (memfd == -1) { err = errno; goto error; } if (puff_zlib_to_file(data, size, memfd)) { err = errno; goto error_close_memfd; } loopfd = open(loopname, O_RDWR); if (loopfd == -1) { err = errno; goto error_close_memfd; } if (ioctl(loopfd, LOOP_SET_FD, memfd)) { if (errno != EBUSY) { err = errno; goto error_close_loop; } ioctl(loopfd, LOOP_CLR_FD, 0); usleep(1000); if (ioctl(loopfd, LOOP_SET_FD, memfd)) { err = errno; goto error_close_loop; } } close(memfd); *loopfd_p = loopfd; return 0; error_close_loop: close(loopfd); error_close_memfd: close(memfd); error: errno = err; return -1; } static void reset_loop_device(const char* loopname) { int loopfd = open(loopname, O_RDWR); if (loopfd == -1) { return; } if (ioctl(loopfd, LOOP_CLR_FD, 0)) { } close(loopfd); } static long syz_mount_image(volatile long fsarg, volatile long dir, volatile long flags, volatile long optsarg, volatile long change_dir, volatile unsigned long size, volatile long image) { unsigned char* data = (unsigned char*)image; int res = -1, err = 0, need_loop_device = !!size; char* mount_opts = (char*)optsarg; char* target = (char*)dir; char* fs = (char*)fsarg; char* source = NULL; char loopname[64]; if (need_loop_device) { int loopfd; memset(loopname, 0, sizeof(loopname)); snprintf(loopname, sizeof(loopname), "/dev/loop%llu", procid); if (setup_loop_device(data, size, loopname, &loopfd) == -1) return -1; close(loopfd); source = loopname; } mkdir(target, 0777); char opts[256]; memset(opts, 0, sizeof(opts)); if (strlen(mount_opts) > (sizeof(opts) - 32)) { } strncpy(opts, mount_opts, sizeof(opts) - 32); if (strcmp(fs, "iso9660") == 0) { flags |= MS_RDONLY; } else if (strncmp(fs, "ext", 3) == 0) { bool has_remount_ro = false; char* remount_ro_start = strstr(opts, "errors=remount-ro"); if (remount_ro_start != NULL) { char after = *(remount_ro_start + strlen("errors=remount-ro")); char before = remount_ro_start == opts ? '\0' : *(remount_ro_start - 1); has_remount_ro = ((before == '\0' || before == ',') && (after == '\0' || after == ',')); } if (strstr(opts, "errors=panic") || !has_remount_ro) strcat(opts, ",errors=continue"); } else if (strcmp(fs, "xfs") == 0) { strcat(opts, ",nouuid"); } res = mount(source, target, fs, flags, opts); if (res == -1) { err = errno; goto error_clear_loop; } res = open(target, O_RDONLY | O_DIRECTORY); if (res == -1) { err = errno; goto error_clear_loop; } if (change_dir) { res = chdir(target); if (res == -1) { err = errno; } } error_clear_loop: if (need_loop_device) reset_loop_device(loopname); errno = err; return res; } #define XT_TABLE_SIZE 1536 #define XT_MAX_ENTRIES 10 struct xt_counters { uint64_t pcnt, bcnt; }; struct ipt_getinfo { char name[32]; unsigned int valid_hooks; unsigned int hook_entry[5]; unsigned int underflow[5]; unsigned int num_entries; unsigned int size; }; struct ipt_get_entries { char name[32]; unsigned int size; uint64_t entrytable[XT_TABLE_SIZE / sizeof(uint64_t)]; }; struct ipt_replace { char name[32]; unsigned int valid_hooks; unsigned int num_entries; unsigned int size; unsigned int hook_entry[5]; unsigned int underflow[5]; unsigned int num_counters; struct xt_counters* counters; uint64_t entrytable[XT_TABLE_SIZE / sizeof(uint64_t)]; }; struct ipt_table_desc { const char* name; struct ipt_getinfo info; struct ipt_replace replace; }; static struct ipt_table_desc ipv4_tables[] = { {.name = "filter"}, {.name = "nat"}, {.name = "mangle"}, {.name = "raw"}, {.name = "security"}, }; static struct ipt_table_desc ipv6_tables[] = { {.name = "filter"}, {.name = "nat"}, {.name = "mangle"}, {.name = "raw"}, {.name = "security"}, }; #define IPT_BASE_CTL 64 #define IPT_SO_SET_REPLACE (IPT_BASE_CTL) #define IPT_SO_GET_INFO (IPT_BASE_CTL) #define IPT_SO_GET_ENTRIES (IPT_BASE_CTL + 1) struct arpt_getinfo { char name[32]; unsigned int valid_hooks; unsigned int hook_entry[3]; unsigned int underflow[3]; unsigned int num_entries; unsigned int size; }; struct arpt_get_entries { char name[32]; unsigned int size; uint64_t entrytable[XT_TABLE_SIZE / sizeof(uint64_t)]; }; struct arpt_replace { char name[32]; unsigned int valid_hooks; unsigned int num_entries; unsigned int size; unsigned int hook_entry[3]; unsigned int underflow[3]; unsigned int num_counters; struct xt_counters* counters; uint64_t entrytable[XT_TABLE_SIZE / sizeof(uint64_t)]; }; struct arpt_table_desc { const char* name; struct arpt_getinfo info; struct arpt_replace replace; }; static struct arpt_table_desc arpt_tables[] = { {.name = "filter"}, }; #define ARPT_BASE_CTL 96 #define ARPT_SO_SET_REPLACE (ARPT_BASE_CTL) #define ARPT_SO_GET_INFO (ARPT_BASE_CTL) #define ARPT_SO_GET_ENTRIES (ARPT_BASE_CTL + 1) static void checkpoint_iptables(struct ipt_table_desc* tables, int num_tables, int family, int level) { int fd = socket(family, SOCK_STREAM, IPPROTO_TCP); if (fd == -1) { switch (errno) { case EAFNOSUPPORT: case ENOPROTOOPT: case ENOENT: return; } exit(1); } for (int i = 0; i < num_tables; i++) { struct ipt_table_desc* table = &tables[i]; strcpy(table->info.name, table->name); strcpy(table->replace.name, table->name); socklen_t optlen = sizeof(table->info); if (getsockopt(fd, level, IPT_SO_GET_INFO, &table->info, &optlen)) { switch (errno) { case EPERM: case ENOENT: case ENOPROTOOPT: continue; } exit(1); } if (table->info.size > sizeof(table->replace.entrytable)) exit(1); if (table->info.num_entries > XT_MAX_ENTRIES) exit(1); struct ipt_get_entries entries; memset(&entries, 0, sizeof(entries)); strcpy(entries.name, table->name); entries.size = table->info.size; optlen = sizeof(entries) - sizeof(entries.entrytable) + table->info.size; if (getsockopt(fd, level, IPT_SO_GET_ENTRIES, &entries, &optlen)) exit(1); table->replace.valid_hooks = table->info.valid_hooks; table->replace.num_entries = table->info.num_entries; table->replace.size = table->info.size; memcpy(table->replace.hook_entry, table->info.hook_entry, sizeof(table->replace.hook_entry)); memcpy(table->replace.underflow, table->info.underflow, sizeof(table->replace.underflow)); memcpy(table->replace.entrytable, entries.entrytable, table->info.size); } close(fd); } static void reset_iptables(struct ipt_table_desc* tables, int num_tables, int family, int level) { int fd = socket(family, SOCK_STREAM, IPPROTO_TCP); if (fd == -1) { switch (errno) { case EAFNOSUPPORT: case ENOPROTOOPT: case ENOENT: return; } exit(1); } for (int i = 0; i < num_tables; i++) { struct ipt_table_desc* table = &tables[i]; if (table->info.valid_hooks == 0) continue; struct ipt_getinfo info; memset(&info, 0, sizeof(info)); strcpy(info.name, table->name); socklen_t optlen = sizeof(info); if (getsockopt(fd, level, IPT_SO_GET_INFO, &info, &optlen)) exit(1); if (memcmp(&table->info, &info, sizeof(table->info)) == 0) { struct ipt_get_entries entries; memset(&entries, 0, sizeof(entries)); strcpy(entries.name, table->name); entries.size = table->info.size; optlen = sizeof(entries) - sizeof(entries.entrytable) + entries.size; if (getsockopt(fd, level, IPT_SO_GET_ENTRIES, &entries, &optlen)) exit(1); if (memcmp(table->replace.entrytable, entries.entrytable, table->info.size) == 0) continue; } struct xt_counters counters[XT_MAX_ENTRIES]; table->replace.num_counters = info.num_entries; table->replace.counters = counters; optlen = sizeof(table->replace) - sizeof(table->replace.entrytable) + table->replace.size; if (setsockopt(fd, level, IPT_SO_SET_REPLACE, &table->replace, optlen)) exit(1); } close(fd); } static void checkpoint_arptables(void) { int fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (fd == -1) { switch (errno) { case EAFNOSUPPORT: case ENOPROTOOPT: case ENOENT: return; } exit(1); } for (unsigned i = 0; i < sizeof(arpt_tables) / sizeof(arpt_tables[0]); i++) { struct arpt_table_desc* table = &arpt_tables[i]; strcpy(table->info.name, table->name); strcpy(table->replace.name, table->name); socklen_t optlen = sizeof(table->info); if (getsockopt(fd, SOL_IP, ARPT_SO_GET_INFO, &table->info, &optlen)) { switch (errno) { case EPERM: case ENOENT: case ENOPROTOOPT: continue; } exit(1); } if (table->info.size > sizeof(table->replace.entrytable)) exit(1); if (table->info.num_entries > XT_MAX_ENTRIES) exit(1); struct arpt_get_entries entries; memset(&entries, 0, sizeof(entries)); strcpy(entries.name, table->name); entries.size = table->info.size; optlen = sizeof(entries) - sizeof(entries.entrytable) + table->info.size; if (getsockopt(fd, SOL_IP, ARPT_SO_GET_ENTRIES, &entries, &optlen)) exit(1); table->replace.valid_hooks = table->info.valid_hooks; table->replace.num_entries = table->info.num_entries; table->replace.size = table->info.size; memcpy(table->replace.hook_entry, table->info.hook_entry, sizeof(table->replace.hook_entry)); memcpy(table->replace.underflow, table->info.underflow, sizeof(table->replace.underflow)); memcpy(table->replace.entrytable, entries.entrytable, table->info.size); } close(fd); } static void reset_arptables() { int fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (fd == -1) { switch (errno) { case EAFNOSUPPORT: case ENOPROTOOPT: case ENOENT: return; } exit(1); } for (unsigned i = 0; i < sizeof(arpt_tables) / sizeof(arpt_tables[0]); i++) { struct arpt_table_desc* table = &arpt_tables[i]; if (table->info.valid_hooks == 0) continue; struct arpt_getinfo info; memset(&info, 0, sizeof(info)); strcpy(info.name, table->name); socklen_t optlen = sizeof(info); if (getsockopt(fd, SOL_IP, ARPT_SO_GET_INFO, &info, &optlen)) exit(1); if (memcmp(&table->info, &info, sizeof(table->info)) == 0) { struct arpt_get_entries entries; memset(&entries, 0, sizeof(entries)); strcpy(entries.name, table->name); entries.size = table->info.size; optlen = sizeof(entries) - sizeof(entries.entrytable) + entries.size; if (getsockopt(fd, SOL_IP, ARPT_SO_GET_ENTRIES, &entries, &optlen)) exit(1); if (memcmp(table->replace.entrytable, entries.entrytable, table->info.size) == 0) continue; } else { } struct xt_counters counters[XT_MAX_ENTRIES]; table->replace.num_counters = info.num_entries; table->replace.counters = counters; optlen = sizeof(table->replace) - sizeof(table->replace.entrytable) + table->replace.size; if (setsockopt(fd, SOL_IP, ARPT_SO_SET_REPLACE, &table->replace, optlen)) exit(1); } close(fd); } #define NF_BR_NUMHOOKS 6 #define EBT_TABLE_MAXNAMELEN 32 #define EBT_CHAIN_MAXNAMELEN 32 #define EBT_BASE_CTL 128 #define EBT_SO_SET_ENTRIES (EBT_BASE_CTL) #define EBT_SO_GET_INFO (EBT_BASE_CTL) #define EBT_SO_GET_ENTRIES (EBT_SO_GET_INFO + 1) #define EBT_SO_GET_INIT_INFO (EBT_SO_GET_ENTRIES + 1) #define EBT_SO_GET_INIT_ENTRIES (EBT_SO_GET_INIT_INFO + 1) struct ebt_replace { char name[EBT_TABLE_MAXNAMELEN]; unsigned int valid_hooks; unsigned int nentries; unsigned int entries_size; struct ebt_entries* hook_entry[NF_BR_NUMHOOKS]; unsigned int num_counters; struct ebt_counter* counters; char* entries; }; struct ebt_entries { unsigned int distinguisher; char name[EBT_CHAIN_MAXNAMELEN]; unsigned int counter_offset; int policy; unsigned int nentries; char data[0] __attribute__((aligned(__alignof__(struct ebt_replace)))); }; struct ebt_table_desc { const char* name; struct ebt_replace replace; char entrytable[XT_TABLE_SIZE]; }; static struct ebt_table_desc ebt_tables[] = { {.name = "filter"}, {.name = "nat"}, {.name = "broute"}, }; static void checkpoint_ebtables(void) { int fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (fd == -1) { switch (errno) { case EAFNOSUPPORT: case ENOPROTOOPT: case ENOENT: return; } exit(1); } for (size_t i = 0; i < sizeof(ebt_tables) / sizeof(ebt_tables[0]); i++) { struct ebt_table_desc* table = &ebt_tables[i]; strcpy(table->replace.name, table->name); socklen_t optlen = sizeof(table->replace); if (getsockopt(fd, SOL_IP, EBT_SO_GET_INIT_INFO, &table->replace, &optlen)) { switch (errno) { case EPERM: case ENOENT: case ENOPROTOOPT: continue; } exit(1); } if (table->replace.entries_size > sizeof(table->entrytable)) exit(1); table->replace.num_counters = 0; table->replace.entries = table->entrytable; optlen = sizeof(table->replace) + table->replace.entries_size; if (getsockopt(fd, SOL_IP, EBT_SO_GET_INIT_ENTRIES, &table->replace, &optlen)) exit(1); } close(fd); } static void reset_ebtables() { int fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (fd == -1) { switch (errno) { case EAFNOSUPPORT: case ENOPROTOOPT: case ENOENT: return; } exit(1); } for (unsigned i = 0; i < sizeof(ebt_tables) / sizeof(ebt_tables[0]); i++) { struct ebt_table_desc* table = &ebt_tables[i]; if (table->replace.valid_hooks == 0) continue; struct ebt_replace replace; memset(&replace, 0, sizeof(replace)); strcpy(replace.name, table->name); socklen_t optlen = sizeof(replace); if (getsockopt(fd, SOL_IP, EBT_SO_GET_INFO, &replace, &optlen)) exit(1); replace.num_counters = 0; table->replace.entries = 0; for (unsigned h = 0; h < NF_BR_NUMHOOKS; h++) table->replace.hook_entry[h] = 0; if (memcmp(&table->replace, &replace, sizeof(table->replace)) == 0) { char entrytable[XT_TABLE_SIZE]; memset(&entrytable, 0, sizeof(entrytable)); replace.entries = entrytable; optlen = sizeof(replace) + replace.entries_size; if (getsockopt(fd, SOL_IP, EBT_SO_GET_ENTRIES, &replace, &optlen)) exit(1); if (memcmp(table->entrytable, entrytable, replace.entries_size) == 0) continue; } for (unsigned j = 0, h = 0; h < NF_BR_NUMHOOKS; h++) { if (table->replace.valid_hooks & (1 << h)) { table->replace.hook_entry[h] = (struct ebt_entries*)table->entrytable + j; j++; } } table->replace.entries = table->entrytable; optlen = sizeof(table->replace) + table->replace.entries_size; if (setsockopt(fd, SOL_IP, EBT_SO_SET_ENTRIES, &table->replace, optlen)) exit(1); } close(fd); } static void checkpoint_net_namespace(void) { checkpoint_ebtables(); checkpoint_arptables(); checkpoint_iptables(ipv4_tables, sizeof(ipv4_tables) / sizeof(ipv4_tables[0]), AF_INET, SOL_IP); checkpoint_iptables(ipv6_tables, sizeof(ipv6_tables) / sizeof(ipv6_tables[0]), AF_INET6, SOL_IPV6); } static void reset_net_namespace(void) { reset_ebtables(); reset_arptables(); reset_iptables(ipv4_tables, sizeof(ipv4_tables) / sizeof(ipv4_tables[0]), AF_INET, SOL_IP); reset_iptables(ipv6_tables, sizeof(ipv6_tables) / sizeof(ipv6_tables[0]), AF_INET6, SOL_IPV6); } static void mount_cgroups(const char* dir, const char** controllers, int count) { if (mkdir(dir, 0777)) { return; } char enabled[128] = {0}; int i = 0; for (; i < count; i++) { if (mount("none", dir, "cgroup", 0, controllers[i])) { continue; } umount(dir); strcat(enabled, ","); strcat(enabled, controllers[i]); } if (enabled[0] == 0) { if (rmdir(dir) && errno != EBUSY) exit(1); return; } if (mount("none", dir, "cgroup", 0, enabled + 1)) { if (rmdir(dir) && errno != EBUSY) exit(1); } if (chmod(dir, 0777)) { } } static void mount_cgroups2(const char** controllers, int count) { if (mkdir("/syzcgroup/unified", 0777)) { return; } if (mount("none", "/syzcgroup/unified", "cgroup2", 0, NULL)) { if (rmdir("/syzcgroup/unified") && errno != EBUSY) exit(1); return; } if (chmod("/syzcgroup/unified", 0777)) { } int control = open("/syzcgroup/unified/cgroup.subtree_control", O_WRONLY); if (control == -1) return; int i; for (i = 0; i < count; i++) if (write(control, controllers[i], strlen(controllers[i])) < 0) { } close(control); } static void setup_cgroups() { const char* unified_controllers[] = {"+cpu", "+io", "+pids"}; const char* net_controllers[] = {"net", "net_prio", "devices", "blkio", "freezer"}; const char* cpu_controllers[] = {"cpuset", "cpuacct", "hugetlb", "rlimit", "memory"}; if (mkdir("/syzcgroup", 0777)) { return; } mount_cgroups2(unified_controllers, sizeof(unified_controllers) / sizeof(unified_controllers[0])); mount_cgroups("/syzcgroup/net", net_controllers, sizeof(net_controllers) / sizeof(net_controllers[0])); mount_cgroups("/syzcgroup/cpu", cpu_controllers, sizeof(cpu_controllers) / sizeof(cpu_controllers[0])); write_file("/syzcgroup/cpu/cgroup.clone_children", "1"); write_file("/syzcgroup/cpu/cpuset.memory_pressure_enabled", "1"); } static void setup_cgroups_loop() { int pid = getpid(); char file[128]; char cgroupdir[64]; snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/unified/syz%llu", procid); if (mkdir(cgroupdir, 0777)) { } snprintf(file, sizeof(file), "%s/pids.max", cgroupdir); write_file(file, "32"); snprintf(file, sizeof(file), "%s/cgroup.procs", cgroupdir); write_file(file, "%d", pid); snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/cpu/syz%llu", procid); if (mkdir(cgroupdir, 0777)) { } snprintf(file, sizeof(file), "%s/cgroup.procs", cgroupdir); write_file(file, "%d", pid); snprintf(file, sizeof(file), "%s/memory.soft_limit_in_bytes", cgroupdir); write_file(file, "%d", 299 << 20); snprintf(file, sizeof(file), "%s/memory.limit_in_bytes", cgroupdir); write_file(file, "%d", 300 << 20); snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/net/syz%llu", procid); if (mkdir(cgroupdir, 0777)) { } snprintf(file, sizeof(file), "%s/cgroup.procs", cgroupdir); write_file(file, "%d", pid); } static void setup_cgroups_test() { char cgroupdir[64]; snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/unified/syz%llu", procid); if (symlink(cgroupdir, "./cgroup")) { } snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/cpu/syz%llu", procid); if (symlink(cgroupdir, "./cgroup.cpu")) { } snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/net/syz%llu", procid); if (symlink(cgroupdir, "./cgroup.net")) { } } static void initialize_cgroups() { if (mkdir("./syz-tmp/newroot/syzcgroup", 0700)) exit(1); if (mkdir("./syz-tmp/newroot/syzcgroup/unified", 0700)) exit(1); if (mkdir("./syz-tmp/newroot/syzcgroup/cpu", 0700)) exit(1); if (mkdir("./syz-tmp/newroot/syzcgroup/net", 0700)) exit(1); unsigned bind_mount_flags = MS_BIND | MS_REC | MS_PRIVATE; if (mount("/syzcgroup/unified", "./syz-tmp/newroot/syzcgroup/unified", NULL, bind_mount_flags, NULL)) { } if (mount("/syzcgroup/cpu", "./syz-tmp/newroot/syzcgroup/cpu", NULL, bind_mount_flags, NULL)) { } if (mount("/syzcgroup/net", "./syz-tmp/newroot/syzcgroup/net", NULL, bind_mount_flags, NULL)) { } } static void sandbox_common_mount_tmpfs(void) { write_file("/proc/sys/fs/mount-max", "100000"); if (mkdir("./syz-tmp", 0777)) exit(1); if (mount("", "./syz-tmp", "tmpfs", 0, NULL)) exit(1); if (mkdir("./syz-tmp/newroot", 0777)) exit(1); if (mkdir("./syz-tmp/newroot/dev", 0700)) exit(1); unsigned bind_mount_flags = MS_BIND | MS_REC | MS_PRIVATE; if (mount("/dev", "./syz-tmp/newroot/dev", NULL, bind_mount_flags, NULL)) exit(1); if (mkdir("./syz-tmp/newroot/proc", 0700)) exit(1); if (mount("syz-proc", "./syz-tmp/newroot/proc", "proc", 0, NULL)) exit(1); if (mkdir("./syz-tmp/newroot/selinux", 0700)) exit(1); const char* selinux_path = "./syz-tmp/newroot/selinux"; if (mount("/selinux", selinux_path, NULL, bind_mount_flags, NULL)) { if (errno != ENOENT) exit(1); if (mount("/sys/fs/selinux", selinux_path, NULL, bind_mount_flags, NULL) && errno != ENOENT) exit(1); } if (mkdir("./syz-tmp/newroot/sys", 0700)) exit(1); if (mount("/sys", "./syz-tmp/newroot/sys", 0, bind_mount_flags, NULL)) exit(1); initialize_cgroups(); if (mkdir("./syz-tmp/pivot", 0777)) exit(1); if (syscall(SYS_pivot_root, "./syz-tmp", "./syz-tmp/pivot")) { if (chdir("./syz-tmp")) exit(1); } else { if (chdir("/")) exit(1); if (umount2("./pivot", MNT_DETACH)) exit(1); } if (chroot("./newroot")) exit(1); if (chdir("/")) exit(1); } static void setup_common() { if (mount(0, "/sys/fs/fuse/connections", "fusectl", 0, 0)) { } } static void setup_binderfs() { if (mkdir("/dev/binderfs", 0777)) { } if (mount("binder", "/dev/binderfs", "binder", 0, NULL)) { } } static void loop(); static void sandbox_common() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setsid(); struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = (200 << 20); setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 32 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 136 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); if (unshare(CLONE_NEWNS)) { } if (mount(NULL, "/", NULL, MS_REC | MS_PRIVATE, NULL)) { } if (unshare(CLONE_NEWIPC)) { } if (unshare(0x02000000)) { } if (unshare(CLONE_NEWUTS)) { } if (unshare(CLONE_SYSVSEM)) { } typedef struct { const char* name; const char* value; } sysctl_t; static const sysctl_t sysctls[] = { {"/proc/sys/kernel/shmmax", "16777216"}, {"/proc/sys/kernel/shmall", "536870912"}, {"/proc/sys/kernel/shmmni", "1024"}, {"/proc/sys/kernel/msgmax", "8192"}, {"/proc/sys/kernel/msgmni", "1024"}, {"/proc/sys/kernel/msgmnb", "1024"}, {"/proc/sys/kernel/sem", "1024 1048576 500 1024"}, }; unsigned i; for (i = 0; i < sizeof(sysctls) / sizeof(sysctls[0]); i++) write_file(sysctls[i].name, sysctls[i].value); } static int wait_for_loop(int pid) { if (pid < 0) exit(1); int status = 0; while (waitpid(-1, &status, __WALL) != pid) { } return WEXITSTATUS(status); } static void drop_caps(void) { struct __user_cap_header_struct cap_hdr = {}; struct __user_cap_data_struct cap_data[2] = {}; cap_hdr.version = _LINUX_CAPABILITY_VERSION_3; cap_hdr.pid = getpid(); if (syscall(SYS_capget, &cap_hdr, &cap_data)) exit(1); const int drop = (1 << CAP_SYS_PTRACE) | (1 << CAP_SYS_NICE); cap_data[0].effective &= ~drop; cap_data[0].permitted &= ~drop; cap_data[0].inheritable &= ~drop; if (syscall(SYS_capset, &cap_hdr, &cap_data)) exit(1); } static int do_sandbox_none(void) { if (unshare(CLONE_NEWPID)) { } int pid = fork(); if (pid != 0) return wait_for_loop(pid); setup_common(); sandbox_common(); drop_caps(); initialize_netdevices_init(); if (unshare(CLONE_NEWNET)) { } write_file("/proc/sys/net/ipv4/ping_group_range", "0 65535"); initialize_netdevices(); sandbox_common_mount_tmpfs(); setup_binderfs(); loop(); exit(1); } #define FS_IOC_SETFLAGS _IOW('f', 2, long) static void remove_dir(const char* dir) { int iter = 0; DIR* dp = 0; const int umount_flags = MNT_FORCE | UMOUNT_NOFOLLOW; retry: while (umount2(dir, umount_flags) == 0) { } dp = opendir(dir); if (dp == NULL) { if (errno == EMFILE) { exit(1); } exit(1); } struct dirent* ep = 0; while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); while (umount2(filename, umount_flags) == 0) { } struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } int i; for (i = 0;; i++) { if (unlink(filename) == 0) break; if (errno == EPERM) { int fd = open(filename, O_RDONLY); if (fd != -1) { long flags = 0; if (ioctl(fd, FS_IOC_SETFLAGS, &flags) == 0) { } close(fd); continue; } } if (errno == EROFS) { break; } if (errno != EBUSY || i > 100) exit(1); if (umount2(filename, umount_flags)) exit(1); } } closedir(dp); for (int i = 0;; i++) { if (rmdir(dir) == 0) break; if (i < 100) { if (errno == EPERM) { int fd = open(dir, O_RDONLY); if (fd != -1) { long flags = 0; if (ioctl(fd, FS_IOC_SETFLAGS, &flags) == 0) { } close(fd); continue; } } if (errno == EROFS) { break; } if (errno == EBUSY) { if (umount2(dir, umount_flags)) exit(1); continue; } if (errno == ENOTEMPTY) { if (iter < 100) { iter++; goto retry; } } } exit(1); } } static void kill_and_wait(int pid, int* status) { kill(-pid, SIGKILL); kill(pid, SIGKILL); for (int i = 0; i < 100; i++) { if (waitpid(-1, status, WNOHANG | __WALL) == pid) return; usleep(1000); } DIR* dir = opendir("/sys/fs/fuse/connections"); if (dir) { for (;;) { struct dirent* ent = readdir(dir); if (!ent) break; if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) continue; char abort[300]; snprintf(abort, sizeof(abort), "/sys/fs/fuse/connections/%s/abort", ent->d_name); int fd = open(abort, O_WRONLY); if (fd == -1) { continue; } if (write(fd, abort, 1) < 0) { } close(fd); } closedir(dir); } else { } while (waitpid(-1, status, __WALL) != pid) { } } static void setup_loop() { setup_cgroups_loop(); checkpoint_net_namespace(); } static void reset_loop() { char buf[64]; snprintf(buf, sizeof(buf), "/dev/loop%llu", procid); int loopfd = open(buf, O_RDWR); if (loopfd != -1) { ioctl(loopfd, LOOP_CLR_FD, 0); close(loopfd); } reset_net_namespace(); } static void setup_test() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setpgrp(); setup_cgroups_test(); write_file("/proc/self/oom_score_adj", "1000"); if (symlink("/dev/binderfs", "./binderfs")) { } } static void close_fds() { for (int fd = 3; fd < MAX_FDS; fd++) close(fd); } static void setup_sysctl() { int cad_pid = fork(); if (cad_pid < 0) exit(1); if (cad_pid == 0) { for (;;) sleep(100); } char tmppid[32]; snprintf(tmppid, sizeof(tmppid), "%d", cad_pid); struct { const char* name; const char* data; } files[] = { {"/sys/kernel/debug/x86/nmi_longest_ns", "10000000000"}, {"/proc/sys/kernel/hung_task_check_interval_secs", "20"}, {"/proc/sys/net/core/bpf_jit_kallsyms", "1"}, {"/proc/sys/net/core/bpf_jit_harden", "0"}, {"/proc/sys/kernel/kptr_restrict", "0"}, {"/proc/sys/kernel/softlockup_all_cpu_backtrace", "1"}, {"/proc/sys/fs/mount-max", "100"}, {"/proc/sys/vm/oom_dump_tasks", "0"}, {"/proc/sys/debug/exception-trace", "0"}, {"/proc/sys/kernel/printk", "7 4 1 3"}, {"/proc/sys/kernel/keys/gc_delay", "1"}, {"/proc/sys/vm/oom_kill_allocating_task", "1"}, {"/proc/sys/kernel/ctrl-alt-del", "0"}, {"/proc/sys/kernel/cad_pid", tmppid}, }; for (size_t i = 0; i < sizeof(files) / sizeof(files[0]); i++) { if (!write_file(files[i].name, files[i].data)) { } } kill(cad_pid, SIGKILL); while (waitpid(cad_pid, NULL, 0) != cad_pid) ; } 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 < 11; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); event_timedwait(&th->done, 50 + (call == 0 ? 4000 : 0) + (call == 6 ? 4000 : 0)); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); close_fds(); } static void execute_one(void); #define WAIT_FLAGS __WALL static void loop(void) { setup_loop(); int iter = 0; for (;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); reset_loop(); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); setup_test(); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { sleep_ms(10); if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; if (current_time_ms() - start < 5000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[7] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: memcpy((void*)0x200001c0, "nilfs2\000", 7); memcpy((void*)0x20000300, "./file0\000", 8); memcpy( (void*)0x20000340, "\x78\x9c\xec\xdd\x4d\x8c\x5b\x47\x01\x00\xe0\xb1\x77\xbd\xc9\x26\x29" "\x71\x4a\x42\x97\x34\xb4\x09\x85\xb6\xfc\x74\xd3\x6c\x96\xf0\x13\x41" "\x52\x25\x42\x22\x6a\x2a\xc4\xa5\x52\xc5\x25\x4a\xd3\x12\x11\x82\x44" "\x91\x80\xaa\x12\x49\x4e\xdc\x68\x55\x05\x89\x13\x3f\xe2\xd4\x4b\x55" "\x10\x12\xbd\xa0\xa8\x27\x2e\x95\x68\xa4\x0a\xa9\xa7\xc2\x81\x03\x51" "\x10\x95\x38\x40\x20\x71\x15\xef\x8c\xd7\x9e\xd8\x7d\xb6\xb3\xeb\x67" "\xc7\xdf\x27\x8d\xc7\xf3\xe6\x3d\xcf\xbc\xe7\xe7\xe7\xf7\x3b\x13\x80" "\xa9\x55\x6d\xbe\x2e\x2f\x2f\x54\x42\xb8\xf8\xfa\xcb\x47\xff\xf1\xe0" "\xdf\xe7\x6f\x0e\x39\xd4\x1a\xa3\xde\x7c\x9d\x6d\x4b\xd5\x42\x08\x95" "\x98\x9e\xcd\x3e\xef\xdd\x99\x95\xf8\xfa\x7b\x2f\x9c\xec\x16\x57\xc2" "\x52\xf3\x35\xa5\xc3\x13\x57\x5b\xd3\x6e\x0e\x21\x9c\x0b\xbb\xc3\xa5" "\x50\x0f\x3b\x2f\x5e\x7e\xe9\xcd\xa5\xc7\x8f\x9f\x3f\x76\x61\xcf\x5b" "\xaf\x1c\xbc\xb2\x3e\x73\x0f\x00\x00\xd3\xe5\xeb\x97\x0e\x2e\xef\xf8" "\xeb\x9f\xef\xdd\x76\xed\xd5\xfb\x0e\x87\x0d\xad\xe1\x69\xff\xbc\x1e" "\xd3\x5b\xe2\x7e\xff\xe1\xb8\xe3\x9f\xf6\xff\xab\xa1\x33\x5d\x69\x0b" "\xed\xe6\xb2\xf1\x66\x63\xa8\xce\x77\x8e\x37\xd3\x65\xbc\xf6\x72\x6a" "\xd9\x78\xb3\x3d\xca\x9f\xcb\xca\xaf\xf5\x18\x6f\x43\xf8\xe0\xf2\x67" "\xda\x86\x75\x9b\x6f\x98\x64\x69\x3d\xae\x87\x4a\x75\xb1\x23\x5d\xad" "\x2e\x2e\xae\x1c\x93\x87\xe6\x71\xfd\x5c\x65\xf1\xec\xe9\x33\xcf\x3c" "\x57\x52\x45\x81\x35\xf7\xef\xfb\x43\x08\xbb\xdb\xc2\x91\x0b\x9d\xe9" "\x71\x0b\x87\xc6\xa0\x0e\x43\x86\xc6\x18\xd4\x61\x22\xc3\xe1\xd1\x95" "\x75\xad\xb1\xa2\xf4\x79\x1e\x51\x68\x6c\x2d\x7b\x0b\x04\xb0\x22\xbf" "\x5e\x78\x8b\x73\xf9\x99\x85\xdb\xd3\xfa\xb4\xd9\xfe\xca\xbf\xfa\x58" "\xb5\xfb\xf4\xb0\x06\x46\xbd\xfe\x0f\x54\xfe\x5c\xc9\xe5\x07\xe5\xff" "\xe6\xbc\x2d\x0e\x6b\xe7\x4e\x5d\x9b\xd2\x7c\xa5\xdf\xd1\x96\x98\xce" "\xaf\x23\xe4\xf7\x2f\xf5\xfe\xfd\xe5\x57\x3a\x3a\x87\xe6\xd7\x23\x6a" "\x7d\xd6\xb3\xd7\x75\x84\x49\xb9\xbe\xd0\xab\x9e\x33\x23\xae\xc7\xb0" "\x7a\xd5\x3f\x5f\x2f\xee\x54\x5f\x8e\x71\x5a\x0e\x5f\xc9\xf2\xdb\x7f" "\x3f\xf9\x77\x3a\x29\xdf\x31\xd0\xdd\x7f\xf2\xf3\xff\x82\x20\x8c\x77" "\x08\x1d\xe9\xda\xed\x7c\x56\xa3\xe4\xed\x0f\x30\xbe\xf2\xfb\xe6\x1a" "\xe9\xfa\x68\x94\xdf\xd7\x97\xe7\x6f\x28\xc8\xdf\x58\x90\x3f\x5f\x90" "\xbf\xa9\x20\x7f\x73\x41\x3e\x4c\xb3\xdf\x7d\xff\xa7\xe1\xc5\xca\xea" "\x71\x7e\x7e\x4c\x3f\xe8\xf9\xf0\x74\x9e\xed\xae\x18\x7f\x68\xc0\xfa" "\xe4\xe7\x23\x07\x2d\x3f\xbf\xef\x77\x50\xb7\x5b\x7e\x7e\x3f\x31\x8c" "\xb3\x3f\x9c\x78\xf2\xd4\x17\x9e\x7e\xea\xf2\xca\xfd\xff\x95\xd6\xfa" "\x7f\x23\xae\xef\xe9\x70\xa3\x1e\x7f\x5b\x97\xe2\x08\xe9\x7c\x61\x7e" "\x5e\xbd\x75\xef\x7f\xbd\xb3\x9c\x6a\x8f\xf1\xee\xce\xea\x73\x57\x97" "\xf1\x9b\xef\xb7\x77\x8e\x57\xd9\xbe\xfa\x39\xa1\x6d\x3b\x73\x4b\x3d" "\x16\x3a\xa7\xdb\xda\x6b\xbc\x5d\x9d\xe3\xd5\xb3\xf1\xe6\x63\xd8\x98" "\xd5\x37\xdf\x3f\xd9\x94\x4d\x97\xf6\x3f\xd2\x76\x35\x2d\xaf\xd9\x6c" "\x7e\x6b\xd9\x7c\xcc\x65\xf5\x48\xdb\x95\x6d\x31\xce\xeb\x01\xc3\x48" "\xeb\x63\xaf\xfb\xff\xd3\xfa\xb9\x10\x6a\x95\x67\x4e\x9f\x39\xf5\x68" "\x4c\xa7\xf5\xf4\x4f\x33\xb5\x0d\x37\x87\xef\x1b\x71\xbd\x81\xdb\xd7" "\xef\xf3\x3f\x0b\xa1\xf3\xf9\x9f\x2d\xad\xe1\xb5\x6a\xfb\x76\x61\xeb" "\xea\xf0\xca\xca\x76\xe1\xb5\xf8\x79\x9d\xc3\x97\x5a\xe5\x74\x0e\xdf" "\x1f\xd3\xe9\x7f\xee\x5b\x33\xf3\xcd\xe1\x8b\x27\xbf\x7b\xe6\xe9\xb5" "\x9f\x7d\x98\x6a\xcf\xfd\xe8\xf9\x6f\x9f\x38\x73\xe6\xd4\xf7\xbc\x19" "\xfa\xcd\x57\xc7\xa3\x1a\x83\xbc\x49\x87\x2d\xe3\x52\x1f\x6f\xc6\xee" "\x4d\xc9\x1b\x26\x60\xdd\xed\xfd\xf1\xca\x4e\xc0\x23\xa7\xbf\x73\xe2" "\xd9\x53\xcf\x9e\x3a\xbb\xff\xc0\x81\xfd\x4b\x4b\x07\xbe\xb8\x7f\x79" "\x6f\x73\xbf\x7e\x6f\xfb\xde\x7d\xbb\x73\x25\xd4\x16\x58\x4b\xab\x7f" "\xfa\x65\xd7\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe8\xd7\x0f\x8e" "\x1d\xbd\xfc\xf6\x1b\x9f\x7f\x67\xe5\xf9\xff\xd5\xe7\xff\xd2\xf3\xff" "\xe9\xce\xdf\xf4\xfc\xff\x4f\xb2\xe7\xff\xf3\xe7\xe4\xd3\x73\xf0\xe9" "\x39\xc0\x6d\x5d\xf2\x9b\xe3\x64\x0d\xac\xce\x65\xe3\xd5\x62\xf8\x70" "\x56\xdf\xed\x59\x39\x3b\xb2\xe9\x3e\x12\xe3\x56\x3f\x7e\xf1\xf9\xff" "\x54\x5c\xde\xae\x6b\xaa\xcf\x3d\xd9\xf0\x5a\x8f\x64\xd6\x9c\xc0\x2d" "\xed\xa5\xcc\x65\x6d\x90\xe4\xfd\x05\x7e\x3c\xc6\x17\x62\xfc\xeb\x00" "\x25\xaa\xcc\x77\x1f\x1c\xe3\xa2\xf6\xad\xd3\xba\x9e\xda\xa7\x68\x6b" "\x97\xa2\xa1\x7d\xe0\xc9\x91\xbe\xb7\xb4\x36\xa4\x76\x4c\xd2\xf3\xdf" "\x5d\xdb\x75\x6a\xfb\xb2\xb7\x8d\xa0\x8e\xac\xbd\x51\x3c\x4e\x58\xf6" "\x3c\x02\xdd\xfd\x73\xaa\xda\xff\xfe\xd7\xea\x8c\x97\x5e\x17\xa1\x77" "\x98\x1d\x6d\x79\x3f\x9f\xde\x75\xa2\xd1\x73\x2f\xbd\xdf\x1e\x6c\x00" "\xd6\x46\xd9\xfd\x7f\xa6\xf3\x9e\x29\x3e\xfb\xc7\xaf\x6d\xbc\x19\xd2" "\x68\x57\x1f\xeb\xdc\x5e\xe6\xed\x97\xc2\x20\xfe\xf2\x76\x67\x7a\xdc" "\xfb\x9f\x5c\xef\xf2\xf3\x7e\xfb\x46\x5d\x7e\xd9\xf3\x3f\xea\xfe\x3f" "\x5b\xfd\xdf\xf5\xbd\xfd\xcb\x7a\xcc\xab\x0f\x57\xee\x7f\x7f\x71\xe5" "\x9d\xb6\x62\xc3\xce\x7e\xcb\xcf\xe7\x3f\xb5\x03\xbd\x7d\xb0\xf2\xaf" "\xc5\xf2\xd3\xdc\x3c\x14\xfa\x2b\xbf\xf1\xab\xac\xfc\xfc\x82\x50\x9f" "\xfe\x97\x95\xbf\xa9\xcf\xf2\x6f\x99\xff\x5d\xc3\x95\xff\xff\x58\x7e" "\x5a\x6c\x0f\x3f\xd0\x6f\xf9\x2b\x35\xae\x54\x3b\xeb\x91\x9f\x37\x4e" "\xd7\xff\xf2\xf3\xc6\xc9\xf5\x6c\xfe\x53\xdb\x9e\x1f\x50\xfe\x37\x9e" "\xef\x36\xff\x43\x76\xd4\x78\x23\x96\x0f\xd3\x6c\x52\xfa\x99\x1d\x54" "\xb6\x1f\xd1\xda\x69\x1f\xbe\xff\xdf\xe8\xdc\xda\xf6\xff\xdb\xaa\x6c" "\xb6\x59\xcb\xef\xc3\xf8\x5c\x4c\xa7\x0d\x71\xba\xcf\x21\xef\xef\x64" "\xd0\xfa\xa7\xfb\x2b\xd2\xff\xc0\x8e\xec\xf3\x2b\x05\xff\x6f\xfa\xff" "\x9d\x6c\x5f\x8a\x71\xd1\xef\x21\xf5\xff\x9b\xd6\xc7\x7a\xfc\xcb\x6f" "\x4b\x37\x97\x65\x4a\xd7\xba\x2c\xdb\x3b\x75\x5b\x03\x93\xea\xdd\xa9" "\xba\xfe\x37\x11\x61\xe3\x18\xd4\x41\xe8\x3f\x34\x66\x86\x98\xae\xd5" "\x4f\x5c\xc9\xf5\x6f\x34\x1a\xeb\x7b\x42\xab\x40\xa9\x85\x53\xfa\xf2" "\x2f\xfb\x38\xa1\xec\xf2\xcb\x5e\xfe\x45\xf2\xfe\x7f\xf3\x7d\xf8\xbc" "\xff\xdf\x3c\x3f\xef\xff\x37\xcf\xcf\xfb\xff\xcd\xf3\xe7\xe3\x37\xd4" "\x2b\x3f\xef\xff\x37\x5f\x9e\x79\xff\xbf\x79\xfe\x3d\xd9\xe7\xe6\xfd" "\x03\x2f\x14\xe4\x7f\xb4\x20\x7f\x67\xf7\xfc\xd6\x61\xfb\xbd\x05\xd3" "\xef\x2a\xc8\xff\x58\x41\xfe\x9e\x56\xfe\xa1\x8e\x31\x52\xfe\x7d\x05" "\xd3\xdf\x5f\x90\x7f\x77\x41\xfe\x03\x05\xf9\x9f\x28\xc8\xff\x64\x41" "\xfe\x83\x05\xf9\x0f\xb7\xe5\xb7\xf7\x01\x9d\xf2\x3f\x55\x30\xfd\x9d" "\x2e\x3d\x8f\x32\xad\xf3\x0f\xd3\x2c\x7f\x3e\xcf\xef\x1f\xa6\x47\xba" "\xfe\xd3\xeb\xf7\xbf\xbd\x20\x1f\x98\x5c\x3f\x7b\x75\xdf\x91\xa7\x7e" "\xfb\xcd\xfa\xca\xf3\xff\x73\xad\xf3\x21\xe9\x3a\xde\xe1\x98\xae\xc5" "\xe3\xa7\x1f\xc6\x74\x7e\xdd\x3b\xb4\xa5\x6f\xe6\xbd\x11\xd3\x7f\xcb" "\xf2\xc7\xfd\x7c\x07\x4c\x93\xbc\xfd\x8c\xfc\xff\xfd\xa1\x82\x7c\x60" "\x72\xa5\xfb\xbc\xfc\xbe\x61\x0a\x55\x36\x76\x1f\x1c\xe3\xa2\x76\xab" "\x7a\xed\xe7\x33\x59\x3e\x1d\xe3\xcf\xc4\xf8\xb3\x31\x7e\x24\xc6\x8b" "\x31\xde\x1b\xe3\x7d\x31\x5e\x1a\x51\xfd\x58\x1f\x47\x5e\xfb\xfd\xc1" "\x17\x2b\xab\xc7\xfb\x5b\xb3\xfc\x7e\xef\x27\xcf\x9f\x07\xea\x68\x27" "\x2a\x84\xb0\xbf\xcf\xfa\xe4\xe7\x07\x06\xbd\x9f\x3d\x6f\xc7\x6f\x50" "\xb7\x5b\xfe\x90\x8f\x83\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x94\xa6\xda" "\x7c\x5d\x5e\x5e\xa8\x84\x70\xf1\xf5\x97\x8f\x3e\x79\xfc\xf4\xde\x9b" "\x43\x0e\xb5\xc6\xa8\x37\x5f\x67\xdb\x52\xb5\xd6\x74\x21\x3c\x1a\xe3" "\x99\x18\xff\x32\xbe\xb9\xfe\xde\x0b\x27\xdb\xe3\x1b\x31\xae\x84\xa5" "\x50\x09\x95\xd6\xf0\xf0\xc4\xd5\x56\x49\x9b\x43\x08\xe7\xc2\xee\x70" "\x29\xd4\xc3\xce\x8b\x97\x5f\x7a\x73\xe9\xf1\xe3\xe7\x8f\x5d\xd8\xf3" "\xd6\x2b\x07\xaf\xac\xdf\x12\x00\x00\x00\x80\x3b\xdf\xfb\x01\x00\x00" "\xff\xff\x07\xae\x0f\x14", 2726); syz_mount_image(/*fs=*/0x200001c0, /*dir=*/0x20000300, /*flags=*/0, /*opts=*/0x20000040, /*chdir=*/1, /*size=*/0xaa6, /*img=*/0x20000340); break; case 1: memcpy((void*)0x20000000, "blkio.bfq.io_queued_recursive\000", 30); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x20000000ul, /*flags=*/0x275aul, /*mode=*/0ul); if (res != -1) r[0] = res; break; case 2: syscall(__NR_mmap, /*addr=*/0x20000000ul, /*len=*/0xb36000ul, /*prot=PROT_WRITE*/ 2ul, /*flags=MAP_STACK|MAP_POPULATE|MAP_FIXED|MAP_SHARED*/ 0x28011ul, /*fd=*/r[0], /*offset=*/0ul); break; case 3: syscall(__NR_ftruncate, /*fd=*/r[0], /*len=*/0xc17aul); break; case 4: memcpy((void*)0x20000040, "/dev/mISDNtimer\000", 16); res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x20000040ul, /*flags=*/0ul, /*mode=*/0ul); if (res != -1) r[1] = res; break; case 5: res = syscall(__NR_ioctl, /*fd=*/r[1], /*cmd=*/0x80044940, /*arg=*/0x20001b00ul); if (res != -1) { r[2] = *(uint64_t*)0x20001c10; r[3] = *(uint64_t*)0x20001c68; r[4] = *(uint64_t*)0x20001c70; } break; case 6: memcpy((void*)0x20000180, "msdos\000", 6); memcpy((void*)0x20000100, ".\000", 2); *(uint16_t*)0x20007980 = r[4]; sprintf((char*)0x20007982, "0x%016llx", (long long)r[3]); memcpy( (void*)0x20007994, "\x12\xa4\x09\x5a\x2a\xac\x12\xf0\xbf\xcb\x20\x6d\x98\x2e\x44\x06\x63" "\x81\x38\x8d\x27\xf1\x40\x02\xd8\xd7\x43\x1d\x39\x47\xf6\x39\x9c\x7f" "\xf9\xf5\x19\x3f\xc0\x39\x86\x53\xe5\xa6\x7b\xbb\x31\x9f\x02\xbf\x4a" "\xc6\xf6\xcc\xd5\xac\xbf\xe1\x35\x0c\xc3\xa6\xd2\xd4\x8c\xf6\xc0\x89" "\xdd\xf6\x71\x71\xff\xb3\xb1\x59\x88\xe7\xb3\x94\xc5\xda\xf3\xe1\x2c" "\xa0\x5e\x4d\xbd\xad\x7e\xdd\x45\xf1\x0c\xbc\x29\x6a\x53\xa5\x30\xd4" "\xc2\xd2\x03\xee\x65\x0d\x5f\xff\x3a\x9b\x5a\xae\x78\x79\x4f\xe8\x43" "\x27\xe5\x08\x17\x2c\xdd\x72\xee\xff\x5a\xf4\xd6\xdb\x93\x79\xbe\xf2" "\x0d\xde\x8e\x64\xb9\x1d\x31\xa8\x4c\xe8\xa7\x59\x8b\xb7\x8c\xc8\x51" "\x08\x87\x48\x11\xfc\x65\x0f\x05\x20\xa5", 163); memcpy( (void*)0x20007a37, "\xf1\xbc\xde\x22\x81\xa8\x43\x92\xf4\xe6\x6f\xf7\xef\x22\xaa\x9a\xf7" "\x27\xce\xae\x8a\x8e\xc9\x5f\xc1\xb7\x30\x83\xde\x2d\xe8\x25\xa0\xcb" "\x2b\x0b\xe7\x74\xfd\xb3\x36\x50\xd7\xda\xce\x27\xc1\x6b\xc2\x3b\x2f" "\x7c\x7f\xb7\x25\x85\x54\x89\x39\x69\x8f\x28\x0d\x13\x8a\xa9\x25\x5a" "\x8a\x92\x40\x08\xf8\x47\x7e\x82\xba\x11\xcd\xb1\x1e\xfd\x5c\xa2\xf1" "\xab\x04\x9c\xe2\xcc\xc4\x15\xd2\xda\xf8\xda\xc7\x25\x53\x3a\x55\x8d" "\x56\x16\x54\xfa\xf5\xe0\x92\x4f\x13\x76\x17\x4f\x37\x4d\x66\x4f\xad" "\x4a\x6a\xb2\x4e\xc0\xe8\x22\xe7\xf9\x42\x6e\x8e\x5d\xe1\xfe\x58\x08" "\x5a\x0a\xe8\x6f\xd0\x2a\x11\x8b\x93\x65\x96\x18\x34\xd4\x62\x08\xb9" "\xfb\x4c\xb1\xa1\xfa\x96\x2a\x8b\x00\x00\xdc\x2e\x31\x93\x79\xea\x1e" "\x5a\x07\xae\xb3\xf9\xcd\x4e\x64\x8d\xf4\xdd\x18\xe6\x25\x3e\x7b\x23" "\x10\xa7\x8d\x63\xa2\x32\xa2\xa4\x07\x58\x02\x7a\x47\x2e\x7d\x26\x3e" "\xf5\x67\xa8\x41\x66\xf2\x6e\xe5\x6e\x70\x1c\x63\xa8\x86\x37\x87\x88" "\xa5\x12\xf2\x8e\xde\xc0\x86\xb1\xc0\x82\x3c\x02\x88\x40\xee\xaf\x3f" "\x5d\x87\x69\x02\x3c\x01\x21\x86\x14\xf4\xfa\x40\xbe\x98\x92\xe7\xa2" "\x85\xac\x63\xf7\xf9\x7a\xaa\x5b\x8e\xcc\x86\xe2\x8c\x61\x93\xbc\x21" "\xa2\xb8\x33\xe5\xc9\xc7\x03\xc4\xcf\xa0\x63\xdd\x34\xc2\x45\x70\x6b" "\xde\x3d\x7a\xc3\x73\xab\x04\xb6\x2b\x41\x11\xb5\x9e\xab\xd4\x36\xdd" "\x97\xe7\x88\xa3\x6e\xf2\x5b\xad\x99\xbe\x2a\xa9\x24\x94\x95\x58\xc8" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 353); sprintf((char*)0x20007b98, "0x%016llx", (long long)-1); *(uint16_t*)0x20007baa = r[2]; sprintf((char*)0x20007bac, "%020llu", (long long)0); memcpy( (void*)0x20007bc0, "\x9a\x7f\x40\xad\x4c\x71\x45\x90\x3a\x86\x8b\x90\x20\xe1\xe8\x89\x9e" "\xd5\x74\x7d\xb2\x30\x04\xfc\x9d\x24\x89\x00\xab\xca\xa6\xb0\x65\xcf" "\x08\x00\x93\x0a\x71\xdc\xd8\xb8\x95\x5d\x93\xc7\x8b\x9d\x4e\x5e\x06" "\xd8\xd5\xc9\xac\x9b\x75\xd1\x77\x75\x4d\x6e\xba\x23\xe6\xd2\xbe\x54" "\x6c\x0d\xfe\xcd\xf6\x1b\xaf\x73\x29\x50\xa5\x72\x9c\x01\xfb\xdc\x11" "\xe3\x6c\xb4\x11\xbe\x20\x0a\x91\x35\x65\x7a\xcd\x97\xd2\x1e\xe4\x6a" "\xac\x31\x3e\xbd\xdd\xd9\x26\x5a\xf1\x65\x58\xdd\x3e\x5b\xa4\x83\x66" "\x59\xa6\xab\xfe\x08\xaa\xd8\x42\x76\xac\xf9\x49\xbd\xaa\x34\xbd\xf7" "\xf7\xb2\xdf\xb2\xfe\x8b\x9d\x6d\x22\x5d\xce\xce\xbe\xb6\xe1\x5f\x64" "\x99\x94\x72\x88\x42\xbd\x99\xfc\x94\x89\x7d\x24\x31\x5a\xc2\xd1\x7b" "\xf6\xc2\xac\xfb\xfa\x84\x64\xd8\x0f\x36\x30\x4f\x88\xb9\x06\xb7\x8a" "\xb3\x59\xbe\x34\x79\xdb\x5b\x0e\x75\x55\xf0\x44\x16\x80\x7c\x22\x02" "\xd6\x55\x1f\x24\x25\x44\x0b\xe7\x41\xdb\xe0\x53\xe0\xbf\xeb\x84\x56" "\x23\xe7\x22\xa9\x29\x38\x43\xf1\xcf\x0a\x71\x11\x9d\xca\xdf\x7e\x35" "\x3a\xf4\xda\x52\xae\xd3\x08\x6d\x6e\x5a\x09\x57\x74\x24\x8b\xe9\xa1" "\xb1\x41\x8d\xec\x1c\x03\xa2\xcb\x0e\xce\x08\x40\xeb\xea\xaf\x7b\x67" "\x86\x7d\xa4\x59\x43\xb7\x00\xe2\xd6\xda\xd7\x75\xae\x6f\x33\xe5\x5a" "\xa8\x6c\xa8\x4c\x33\x6c\x91\xe3\xb7\xd7\x22\x4f\x7a\x9a\x10\xd5\xb4" "\x5a\x6c\xe0\x76\x9d\x87\x54\x15\xbe\xa1\x36\xb5\x50\x8e\x5e\x0a\x88" "\x29\x07\x92\xda\x3b\x11\xb2\x28\x4a\x3d\x75\x7c\x30\x1c\xec\x78\xb5" "\x5d\x3f\xcf\xa0\x73\x61\x5c\xcb\x08\x9f\x66\xc5\xb9\xa5\xc8\x4f\x6c" "\x1b\xb7\x8c\x33\x70\xc4\x68\x7e\xab\x26\x07\x11\xfa\x05\x52\x56\x87" "\xc7\x70\x9e\x15\xcd\xde\xa0\x61\xf7\x07\x98\xcb\xf9\x40\xad\x92\x9e" "\xb8\x0f\x33\xad\x8b\xb4\xfc\xd3\x22\xdd\x05\x58\xf1\x11\xd7\xd0\x13" "\x51\x14\x79\x76\xb4\x25\xa2\x7e\x57\x34\x02\x49\x00\x55\x05\x4c\xf3" "\xd8\x0b\xeb\xde\x6a\x89\xf3\x08\x61\x70\x63\x37\x40\xf0\x87\x80\xaa" "\xc3\xa7\x3f\x17\xea\xed\xa8\xde\xb6\x42\xc2\x88\x79\x62\x59\x6b\x4d" "\x78\xc0\xff\xff\xb2\x8d\x0e\x64\x07\x3b\x06\x41\xf8\x9c\xf8\x3a\x69" "\xaf\xaa\xea\x03\xba\x60\x70\x83\x8f\xdb\xda\xcc\xb8\x16\x30\xa6\xfd" "\xaa\x77\xfc\x10\x14\x60\x13\xb9\xfd\x79\xe9\x65\xa3\x20\xda\xf8\x1c" "\x1a\x51\xf0\x32\xa3\xf4\x62\xf2\x74\x0e\x57\x9e\xb1\x16\xca\xd8\x0b" "\x4e\x23\x33\x26\xbf\x94\xfe\xa5\x21\x84\x51\x7a\xcc\xf6\x08\xb1\xfb" "\xfb\x39\x59\x42\x86\x98\x41\xb9\xca\x0f\x31\x4b\xef\xf6\xb2\xdc\x0a" "\x74\xd7\x59\x90\x12\x27\x4b\x24\x77\x5f\x03\x82\xe7\x29\x07\xc1\xf0" "\xc5\x71\xb9\x94\xf0\x48\xc0\x26\x6f\xeb\x77\x5d\x89\x3f\xec\x84\xe5" "\x73\x3c\xd6\x6a\x96\xcd\x45\xb6\x0f\x63\x74\x3b\x17\xb0\x5d\x99\xc4" "\x27\xa2\xd0\x0a\x27\xfe\xf1\x7c\xad\xf1\x28\x05\x9a\x2e\x22\x7b\x80" "\x70\x17\x55\xb0\xbc\x70\x6f\x32\x25\x5c\x8c\xd6\x19\xfa\x99\x5c\xc7" "\x64\x9f\x28\x33\x73\x61\xa6\x2c\xff\x46\x66\x9f\xa4\xcf\x09\x5a\x2d" "\x14\x89\x87\xa9\xfa\xfa\x6e\x1f\xb9\xf5\x9b\x5a\xc5\xff\x10\xa4\xc6" "\x2e\x01\x87\xa3\xc7\x5a\x98\x3f\x7f\x52\x11\x14\x2c\x6c\x09\x17\x0a" "\x13\xe2\x9c\x20\x44\xe5\x56\x8b\xda\x80\x55\xce\xe4\x72\x2e\x44\x5e" "\x83\xea\x01\x30\x7c\x42\xcb\xe6\x3a\x5b\xc5\x29\xe1\x20\x0e\x58\x74" "\xf7\x50\x02\x75\xab\xac\xd6\xcc\x0e\x3b\xf8\xfd\x38\xab\x7b\xab\x39" "\xf5\x4d\x18\x0d\x60\x89\x2e\x2e\x3a\x71\x3a\x3e\x65\x4c\x89\xb8\xe9" "\xba\x44\x74\x90\x99\x91\x84\x45\x14\xc0\x4b\x65\x5c\x66\xcc\xd6\xf2" "\xa1\x7e\x29\xff\x69\xd3\x43\xeb\xac\x7a\xc5\xe1\x51\x0a\xd4\xff\x52" "\xe6\xa9\x32\xa9\x7b\xb0\xd8\x14\x25\x9d\xa6\x54\x50\x22\x15\x2d\xd6" "\x3f\x06\x21\x9a\x1d\x66\xec\x22\x78\xb6\x94\x87\x6e\xd6\x19\x5b\x05" "\x43\xb8\xc9\x28\x9b\x84\x38\xe8\xee\x57\xdd\x38\xbc\xdb\x04\x5a\x6f" "\xc4\xce\xde\x28\xef\xfa\xa0\x35\x4a\xfb\xd4\x19\x0f\xcb\xcc\xd9\xa0" "\xe9\x15\x08\xe4\x39\x9e\x0e\x30\xa0\xbf\xde\xdc\xc1\x94\x54\xb6\xdd" "\x7c\x27\x85\xa6\xe4\xfe\x74\xa0\xec\xe1\xd6\x83\xad\x07\xd7\x6e\xaf" "\xec\x02\xfb\x0d\x88\xde\xbf\xea\xcd\x35\x31\x41\x31\x85\xda\x0f\xfa" "\x4f\xb9\xb5\xe6\xd5\xa9\x16\xf7\xbb\x5d\x51\xef\xc8\xab\x61\xe4\x95" "\x3f\xc6\xb2\xd1\xe6\x70\x76\x9f\x3c\xa5\x6d\x51\xb8\x04\xce\xb1\x18" "\x27\x8a\xcc\x90\x42\x2e\x1f\x51\xe4\x48\xa2\x7d\x2f\xe4\xf9\x3c\x88" "\xcf\x7c\x61\x48\x47\x4b\xf6\x50\x90\x2d\xd6\xdd\x96\x54\x10\x44\x11" "\x3d\x24\x4c\xf9\x38\x15\x0e\xc4\x26\xe7\xed\x63\xe1\xf1\x53\xbb\xe3" "\x28\xf4\x23\x25\x52\xb1\x04\xc8\xde\xe6\x0b\x0c\x4e\x4c\x25\xf2\x60" "\x5e\x97\xcc\x6f\x42\x63\xd3\x2e\x83\x40\xbe\x2d\x16\x71\x37\x68\x23" "\x73\xae\x4c\xd5\x01\xfd\xc9\xc5\x35\x9b\x40\xf5\x28\x03\xa5\xe4\xc0" "\xe0\x4a\x5d\xe0\x41\x2c\x5c\xbd\x4d\x05\xe6\x13\x5a\x12\x09\xd4\xb2" "\xdf\xf5\x0d\x39\xe4\x81\xf1\xd1\xb0\x1e\xd7\x10\x04\xfb\x0c\x18\xe7" "\x36\xaf\x8a\xb1\x76\xf8\x33\xa4\x39\xa8\x5c\x91\x32\xe6\xd2\x29\x6f" "\x66\x57\x71\xc6\xa2\x84\xea\xdc\x08\xc9\x4f\xfa\x52\x0d\xcc\x37\xfd" "\x64\x26\xc1\x52\x36\x46\x99\x51\x4b\x15\xd4\xdf\x67\x32\xff\xf3\x98" "\x34\xe8\xba\x29\x68\x8b\x19\xdb\x27\xa9\x70\xd9\xd7\xfb\xee\x97\x3c" "\x76\xbe\xe0\x4f\xb6\x16\x49\x63\x96\x9e\xbd\xe0\xf7\x85\x60\x67\x81" "\xd6\x37\x26\x73\x6d\x8b\x60\xa7\x13\xd5\xf7\x22\x07\xa2\x3f\x6f\x00" "\x42\x0f\xdf\x24\xd1\x4c\x06\x9f\x36\xa7\xe2\x36\x62\x04\x81\xcc\x7a" "\x63\x85\x7c\xc1\x35\x5b\xac\x8d\x4f\x9a\x3f\x32\x78\x5a\xd4\xd9\xd8" "\x17\x19\x07\x7a\x81\x6b\x33\xb9\x80\x06\xc3\x22\xee\x47\x3a\xa9\xf8" "\xf8\x3f\xae\x86\xa4\xd4\x21\x10\x4b\x29\x8a\x9e\x42\x35\x7c\x44\xb7" "\x73\xe3\x50\x4b\x3f\x9e\xb5\xb2\x93\x30\x41\x1b\x77\x6b\x78\xfd\xb6" "\xdd\x97\x13\xdd\x1a\xee\x0c\xc9\xc7\xee\x8b\xd2\x3a\x50\xd4\xc8\xba" "\xba\xf6\xd7\x4b\xc2\x53\x77\x00\x9a\x8c\x57\xc9\x41\xf8\x0e\x58\xac" "\x08\xc9\x3a\x27\x56\x56\xcb\xad\x38\x64\xdf\x9e\x79\x13\x05\xd6\x61" "\x03\xab\x30\x98\x3b\x07\x55\x3e\xde\x5b\x5d\x5b\x0a\xab\x15\x7f\x80" "\x5e\xb6\xc1\x1c\x75\xdd\x7f\x29\x7c\x2c\xc9\x11\x05\x51\x13\x1a\x79" "\x71\x64\xde\xc4\x22\xb1\x37\x99\xf1\xc2\x61\x46\x4c\x76\x5a\x62\xc2" "\x01\xeb\x9c\x86\x86\xee\xe9\x46\x42\xd5\x9f\x42\x9c\xd1\x37\xcb\xa0" "\xd1\xa8\x12\x6d\xcd\xfc\x28\xea\x5c\x20\x15\x26\xc6\x11\x64\xa8\x6f" "\x48\x0d\xfd\xe0\xc6\x0f\xdf\x6a\xfd\x3c\xd6\x47\x19\xde\x1d\x89\xb5" "\xa3\x62\xe0\x58\x05\x4a\x9d\xb7\x3a\xaf\xfa\xc3\x24\xb0\x4e\x89\x03" "\x06\x0e\x1f\x14\xca\x4a\xc3\x1c\x82\x18\x30\x66\xe6\xd5\x81\x68\x5e" "\xfb\xe3\x45\x2a\x20\xa6\x65\x16\x6b\x03\x80\x82\x20\x77\x0d\x66\x05" "\x19\x71\xb6\x1d\x81\x14\x37\x6e\x22\xa4\x51\x1c\xae\x9f\xdf\x7b\xbe" "\xd6\x8b\xb9\xf4\x5b\x57\xee\xe1\xc1\x57\x75\x73\x0e\xf1\x43\x47\x31" "\xd7\xb8\x2a\x7c\xbc\xd6\x15\x53\x96\x26\x39\x84\xed\xfc\xea\x62\x19" "\x61\x89\xda\x0b\xa9\x90\x8d\x7d\x5e\xf5\x14\xd7\x5a\x3e\x1d\x4a\xe4" "\x26\x54\x36\x50\x83\x87\x3f\xc4\xce\x96\x9f\xa4\xfa\xc5\x1d\x64\x0b" "\xe8\xd9\x48\xbb\x94\x64\xd1\xa7\xe4\x94\xc8\xdf\x98\xbd\x5a\x56\x9f" "\xf7\xfe\x1a\xca\x54\x2c\x34\x61\x01\x48\xa8\xf1\xdc\x9d\x60\xff\x0f" "\x76\x12\x70\x57\x7f\x28\x6a\x36\x2f\x32\x16\x41\x84\xff\xce\x3a\xd1" "\x32\x63\x7e\x9f\x03\x81\xe9\xce\x76\xa1\x1f\x29\x6f\x9d\x1e\x83\x5c" "\xdc\x44\x92\x61\x04\xe1\xdf\x4d\x0a\x28\x2a\x84\xb9\xfb\xc2\x30\x64" "\xbf\xca\xb0\xd2\x21\xc6\xe3\x12\x4a\xe8\xba\x60\x22\xe6\x2f\x17\x0d" "\xcc\x2d\x65\x5f\x73\xb4\x0f\x83\xfd\x65\xf5\xc7\x05\xbc\x1f\x9e\x8d" "\xf1\x3a\xde\xad\xff\x9e\x1f\xe4\x66\x0a\x55\xbe\x7d\xc9\x69\xcf\xff" "\xae\xd6\x07\x19\x01\x62\xdc\xd0\x9d\x0c\xd8\x6a\x29\x7b\x22\x14\x2b" "\x88\xf0\xeb\x28\xdd\x1a\x45\x15\x2a\x4f\x4f\x2d\xca\x0d\x96\xd3\x9f" "\xa5\x94\x34\x90\x40\xf4\x86\xcd\x48\x6a\xf6\x19\xb7\x08\x32\x36\xcf" "\x90\x32\x4c\xdd\xc6\xf1\xed\x0f\x6a\x10\x3c\x8d\x93\x6d\x7f\x2f\x31" "\xd4\x20\xef\x50\x93\x18\x38\xe6\x67\x21\xbf\xf7\x49\x46\x17\xb6\xb4" "\xbc\x38\x5f\x3e\x51\xb3\xf8\x1c\xf5\xd6\x95\x3a\xc7\xfd\xdc\x0f\x34" "\x66\x68\x29\x11\xb3\x8b\xc7\xf0\x82\xe0\xc1\x8e\x3a\xe0\xba\xdf\x7f" "\x3f\xd3\xe1\x86\xeb\xc2\xba\xb7\x1f\xa2\x6f\x77\xbb\x14\xcd\x97\xe6" "\x76\x1c\x93\xc8\xc2\x58\x87\xc0\xef\x1f\x3d\xc1\xd8\xd8\x6c\xe0\xfb" "\x73\x19\x0f\x66\xf4\xde\xca\x77\x97\x7e\x8d\x60\x64\xbf\xee\xac\x3f" "\xad\x2b\xc5\x04\x88\xc1\x44\xe2\xa1\xa8\x2f\xcc\x1e\x1c\x12\xac\x54" "\xbf\x3e\x2d\x46\x8e\x8f\x53\x24\x1e\x4a\x6a\xd9\xe4\x66\x74\x6a\x45" "\xb0\x53\x45\x2d\xed\x5c\xaa\x20\x46\x18\x81\xd7\x8d\x82\x35\xe9\x86" "\xba\x8b\x77\xe8\x36\x01\x65\x5d\x26\x50\xbf\x1b\x64\xce\x17\xc7\x53" "\x14\x21\x6b\x43\xbb\xd1\x10\x1a\x2e\x12\xe5\x75\x25\xbb\x7d\x3b\x13" "\x6a\x70\x63\x5b\xda\xc8\xaf\x24\x36\x7a\x24\xce\x2f\xe2\xa7\x2e\xf2" "\xb0\xe5\x6f\xf8\xdc\x62\xa8\x29\x46\xf8\x6f\x9b\x6b\x14\x18\xa8\x9b" "\x19\x71\x37\x2d\xfe\x7d\x5c\xe2\xe6\x61\x1b\xef\xff\x72\x1f\x04\xa1" "\x9b\xce\x7f\x90\xb1\x55\x1a\x4c\xde\xad\x13\x66\x62\xc5\x05\x13\xfd" "\xde\x6f\x9d\x4a\x19\x9c\x39\x07\xed\x87\x99\xf2\x31\xf5\x4d\xd8\x34" "\x7c\x71\xd8\x29\xff\x8d\xdc\x5d\x96\xb5\xaa\xc2\xfe\x58\x65\x2c\x81" "\xff\x7f\x54\xe2\x56\x81\x19\xdf\xf2\x76\x3e\xf4\x35\xaa\x42\x06\x30" "\xda\xcc\x7e\x94\x14\x34\x0e\xe8\x68\x8f\x46\xc7\xa8\xab\x96\xd8\x60" "\x93\x76\x41\x04\x2b\x3c\xdf\x68\x57\xff\x1d\x2d\x4e\x47\xce\xc1\xf2" "\x3e\x65\xfe\x54\x1f\x38\xcb\x96\xb1\x32\x66\x6f\x99\x90\x02\xe8\x9c" "\xd1\x89\x6c\xa5\x8c\x2e\x63\xb8\x73\x82\xe1\xa6\xc1\xee\x9a\xfa\x56" "\xcf\x3b\xa9\x23\xfa\x9c\x98\x9e\x20\xbf\xf3\x13\xf3\x72\x52\x63\x2f" "\xdc\xff\x03\xfb\xdd\x2d\x33\x4e\xe9\x3b\xaf\x75\xc1\xbd\xae\x30\xfe" "\xaa\x81\xfb\x2a\xc1\xb6\x3c\x42\xdd\xa0\x6f\x20\xce\x8c\x9d\x00\x3e" "\xb3\xef\xed\x79\x31\xde\xf3\x42\xfb\x87\x4f\xce\x92\x76\x3f\x6f\x47" "\x7c\x7f\x58\x9b\x75\xd2\x12\x94\x19\xfc\x4c\xb7\xa8\x89\x3a\x1d\x3f" "\x94\x53\x3e\xd9\xfd\xf9\xf2\x1f\xc2\x54\xfd\x80\xaa\x74\x75\x08\x33" "\xd3\x90\x32\x7a\x21\x07\xe7\x61\x24\x09\x28\xd3\x5a\x36\xc5\xea\xca" "\x61\xfd\x84\x81\x16\xb8\xdd\x7e\xc8\x15\x79\x28\xbc\x2d\xd8\x7f\x77" "\x56\xaa\x51\x7c\xf6\xa6\x1d\x20\x09\xfd\x4b\xa0\x57\x9c\xa3\xb3\x12" "\x9c\xfd\x54\x03\x54\x6f\x5a\xb6\xd0\x57\x57\x99\xa0\x08\xfc\x67\xda" "\x96\x58\x42\x76\x36\xd8\xf8\x06\xd9\xb8\xca\xd6\x4a\xee\x43\x8d\x0a" "\x9b\x45\x95\x7f\x31\xa5\xaf\xe3\xed\x89\x4a\xdd\x9a\xca\xdf\xd3\x47" "\x24\x60\x99\xc6\xff\x0b\x4e\xc6\xf1\x9a\xc6\x15\x57\xda\xf8\x73\x9e" "\x52\x81\x85\xab\x14\x68\xca\x72\xd6\xd7\x2e\x4f\x02\x6e\x37\x1e\x54" "\x0b\x77\x4b\x65\x76\xdf\x30\x14\xdc\xc9\xe9\x1b\x2c\xd1\xf0\x40\x3a" "\x4f\xca\xa6\x62\x7b\x22\x68\x2b\xb5\x4f\x92\x15\x0c\x29\x17\xac\xae" "\xe1\x97\x2b\x2b\x03\xbc\x2b\xd3\x7f\xdb\x9e\x73\x52\xc6\x54\xd9\x4e" "\xf1\x96\xb7\x22\x9e\x4d\xa5\xee\x62\xb7\xd3\x95\xec\xdd\x51\x77\xf2" "\x56\x32\x42\xea\x49\xff\x78\x15\x1a\x4a\x81\x6a\x94\xe8\x9b\x03\xf4" "\x1c\x7e\x66\x84\xf8\xbe\x3e\x58\x02\xe9\x33\x8e\x7c\xbd\x3b\x43\xf7" "\x08\xc0\x62\xf9\x44\xa5\x9f\x31\xb0\x2c\xa9\xa1\x77\xe6\xb6\x81\xac" "\xce\xe8\x78\x5d\x24\x67\xd2\xd7\x86\x36\xbe\x43\x30\xfe\xba\xa3\xf6" "\x90\x7d\xb0\x79\x92\xa2\xde\x74\xe4\x59\xf3\xae\x8e\xe6\xad\xae\x20" "\xcb\xc7\x5a\xab\xd2\xd5\xd3\x42\x4d\xe0\xdd\xcc\x3d\xdd\x98\x1c\x3a" "\x49\x66\xc5\x7f\x8f\xdb\x1c\x42\xdb\x87\x39\x5f\x0b\xc8\x00\xff\x8d" "\xdb\x4c\x22\x8a\x7d\x79\x3d\x8a\x99\x78\x85\x49\x4a\x85\x78\xf5\x43" "\x3d\x3f\x82\x88\x6e\xa5\x73\x64\x1b\xf1\x60\x65\xef\xbc\x25\x71\x8c" "\x88\xf7\x27\x7c\xe0\x4c\x94\xaf\x56\x0d\x8d\xeb\x79\x68\x49\x6f\x84" "\x9d\x3f\xad\x78\x74\x12\x72\xb0\x8b\xf7\xae\xc3\xf3\xc7\x77\x42\x8d" "\x3b\x8b\x89\x73\x33\xae\x5a\xfb\x68\x23\xaf\x63\xcb\x73\x47\x60\x1e" "\xe2\xe8\xd4\xe2\x1b\x21\xa1\x2e\x6d\x42\xf6\x6a\x1a\xac\x26\xd2\x96" "\xbc\x68\xa9\x98\xd8\xba\x17\x9e\xd5\xf7\x56\xc2\xef\xd8\xa7\xac\xc0" "\xe3\xf0\x80\x93\xbb\x4a\x83\xd3\x7f\x15\xb4\xfe\x07\xc9\x08\x58\x05" "\x8a\xd1\xff\x0e\x21\xbb\x7b\xf4\x36\x30\x79\xc5\xd4\x52\xdb\xa5\x97" "\x2b\x21\xc8\xf4\x1d\xaf\x6f\x11\xa5\x1d\x32\x1d\x3c\x1d\x54\x41\x90" "\x23\x80\x36\xd9\x07\xd9\x65\xff\x46\x9c\xe4\x89\x5e\xb7\x67\x5f\x3e" "\x94\xa1\x5f\x83\xb8\x37\xb8\x92\xa4\x03\x90\xd8\x7d\x76\xe9\xb1\x5e" "\xda\x02\x36\x62\x99\xd3\xdd\x93\x94\x34\x66\xbc\xee\xb2\xf9\xe4\x65" "\xad\xcc\xc0\x8e\x1a\x02\xc3\xac\x01\x81\x59\x31\x62\x7e\xd3\x27\xe0" "\xff\xbe\x09\x56\x32\x21\xa3\x65\xb8\x8c\x4f\x24\x49\xbd\x36\x34\x92" "\x0d\x5b\xfb\xde\x7c\xdc\x92\xc4\xcb\x16\xa5\x79\xf3\x5f\x07\xda\xfc" "\x87\xce\x6c\xe4\xde\x7b\xf9\xe8\xff\x0e\x80\xb8\x1c\xda\xb8\xf2\x16" "\x4a\x25\xa0\xa6\x92\x96\x79\xce\x9a\xe0\xdc\x2a\xc7\xed\x41\xa7\x87" "\x44\x66\x76\xf0\x91\x59\x75\x51\xdc\x2e\x8c\x05\x42\x24\xba\xc6\x65" "\x2b\xba\x5f\xb6\x75\xc0\xb2\xc9\x4d\x2f\xaa\xc1\x60\xf1\x1b\x7b\x96" "\xfc\x96\x41\x5a\xca\x8a\x47\xfa\x03\x65\x8b\x8a\xfa\x24\xb6\xbd\x97" "\xf7\xdb\xee\xad\x9a\xe5\xf7\xec\x1c\xb0\xd0\x00\x05\x5f\x41\xa5\x04" "\x3c\x6c\x4c\x97\x21\x23\x98\xb1\x68\xb5\xcb\x9e\xe6\x50\x72\x6e\xab" "\xcc\x31\xb6\x71\x2e\x81\x5f\xda\xae\x77\x88\x53\x50\x88\x4f\xb3\x6d" "\x6d\x54\x44\xd5\xe5\x50\x0a\x7d\x63\x6d\x4e\xce\xd1\x4b\x9d\x41\x1c" "\x76\x5b\x36\xa4\xbe\x06\xca\x9b\xe2\x96\x5d\x6d\x6c\x06\xc3\xb6\xbc" "\xb3\x8b\xab\xeb\x29\x99\xee\x71\x29\x5d\x48\x92\x6b\xf6\xe3\x93\x63" "\xfa\xbf\x74\xde\x5e\x57\xaa\x0b\x59\xf9\xdd\xde\xca\x14\x2d\x0c\x50" "\xab\x7f\xf1\x98\x19\x6c\x69\xc9\x71\xe6\xab\x59\x12\x20\xf4\xe4\x2d" "\x65\x25\xe2\xdb\xd9\x9b\x6c\x57\x94\x9c\x85\x4e\x4e\xe0\xe4\x58\x1f" "\x9e\x3e\x16\x0b\x3f\x66\xb0\x1f\x23\xf4\xd0\x47\x2c\x0a\x1f\x30\x78" "\x37\xac\x8d\xac\x0a\x25\x7d\x09\xab\x82\x97\x51\x48\xdc\xd7\x64\xfe" "\x63\x59\xa5\xf2\x1b\x9c\xbe\x2a\xe7\xb9\xb2\x77\x48\x9a\x8b\x32\x85" "\xb8\x28\x9a\x84\xff\x85\x45\x08\xb4\x48\x8f\xfc\xf6\x8f\x47\xec\x7a" "\x5c\x18\xa8\xc3\xd0\x6e\x26\xb3\x2f\x75\x4a\xc7\x4e\xa8\xe9\x3a\x55" "\x41\x47\xfd\x3b\x3d\xaf\x1f\xbe\x92\x4e\x2e\x38\x9c\xac\x13\xa5\xf8" "\x0f\x3a\x21\xdb\xd2\x50\xd3\x91\x7f\x7b\x5a\xcf\xc7\x39\xa6\x3f\x2b" "\x3d\x6b\x3f\x09\x9e\xfb\x4b\xe7\xa8\x42\x21\x5c\x89\xfc\x87\xbd\x85" "\x50\xd1\x1b\xa2\xa4\xaf\x0f\x11\x1a\xb1\x24\x50\x3b\x26\xfe\xea\xe3" "\xbe\x3e\xe2\x41\x68\xdd\x45\x53\xa2\x26\xb9\x16\x8e\xdb\x11\xc3\xe6" "\x1b\xc8\x50\xad\xf9\x95\xb4\xd6\xf1\xaa\xce\x6d\xb0\xb9\x1f\x80\x5c" "\x3d\x17\x89\xa3\xe6\xb4\x70\xe5\x47\x09\x68\xf4\x29\xd5\xb0\x5c\x8f" "\x76\xca\x29\x81\xe3\x7f\x5b\xde\x4a\xd0\x0a\x09\x75\x5c\x76\x77\x4e" "\xad\x7d\x93\xf3\xf4\x12\x55\xb1\xd5\x61\x52\xe3\x69\x9b\x13\x3b\x2e" "\x0b\x27\x74\x27\xc9\x92\x32\x3d\x1b\x4d\x8c\x43\x84\x34\xe9\xe9\x01" "\xdd\xd4\x37\x88\xf8\x0c\xb9\xa9\x75\xe9\xdd\x16\x71\xce\x16\xbe\x5f" "\xf8\x03\x3d\x5d\xa8\x24\xf0\x0f\xd7\x8b\x54\x0e\xdb\xcd\x69\xa2\xe9" "\xaf\xf0\x3e\x31\xaf\x9a\xfe\xfb\x80\x94\x34\xf5\x2b\x4a\x12\x39\xfd" "\xd2\x41\xed\x3a\x26\x82\x58\xad\xdd\xe1\x9d\x17\x24\x15\x5a\x1a\x4c" "\x87\x7b\xd5\x9b\x06\x59\xb7\xa7\x86\x88\x6f\x6f\xfc\xb5\x99\x9d\x1f" "\x9c\x00\x7d\x61\x50\x20\x92\x6f\x71\x65\xa9\xdd\xd4\xaa\xa3\xc7\xb6" "\x31\xd3\x0c\xc9\x51\xe3\x28\x13\x1d\x99\x28\x2a\xc0\x6a\x18\xf8\x83" "\x73\x09\x23\x20\xea\x53\x08\xf0\x6c\x37\x6e\x71\x1a\xec\xda\x4c\xd1" "\xc2\xb6\x39\xd9\xea\x7a\x26\x13\xd4\xe9\xea\xa9\xa0\xef\x72\x77\x4f" "\xde\xc6\x22\xf7\xd1\x31\xb4\x51\x35\xd5\x77\x89\x7b\xf6\x86\xb4\x60" "\xa3\x71\x08\x30\x70\x13\x9e\xa5\x44\xbd\xa1\x50\x12\x25\x1d\x6c\x8e" "\x71\x63\xc2\x54\x12\x84\x1f\xae\xfb\xa7\x67\x65\x64\x8c\xa7\xcd\x1b" "\x42\x34\x03\xa6\x54\xb6\xb5\x75\x45\x88\xae\x6c\x30\x96\x21\x47\x7d" "\xb2\x0f\x7c\x92\x36\xaf\x1e\x42\x2e\xbd\x3f\xb6\xd6\xa7\x12\xe7\xa6" "\xd0\x0d\x58\x41\x6b\x7d\x65\xa5\x3a\x25\x14\xbf\x51\xbe\xdf\xe9\x20" "\x7f\x16\xa4\xd7\x94\x18\x60\x03\x89\xb9\x8e\xa8\xb9\xe0\x6b\x8d\xa7" "\x08\xa8\x6f\x19\x1e\x56\x79\x25\xaf\x39\xa0\x9a\xc9\xfd\x79\x02\xe8" "\xf8\xe7\x75\x67\xba\xf1\xb7\x5c\x05\xba\x1e\xb7\x08\x9b\x42\x48\x01" "\x40\x5a\xfc\x98\x2a\x8d\x79\xc8\x0f\xad\xa1\x84\xa1\xab\x3b\xab\x52" "\x6a\x3b\x0a\x5e\x20\xd2\xdc\x6b\xcd\xd2\xc5\xcb\x7c\x49\xf7\x35\xf3" "\xe8\xf4\xd3\x6a\x38\x8c\xa8\x05\x87\x6a\xe0\x8f\x0e\x3a\xcc\xa5\xdd" "\x86\x4c\x1f\xa1\x55\x20\x68\xbf\x79\x90\x95\x22\x14\x80\x37\x4f\xd2" "\xdc\xae\xdd\xb7\x4b\xe9\x34\x70\xef\xf4\xfe\x27\x8e\x19\x0f\x0a\x13" "\x1f\x32\x34\x0a\xda\x9c\xca\x51\x8a\xf7\x69\xf4\x29\x43\x87\x5f\x4c" "\x57\x07\xbe\xee\x21\x79\x77\x1d\xa2\x1c\xd6\x64\x05\xb9\x97\x36\x48" "\xbd\x04\x7a\x51\x6d\x1c\xf9\x02\xfa\x1f\x0f\xcd\xcb\xc3\xf4\xc1\xf2" "\x0f\xc2\x2f\x9a\x7e\x9f\x4c\x3a\x52\x57\x63\x99\x60\x4c\x46\xf8\x3e" "\xde\x44\xf5\x42\xd0\x6d\x54\xe6\xe8\xa1\xe6\x93\xa2\xcf\xcb\xb1\x6c" "\x17\x8d\x1b\xac\xe9\x76\x13\x3e\x72\xcc\x45\x33\xbd\x02\xb1\xc4\xec" "\x2c\xc2\x20\x97\x43\x5a\xff\x5a\x68\x2c\xa7\x22\x74\x14\x89\x54\x50" "\x83\x15\x60\xfa\x68\x24\x93\xf4\x81\x4c\xe8\xfb\xdb\x19\x0f\x8c\xe2" "\xb5\x33\xed\x95\x82\x63\x85\x11\xbd\xa9\x3a\xea\xe5\xd0\x69\x0f\x74" "\x5b\x78\x8d\xb6\x22\x86\x4b\xa3\xfb\x60\x95\x2f\x11\x94\x27\xfb\xe6" "\x67\x54\xc5\xc0\x38\xc5\xfb\x2c\xb8\x7c\x32\x6d\x65\x86\x2e\x35\x3c" "\x14\x95\x0b\xd1\xfa\x7c\x70\xe3\x63\x23\xe9\xcf\x90\xc8\x1f\x62\x75" "\xe5\x9c\x79\x26\xac\xac\x15\x60\xa0\xb6\xbb\xc7\xa8\x50\x81\x7f\x2e" "\xff\xa1\x9d\x48\x53\x15\xa2\x19\xd4\x9e\x29\x3f\x87\x12\x78\x29\x4d" "\x02\x76\x5c\xf7\x2c\xaa\x2f\x43\x8d\xe3\x33\x7e\xd2\x05\xbf\x68\xff" "\x6d\xda\xaa\x5e\x4b\x80\xde\x5f\xba\x02\x2d\xfc\xf9\xcf\x07\x4a\x31" "\x96\x78\xdf\x11\xeb\x77\xb3\xef\x66\xe5\x12\xb6\x7b\xa5\x18\x22\x65" "\xa6\x0e\xaf\x45\x76\x91\xe9\x73\xd2\x3c\xba\xf6\x00\x05\x37\xf8\x86" "\x69\x50\x74\xeb\xb6\x16\xf9\xcd\xad\x9d\xe7\xc6\xfe\x9e\xcf\xbd\x13" "\xd5\x37\xd6\x4c\x34\xa7\xc9\x0c\xa5\x6b\x50\xe6\x0d\x6a\x70\x67\xe3" "\x91\xe6\x35\x61\x79\x3e\xdf\x6e\xd3\xc2\xee\xb8\x55\x59\x09\xa5\x9c" "\xe7\x3d\xa1\xf0\x96\xd4\x1f\xb4\x2d\xe4\x44\x94\x12\x83\x24\xa9", 4096); *(uint8_t*)0x20008bc0 = -1; *(uint16_t*)0x20008bc1 = -1; syz_mount_image( /*fs=*/0x20000180, /*dir=*/0x20000100, /*flags=MS_I_VERSION|MS_PRIVATE|MS_SYNCHRONOUS|MS_STRICTATIME|MS_REMOUNT|MS_RELATIME|0x240c*/ 0x1a4243c, /*opts=*/0x20007980, /*chdir=*/0, /*size=*/0, /*img=*/0x20000000); break; case 7: memcpy((void*)0x20003bc0, "/dev/capi20\000", 12); res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x20003bc0ul, /*flags=*/0ul, /*mode=*/0ul); if (res != -1) r[5] = res; break; case 8: res = syscall(__NR_epoll_create, /*size=*/1); if (res != -1) r[6] = res; break; case 9: syscall(__NR_epoll_pwait, /*epfd=*/r[6], /*events=*/0x20008040ul, /*maxevents=*/1ul, /*timeout=*/0x401, /*sigmask=*/0ul, /*size=*/0ul); break; case 10: *(uint32_t*)0x200000c0 = 0; *(uint64_t*)0x200000c4 = 0; syscall(__NR_epoll_ctl, /*epfd=*/r[6], /*op=*/1ul, /*fd=*/r[5], /*ev=*/0x200000c0ul); 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; use_temporary_dir(); do_sandbox_none(); return 0; }