// https://syzkaller.appspot.com/bug?id=3690b3979ff88ef32739ef6cc9c45fb74fe59abd // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifndef __NR_memfd_create #define __NR_memfd_create 319 #endif static unsigned long long procid; static __thread int clone_ongoing; static __thread int skip_segv; static __thread jmp_buf segv_env; static void segv_handler(int sig, siginfo_t* info, void* ctx) { if (__atomic_load_n(&clone_ongoing, __ATOMIC_RELAXED) != 0) { exit(sig); } uintptr_t addr = (uintptr_t)info->si_addr; const uintptr_t prog_start = 1 << 20; const uintptr_t prog_end = 100 << 20; int skip = __atomic_load_n(&skip_segv, __ATOMIC_RELAXED) != 0; int valid = addr < prog_start || addr > prog_end; if (skip && valid) { _longjmp(segv_env, 1); } exit(sig); } static void install_segv_handler(void) { struct sigaction sa; memset(&sa, 0, sizeof(sa)); sa.sa_handler = SIG_IGN; syscall(SYS_rt_sigaction, 0x20, &sa, NULL, 8); syscall(SYS_rt_sigaction, 0x21, &sa, NULL, 8); memset(&sa, 0, sizeof(sa)); sa.sa_sigaction = segv_handler; sa.sa_flags = SA_NODEFER | SA_SIGINFO; sigaction(SIGSEGV, &sa, NULL); sigaction(SIGBUS, &sa, NULL); } #define NONFAILING(...) \ ({ \ int ok = 1; \ __atomic_fetch_add(&skip_segv, 1, __ATOMIC_SEQ_CST); \ if (_setjmp(segv_env) == 0) { \ __VA_ARGS__; \ } else \ ok = 0; \ __atomic_fetch_sub(&skip_segv, 1, __ATOMIC_SEQ_CST); \ ok; \ }) static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static bool write_file(const char* file, const char* what, ...) { char buf[1024]; va_list args; va_start(args, what); vsnprintf(buf, sizeof(buf), what, args); va_end(args); buf[sizeof(buf) - 1] = 0; int len = strlen(buf); int fd = open(file, O_WRONLY | O_CLOEXEC); if (fd == -1) return false; if (write(fd, buf, len) != len) { int err = errno; close(fd); errno = err; return false; } close(fd); return true; } struct nlmsg { char* pos; int nesting; struct nlattr* nested[8]; char buf[4096]; }; static void netlink_init(struct nlmsg* nlmsg, int typ, int flags, const void* data, int size) { memset(nlmsg, 0, sizeof(*nlmsg)); struct nlmsghdr* hdr = (struct nlmsghdr*)nlmsg->buf; hdr->nlmsg_type = typ; hdr->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK | flags; memcpy(hdr + 1, data, size); nlmsg->pos = (char*)(hdr + 1) + NLMSG_ALIGN(size); } static void netlink_attr(struct nlmsg* nlmsg, int typ, const void* data, int size) { struct nlattr* attr = (struct nlattr*)nlmsg->pos; attr->nla_len = sizeof(*attr) + size; attr->nla_type = typ; if (size > 0) memcpy(attr + 1, data, size); nlmsg->pos += NLMSG_ALIGN(attr->nla_len); } static void netlink_nest(struct nlmsg* nlmsg, int typ) { struct nlattr* attr = (struct nlattr*)nlmsg->pos; attr->nla_type = typ; nlmsg->pos += sizeof(*attr); nlmsg->nested[nlmsg->nesting++] = attr; } static void netlink_done(struct nlmsg* nlmsg) { struct nlattr* attr = nlmsg->nested[--nlmsg->nesting]; attr->nla_len = nlmsg->pos - (char*)attr; } static int netlink_send_ext(struct nlmsg* nlmsg, int sock, uint16_t reply_type, int* reply_len, bool dofail) { if (nlmsg->pos > nlmsg->buf + sizeof(nlmsg->buf) || nlmsg->nesting) exit(1); struct nlmsghdr* hdr = (struct nlmsghdr*)nlmsg->buf; hdr->nlmsg_len = nlmsg->pos - nlmsg->buf; struct sockaddr_nl addr; memset(&addr, 0, sizeof(addr)); addr.nl_family = AF_NETLINK; ssize_t n = sendto(sock, nlmsg->buf, hdr->nlmsg_len, 0, (struct sockaddr*)&addr, sizeof(addr)); if (n != (ssize_t)hdr->nlmsg_len) { if (dofail) exit(1); return -1; } n = recv(sock, nlmsg->buf, sizeof(nlmsg->buf), 0); if (reply_len) *reply_len = 0; if (n < 0) { if (dofail) exit(1); return -1; } if (n < (ssize_t)sizeof(struct nlmsghdr)) { errno = EINVAL; if (dofail) exit(1); return -1; } if (hdr->nlmsg_type == NLMSG_DONE) return 0; if (reply_len && hdr->nlmsg_type == reply_type) { *reply_len = n; return 0; } if (n < (ssize_t)(sizeof(struct nlmsghdr) + sizeof(struct nlmsgerr))) { errno = EINVAL; if (dofail) exit(1); return -1; } if (hdr->nlmsg_type != NLMSG_ERROR) { errno = EINVAL; if (dofail) exit(1); return -1; } errno = -((struct nlmsgerr*)(hdr + 1))->error; return -errno; } static int netlink_send(struct nlmsg* nlmsg, int sock) { return netlink_send_ext(nlmsg, sock, 0, NULL, true); } static int netlink_query_family_id(struct nlmsg* nlmsg, int sock, const char* family_name, bool dofail) { struct genlmsghdr genlhdr; memset(&genlhdr, 0, sizeof(genlhdr)); genlhdr.cmd = CTRL_CMD_GETFAMILY; netlink_init(nlmsg, GENL_ID_CTRL, 0, &genlhdr, sizeof(genlhdr)); netlink_attr(nlmsg, CTRL_ATTR_FAMILY_NAME, family_name, strnlen(family_name, GENL_NAMSIZ - 1) + 1); int n = 0; int err = netlink_send_ext(nlmsg, sock, GENL_ID_CTRL, &n, dofail); if (err < 0) { return -1; } uint16_t id = 0; struct nlattr* attr = (struct nlattr*)(nlmsg->buf + NLMSG_HDRLEN + NLMSG_ALIGN(sizeof(genlhdr))); for (; (char*)attr < nlmsg->buf + n; attr = (struct nlattr*)((char*)attr + NLMSG_ALIGN(attr->nla_len))) { if (attr->nla_type == CTRL_ATTR_FAMILY_ID) { id = *(uint16_t*)(attr + 1); break; } } if (!id) { errno = EINVAL; return -1; } recv(sock, nlmsg->buf, sizeof(nlmsg->buf), 0); return id; } static 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, bool dofail) { 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_ext(nlmsg, sock, 0, NULL, dofail); 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, bool dofail) { 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_ext(nlmsg, sock, 0, NULL, dofail); if (err < 0) { } return err; } static int get_ifla_operstate(struct nlmsg* nlmsg, int ifindex, bool dofail) { 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, dofail); 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, bool dofail) { int ifindex = if_nametoindex(interface); while (true) { usleep(1000); int ret = get_ifla_operstate(nlmsg, ifindex, dofail); 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, bool dofail) { int ifindex = if_nametoindex(interface); if (ifindex == 0) { return -1; } int ret = nl80211_set_interface(nlmsg, sock, nl80211_family_id, ifindex, NL80211_IFTYPE_ADHOC, dofail); 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, dofail); 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) exit(1); 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) exit(1); 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); if (hwsim_family_id < 0 || nl80211_family_id < 0) exit(1); 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, true) < 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, true); if (ret < 0) exit(1); } close(sock); } static int runcmdline(char* cmdline) { int ret = system(cmdline); if (ret) { } return ret; } static int read_tun(char* data, int size) { if (tunfd < 0) return -1; int rv = read(tunfd, data, size); if (rv < 0) { if (errno == EAGAIN || errno == EBADF || errno == EBADFD) return -1; exit(1); } return rv; } static void flush_tun() { char data[1000]; while (read_tun(&data[0], sizeof(data)) != -1) { } } #define MAX_FDS 30 //% This code is derived from puff.{c,h}, found in the zlib development. The //% original files come with the following copyright notice: //% Copyright (C) 2002-2013 Mark Adler, all rights reserved //% version 2.3, 21 Jan 2013 //% This software is provided 'as-is', without any express or implied //% warranty. In no event will the author be held liable for any damages //% arising from the use of this software. //% Permission is granted to anyone to use this software for any purpose, //% including commercial applications, and to alter it and redistribute it //% freely, subject to the following restrictions: //% 1. The origin of this software must not be misrepresented; you must not //% claim that you wrote the original software. If you use this software //% in a product, an acknowledgment in the product documentation would be //% appreciated but is not required. //% 2. Altered source versions must be plainly marked as such, and must not be //% misrepresented as being the original software. //% 3. This notice may not be removed or altered from any source distribution. //% Mark Adler madler@alumni.caltech.edu //% BEGIN CODE DERIVED FROM puff.{c,h} #define MAXBITS 15 #define MAXLCODES 286 #define MAXDCODES 30 #define MAXCODES (MAXLCODES + MAXDCODES) #define FIXLCODES 288 struct puff_state { unsigned char* out; unsigned long outlen; unsigned long outcnt; const unsigned char* in; unsigned long inlen; unsigned long incnt; int bitbuf; int bitcnt; jmp_buf env; }; static int puff_bits(struct puff_state* s, int need) { long val = s->bitbuf; while (s->bitcnt < need) { if (s->incnt == s->inlen) longjmp(s->env, 1); val |= (long)(s->in[s->incnt++]) << s->bitcnt; s->bitcnt += 8; } s->bitbuf = (int)(val >> need); s->bitcnt -= need; return (int)(val & ((1L << need) - 1)); } static int puff_stored(struct puff_state* s) { s->bitbuf = 0; s->bitcnt = 0; if (s->incnt + 4 > s->inlen) return 2; unsigned len = s->in[s->incnt++]; len |= s->in[s->incnt++] << 8; if (s->in[s->incnt++] != (~len & 0xff) || s->in[s->incnt++] != ((~len >> 8) & 0xff)) return -2; if (s->incnt + len > s->inlen) return 2; if (s->outcnt + len > s->outlen) return 1; for (; len--; s->outcnt++, s->incnt++) { if (s->in[s->incnt]) s->out[s->outcnt] = s->in[s->incnt]; } return 0; } struct puff_huffman { short* count; short* symbol; }; static int puff_decode(struct puff_state* s, const struct puff_huffman* h) { int first = 0; int index = 0; int bitbuf = s->bitbuf; int left = s->bitcnt; int code = first = index = 0; int len = 1; short* next = h->count + 1; while (1) { while (left--) { code |= bitbuf & 1; bitbuf >>= 1; int count = *next++; if (code - count < first) { s->bitbuf = bitbuf; s->bitcnt = (s->bitcnt - len) & 7; return h->symbol[index + (code - first)]; } index += count; first += count; first <<= 1; code <<= 1; len++; } left = (MAXBITS + 1) - len; if (left == 0) break; if (s->incnt == s->inlen) longjmp(s->env, 1); bitbuf = s->in[s->incnt++]; if (left > 8) left = 8; } return -10; } static int puff_construct(struct puff_huffman* h, const short* length, int n) { int len; for (len = 0; len <= MAXBITS; len++) h->count[len] = 0; int symbol; for (symbol = 0; symbol < n; symbol++) (h->count[length[symbol]])++; if (h->count[0] == n) return 0; int left = 1; for (len = 1; len <= MAXBITS; len++) { left <<= 1; left -= h->count[len]; if (left < 0) return left; } short offs[MAXBITS + 1]; offs[1] = 0; for (len = 1; len < MAXBITS; len++) offs[len + 1] = offs[len] + h->count[len]; for (symbol = 0; symbol < n; symbol++) if (length[symbol] != 0) h->symbol[offs[length[symbol]]++] = symbol; return left; } static int puff_codes(struct puff_state* s, const struct puff_huffman* lencode, const struct puff_huffman* distcode) { static const short lens[29] = {3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258}; static const short lext[29] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0}; static const short dists[30] = { 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577}; static const short dext[30] = {0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13}; int symbol; do { symbol = puff_decode(s, lencode); if (symbol < 0) return symbol; if (symbol < 256) { if (s->outcnt == s->outlen) return 1; if (symbol) s->out[s->outcnt] = symbol; s->outcnt++; } else if (symbol > 256) { symbol -= 257; if (symbol >= 29) return -10; int len = lens[symbol] + puff_bits(s, lext[symbol]); symbol = puff_decode(s, distcode); if (symbol < 0) return symbol; unsigned dist = dists[symbol] + puff_bits(s, dext[symbol]); if (dist > s->outcnt) return -11; if (s->outcnt + len > s->outlen) return 1; while (len--) { if (dist <= s->outcnt && s->out[s->outcnt - dist]) s->out[s->outcnt] = s->out[s->outcnt - dist]; s->outcnt++; } } } while (symbol != 256); return 0; } static int puff_fixed(struct puff_state* s) { static int virgin = 1; static short lencnt[MAXBITS + 1], lensym[FIXLCODES]; static short distcnt[MAXBITS + 1], distsym[MAXDCODES]; static struct puff_huffman lencode, distcode; if (virgin) { lencode.count = lencnt; lencode.symbol = lensym; distcode.count = distcnt; distcode.symbol = distsym; short lengths[FIXLCODES]; int symbol; for (symbol = 0; symbol < 144; symbol++) lengths[symbol] = 8; for (; symbol < 256; symbol++) lengths[symbol] = 9; for (; symbol < 280; symbol++) lengths[symbol] = 7; for (; symbol < FIXLCODES; symbol++) lengths[symbol] = 8; puff_construct(&lencode, lengths, FIXLCODES); for (symbol = 0; symbol < MAXDCODES; symbol++) lengths[symbol] = 5; puff_construct(&distcode, lengths, MAXDCODES); virgin = 0; } return puff_codes(s, &lencode, &distcode); } static int puff_dynamic(struct puff_state* s) { static const short order[19] = {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; int nlen = puff_bits(s, 5) + 257; int ndist = puff_bits(s, 5) + 1; int ncode = puff_bits(s, 4) + 4; if (nlen > MAXLCODES || ndist > MAXDCODES) return -3; short lengths[MAXCODES]; int index; for (index = 0; index < ncode; index++) lengths[order[index]] = puff_bits(s, 3); for (; index < 19; index++) lengths[order[index]] = 0; short lencnt[MAXBITS + 1], lensym[MAXLCODES]; struct puff_huffman lencode = {lencnt, lensym}; int err = puff_construct(&lencode, lengths, 19); if (err != 0) return -4; index = 0; while (index < nlen + ndist) { int symbol; int len; symbol = puff_decode(s, &lencode); if (symbol < 0) return symbol; if (symbol < 16) lengths[index++] = symbol; else { len = 0; if (symbol == 16) { if (index == 0) return -5; len = lengths[index - 1]; symbol = 3 + puff_bits(s, 2); } else if (symbol == 17) symbol = 3 + puff_bits(s, 3); else symbol = 11 + puff_bits(s, 7); if (index + symbol > nlen + ndist) return -6; while (symbol--) lengths[index++] = len; } } if (lengths[256] == 0) return -9; err = puff_construct(&lencode, lengths, nlen); if (err && (err < 0 || nlen != lencode.count[0] + lencode.count[1])) return -7; short distcnt[MAXBITS + 1], distsym[MAXDCODES]; struct puff_huffman distcode = {distcnt, distsym}; err = puff_construct(&distcode, lengths + nlen, ndist); if (err && (err < 0 || ndist != distcode.count[0] + distcode.count[1])) return -8; return puff_codes(s, &lencode, &distcode); } static int puff(unsigned char* dest, unsigned long* destlen, const unsigned char* source, unsigned long sourcelen) { struct puff_state s = { .out = dest, .outlen = *destlen, .outcnt = 0, .in = source, .inlen = sourcelen, .incnt = 0, .bitbuf = 0, .bitcnt = 0, }; int err; if (setjmp(s.env) != 0) err = 2; else { int last; do { last = puff_bits(&s, 1); int type = puff_bits(&s, 2); err = type == 0 ? puff_stored(&s) : (type == 1 ? puff_fixed(&s) : (type == 2 ? puff_dynamic(&s) : -1)); if (err != 0) break; } while (!last); } *destlen = s.outcnt; return err; } //% END CODE DERIVED FROM puff.{c,h} #define ZLIB_HEADER_WIDTH 2 static int puff_zlib_to_file(const unsigned char* source, unsigned long sourcelen, int dest_fd) { if (sourcelen < ZLIB_HEADER_WIDTH) return 0; source += ZLIB_HEADER_WIDTH; sourcelen -= ZLIB_HEADER_WIDTH; const unsigned long max_destlen = 132 << 20; void* ret = mmap(0, max_destlen, PROT_WRITE | PROT_READ, MAP_PRIVATE | MAP_ANON, -1, 0); if (ret == MAP_FAILED) return -1; unsigned char* dest = (unsigned char*)ret; unsigned long destlen = max_destlen; int err = puff(dest, &destlen, source, sourcelen); if (err) { munmap(dest, max_destlen); errno = -err; return -1; } if (write(dest_fd, dest, destlen) != (ssize_t)destlen) { munmap(dest, max_destlen); return -1; } return munmap(dest, max_destlen); } static int setup_loop_device(unsigned char* data, unsigned long size, const char* loopname, int* loopfd_p) { int err = 0, loopfd = -1; int memfd = syscall(__NR_memfd_create, "syzkaller", 0); if (memfd == -1) { err = errno; goto error; } if (puff_zlib_to_file(data, size, memfd)) { err = errno; goto error_close_memfd; } loopfd = open(loopname, O_RDWR); if (loopfd == -1) { err = errno; goto error_close_memfd; } if (ioctl(loopfd, LOOP_SET_FD, memfd)) { if (errno != EBUSY) { err = errno; goto error_close_loop; } ioctl(loopfd, LOOP_CLR_FD, 0); usleep(1000); if (ioctl(loopfd, LOOP_SET_FD, memfd)) { err = errno; goto error_close_loop; } } close(memfd); *loopfd_p = loopfd; return 0; error_close_loop: close(loopfd); error_close_memfd: close(memfd); error: errno = err; return -1; } static void reset_loop_device(const char* loopname) { int loopfd = open(loopname, O_RDWR); if (loopfd == -1) { return; } if (ioctl(loopfd, LOOP_CLR_FD, 0)) { } close(loopfd); } static long syz_mount_image(volatile long fsarg, volatile long dir, volatile long flags, volatile long optsarg, volatile long change_dir, volatile unsigned long size, volatile long image) { unsigned char* data = (unsigned char*)image; int res = -1, err = 0, need_loop_device = !!size; char* mount_opts = (char*)optsarg; char* target = (char*)dir; char* fs = (char*)fsarg; char* source = NULL; char loopname[64]; if (need_loop_device) { int loopfd; memset(loopname, 0, sizeof(loopname)); snprintf(loopname, sizeof(loopname), "/dev/loop%llu", procid); if (setup_loop_device(data, size, loopname, &loopfd) == -1) return -1; close(loopfd); source = loopname; } mkdir(target, 0777); char opts[256]; memset(opts, 0, sizeof(opts)); if (strlen(mount_opts) > (sizeof(opts) - 32)) { } strncpy(opts, mount_opts, sizeof(opts) - 32); if (strcmp(fs, "iso9660") == 0) { flags |= MS_RDONLY; } else if (strncmp(fs, "ext", 3) == 0) { bool has_remount_ro = false; char* remount_ro_start = strstr(opts, "errors=remount-ro"); if (remount_ro_start != NULL) { char after = *(remount_ro_start + strlen("errors=remount-ro")); char before = remount_ro_start == opts ? '\0' : *(remount_ro_start - 1); has_remount_ro = ((before == '\0' || before == ',') && (after == '\0' || after == ',')); } if (strstr(opts, "errors=panic") || !has_remount_ro) strcat(opts, ",errors=continue"); } else if (strcmp(fs, "xfs") == 0) { strcat(opts, ",nouuid"); } res = mount(source, target, fs, flags, opts); if (res == -1) { err = errno; goto error_clear_loop; } res = open(target, O_RDONLY | O_DIRECTORY); if (res == -1) { err = errno; goto error_clear_loop; } if (change_dir) { res = chdir(target); if (res == -1) { err = errno; } } error_clear_loop: if (need_loop_device) reset_loop_device(loopname); errno = err; return res; } 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 (mkdir("./syz-tmp/pivot", 0777)) exit(1); if (syscall(SYS_pivot_root, "./syz-tmp", "./syz-tmp/pivot")) { if (chdir("./syz-tmp")) exit(1); } else { if (chdir("/")) exit(1); if (umount2("./pivot", MNT_DETACH)) exit(1); } if (chroot("./newroot")) exit(1); if (chdir("/")) exit(1); } static void setup_common() { if (mount(0, "/sys/fs/fuse/connections", "fusectl", 0, 0)) { } } static void setup_binderfs() { if (mkdir("/dev/binderfs", 0777)) { } if (mount("binder", "/dev/binderfs", "binder", 0, NULL)) { } } static void loop(); static void sandbox_common() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setsid(); struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = (200 << 20); setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 32 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 136 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); if (unshare(CLONE_NEWNS)) { } if (mount(NULL, "/", NULL, MS_REC | MS_PRIVATE, NULL)) { } if (unshare(CLONE_NEWIPC)) { } if (unshare(0x02000000)) { } if (unshare(CLONE_NEWUTS)) { } if (unshare(CLONE_SYSVSEM)) { } typedef struct { const char* name; const char* value; } sysctl_t; static const sysctl_t sysctls[] = { {"/proc/sys/kernel/shmmax", "16777216"}, {"/proc/sys/kernel/shmall", "536870912"}, {"/proc/sys/kernel/shmmni", "1024"}, {"/proc/sys/kernel/msgmax", "8192"}, {"/proc/sys/kernel/msgmni", "1024"}, {"/proc/sys/kernel/msgmnb", "1024"}, {"/proc/sys/kernel/sem", "1024 1048576 500 1024"}, }; unsigned i; for (i = 0; i < sizeof(sysctls) / sizeof(sysctls[0]); i++) write_file(sysctls[i].name, sysctls[i].value); } static int wait_for_loop(int pid) { if (pid < 0) exit(1); int status = 0; while (waitpid(-1, &status, __WALL) != pid) { } return WEXITSTATUS(status); } static void drop_caps(void) { struct __user_cap_header_struct cap_hdr = {}; struct __user_cap_data_struct cap_data[2] = {}; cap_hdr.version = _LINUX_CAPABILITY_VERSION_3; cap_hdr.pid = getpid(); if (syscall(SYS_capget, &cap_hdr, &cap_data)) exit(1); const int drop = (1 << CAP_SYS_PTRACE) | (1 << CAP_SYS_NICE); cap_data[0].effective &= ~drop; cap_data[0].permitted &= ~drop; cap_data[0].inheritable &= ~drop; if (syscall(SYS_capset, &cap_hdr, &cap_data)) exit(1); } static int do_sandbox_none(void) { if (unshare(CLONE_NEWPID)) { } int pid = fork(); if (pid != 0) return wait_for_loop(pid); setup_common(); sandbox_common(); drop_caps(); if (unshare(CLONE_NEWNET)) { } write_file("/proc/sys/net/ipv4/ping_group_range", "0 65535"); initialize_tun(); initialize_wifi_devices(); sandbox_common_mount_tmpfs(); setup_binderfs(); loop(); exit(1); } #define FS_IOC_SETFLAGS _IOW('f', 2, long) static void remove_dir(const char* dir) { int iter = 0; DIR* dp = 0; const int umount_flags = MNT_FORCE | UMOUNT_NOFOLLOW; retry: while (umount2(dir, umount_flags) == 0) { } dp = opendir(dir); if (dp == NULL) { if (errno == EMFILE) { exit(1); } exit(1); } struct dirent* ep = 0; while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); while (umount2(filename, umount_flags) == 0) { } struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } int i; for (i = 0;; i++) { if (unlink(filename) == 0) break; if (errno == EPERM) { int fd = open(filename, O_RDONLY); if (fd != -1) { long flags = 0; if (ioctl(fd, FS_IOC_SETFLAGS, &flags) == 0) { } close(fd); continue; } } if (errno == EROFS) { break; } if (errno != EBUSY || i > 100) exit(1); if (umount2(filename, umount_flags)) exit(1); } } closedir(dp); for (int i = 0;; i++) { if (rmdir(dir) == 0) break; if (i < 100) { if (errno == EPERM) { int fd = open(dir, O_RDONLY); if (fd != -1) { long flags = 0; if (ioctl(fd, FS_IOC_SETFLAGS, &flags) == 0) { } close(fd); continue; } } if (errno == EROFS) { break; } if (errno == EBUSY) { if (umount2(dir, umount_flags)) exit(1); continue; } if (errno == ENOTEMPTY) { if (iter < 100) { iter++; goto retry; } } } exit(1); } } static void kill_and_wait(int pid, int* status) { kill(-pid, SIGKILL); kill(pid, SIGKILL); for (int i = 0; i < 100; i++) { if (waitpid(-1, status, WNOHANG | __WALL) == pid) return; usleep(1000); } DIR* dir = opendir("/sys/fs/fuse/connections"); if (dir) { for (;;) { struct dirent* ent = readdir(dir); if (!ent) break; if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) continue; char abort[300]; snprintf(abort, sizeof(abort), "/sys/fs/fuse/connections/%s/abort", ent->d_name); int fd = open(abort, O_WRONLY); if (fd == -1) { continue; } if (write(fd, abort, 1) < 0) { } close(fd); } closedir(dir); } else { } while (waitpid(-1, status, __WALL) != pid) { } } static void reset_loop() { char buf[64]; snprintf(buf, sizeof(buf), "/dev/loop%llu", procid); int loopfd = open(buf, O_RDWR); if (loopfd != -1) { ioctl(loopfd, LOOP_CLR_FD, 0); close(loopfd); } } static void setup_test() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setpgrp(); write_file("/proc/self/oom_score_adj", "1000"); flush_tun(); if (symlink("/dev/binderfs", "./binderfs")) { } } static void close_fds() { for (int fd = 3; fd < MAX_FDS; fd++) close(fd); } static const char* setup_usb() { if (chmod("/dev/raw-gadget", 0666)) return "failed to chmod /dev/raw-gadget"; return NULL; } #define NL802154_CMD_SET_SHORT_ADDR 11 #define NL802154_ATTR_IFINDEX 3 #define NL802154_ATTR_SHORT_ADDR 10 static const char* setup_802154() { const char* error = NULL; int sock_generic = -1; int sock_route = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); if (sock_route == -1) { error = "socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE) failed"; goto fail; } sock_generic = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC); if (sock_generic == -1) { error = "socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC) failed"; goto fail; } { int nl802154_family_id = netlink_query_family_id(&nlmsg, sock_generic, "nl802154", true); if (nl802154_family_id < 0) { error = "netlink_query_family_id failed"; goto fail; } 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)); if (netlink_send(&nlmsg, sock_generic) < 0) { error = "NL802154_CMD_SET_SHORT_ADDR failed"; goto fail; } 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)); if (netlink_send(&nlmsg, sock_route) < 0) { error = "netlink: adding device lowpan0 type lowpan link wpan0"; goto fail; } } } } fail: close(sock_route); close(sock_generic); return error; } #define SWAP_FILE "./swap-file" #define SWAP_FILE_SIZE (128 * 1000 * 1000) static const char* setup_swap() { swapoff(SWAP_FILE); unlink(SWAP_FILE); int fd = open(SWAP_FILE, O_CREAT | O_WRONLY | O_CLOEXEC, 0600); if (fd == -1) return "swap file open failed"; fallocate(fd, FALLOC_FL_ZERO_RANGE, 0, SWAP_FILE_SIZE); close(fd); char cmdline[64]; sprintf(cmdline, "mkswap %s", SWAP_FILE); if (runcmdline(cmdline)) return "mkswap failed"; if (swapon(SWAP_FILE, SWAP_FLAG_PREFER) == 1) return "swapon failed"; return NULL; } static void execute_one(void); #define WAIT_FLAGS __WALL static void loop(void) { int iter = 0; for (;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); reset_loop(); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); setup_test(); execute_one(); close_fds(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { sleep_ms(10); if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; if (current_time_ms() - start < 5000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; void execute_one(void) { intptr_t res = 0; if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } NONFAILING(memcpy((void*)0x20000440, "ext4\000", 5)); NONFAILING(memcpy((void*)0x200000c0, "./file0\000", 8)); NONFAILING(memcpy((void*)0x20000100, "max_batch_time", 14)); NONFAILING(*(uint8_t*)0x2000010e = 0x3d); NONFAILING(sprintf((char*)0x2000010f, "0x%016llx", (long long)0x8001)); NONFAILING(*(uint8_t*)0x20000121 = 0x2c); NONFAILING(memcpy((void*)0x20000122, "errors=continue", 15)); NONFAILING(*(uint8_t*)0x20000131 = 0x2c); NONFAILING(memcpy((void*)0x20000132, "errors=remount-ro", 17)); NONFAILING(*(uint8_t*)0x20000143 = 0x2c); NONFAILING(memcpy((void*)0x20000144, "minixdf", 7)); NONFAILING(*(uint8_t*)0x2000014b = 0x2c); NONFAILING(memcpy((void*)0x2000014c, "jqfmt=vfsv0", 11)); NONFAILING(*(uint8_t*)0x20000157 = 0x2c); NONFAILING(memcpy((void*)0x20000158, "usrjquota=", 10)); NONFAILING(*(uint8_t*)0x20000162 = 0x2e); NONFAILING(memcpy((void*)0x20000163, "smackfsfloor", 12)); NONFAILING(*(uint8_t*)0x2000016f = 0x3d); NONFAILING(memcpy((void*)0x20000170, "ext4\000", 5)); NONFAILING(*(uint8_t*)0x20000175 = 0x2c); NONFAILING(memcpy((void*)0x20000176, "fsname", 6)); NONFAILING(*(uint8_t*)0x2000017c = 0x3d); NONFAILING(memcpy((void*)0x2000017d, "minixdf", 7)); NONFAILING(*(uint8_t*)0x20000184 = 0x2c); NONFAILING(*(uint8_t*)0x20000185 = 0x2c); NONFAILING(memcpy( (void*)0x20000480, "\x78\x9c\xec\xdb\x4b\x6f\x1b\x55\x1b\x00\xe0\x77\xc6\x49\xef\xfd\x92\xaf" "\x94\x4b\x2f\x40\xa0\x20\x22\x2e\x49\x93\x16\xe8\x82\x0d\x08\xa4\x6e\x90" "\x90\x60\x51\x96\x21\x49\xab\xd2\xb4\x41\x4d\x90\x68\x55\xd1\x80\x50\x59" "\xa2\xfe\x02\x60\x89\xc4\x2f\x60\x05\x1b\x04\xac\x40\x6c\x61\x8f\x90\x2a" "\xd4\x0d\x85\x05\x1a\x34\xf6\x4c\xeb\x26\x76\x88\x2f\xa9\x93\xfa\x79\x24" "\xb7\xe7\x78\x8e\x7d\xde\xd7\x33\x27\x3e\x33\x67\x1c\x40\xdf\x1a\xc9\xff" "\x49\x22\x76\x45\xc4\x2f\x11\x31\x54\xab\xde\xde\x60\xa4\xf6\xdf\x8d\xeb" "\x97\xa6\xff\xba\x7e\x69\x3a\x89\x2c\x7b\xfd\x8f\xa4\xda\xee\xcf\xeb\x97" "\xa6\xcb\xa6\xe5\xeb\x76\x16\x95\xd1\x34\x22\xfd\x28\x89\x03\x0d\xfa\x5d" "\xb8\x70\xf1\xcc\xd4\xdc\xdc\xec\xf9\xa2\x3e\xbe\x78\xf6\x9d\xf1\x85\x0b" "\x17\x9f\x39\x7d\x76\xea\xd4\xec\xa9\xd9\x73\x93\xc7\x8e\x1d\x3d\x32\xf1" "\xfc\x73\x93\xcf\x76\x25\xcf\xdd\x79\xac\xfb\xdf\x9f\x3f\xb8\xef\xf8\x9b" "\x57\x5f\x9d\x3e\x71\xf5\xad\xef\xbf\xcc\xe3\xdd\x55\x6c\xaf\xcf\xa3\x66" "\xb8\xe3\x3e\x47\x62\xe4\xf6\xcf\xb2\xce\xe3\x1d\xbf\xfb\xc6\xb2\xbb\xae" "\x9c\x0c\xf4\x30\x10\x5a\x52\x89\x88\x7c\x77\x0d\x56\xc7\xff\x50\x54\xe2" "\xd6\xce\x1b\x8a\x57\x3e\xec\x69\x70\xc0\xba\xca\xb2\x2c\xdb\xba\xe2\xd9" "\x4a\x59\x58\xca\x80\xbb\x58\x12\xbd\x8e\x00\xe8\x8d\xf2\x8b\x3e\x3f\xff" "\x2d\x1f\x77\x70\xfa\xd1\x73\xd7\x5e\xac\x9d\x00\xe5\x79\xdf\x28\x1e\xb5" "\x2d\x03\x91\x16\x6d\x06\x97\x9d\xdf\x76\xd3\x48\x44\x9c\x58\xfa\xfb\xd3" "\xfc\x11\x0d\xaf\x43\x00\x00\x74\xd7\xd7\xf9\xfc\xe7\xe9\x46\xf3\xbf\x34" "\xee\xab\x6b\xf7\xbf\x62\x6d\x68\x38\x22\xfe\x1f\x11\x7b\x22\xe2\x9e\x88" "\xd8\x1b\x11\xf7\x46\x54\xdb\xde\x1f\x11\x0f\xb4\xd8\xff\xc8\xb2\xfa\xca" "\xf9\xcf\x4f\xdb\xdb\x4a\x6c\x8d\xf2\xf9\xdf\x0b\xc5\xda\xd6\xed\xf3\xbf" "\x72\xf6\x17\xc3\x95\xa2\xb6\xbb\x9a\xff\x60\x72\xf2\xf4\xdc\xec\xe1\xe2" "\x33\x19\x8d\xc1\xad\x79\x7d\x62\x95\x3e\xbe\x79\xf9\xe7\x4f\x9a\x6d\xab" "\x9f\xff\xe5\x8f\xbc\xff\x72\x2e\x58\xc4\xf1\xfb\xc0\xb2\x0b\x74\x33\x53" "\x8b\x53\x9d\xe4\x5c\xef\xda\x07\x11\xfb\x07\x1a\xe5\x9f\xdc\x5c\x09\x48" "\x22\x62\x5f\x44\xec\x6f\xe3\xfd\xb7\x45\xc4\xe9\x27\xbf\x38\xd8\x6c\xfb" "\x7f\xe7\xbf\x8a\x2e\xac\x33\x65\x9f\x47\x3c\x51\xdb\xff\x4b\xb1\x2c\xff" "\x52\xb2\xfa\xfa\xe4\xf8\xb6\x98\x9b\x3d\x3c\x5e\x1e\x15\x2b\xfd\xf0\xe3" "\x95\xd7\x9a\xf5\xdf\x51\xfe\x5d\x90\xef\xff\x1d\x0d\x8f\xff\x9b\xf9\x0f" "\x27\xf5\xeb\xb5\x0b\xad\xf7\x71\xe5\xd7\x8f\x9b\x9e\xd3\xb4\x7b\xfc\x6f" "\x49\xde\xa8\x96\xb7\x14\xcf\xbd\x37\xb5\xb8\x78\x7e\x22\x62\x4b\xb2\xb4" "\xf2\xf9\xc9\x5b\xaf\x2d\xeb\x65\xfb\x3c\xff\xd1\x43\x8d\xc7\xff\x9e\x88" "\x7f\x3e\x2b\x5e\x77\x20\x22\xf2\x83\xf8\xc1\x88\x78\x28\x22\x1e\x2e\x62" "\x7f\x24\x22\x1e\x8d\x88\x43\xab\xe4\xff\xdd\x4b\x8f\xbd\xdd\x7e\xfe\xeb" "\x2b\xcf\x7f\xa6\xa5\xfd\xdf\x7a\xa1\x72\xe6\xdb\xaf\x9a\xf5\xbf\xb6\xfd" "\x7f\xb4\x5a\x1a\x2d\x9e\x99\x99\xca\xb2\xec\xf2\xea\x79\xad\x35\xc0\xce" "\x3e\x3d\x00\x00\x00\xd8\x1c\xd2\xea\x3d\xf0\x49\x3a\x76\xb3\x9c\xa6\x63" "\x63\xb5\x7b\xf8\xf7\xc6\x8e\x74\x6e\x7e\x61\xf1\xa9\x93\xf3\xef\x9e\x9b" "\xa9\xdd\x2b\x3f\x1c\x83\x69\x79\xa5\x6b\xa8\xee\x7a\xe8\x44\x71\x6d\xb8" "\xac\x4f\x2e\xab\x1f\xa9\x5e\x37\xce\xb2\x2c\xdb\x5e\xad\x8f\x4d\xcf\xcf" "\xad\xd7\x9a\x3a\xb0\x36\x3b\x9b\x8c\xff\xdc\x6f\x95\x5e\x47\x07\xac\xbb" "\x96\xd6\xd1\x9a\xfd\xa2\x0d\xd8\x94\xfc\x5e\x13\xfa\x97\xf1\x0f\xfd\xcb" "\xf8\x87\xfe\x65\xfc\x43\xff\x6a\x34\xfe\x2f\x47\xdc\xe8\x41\x28\xc0\x1d" "\xe6\xfb\x1f\xfa\x97\xf1\x0f\xfd\xcb\xf8\x87\xfe\xd5\xfe\xf8\x77\x33\x10" "\x6c\x62\x9d\xfc\xae\x7f\xb5\xc2\x9e\xe3\xeb\xf5\xce\x77\x5b\xa1\xb2\x31" "\xc2\x68\xb9\x10\xe9\x86\x08\xa3\xbd\x42\xba\x31\xc2\xa8\x15\xb6\x46\xc4" "\x5a\x1b\x5f\x8e\x3b\x15\x58\xaf\xff\x32\x01\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x74\xc7\xbf\x01\x00\x00\xff\xff\x1f\x4a\xeb\x81", 1114)); res = -1; NONFAILING(res = syz_mount_image(/*fs=*/0x20000440, /*dir=*/0x200000c0, /*flags=MS_NOATIME*/ 0x400, /*opts=*/0x20000100, /*chdir=*/0x84, /*size=*/0x45a, /*img=*/0x20000480)); if (res != -1) r[0] = res; NONFAILING(memcpy((void*)0x20000000, "./file0\000", 8)); syscall(__NR_chdir, /*dir=*/0x20000000ul); NONFAILING(memcpy((void*)0x20000040, "./bus\000", 6)); res = syscall(__NR_creat, /*file=*/0x20000040ul, /*mode=*/0ul); if (res != -1) r[1] = res; NONFAILING(memcpy((void*)0x20000380, "/dev/loop", 9)); NONFAILING(*(uint8_t*)0x20000389 = 0x30); NONFAILING(*(uint8_t*)0x2000038a = 0); NONFAILING(memcpy((void*)0x20000140, "./bus\000", 6)); syscall(__NR_mount, /*src=*/0x20000380ul, /*dst=*/0x20000140ul, /*type=*/0ul, /*flags=MS_BIND*/ 0x1000ul, /*data=*/0ul); NONFAILING(memcpy((void*)0x20000080, "./bus\000", 6)); res = syscall(__NR_open, /*file=*/0x20000080ul, /*flags=O_SYNC|O_NOCTTY|O_DIRECT|O_CLOEXEC|O_RDWR*/ 0x185102ul, /*mode=*/0ul); if (res != -1) r[2] = res; syscall(__NR_mmap, /*addr=*/0x20000000ul, /*len=*/0x800000ul, /*prot=PROT_WRITE*/ 2ul, /*flags=MAP_STACK|MAP_POPULATE|MAP_FIXED|MAP_SHARED*/ 0x28011ul, /*fd=*/r[2], /*offset=*/0ul); NONFAILING(memcpy((void*)0x20000040, "cpuacct.usage_percpu_user\000", 26)); syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x20000040ul, /*flags=*/0x275aul, /*mode=*/0ul); NONFAILING(memcpy((void*)0x20000100, "squashfs\000", 9)); NONFAILING(memcpy((void*)0x20000240, "./file0\000", 8)); NONFAILING(*(uint16_t*)0x20001b40 = -1); NONFAILING(memcpy( (void*)0x20001b42, "\x22\x6a\x93\x26\xe4\xab\xc9\xc6\x23\x90\x58\xf8\x12\xfa\x6a\x97\xff\x15" "\x0e\xa1\x10\x42\x5f\xde\xb3\x4c\xf0\x74\x58\x82\xd8\x1e\x27\x08\xc7\x92" "\x19\x1d\xd7\x27\x6d\xad\xac\x68\x16\x7c\xe2\x66\xfd\x56\xf0\xb4\x60\x0b" "\x67\x10\xb5\x7e\xe6\xbf\x18\x9c\x87\x55\x78\x83\xc8\x56\x22\x11\x3e\xe3" "\x95\x33\x1c\x25\x0f\x45\x91\x5f\x70\x7b\xb3\xc9\xbc\x03\xfe\xb6\xe2\x7e" "\xbc\xe4\xaf\x77\xda\xd1\xbf\x2f\xc9\x6d\x16\xa9\x1f\xa0\x95\x63\x00\xdc" "\xec\xe9\x2d\xf6\xd6\xa6\xf3\xaf\xce\xe5\x4e\x53\xba\x26\x37\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 139)); NONFAILING(memcpy( (void*)0x20001bcd, "\xcf\xc1\x72\xe9\xb9\x64\x90\xe8\xba\xa7\x57\x03\x1f\xd3\x11\x3d\x8f\xd2" "\x31\xae\xca\xb2\xc4\x55\x59\x1d\x3b\xec\x0b\x6d\x42\xa1\xd9\x57\x2d\xc5" "\x07\x8c\x0d\xe5\xa6\x8d\xc2\x52\xae\xb4\x57\xf3\x45\xaa\xef\x17\x44\xf7" "\x17\xc7\x17\x38\x08\x6a\x77\xf8\x19\xbf\x8e\xc2\x16\x4a\xd9\xd2\x25\x99" "\x68\x68\xd5\x44\x0c\x2a\x1f\x17\x59\x38\x6c\x92\x02\x14\xf5\xb0\x7f\xde" "\xaa\x34\xd7\xcb\xb8\x95\xee\x45\x10\x8d\x87\x15\xe8\x67\x8c\x94\x65\xc8" "\xb7\x6f\x3f\x4f\x2a\x15\x37\xde\x01\x26\x4b\x0f\x6c\x5a\x50\x83\xf4\x9b" "\x67\x37\xa2\x57\x58\x55\x3b\x72\x78\x8c\x48\xc1\x29\xab\x89\xff\x00\x0e" "\x7d\x0b\x1d\xa4\x39\xdc\x5e\x7e\x6c\xfa\xd1\x50\xa6\x64\xab\x7d\x70\xdd" "\x12\x7f\x47\x30\x15\x97\x6f\x8f\x2a\x36\x03\xf4\x5a\x04\x2d\x8c\x35\x78" "\xe6\xeb\x30\x60\xb9\x86\xee\x9e\x6b\x4d\xbf\x79\x89\x6d\x28\x30\x1c\x5d" "\x9e\xa3\x4a\xfe\x12\x29\x34\x55\xd9\xc7\xc3\x30\xa3\xeb\x7d\x44\xe5\xcd" "\x17\x03\xd9\x28\x9c\x0d\xf5\xcb\xc9\xd1\x23\x99\x54\x86\xbd\x79\x7c\xed" "\xbd\xbd\x8c\x31\x11\xfe\x36\x6c\xbe\x2b\x2c\xc2\x80\x8c\xc9\x9f\xea\x71" "\x8c\xd2\x35\x0f\xc1\xfe\xe7\xa8\xa0\x68\xd5\x33\xe5\xe0\x94\x35\x06\xd0" "\xa4\x4a\x5f\x4e\x58\x9c\x23\x35\x16\xfe\xd5\x4f\xdb\x7a\xb4\xa1\xbf\x21" "\x4b\x05\x16\x5d\x70\x6d\x00\xab\x50\x38\xdb\xfb\xc2\xd7\x48\x2a\x2f\x44" "\x58\x8a\x25\xe4\xf6\x5c\x1c\x3c\x5b\xcc\x84\x06\xff\xf8\xe8\x0a\x15\xd4" "\x41\x90\x4f\x85\xae\x3b\x02\x4c\xea\x9b\x3e\x4a\x02\xa4\x3b\x67\x7f\x59" "\x01\xe1\x42\xa2\x8f\x1e\x97\xdf\x21\x01\x75\xea\x77\x8f\x3f\xba\x41\x74" "\x66\x28\x16\x30\x98\x6a\xff\xf8\x55\x6b\x6f\x82\x21\xff\xaf\x9c\x53\x2e" "\x2e\xef\x12\x99\x3e\x9f\xf2\x6a\xeb\x36\x8a\xdb\x39\x51\xc1\xf6\x11\xbf" "\x82\x70\x9c\xf6\xea\x32\x94\xc0\xeb\xf0\xb2\x5f\xdc\x88\xa4\xeb\x56\x59" "\x13\x0e\x7d\x7a\x6d\x15\xf6\xa2\x8a\xe2\xfd\x62\xd6\xa1\x3a\x4b\x5d\x4a" "\x6b\x6a\x48\x4d\xc7\x85\xae\x0a\x27\xc8\xc4\xe9\x80\xca\x4c\x4f\xab\x79" "\x36\xee\xee\x98\x5d\xe8\x02\x69\x8f\x3e\x54\x92\x77\xc7\xdf\xaf\xe9\x2b" "\xca\x27\x45\x5e\x82\xfb\xdd\x9d\x9e\x13\x2e\x4c\x13\x16\x10\xb5\x8f\xd7" "\xc9\x00\xe1\x5e\x34\x7d\xa6\x4d\x17\x06\xb0\x58\x9e\x2e\x2f\xd1\xcc\x93" "\x93\x23\x77\xcb\x57\x68\xb8\x00\xe2\xfd\x6e\x60\xbf\x32\x09\xb5\x5f\x7c" "\x4b\x42\xf6\x77\x57\x96\xbf\x5c\x30\x3a\x2d\xb1\x86\x5e\x06\xcf\x04\x7c" "\x04\x91\x84\x2e\x37\x1a\xf7\x03\x6c\xa2\xcd\x5d\x37\x75\xce\xbf\x75\x28" "\x52\xa7\x26\x67\x01\x6b\xb9\x03\xba\xfa\x11\x4f\xf2\x7d\x0b\x0d\x6a\x34" "\x89\x85\xeb\x27\x14\x23\x8b\x66\x33\xb4\x06\xcc\x7a\xec\x62\xc5\x1a\x9a" "\xfb\xef\x99\x7e\xf0\xaf\x5b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\xda\xde\x9f\xe7\xc4\xa2\x9d\x8b\x5d\xdc\xa5\xd8\x78\xeb" "\xd9\xda\x8f\x15\x32\x18\x0f\x1c\x0f\x53\x28\x00\xa0\x4a\x27\x28\xe7\x56" "\x0a\x87\xbf\x2d\x98\x79\x52\x73\x38\xa0\x6a\x49\x8a\xa6\xaf\x1b\xb8\x00" "\x94\xaf\x77\x4a\x59\xf7\xd9\xc9\xcd\x09\x00\x9e\x2a\x46\x41\xbf\xc9\xe9" "\xa6\xf1\xba\xe3\x7f\xe6\x35\xce\x4d\xc1\x25\x89\x64\xdf\xc4\x63\xcc\xab" "\x61\x88\x5b\x47\x42\x1b\x2e\xc2\x38\x9c\xd3\x4c\x4a\x23\x57\x62\xa9\xdd" "\x79\x14\xbe\xac\xa6\xa9\x91\xe2\x6c\x93\x6d\x63\x5b\xf0\x5f\x1d\x2b\x08" "\xc9\xaa\x6b\x13\xee\x94\xd1\xb9\xde\x38\x84\xb9\x7b\x5f\x3f\x82\x70\x00" "\xaa\xc6\x99", 759)); NONFAILING(*(uint32_t*)0x20001ec4 = -1); NONFAILING( memcpy((void*)0x20001ec8, "\xe0\xf1\xdb\x14\x22\x8f\x72\xe8\xd9\xaf\xb4\x5d\x40\xe6\xed\xa2" "\xf0\xda\x16\x09\x19\x5d\x6a\x31\x31\x2a\xa3\x09\x2f\x64\xa4\xbb" "\x28\x69\x43\xab\xe0\xbf\x65\x32\xd3\xf6\x93\x24\x7e\x42\xdc\xe5", 48)); NONFAILING(*(uint8_t*)0x20001ef8 = 0); NONFAILING(*(uint16_t*)0x20001ef9 = -1); NONFAILING(*(uint8_t*)0x20001efb = r[1]); NONFAILING(*(uint64_t*)0x20001efc = -1); NONFAILING(*(uint32_t*)0x20001f04 = -1); NONFAILING(*(uint16_t*)0x20001f08 = -1); NONFAILING(*(uint8_t*)0x20001f0a = -1); NONFAILING(sprintf((char*)0x20001f0b, "%020llu", (long long)0)); NONFAILING(*(uint64_t*)0x20001f1f = r[1]); NONFAILING(memcpy( (void*)0x20001f27, "\x14\xce\x6c\xfc\x4b\xc2\xb9\xdd\x00\x29\x2d\xb7\xe4\xa0\x59\x47\xa7\x02" "\x3d\x36\x77\x1c\xf7\x80\x81\xcd\xec\x8d\x45\x0a\x57\xe2\x6f\x39\x2b\xe4" "\xba\x56\x57\x42\x1b\xe6\x1d\x36\x7e\x61\xcc\xc0\xa7\xb4\x35\x89\x24\x7a" "\xe0\xd3\x8b\xaf\x4e\xad\xfb\x2b\x49\xdb\x36\xc0\x9a\xae\x29\x0a\xbd\x5f" "\xed\xeb\x33\xe8\xab\xcb\xba\xb1\x53\xc1\x45\x0f\xea\xd9\x22\xd9\x03\xec" "\x4a\x19\x0e\x1b\x13\xda\x8e\xbf\x72\x6b\x99\x25\x3b\x58\xc3\x61\xe4\xa4" "\x77\x2f\x26\x8c\x11\x82\xa0\xf5\x6f\x1c\xf6\x44\xb9\xdc\xe2\xd9\x61\xa0" "\x4b\xeb\xa5\x75\xc4\xbc\x03\x9b\x72\x94\xb3\xd7\x5a\xe9\x3c\x35\x9d\x84" "\x23\x68\x23\x92\x80\x01\xd0\x01\xb8\xf6\x97\x09\x85\x4e\x73\xa7\x05\x45" "\x95\x43\x7d", 165)); NONFAILING(sprintf((char*)0x20001fcc, "0x%016llx", (long long)r[0])); NONFAILING(memcpy( (void*)0x20000440, "\x78\x9c\xec\x55\xbf\xee\x12\x41\x10\xfe\xe6\x6e\xe1\x40\x2d\xa8\x6d\x25" "\x42\xa3\xc0\xd9\xf8\x06\xf2\x00\x3e\x80\x04\x4e\x24\x1e\xfe\xe1\x2e\x51" "\x08\xc5\x69\x43\x63\x61\x7c\x09\x12\x9f\xc2\xc2\x44\x7b\x0b\x63\x4c\x6c" "\xb0\xd0\x44\x0b\x2c\x49\x0c\x66\x77\xe7\xd6\x25\x6a\xc0\xe4\xc8\xef\xf7" "\x4b\xf6\x4b\xc8\x7c\xf3\xcd\xce\xec\x0e\x97\x9d\xbd\x93\x3c\x4c\x02\x00" "\x3f\xd7\xf3\x3e\x6a\x50\x20\x5c\xc0\x47\x22\x08\x00\x0d\xd2\xda\xa6\xac" "\xed\x0f\xb6\x5b\xc6\x17\xa1\xfd\x0e\xeb\x2f\xd9\x7e\x66\x9b\x4c\x67\xef" "\x9e\x69\x3a\xbb\xdb\x8b\xe3\x68\x92\x4c\xf7\x10\x22\x60\xdf\x9a\x1d\x72" "\xd0\xa2\xc3\xc9\xdb\xa7\xbb\x0a\xa1\xa8\xca\x45\x93\xd4\xd7\xff\xec\x9f" "\xa1\xe7\x3b\x4a\xf0\xb7\x35\x9c\x8b\x13\xef\xa2\x38\xe2\xff\xb3\x9d\xaf" "\x45\xef\x55\xc2\xb1\xdb\x01\x8c\x42\x07\x64\x7d\x78\xa1\x3f\xe7\x69\xf9" "\x16\x47\x22\xde\x7f\x65\x25\xe0\xf1\x95\xdc\x78\xe2\xe1\xbb\x72\xde\xaf" "\xe7\x7d\x49\x6e\xf1\x14\x93\xda\x40\xff\xf2\x2b\xa1\xd6\x48\xe7\xb5\xb5" "\xe6\xa2\x00\x32\x80\x7c\x6c\x4d\x1d\xa1\xa6\x25\xd0\x00\xd0\x4a\xc7\x0f" "\x5a\xc9\x74\x76\x65\x34\xee\x0d\xa3\x61\x74\x2f\x0c\x91\xb5\xdf\x9c\xe7" "\x2b\x1a\xb5\x5b\xb7\x47\x71\xd4\x26\xeb\x18\x9e\x24\x02\x06\xf2\x9e\x56" "\xad\x78\x09\xc0\xa7\xdf\xf1\x0c\x16\xc8\x3a\x9a\xc4\x39\x80\xec\x5c\x39" "\x7f\xf3\xe1\xdc\xbc\x64\x25\x56\x01\xcf\xca\xb5\x6b\xe8\xba\xaf\x4c\x8d" "\x80\x35\xf9\x57\xdc\xc4\x65\x54\x00\x3c\xca\x64\x38\x64\xb5\x0e\x59\x4d" "\x40\xb5\xd6\x05\xc1\x67\xa7\x23\xac\x73\x02\x1b\x78\xa8\xa8\xc0\xd5\xfe" "\xfd\x78\xb0\x00\x81\xf2\xb4\x25\x84\xa9\xd1\x59\xa1\x24\x1d\xca\x80\x28" "\x64\x47\x45\xae\x5d\x37\xed\x2f\xd8\xd6\xd9\x76\xd9\x2e\xd9\xae\xd8\xe6" "\x6f\x57\xfe\x26\x09\x55\xe1\x1b\x7b\xcd\x0c\x28\xe3\x71\x2f\x4d\x27\xea" "\xf1\xd2\xcc\x68\xa1\xd1\xc2\x9a\xd9\xd9\xe3\x5d\xf3\xd7\x90\xf2\x93\x04" "\x70\x70\x70\x70\x70\x70\x70\x70\x38\x23\xf8\x15\x00\x00\xff\xff\xb0\x75" "\x54\x83", 452)); NONFAILING(syz_mount_image(/*fs=*/0x20000100, /*dir=*/0x20000240, /*flags=MS_SILENT*/ 0x8000, /*opts=*/0x20001b40, /*chdir=*/0, /*size=*/0x1c4, /*img=*/0x20000440)); NONFAILING(memcpy((void*)0x200001c0, ".\000", 2)); res = syscall(__NR_open, /*file=*/0x200001c0ul, /*flags=*/0ul, /*mode=*/0ul); if (res != -1) r[3] = res; NONFAILING( memcpy((void*)0x200003c0, "\023\023w\305\3745\324\024T\325\324\035)\255\032`)" "Y\201F\346\276\026nA\255\r\275@T\003<\2373\273\332\202$" "\242\363\327r\347cnH\263<\277p\203r\350\361\271\223>" "\305\022wC\276\"\006 \236\360-\371\313\362\366\350\200\3238/\000", 78)); syscall(__NR_mkdirat, /*fd=*/r[3], /*path=*/0x200003c0ul, /*mode=*/0ul); } int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x20000000ul, /*len=*/0x1000000ul, /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/ 7ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x21000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1, /*offset=*/0ul); const char* reason; (void)reason; if ((reason = setup_usb())) printf("the reproducer may not work as expected: USB injection setup " "failed: %s\n", reason); if ((reason = setup_802154())) printf("the reproducer may not work as expected: 802154 injection setup " "failed: %s\n", reason); if ((reason = setup_swap())) printf("the reproducer may not work as expected: swap setup failed: %s\n", reason); install_segv_handler(); use_temporary_dir(); do_sandbox_none(); return 0; }