// https://syzkaller.appspot.com/bug?id=1eaa553d8a82de59255e3a9574d193885c6dadd4 // 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 #ifndef __NR_bpf #define __NR_bpf 321 #endif #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; } 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); } static void setup_binderfs(); static void setup_fusectl(); static void sandbox_common_mount_tmpfs(void) { write_file("/proc/sys/fs/mount-max", "100000"); if (mkdir("./syz-tmp", 0777)) exit(1); if (mount("", "./syz-tmp", "tmpfs", 0, NULL)) exit(1); if (mkdir("./syz-tmp/newroot", 0777)) exit(1); if (mkdir("./syz-tmp/newroot/dev", 0700)) exit(1); unsigned bind_mount_flags = MS_BIND | MS_REC | MS_PRIVATE; if (mount("/dev", "./syz-tmp/newroot/dev", NULL, bind_mount_flags, NULL)) exit(1); if (mkdir("./syz-tmp/newroot/proc", 0700)) exit(1); if (mount("syz-proc", "./syz-tmp/newroot/proc", "proc", 0, NULL)) exit(1); if (mkdir("./syz-tmp/newroot/selinux", 0700)) exit(1); const char* selinux_path = "./syz-tmp/newroot/selinux"; if (mount("/selinux", selinux_path, NULL, bind_mount_flags, NULL)) { if (errno != ENOENT) exit(1); if (mount("/sys/fs/selinux", selinux_path, NULL, bind_mount_flags, NULL) && errno != ENOENT) exit(1); } if (mkdir("./syz-tmp/newroot/sys", 0700)) exit(1); if (mount("/sys", "./syz-tmp/newroot/sys", 0, bind_mount_flags, NULL)) exit(1); if (mount("/sys/kernel/debug", "./syz-tmp/newroot/sys/kernel/debug", NULL, bind_mount_flags, NULL) && errno != ENOENT) exit(1); if (mount("/sys/fs/smackfs", "./syz-tmp/newroot/sys/fs/smackfs", NULL, bind_mount_flags, NULL) && errno != ENOENT) exit(1); if (mount("/proc/sys/fs/binfmt_misc", "./syz-tmp/newroot/proc/sys/fs/binfmt_misc", NULL, bind_mount_flags, NULL) && errno != ENOENT) exit(1); if (mkdir("./syz-tmp/pivot", 0777)) exit(1); if (syscall(SYS_pivot_root, "./syz-tmp", "./syz-tmp/pivot")) { if (chdir("./syz-tmp")) exit(1); } else { if (chdir("/")) exit(1); if (umount2("./pivot", MNT_DETACH)) exit(1); } if (chroot("./newroot")) exit(1); if (chdir("/")) exit(1); setup_binderfs(); setup_fusectl(); } static void setup_fusectl() { if (mount(0, "/sys/fs/fuse/connections", "fusectl", 0, 0)) { } } static void setup_binderfs() { if (mkdir("/dev/binderfs", 0777)) { } if (mount("binder", "/dev/binderfs", "binder", 0, NULL)) { } if (symlink("/dev/binderfs", "./binderfs")) { } } static void loop(); static void sandbox_common() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); if (getppid() == 1) exit(1); struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = (200 << 20); setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 32 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 136 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); if (unshare(CLONE_NEWNS)) { } if (mount(NULL, "/", NULL, MS_REC | MS_PRIVATE, NULL)) { } if (unshare(CLONE_NEWIPC)) { } if (unshare(0x02000000)) { } if (unshare(CLONE_NEWUTS)) { } if (unshare(CLONE_SYSVSEM)) { } typedef struct { const char* name; const char* value; } sysctl_t; static const sysctl_t sysctls[] = { {"/proc/sys/kernel/shmmax", "16777216"}, {"/proc/sys/kernel/shmall", "536870912"}, {"/proc/sys/kernel/shmmni", "1024"}, {"/proc/sys/kernel/msgmax", "8192"}, {"/proc/sys/kernel/msgmni", "1024"}, {"/proc/sys/kernel/msgmnb", "1024"}, {"/proc/sys/kernel/sem", "1024 1048576 500 1024"}, }; unsigned i; for (i = 0; i < sizeof(sysctls) / sizeof(sysctls[0]); i++) write_file(sysctls[i].name, sysctls[i].value); } static int wait_for_loop(int pid) { if (pid < 0) exit(1); int status = 0; while (waitpid(-1, &status, __WALL) != pid) { } return WEXITSTATUS(status); } static void drop_caps(void) { struct __user_cap_header_struct cap_hdr = {}; struct __user_cap_data_struct cap_data[2] = {}; cap_hdr.version = _LINUX_CAPABILITY_VERSION_3; cap_hdr.pid = getpid(); if (syscall(SYS_capget, &cap_hdr, &cap_data)) exit(1); const int drop = (1 << CAP_SYS_PTRACE) | (1 << CAP_SYS_NICE); cap_data[0].effective &= ~drop; cap_data[0].permitted &= ~drop; cap_data[0].inheritable &= ~drop; if (syscall(SYS_capset, &cap_hdr, &cap_data)) exit(1); } static int do_sandbox_none(void) { if (unshare(CLONE_NEWPID)) { } int pid = fork(); if (pid != 0) return wait_for_loop(pid); sandbox_common(); drop_caps(); if (unshare(CLONE_NEWNET)) { } write_file("/proc/sys/net/ipv4/ping_group_range", "0 65535"); initialize_tun(); sandbox_common_mount_tmpfs(); loop(); exit(1); } uint64_t r[8] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x0}; void loop(void) { intptr_t res = 0; if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } res = syscall(__NR_socket, /*domain=*/0x10ul, /*type=*/3ul, /*proto=*/0); if (res != -1) r[0] = res; *(uint32_t*)0x200000c0 = 0; *(uint32_t*)0x200000c4 = 0xc; *(uint64_t*)0x200000c8 = 0x20000440; memcpy((void*)0x20000440, "\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x18" "\x11\x00\x00", 20); *(uint32_t*)0x20000454 = -1; memcpy((void*)0x20000458, "\x00\x00\x00\x00\x00\x00\x00\x00\xb7\x08\x00\x00\x00\x00\x00\x00\x7b" "\x8a\xf8\xff\x00\x00\x00\x00\xbf\xa2\x00\x00\x00\x00\x00\x00\x07\x02" "\x00\x00\xf8\xff\xff\xff\xb7\x03\x00\x00\x08\x00\x00\x00\xb7\x04\x00" "\x00\x00\x00\x00\x00\x85\x00\x00\x00\x01\x00\x00\x00\x95", 65); *(uint64_t*)0x200000d0 = 0; *(uint32_t*)0x200000d8 = 0; *(uint32_t*)0x200000dc = 0; *(uint64_t*)0x200000e0 = 0; *(uint32_t*)0x200000e8 = 0; *(uint32_t*)0x200000ec = 0; memset((void*)0x200000f0, 0, 16); *(uint32_t*)0x20000100 = 0; *(uint32_t*)0x20000104 = 0; *(uint32_t*)0x20000108 = -1; *(uint32_t*)0x2000010c = 0; *(uint64_t*)0x20000110 = 0; *(uint32_t*)0x20000118 = 0; *(uint32_t*)0x2000011c = 0; *(uint64_t*)0x20000120 = 0; *(uint32_t*)0x20000128 = 0; *(uint32_t*)0x2000012c = 0; *(uint32_t*)0x20000130 = 0; *(uint32_t*)0x20000134 = 0; *(uint64_t*)0x20000138 = 0; *(uint64_t*)0x20000140 = 0; *(uint32_t*)0x20000148 = 0; *(uint32_t*)0x2000014c = 0; *(uint32_t*)0x20000150 = 0; syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x200000c0ul, /*size=*/0x90ul); *(uint32_t*)0x20000000 = 0xa; *(uint32_t*)0x20000004 = 5; *(uint32_t*)0x20000008 = 2; *(uint32_t*)0x2000000c = 7; *(uint32_t*)0x20000010 = 0; *(uint32_t*)0x20000014 = -1; *(uint32_t*)0x20000018 = 0; memset((void*)0x2000001c, 0, 16); *(uint32_t*)0x2000002c = 0; *(uint32_t*)0x20000030 = -1; *(uint32_t*)0x20000034 = 0; *(uint32_t*)0x20000038 = 0; *(uint32_t*)0x2000003c = 0; *(uint64_t*)0x20000040 = 0; *(uint32_t*)0x20000048 = 0; *(uint32_t*)0x2000004c = 0; res = syscall(__NR_bpf, /*cmd=*/0ul, /*arg=*/0x20000000ul, /*size=*/0x48ul); if (res != -1) r[1] = res; *(uint32_t*)0x20000180 = 0; *(uint32_t*)0x20000184 = 0xc; *(uint64_t*)0x20000188 = 0x20000440; memcpy((void*)0x20000440, "\x18\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x80\x00\x00\x00\x18" "\x11\x00\x00", 20); *(uint32_t*)0x20000454 = r[1]; *(uint64_t*)0x20000190 = 0; *(uint32_t*)0x20000198 = 0; *(uint32_t*)0x2000019c = 0; *(uint64_t*)0x200001a0 = 0; *(uint32_t*)0x200001a8 = 0; *(uint32_t*)0x200001ac = 0; memset((void*)0x200001b0, 0, 16); *(uint32_t*)0x200001c0 = 0; *(uint32_t*)0x200001c4 = 0; *(uint32_t*)0x200001c8 = -1; *(uint32_t*)0x200001cc = 0; *(uint64_t*)0x200001d0 = 0; *(uint32_t*)0x200001d8 = 0; *(uint32_t*)0x200001dc = 0; *(uint64_t*)0x200001e0 = 0; *(uint32_t*)0x200001e8 = 0; *(uint32_t*)0x200001ec = 0; *(uint32_t*)0x200001f0 = 0; *(uint32_t*)0x200001f4 = 0; *(uint64_t*)0x200001f8 = 0; *(uint64_t*)0x20000200 = 0; *(uint32_t*)0x20000208 = 0; *(uint32_t*)0x2000020c = 0; *(uint32_t*)0x20000210 = 0; syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x20000180ul, /*size=*/0x90ul); *(uint32_t*)0x200000c0 = 0x11; *(uint32_t*)0x200000c4 = 0xc; *(uint64_t*)0x200000c8 = 0x20000440; *(uint64_t*)0x200000d0 = 0x20000240; memcpy((void*)0x20000240, "GPL\000", 4); *(uint32_t*)0x200000d8 = 0; *(uint32_t*)0x200000dc = 0; *(uint64_t*)0x200000e0 = 0; *(uint32_t*)0x200000e8 = 0; *(uint32_t*)0x200000ec = 0; memset((void*)0x200000f0, 0, 16); *(uint32_t*)0x20000100 = 0; *(uint32_t*)0x20000104 = 0; *(uint32_t*)0x20000108 = -1; *(uint32_t*)0x2000010c = 0; *(uint64_t*)0x20000110 = 0; *(uint32_t*)0x20000118 = 0; *(uint32_t*)0x2000011c = 0; *(uint64_t*)0x20000120 = 0; *(uint32_t*)0x20000128 = 0; *(uint32_t*)0x2000012c = 0; *(uint32_t*)0x20000130 = 0; *(uint32_t*)0x20000134 = 0; *(uint64_t*)0x20000138 = 0; *(uint64_t*)0x20000140 = 0; *(uint32_t*)0x20000148 = 0; *(uint32_t*)0x2000014c = 0; *(uint32_t*)0x20000150 = 0; res = syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x200000c0ul, /*size=*/0x90ul); if (res != -1) r[2] = res; *(uint64_t*)0x20000200 = 0x20000500; memcpy((void*)0x20000500, "percpu_free_percpu\000", 19); *(uint32_t*)0x20000208 = r[2]; *(uint32_t*)0x2000020c = 0; *(uint64_t*)0x20000210 = 0; syscall(__NR_bpf, /*cmd=*/0x11ul, /*arg=*/0x20000200ul, /*size=*/0x10ul); *(uint32_t*)0x200000c0 = 0x11; *(uint32_t*)0x200000c4 = 0xc; *(uint64_t*)0x200000c8 = 0x20000440; *(uint64_t*)0x200000d0 = 0x20000240; memcpy((void*)0x20000240, "GPL\000", 4); *(uint32_t*)0x200000d8 = 0; *(uint32_t*)0x200000dc = 0; *(uint64_t*)0x200000e0 = 0; *(uint32_t*)0x200000e8 = 0; *(uint32_t*)0x200000ec = 0; memset((void*)0x200000f0, 0, 16); *(uint32_t*)0x20000100 = 0; *(uint32_t*)0x20000104 = 0; *(uint32_t*)0x20000108 = -1; *(uint32_t*)0x2000010c = 0; *(uint64_t*)0x20000110 = 0; *(uint32_t*)0x20000118 = 0; *(uint32_t*)0x2000011c = 0; *(uint64_t*)0x20000120 = 0; *(uint32_t*)0x20000128 = 0; *(uint32_t*)0x2000012c = 0; *(uint32_t*)0x20000130 = 0; *(uint32_t*)0x20000134 = 0; *(uint64_t*)0x20000138 = 0; *(uint64_t*)0x20000140 = 0; *(uint32_t*)0x20000148 = 0; *(uint32_t*)0x2000014c = 0; *(uint32_t*)0x20000150 = 0; res = syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x200000c0ul, /*size=*/0x90ul); if (res != -1) r[3] = res; *(uint64_t*)0x20000200 = 0x20000500; memcpy((void*)0x20000500, "percpu_free_percpu\000", 19); *(uint32_t*)0x20000208 = r[3]; *(uint32_t*)0x2000020c = 0; *(uint64_t*)0x20000210 = 0; syscall(__NR_bpf, /*cmd=*/0x11ul, /*arg=*/0x20000200ul, /*size=*/0x10ul); memcpy((void*)0x200009c0, "\x19\x00\x00\x00\x04\x00\x00\x00\x08\x00\x00\x00\x05", 13); res = syscall(__NR_bpf, /*cmd=*/0ul, /*arg=*/0x200009c0ul, /*size=*/0x48ul); if (res != -1) r[4] = res; *(uint32_t*)0x200000c0 = 6; *(uint32_t*)0x200000c4 = 0xc; *(uint64_t*)0x200000c8 = 0x200001c0; memcpy((void*)0x200001c0, "\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x18" "\x11\x00\x00", 20); *(uint32_t*)0x200001d4 = r[4]; memcpy((void*)0x200001d8, "\x00\x00\x00\x00\x00\x00\x00\x00\xb7\x08\x00\x00\x00\x00\x00\x00\x7b" "\x8a\xf8\xff\x00\x00\x00\x00\xbc\x82\x00\x00\x00\x00\x00\x00\xa6\x02" "\x00\x00\xf8\xff\xff\xff\xb7\x03\x00\x00\x08\x00\x00\x00\xb7\x03\x00" "\x00\x00\x00\x00\x00\x85\x00\x00\x00\x33\x00\x00\x00\x95", 65); *(uint64_t*)0x200000d0 = 0x20000180; memcpy((void*)0x20000180, "GPL\000", 4); *(uint32_t*)0x200000d8 = 0; *(uint32_t*)0x200000dc = 0; *(uint64_t*)0x200000e0 = 0; *(uint32_t*)0x200000e8 = 0x41000; *(uint32_t*)0x200000ec = 0; memset((void*)0x200000f0, 0, 16); *(uint32_t*)0x20000100 = 0; *(uint32_t*)0x20000104 = 0; *(uint32_t*)0x20000108 = -1; *(uint32_t*)0x2000010c = 0; *(uint64_t*)0x20000110 = 0; *(uint32_t*)0x20000118 = 0; *(uint32_t*)0x2000011c = 0; *(uint64_t*)0x20000120 = 0; *(uint32_t*)0x20000128 = 0; *(uint32_t*)0x2000012c = 0; *(uint32_t*)0x20000130 = 0; *(uint32_t*)0x20000134 = 0; *(uint64_t*)0x20000138 = 0; *(uint64_t*)0x20000140 = 0; *(uint32_t*)0x20000148 = 0; *(uint32_t*)0x2000014c = 0; *(uint32_t*)0x20000150 = 0; res = syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x200000c0ul, /*size=*/0x94ul); if (res != -1) r[5] = res; *(uint32_t*)0x20000180 = 3; *(uint32_t*)0x20000184 = 4; *(uint64_t*)0x20000188 = 0x20000580; memcpy( (void*)0x20000580, "\x85\x00\x00\x00\x2e\x00\x00\x00\x35\x00\x00\x00\x00\x00\xba\x00\x85\x00" "\x00\x00\x08\x00\x00\x00\x95\x00\x00\x00\x00\x00\x00\x00\x64\xf1\xc0\xdc" "\xf9\x5d\x68\x06\xf8\xa1\x57\x2b\x41\xa1\x41\x08\x24\x58\x18\x35\xd8\x05" "\x32\xcb\x45\x7f\x45\x46\x98\x16\x5b\x61\xa3\xcf\x5f\xc6\xdd\x84\x28\x23" "\x0e\x35\x23\x01\x63\xcf\x09\x49\x49\xfc\x8b\x0a\x91\x14\xf4\x3d\x1b\x65" "\x38\xf5\x97\x6b\xe4\xad\xc0\x7e\x8c\x97\xd7\x6b\x18\x95\xc3\x22\xa1\xef" "\x1f\x83\xdd\x6c\x10\x23\x15\x8a\x10\x86\xf7\xd0\xf9\xdc\xe4\x35\x55\x4b" "\xc3\x4e\x6b\xde\xa4\x21\x7c\xfa\xa9\xa1\xf8\xad\x10\x87\xc6\x97\xac\xd9" "\xa7\xab\x69\x69\x22\xc9\xe3\x5f\x0a\xee\x61\x56\xc5\x99\xc7\xb2\x97\xde" "\x00\x19\xb2\x7d\x67\xbf\xb3\xfe\x24\x14\x54\xa0\x40\x80\xbf\x7f\x8c\xe0" "\x21\x12\x9c\x82\x0f\x9b\x80\xfe\x04\xbe\x5b\x11\xcc\x7b\xf1\x6c\x8a\x02" "\x9d\xf5\x73\xdb\x05\x23\x57\xc7\x1b\xe1\xf5\xe8\xce\x8d\xb0\xf9\x6e\xe1" "\xd8\xa3\x12\xe9\x67\x1e\x65\x2b\xd6\x42\xdd\x65\xd5\xb9\xde\x99\x03\x8b" "\xc9\xa5\xd9\x05\x44\x1c\x07\x85\xd3\x33\x13\x5a\x04\x00\x01\x30\xaf\x1b" "\xb4\xcd\x5b\x29\x5b\x9a\xdd\x7a\x02\x47\xca\xda\x05\x6b\xe3\xa9\xe2\x9f" "\x9d\x4b\x57\xdd\xd4\x13\x0c\xcb\xbb\xcd\x6e\x00\x00\x00\x00\x00\x00\x00" "\x41\x02\xd7\x4c\x39\x1a\xcc\x08\x80\x31\x2c\xc8\xa8\xc5\x1c\x7b\xdd\xd3" "\x69\x8f\x62\x0a\x69\xf4\x69\x84\xc2\xa2\xe7\x42\xfa\xde\xcf\x6f\xa7\x00" "\x00\x00\x00\x00\x00\xf0\x01\x00\x00\x80\x00\x00\x00\x00\x1b\x7e\x62\xca" "\x8c\x35\x72\xc3\xdc\x46\xdc\x75\x79\xc1\x00\x01\x00\x00\x00\x00\x00\x00" "\x1a\xf7\xd2\x14\x9c\x8a\xb5\xef\x18\x70\x87\xf7\x4b\x65\xa6\xc7\xda\x15" "\x48\x53\x89\x44\x37\xff\xcb\x5c\xc3\xa2\xb1\x37\x59\xc4\x2b\x35\x0b\x09" "\xa6\x39\xa8\xf2\x57\xd8\x12\x04\xe7\xe6\x1b\x7f\x72\x30\xdb\x06\x1f\xab" "\xbd\xc6\x11\xdf\x11\x29\x69\x52\x65\xa3\x42\x6e\x02\xf9\xb2\x4e\xbc\x13" "\x55\xc3\xbd\xe3\x4d\x28\xc2\xbe\x85\x94\xaf\x30\x23\x1a\x56\x7d\x1f\x0a" "\xc5\x29\x7d\xaa\x6e\x9e\x82\xeb\x90\xc6\x02\xad\xff\xc6\xa3\xde\x64\xb1" "\xdb\x82\xac\x54\x7a\xaf\x07\x00\x00\x23\xae\xbb\xf4\x91\x74\x50\xe5\x4b" "\x98\x9c\x60\x65\xae\xaf\xe7\x08\xed\x91\xd8\x6e\xe0\xae\xbd\x84\x28\x15" "\xa9\xba\xd2\x26\xf1\xed\xa0\x90\x45\x6f\x50\x86\x30\x60\xf0\x74\xc0\x46" "\x9f\xb8\x27\x52\x04\x00\x00\x00\x00\x00\x0f\x00\xcd\xb6\x28\xb5\xf3\x71" "\xce\x3b\x14\x31\xb2\x72\x6c\xbd\x8b\x93\x3f\x3c\xe2\xd4\x52\xd4\x6d\x56" "\x3b\x25\x4f\xc3\xbe\xf4\x47\xd8\x69\xa8\xcc\x49\xe1\x60\x58\x1b\x4a\xe4" "\x3a\x81\x26\x4d\x49\x8b\x4b\x6e\x7c\x2f\x9b\xc9\x62\xda\x26\x0e\x69\x9a" "\x9a\x0d\x2d\xa3\x2c\x55\x50\x47\xca\xd7\xe5\xde\xef\xca\x3a\x09\x42\xd6" "\x17\x0a\xa7\x56\x48\xbd\x19\x13\x33\x73\xdc\xee\x41\xdd\xec\xe3\xfe\x4c" "\x11\x15\x58\xe0\xc4\xa3\x7c\xcb\x72\xe2\x6c\x31\x36\x2c\xfb\x96\x06\x94" "\x1d\xfd\xb1\x0f\xee\x16\xeb\x67\xab\x9e\x95\x7c\xa0\x1b\x83\x8d\xef\xa3" "\x34\xe3\x6f\x70\x32\x04\xb0\x1d\xd3\x94\xbd\x1d\xd0\x8b\x0e\x1a\xa9\xeb" "\x39\x6c\x61\xdc\x2b\x69\xbc\x6a\xec\x6e\x8d\x2a\x1c\x52\x40\xb7\x34\x89" "\x63\x65\xf8\x54\xed\x66\x3c\xc0\xab\x4c\x4a\x03\x46\x8e\xeb\xe3\x78\x6f" "\x77\x32\x7e\xd3\x13\x60\x55\x4b\x8b\xca\x4d\x90\xe8\xe7\xfe\xfe\xb9\x58" "\x31\xf4\x95\x37\xe3\xf0\x8a\xd0\x6b\xc6\xc0\xc1\x84\x2f\xe5\xdb\x58\x26" "\x77\xb6\xa6\x88\x6b\xbf", 762); *(uint64_t*)0x20000190 = 0x20001040; memcpy((void*)0x20001040, "GPL\000", 4); *(uint32_t*)0x20000198 = 0; *(uint32_t*)0x2000019c = 0x6b; *(uint64_t*)0x200001a0 = 0x200004c0; *(uint32_t*)0x200001a8 = 0; *(uint32_t*)0x200001ac = 0; memset((void*)0x200001b0, 0, 16); *(uint32_t*)0x200001c0 = 0; *(uint32_t*)0x200001c4 = 0; *(uint32_t*)0x200001c8 = -1; *(uint32_t*)0x200001cc = 8; *(uint64_t*)0x200001d0 = 0; *(uint32_t*)0x200001d8 = 0; *(uint32_t*)0x200001dc = 0x10; *(uint64_t*)0x200001e0 = 0; *(uint32_t*)0x200001e8 = 0; *(uint32_t*)0x200001ec = 0; *(uint32_t*)0x200001f0 = -1; *(uint32_t*)0x200001f4 = 0; *(uint64_t*)0x200001f8 = 0; *(uint64_t*)0x20000200 = 0; *(uint32_t*)0x20000208 = 0x10; *(uint32_t*)0x2000020c = 0; *(uint32_t*)0x20000210 = 0; res = syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x20000180ul, /*size=*/0x15ul); if (res != -1) r[6] = res; *(uint32_t*)0x20000500 = r[4]; *(uint64_t*)0x20000508 = 0x20000480; *(uint32_t*)0x20000480 = 0; *(uint64_t*)0x20000510 = 0x200004c0; *(uint32_t*)0x200004c0 = r[6]; *(uint64_t*)0x20000518 = 0; syscall(__NR_bpf, /*cmd=*/2ul, /*arg=*/0x20000500ul, /*size=*/0x20ul); *(uint32_t*)0x20000640 = 6; *(uint32_t*)0x20000644 = 0; *(uint64_t*)0x20000648 = 0; *(uint64_t*)0x20000650 = 0; *(uint32_t*)0x20000658 = 0; *(uint32_t*)0x2000065c = 0; *(uint64_t*)0x20000660 = 0; *(uint32_t*)0x20000668 = 0; *(uint32_t*)0x2000066c = 0; memset((void*)0x20000670, 0, 16); *(uint32_t*)0x20000680 = 0; *(uint32_t*)0x20000684 = 0x25; *(uint32_t*)0x20000688 = -1; *(uint32_t*)0x2000068c = 8; *(uint64_t*)0x20000690 = 0x20000280; *(uint32_t*)0x20000280 = 2; *(uint32_t*)0x20000284 = 0x80; *(uint32_t*)0x20000698 = 8; *(uint32_t*)0x2000069c = 0x10; *(uint64_t*)0x200006a0 = 0; *(uint32_t*)0x200006a8 = 0; *(uint32_t*)0x200006ac = 0; *(uint32_t*)0x200006b0 = 0; *(uint32_t*)0x200006b4 = 0; *(uint64_t*)0x200006b8 = 0; *(uint64_t*)0x200006c0 = 0; *(uint32_t*)0x200006c8 = 0x10; *(uint32_t*)0x200006cc = 0; *(uint32_t*)0x200006d0 = 0; syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x20000640ul, /*size=*/0x90ul); *(uint32_t*)0x20000240 = r[5]; *(uint32_t*)0x20000244 = -1; *(uint32_t*)0x20000248 = 0; syscall(__NR_bpf, /*cmd=*/0xaul, /*arg=*/0x20000240ul, /*size=*/0x57ul); memcpy((void*)0x20000180, "syz_tun\000\000\000\000\000\000\000\000\000", 16); res = syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x8933, /*arg=*/0x20000180ul); if (res != -1) r[7] = *(uint32_t*)0x20000190; *(uint64_t*)0x20000140 = 0; *(uint32_t*)0x20000148 = 0; *(uint64_t*)0x20000150 = 0x20000240; *(uint64_t*)0x20000240 = 0x20000880; *(uint32_t*)0x20000880 = 0x48; *(uint16_t*)0x20000884 = 0x13; *(uint16_t*)0x20000886 = 0xd1f5; *(uint32_t*)0x20000888 = 0; *(uint32_t*)0x2000088c = 0; *(uint8_t*)0x20000890 = 0; *(uint8_t*)0x20000891 = 0; *(uint16_t*)0x20000892 = 0; *(uint32_t*)0x20000894 = r[7]; *(uint32_t*)0x20000898 = 0; *(uint32_t*)0x2000089c = 0; *(uint16_t*)0x200008a0 = 8; *(uint16_t*)0x200008a2 = 0xd; *(uint32_t*)0x200008a4 = 0; *(uint16_t*)0x200008a8 = 0x18; STORE_BY_BITMASK(uint16_t, , 0x200008aa, 0x16, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x200008ab, 0, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x200008ab, 1, 7, 1); *(uint16_t*)0x200008ac = 0x14; STORE_BY_BITMASK(uint16_t, , 0x200008ae, 1, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x200008af, 0, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x200008af, 1, 7, 1); *(uint16_t*)0x200008b0 = 0x10; *(uint16_t*)0x200008b2 = 2; *(uint32_t*)0x200008b4 = 5; *(uint32_t*)0x200008b8 = 0x61e; *(uint32_t*)0x200008bc = 0xfffffffc; *(uint16_t*)0x200008c0 = 8; *(uint16_t*)0x200008c2 = 0x29; *(uint32_t*)0x200008c4 = 0x10000; *(uint64_t*)0x20000248 = 0x48; *(uint64_t*)0x20000158 = 1; *(uint64_t*)0x20000160 = 0; *(uint64_t*)0x20000168 = 0; *(uint32_t*)0x20000170 = 0x40010; syscall(__NR_sendmsg, /*fd=*/r[0], /*msg=*/0x20000140ul, /*f=*/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; do_sandbox_none(); return 0; }