// https://syzkaller.appspot.com/bug?id=1ae95fd6985c99562ddf13311bc775ddd9507abd // 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 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 void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); syscall(SYS_futex, &ev->state, FUTEX_WAKE | FUTEX_PRIVATE_FLAG, 1000000); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, 0); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; for (;;) { uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, &ts); if (__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) return 1; now = current_time_ms(); if (now - start > timeout) return 0; } } 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 struct nlmsg nlmsg; #define MAX_FDS 30 static void setup_gadgetfs(); static void setup_binderfs(); static void setup_fusectl(); static void sandbox_common_mount_tmpfs(void) { write_file("/proc/sys/fs/mount-max", "100000"); if (mkdir("./syz-tmp", 0777)) exit(1); if (mount("", "./syz-tmp", "tmpfs", 0, NULL)) exit(1); if (mkdir("./syz-tmp/newroot", 0777)) exit(1); if (mkdir("./syz-tmp/newroot/dev", 0700)) exit(1); unsigned bind_mount_flags = MS_BIND | MS_REC | MS_PRIVATE; if (mount("/dev", "./syz-tmp/newroot/dev", NULL, bind_mount_flags, NULL)) exit(1); if (mkdir("./syz-tmp/newroot/proc", 0700)) exit(1); if (mount("syz-proc", "./syz-tmp/newroot/proc", "proc", 0, NULL)) exit(1); if (mkdir("./syz-tmp/newroot/selinux", 0700)) exit(1); const char* selinux_path = "./syz-tmp/newroot/selinux"; if (mount("/selinux", selinux_path, NULL, bind_mount_flags, NULL)) { if (errno != ENOENT) exit(1); if (mount("/sys/fs/selinux", selinux_path, NULL, bind_mount_flags, NULL) && errno != ENOENT) exit(1); } if (mkdir("./syz-tmp/newroot/sys", 0700)) exit(1); if (mount("/sys", "./syz-tmp/newroot/sys", 0, bind_mount_flags, NULL)) exit(1); if (mount("/sys/kernel/debug", "./syz-tmp/newroot/sys/kernel/debug", NULL, bind_mount_flags, NULL) && errno != ENOENT) exit(1); if (mount("/sys/fs/smackfs", "./syz-tmp/newroot/sys/fs/smackfs", NULL, bind_mount_flags, NULL) && errno != ENOENT) exit(1); if (mount("/proc/sys/fs/binfmt_misc", "./syz-tmp/newroot/proc/sys/fs/binfmt_misc", NULL, bind_mount_flags, NULL) && errno != ENOENT) exit(1); if (mkdir("./syz-tmp/newroot/syz-inputs", 0700)) exit(1); if (mount("/syz-inputs", "./syz-tmp/newroot/syz-inputs", NULL, bind_mount_flags | MS_RDONLY, NULL) && errno != ENOENT) exit(1); if (mkdir("./syz-tmp/pivot", 0777)) exit(1); if (syscall(SYS_pivot_root, "./syz-tmp", "./syz-tmp/pivot")) { if (chdir("./syz-tmp")) exit(1); } else { if (chdir("/")) exit(1); if (umount2("./pivot", MNT_DETACH)) exit(1); } if (chroot("./newroot")) exit(1); if (chdir("/")) exit(1); setup_gadgetfs(); setup_binderfs(); setup_fusectl(); } static void setup_gadgetfs() { if (mkdir("/dev/gadgetfs", 0777)) { } if (mount("gadgetfs", "/dev/gadgetfs", "gadgetfs", 0, NULL)) { } } static void setup_fusectl() { if (mount(0, "/sys/fs/fuse/connections", "fusectl", 0, 0)) { } } static void setup_binderfs() { if (mkdir("/dev/binderfs", 0777)) { } if (mount("binder", "/dev/binderfs", "binder", 0, NULL)) { } } 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"); sandbox_common_mount_tmpfs(); 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 setup_test() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setpgrp(); write_file("/proc/self/oom_score_adj", "1000"); 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; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } int i, call, thread; for (call = 0; call < 16; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); close_fds(); } 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); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); setup_test(); execute_one(); 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[2] = {0xffffffffffffffff, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: // socket$inet6_tcp arguments: [ // domain: const = 0xa (8 bytes) // type: const = 0x1 (8 bytes) // proto: const = 0x0 (4 bytes) // ] // returns sock_tcp6 syscall(__NR_socket, /*domain=*/0xaul, /*type=*/1ul, /*proto=*/0); break; case 1: // openat$uinput arguments: [ // fd: const = 0xffffffffffffff9c (8 bytes) // file: ptr[in, buffer] { // buffer: {2f 64 65 76 2f 75 69 6e 70 75 74 00} (length 0xc) // } // flags: uinput_open_flags = 0x2 (4 bytes) // mode: const = 0x0 (2 bytes) // ] // returns fd_uinput NONFAILING(memcpy((void*)0x2000000000c0, "/dev/uinput\000", 12)); res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x2000000000c0ul, /*flags=O_RDWR*/ 2, /*mode=*/0); if (res != -1) r[0] = res; break; case 2: // write$uinput_user_dev arguments: [ // fd: fd_uinput (resource) // data: ptr[in, uinput_user_dev] { // uinput_user_dev { // name: buffer: {73 79 7a 31 00 00 00 00 00 00 00 00 00 00 00 00 00 // 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00} (length // 0x50) id: input_id { // bustype: int16 = 0x6ec9 (2 bytes) // vendor: int16 = 0x7 (2 bytes) // product: int16 = 0x5 (2 bytes) // version: int16 = 0x5 (2 bytes) // } // ff_effects_max: int32 = 0x3e (4 bytes) // absmax: array[int32] { // int32 = 0x9 (4 bytes) // int32 = 0x2 (4 bytes) // int32 = 0x8 (4 bytes) // int32 = 0x2 (4 bytes) // int32 = 0x5334 (4 bytes) // int32 = 0x400 (4 bytes) // int32 = 0x80000000 (4 bytes) // int32 = 0x5 (4 bytes) // int32 = 0x8 (4 bytes) // int32 = 0x0 (4 bytes) // int32 = 0x6 (4 bytes) // int32 = 0xf5 (4 bytes) // int32 = 0x9 (4 bytes) // int32 = 0x39 (4 bytes) // int32 = 0x747d5a13 (4 bytes) // int32 = 0x8 (4 bytes) // int32 = 0xfffffb9a (4 bytes) // int32 = 0xfffffffc (4 bytes) // int32 = 0x4 (4 bytes) // int32 = 0xfffffffb (4 bytes) // int32 = 0x4 (4 bytes) // int32 = 0x3 (4 bytes) // int32 = 0x4 (4 bytes) // int32 = 0xf252 (4 bytes) // int32 = 0x4 (4 bytes) // int32 = 0x800 (4 bytes) // int32 = 0x300000 (4 bytes) // int32 = 0x7 (4 bytes) // int32 = 0xe (4 bytes) // int32 = 0x4623b (4 bytes) // int32 = 0x0 (4 bytes) // int32 = 0x0 (4 bytes) // int32 = 0x1ff (4 bytes) // int32 = 0x8000 (4 bytes) // int32 = 0x3ff (4 bytes) // int32 = 0x3 (4 bytes) // int32 = 0xd (4 bytes) // int32 = 0x3 (4 bytes) // int32 = 0xba55 (4 bytes) // int32 = 0x1000 (4 bytes) // int32 = 0x2 (4 bytes) // int32 = 0x200 (4 bytes) // int32 = 0x2 (4 bytes) // int32 = 0x400008 (4 bytes) // int32 = 0xe (4 bytes) // int32 = 0x4 (4 bytes) // int32 = 0x2 (4 bytes) // int32 = 0x0 (4 bytes) // int32 = 0x8 (4 bytes) // int32 = 0x9 (4 bytes) // int32 = 0x1 (4 bytes) // int32 = 0x199f (4 bytes) // int32 = 0x8 (4 bytes) // int32 = 0x2 (4 bytes) // int32 = 0x9 (4 bytes) // int32 = 0x1 (4 bytes) // int32 = 0x4 (4 bytes) // int32 = 0x6 (4 bytes) // int32 = 0x1000 (4 bytes) // int32 = 0x5 (4 bytes) // int32 = 0x40 (4 bytes) // int32 = 0x9 (4 bytes) // int32 = 0x7 (4 bytes) // int32 = 0x5 (4 bytes) // } // absmin: array[int32] { // int32 = 0x6 (4 bytes) // int32 = 0x1e (4 bytes) // int32 = 0x3 (4 bytes) // int32 = 0x8000 (4 bytes) // int32 = 0xfffffffe (4 bytes) // int32 = 0x3 (4 bytes) // int32 = 0x0 (4 bytes) // int32 = 0x5 (4 bytes) // int32 = 0x7 (4 bytes) // int32 = 0xfffffffc (4 bytes) // int32 = 0x4 (4 bytes) // int32 = 0x7fff (4 bytes) // int32 = 0x72c (4 bytes) // int32 = 0x1c32 (4 bytes) // int32 = 0x3 (4 bytes) // int32 = 0x9 (4 bytes) // int32 = 0x10000 (4 bytes) // int32 = 0xf7 (4 bytes) // int32 = 0x8001 (4 bytes) // int32 = 0x3 (4 bytes) // int32 = 0x1 (4 bytes) // int32 = 0x297 (4 bytes) // int32 = 0x5 (4 bytes) // int32 = 0x0 (4 bytes) // int32 = 0x981 (4 bytes) // int32 = 0x4 (4 bytes) // int32 = 0x100 (4 bytes) // int32 = 0x3ff (4 bytes) // int32 = 0x0 (4 bytes) // int32 = 0xfffffffe (4 bytes) // int32 = 0x0 (4 bytes) // int32 = 0x1000001 (4 bytes) // int32 = 0x12 (4 bytes) // int32 = 0xfffffff9 (4 bytes) // int32 = 0x0 (4 bytes) // int32 = 0x5 (4 bytes) // int32 = 0x1 (4 bytes) // int32 = 0xffffffff (4 bytes) // int32 = 0x6 (4 bytes) // int32 = 0x5 (4 bytes) // int32 = 0x800 (4 bytes) // int32 = 0xffff (4 bytes) // int32 = 0x6 (4 bytes) // int32 = 0x96 (4 bytes) // int32 = 0xfffffffd (4 bytes) // int32 = 0x101 (4 bytes) // int32 = 0x0 (4 bytes) // int32 = 0x2 (4 bytes) // int32 = 0x401 (4 bytes) // int32 = 0xc (4 bytes) // int32 = 0x3 (4 bytes) // int32 = 0x379 (4 bytes) // int32 = 0x9 (4 bytes) // int32 = 0x200 (4 bytes) // int32 = 0x5 (4 bytes) // int32 = 0x7 (4 bytes) // int32 = 0x6 (4 bytes) // int32 = 0x2 (4 bytes) // int32 = 0x1 (4 bytes) // int32 = 0x1 (4 bytes) // int32 = 0x8 (4 bytes) // int32 = 0x6 (4 bytes) // int32 = 0x200 (4 bytes) // int32 = 0x3 (4 bytes) // } // absfuzz: array[int32] { // int32 = 0x401 (4 bytes) // int32 = 0xc584 (4 bytes) // int32 = 0xffff (4 bytes) // int32 = 0xcd5 (4 bytes) // int32 = 0x7 (4 bytes) // int32 = 0x20 (4 bytes) // int32 = 0x7 (4 bytes) // int32 = 0x4 (4 bytes) // int32 = 0x8 (4 bytes) // int32 = 0x437 (4 bytes) // int32 = 0x7 (4 bytes) // int32 = 0x9 (4 bytes) // int32 = 0xe8b (4 bytes) // int32 = 0x5 (4 bytes) // int32 = 0x80000001 (4 bytes) // int32 = 0x8 (4 bytes) // int32 = 0xffffffff (4 bytes) // int32 = 0x1000 (4 bytes) // int32 = 0x2 (4 bytes) // int32 = 0x10 (4 bytes) // int32 = 0x1 (4 bytes) // int32 = 0xfffffff9 (4 bytes) // int32 = 0xe55 (4 bytes) // int32 = 0x10 (4 bytes) // int32 = 0x80000001 (4 bytes) // int32 = 0x4 (4 bytes) // int32 = 0xf5e (4 bytes) // int32 = 0x5 (4 bytes) // int32 = 0x9 (4 bytes) // int32 = 0x2 (4 bytes) // int32 = 0x20000005 (4 bytes) // int32 = 0x80 (4 bytes) // int32 = 0x9 (4 bytes) // int32 = 0x9 (4 bytes) // int32 = 0x47 (4 bytes) // int32 = 0x2 (4 bytes) // int32 = 0x3 (4 bytes) // int32 = 0x4 (4 bytes) // int32 = 0x7 (4 bytes) // int32 = 0x6d7e (4 bytes) // int32 = 0x3 (4 bytes) // int32 = 0x4 (4 bytes) // int32 = 0x8001 (4 bytes) // int32 = 0xbf23 (4 bytes) // int32 = 0x6 (4 bytes) // int32 = 0x8 (4 bytes) // int32 = 0x95a (4 bytes) // int32 = 0xffffffff (4 bytes) // int32 = 0x4 (4 bytes) // int32 = 0x3 (4 bytes) // int32 = 0x6 (4 bytes) // int32 = 0x100fffe (4 bytes) // int32 = 0x2005 (4 bytes) // int32 = 0x7 (4 bytes) // int32 = 0x4 (4 bytes) // int32 = 0xea (4 bytes) // int32 = 0x9 (4 bytes) // int32 = 0x5 (4 bytes) // int32 = 0x2 (4 bytes) // int32 = 0xd9 (4 bytes) // int32 = 0x0 (4 bytes) // int32 = 0x7ff (4 bytes) // int32 = 0x401 (4 bytes) // int32 = 0x5 (4 bytes) // } // absflat: array[int32] { // int32 = 0x108e (4 bytes) // int32 = 0x7fff (4 bytes) // int32 = 0x3 (4 bytes) // int32 = 0x3 (4 bytes) // int32 = 0x88 (4 bytes) // int32 = 0x2 (4 bytes) // int32 = 0x9 (4 bytes) // int32 = 0x4 (4 bytes) // int32 = 0x50 (4 bytes) // int32 = 0x8 (4 bytes) // int32 = 0x763 (4 bytes) // int32 = 0xb (4 bytes) // int32 = 0x402 (4 bytes) // int32 = 0x800 (4 bytes) // int32 = 0x2 (4 bytes) // int32 = 0x1000 (4 bytes) // int32 = 0x7f (4 bytes) // int32 = 0x5 (4 bytes) // int32 = 0x3fa6 (4 bytes) // int32 = 0x4 (4 bytes) // int32 = 0x0 (4 bytes) // int32 = 0x5 (4 bytes) // int32 = 0x1e0 (4 bytes) // int32 = 0x4 (4 bytes) // int32 = 0xe47 (4 bytes) // int32 = 0x3 (4 bytes) // int32 = 0x3 (4 bytes) // int32 = 0x4 (4 bytes) // int32 = 0x200 (4 bytes) // int32 = 0x1000 (4 bytes) // int32 = 0x403e (4 bytes) // int32 = 0x2 (4 bytes) // int32 = 0x5 (4 bytes) // int32 = 0x800 (4 bytes) // int32 = 0xa80a (4 bytes) // int32 = 0x65f413f9 (4 bytes) // int32 = 0x4 (4 bytes) // int32 = 0x8 (4 bytes) // int32 = 0x8a8 (4 bytes) // int32 = 0x2 (4 bytes) // int32 = 0x40 (4 bytes) // int32 = 0x7 (4 bytes) // int32 = 0x2 (4 bytes) // int32 = 0x4 (4 bytes) // int32 = 0x4 (4 bytes) // int32 = 0x10 (4 bytes) // int32 = 0x0 (4 bytes) // int32 = 0x0 (4 bytes) // int32 = 0x7fff (4 bytes) // int32 = 0x1 (4 bytes) // int32 = 0xfffffff8 (4 bytes) // int32 = 0x401 (4 bytes) // int32 = 0x1 (4 bytes) // int32 = 0x200 (4 bytes) // int32 = 0x7 (4 bytes) // int32 = 0x4edf (4 bytes) // int32 = 0xfffffffd (4 bytes) // int32 = 0x7 (4 bytes) // int32 = 0xe (4 bytes) // int32 = 0xffffffff (4 bytes) // int32 = 0xe (4 bytes) // int32 = 0xf (4 bytes) // int32 = 0x133 (4 bytes) // int32 = 0x6 (4 bytes) // } // } // } // len: len = 0x45c (8 bytes) // ] NONFAILING(memcpy( (void*)0x200000000a00, "syz1\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" "\000\000\000\000\000\000\000\000\000", 80)); NONFAILING(*(uint16_t*)0x200000000a50 = 0x6ec9); NONFAILING(*(uint16_t*)0x200000000a52 = 7); NONFAILING(*(uint16_t*)0x200000000a54 = 5); NONFAILING(*(uint16_t*)0x200000000a56 = 5); NONFAILING(*(uint32_t*)0x200000000a58 = 0x3e); NONFAILING(*(uint32_t*)0x200000000a5c = 9); NONFAILING(*(uint32_t*)0x200000000a60 = 2); NONFAILING(*(uint32_t*)0x200000000a64 = 8); NONFAILING(*(uint32_t*)0x200000000a68 = 2); NONFAILING(*(uint32_t*)0x200000000a6c = 0x5334); NONFAILING(*(uint32_t*)0x200000000a70 = 0x400); NONFAILING(*(uint32_t*)0x200000000a74 = 0x80000000); NONFAILING(*(uint32_t*)0x200000000a78 = 5); NONFAILING(*(uint32_t*)0x200000000a7c = 8); NONFAILING(*(uint32_t*)0x200000000a80 = 0); NONFAILING(*(uint32_t*)0x200000000a84 = 6); NONFAILING(*(uint32_t*)0x200000000a88 = 0xf5); NONFAILING(*(uint32_t*)0x200000000a8c = 9); NONFAILING(*(uint32_t*)0x200000000a90 = 0x39); NONFAILING(*(uint32_t*)0x200000000a94 = 0x747d5a13); NONFAILING(*(uint32_t*)0x200000000a98 = 8); NONFAILING(*(uint32_t*)0x200000000a9c = 0xfffffb9a); NONFAILING(*(uint32_t*)0x200000000aa0 = 0xfffffffc); NONFAILING(*(uint32_t*)0x200000000aa4 = 4); NONFAILING(*(uint32_t*)0x200000000aa8 = 0xfffffffb); NONFAILING(*(uint32_t*)0x200000000aac = 4); NONFAILING(*(uint32_t*)0x200000000ab0 = 3); NONFAILING(*(uint32_t*)0x200000000ab4 = 4); NONFAILING(*(uint32_t*)0x200000000ab8 = 0xf252); NONFAILING(*(uint32_t*)0x200000000abc = 4); NONFAILING(*(uint32_t*)0x200000000ac0 = 0x800); NONFAILING(*(uint32_t*)0x200000000ac4 = 0x300000); NONFAILING(*(uint32_t*)0x200000000ac8 = 7); NONFAILING(*(uint32_t*)0x200000000acc = 0xe); NONFAILING(*(uint32_t*)0x200000000ad0 = 0x4623b); NONFAILING(*(uint32_t*)0x200000000ad4 = 0); NONFAILING(*(uint32_t*)0x200000000ad8 = 0); NONFAILING(*(uint32_t*)0x200000000adc = 0x1ff); NONFAILING(*(uint32_t*)0x200000000ae0 = 0x8000); NONFAILING(*(uint32_t*)0x200000000ae4 = 0x3ff); NONFAILING(*(uint32_t*)0x200000000ae8 = 3); NONFAILING(*(uint32_t*)0x200000000aec = 0xd); NONFAILING(*(uint32_t*)0x200000000af0 = 3); NONFAILING(*(uint32_t*)0x200000000af4 = 0xba55); NONFAILING(*(uint32_t*)0x200000000af8 = 0x1000); NONFAILING(*(uint32_t*)0x200000000afc = 2); NONFAILING(*(uint32_t*)0x200000000b00 = 0x200); NONFAILING(*(uint32_t*)0x200000000b04 = 2); NONFAILING(*(uint32_t*)0x200000000b08 = 0x400008); NONFAILING(*(uint32_t*)0x200000000b0c = 0xe); NONFAILING(*(uint32_t*)0x200000000b10 = 4); NONFAILING(*(uint32_t*)0x200000000b14 = 2); NONFAILING(*(uint32_t*)0x200000000b18 = 0); NONFAILING(*(uint32_t*)0x200000000b1c = 8); NONFAILING(*(uint32_t*)0x200000000b20 = 9); NONFAILING(*(uint32_t*)0x200000000b24 = 1); NONFAILING(*(uint32_t*)0x200000000b28 = 0x199f); NONFAILING(*(uint32_t*)0x200000000b2c = 8); NONFAILING(*(uint32_t*)0x200000000b30 = 2); NONFAILING(*(uint32_t*)0x200000000b34 = 9); NONFAILING(*(uint32_t*)0x200000000b38 = 1); NONFAILING(*(uint32_t*)0x200000000b3c = 4); NONFAILING(*(uint32_t*)0x200000000b40 = 6); NONFAILING(*(uint32_t*)0x200000000b44 = 0x1000); NONFAILING(*(uint32_t*)0x200000000b48 = 5); NONFAILING(*(uint32_t*)0x200000000b4c = 0x40); NONFAILING(*(uint32_t*)0x200000000b50 = 9); NONFAILING(*(uint32_t*)0x200000000b54 = 7); NONFAILING(*(uint32_t*)0x200000000b58 = 5); NONFAILING(*(uint32_t*)0x200000000b5c = 6); NONFAILING(*(uint32_t*)0x200000000b60 = 0x1e); NONFAILING(*(uint32_t*)0x200000000b64 = 3); NONFAILING(*(uint32_t*)0x200000000b68 = 0x8000); NONFAILING(*(uint32_t*)0x200000000b6c = 0xfffffffe); NONFAILING(*(uint32_t*)0x200000000b70 = 3); NONFAILING(*(uint32_t*)0x200000000b74 = 0); NONFAILING(*(uint32_t*)0x200000000b78 = 5); NONFAILING(*(uint32_t*)0x200000000b7c = 7); NONFAILING(*(uint32_t*)0x200000000b80 = 0xfffffffc); NONFAILING(*(uint32_t*)0x200000000b84 = 4); NONFAILING(*(uint32_t*)0x200000000b88 = 0x7fff); NONFAILING(*(uint32_t*)0x200000000b8c = 0x72c); NONFAILING(*(uint32_t*)0x200000000b90 = 0x1c32); NONFAILING(*(uint32_t*)0x200000000b94 = 3); NONFAILING(*(uint32_t*)0x200000000b98 = 9); NONFAILING(*(uint32_t*)0x200000000b9c = 0x10000); NONFAILING(*(uint32_t*)0x200000000ba0 = 0xf7); NONFAILING(*(uint32_t*)0x200000000ba4 = 0x8001); NONFAILING(*(uint32_t*)0x200000000ba8 = 3); NONFAILING(*(uint32_t*)0x200000000bac = 1); NONFAILING(*(uint32_t*)0x200000000bb0 = 0x297); NONFAILING(*(uint32_t*)0x200000000bb4 = 5); NONFAILING(*(uint32_t*)0x200000000bb8 = 0); NONFAILING(*(uint32_t*)0x200000000bbc = 0x981); NONFAILING(*(uint32_t*)0x200000000bc0 = 4); NONFAILING(*(uint32_t*)0x200000000bc4 = 0x100); NONFAILING(*(uint32_t*)0x200000000bc8 = 0x3ff); NONFAILING(*(uint32_t*)0x200000000bcc = 0); NONFAILING(*(uint32_t*)0x200000000bd0 = 0xfffffffe); NONFAILING(*(uint32_t*)0x200000000bd4 = 0); NONFAILING(*(uint32_t*)0x200000000bd8 = 0x1000001); NONFAILING(*(uint32_t*)0x200000000bdc = 0x12); NONFAILING(*(uint32_t*)0x200000000be0 = 0xfffffff9); NONFAILING(*(uint32_t*)0x200000000be4 = 0); NONFAILING(*(uint32_t*)0x200000000be8 = 5); NONFAILING(*(uint32_t*)0x200000000bec = 1); NONFAILING(*(uint32_t*)0x200000000bf0 = -1); NONFAILING(*(uint32_t*)0x200000000bf4 = 6); NONFAILING(*(uint32_t*)0x200000000bf8 = 5); NONFAILING(*(uint32_t*)0x200000000bfc = 0x800); NONFAILING(*(uint32_t*)0x200000000c00 = 0xffff); NONFAILING(*(uint32_t*)0x200000000c04 = 6); NONFAILING(*(uint32_t*)0x200000000c08 = 0x96); NONFAILING(*(uint32_t*)0x200000000c0c = 0xfffffffd); NONFAILING(*(uint32_t*)0x200000000c10 = 0x101); NONFAILING(*(uint32_t*)0x200000000c14 = 0); NONFAILING(*(uint32_t*)0x200000000c18 = 2); NONFAILING(*(uint32_t*)0x200000000c1c = 0x401); NONFAILING(*(uint32_t*)0x200000000c20 = 0xc); NONFAILING(*(uint32_t*)0x200000000c24 = 3); NONFAILING(*(uint32_t*)0x200000000c28 = 0x379); NONFAILING(*(uint32_t*)0x200000000c2c = 9); NONFAILING(*(uint32_t*)0x200000000c30 = 0x200); NONFAILING(*(uint32_t*)0x200000000c34 = 5); NONFAILING(*(uint32_t*)0x200000000c38 = 7); NONFAILING(*(uint32_t*)0x200000000c3c = 6); NONFAILING(*(uint32_t*)0x200000000c40 = 2); NONFAILING(*(uint32_t*)0x200000000c44 = 1); NONFAILING(*(uint32_t*)0x200000000c48 = 1); NONFAILING(*(uint32_t*)0x200000000c4c = 8); NONFAILING(*(uint32_t*)0x200000000c50 = 6); NONFAILING(*(uint32_t*)0x200000000c54 = 0x200); NONFAILING(*(uint32_t*)0x200000000c58 = 3); NONFAILING(*(uint32_t*)0x200000000c5c = 0x401); NONFAILING(*(uint32_t*)0x200000000c60 = 0xc584); NONFAILING(*(uint32_t*)0x200000000c64 = 0xffff); NONFAILING(*(uint32_t*)0x200000000c68 = 0xcd5); NONFAILING(*(uint32_t*)0x200000000c6c = 7); NONFAILING(*(uint32_t*)0x200000000c70 = 0x20); NONFAILING(*(uint32_t*)0x200000000c74 = 7); NONFAILING(*(uint32_t*)0x200000000c78 = 4); NONFAILING(*(uint32_t*)0x200000000c7c = 8); NONFAILING(*(uint32_t*)0x200000000c80 = 0x437); NONFAILING(*(uint32_t*)0x200000000c84 = 7); NONFAILING(*(uint32_t*)0x200000000c88 = 9); NONFAILING(*(uint32_t*)0x200000000c8c = 0xe8b); NONFAILING(*(uint32_t*)0x200000000c90 = 5); NONFAILING(*(uint32_t*)0x200000000c94 = 0x80000001); NONFAILING(*(uint32_t*)0x200000000c98 = 8); NONFAILING(*(uint32_t*)0x200000000c9c = -1); NONFAILING(*(uint32_t*)0x200000000ca0 = 0x1000); NONFAILING(*(uint32_t*)0x200000000ca4 = 2); NONFAILING(*(uint32_t*)0x200000000ca8 = 0x10); NONFAILING(*(uint32_t*)0x200000000cac = 1); NONFAILING(*(uint32_t*)0x200000000cb0 = 0xfffffff9); NONFAILING(*(uint32_t*)0x200000000cb4 = 0xe55); NONFAILING(*(uint32_t*)0x200000000cb8 = 0x10); NONFAILING(*(uint32_t*)0x200000000cbc = 0x80000001); NONFAILING(*(uint32_t*)0x200000000cc0 = 4); NONFAILING(*(uint32_t*)0x200000000cc4 = 0xf5e); NONFAILING(*(uint32_t*)0x200000000cc8 = 5); NONFAILING(*(uint32_t*)0x200000000ccc = 9); NONFAILING(*(uint32_t*)0x200000000cd0 = 2); NONFAILING(*(uint32_t*)0x200000000cd4 = 0x20000005); NONFAILING(*(uint32_t*)0x200000000cd8 = 0x80); NONFAILING(*(uint32_t*)0x200000000cdc = 9); NONFAILING(*(uint32_t*)0x200000000ce0 = 9); NONFAILING(*(uint32_t*)0x200000000ce4 = 0x47); NONFAILING(*(uint32_t*)0x200000000ce8 = 2); NONFAILING(*(uint32_t*)0x200000000cec = 3); NONFAILING(*(uint32_t*)0x200000000cf0 = 4); NONFAILING(*(uint32_t*)0x200000000cf4 = 7); NONFAILING(*(uint32_t*)0x200000000cf8 = 0x6d7e); NONFAILING(*(uint32_t*)0x200000000cfc = 3); NONFAILING(*(uint32_t*)0x200000000d00 = 4); NONFAILING(*(uint32_t*)0x200000000d04 = 0x8001); NONFAILING(*(uint32_t*)0x200000000d08 = 0xbf23); NONFAILING(*(uint32_t*)0x200000000d0c = 6); NONFAILING(*(uint32_t*)0x200000000d10 = 8); NONFAILING(*(uint32_t*)0x200000000d14 = 0x95a); NONFAILING(*(uint32_t*)0x200000000d18 = -1); NONFAILING(*(uint32_t*)0x200000000d1c = 4); NONFAILING(*(uint32_t*)0x200000000d20 = 3); NONFAILING(*(uint32_t*)0x200000000d24 = 6); NONFAILING(*(uint32_t*)0x200000000d28 = 0x100fffe); NONFAILING(*(uint32_t*)0x200000000d2c = 0x2005); NONFAILING(*(uint32_t*)0x200000000d30 = 7); NONFAILING(*(uint32_t*)0x200000000d34 = 4); NONFAILING(*(uint32_t*)0x200000000d38 = 0xea); NONFAILING(*(uint32_t*)0x200000000d3c = 9); NONFAILING(*(uint32_t*)0x200000000d40 = 5); NONFAILING(*(uint32_t*)0x200000000d44 = 2); NONFAILING(*(uint32_t*)0x200000000d48 = 0xd9); NONFAILING(*(uint32_t*)0x200000000d4c = 0); NONFAILING(*(uint32_t*)0x200000000d50 = 0x7ff); NONFAILING(*(uint32_t*)0x200000000d54 = 0x401); NONFAILING(*(uint32_t*)0x200000000d58 = 5); NONFAILING(*(uint32_t*)0x200000000d5c = 0x108e); NONFAILING(*(uint32_t*)0x200000000d60 = 0x7fff); NONFAILING(*(uint32_t*)0x200000000d64 = 3); NONFAILING(*(uint32_t*)0x200000000d68 = 3); NONFAILING(*(uint32_t*)0x200000000d6c = 0x88); NONFAILING(*(uint32_t*)0x200000000d70 = 2); NONFAILING(*(uint32_t*)0x200000000d74 = 9); NONFAILING(*(uint32_t*)0x200000000d78 = 4); NONFAILING(*(uint32_t*)0x200000000d7c = 0x50); NONFAILING(*(uint32_t*)0x200000000d80 = 8); NONFAILING(*(uint32_t*)0x200000000d84 = 0x763); NONFAILING(*(uint32_t*)0x200000000d88 = 0xb); NONFAILING(*(uint32_t*)0x200000000d8c = 0x402); NONFAILING(*(uint32_t*)0x200000000d90 = 0x800); NONFAILING(*(uint32_t*)0x200000000d94 = 2); NONFAILING(*(uint32_t*)0x200000000d98 = 0x1000); NONFAILING(*(uint32_t*)0x200000000d9c = 0x7f); NONFAILING(*(uint32_t*)0x200000000da0 = 5); NONFAILING(*(uint32_t*)0x200000000da4 = 0x3fa6); NONFAILING(*(uint32_t*)0x200000000da8 = 4); NONFAILING(*(uint32_t*)0x200000000dac = 0); NONFAILING(*(uint32_t*)0x200000000db0 = 5); NONFAILING(*(uint32_t*)0x200000000db4 = 0x1e0); NONFAILING(*(uint32_t*)0x200000000db8 = 4); NONFAILING(*(uint32_t*)0x200000000dbc = 0xe47); NONFAILING(*(uint32_t*)0x200000000dc0 = 3); NONFAILING(*(uint32_t*)0x200000000dc4 = 3); NONFAILING(*(uint32_t*)0x200000000dc8 = 4); NONFAILING(*(uint32_t*)0x200000000dcc = 0x200); NONFAILING(*(uint32_t*)0x200000000dd0 = 0x1000); NONFAILING(*(uint32_t*)0x200000000dd4 = 0x403e); NONFAILING(*(uint32_t*)0x200000000dd8 = 2); NONFAILING(*(uint32_t*)0x200000000ddc = 5); NONFAILING(*(uint32_t*)0x200000000de0 = 0x800); NONFAILING(*(uint32_t*)0x200000000de4 = 0xa80a); NONFAILING(*(uint32_t*)0x200000000de8 = 0x65f413f9); NONFAILING(*(uint32_t*)0x200000000dec = 4); NONFAILING(*(uint32_t*)0x200000000df0 = 8); NONFAILING(*(uint32_t*)0x200000000df4 = 0x8a8); NONFAILING(*(uint32_t*)0x200000000df8 = 2); NONFAILING(*(uint32_t*)0x200000000dfc = 0x40); NONFAILING(*(uint32_t*)0x200000000e00 = 7); NONFAILING(*(uint32_t*)0x200000000e04 = 2); NONFAILING(*(uint32_t*)0x200000000e08 = 4); NONFAILING(*(uint32_t*)0x200000000e0c = 4); NONFAILING(*(uint32_t*)0x200000000e10 = 0x10); NONFAILING(*(uint32_t*)0x200000000e14 = 0); NONFAILING(*(uint32_t*)0x200000000e18 = 0); NONFAILING(*(uint32_t*)0x200000000e1c = 0x7fff); NONFAILING(*(uint32_t*)0x200000000e20 = 1); NONFAILING(*(uint32_t*)0x200000000e24 = 0xfffffff8); NONFAILING(*(uint32_t*)0x200000000e28 = 0x401); NONFAILING(*(uint32_t*)0x200000000e2c = 1); NONFAILING(*(uint32_t*)0x200000000e30 = 0x200); NONFAILING(*(uint32_t*)0x200000000e34 = 7); NONFAILING(*(uint32_t*)0x200000000e38 = 0x4edf); NONFAILING(*(uint32_t*)0x200000000e3c = 0xfffffffd); NONFAILING(*(uint32_t*)0x200000000e40 = 7); NONFAILING(*(uint32_t*)0x200000000e44 = 0xe); NONFAILING(*(uint32_t*)0x200000000e48 = -1); NONFAILING(*(uint32_t*)0x200000000e4c = 0xe); NONFAILING(*(uint32_t*)0x200000000e50 = 0xf); NONFAILING(*(uint32_t*)0x200000000e54 = 0x133); NONFAILING(*(uint32_t*)0x200000000e58 = 6); syscall(__NR_write, /*fd=*/r[0], /*data=*/0x200000000a00ul, /*len=*/0x45cul); break; case 3: // ioctl$UI_DEV_CREATE arguments: [ // fd: fd_uinput (resource) // cmd: const = 0x5501 (4 bytes) // ] syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x5501, 0); break; case 4: // timer_create arguments: [ // id: clock_id = 0x0 (8 bytes) // ev: ptr[in, sigevent] { // sigevent { // val: const = 0x0 (8 bytes) // signo: int32 = 0x21 (4 bytes) // notify: sigev_notify = 0x2 (4 bytes) // u: union sigevent_u { // thr: sigevent_thread { // func: nil // attr: nil // } // } // pad = 0x0 (32 bytes) // } // } // timerid: ptr[out, timerid] { // timerid (resource) // } // ] NONFAILING(*(uint64_t*)0x2000000000c0 = 0); NONFAILING(*(uint32_t*)0x2000000000c8 = 0x21); NONFAILING(*(uint32_t*)0x2000000000cc = 2); NONFAILING(*(uint64_t*)0x2000000000d0 = 0); NONFAILING(*(uint64_t*)0x2000000000d8 = 0); res = syscall(__NR_timer_create, /*id=*/0ul, /*ev=*/0x2000000000c0ul, /*timerid=*/0x200000000300ul); if (res != -1) NONFAILING(r[1] = *(uint32_t*)0x200000000300); break; case 5: // fcntl$lock arguments: [ // fd: fd (resource) // cmd: fcntl_lock = 0x24 (8 bytes) // lock: ptr[in, flock] { // flock { // type: flock_type = 0x0 (2 bytes) // whence: seek_whence = 0x0 (2 bytes) // pad = 0x0 (4 bytes) // start: intptr = 0x10001 (8 bytes) // len: intptr = 0x5 (8 bytes) // pid: pid (resource) // pad = 0x0 (4 bytes) // } // } // ] NONFAILING(*(uint16_t*)0x200000000040 = 0); NONFAILING(*(uint16_t*)0x200000000042 = 0); NONFAILING(*(uint64_t*)0x200000000048 = 0x10001); NONFAILING(*(uint64_t*)0x200000000050 = 5); NONFAILING(*(uint32_t*)0x200000000058 = 0); syscall(__NR_fcntl, /*fd=*/(intptr_t)-1, /*cmd=F_OFD_GETLK*/ 0x24ul, /*lock=*/0x200000000040ul); break; case 6: // mprotect arguments: [ // addr: VMA[0xf000] // len: len = 0xf000 (8 bytes) // prot: mmap_prot = 0x1 (8 bytes) // ] syscall(__NR_mprotect, /*addr=*/0x200000000000ul, /*len=*/0xf000ul, /*prot=PROT_READ*/ 1ul); break; case 7: // timer_settime arguments: [ // timerid: timerid (resource) // flags: timer_flags = 0x1 (8 bytes) // new: ptr[in, itimerspec] { // itimerspec { // interv: timespec { // sec: time_sec (resource) // nsec: time_nsec (resource) // } // value: timespec { // sec: time_sec (resource) // nsec: time_nsec (resource) // } // } // } // old: nil // ] NONFAILING(*(uint64_t*)0x200000000040 = 0); NONFAILING(*(uint64_t*)0x200000000048 = 0); NONFAILING(*(uint64_t*)0x200000000050 = 0); NONFAILING(*(uint64_t*)0x200000000058 = 0x989680); syscall(__NR_timer_settime, /*timerid=*/r[1], /*flags=TIMER_ABSTIME*/ 1ul, /*new=*/0x200000000040ul, /*old=*/0ul); break; case 8: // mmap arguments: [ // addr: VMA[0x200000] // len: len = 0x200000 (8 bytes) // prot: mmap_prot = 0x300000b (8 bytes) // flags: mmap_flags = 0x204031 (8 bytes) // fd: fd (resource) // offset: intptr = 0xec776000 (8 bytes) // ] syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0x200000ul, /*prot=PROT_GROWSUP|PROT_GROWSDOWN|PROT_SEM|PROT_WRITE|PROT_READ*/ 0x300000bul, /*flags=MAP_NORESERVE|MAP_FIXED|MAP_ANONYMOUS|MAP_SHARED|0x200000*/ 0x204031ul, /*fd=*/(intptr_t)-1, /*offset=*/0xec776000ul); break; case 9: // prlimit64 arguments: [ // pid: pid (resource) // res: rlimit_type = 0xe (8 bytes) // new: ptr[in, rlimit] { // rlimit { // soft: intptr = 0x8 (8 bytes) // hard: intptr = 0x80000100008b (8 bytes) // } // } // old: nil // ] NONFAILING(*(uint64_t*)0x200000000100 = 8); NONFAILING(*(uint64_t*)0x200000000108 = 0x80000100008b); syscall(__NR_prlimit64, /*pid=*/0, /*res=RLIMIT_RTPRIO*/ 0xeul, /*new=*/0x200000000100ul, /*old=*/0ul); break; case 10: // sched_setscheduler arguments: [ // pid: pid (resource) // policy: sched_policy = 0x1 (8 bytes) // prio: ptr[in, int32] { // int32 = 0x7 (4 bytes) // } // ] NONFAILING(*(uint32_t*)0x200000000300 = 7); syscall(__NR_sched_setscheduler, /*pid=*/0, /*policy=SCHED_FIFO*/ 1ul, /*prio=*/0x200000000300ul); break; case 11: // readv arguments: [ // fd: fd (resource) // vec: ptr[in, array[iovec[out, array[int8]]]] { // array[iovec[out, array[int8]]] { // iovec[out, array[int8]] { // addr: ptr[out, buffer] { // buffer: (DirOut) // } // len: len = 0x18 (8 bytes) // } // } // } // vlen: len = 0x1 (8 bytes) // ] NONFAILING(*(uint64_t*)0x200000000140 = 0x200000000040); NONFAILING(*(uint64_t*)0x200000000148 = 0x18); syscall(__NR_readv, /*fd=*/r[0], /*vec=*/0x200000000140ul, /*vlen=*/1ul); break; case 12: // socket$inet6_sctp arguments: [ // domain: const = 0xa (8 bytes) // type: sctp_socket_type = 0x1 (8 bytes) // proto: const = 0x84 (4 bytes) // ] // returns sock_sctp6 syscall(__NR_socket, /*domain=*/0xaul, /*type=SOCK_STREAM*/ 1ul, /*proto=*/0x84); break; case 13: // setsockopt$inet_sctp6_SCTP_ENABLE_STREAM_RESET arguments: [ // fd: sock_sctp6 (resource) // level: const = 0x84 (4 bytes) // opt: const = 0x76 (4 bytes) // val: nil // len: len = 0x0 (8 bytes) // ] syscall(__NR_setsockopt, /*fd=*/(intptr_t)-1, /*level=*/0x84, /*opt=*/0x76, /*val=*/0ul, /*len=*/0ul); break; case 14: // ioctl$TIOCVHANGUP arguments: [ // fd: fd_tty (resource) // cmd: const = 0x5437 (4 bytes) // arg: const = 0x0 (8 bytes) // ] syscall(__NR_ioctl, /*fd=*/(intptr_t)-1, /*cmd=*/0x5437, /*arg=*/0ul); break; case 15: // socket$inet_udp arguments: [ // domain: const = 0x2 (8 bytes) // type: const = 0x2 (8 bytes) // proto: const = 0x0 (4 bytes) // ] // returns sock_udp syscall(__NR_socket, /*domain=*/2ul, /*type=*/2ul, /*proto=*/0); break; } } int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0x1000000ul, /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/ 7ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x200001000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); const char* reason; (void)reason; 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); install_segv_handler(); for (procid = 0; procid < 4; procid++) { if (fork() == 0) { use_temporary_dir(); do_sandbox_none(); } } sleep(1000000); return 0; }