// https://syzkaller.appspot.com/bug?id=cbf5fe846f14a90f05e10df200b08c57941dc750 // 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 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; } #define BITMASK(bf_off, bf_len) (((1ull << (bf_len)) - 1) << (bf_off)) #define STORE_BY_BITMASK(type, htobe, addr, val, bf_off, bf_len) \ *(type*)(addr) = \ htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | \ (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len)))) 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 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; } #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; } #define MAX_FDS 30 static void setup_common() { if (mount(0, "/sys/fs/fuse/connections", "fusectl", 0, 0)) { } } static void loop(); static void sandbox_common() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setsid(); struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = (200 << 20); setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 32 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 136 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 0; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); if (unshare(CLONE_NEWNS)) { } if (mount(NULL, "/", NULL, MS_REC | MS_PRIVATE, NULL)) { } if (unshare(CLONE_NEWIPC)) { } if (unshare(0x02000000)) { } if (unshare(CLONE_NEWUTS)) { } if (unshare(CLONE_SYSVSEM)) { } typedef struct { const char* name; const char* value; } sysctl_t; static const sysctl_t sysctls[] = { {"/proc/sys/kernel/shmmax", "16777216"}, {"/proc/sys/kernel/shmall", "536870912"}, {"/proc/sys/kernel/shmmni", "1024"}, {"/proc/sys/kernel/msgmax", "8192"}, {"/proc/sys/kernel/msgmni", "1024"}, {"/proc/sys/kernel/msgmnb", "1024"}, {"/proc/sys/kernel/sem", "1024 1048576 500 1024"}, }; unsigned i; for (i = 0; i < sizeof(sysctls) / sizeof(sysctls[0]); i++) write_file(sysctls[i].name, sysctls[i].value); } static int wait_for_loop(int pid) { if (pid < 0) exit(1); int status = 0; while (waitpid(-1, &status, __WALL) != pid) { } return WEXITSTATUS(status); } static void drop_caps(void) { struct __user_cap_header_struct cap_hdr = {}; struct __user_cap_data_struct cap_data[2] = {}; cap_hdr.version = _LINUX_CAPABILITY_VERSION_3; cap_hdr.pid = getpid(); if (syscall(SYS_capget, &cap_hdr, &cap_data)) exit(1); const int drop = (1 << CAP_SYS_PTRACE) | (1 << CAP_SYS_NICE); cap_data[0].effective &= ~drop; cap_data[0].permitted &= ~drop; cap_data[0].inheritable &= ~drop; if (syscall(SYS_capset, &cap_hdr, &cap_data)) exit(1); } static int do_sandbox_none(void) { if (unshare(CLONE_NEWPID)) { } int pid = fork(); if (pid != 0) return wait_for_loop(pid); setup_common(); sandbox_common(); drop_caps(); if (unshare(CLONE_NEWNET)) { } loop(); exit(1); } static void kill_and_wait(int pid, int* status) { kill(-pid, SIGKILL); kill(pid, SIGKILL); for (int i = 0; i < 100; i++) { if (waitpid(-1, status, WNOHANG | __WALL) == pid) return; usleep(1000); } DIR* dir = opendir("/sys/fs/fuse/connections"); if (dir) { for (;;) { struct dirent* ent = readdir(dir); if (!ent) break; if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) continue; char abort[300]; snprintf(abort, sizeof(abort), "/sys/fs/fuse/connections/%s/abort", ent->d_name); int fd = open(abort, O_WRONLY); if (fd == -1) { continue; } if (write(fd, abort, 1) < 0) { } close(fd); } closedir(dir); } else { } while (waitpid(-1, status, __WALL) != pid) { } } static void setup_test() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setpgrp(); write_file("/proc/self/oom_score_adj", "1000"); } static void close_fds() { for (int fd = 3; fd < MAX_FDS; fd++) close(fd); } #define WIFI_MAX_SSID_LEN 32 #define WIFI_JOIN_IBSS_NO_SCAN 0 #define WIFI_JOIN_IBSS_BG_SCAN 1 #define WIFI_JOIN_IBSS_BG_NO_SCAN 2 static long syz_80211_join_ibss(volatile long a0, volatile long a1, volatile long a2, volatile long a3) { char* interface = (char*)a0; uint8_t* ssid = (uint8_t*)a1; int ssid_len = (int)a2; int mode = (int)a3; struct nlmsg tmp_msg; uint8_t bssid[ETH_ALEN] = WIFI_IBSS_BSSID; if (ssid_len < 0 || ssid_len > WIFI_MAX_SSID_LEN) { return -1; } if (mode < 0 || mode > WIFI_JOIN_IBSS_BG_NO_SCAN) { return -1; } int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC); if (sock < 0) { return -1; } int nl80211_family_id = netlink_query_family_id(&tmp_msg, sock, "nl80211", true); struct join_ibss_props ibss_props = { .wiphy_freq = WIFI_DEFAULT_FREQUENCY, .wiphy_freq_fixed = (mode == WIFI_JOIN_IBSS_NO_SCAN || mode == WIFI_JOIN_IBSS_BG_NO_SCAN), .mac = bssid, .ssid = ssid, .ssid_len = ssid_len}; int ret = nl80211_setup_ibss_interface(&tmp_msg, sock, nl80211_family_id, interface, &ibss_props); close(sock); if (ret < 0) { return -1; } if (mode == WIFI_JOIN_IBSS_NO_SCAN) { ret = await_ifla_operstate(&tmp_msg, interface, IF_OPER_UP); if (ret < 0) { return -1; } } return 0; } static void execute_one(void); #define WAIT_FLAGS __WALL static void loop(void) { int iter = 0; for (;; iter++) { int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { setup_test(); execute_one(); close_fds(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5000) { continue; } kill_and_wait(pid, &status); break; } } } uint64_t r[4] = {0xffffffffffffffff, 0x0, 0x0, 0xffffffffffffffff}; void execute_one(void) { intptr_t res = 0; syscall(__NR_perf_event_open, 0ul, -1, 0xeul, -1, 0xeul); *(uint32_t*)0x20000380 = 0; syscall(__NR_sched_setscheduler, 0, 5ul, 0x20000380ul); *(uint32_t*)0x200003c0 = 3; *(uint32_t*)0x200003c4 = 0x80; *(uint8_t*)0x200003c8 = 8; *(uint8_t*)0x200003c9 = 4; *(uint8_t*)0x200003ca = 0; *(uint8_t*)0x200003cb = 0; *(uint32_t*)0x200003cc = 0; *(uint64_t*)0x200003d0 = 0; *(uint64_t*)0x200003d8 = 0xc3820; *(uint64_t*)0x200003e0 = 0; STORE_BY_BITMASK(uint64_t, , 0x200003e8, 0, 0, 1); STORE_BY_BITMASK(uint64_t, , 0x200003e8, 0, 1, 1); STORE_BY_BITMASK(uint64_t, , 0x200003e8, 0, 2, 1); STORE_BY_BITMASK(uint64_t, , 0x200003e8, 0, 3, 1); STORE_BY_BITMASK(uint64_t, , 0x200003e8, 0, 4, 1); STORE_BY_BITMASK(uint64_t, , 0x200003e8, 0, 5, 1); STORE_BY_BITMASK(uint64_t, , 0x200003e8, 0, 6, 1); STORE_BY_BITMASK(uint64_t, , 0x200003e8, 0, 7, 1); STORE_BY_BITMASK(uint64_t, , 0x200003e8, 1, 8, 1); STORE_BY_BITMASK(uint64_t, , 0x200003e8, 0, 9, 1); STORE_BY_BITMASK(uint64_t, , 0x200003e8, 0, 10, 1); STORE_BY_BITMASK(uint64_t, , 0x200003e8, 0, 11, 1); STORE_BY_BITMASK(uint64_t, , 0x200003e8, 0, 12, 1); STORE_BY_BITMASK(uint64_t, , 0x200003e8, 0, 13, 1); STORE_BY_BITMASK(uint64_t, , 0x200003e8, 0, 14, 1); STORE_BY_BITMASK(uint64_t, , 0x200003e8, 3, 15, 2); STORE_BY_BITMASK(uint64_t, , 0x200003e8, 1, 17, 1); STORE_BY_BITMASK(uint64_t, , 0x200003e8, 1, 18, 1); STORE_BY_BITMASK(uint64_t, , 0x200003e8, 0, 19, 1); STORE_BY_BITMASK(uint64_t, , 0x200003e8, 0, 20, 1); STORE_BY_BITMASK(uint64_t, , 0x200003e8, 1, 21, 1); STORE_BY_BITMASK(uint64_t, , 0x200003e8, 1, 22, 1); STORE_BY_BITMASK(uint64_t, , 0x200003e8, 0, 23, 1); STORE_BY_BITMASK(uint64_t, , 0x200003e8, 0, 24, 1); STORE_BY_BITMASK(uint64_t, , 0x200003e8, 0, 25, 1); STORE_BY_BITMASK(uint64_t, , 0x200003e8, 0, 26, 1); STORE_BY_BITMASK(uint64_t, , 0x200003e8, 0, 27, 1); STORE_BY_BITMASK(uint64_t, , 0x200003e8, 1, 28, 1); STORE_BY_BITMASK(uint64_t, , 0x200003e8, 0, 29, 1); STORE_BY_BITMASK(uint64_t, , 0x200003e8, 0, 30, 1); STORE_BY_BITMASK(uint64_t, , 0x200003e8, 0, 31, 1); STORE_BY_BITMASK(uint64_t, , 0x200003e8, 0, 32, 1); STORE_BY_BITMASK(uint64_t, , 0x200003e8, 0, 33, 1); STORE_BY_BITMASK(uint64_t, , 0x200003e8, 0, 34, 1); STORE_BY_BITMASK(uint64_t, , 0x200003e8, 1, 35, 1); STORE_BY_BITMASK(uint64_t, , 0x200003e8, 0, 36, 1); STORE_BY_BITMASK(uint64_t, , 0x200003e8, 0, 37, 1); STORE_BY_BITMASK(uint64_t, , 0x200003e8, 0, 38, 26); *(uint32_t*)0x200003f0 = 0; *(uint32_t*)0x200003f4 = 0; *(uint64_t*)0x200003f8 = 6; *(uint64_t*)0x20000400 = 1; *(uint64_t*)0x20000408 = 0; *(uint64_t*)0x20000410 = 0x10001; *(uint32_t*)0x20000418 = 0; *(uint32_t*)0x2000041c = 9; *(uint64_t*)0x20000420 = 0xae5; *(uint32_t*)0x20000428 = 6; *(uint16_t*)0x2000042c = 0; *(uint16_t*)0x2000042e = 0; *(uint32_t*)0x20000430 = 0; *(uint32_t*)0x20000434 = 0; *(uint64_t*)0x20000438 = 0; syscall(__NR_perf_event_open, 0x200003c0ul, -1, 6ul, -1, 0ul); memcpy((void*)0x200001c0, "wlan1\000", 6); memcpy((void*)0x20000100, "\x7b\x06\xfe\xb4\x5f\xa6\xad\xa6\xb0\xf1\x0b\x48\xed\xa3\xb9\x3c\xc8" "\x89\x82", 19); syz_80211_join_ibss(0x200001c0, 0x20000100, 2, 2); memcpy((void*)0x200002c0, "/sys/power/resume", 17); res = syscall(__NR_openat, 0xffffffffffffff9cul, 0x200002c0ul, 0x121a02ul, 0ul); if (res != -1) r[0] = res; res = syscall(__NR_getpgid, 0); if (res != -1) r[1] = res; sprintf((char*)0x20000140, "0x%016llx", (long long)r[1]); syscall(__NR_write, r[0], 0x20000140ul, 0x12ul); memcpy((void*)0x20000f00, "ip6gre0\000\000\000\000\000\000\000\000\000", 16); *(uint64_t*)0x20000f10 = 0x20000e80; memcpy((void*)0x20000e80, "syztnl1\000\000\000\000\000\000\000\000\000", 16); *(uint32_t*)0x20000e90 = 0; *(uint8_t*)0x20000e94 = 0; *(uint8_t*)0x20000e95 = 0x3f; *(uint8_t*)0x20000e96 = 0; *(uint32_t*)0x20000e98 = htobe32(0x40); *(uint32_t*)0x20000e9c = 0x14; *(uint8_t*)0x20000ea0 = -1; *(uint8_t*)0x20000ea1 = 2; memset((void*)0x20000ea2, 0, 13); *(uint8_t*)0x20000eaf = 1; memset((void*)0x20000eb0, 0, 16); *(uint16_t*)0x20000ec0 = htobe16(8); *(uint16_t*)0x20000ec2 = htobe16(0x10); *(uint32_t*)0x20000ec4 = htobe32(0x8001); *(uint32_t*)0x20000ec8 = htobe32(1); res = syscall(__NR_ioctl, -1, 0x89f2, 0x20000f00ul); if (res != -1) r[2] = *(uint32_t*)0x20000e90; *(uint64_t*)0x20001040 = 0x20000080; *(uint16_t*)0x20000080 = 2; *(uint16_t*)0x20000082 = htobe16(0x4e22); *(uint32_t*)0x20000084 = htobe32(0xe0000002); *(uint32_t*)0x20001048 = 0x10; *(uint64_t*)0x20001050 = 0; *(uint64_t*)0x20001058 = 0; *(uint64_t*)0x20001060 = 0x200009c0; *(uint64_t*)0x200009c0 = 0x1c; *(uint32_t*)0x200009c8 = 0; *(uint32_t*)0x200009cc = 7; *(uint8_t*)0x200009d0 = 0x94; *(uint8_t*)0x200009d1 = 4; *(uint16_t*)0x200009d2 = 0; *(uint8_t*)0x200009d4 = 0x89; *(uint8_t*)0x200009d5 = 7; *(uint8_t*)0x200009d6 = 0x22; *(uint32_t*)0x200009d7 = htobe32(0); *(uint64_t*)0x200009e0 = 0x64; *(uint32_t*)0x200009e8 = 0; *(uint32_t*)0x200009ec = 7; *(uint8_t*)0x200009f0 = 0; *(uint8_t*)0x200009f1 = 0x44; *(uint8_t*)0x200009f2 = 0xc; *(uint8_t*)0x200009f3 = 0x7c; STORE_BY_BITMASK(uint8_t, , 0x200009f4, 3, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x200009f4, 6, 4, 4); *(uint8_t*)0x200009f5 = 0xac; *(uint8_t*)0x200009f6 = 0x14; *(uint8_t*)0x200009f7 = 0x14; *(uint8_t*)0x200009f8 = 0xbb; *(uint32_t*)0x200009f9 = htobe32(0x7fffffff); *(uint8_t*)0x200009fd = 0x44; *(uint8_t*)0x200009fe = 0x2c; *(uint8_t*)0x200009ff = 0xb1; STORE_BY_BITMASK(uint8_t, , 0x20000a00, 1, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x20000a00, 4, 4, 4); *(uint32_t*)0x20000a01 = htobe32(0x64010101); *(uint32_t*)0x20000a05 = htobe32(0x200); *(uint32_t*)0x20000a09 = htobe32(0x64010102); *(uint32_t*)0x20000a0d = htobe32(0x83); *(uint8_t*)0x20000a11 = 0xac; *(uint8_t*)0x20000a12 = 0x14; *(uint8_t*)0x20000a13 = 0x14; *(uint8_t*)0x20000a14 = 0xaa; *(uint32_t*)0x20000a15 = htobe32(3); *(uint8_t*)0x20000a19 = 0xac; *(uint8_t*)0x20000a1a = 0x1e; *(uint8_t*)0x20000a1b = 1; *(uint8_t*)0x20000a1c = 1; *(uint32_t*)0x20000a1d = htobe32(0x1f); *(uint32_t*)0x20000a21 = htobe32(-1); *(uint32_t*)0x20000a25 = htobe32(0x8000); *(uint8_t*)0x20000a29 = 0x86; *(uint8_t*)0x20000a2a = 0x13; *(uint32_t*)0x20000a2b = htobe32(3); *(uint8_t*)0x20000a2f = 6; *(uint8_t*)0x20000a30 = 0xb; memcpy((void*)0x20000a31, "\x04\x37\x3d\x6d\x6b\x9a\xb8\xfe\x3c", 9); *(uint8_t*)0x20000a3a = 0; *(uint8_t*)0x20000a3b = 2; *(uint8_t*)0x20000a3c = 0x86; *(uint8_t*)0x20000a3d = 8; *(uint32_t*)0x20000a3e = htobe32(3); *(uint8_t*)0x20000a42 = 2; *(uint8_t*)0x20000a43 = 2; *(uint64_t*)0x20000a48 = 0xa0; *(uint32_t*)0x20000a50 = 0; *(uint32_t*)0x20000a54 = 7; *(uint8_t*)0x20000a58 = 0x83; *(uint8_t*)0x20000a59 = 0x23; *(uint8_t*)0x20000a5a = 0x38; *(uint32_t*)0x20000a5b = htobe32(0); *(uint32_t*)0x20000a5f = htobe32(0xe0000001); *(uint32_t*)0x20000a63 = htobe32(0xe0000002); *(uint32_t*)0x20000a67 = htobe32(-1); *(uint32_t*)0x20000a6b = htobe32(0x7f000001); *(uint8_t*)0x20000a6f = 0xac; *(uint8_t*)0x20000a70 = 0x14; *(uint8_t*)0x20000a71 = 0x14; *(uint8_t*)0x20000a72 = 0xbb; *(uint32_t*)0x20000a73 = htobe32(0xe0000001); *(uint32_t*)0x20000a77 = htobe32(0xa010100); *(uint8_t*)0x20000a7b = 0x89; *(uint8_t*)0x20000a7c = 0x17; *(uint8_t*)0x20000a7d = 0xa7; *(uint32_t*)0x20000a7e = htobe32(0x7f000001); *(uint32_t*)0x20000a82 = htobe32(0xa010101); *(uint8_t*)0x20000a86 = 0xac; *(uint8_t*)0x20000a87 = 0x14; *(uint8_t*)0x20000a88 = 0x14; *(uint8_t*)0x20000a89 = 0x27; *(uint32_t*)0x20000a8a = htobe32(0xe0000001); *(uint32_t*)0x20000a8e = htobe32(0xe0000002); *(uint8_t*)0x20000a92 = 0x83; *(uint8_t*)0x20000a93 = 0xf; memcpy((void*)0x20000a94, "\x8a\xa0\x8c\x50\x2e\x57\x42\xb2\xa4\x8d\xff\x8f\x9b", 13); *(uint8_t*)0x20000aa1 = 0x89; *(uint8_t*)0x20000aa2 = 0xb; *(uint8_t*)0x20000aa3 = 0xec; *(uint32_t*)0x20000aa4 = htobe32(0x64010101); *(uint8_t*)0x20000aa8 = 0xac; *(uint8_t*)0x20000aa9 = 0x1e; *(uint8_t*)0x20000aaa = 0; *(uint8_t*)0x20000aab = 1; *(uint8_t*)0x20000aac = 0x44; *(uint8_t*)0x20000aad = 0x3c; *(uint8_t*)0x20000aae = 0xe6; STORE_BY_BITMASK(uint8_t, , 0x20000aaf, 1, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x20000aaf, 6, 4, 4); *(uint8_t*)0x20000ab0 = 0xac; *(uint8_t*)0x20000ab1 = 0x1e; *(uint8_t*)0x20000ab2 = 0; *(uint8_t*)0x20000ab3 = 1; *(uint32_t*)0x20000ab4 = htobe32(4); *(uint8_t*)0x20000ab8 = 0xac; *(uint8_t*)0x20000ab9 = 0x14; *(uint8_t*)0x20000aba = 0x14; *(uint8_t*)0x20000abb = 0xaa; *(uint32_t*)0x20000abc = htobe32(1); *(uint32_t*)0x20000ac0 = htobe32(0x64010102); *(uint32_t*)0x20000ac4 = htobe32(0x40); *(uint8_t*)0x20000ac8 = 0xac; *(uint8_t*)0x20000ac9 = 0x1e; *(uint8_t*)0x20000aca = 1; *(uint8_t*)0x20000acb = 1; *(uint32_t*)0x20000acc = htobe32(9); *(uint8_t*)0x20000ad0 = 0xac; *(uint8_t*)0x20000ad1 = 0x1e; *(uint8_t*)0x20000ad2 = 1; *(uint8_t*)0x20000ad3 = 1; *(uint32_t*)0x20000ad4 = htobe32(6); *(uint32_t*)0x20000ad8 = htobe32(0x64010100); *(uint32_t*)0x20000adc = htobe32(9); *(uint8_t*)0x20000ae0 = 0xac; *(uint8_t*)0x20000ae1 = 0x1e; *(uint8_t*)0x20000ae2 = 0; *(uint8_t*)0x20000ae3 = 1; *(uint32_t*)0x20000ae4 = htobe32(0x46f4); *(uint64_t*)0x20000ae8 = 0x14; *(uint32_t*)0x20000af0 = 0; *(uint32_t*)0x20000af4 = 1; *(uint32_t*)0x20000af8 = 2; *(uint64_t*)0x20000b00 = 0x11; *(uint32_t*)0x20000b08 = 0; *(uint32_t*)0x20000b0c = 1; *(uint8_t*)0x20000b10 = 0; *(uint64_t*)0x20000b18 = 0x14; *(uint32_t*)0x20000b20 = 0; *(uint32_t*)0x20000b24 = 2; *(uint32_t*)0x20000b28 = 0xc5ae; *(uint64_t*)0x20000b30 = 0x14; *(uint32_t*)0x20000b38 = 0; *(uint32_t*)0x20000b3c = 2; *(uint32_t*)0x20000b40 = 2; *(uint64_t*)0x20000b48 = 0x14; *(uint32_t*)0x20000b50 = 0; *(uint32_t*)0x20000b54 = 2; *(uint32_t*)0x20000b58 = 1; *(uint64_t*)0x20000b60 = 0x14; *(uint32_t*)0x20000b68 = 0; *(uint32_t*)0x20000b6c = 1; *(uint32_t*)0x20000b70 = 9; *(uint64_t*)0x20001068 = 0x1b8; *(uint32_t*)0x20001070 = 0; *(uint32_t*)0x20001078 = 0; *(uint64_t*)0x20001080 = 0x20000180; *(uint16_t*)0x20000180 = 2; *(uint16_t*)0x20000182 = htobe16(0x4e23); *(uint32_t*)0x20000184 = htobe32(-1); *(uint32_t*)0x20001088 = 0x10; *(uint64_t*)0x20001090 = 0x20000540; *(uint64_t*)0x20000540 = 0x20000280; memcpy((void*)0x20000280, "\x10\x57\x07\xba\x1a\xbd\x29\x1d\x6a\xf2\xf5\x1b\x8d\xf4\xad\xe3\xba" "\xc7\x9a\x66\x44\x65\xe9\x9a\x48\xdf\xf3\xfc\x0a\x8c\x02\xde\xe1\x12" "\x69\x11\x03\xf9\x75\x36\xe3\x59\x86\x7d\x68\x65\x95\x94\x57\x98\xf2", 51); *(uint64_t*)0x20000548 = 0x33; *(uint64_t*)0x20000550 = 0x20000bc0; memcpy((void*)0x20000bc0, "\x4c\x85\x1a\x3a\x54\xac\xd8\x3c\xd4\xf2\x1d\x32\x11\x07\xa7\xb6\xae" "\xc7\x41\x70\xbe\xaf\x52\x6e\x82\xc3\x69\xad\x53\x9c\x4a\x7e\xe5\x24" "\xef\xbd\xb8\xd4\x0d\x93\xa3\x9c\x94\xba\x04\x2f\xce\x00\xd4\x0d\x51" "\xfb\x38\x23\x4a\x35\x11\x8d\x3f\x27\x9c\x3d\xc2\xef\x5f\xd6\xf4\xa4" "\x41\xdb\xd9\xbd\x1d\x0f\xd1\x61\x4f\xc8\x7b\x36\xc8\x33\xb0\x85\x38" "\xeb\xd0\x14\x6c\xa3\x5b\x6d\x8a\xb0\x9e\x58\x7e\xac\x7e\xbe", 100); *(uint64_t*)0x20000558 = 0x64; *(uint64_t*)0x20000560 = 0x20000c40; memcpy((void*)0x20000c40, "\xe6\xb4\xcf\xcb\x28\xc0\x80\x5f\x82\x46\xc6\x32\x57\x5d\x46\xc7\xa2" "\x2a\xb6\xfe\xcd\x7c\x19\x2b\x43\xe7\xe9\xa2\x43\x17\x1c\x10\x02\xb5" "\xb5\x5b\x11\xc0\x61\xee\x66\xec\xf1\x86\x74\xa8\x35\xfb\xa6\xc3\x81" "\xff\x95\x2c\x2c\x95\x18\x0f\x60\xf9\x2a\x64\xc5\x8e\xac\xa1\x41\xfa" "\x23\xb8\xdf\x57\x30\x52\xc2\xd7\x34\x5b\xa6\xbc\xd1\x69\xc9\x98\x8f" "\x73\x31\x15\x3d\xb4\x1f\xe5\x33\x43\xf8\x57\xcc\x6e\x53\xc4\xc5\x3d" "\x8e\xcc\xda\xb4\xf6\x01\xce\x76\xde\x12\x46\xc4\x7d\xe0\xc9\x34\xfd" "\xaa\xe8\x61\x75\x15\x0f\x29\xf2\x3b\x8c\xa4\x84\xf8\x55\x4a\xaf\xc9" "\xbe\x2b\x83\x91\x44\x9b\xeb\xe5\x91\x67\x6b\x9b\x83\xcc\xc1\x1b\x29" "\xa0\x0c\x69\xcb\x5e\xbd\xba\xd6\xd0\x2f\x4c\x55\xd4\x5b\xc4\xab\x93" "\x72\x8b\xa7\x34\xc9\x0b\xe7\x29\x36\x23\xef\x8f\xd8\xbc\xb6\x2c\x0c" "\xc7\x65\x3a\x02\xd2\xbc\xa0\xe1\xd0\xba\x92\x66\x2e\xcd\x53\x6b\xbf" "\x81\x2b\x55\xca\x3c\xcf\xb4\x99\x92\x11\xb1\x65\x3f\x59", 218); *(uint64_t*)0x20000568 = 0xda; *(uint64_t*)0x20001098 = 3; *(uint64_t*)0x200010a0 = 0x20000f40; *(uint64_t*)0x20000f40 = 0x38; *(uint32_t*)0x20000f48 = 0; *(uint32_t*)0x20000f4c = 7; *(uint8_t*)0x20000f50 = 7; *(uint8_t*)0x20000f51 = 3; *(uint8_t*)0x20000f52 = 0xe7; *(uint8_t*)0x20000f53 = 1; *(uint8_t*)0x20000f54 = 0x44; *(uint8_t*)0x20000f55 = 0x1c; *(uint8_t*)0x20000f56 = 0x1a; STORE_BY_BITMASK(uint8_t, , 0x20000f57, 3, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x20000f57, 1, 4, 4); *(uint32_t*)0x20000f58 = htobe32(0); *(uint32_t*)0x20000f5c = htobe32(3); *(uint32_t*)0x20000f60 = htobe32(0xe0000002); *(uint32_t*)0x20000f64 = htobe32(8); *(uint8_t*)0x20000f68 = 0xac; *(uint8_t*)0x20000f69 = 0x1e; *(uint8_t*)0x20000f6a = 1; *(uint8_t*)0x20000f6b = 1; *(uint32_t*)0x20000f6c = htobe32(0x40); *(uint8_t*)0x20000f70 = 7; *(uint8_t*)0x20000f71 = 7; *(uint8_t*)0x20000f72 = 0xa1; *(uint8_t*)0x20000f73 = 0xac; *(uint8_t*)0x20000f74 = 0x1e; *(uint8_t*)0x20000f75 = 0; *(uint8_t*)0x20000f76 = 1; *(uint8_t*)0x20000f77 = 0; *(uint64_t*)0x20000f78 = 0x1c; *(uint32_t*)0x20000f80 = 0; *(uint32_t*)0x20000f84 = 8; *(uint32_t*)0x20000f88 = 0; *(uint8_t*)0x20000f8c = 0xac; *(uint8_t*)0x20000f8d = 0x14; *(uint8_t*)0x20000f8e = 0x14; *(uint8_t*)0x20000f8f = 0x33; *(uint8_t*)0x20000f90 = 0xac; *(uint8_t*)0x20000f91 = 0x1e; *(uint8_t*)0x20000f92 = 1; *(uint8_t*)0x20000f93 = 1; *(uint64_t*)0x20000f98 = 0x1c; *(uint32_t*)0x20000fa0 = 0; *(uint32_t*)0x20000fa4 = 8; *(uint32_t*)0x20000fa8 = 0; *(uint8_t*)0x20000fac = 0xac; *(uint8_t*)0x20000fad = 0x14; *(uint8_t*)0x20000fae = 0x14; *(uint8_t*)0x20000faf = 0xaa; *(uint8_t*)0x20000fb0 = 0xac; *(uint8_t*)0x20000fb1 = 0x1e; *(uint8_t*)0x20000fb2 = 0; *(uint8_t*)0x20000fb3 = 1; *(uint64_t*)0x20000fb8 = 0x1c; *(uint32_t*)0x20000fc0 = 0; *(uint32_t*)0x20000fc4 = 8; *(uint32_t*)0x20000fc8 = 0; *(uint32_t*)0x20000fcc = htobe32(0xa010102); *(uint32_t*)0x20000fd0 = htobe32(0x7f000001); *(uint64_t*)0x20000fd8 = 0x14; *(uint32_t*)0x20000fe0 = 0; *(uint32_t*)0x20000fe4 = 2; *(uint32_t*)0x20000fe8 = 5; *(uint64_t*)0x20000ff0 = 0x11; *(uint32_t*)0x20000ff8 = 0; *(uint32_t*)0x20000ffc = 1; *(uint8_t*)0x20001000 = 1; *(uint64_t*)0x20001008 = 0x1c; *(uint32_t*)0x20001010 = 0; *(uint32_t*)0x20001014 = 8; *(uint32_t*)0x20001018 = r[2]; *(uint32_t*)0x2000101c = htobe32(0x7f000001); *(uint32_t*)0x20001020 = htobe32(-1); *(uint64_t*)0x200010a8 = 0xe8; *(uint32_t*)0x200010b0 = 0; *(uint32_t*)0x200010b8 = 0; syscall(__NR_sendmmsg, -1, 0x20001040ul, 2ul, 0x40800ul); res = syscall(__NR_socket, 0x10ul, 3ul, 0x10); if (res != -1) r[3] = res; memcpy((void*)0x20000000, "wlan0\000\000\000\000\000\000\000\000\000\000\000", 16); syscall(__NR_ioctl, r[3], 0x8933, 0x20000000ul); *(uint32_t*)0x20000040 = 0; *(uint32_t*)0x20000044 = 0x5517; *(uint64_t*)0x20000048 = 0; syscall(__NR_ioctl, -1, 0xc0105512, 0x20000040ul); } 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); do_sandbox_none(); return 0; }