// 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 #ifndef __NR_bpf #define __NR_bpf 321 #endif static unsigned long long procid; 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 unsigned int queue_count = 2; 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_attr(nlmsg, IFLA_NUM_TX_QUEUES, &queue_count, sizeof(queue_count)); netlink_attr(nlmsg, IFLA_NUM_RX_QUEUES, &queue_count, sizeof(queue_count)); 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_attr(nlmsg, IFLA_NUM_TX_QUEUES, &queue_count, sizeof(queue_count)); netlink_attr(nlmsg, IFLA_NUM_RX_QUEUES, &queue_count, sizeof(queue_count)); 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); } static void setup_gadgetfs(); static void setup_binderfs(); static void setup_fusectl(); 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); if (mount("/sys/kernel/debug", "./syz-tmp/newroot/sys/kernel/debug", NULL, bind_mount_flags, NULL) && errno != ENOENT) exit(1); if (mount("/sys/fs/smackfs", "./syz-tmp/newroot/sys/fs/smackfs", NULL, bind_mount_flags, NULL) && errno != ENOENT) exit(1); if (mount("/proc/sys/fs/binfmt_misc", "./syz-tmp/newroot/proc/sys/fs/binfmt_misc", NULL, bind_mount_flags, NULL) && errno != ENOENT) exit(1); if (mkdir("./syz-tmp/newroot/syz-inputs", 0700)) exit(1); if (mount("/syz-inputs", "./syz-tmp/newroot/syz-inputs", NULL, bind_mount_flags | MS_RDONLY, NULL) && errno != ENOENT) exit(1); 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); setup_gadgetfs(); setup_binderfs(); setup_fusectl(); } static void setup_gadgetfs() { if (mkdir("/dev/gadgetfs", 0777)) { } if (mount("gadgetfs", "/dev/gadgetfs", "gadgetfs", 0, NULL)) { } } static void setup_fusectl() { 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)) { } if (symlink("/dev/binderfs", "./binderfs")) { } } static void loop(); static void sandbox_common() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); if (getppid() == 1) exit(1); 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); 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(); loop(); exit(1); } uint64_t r[1] = {0xffffffffffffffff}; void loop(void) { intptr_t res = 0; if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } // bpf$PROG_LOAD arguments: [ // cmd: const = 0x5 (8 bytes) // arg: ptr[in, bpf_prog_t[flags[bpf_prog_type, int32], // bpf_prog_attach_types, bpf_btf_id[opt], fd_bpf_prog[opt]]] { // bpf_prog_t[flags[bpf_prog_type, int32], bpf_prog_attach_types, // bpf_btf_id[opt], fd_bpf_prog[opt]] { // type: bpf_prog_type = 0xc (4 bytes) // ninsn: bytesize8 = 0xe (4 bytes) // insns: ptr[inout, array[ANYUNION]] { // array[ANYUNION] { // union ANYUNION { // ANYBLOB: buffer: {b7 02 00 00 03 00 00 00 bf a3 00 00 00 00 00 // 00 07 03 00 00 00 fe ff ff 7a 0a f0 ff f9 ff ff ff 79 a4 f0 ff // 00 00 00 00 b7 06 00 00 ff ff ff ff 2d 64 05 00 00 00 00 00 65 // 04 04 00 01 00 00 00 04 04 00 00 01 00 7d 60 b7 03 00 00 00 00 // 00 00 6a 0a 00 fe 00 01 00 00 85 00 00 00 0d 00 00 00 b7 00 00 // 00 00 00 00 00 95 00 00 00 00 00 00 00 49 6c f2 82 7f b4 3a 43 // 1c a7 11 fc d0 cd fa 14 6e c5 61 75 03 79 58 e2 71 f6 0d 25 b7 // 93 7f 02 c8 69 5e 5a 1b 24 df 41 dc 10 d1 e8 bf 07 6d 83 92 3d // d2 9c 03 40 55 b6 7d af e6 c8 dc 3d 5d 78 c0 7f a1 f7 e6 55 ce // 34 e4 d5 b3 18 e2 ec 0e 1a 00 89 7a 74 a0 09 1f f1 10 02 6e 6d // 2e f8 31 ab 7e a0 c3 4f 17 ef d3 6e f3 bb 62 20 03 b5 38 df d8 // e0 12 e7 95 78 e5 1b c5 30 99 e9 0f bd b2 ca 8e eb 9c 15 ab 3a // 14 81 7a c6 1e 4d d1 11 83 a1 34 77 bf 7e 06 0e 36 70 ef 0e 78 // 9f 93 78 19 65 f1 32 8d 67 04 90 2c be 7b c0 cb 82 d2 78 9c b1 // 32 b8 66 7c 21 47 66 19 f2 8d 99 61 b6 3e 1a 9c f6 c2 a6 60 a1 // fe 3c 18 4b 75 1c 51 16 0f bc e8 41 f8 a9 7b e6 14 8b a5 32 e6 // ea 09 c3 46 df eb d3 1a 08 b3 28 08 b8 02 00 00 00 00 00 9d d2 // 70 80 e7 11 13 61 0e 10 19 c1 2a 73 74 8b 04 96 04 fa 72 c6 4e // d8 58 e8 32 7e f0 1f b6 c8 6a da c1 22 33 f9 a1 fb 9c 2a ec 61 // ce 63 a3 46 2f d5 01 17 b8 9a 9a b3 59 b4 ee a0 c6 e9 57 67 d4 // 2b 4e 54 86 1d 02 27 db fd 2e d8 57 6a 3f 7f 3d ea dd 71 30 85 // 6f 75 64 36 30 37 67 d2 e2 4f 29 e5 da d9 79 6e db 69 7a 6e 97 // 18 0a ab c1 8c ae 2e d4 b4 39 0a f9 a9 ce af d0 7e d0 0b 00 00 // 00 2c ab 15 4a d0 29 a1 19 ca 3c 97 27 80 87 00 14 60 1c 3c 97 // 5d 5a ec 84 22 2f ff 0d 72 16 fd b0 d3 a0 ec 4b e3 e5 63 11 2f // 4b 39 50 1a af e2 34 87 00 72 85 8d c0 6e 7c 33 76 42 d3 e5 a8 // 15 23 2f 5e 16 c1 b3 0c 3a 2a 71 bc 85 01 8e 5f f2 c9 10 49 6f // 19 af c9 1b 47 68 3d b0 1a 46 93 98 68 52 11 bb ae 0e 73 13 bf // f5 d4 c3 91 dd ec e0 0f c7 72 dd 6b 4d 4d e2 a4 19 90 f0 5c a3 // bd e7 92 c8 8c 5b 8d cd cc 22 ee 17 47 6d 73 89 92 53 3a c2 a9 // b5 a6 99 59 3f 08 44 19 ca e0 b4 18 3f b0 1c 73 f9 98 57 39 95 // 37 f5 dc 2a cb 72 c7 ea e9 93 fc 9e b2 2d 13 06 65 b6 34 1d a1 // 14 f0 8c d0 50 9d 38 05 78 67 3f ff ff ff d7 91 7f 23 83 7a 6b // 24 db 0e 06 73 45 56 09 42 fa 62 9f be f2 46 1c 96 a0 87 07 67 // 13 15 c3 02 fa e2 91 87 d4 f5 c0 6a 96 0f d3 7c 10 22 3f da e7 // ed 04 93 5c 3c 90 d3 ad d8 ee bc 86 19 d7 34 15 e6 ad cd a2 13 // 0f 50 11 e4 84 55 b5 88 b9 0d fa e1 58 b9 4f 50 ad ab 98 8d d8 // e1 2b af 5c c9 39 8c 88 60 7a 08 00 9c 29 77 aa b3 7d 9a 44 cf // c1 c7 b4 00 00 00 00 00 00 fa 47 74 2f 6c 5b 9c 4b 11 e7 d7 26 // 2a 14 57 c3 94 95 c8 26 b9 56 ba 85 9a c8 e3 c1 77 b9 1b d7 d5 // ca 16 64 fe 2f 3c ed 84 68 91 18 06 e8 91 6d c1 5e 21 64 4d b6 // 0c 24 98 d5 d1 6d 7d 91 58 36 ab 26 c1 69 48 20 08 ef 06 9d c4 // 27 49 28 9f 85 47 97 f2 f9 00 c2 a1 2d 8c 38 a9 67 c1 bb e0 93 // 15 c2 98 77 a3 31 bc c8 7d c3 ad db 08 14 1b de e5 d2 78 74 b2 // f6 63 dd ee f0 00 5b 3d 96 c7 aa bf 4d f5 17 d9 0b dc 01 e7 38 // 35 d4 a3 e1 a9 e9 0d 76 c1 99 3e 07 99 d4 89 4e e7 f8 24 9d c1 // e3 42 89 21 29 36 9e e1 b8 5a fa 1a 5b e5 f6 eb 2e ea 0d 0d f4 // 14 b3 15 f6 51 c8 41 23 92 19 1f a8 3e e8 30 54 8f 11 e1 03 8d // eb d6 4c be 35 94 54 a3 f2 23 9c fe 35 f8 1b 7a de d4 48 85 99 // 68 ff 0e 90 50 1b 0b 07 c0 dd 00 49 0f 16 7e 6d 5c 11 09 68 17 // 39 dc 33 f7 5b 20 42 8d 64 74 a0 a9 1e e9 0b 8d e8 02 c6 b5 38 // 62 2e 6b bc b8 0f 87 b4 15 26 3c 40 1e 64 ed 69 a2 f7 54 09 00 // 00 00 00 00 00 00 1d 69 5c 45 59 b8 2c ab ac 3c cc ad c1 e1 c1 // 9a f4 e0 30 20 ab f5 ff 04 33 d6 60 f2 08 98 d2 a0 45 d0 09 a0 // ff b2 0a 77 c9 af 2b 80 c0 51 84 a6 6d 30 bb ea 2c a4 5a 4d 6d // 6d 1e 6e 79 ae f4 23 55 b1 74 02 a5 00 58 7b 60 33 06 a5 af 8d // 86 7d 80 a0 7f 10 b8 54 b1 c8 c7 68 c0 01 49 6f a9 9c e5 b5 04 // 0b e9 19 41 23 e9 18 91 4a 71 ad 5a 85 21 fb 95 6d bc 60 f7 d9 // 71 9b 55 b3 ab b6 bb a3 d1 13 a6 80 a8 d4 6f e0 74 c8 3f be 37 // 8a 38 89 e8 14 5b 2e ac ea b0 5e f9 32 c6 e4 f8 ef 0e d0 d8 18 // a7 b7 6d 83 9c f3 c6 77 5e 19 f0 b7 e7 08 03 00 00 00 b1 68 c3 // 8f a3 2e 49 56 3c fe e3 a7 f0 fc 18 bf a3 2c 41 8c ef 87 5f b4 // 9e 29 89 17 2a 1b cd 1e 30 28 0b c5 86 7d d4 e2 7b 6e f2 06 66 // 00 90 bb 21 64 47 4c ef 37 8f 97 ca 33 fc cf 36 33 61 dc db a1 // 0c 15 47 05 34 53 d0 c9 ae c9 1a 24 07 9b 21 d5 2f b5 51 6b f0 // c2 8e f3 7a a7 64 42 f6 08 3d c9 9c d6 1a fa f6 be 45 d7 b0 0d // 36 39 f2 f1 0a c2 d5 c7 59 c3 e5 46 8f 58 74 c2 44 11 d4 15 b6 // b0 85 fb 73 a2 d7 c3 85 2e 0e 65 8f fe b4 e8 63 42 8a 79 2b ee // 94 f6 cd 89 54 24 36 0e 04 64 f9 d7 ea 42 5f 2f a6 aa 00 00 00 // 00 00 00 00 00 53 2f f1 81 c9 85 f5 4b 7a e2 0a a5 e6 30 55 b4 // d6 a3 6f a9 8a 44 e3 79 d2 bc cf 97 7c 3e 88 53 8f 40 6b 59 83 // 07 c9 91 2f b0 97 60 1f 3f 88 a2 ea 6f d1 f9 32 0c fe 7f 09 ae // d4 d1 e7 2d 26 e5 c7 a9 38 54 c8 e9 f7 f1 5f 02 e1 77 ce 23 f4 // 3a 15 4b 42 e2 6f 03 7e 8a 01 37 7c bd 3f 50 9e 6e 54 0c 9b a9 // c2 a5 89 ac 5d 8a d6 7a 65 e9 a4 4c 57 6d c2 44 52 ea fe ff ff // ff ff ff ff ff 00 00 00 07 00 00 00 00 00 00 00 00 00 00 00 00 // 53 33 c6 19 9c 12 dc d9 26 89 19 27 27 a7 26 7c 47 cf 89 78 53 // d1 60 10 0b 39 b6 13 fa ef e1 6b d9 1f c1 05 dd dd 77 ab 92 9b // 95 03 2d 37 17 fa 9f bd c2 bd c0 e9 8a e2 c3 f2 3a 61 31 e2 87 // 9f 04 84 ee 3b fe 30 b9 2d d4 93 be 66 c2 24 2f 81 84 73 3b 80 // ba 28 e8 24 91 08 44 df 31 f3 d4 bb 2f 89 04 9c 5f 6d 63 95 69 // 95 74 76 39 96 42 17 aa cf e5 48 bc 86 90 98 aa 8e 07 e5 1d bc // 9e 2d 4d b3 c5 f7 9f d3 55 22 2e c2 a0 0c f7 f2 cc d6 dd 6d 2d // c2 a8 15 d8 31 42 21 a5 47 2f 13 18 a9 df be c5 a7 59 57 9c af // 32 62 12 9b 14 e9 9a 40 b5 d9 13 98 e1 7d f8 5c 25 cc ae 97 3e // ec c7 d1 87 16 8d 5c 9c d8 48 d5 66 cc 17 58 76 3f 00 00 00 9c // 92 7d a3 8d 83 31 44 80 b1 5e 23 eb 8c 5b 87 7a 72 bd 4c f7 4a // 29 9d f4 fb fc 8e 6e a9 69 39 f1 5d 25 4d 90 33 c5 a4 57 06 bd // a7 8a b6 02 00 00 00 00 00 00 00 00 00 11 3a 30 65 a4 78 d1 de // 98 be 3a 66 f6 fb f6 8f 2f 56 93 05 0f a5 6d b6 2e 2f 99 cf 91 // 60 59 ee 36 cd ad 07 8f c8 8d 17 cb de 37 a2 27 0f 90 a6 0a fe // 85 48 d4 c5 79 b0 9c 33 33 82 c6 e7 a3 16 ac 03 aa 23 d3 79 83 // 6b 96 17 3a 55 41 fa 96 c2 7e 7f b6 d2 58 5d 82 8a a3 30 f3 43 // 8d 84 87 91 2b b7 74 2b e1 50 2e 70 66 44 f7 a9 37 45 1b eb 7a // 5f 6c a3 ef 21 e8 cb 8f 84 1a f6 d5 43 34 d8 2a 8b 81 6b 6d ac // cf 0c 66 16 2f 89 76 23 ee 32 5d 71 4f 9f 10 63 6a 75 73 58 2f // f3 1c 7f 9c 6f 76 7c 80 6e f4 af 48 6c c1 9a 53 55 bd c8 14 cb // 55 57 c6 fa 64 04 17 9c 86 59 80 b0 81 5b 90 7a 7f 26 8e 97 82 // 8c 19 6f 5a c0 33 d3 95 a2 17 b4 e1 e4 56 63 02 3a 02 92 00 3c // 36 a3 b7 46 1f c2 c8 56 6e 0f 3f 69 3b fa ca e2 6a a2 b7 d1 79 // 62 98 9c cb 94 36 33 c0 80 aa cc 9b 7d 31 1c 25 16 86 fc 66 aa // 80 bf 41 a5 bf 6c d7 2d 5a a9 95 82 0f b3 18 fa d6 1a 79 a6 1d // 0a 96 9f d6 01 8a c9 f1 31 fe 02 fe 31 d5 65 72 3c bf 9b 63 84 // 1e 21 41 7f c2 9a 3e 7a 03 88 6d 80 56 6a e0 01 86 17 99 a4 aa // d9 1c 72 13 9e 68 1c ed 86 25 b6 75 df bd 6d 45 8d 4b 2d 9e 6d // 56 54 30 24 81 72 ad 94 2c db 41 63 9f 41 13 89 68 27 c8 80 6e // 04 92 18 cd 1e ef 89 d6 b9 b1 4d d7 07 da 40 70 5c 07 f8 78 26 // 3f f9 b7 1c cf 28 ec 50 17 8c 7a ac 83 be f7 bd 10 45 9e 2f 2e // 26 7f 82 ba fd 5b 4c 7b 48 1e a5 e4 bc b6 cf e0 5e 2a c3 e1 7c // 1f 8f 12 dd f5 b6 77 0c e0 da 8c b3 ab a3 a9 35 a6 b7 37 b6 d3 // eb f2 c7 15 dc c1 1c 57 59 bd 0a cd ec f3 33 f2 b7 7c 52 fb 22 // 51 33 6b bd 92 f7 3a d1 a3 0b b9 16 2b d9 d6 99 c4 9d 82 4b 82 // 7f 3e 7c 10 96 35 49 46 e0 99 22 db 25 90 4c 83 26 2c 6d cb 87 // 45 7e 4a be fa 0e 9d cb 17 d7 9c 17 38 95 b7 4a ae 2e d4 41 96 // 62 69 0a 16 49 4e 7b 27 d0 d2 68 8c 69 b4 be 3d 21 b7 83 19 5f // 6a 5e 5d c5 c0 7c 73 f0 d0 f0 67 0d b1 0a c9 ef 5b 82 95 ff 88 // df 73 4e 3c 6a b8 55 5c 03 90 f9 62 cb f5 59 bc e9 c4 2e 10 34 // db a7 89 97 b2 87 7b 48 5d 9d 4a e2 fc d3 e7 57 b8 43 19 87 9d // 03 37 78 57 73 c9 40 af 6e 57 d1 62 f4 60 6d 10 1d ef 01 19 93 // 25 c8 67 6a 32 e2 63 03 56 02 71 b7 20 21 6d 95 e0 01 32 65 a4 // 5b 02 bd 24 14 be bd a8 9b 7b 5e 71 e7 0e 00 00 00 00 00 00 00 // 00} (length 0x9e8) // } // } // } // license: ptr[in, buffer] { // buffer: {73 79 7a 6b 61 6c 6c 65 72 00} (length 0xa) // } // loglev: int32 = 0x0 (4 bytes) // logsize: len = 0x0 (4 bytes) // log: nil // kern_version: bpf_kern_version = 0x0 (4 bytes) // flags: bpf_prog_load_flags = 0x0 (4 bytes) // prog_name: buffer: {00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00} // (length 0x10) prog_ifindex: ifindex (resource) expected_attach_type: // union bpf_prog_attach_types { // fallback: bpf_attach_types = 0x0 (4 bytes) // } // btf_fd: fd_btf (resource) // func_info_rec_size: const = 0x8 (4 bytes) // func_info: nil // func_info_cnt: len = 0x0 (4 bytes) // line_info_rec_size: const = 0x10 (4 bytes) // line_info: nil // line_info_cnt: len = 0x0 (4 bytes) // attach_btf_id: bpf_btf_id (resource) // attach_prog_fd: fd_bpf_prog (resource) // core_relo_cnt: len = 0x0 (4 bytes) // fd_array: nil // core_relos: nil // core_relo_rec_size: const = 0x10 (4 bytes) // log_true_size: int32 = 0x0 (4 bytes) // prog_token_fd: union _bpf_prog_t[flags[bpf_prog_type, int32], // bpf_prog_attach_types, bpf_btf_id[opt], // fd_bpf_prog[opt]]_prog_token_fd_wrapper { // void: buffer: {} (length 0x0) // } // pad: union _bpf_prog_t[flags[bpf_prog_type, int32], // bpf_prog_attach_types, bpf_btf_id[opt], // fd_bpf_prog[opt]]_pad_wrapper { // value: const = 0x0 (4 bytes) // } // } // } // size: len = 0x48 (8 bytes) // ] // returns fd_bpf_prog *(uint32_t*)0x200000000200 = 0xc; *(uint32_t*)0x200000000204 = 0xe; *(uint64_t*)0x200000000208 = 0x200000000400; memcpy( (void*)0x200000000400, "\xb7\x02\x00\x00\x03\x00\x00\x00\xbf\xa3\x00\x00\x00\x00\x00\x00\x07\x03" "\x00\x00\x00\xfe\xff\xff\x7a\x0a\xf0\xff\xf9\xff\xff\xff\x79\xa4\xf0\xff" "\x00\x00\x00\x00\xb7\x06\x00\x00\xff\xff\xff\xff\x2d\x64\x05\x00\x00\x00" "\x00\x00\x65\x04\x04\x00\x01\x00\x00\x00\x04\x04\x00\x00\x01\x00\x7d\x60" "\xb7\x03\x00\x00\x00\x00\x00\x00\x6a\x0a\x00\xfe\x00\x01\x00\x00\x85\x00" "\x00\x00\x0d\x00\x00\x00\xb7\x00\x00\x00\x00\x00\x00\x00\x95\x00\x00\x00" "\x00\x00\x00\x00\x49\x6c\xf2\x82\x7f\xb4\x3a\x43\x1c\xa7\x11\xfc\xd0\xcd" "\xfa\x14\x6e\xc5\x61\x75\x03\x79\x58\xe2\x71\xf6\x0d\x25\xb7\x93\x7f\x02" "\xc8\x69\x5e\x5a\x1b\x24\xdf\x41\xdc\x10\xd1\xe8\xbf\x07\x6d\x83\x92\x3d" "\xd2\x9c\x03\x40\x55\xb6\x7d\xaf\xe6\xc8\xdc\x3d\x5d\x78\xc0\x7f\xa1\xf7" "\xe6\x55\xce\x34\xe4\xd5\xb3\x18\xe2\xec\x0e\x1a\x00\x89\x7a\x74\xa0\x09" "\x1f\xf1\x10\x02\x6e\x6d\x2e\xf8\x31\xab\x7e\xa0\xc3\x4f\x17\xef\xd3\x6e" "\xf3\xbb\x62\x20\x03\xb5\x38\xdf\xd8\xe0\x12\xe7\x95\x78\xe5\x1b\xc5\x30" "\x99\xe9\x0f\xbd\xb2\xca\x8e\xeb\x9c\x15\xab\x3a\x14\x81\x7a\xc6\x1e\x4d" "\xd1\x11\x83\xa1\x34\x77\xbf\x7e\x06\x0e\x36\x70\xef\x0e\x78\x9f\x93\x78" "\x19\x65\xf1\x32\x8d\x67\x04\x90\x2c\xbe\x7b\xc0\xcb\x82\xd2\x78\x9c\xb1" "\x32\xb8\x66\x7c\x21\x47\x66\x19\xf2\x8d\x99\x61\xb6\x3e\x1a\x9c\xf6\xc2" "\xa6\x60\xa1\xfe\x3c\x18\x4b\x75\x1c\x51\x16\x0f\xbc\xe8\x41\xf8\xa9\x7b" "\xe6\x14\x8b\xa5\x32\xe6\xea\x09\xc3\x46\xdf\xeb\xd3\x1a\x08\xb3\x28\x08" "\xb8\x02\x00\x00\x00\x00\x00\x9d\xd2\x70\x80\xe7\x11\x13\x61\x0e\x10\x19" "\xc1\x2a\x73\x74\x8b\x04\x96\x04\xfa\x72\xc6\x4e\xd8\x58\xe8\x32\x7e\xf0" "\x1f\xb6\xc8\x6a\xda\xc1\x22\x33\xf9\xa1\xfb\x9c\x2a\xec\x61\xce\x63\xa3" "\x46\x2f\xd5\x01\x17\xb8\x9a\x9a\xb3\x59\xb4\xee\xa0\xc6\xe9\x57\x67\xd4" "\x2b\x4e\x54\x86\x1d\x02\x27\xdb\xfd\x2e\xd8\x57\x6a\x3f\x7f\x3d\xea\xdd" "\x71\x30\x85\x6f\x75\x64\x36\x30\x37\x67\xd2\xe2\x4f\x29\xe5\xda\xd9\x79" "\x6e\xdb\x69\x7a\x6e\x97\x18\x0a\xab\xc1\x8c\xae\x2e\xd4\xb4\x39\x0a\xf9" "\xa9\xce\xaf\xd0\x7e\xd0\x0b\x00\x00\x00\x2c\xab\x15\x4a\xd0\x29\xa1\x19" "\xca\x3c\x97\x27\x80\x87\x00\x14\x60\x1c\x3c\x97\x5d\x5a\xec\x84\x22\x2f" "\xff\x0d\x72\x16\xfd\xb0\xd3\xa0\xec\x4b\xe3\xe5\x63\x11\x2f\x4b\x39\x50" "\x1a\xaf\xe2\x34\x87\x00\x72\x85\x8d\xc0\x6e\x7c\x33\x76\x42\xd3\xe5\xa8" "\x15\x23\x2f\x5e\x16\xc1\xb3\x0c\x3a\x2a\x71\xbc\x85\x01\x8e\x5f\xf2\xc9" "\x10\x49\x6f\x19\xaf\xc9\x1b\x47\x68\x3d\xb0\x1a\x46\x93\x98\x68\x52\x11" "\xbb\xae\x0e\x73\x13\xbf\xf5\xd4\xc3\x91\xdd\xec\xe0\x0f\xc7\x72\xdd\x6b" "\x4d\x4d\xe2\xa4\x19\x90\xf0\x5c\xa3\xbd\xe7\x92\xc8\x8c\x5b\x8d\xcd\xcc" "\x22\xee\x17\x47\x6d\x73\x89\x92\x53\x3a\xc2\xa9\xb5\xa6\x99\x59\x3f\x08" "\x44\x19\xca\xe0\xb4\x18\x3f\xb0\x1c\x73\xf9\x98\x57\x39\x95\x37\xf5\xdc" "\x2a\xcb\x72\xc7\xea\xe9\x93\xfc\x9e\xb2\x2d\x13\x06\x65\xb6\x34\x1d\xa1" "\x14\xf0\x8c\xd0\x50\x9d\x38\x05\x78\x67\x3f\xff\xff\xff\xd7\x91\x7f\x23" "\x83\x7a\x6b\x24\xdb\x0e\x06\x73\x45\x56\x09\x42\xfa\x62\x9f\xbe\xf2\x46" "\x1c\x96\xa0\x87\x07\x67\x13\x15\xc3\x02\xfa\xe2\x91\x87\xd4\xf5\xc0\x6a" "\x96\x0f\xd3\x7c\x10\x22\x3f\xda\xe7\xed\x04\x93\x5c\x3c\x90\xd3\xad\xd8" "\xee\xbc\x86\x19\xd7\x34\x15\xe6\xad\xcd\xa2\x13\x0f\x50\x11\xe4\x84\x55" "\xb5\x88\xb9\x0d\xfa\xe1\x58\xb9\x4f\x50\xad\xab\x98\x8d\xd8\xe1\x2b\xaf" "\x5c\xc9\x39\x8c\x88\x60\x7a\x08\x00\x9c\x29\x77\xaa\xb3\x7d\x9a\x44\xcf" "\xc1\xc7\xb4\x00\x00\x00\x00\x00\x00\xfa\x47\x74\x2f\x6c\x5b\x9c\x4b\x11" "\xe7\xd7\x26\x2a\x14\x57\xc3\x94\x95\xc8\x26\xb9\x56\xba\x85\x9a\xc8\xe3" "\xc1\x77\xb9\x1b\xd7\xd5\xca\x16\x64\xfe\x2f\x3c\xed\x84\x68\x91\x18\x06" "\xe8\x91\x6d\xc1\x5e\x21\x64\x4d\xb6\x0c\x24\x98\xd5\xd1\x6d\x7d\x91\x58" "\x36\xab\x26\xc1\x69\x48\x20\x08\xef\x06\x9d\xc4\x27\x49\x28\x9f\x85\x47" "\x97\xf2\xf9\x00\xc2\xa1\x2d\x8c\x38\xa9\x67\xc1\xbb\xe0\x93\x15\xc2\x98" "\x77\xa3\x31\xbc\xc8\x7d\xc3\xad\xdb\x08\x14\x1b\xde\xe5\xd2\x78\x74\xb2" "\xf6\x63\xdd\xee\xf0\x00\x5b\x3d\x96\xc7\xaa\xbf\x4d\xf5\x17\xd9\x0b\xdc" "\x01\xe7\x38\x35\xd4\xa3\xe1\xa9\xe9\x0d\x76\xc1\x99\x3e\x07\x99\xd4\x89" "\x4e\xe7\xf8\x24\x9d\xc1\xe3\x42\x89\x21\x29\x36\x9e\xe1\xb8\x5a\xfa\x1a" "\x5b\xe5\xf6\xeb\x2e\xea\x0d\x0d\xf4\x14\xb3\x15\xf6\x51\xc8\x41\x23\x92" "\x19\x1f\xa8\x3e\xe8\x30\x54\x8f\x11\xe1\x03\x8d\xeb\xd6\x4c\xbe\x35\x94" "\x54\xa3\xf2\x23\x9c\xfe\x35\xf8\x1b\x7a\xde\xd4\x48\x85\x99\x68\xff\x0e" "\x90\x50\x1b\x0b\x07\xc0\xdd\x00\x49\x0f\x16\x7e\x6d\x5c\x11\x09\x68\x17" "\x39\xdc\x33\xf7\x5b\x20\x42\x8d\x64\x74\xa0\xa9\x1e\xe9\x0b\x8d\xe8\x02" "\xc6\xb5\x38\x62\x2e\x6b\xbc\xb8\x0f\x87\xb4\x15\x26\x3c\x40\x1e\x64\xed" "\x69\xa2\xf7\x54\x09\x00\x00\x00\x00\x00\x00\x00\x1d\x69\x5c\x45\x59\xb8" "\x2c\xab\xac\x3c\xcc\xad\xc1\xe1\xc1\x9a\xf4\xe0\x30\x20\xab\xf5\xff\x04" "\x33\xd6\x60\xf2\x08\x98\xd2\xa0\x45\xd0\x09\xa0\xff\xb2\x0a\x77\xc9\xaf" "\x2b\x80\xc0\x51\x84\xa6\x6d\x30\xbb\xea\x2c\xa4\x5a\x4d\x6d\x6d\x1e\x6e" "\x79\xae\xf4\x23\x55\xb1\x74\x02\xa5\x00\x58\x7b\x60\x33\x06\xa5\xaf\x8d" "\x86\x7d\x80\xa0\x7f\x10\xb8\x54\xb1\xc8\xc7\x68\xc0\x01\x49\x6f\xa9\x9c" "\xe5\xb5\x04\x0b\xe9\x19\x41\x23\xe9\x18\x91\x4a\x71\xad\x5a\x85\x21\xfb" "\x95\x6d\xbc\x60\xf7\xd9\x71\x9b\x55\xb3\xab\xb6\xbb\xa3\xd1\x13\xa6\x80" "\xa8\xd4\x6f\xe0\x74\xc8\x3f\xbe\x37\x8a\x38\x89\xe8\x14\x5b\x2e\xac\xea" "\xb0\x5e\xf9\x32\xc6\xe4\xf8\xef\x0e\xd0\xd8\x18\xa7\xb7\x6d\x83\x9c\xf3" "\xc6\x77\x5e\x19\xf0\xb7\xe7\x08\x03\x00\x00\x00\xb1\x68\xc3\x8f\xa3\x2e" "\x49\x56\x3c\xfe\xe3\xa7\xf0\xfc\x18\xbf\xa3\x2c\x41\x8c\xef\x87\x5f\xb4" "\x9e\x29\x89\x17\x2a\x1b\xcd\x1e\x30\x28\x0b\xc5\x86\x7d\xd4\xe2\x7b\x6e" "\xf2\x06\x66\x00\x90\xbb\x21\x64\x47\x4c\xef\x37\x8f\x97\xca\x33\xfc\xcf" "\x36\x33\x61\xdc\xdb\xa1\x0c\x15\x47\x05\x34\x53\xd0\xc9\xae\xc9\x1a\x24" "\x07\x9b\x21\xd5\x2f\xb5\x51\x6b\xf0\xc2\x8e\xf3\x7a\xa7\x64\x42\xf6\x08" "\x3d\xc9\x9c\xd6\x1a\xfa\xf6\xbe\x45\xd7\xb0\x0d\x36\x39\xf2\xf1\x0a\xc2" "\xd5\xc7\x59\xc3\xe5\x46\x8f\x58\x74\xc2\x44\x11\xd4\x15\xb6\xb0\x85\xfb" "\x73\xa2\xd7\xc3\x85\x2e\x0e\x65\x8f\xfe\xb4\xe8\x63\x42\x8a\x79\x2b\xee" "\x94\xf6\xcd\x89\x54\x24\x36\x0e\x04\x64\xf9\xd7\xea\x42\x5f\x2f\xa6\xaa" "\x00\x00\x00\x00\x00\x00\x00\x00\x53\x2f\xf1\x81\xc9\x85\xf5\x4b\x7a\xe2" "\x0a\xa5\xe6\x30\x55\xb4\xd6\xa3\x6f\xa9\x8a\x44\xe3\x79\xd2\xbc\xcf\x97" "\x7c\x3e\x88\x53\x8f\x40\x6b\x59\x83\x07\xc9\x91\x2f\xb0\x97\x60\x1f\x3f" "\x88\xa2\xea\x6f\xd1\xf9\x32\x0c\xfe\x7f\x09\xae\xd4\xd1\xe7\x2d\x26\xe5" "\xc7\xa9\x38\x54\xc8\xe9\xf7\xf1\x5f\x02\xe1\x77\xce\x23\xf4\x3a\x15\x4b" "\x42\xe2\x6f\x03\x7e\x8a\x01\x37\x7c\xbd\x3f\x50\x9e\x6e\x54\x0c\x9b\xa9" "\xc2\xa5\x89\xac\x5d\x8a\xd6\x7a\x65\xe9\xa4\x4c\x57\x6d\xc2\x44\x52\xea" "\xfe\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x53\x33\xc6\x19\x9c\x12\xdc\xd9\x26\x89\x19\x27" "\x27\xa7\x26\x7c\x47\xcf\x89\x78\x53\xd1\x60\x10\x0b\x39\xb6\x13\xfa\xef" "\xe1\x6b\xd9\x1f\xc1\x05\xdd\xdd\x77\xab\x92\x9b\x95\x03\x2d\x37\x17\xfa" "\x9f\xbd\xc2\xbd\xc0\xe9\x8a\xe2\xc3\xf2\x3a\x61\x31\xe2\x87\x9f\x04\x84" "\xee\x3b\xfe\x30\xb9\x2d\xd4\x93\xbe\x66\xc2\x24\x2f\x81\x84\x73\x3b\x80" "\xba\x28\xe8\x24\x91\x08\x44\xdf\x31\xf3\xd4\xbb\x2f\x89\x04\x9c\x5f\x6d" "\x63\x95\x69\x95\x74\x76\x39\x96\x42\x17\xaa\xcf\xe5\x48\xbc\x86\x90\x98" "\xaa\x8e\x07\xe5\x1d\xbc\x9e\x2d\x4d\xb3\xc5\xf7\x9f\xd3\x55\x22\x2e\xc2" "\xa0\x0c\xf7\xf2\xcc\xd6\xdd\x6d\x2d\xc2\xa8\x15\xd8\x31\x42\x21\xa5\x47" "\x2f\x13\x18\xa9\xdf\xbe\xc5\xa7\x59\x57\x9c\xaf\x32\x62\x12\x9b\x14\xe9" "\x9a\x40\xb5\xd9\x13\x98\xe1\x7d\xf8\x5c\x25\xcc\xae\x97\x3e\xec\xc7\xd1" "\x87\x16\x8d\x5c\x9c\xd8\x48\xd5\x66\xcc\x17\x58\x76\x3f\x00\x00\x00\x9c" "\x92\x7d\xa3\x8d\x83\x31\x44\x80\xb1\x5e\x23\xeb\x8c\x5b\x87\x7a\x72\xbd" "\x4c\xf7\x4a\x29\x9d\xf4\xfb\xfc\x8e\x6e\xa9\x69\x39\xf1\x5d\x25\x4d\x90" "\x33\xc5\xa4\x57\x06\xbd\xa7\x8a\xb6\x02\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x11\x3a\x30\x65\xa4\x78\xd1\xde\x98\xbe\x3a\x66\xf6\xfb\xf6\x8f\x2f" "\x56\x93\x05\x0f\xa5\x6d\xb6\x2e\x2f\x99\xcf\x91\x60\x59\xee\x36\xcd\xad" "\x07\x8f\xc8\x8d\x17\xcb\xde\x37\xa2\x27\x0f\x90\xa6\x0a\xfe\x85\x48\xd4" "\xc5\x79\xb0\x9c\x33\x33\x82\xc6\xe7\xa3\x16\xac\x03\xaa\x23\xd3\x79\x83" "\x6b\x96\x17\x3a\x55\x41\xfa\x96\xc2\x7e\x7f\xb6\xd2\x58\x5d\x82\x8a\xa3" "\x30\xf3\x43\x8d\x84\x87\x91\x2b\xb7\x74\x2b\xe1\x50\x2e\x70\x66\x44\xf7" "\xa9\x37\x45\x1b\xeb\x7a\x5f\x6c\xa3\xef\x21\xe8\xcb\x8f\x84\x1a\xf6\xd5" "\x43\x34\xd8\x2a\x8b\x81\x6b\x6d\xac\xcf\x0c\x66\x16\x2f\x89\x76\x23\xee" "\x32\x5d\x71\x4f\x9f\x10\x63\x6a\x75\x73\x58\x2f\xf3\x1c\x7f\x9c\x6f\x76" "\x7c\x80\x6e\xf4\xaf\x48\x6c\xc1\x9a\x53\x55\xbd\xc8\x14\xcb\x55\x57\xc6" "\xfa\x64\x04\x17\x9c\x86\x59\x80\xb0\x81\x5b\x90\x7a\x7f\x26\x8e\x97\x82" "\x8c\x19\x6f\x5a\xc0\x33\xd3\x95\xa2\x17\xb4\xe1\xe4\x56\x63\x02\x3a\x02" "\x92\x00\x3c\x36\xa3\xb7\x46\x1f\xc2\xc8\x56\x6e\x0f\x3f\x69\x3b\xfa\xca" "\xe2\x6a\xa2\xb7\xd1\x79\x62\x98\x9c\xcb\x94\x36\x33\xc0\x80\xaa\xcc\x9b" "\x7d\x31\x1c\x25\x16\x86\xfc\x66\xaa\x80\xbf\x41\xa5\xbf\x6c\xd7\x2d\x5a" "\xa9\x95\x82\x0f\xb3\x18\xfa\xd6\x1a\x79\xa6\x1d\x0a\x96\x9f\xd6\x01\x8a" "\xc9\xf1\x31\xfe\x02\xfe\x31\xd5\x65\x72\x3c\xbf\x9b\x63\x84\x1e\x21\x41" "\x7f\xc2\x9a\x3e\x7a\x03\x88\x6d\x80\x56\x6a\xe0\x01\x86\x17\x99\xa4\xaa" "\xd9\x1c\x72\x13\x9e\x68\x1c\xed\x86\x25\xb6\x75\xdf\xbd\x6d\x45\x8d\x4b" "\x2d\x9e\x6d\x56\x54\x30\x24\x81\x72\xad\x94\x2c\xdb\x41\x63\x9f\x41\x13" "\x89\x68\x27\xc8\x80\x6e\x04\x92\x18\xcd\x1e\xef\x89\xd6\xb9\xb1\x4d\xd7" "\x07\xda\x40\x70\x5c\x07\xf8\x78\x26\x3f\xf9\xb7\x1c\xcf\x28\xec\x50\x17" "\x8c\x7a\xac\x83\xbe\xf7\xbd\x10\x45\x9e\x2f\x2e\x26\x7f\x82\xba\xfd\x5b" "\x4c\x7b\x48\x1e\xa5\xe4\xbc\xb6\xcf\xe0\x5e\x2a\xc3\xe1\x7c\x1f\x8f\x12" "\xdd\xf5\xb6\x77\x0c\xe0\xda\x8c\xb3\xab\xa3\xa9\x35\xa6\xb7\x37\xb6\xd3" "\xeb\xf2\xc7\x15\xdc\xc1\x1c\x57\x59\xbd\x0a\xcd\xec\xf3\x33\xf2\xb7\x7c" "\x52\xfb\x22\x51\x33\x6b\xbd\x92\xf7\x3a\xd1\xa3\x0b\xb9\x16\x2b\xd9\xd6" "\x99\xc4\x9d\x82\x4b\x82\x7f\x3e\x7c\x10\x96\x35\x49\x46\xe0\x99\x22\xdb" "\x25\x90\x4c\x83\x26\x2c\x6d\xcb\x87\x45\x7e\x4a\xbe\xfa\x0e\x9d\xcb\x17" "\xd7\x9c\x17\x38\x95\xb7\x4a\xae\x2e\xd4\x41\x96\x62\x69\x0a\x16\x49\x4e" "\x7b\x27\xd0\xd2\x68\x8c\x69\xb4\xbe\x3d\x21\xb7\x83\x19\x5f\x6a\x5e\x5d" "\xc5\xc0\x7c\x73\xf0\xd0\xf0\x67\x0d\xb1\x0a\xc9\xef\x5b\x82\x95\xff\x88" "\xdf\x73\x4e\x3c\x6a\xb8\x55\x5c\x03\x90\xf9\x62\xcb\xf5\x59\xbc\xe9\xc4" "\x2e\x10\x34\xdb\xa7\x89\x97\xb2\x87\x7b\x48\x5d\x9d\x4a\xe2\xfc\xd3\xe7" "\x57\xb8\x43\x19\x87\x9d\x03\x37\x78\x57\x73\xc9\x40\xaf\x6e\x57\xd1\x62" "\xf4\x60\x6d\x10\x1d\xef\x01\x19\x93\x25\xc8\x67\x6a\x32\xe2\x63\x03\x56" "\x02\x71\xb7\x20\x21\x6d\x95\xe0\x01\x32\x65\xa4\x5b\x02\xbd\x24\x14\xbe" "\xbd\xa8\x9b\x7b\x5e\x71\xe7\x0e\x00\x00\x00\x00\x00\x00\x00\x00", 2536); *(uint64_t*)0x200000000210 = 0x200000000340; memcpy((void*)0x200000000340, "syzkaller\000", 10); *(uint32_t*)0x200000000218 = 0; *(uint32_t*)0x20000000021c = 0; *(uint64_t*)0x200000000220 = 0; *(uint32_t*)0x200000000228 = 0; *(uint32_t*)0x20000000022c = 0; memset((void*)0x200000000230, 0, 16); *(uint32_t*)0x200000000240 = 0; *(uint32_t*)0x200000000244 = 0; *(uint32_t*)0x200000000248 = -1; *(uint32_t*)0x20000000024c = 8; *(uint64_t*)0x200000000250 = 0; *(uint32_t*)0x200000000258 = 0; *(uint32_t*)0x20000000025c = 0x10; *(uint64_t*)0x200000000260 = 0; *(uint32_t*)0x200000000268 = 0; *(uint32_t*)0x20000000026c = 0; *(uint32_t*)0x200000000270 = -1; *(uint32_t*)0x200000000274 = 0; *(uint64_t*)0x200000000278 = 0; *(uint64_t*)0x200000000280 = 0; *(uint32_t*)0x200000000288 = 0x10; *(uint32_t*)0x20000000028c = 0; *(uint32_t*)0x200000000290 = 0; res = syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x200000000200ul, /*size=*/0x48ul); if (res != -1) r[0] = res; // bpf$BPF_PROG_TEST_RUN arguments: [ // cmd: const = 0xa (8 bytes) // arg: ptr[in, bpf_test_prog_arg] { // bpf_test_prog_arg { // prog: fd_bpf_prog (resource) // retval: const = 0x18000000000002a0 (4 bytes) // insizedata: len = 0xfe (4 bytes) // outsizedata: len = 0x10000000 (4 bytes) // indata: ptr[in, buffer] { // buffer: {b9 ff 03 00 60 44 23 8c b8 9e 14 f0 88 a8 1b ff 88 a8 00 // 00 81 00 63 06 77 fb ac 14 14 42 e9 34 a0 a6 62 07 9f 4b 4d fe 87 // e5 fe ca 6a ab 84 50 13 f2 88 a8 1a 39 08 02 0b 09 8d a1 88 0b 25 // 18 1a a5 9d 94 3b e3 f4 ae d5 0e a5 a6 b8 68 67 31 cb 89 ef 77 12 // 3c 89 9b 69 9e ea a8 ea a0 07 34 61 11 96 63 90 64 00 f3 0c 06 00 // 00 00 00 00 00 59 b6 d3 29 6e 8c a3 1b ce 1d 83 92 07 8b 72 f2 49 // 96 ae 17 df fc 2e 43 c8 17 4b 54 b6 20 63 68 94 aa ac f2 8f f6 26 // 16 36 3c 70 a4 40 ae c4 01 4c af 28 c0 ad c0 43 08 46 17 d7 ec f4 // 1e 9d 13 45 89 d4 6e 5d fc 4c a5 78 0d 38 ca e8 70 b9 a1 df 48 b2 // 38 19 0d a4 50 29 6b 0a c0 14 96 ac e2 3e ef c9 d4 24 6d d1 4a fb // f7 9a 22 83 a0 bb 7e 1d 23 5f 3d f1 26 c3 ac c2 40 d7 5a 05 8f 6e // fa 6d 1f 5f 7f f4 00 00 00 00 00 00 00 00 00} (length 0xfe) // } // outdata: nil // repeat: int32 = 0xfe (4 bytes) // dur: const = 0x60000000 (4 bytes) // insizectx: len = 0x0 (4 bytes) // outsizectx: len = 0x6 (4 bytes) // inctx: ptr[in, buffer] { // buffer: {} (length 0x0) // } // outctx: ptr[in, buffer] { // buffer: {} (length 0x0) // } // flags: bpf_prog_test_run_flags = 0x0 (4 bytes) // cpu: const = 0x0 (4 bytes) // batch_size: int32 = 0x0 (4 bytes) // pad = 0x0 (4 bytes) // } // } // size: len = 0x2c (8 bytes) // ] *(uint32_t*)0x200000000080 = r[0]; *(uint32_t*)0x200000000084 = 0x2a0; *(uint32_t*)0x200000000088 = 0xfe; *(uint32_t*)0x20000000008c = 0x10000000; *(uint64_t*)0x200000000090 = 0x200000000100; memcpy((void*)0x200000000100, "\xb9\xff\x03\x00\x60\x44\x23\x8c\xb8\x9e\x14\xf0\x88\xa8\x1b\xff\x88" "\xa8\x00\x00\x81\x00\x63\x06\x77\xfb\xac\x14\x14\x42\xe9\x34\xa0\xa6" "\x62\x07\x9f\x4b\x4d\xfe\x87\xe5\xfe\xca\x6a\xab\x84\x50\x13\xf2\x88" "\xa8\x1a\x39\x08\x02\x0b\x09\x8d\xa1\x88\x0b\x25\x18\x1a\xa5\x9d\x94" "\x3b\xe3\xf4\xae\xd5\x0e\xa5\xa6\xb8\x68\x67\x31\xcb\x89\xef\x77\x12" "\x3c\x89\x9b\x69\x9e\xea\xa8\xea\xa0\x07\x34\x61\x11\x96\x63\x90\x64" "\x00\xf3\x0c\x06\x00\x00\x00\x00\x00\x00\x59\xb6\xd3\x29\x6e\x8c\xa3" "\x1b\xce\x1d\x83\x92\x07\x8b\x72\xf2\x49\x96\xae\x17\xdf\xfc\x2e\x43" "\xc8\x17\x4b\x54\xb6\x20\x63\x68\x94\xaa\xac\xf2\x8f\xf6\x26\x16\x36" "\x3c\x70\xa4\x40\xae\xc4\x01\x4c\xaf\x28\xc0\xad\xc0\x43\x08\x46\x17" "\xd7\xec\xf4\x1e\x9d\x13\x45\x89\xd4\x6e\x5d\xfc\x4c\xa5\x78\x0d\x38" "\xca\xe8\x70\xb9\xa1\xdf\x48\xb2\x38\x19\x0d\xa4\x50\x29\x6b\x0a\xc0" "\x14\x96\xac\xe2\x3e\xef\xc9\xd4\x24\x6d\xd1\x4a\xfb\xf7\x9a\x22\x83" "\xa0\xbb\x7e\x1d\x23\x5f\x3d\xf1\x26\xc3\xac\xc2\x40\xd7\x5a\x05\x8f" "\x6e\xfa\x6d\x1f\x5f\x7f\xf4\x00\x00\x00\x00\x00\x00\x00\x00\x00", 254); *(uint64_t*)0x200000000098 = 0; *(uint32_t*)0x2000000000a0 = 0xfe; *(uint32_t*)0x2000000000a4 = 0x60000000; *(uint32_t*)0x2000000000a8 = 0; *(uint32_t*)0x2000000000ac = 6; *(uint64_t*)0x2000000000b0 = 0x200000000000; *(uint64_t*)0x2000000000b8 = 0x200000000000; *(uint32_t*)0x2000000000c0 = 0; *(uint32_t*)0x2000000000c4 = 0; *(uint32_t*)0x2000000000c8 = 0; syscall(__NR_bpf, /*cmd=*/0xaul, /*arg=*/0x200000000080ul, /*size=*/0x2cul); } int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0x1000000ul, /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/ 7ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x200001000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); const char* reason; (void)reason; do_sandbox_none(); return 0; }