// https://syzkaller.appspot.com/bug?id=5030e6941851189bdae8a669c373279f5efb35eb // 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 #ifndef __NR_memfd_create #define __NR_memfd_create 279 #endif #ifndef __NR_mmap #define __NR_mmap 222 #endif static unsigned long long procid; static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static bool write_file(const char* file, const char* what, ...) { char buf[1024]; va_list args; va_start(args, what); vsnprintf(buf, sizeof(buf), what, args); va_end(args); buf[sizeof(buf) - 1] = 0; int len = strlen(buf); int fd = open(file, O_WRONLY | O_CLOEXEC); if (fd == -1) return false; if (write(fd, buf, len) != len) { int err = errno; close(fd); errno = err; return false; } close(fd); return true; } struct nlmsg { char* pos; int nesting; struct nlattr* nested[8]; char buf[4096]; }; static void netlink_init(struct nlmsg* nlmsg, int typ, int flags, const void* data, int size) { memset(nlmsg, 0, sizeof(*nlmsg)); struct nlmsghdr* hdr = (struct nlmsghdr*)nlmsg->buf; hdr->nlmsg_type = typ; hdr->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK | flags; memcpy(hdr + 1, data, size); nlmsg->pos = (char*)(hdr + 1) + NLMSG_ALIGN(size); } static void netlink_attr(struct nlmsg* nlmsg, int typ, const void* data, int size) { struct nlattr* attr = (struct nlattr*)nlmsg->pos; attr->nla_len = sizeof(*attr) + size; attr->nla_type = typ; if (size > 0) memcpy(attr + 1, data, size); nlmsg->pos += NLMSG_ALIGN(attr->nla_len); } static void netlink_nest(struct nlmsg* nlmsg, int typ) { struct nlattr* attr = (struct nlattr*)nlmsg->pos; attr->nla_type = typ; nlmsg->pos += sizeof(*attr); nlmsg->nested[nlmsg->nesting++] = attr; } static void netlink_done(struct nlmsg* nlmsg) { struct nlattr* attr = nlmsg->nested[--nlmsg->nesting]; attr->nla_len = nlmsg->pos - (char*)attr; } static int netlink_send_ext(struct nlmsg* nlmsg, int sock, uint16_t reply_type, int* reply_len, bool dofail) { if (nlmsg->pos > nlmsg->buf + sizeof(nlmsg->buf) || nlmsg->nesting) exit(1); struct nlmsghdr* hdr = (struct nlmsghdr*)nlmsg->buf; hdr->nlmsg_len = nlmsg->pos - nlmsg->buf; struct sockaddr_nl addr; memset(&addr, 0, sizeof(addr)); addr.nl_family = AF_NETLINK; ssize_t n = sendto(sock, nlmsg->buf, hdr->nlmsg_len, 0, (struct sockaddr*)&addr, sizeof(addr)); if (n != (ssize_t)hdr->nlmsg_len) { if (dofail) exit(1); return -1; } n = recv(sock, nlmsg->buf, sizeof(nlmsg->buf), 0); if (reply_len) *reply_len = 0; if (n < 0) { if (dofail) exit(1); return -1; } if (n < (ssize_t)sizeof(struct nlmsghdr)) { errno = EINVAL; if (dofail) exit(1); return -1; } if (hdr->nlmsg_type == NLMSG_DONE) return 0; if (reply_len && hdr->nlmsg_type == reply_type) { *reply_len = n; return 0; } if (n < (ssize_t)(sizeof(struct nlmsghdr) + sizeof(struct nlmsgerr))) { errno = EINVAL; if (dofail) exit(1); return -1; } if (hdr->nlmsg_type != NLMSG_ERROR) { errno = EINVAL; if (dofail) exit(1); return -1; } errno = -((struct nlmsgerr*)(hdr + 1))->error; return -errno; } static int netlink_send(struct nlmsg* nlmsg, int sock) { return netlink_send_ext(nlmsg, sock, 0, NULL, true); } static int netlink_query_family_id(struct nlmsg* nlmsg, int sock, const char* family_name, bool dofail) { struct genlmsghdr genlhdr; memset(&genlhdr, 0, sizeof(genlhdr)); genlhdr.cmd = CTRL_CMD_GETFAMILY; netlink_init(nlmsg, GENL_ID_CTRL, 0, &genlhdr, sizeof(genlhdr)); netlink_attr(nlmsg, CTRL_ATTR_FAMILY_NAME, family_name, strnlen(family_name, GENL_NAMSIZ - 1) + 1); int n = 0; int err = netlink_send_ext(nlmsg, sock, GENL_ID_CTRL, &n, dofail); if (err < 0) { return -1; } uint16_t id = 0; struct nlattr* attr = (struct nlattr*)(nlmsg->buf + NLMSG_HDRLEN + NLMSG_ALIGN(sizeof(genlhdr))); for (; (char*)attr < nlmsg->buf + n; attr = (struct nlattr*)((char*)attr + NLMSG_ALIGN(attr->nla_len))) { if (attr->nla_type == CTRL_ATTR_FAMILY_ID) { id = *(uint16_t*)(attr + 1); break; } } if (!id) { errno = EINVAL; return -1; } recv(sock, nlmsg->buf, sizeof(nlmsg->buf), 0); return id; } static 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_device_change(struct nlmsg* nlmsg, int sock, const char* name, bool up, const char* master, const void* mac, int macsize, const char* new_name) { struct ifinfomsg hdr; memset(&hdr, 0, sizeof(hdr)); if (up) hdr.ifi_flags = hdr.ifi_change = IFF_UP; hdr.ifi_index = if_nametoindex(name); netlink_init(nlmsg, RTM_NEWLINK, 0, &hdr, sizeof(hdr)); if (new_name) netlink_attr(nlmsg, IFLA_IFNAME, new_name, strlen(new_name)); if (master) { int ifindex = if_nametoindex(master); netlink_attr(nlmsg, IFLA_MASTER, &ifindex, sizeof(ifindex)); } if (macsize) netlink_attr(nlmsg, IFLA_ADDRESS, mac, macsize); int err = netlink_send(nlmsg, sock); if (err < 0) { } } static int netlink_add_addr(struct nlmsg* nlmsg, int sock, const char* dev, const void* addr, int addrsize) { struct ifaddrmsg hdr; memset(&hdr, 0, sizeof(hdr)); hdr.ifa_family = addrsize == 4 ? AF_INET : AF_INET6; hdr.ifa_prefixlen = addrsize == 4 ? 24 : 120; hdr.ifa_scope = RT_SCOPE_UNIVERSE; hdr.ifa_index = if_nametoindex(dev); netlink_init(nlmsg, RTM_NEWADDR, NLM_F_CREATE | NLM_F_REPLACE, &hdr, sizeof(hdr)); netlink_attr(nlmsg, IFA_LOCAL, addr, addrsize); netlink_attr(nlmsg, IFA_ADDRESS, addr, addrsize); return netlink_send(nlmsg, sock); } static void netlink_add_addr4(struct nlmsg* nlmsg, int sock, const char* dev, const char* addr) { struct in_addr in_addr; inet_pton(AF_INET, addr, &in_addr); int err = netlink_add_addr(nlmsg, sock, dev, &in_addr, sizeof(in_addr)); if (err < 0) { } } static void netlink_add_addr6(struct nlmsg* nlmsg, int sock, const char* dev, const char* addr) { struct in6_addr in6_addr; inet_pton(AF_INET6, addr, &in6_addr); int err = netlink_add_addr(nlmsg, sock, dev, &in6_addr, sizeof(in6_addr)); if (err < 0) { } } static void netlink_add_neigh(struct nlmsg* nlmsg, int sock, const char* name, const void* addr, int addrsize, const void* mac, int macsize) { struct ndmsg hdr; memset(&hdr, 0, sizeof(hdr)); hdr.ndm_family = addrsize == 4 ? AF_INET : AF_INET6; hdr.ndm_ifindex = if_nametoindex(name); hdr.ndm_state = NUD_PERMANENT; netlink_init(nlmsg, RTM_NEWNEIGH, NLM_F_EXCL | NLM_F_CREATE, &hdr, sizeof(hdr)); netlink_attr(nlmsg, NDA_DST, addr, addrsize); netlink_attr(nlmsg, NDA_LLADDR, mac, macsize); int err = netlink_send(nlmsg, sock); if (err < 0) { } } static struct nlmsg nlmsg; static int tunfd = -1; #define TUN_IFACE "syz_tun" #define LOCAL_MAC 0xaaaaaaaaaaaa #define REMOTE_MAC 0xaaaaaaaaaabb #define LOCAL_IPV4 "172.20.20.170" #define REMOTE_IPV4 "172.20.20.187" #define LOCAL_IPV6 "fe80::aa" #define REMOTE_IPV6 "fe80::bb" #define IFF_NAPI 0x0010 static void initialize_tun(void) { tunfd = open("/dev/net/tun", O_RDWR | O_NONBLOCK); if (tunfd == -1) { printf("tun: can't open /dev/net/tun: please enable CONFIG_TUN=y\n"); printf("otherwise fuzzing or reproducing might not work as intended\n"); return; } const int kTunFd = 200; if (dup2(tunfd, kTunFd) < 0) exit(1); close(tunfd); tunfd = kTunFd; struct ifreq ifr; memset(&ifr, 0, sizeof(ifr)); strncpy(ifr.ifr_name, TUN_IFACE, IFNAMSIZ); ifr.ifr_flags = IFF_TAP | IFF_NO_PI; if (ioctl(tunfd, TUNSETIFF, (void*)&ifr) < 0) { exit(1); } char sysctl[64]; sprintf(sysctl, "/proc/sys/net/ipv6/conf/%s/accept_dad", TUN_IFACE); write_file(sysctl, "0"); sprintf(sysctl, "/proc/sys/net/ipv6/conf/%s/router_solicitations", TUN_IFACE); write_file(sysctl, "0"); int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); if (sock == -1) exit(1); netlink_add_addr4(&nlmsg, sock, TUN_IFACE, LOCAL_IPV4); netlink_add_addr6(&nlmsg, sock, TUN_IFACE, LOCAL_IPV6); uint64_t macaddr = REMOTE_MAC; struct in_addr in_addr; inet_pton(AF_INET, REMOTE_IPV4, &in_addr); netlink_add_neigh(&nlmsg, sock, TUN_IFACE, &in_addr, sizeof(in_addr), &macaddr, ETH_ALEN); struct in6_addr in6_addr; inet_pton(AF_INET6, REMOTE_IPV6, &in6_addr); netlink_add_neigh(&nlmsg, sock, TUN_IFACE, &in6_addr, sizeof(in6_addr), &macaddr, ETH_ALEN); macaddr = LOCAL_MAC; netlink_device_change(&nlmsg, sock, TUN_IFACE, true, 0, &macaddr, ETH_ALEN, NULL); close(sock); } #define WIFI_INITIAL_DEVICE_COUNT 2 #define WIFI_MAC_BASE \ { \ 0x08, 0x02, 0x11, 0x00, 0x00, 0x00 \ } #define WIFI_IBSS_BSSID \ { \ 0x50, 0x50, 0x50, 0x50, 0x50, 0x50 \ } #define WIFI_IBSS_SSID \ { \ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10 \ } #define WIFI_DEFAULT_FREQUENCY 2412 #define WIFI_DEFAULT_SIGNAL 0 #define WIFI_DEFAULT_RX_RATE 1 #define HWSIM_CMD_REGISTER 1 #define HWSIM_CMD_FRAME 2 #define HWSIM_CMD_NEW_RADIO 4 #define HWSIM_ATTR_SUPPORT_P2P_DEVICE 14 #define HWSIM_ATTR_PERM_ADDR 22 #define IF_OPER_UP 6 struct join_ibss_props { int wiphy_freq; bool wiphy_freq_fixed; uint8_t* mac; uint8_t* ssid; int ssid_len; }; static int set_interface_state(const char* interface_name, int on) { struct ifreq ifr; int sock = socket(AF_INET, SOCK_DGRAM, 0); if (sock < 0) { return -1; } memset(&ifr, 0, sizeof(ifr)); strcpy(ifr.ifr_name, interface_name); int ret = ioctl(sock, SIOCGIFFLAGS, &ifr); if (ret < 0) { close(sock); return -1; } if (on) ifr.ifr_flags |= IFF_UP; else ifr.ifr_flags &= ~IFF_UP; ret = ioctl(sock, SIOCSIFFLAGS, &ifr); close(sock); if (ret < 0) { return -1; } return 0; } static int nl80211_set_interface(struct nlmsg* nlmsg, int sock, int nl80211_family, uint32_t ifindex, uint32_t iftype) { struct genlmsghdr genlhdr; memset(&genlhdr, 0, sizeof(genlhdr)); genlhdr.cmd = NL80211_CMD_SET_INTERFACE; netlink_init(nlmsg, nl80211_family, 0, &genlhdr, sizeof(genlhdr)); netlink_attr(nlmsg, NL80211_ATTR_IFINDEX, &ifindex, sizeof(ifindex)); netlink_attr(nlmsg, NL80211_ATTR_IFTYPE, &iftype, sizeof(iftype)); int err = netlink_send(nlmsg, sock); if (err < 0) { } return err; } static int nl80211_join_ibss(struct nlmsg* nlmsg, int sock, int nl80211_family, uint32_t ifindex, struct join_ibss_props* props) { struct genlmsghdr genlhdr; memset(&genlhdr, 0, sizeof(genlhdr)); genlhdr.cmd = NL80211_CMD_JOIN_IBSS; netlink_init(nlmsg, nl80211_family, 0, &genlhdr, sizeof(genlhdr)); netlink_attr(nlmsg, NL80211_ATTR_IFINDEX, &ifindex, sizeof(ifindex)); netlink_attr(nlmsg, NL80211_ATTR_SSID, props->ssid, props->ssid_len); netlink_attr(nlmsg, NL80211_ATTR_WIPHY_FREQ, &(props->wiphy_freq), sizeof(props->wiphy_freq)); if (props->mac) netlink_attr(nlmsg, NL80211_ATTR_MAC, props->mac, ETH_ALEN); if (props->wiphy_freq_fixed) netlink_attr(nlmsg, NL80211_ATTR_FREQ_FIXED, NULL, 0); int err = netlink_send(nlmsg, sock); if (err < 0) { } return err; } static int get_ifla_operstate(struct nlmsg* nlmsg, int ifindex) { struct ifinfomsg info; memset(&info, 0, sizeof(info)); info.ifi_family = AF_UNSPEC; info.ifi_index = ifindex; int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); if (sock == -1) { return -1; } netlink_init(nlmsg, RTM_GETLINK, 0, &info, sizeof(info)); int n; int err = netlink_send_ext(nlmsg, sock, RTM_NEWLINK, &n, true); close(sock); if (err) { return -1; } struct rtattr* attr = IFLA_RTA(NLMSG_DATA(nlmsg->buf)); for (; RTA_OK(attr, n); attr = RTA_NEXT(attr, n)) { if (attr->rta_type == IFLA_OPERSTATE) return *((int32_t*)RTA_DATA(attr)); } return -1; } static int await_ifla_operstate(struct nlmsg* nlmsg, char* interface, int operstate) { int ifindex = if_nametoindex(interface); while (true) { usleep(1000); int ret = get_ifla_operstate(nlmsg, ifindex); if (ret < 0) return ret; if (ret == operstate) return 0; } return 0; } static int nl80211_setup_ibss_interface(struct nlmsg* nlmsg, int sock, int nl80211_family_id, char* interface, struct join_ibss_props* ibss_props) { int ifindex = if_nametoindex(interface); if (ifindex == 0) { return -1; } int ret = nl80211_set_interface(nlmsg, sock, nl80211_family_id, ifindex, NL80211_IFTYPE_ADHOC); if (ret < 0) { return -1; } ret = set_interface_state(interface, 1); if (ret < 0) { return -1; } ret = nl80211_join_ibss(nlmsg, sock, nl80211_family_id, ifindex, ibss_props); if (ret < 0) { return -1; } return 0; } static int hwsim80211_create_device(struct nlmsg* nlmsg, int sock, int hwsim_family, uint8_t mac_addr[ETH_ALEN]) { struct genlmsghdr genlhdr; memset(&genlhdr, 0, sizeof(genlhdr)); genlhdr.cmd = HWSIM_CMD_NEW_RADIO; netlink_init(nlmsg, hwsim_family, 0, &genlhdr, sizeof(genlhdr)); netlink_attr(nlmsg, HWSIM_ATTR_SUPPORT_P2P_DEVICE, NULL, 0); netlink_attr(nlmsg, HWSIM_ATTR_PERM_ADDR, mac_addr, ETH_ALEN); int err = netlink_send(nlmsg, sock); if (err < 0) { } return err; } static void initialize_wifi_devices(void) { int rfkill = open("/dev/rfkill", O_RDWR); if (rfkill == -1) { if (errno != ENOENT && errno != EACCES) exit(1); } else { struct rfkill_event event = {0}; event.type = RFKILL_TYPE_ALL; event.op = RFKILL_OP_CHANGE_ALL; if (write(rfkill, &event, sizeof(event)) != (ssize_t)(sizeof(event))) exit(1); close(rfkill); } uint8_t mac_addr[6] = WIFI_MAC_BASE; int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC); if (sock < 0) { return; } int hwsim_family_id = netlink_query_family_id(&nlmsg, sock, "MAC80211_HWSIM", true); int nl80211_family_id = netlink_query_family_id(&nlmsg, sock, "nl80211", true); uint8_t ssid[] = WIFI_IBSS_SSID; uint8_t bssid[] = WIFI_IBSS_BSSID; struct join_ibss_props ibss_props = {.wiphy_freq = WIFI_DEFAULT_FREQUENCY, .wiphy_freq_fixed = true, .mac = bssid, .ssid = ssid, .ssid_len = sizeof(ssid)}; for (int device_id = 0; device_id < WIFI_INITIAL_DEVICE_COUNT; device_id++) { mac_addr[5] = device_id; int ret = hwsim80211_create_device(&nlmsg, sock, hwsim_family_id, mac_addr); if (ret < 0) exit(1); char interface[6] = "wlan0"; interface[4] += device_id; if (nl80211_setup_ibss_interface(&nlmsg, sock, nl80211_family_id, interface, &ibss_props) < 0) exit(1); } for (int device_id = 0; device_id < WIFI_INITIAL_DEVICE_COUNT; device_id++) { char interface[6] = "wlan0"; interface[4] += device_id; int ret = await_ifla_operstate(&nlmsg, interface, IF_OPER_UP); if (ret < 0) exit(1); } 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, 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 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, loopfd = -1, 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) { memset(loopname, 0, sizeof(loopname)); snprintf(loopname, sizeof(loopname), "/dev/loop%llu", procid); if (setup_loop_device(data, size, loopname, &loopfd) == -1) return -1; 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) { ioctl(loopfd, LOOP_CLR_FD, 0); close(loopfd); } errno = err; return res; } 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(); if (unshare(CLONE_NEWNET)) { } write_file("/proc/sys/net/ipv4/ping_group_range", "0 65535"); initialize_tun(); initialize_wifi_devices(); setup_binderfs(); loop(); exit(1); } static void close_fds() { for (int fd = 3; fd < MAX_FDS; fd++) close(fd); } static void setup_binfmt_misc() { if (mount(0, "/proc/sys/fs/binfmt_misc", "binfmt_misc", 0, 0)) { } write_file("/proc/sys/fs/binfmt_misc/register", ":syz0:M:0:\x01::./file0:"); write_file("/proc/sys/fs/binfmt_misc/register", ":syz1:M:1:\x02::./file0:POC"); } static void setup_usb() { if (chmod("/dev/raw-gadget", 0666)) exit(1); } #define NL802154_CMD_SET_SHORT_ADDR 11 #define NL802154_ATTR_IFINDEX 3 #define NL802154_ATTR_SHORT_ADDR 10 static void setup_802154() { int sock_route = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); if (sock_route == -1) exit(1); int sock_generic = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC); if (sock_generic < 0) exit(1); int nl802154_family_id = netlink_query_family_id(&nlmsg, sock_generic, "nl802154", true); for (int i = 0; i < 2; i++) { char devname[] = "wpan0"; devname[strlen(devname) - 1] += i; uint64_t hwaddr = 0xaaaaaaaaaaaa0002 + (i << 8); uint16_t shortaddr = 0xaaa0 + i; int ifindex = if_nametoindex(devname); struct genlmsghdr genlhdr; memset(&genlhdr, 0, sizeof(genlhdr)); genlhdr.cmd = NL802154_CMD_SET_SHORT_ADDR; netlink_init(&nlmsg, nl802154_family_id, 0, &genlhdr, sizeof(genlhdr)); netlink_attr(&nlmsg, NL802154_ATTR_IFINDEX, &ifindex, sizeof(ifindex)); netlink_attr(&nlmsg, NL802154_ATTR_SHORT_ADDR, &shortaddr, sizeof(shortaddr)); int err = netlink_send(&nlmsg, sock_generic); if (err < 0) { } netlink_device_change(&nlmsg, sock_route, devname, true, 0, &hwaddr, sizeof(hwaddr), 0); if (i == 0) { netlink_add_device_impl(&nlmsg, "lowpan", "lowpan0", false); netlink_done(&nlmsg); netlink_attr(&nlmsg, IFLA_LINK, &ifindex, sizeof(ifindex)); int err = netlink_send(&nlmsg, sock_route); if (err < 0) { } } } close(sock_route); close(sock_generic); } void loop(void) { memcpy((void*)0x20000040, "ntfs\000", 5); memcpy((void*)0x2001f200, "./file0\000", 8); memcpy( (void*)0x20000980, "\x78\x9c\xec\x9d\x4f\x6c\x1b\x59\x1d\xc7\xbf\x33\xb6\xe3\x6c\x92\xb6\x49" "\xa8\x50\x16\x0e\x3b\x45\xd6\xaa\x12\x28\xb2\x80\x95\xb8\xd5\xf9\xe3\x34" "\xae\xd2\x24\x9b\x38\x55\xb9\xd0\xb8\xc4\xdd\x86\x66\x63\x6f\xec\x6a\x37" "\xa8\x62\xcd\x6d\x11\x97\x1c\x11\x97\xed\x71\x85\x38\x44\x82\x03\x12\x12" "\xda\x23\x97\x0a\x8e\x08\x71\xe0\xb0\xb7\x5e\x2a\x71\x60\x0f\xa8\x46\xf3" "\xe6\xbd\xc9\xfc\xf1\xe4\x8f\x93\xd8\x4d\x7e\xdf\x8f\xd4\xbe\xe7\xf1\xf8" "\xcd\x9b\xf9\xfa\x4d\xfc\x7d\x7f\x7e\xf3\x72\x65\x6f\xb1\x3c\xb7\xea\x38" "\x8e\x83\x51\x0b\x1e\x5f\x7b\xc9\xc7\x55\x2f\x6d\xa1\x85\xb6\x7e\x2f\xad" "\x77\x69\xeb\xd4\xdd\xfc\x9f\x6b\xc0\x7f\x7f\xfb\xcb\xdb\xdf\x6d\xfc\x6d" "\x06\x23\xc0\xd5\x77\xfe\xf2\xd1\xb3\xdf\x7f\xe7\xcb\xe6\xf0\xbd\x3f\x5e" "\xfd\x73\x16\x2f\x46\x7f\xf2\xf2\xd5\xf7\xbf\x7a\xf1\xcd\x17\x6f\xbf\x7c" "\x5d\x7e\xbc\xd9\x70\x36\x1b\xce\x76\xad\xe9\x54\x9c\x87\xb5\x5a\xb3\xf2" "\x70\xab\xea\x6c\x6c\x36\x9e\x4c\x3a\xcb\x5b\xd5\x4a\xa3\xea\x6c\x6e\x37" "\xaa\x3b\xa1\xb7\x1f\x6d\xd5\xea\xf5\x5d\xa7\xb2\xbd\x71\x65\xa8\xbe\x53" "\x6d\x34\x9c\xca\xf6\xae\xf3\xa4\xba\xeb\x34\x6b\x4e\x73\x67\xd7\xa9\x7c" "\x50\xd9\xdc\x76\x26\x27\x27\x9d\x2b\x43\x20\xc7\x64\xed\x77\xfd\xae\x01" "\x21\x84\x10\x42\x08\x21\x84\x10\x42\x08\x21\x84\x10\x42\x08\x21\x84\x90" "\xb3\xa1\xdd\x46\xd6\x4d\x6f\xf5\xbb\x22\x84\x10\x42\x08\x21\x84\x10\x42" "\x08\x21\x84\x10\x42\x08\x21\x84\x10\x42\x08\xe9\x9a\xb9\xd2\x42\x31\x8f" "\xb7\xfc\xd7\x16\x2c\xcc\xc3\xc2\x17\x16\x80\xd1\x83\xfd\xcc\xba\xff\xc1" "\x84\x72\xdc\x5d\xd7\x55\x6e\x42\xfd\x3f\xef\xe7\x0e\x67\xe0\x98\xf5\xcc" "\x03\x78\xec\x97\x6f\xe3\x8e\xca\x59\xc8\xa8\x6d\x19\xb4\xca\xf9\xed\x5f" "\xbf\xfe\x87\x95\x94\x62\x5f\x07\x30\xd0\xa9\x39\x6e\x3a\x95\xc3\x5d\xcc" "\xa1\xac\x5f\xb7\x74\xdd\x2d\x14\x74\x74\x03\x8f\x3b\x3a\x2d\x98\x0d\xfb" "\xfa\x8a\xac\x87\xd3\xb1\x5b\xe9\x1b\x23\xb7\x2c\xec\x87\xca\x49\xc5\xce" "\xc7\x2f\x67\x34\x94\xf8\xe9\x98\x65\xab\xb4\xdd\x6e\xb7\x8f\x79\x89\xba" "\x20\x49\x4d\x22\x03\xea\x2f\x1b\xea\x2f\x1b\xea\x2f\x1b\xea\x2f\x1b\xea" "\x2f\x1b\xea\x2f\x9b\xc1\x44\xff\xff\x38\xe2\xff\x53\xda\x0d\xdb\x09\x25" "\x25\xf9\xff\xa3\x7c\x79\x47\xff\x6f\xc5\x37\xb9\xfe\xbf\xee\x97\x6f\x63" "\xe5\xa4\xfe\xdf\x18\x6e\x9d\x9a\xe3\x0e\xfa\xfe\xff\x2e\x36\xb1\x83\x1d" "\xbd\x3d\xa9\x1f\x20\x15\x2e\x06\xd1\x72\x4d\x7a\x23\xed\xd9\xf6\xf3\xf5" "\xef\x84\x9c\x86\xa4\xd6\x4c\x64\x40\xfd\x65\x43\xfd\x65\x43\xfd\x65\x43" "\xfd\x65\x43\xfd\x65\x63\xc7\xfc\xbf\x7d\x88\xff\xb7\x2f\xb2\xff\xf7\x67" "\x30\x78\x69\xd0\xff\x2f\xa0\x86\x0f\x30\x87\x4d\x6c\x41\x3f\xf2\x20\xd1" "\xff\x9b\x38\x09\xbe\xff\x8f\x94\x6b\xd2\x1b\x85\x94\xfa\x50\x7f\xfc\xbf" "\x95\x3e\xde\x7e\x6c\xff\x97\x9c\xaf\x3a\x34\xa5\x00\xd4\x5f\x36\xd4\x5f" "\x36\xd4\x5f\x36\xd4\x5f\x36\xd4\x5f\x36\xd4\x5f\x36\x71\xff\x9f\xd2\xfe" "\xff\x55\xc4\xff\x0f\x04\xfa\x00\x3a\x31\xaa\xfd\xb2\xf1\xff\xf9\x2e\xfd" "\x7f\x78\x9e\xbf\x85\xe5\x13\xfb\xfc\x30\xa6\xfc\x6c\x2a\x87\x7b\xa8\x61" "\x0b\x4f\xf1\x21\xaa\xaa\xdc\x96\x7f\x1c\x1b\x1b\xfe\x11\xd3\x2d\xf7\x3c" "\xcc\x7a\x80\xeb\xea\xdd\x1f\xea\xf3\xbe\x8e\xcf\xad\x71\x58\xde\x51\x32" "\xe3\xfa\xf3\x6a\x9b\xb7\x43\xc6\x01\xe0\xd8\x08\xed\x13\x7d\x0f\xba\xaf" "\x24\xef\x1f\x3f\x8d\x71\x9d\x6b\x60\x17\x3f\xc7\x13\x54\xb0\xa5\x7a\x23" "\xcc\x7c\x84\x3a\x80\x9b\xfe\xfe\x19\x8c\x44\xd6\x57\xa4\xf4\x99\xb7\xfc" "\xed\x13\xfe\x6c\x85\x89\xc4\x7e\x08\xb6\x7f\xd9\x50\x7f\xd9\x50\x7f\xd9" "\x50\x7f\xd9\x50\x7f\xd9\x50\x7f\xd9\x50\x7f\xd9\xc4\xfd\x7f\x5a\xfb\xff" "\xe7\xc3\xf1\xf5\xff\x69\xff\x1b\x53\x8e\x95\x74\x96\xfe\xff\x14\xe3\xfc" "\x07\x0b\xed\x87\xbc\x24\x38\xce\x3f\x85\x26\x9a\xd8\xc1\x2c\xaa\x78\xa4" "\xb7\x87\xfb\x01\x52\xc7\xee\x07\xf8\x15\xe2\xfd\x00\x6a\xdb\x09\xfb\x01" "\x94\x5f\x1f\x32\xc7\xb7\x9e\xb9\xbb\xb7\x3f\x05\x72\x58\x45\x19\x53\x58" "\xc4\x2c\xa6\xb0\x82\x59\x3c\x40\x09\x8b\x98\xc3\x12\x56\x70\x17\x53\x28" "\xa3\x84\x25\x2c\x9e\x40\xed\x38\xc9\xed\x3f\x20\xbd\x9a\xeb\x90\xd7\xf9" "\x79\x9d\xe6\x54\x0d\xca\x58\x41\x09\xd3\x58\x43\x19\x45\x3c\xc0\x02\x4a" "\xaa\xde\xe7\x8f\x13\xc8\xb7\x02\xf9\xb6\x26\x87\x39\x94\xb0\xa0\x6a\xb5" "\x88\x29\xdc\x45\xb1\x07\xb5\x3a\x20\x1f\xc8\x4f\x03\x98\x35\x79\x7d\xc9" "\x73\x58\xc2\x34\xee\xa0\x88\x19\x94\x95\xb6\xb3\xc7\x29\xf6\xcc\x1e\xd3" "\xe1\xcd\x5f\xb1\x03\x79\x8d\x65\xea\xb7\xaa\xea\xb6\xa6\x14\x2e\xe3\xc7" "\x78\x80\x59\x14\xb1\x8a\x19\xb5\x65\x19\x65\xf5\x4d\x3c\x2f\x96\x03\xf9" "\xce\xfa\xde\xc3\x12\x16\xb0\xa6\x94\xed\xbd\xc6\xeb\x81\x7c\x21\xd8\x92" "\xfc\xeb\x17\xae\xdf\xd9\xb7\xdd\xc3\xa9\x47\xea\x37\xa2\xf3\x26\xcd\xa9" "\xfb\x8a\x8d\xa9\x73\xac\xc3\x61\xb4\x12\xb6\x1f\xe8\x5b\x52\xf7\xbe\x22" "\xee\xe3\x01\x56\xb0\x84\xa5\x9e\xdc\x57\x0c\x7b\x81\x7c\xe1\xc8\xfa\x4d" "\x61\x01\x0b\x58\xc2\x4c\x4f\xb4\x75\x79\x1e\xc8\x77\x6e\x1f\xd3\xaa\xdd" "\xba\xdf\xb6\xe5\xc4\x52\xce\xef\xf7\xdf\xfe\x91\xf5\x5b\x41\x11\xcb\xea" "\x6f\xdb\xaa\x6a\x21\xcb\x58\x52\xd7\xb4\x37\x2a\x7f\x99\x50\x3f\x23\x76" "\x0e\x45\x4c\xf5\xa1\xdd\x1a\xfe\x6e\x32\x59\x2f\x31\x2b\x75\x4d\xea\xd5" "\xef\xb4\x74\xaf\xff\xbf\x13\xdf\xf1\x6e\x80\x39\xd5\x1e\x6e\xe3\x36\x8a" "\xea\xb7\xcb\x9a\xba\x76\x0b\xfe\xdf\x92\x55\xf5\xdb\xa1\xa8\xee\xda\xe7" "\x42\x60\x24\xa8\x95\xf4\xc6\x1b\x4c\x6f\xe6\x8d\xd2\xff\xc9\x86\xfa\xcb" "\x26\xee\xff\x33\xca\xff\xa7\x30\x6a\xc7\xc7\xff\x33\xea\xcf\x51\xbe\x63" "\x49\x47\xf9\xff\xe9\xf7\xde\xfb\x28\x98\x9a\xed\xef\x46\xca\xc9\x87\xd6" "\x11\x58\xca\x15\x9d\x72\xfc\x5f\x9d\x85\x95\x9a\x54\xaf\x97\x43\xf3\xfa" "\x0f\xbe\xff\xe6\x83\xfe\x6f\x3d\x6d\x30\xbf\x37\x1a\x4e\xc7\xec\x19\x95" "\xba\xbf\x0f\xef\xbb\x99\xb4\xd7\x6f\xf0\x23\xfd\x11\xf7\x77\xe1\x0f\x90" "\x57\xe7\x61\xe9\x0b\x63\xa6\x52\xdc\xd4\xff\x82\x95\x9c\x88\x44\x07\x7c" "\xae\xeb\x68\xa5\x0b\xfa\x8a\x87\x99\x0f\x5e\xf0\x0e\xa9\x39\xfe\x98\xe5" "\x79\xa1\x7d\x33\x6f\x20\xed\xcd\x33\x18\x0c\xd5\x33\xeb\xd7\x85\x71\x0a" "\x24\x92\xed\x77\x05\x48\x5f\xa1\xfe\xb2\xa1\xfe\xb2\xa1\xfe\x17\x1f\xdd" "\xa1\xf6\x69\x37\x9f\xa5\xfe\xb2\xa1\xfe\xb2\xc9\xc6\xfc\xff\x80\x1e\xff" "\x5f\xef\xb0\xfe\x7f\xa0\xcf\xeb\xff\x83\xf1\xff\x4f\xbc\x2e\x40\x9f\x4b" "\xc1\x3f\x4f\x7d\x05\x52\x39\x4c\x63\x13\x4d\x7c\x88\x0a\xea\x89\xeb\xfe" "\x0d\xd1\xb8\xfd\xd1\xf0\x7f\x63\xd6\x9c\x4a\x2f\x86\x9f\x66\xff\x9f\x6c" "\xa8\xbf\x6c\xa8\xbf\x6c\xa8\xbf\x6c\xa8\xbf\x6c\xa8\xbf\x6c\xa8\xbf\x6c" "\xe2\xe3\xff\x59\xed\xff\xff\xda\xe1\xf9\x7f\xd9\x9e\xaf\xff\xb7\xb1\x70" "\x52\x9f\x6f\x26\x86\xeb\xd4\x94\x9f\x51\x3e\xbf\x86\x1a\x9a\xea\xf5\x9b" "\x30\xef\xbf\x53\x3f\x43\xd2\x3c\x84\x68\x3a\xa6\xcb\x39\x5d\x3f\x03\xdb" "\xbf\x6c\xa8\xff\x25\x26\xfe\xd0\xd1\x18\xd4\x5f\x36\xd4\x5f\x36\xd4\x5f" "\x36\xd4\x5f\x36\xd4\x5f\x36\x71\xff\x3f\xa8\xfd\xff\x67\x1d\xfc\xff\xe0" "\x19\x8c\xff\x9b\x30\xf9\xa7\x8b\xff\x9f\xea\x22\xfe\x7f\x98\x60\x5c\x80" "\x69\x54\xb0\x81\x19\x15\x1b\xb0\x01\xcf\x4f\x87\xe3\xe8\xd9\x7e\xae\x15" "\x9a\x9f\x7f\x50\xec\x6b\x9d\xf5\xe7\xe7\xbf\x7a\x27\x9c\x6a\xcc\xd1\xec" "\xb6\xf7\x81\xfe\xce\x13\x60\xfb\x97\x0d\xf5\x97\x0d\xf5\x97\x0d\xf5\x97" "\x0d\xf5\x97\x0d\xf5\x97\x0d\xf5\x97\x4d\xdc\xff\xbf\xa5\xfc\xff\x5b\xf8" "\x53\x64\xfd\x7f\x46\xbd\xe7\x7e\xa2\xd4\xb1\xa4\x53\xcc\xff\x77\xa2\x65" "\x59\x47\xce\xff\x3f\x93\xe7\x02\xa8\xe3\x66\x53\x39\xac\xa2\x8a\x9f\xe2" "\x29\x76\x50\x8d\xf8\xfb\x83\xf6\x51\xf0\xaf\x8f\x39\x61\xaf\x23\xe3\x7f" "\x08\xa7\x6e\x69\xb3\x58\xc5\xd8\xd4\x6d\xf5\x7a\xcf\xc4\x42\xd2\x71\x02" "\xf6\xfc\xf5\xf7\xee\x7e\x5e\x6f\xc1\x38\xc2\x71\x02\x5a\x81\x98\x35\x13" "\x6a\x06\x82\x7b\xfe\x5e\xe4\x9f\xf7\x73\x7f\x50\xd7\xc7\xa4\x66\xbf\x67" "\x00\x4a\x28\xc5\xf6\x7f\x35\x9e\xfa\xda\x2d\xd8\xa4\x08\xed\x6f\x87\xf4" "\xb3\x75\x7d\x9f\xe3\x20\x5e\x40\x2b\x50\xdf\x92\xd6\x7e\x34\x52\xdf\x7a" "\x20\xde\xd8\x75\x7d\xfc\x9b\xa6\xa3\x27\xe1\xd8\xd1\xfd\x92\xce\x29\x5a" "\xbf\x8b\xb1\xae\xe2\xa2\xc0\xfb\xbf\x6c\xa8\xbf\x4c\xcc\xcd\x98\xfa\xcb" "\x86\xfa\xcb\x86\xfa\x4b\xe4\xe0\x37\x34\xf5\x97\x4d\xdc\xff\x0f\xe9\xf1" "\xff\x2f\x3a\x8c\xff\x0f\xf5\x71\xfd\xff\x68\xc8\xff\xa7\xba\xf0\xff\xb6" "\x7f\xce\x88\xac\xff\x5f\x43\x1d\x33\xa8\xa0\x81\xaa\xf2\xba\x9d\xe6\xe5" "\x9b\x51\xfc\x42\xa8\x46\x88\x5d\x91\x1b\xce\x67\x2a\x35\xf3\xfb\x91\xf1" "\xe6\x0f\x38\x3a\x0e\x5f\x0e\x25\x6c\xe3\x11\x6a\x7a\x7f\xd3\xf9\x31\xb2" "\xf9\xed\x27\x1f\xff\xe2\x5f\xff\x8c\x9e\xf7\xf9\xfa\x5d\xb6\x7f\xd9\x50" "\x7f\xd9\x50\x7f\xd9\x50\x7f\xd9\x50\x7f\xd9\x50\x7f\xd9\x50\x7f\xd9\xc4" "\xfd\xff\xb0\x8e\xff\xbf\x67\xc7\xe3\xff\x0d\xf7\xc8\xff\xf7\x68\xfc\x5f" "\x9d\x9d\xeb\xff\x8b\xf8\x04\x4d\x54\xb1\x8d\x0d\x35\xfe\xfd\x89\x65\xc6" "\xbf\x6d\xdc\xb7\x8e\x8e\xeb\x3f\x6f\x79\xff\x5c\xde\xf6\xce\x00\xeb\xfa" "\x29\x41\xc3\xfa\xff\x93\xd6\xef\x5d\xdd\x35\x30\x90\xca\x61\x09\x0f\xf1" "\x33\x94\xfc\x18\x05\x67\x57\xbe\xad\xca\x7f\x1f\x4f\x55\x5c\x84\x0a\x80" "\x6f\xe9\xf2\x1f\xeb\x67\xbb\x9d\xb6\xfe\x83\xa9\x1c\x56\x50\x45\x1d\x15" "\xec\xa8\x1e\x96\xf8\xf7\x86\xe3\xfa\xfd\x82\xf7\x7f\xd9\x50\x7f\xd9\x50" "\x7f\xd9\x50\x7f\xd9\x50\x7f\xd9\x50\x7f\xd9\xc4\xfd\xff\x88\xf2\xee\x16" "\xf2\x1d\xe2\xff\x8f\xf4\x20\xfe\x5f\x38\x2e\x9f\x7d\xec\xb8\x7c\x9f\x5b" "\xf1\xb8\x7c\x6a\x5b\x37\xcf\xe3\xf7\x8f\x6f\xf9\xb9\xce\xfe\xb4\x70\xfc" "\x4b\xfd\x46\xc2\xf6\x2f\x1b\xea\x2f\x1b\xea\x2f\x8f\xc0\xd3\xd0\x8f\x11" "\x21\x92\x5c\x66\xd8\xfe\x65\x43\xfd\x65\x43\xfd\x65\x13\xf7\xff\x57\x0e" "\xf1\xff\x57\xe8\xff\x2f\x19\x6c\xff\xb2\xa1\xfe\xb2\xa1\xfe\xb2\xa1\xfe" "\xb2\xa1\xfe\xb2\xa1\xfe\xb2\xa1\xfe\xb2\x89\xfb\xff\xab\x87\xf8\xff\xab" "\xa2\xfd\xbf\x4d\xff\x4f\x2e\x19\xd4\x5f\x36\xd4\x5f\x36\xd4\x5f\x36\xd4" "\x5f\x36\xd4\x5f\x36\xd4\x5f\x36\x71\xff\x7f\xed\x10\xff\x7f\x4d\xb4\xff" "\xe7\xf8\x3f\xb9\x6c\x50\x7f\xd9\x50\x7f\xd9\x50\x7f\xd9\x50\x7f\xd9\x50" "\x7f\xd9\x50\x7f\xd9\xc4\xfd\xbf\xf1\xf1\xbf\x41\xd8\xff\x1f\xf5\xc4\xa0" "\xb3\xf2\xff\x97\xd3\x67\xbf\xa9\xb0\xfd\xcb\x86\xfa\xcb\x86\xfa\xcb\x86" "\xfa\xcb\x86\xfa\xcb\x86\xfa\xcb\x86\xfa\xcb\x26\xee\xff\xc7\xe8\xff\x05" "\xc1\xf6\x2f\x1b\xea\x2f\x1b\xea\x2f\x1b\xea\x2f\x1b\xea\x2f\x1b\xea\x7f" "\x59\xe8\x2e\x94\x2b\xf5\x97\x4d\xdc\xff\x8f\xd3\xff\x0b\x82\xed\x5f\x36" "\xd4\x5f\x36\xd4\x5f\x36\xd4\x5f\x36\xd4\x5f\x36\xd4\x5f\x36\xd4\x5f\x36" "\x71\xff\xff\x0d\xfa\x7f\x41\xb0\xfd\xcb\x86\xfa\xcb\x86\xfa\xcb\x86\xfa" "\xcb\x86\xfa\xcb\x86\xfa\x5f\x10\xfe\x1f\x00\x00\xff\xff\x81\x2f\x07" "\x70", 2430); syz_mount_image(0x20000040, 0x2001f200, 0, 0x20000000, 0, 0x97e, 0x20000980); close_fds(); } int main(void) { syscall(__NR_mmap, 0x1ffff000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul); syscall(__NR_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x32ul, -1, 0ul); syscall(__NR_mmap, 0x21000000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul); setup_binfmt_misc(); setup_usb(); setup_802154(); use_temporary_dir(); do_sandbox_none(); return 0; }