// https://syzkaller.appspot.com/bug?id=9783833d68792f80bc7f8d2ede932cb29aaf6462 // 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 #ifndef __NR_bpf #define __NR_bpf 321 #endif #ifndef __NR_execveat #define __NR_execveat 322 #endif #ifndef __NR_fsconfig #define __NR_fsconfig 431 #endif #ifndef __NR_fsmount #define __NR_fsmount 432 #endif #ifndef __NR_fsopen #define __NR_fsopen 430 #endif 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 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); } #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)))) 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 unsigned int queue_count = 2; 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_attr(nlmsg, IFLA_NUM_TX_QUEUES, &queue_count, sizeof(queue_count)); netlink_attr(nlmsg, IFLA_NUM_RX_QUEUES, &queue_count, sizeof(queue_count)); 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; static long syz_open_procfs(volatile long a0, volatile long a1) { char buf[128]; memset(buf, 0, sizeof(buf)); if (a0 == 0) { snprintf(buf, sizeof(buf), "/proc/self/%s", (char*)a1); } else if (a0 == -1) { snprintf(buf, sizeof(buf), "/proc/thread-self/%s", (char*)a1); } else { snprintf(buf, sizeof(buf), "/proc/self/task/%d/%s", (int)a0, (char*)a1); } int fd = open(buf, O_RDWR); if (fd == -1) fd = open(buf, O_RDONLY); return fd; } 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"); } #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 < 21; 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); if (call == 0 || call == 4 || call == 6 || call == 10 || call == 15 || call == 16) break; event_timedwait(&th->done, 50 + (call == 20 ? 500 : 0)); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } 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(); 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; } } } uint64_t r[6] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: // syz_open_procfs$namespace arguments: [ // pid: pid (resource) // file: ptr[in, buffer] { // buffer: {6e 73 2f 70 69 64 5f 66 6f 72 5f 63 68 69 6c 64 72 65 6e // 00} (length 0x14) // } // ] // returns fd_namespace memcpy((void*)0x200000000300, "ns/pid_for_children\000", 20); syz_open_procfs(/*pid=*/-1, /*file=*/0x200000000300); break; case 1: // syz_open_procfs$namespace arguments: [ // pid: pid (resource) // file: ptr[in, buffer] { // buffer: {6e 73 2f 70 69 64 5f 66 6f 72 5f 63 68 69 6c 64 72 65 6e // 00} (length 0x14) // } // ] // returns fd_namespace memcpy((void*)0x200000000300, "ns/pid_for_children\000", 20); res = -1; res = syz_open_procfs(/*pid=*/-1, /*file=*/0x200000000300); if (res != -1) r[0] = res; break; case 2: // ioctl$SIOCSIFHWADDR arguments: [ // fd: fd_tun (resource) // cmd: const = 0x8914 (4 bytes) // arg: nil // ] syscall(__NR_ioctl, /*fd=*/(intptr_t)-1, /*cmd=*/0x8914, /*arg=*/0ul); break; case 3: // bpf$MAP_UPDATE_ELEM_TAIL_CALL arguments: [ // cmd: const = 0x2 (8 bytes) // arg: nil // size: len = 0x0 (8 bytes) // ] syscall(__NR_bpf, /*cmd=*/2ul, /*arg=*/0ul, /*size=*/0ul); break; case 4: // ioctl$sock_ipv6_tunnel_SIOCGETTUNNEL arguments: [ // fd: sock_udp6 (resource) // cmd: const = 0x89f0 (4 bytes) // arg: ptr[inout, ifreq_dev_t[ipv6_tunnel_names, ptr[inout, // ip6_tnl_parm2]]] { // ifreq_dev_t[ipv6_tunnel_names, ptr[inout, ip6_tnl_parm2]] { // ifr_ifrn: buffer: {69 70 36 74 6e 6c 30 00 00 00 00 00 00 00 00 // 00} (length 0x10) elem: nil pad = 0x0 (16 bytes) // } // } // ] memcpy((void*)0x200000000400, "ip6tnl0\000\000\000\000\000\000\000\000\000", 16); *(uint64_t*)0x200000000410 = 0; syscall(__NR_ioctl, /*fd=*/(intptr_t)-1, /*cmd=*/0x89f0, /*arg=*/0x200000000400ul); break; case 5: // fsopen arguments: [ // type: ptr[in, buffer] { // buffer: {62 70 66 00} (length 0x4) // } // flags: fsopen_flags = 0x0 (8 bytes) // ] // returns fd_fscontext memcpy((void*)0x200000000100, "bpf\000", 4); res = syscall(__NR_fsopen, /*type=*/0x200000000100ul, /*flags=*/0ul); if (res != -1) r[1] = res; break; case 6: // fsconfig$FSCONFIG_CMD_CREATE arguments: [ // fd: fd_fscontext (resource) // cmd: const = 0x6 (8 bytes) // key: const = 0x0 (8 bytes) // value: const = 0x0 (8 bytes) // aux: const = 0x0 (8 bytes) // ] syscall(__NR_fsconfig, /*fd=*/r[1], /*cmd=*/6ul, /*key=*/0ul, /*value=*/0ul, /*aux=*/0ul); break; case 7: // fsconfig$FSCONFIG_CMD_CREATE arguments: [ // fd: fd_fscontext (resource) // cmd: const = 0x6 (8 bytes) // key: const = 0x0 (8 bytes) // value: const = 0x0 (8 bytes) // aux: const = 0x0 (8 bytes) // ] syscall(__NR_fsconfig, /*fd=*/r[1], /*cmd=*/6ul, /*key=*/0ul, /*value=*/0ul, /*aux=*/0ul); break; case 8: // fsmount arguments: [ // fs_fd: fd_fscontext (resource) // flags: fsmount_flags = 0x0 (8 bytes) // attr_flags: fsmount_attr_flags = 0x0 (8 bytes) // ] // returns fd res = syscall(__NR_fsmount, /*fs_fd=*/r[1], /*flags=*/0ul, /*attr_flags=*/0ul); if (res != -1) r[2] = res; break; case 9: // symlinkat arguments: [ // old: ptr[in, buffer] { // buffer: {2e 00} (length 0x2) // } // newfd: fd_dir (resource) // new: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 30 00} (length 0x8) // } // ] memcpy((void*)0x200000000000, ".\000", 2); memcpy((void*)0x200000000140, "./file0\000", 8); syscall(__NR_symlinkat, /*old=*/0x200000000000ul, /*newfd=*/r[2], /*new=*/0x200000000140ul); break; case 10: // unlinkat arguments: [ // fd: fd_dir (resource) // path: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 30 2f 2e 2e 2f 66 69 6c 65 30 2f 66 69 6c // 65 30 00} (length 0x17) // } // flags: unlinkat_flags = 0x0 (8 bytes) // ] memcpy((void*)0x2000000001c0, "./file0/../file0/file0\000", 23); syscall(__NR_unlinkat, /*fd=*/r[2], /*path=*/0x2000000001c0ul, /*flags=*/0ul); break; case 11: // unlinkat arguments: [ // fd: fd_dir (resource) // path: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 30 2f 2e 2e 2f 66 69 6c 65 30 2f 66 69 6c // 65 30 00} (length 0x17) // } // flags: unlinkat_flags = 0x0 (8 bytes) // ] memcpy((void*)0x2000000001c0, "./file0/../file0/file0\000", 23); syscall(__NR_unlinkat, /*fd=*/r[2], /*path=*/0x2000000001c0ul, /*flags=*/0ul); break; case 12: // bpf$MAP_LOOKUP_ELEM arguments: [ // cmd: const = 0x1 (8 bytes) // arg: nil // size: len = 0x0 (8 bytes) // ] syscall(__NR_bpf, /*cmd=*/1ul, /*arg=*/0ul, /*size=*/0ul); break; case 13: // bpf$MAP_UPDATE_CONST_STR arguments: [ // cmd: const = 0x2 (8 bytes) // arg: nil // size: len = 0x0 (8 bytes) // ] syscall(__NR_bpf, /*cmd=*/2ul, /*arg=*/0ul, /*size=*/0ul); break; case 14: // bpf$OBJ_GET_MAP arguments: [ // cmd: const = 0x7 (8 bytes) // arg: ptr[in, bpf_obj_get] { // union bpf_obj_get { // o_path: bpf_obj_get_o_path { // path: nil // fd: const = 0x0 (4 bytes) // file_flags: bpf_obj_get_flags = 0x10 (4 bytes) // path_fd: fd (resource) // pad = 0x0 (4 bytes) // } // } // } // size: len = 0x18 (8 bytes) // ] // returns fd_bpf_map *(uint64_t*)0x200000000800 = 0; *(uint32_t*)0x200000000808 = 0; *(uint32_t*)0x20000000080c = 0x10; *(uint32_t*)0x200000000810 = r[0]; res = syscall(__NR_bpf, /*cmd=*/7ul, /*arg=*/0x200000000800ul, /*size=*/0x18ul); if (res != -1) r[3] = res; break; case 15: // bpf$MAP_CREATE_CONST_STR arguments: [ // cmd: const = 0x0 (8 bytes) // arg: nil // size: len = 0x0 (8 bytes) // ] // returns fd_bpf_const_str_map syscall(__NR_bpf, /*cmd=*/0ul, /*arg=*/0ul, /*size=*/0ul); break; case 16: // openat$cgroup_ro arguments: [ // fd: fd_cgroup (resource) // file: ptr[in, buffer] { // buffer: {62 6c 6b 69 6f 2e 62 66 71 2e 69 6f 5f 77 61 69 74 5f 74 69 // 6d 65 00} (length 0x17) // } // flags: const = 0x275a (4 bytes) // mode: const = 0x0 (2 bytes) // ] // returns fd memcpy((void*)0x200000000200, "blkio.bfq.io_wait_time\000", 23); syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000200ul, /*flags=*/0x275a, /*mode=*/0); break; case 17: // fsopen arguments: [ // type: ptr[in, buffer] { // buffer: {72 61 6d 66 73 00} (length 0x6) // } // flags: fsopen_flags = 0x0 (8 bytes) // ] // returns fd_fscontext memcpy((void*)0x200000000100, "ramfs\000", 6); res = syscall(__NR_fsopen, /*type=*/0x200000000100ul, /*flags=*/0ul); if (res != -1) r[4] = res; break; case 18: // fsmount arguments: [ // fs_fd: fd_fscontext (resource) // flags: fsmount_flags = 0x0 (8 bytes) // attr_flags: fsmount_attr_flags = 0x0 (8 bytes) // ] // returns fd res = syscall(__NR_fsmount, /*fs_fd=*/r[4], /*flags=*/0ul, /*attr_flags=*/0ul); if (res != -1) r[5] = res; break; case 19: // execveat$binfmt arguments: [ // dirfd: fd_dir (resource) // file: ptr_binfmt_file (resource) // argv: nil // envp: nil // flags: at_flags = 0x0 (8 bytes) // ] syscall(__NR_execveat, /*dirfd=*/r[5], /*file=*/0ul, /*argv=*/0ul, /*envp=*/0ul, /*flags=*/0ul); break; case 20: // bpf$BPF_PROG_WITH_BTFID_LOAD arguments: [ // cmd: const = 0x5 (8 bytes) // arg: ptr[in, bpf_prog_with_btfid] { // union bpf_prog_with_btfid { // bpf_tracing: bpf_prog_t[const[BPF_PROG_TYPE_TRACING, int32], // flags[bpf_tracing_attach_types, int32], int32[0:BTF_ID_MAX], // fd_bpf_prog[opt]] { // type: const = 0x1a (4 bytes) // ninsn: bytesize8 = 0x29 (4 bytes) // insns: ptr[in, bpf_instructions] { // union bpf_instructions { // raw: array[bpf_insn] { // union bpf_insn { // tail_call: bpf_insn_tail_call { // insn1: bpf_insn_map_fd_t[const[BPF_REG_2, int8:4], // tail_call_map] { // code: const = 0x18 (1 bytes) // dst: const = 0x2 (0 bytes) // src: const = 0x1 (1 bytes) // off: const = 0x0 (2 bytes) // imm: tail_call_map (resource) // code2: const = 0x0 (1 bytes) // regs2: const = 0x0 (1 bytes) // off2: const = 0x0 (2 bytes) // imm2: const = 0x0 (4 bytes) // } // insn2: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_MOV0, // const[BPF_REG_3, int8:4], const[0, int8:4], const[0, // int16], const[0, int32]] { // code_class: int8 = 0x7 (0 bytes) // code_s: int8 = 0x0 (0 bytes) // code_op: int8 = 0xb (1 bytes) // dst: const = 0x3 (0 bytes) // src: const = 0x0 (1 bytes) // off: const = 0x0 (2 bytes) // imm: const = 0x0 (4 bytes) // } // insn3: // bpf_insn_call_helper_t[const[BPF_FUNC_tail_call, // int32]] { // code: const = 0x85 (1 bytes) // regs: const = 0x0 (1 bytes) // off: const = 0x0 (2 bytes) // func: const = 0xc (4 bytes) // } // insn4: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_MOV0, // const[BPF_REG_0, int8:4], const[0, int8:4], const[0, // int16], const[0, int32]] { // code_class: int8 = 0x7 (0 bytes) // code_s: int8 = 0x0 (0 bytes) // code_op: int8 = 0xb (1 bytes) // dst: const = 0x0 (0 bytes) // src: const = 0x0 (1 bytes) // off: const = 0x0 (2 bytes) // imm: const = 0x0 (4 bytes) // } // } // } // union bpf_insn { // alu: bpf_insn_alu_t[bpf_alu_insn, bpf_alu_source, // bpf_alu_op, flags[bpf_reg, int8:4], flags[bpf_reg, // int8:4], flags[bpf_insn_offsets, int16], // flags[bpf_insn_immediates, int32]] { // code_class: bpf_alu_insn = 0x4 (0 bytes) // code_s: bpf_alu_source = 0x0 (0 bytes) // code_op: bpf_alu_op = 0x4 (1 bytes) // dst: bpf_reg = 0x6 (0 bytes) // src: bpf_reg = 0x1 (1 bytes) // off: bpf_insn_offsets = 0x1 (2 bytes) // imm: bpf_insn_immediates = 0x4 (4 bytes) // } // } // union bpf_insn { // initr0: bpf_insn_init_r0 { // code: const = 0x18 (1 bytes) // dst: const = 0x0 (0 bytes) // src: const = 0x0 (1 bytes) // off: const = 0x0 (2 bytes) // imm: int32 = 0x10000 (4 bytes) // code2: const = 0x0 (1 bytes) // regs2: const = 0x0 (1 bytes) // off2: const = 0x0 (2 bytes) // imm2: int32 = 0x80000001 (4 bytes) // } // } // union bpf_insn { // map_idx_val: bpf_insn_map_idx_value { // code: const = 0x18 (1 bytes) // dst: bpf_reg = 0x2 (0 bytes) // src: const = 0x6 (1 bytes) // off: const = 0x0 (2 bytes) // imm: int32 = 0x7 (4 bytes) // code2: const = 0x0 (1 bytes) // regs2: const = 0x0 (1 bytes) // off2: const = 0x0 (2 bytes) // imm2: int32 = 0x29 (4 bytes) // } // } // union bpf_insn { // snprintf: bpf_insn_snprintf { // insn1: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_MOV0, // const[BPF_REG_8, int8:4], const[0, int8:4], const[0, // int16], const[0, int32]] { // code_class: int8 = 0x7 (0 bytes) // code_s: int8 = 0x0 (0 bytes) // code_op: int8 = 0xb (1 bytes) // dst: const = 0x8 (0 bytes) // src: const = 0x0 (1 bytes) // off: const = 0x0 (2 bytes) // imm: const = 0x0 (4 bytes) // } // insn2: bpf_insn_ldst_t[BPF_STX, BPF_DW0, BPF_MEM0, // const[BPF_REG_10, int8:4], const[BPF_REG_8, int8:4], // const[-8, int16], const[0, int32]] { // code_class: int8 = 0x3 (0 bytes) // code_size: int8 = 0x3 (0 bytes) // code_mode: int8 = 0x3 (1 bytes) // dst: const = 0xa (0 bytes) // src: const = 0x8 (1 bytes) // off: const = 0xfff8 (2 bytes) // imm: const = 0x0 (4 bytes) // } // insn3: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_MOV0, // const[BPF_REG_8, int8:4], const[0, int8:4], const[0, // int16], int32] { // code_class: int8 = 0x7 (0 bytes) // code_s: int8 = 0x0 (0 bytes) // code_op: int8 = 0xb (1 bytes) // dst: const = 0x8 (0 bytes) // src: const = 0x0 (1 bytes) // off: const = 0x0 (2 bytes) // imm: int32 = 0x0 (4 bytes) // } // insn4: bpf_insn_ldst_t[BPF_STX, BPF_DW0, BPF_MEM0, // const[BPF_REG_10, int8:4], const[BPF_REG_8, int8:4], // const[-16, int16], const[0, int32]] { // code_class: int8 = 0x3 (0 bytes) // code_size: int8 = 0x3 (0 bytes) // code_mode: int8 = 0x3 (1 bytes) // dst: const = 0xa (0 bytes) // src: const = 0x8 (1 bytes) // off: const = 0xfff0 (2 bytes) // imm: const = 0x0 (4 bytes) // } // insn5: bpf_insn_alu_t[BPF_ALU64, BPF_X0, BPF_MOV0, // const[BPF_REG_1, int8:4], const[BPF_REG_10, int8:4], // const[0, int16], const[0, int32]] { // code_class: int8 = 0x7 (0 bytes) // code_s: int8 = 0x1 (0 bytes) // code_op: int8 = 0xb (1 bytes) // dst: const = 0x1 (0 bytes) // src: const = 0xa (1 bytes) // off: const = 0x0 (2 bytes) // imm: const = 0x0 (4 bytes) // } // insn6: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_ADD0, // const[BPF_REG_1, int8:4], const[0, int8:4], const[0, // int16], const[-8, int32]] { // code_class: int8 = 0x7 (0 bytes) // code_s: int8 = 0x0 (0 bytes) // code_op: int8 = 0x0 (1 bytes) // dst: const = 0x1 (0 bytes) // src: const = 0x0 (1 bytes) // off: const = 0x0 (2 bytes) // imm: const = 0xfffffff8 (4 bytes) // } // insn7: bpf_insn_alu_t[BPF_ALU64, BPF_X0, BPF_MOV0, // const[BPF_REG_4, int8:4], const[BPF_REG_10, int8:4], // const[0, int16], const[0, int32]] { // code_class: int8 = 0x7 (0 bytes) // code_s: int8 = 0x1 (0 bytes) // code_op: int8 = 0xb (1 bytes) // dst: const = 0x4 (0 bytes) // src: const = 0xa (1 bytes) // off: const = 0x0 (2 bytes) // imm: const = 0x0 (4 bytes) // } // insn8: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_ADD0, // const[BPF_REG_4, int8:4], const[0, int8:4], const[0, // int16], const[-16, int32]] { // code_class: int8 = 0x7 (0 bytes) // code_s: int8 = 0x0 (0 bytes) // code_op: int8 = 0x0 (1 bytes) // dst: const = 0x4 (0 bytes) // src: const = 0x0 (1 bytes) // off: const = 0x0 (2 bytes) // imm: const = 0xfffffff0 (4 bytes) // } // insn9: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_MOV0, // const[BPF_REG_2, int8:4], const[0, int8:4], const[0, // int16], const[8, int32]] { // code_class: int8 = 0x7 (0 bytes) // code_s: int8 = 0x0 (0 bytes) // code_op: int8 = 0xb (1 bytes) // dst: const = 0x2 (0 bytes) // src: const = 0x0 (1 bytes) // off: const = 0x0 (2 bytes) // imm: const = 0x8 (4 bytes) // } // insn10: bpf_insn_map_value_t[const[BPF_REG_3, int8:4], // bpf_frozen_const_str, const[0, int32]] { // code: const = 0x18 (1 bytes) // dst: const = 0x3 (0 bytes) // src: const = 0x2 (1 bytes) // off: const = 0x0 (2 bytes) // imm: bpf_frozen_const_str (resource) // code2: const = 0x0 (1 bytes) // regs2: const = 0x0 (1 bytes) // off2: const = 0x0 (2 bytes) // imm2: const = 0x0 (4 bytes) // } // insn11: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_MOV0, // const[BPF_REG_5, int8:4], const[0, int8:4], const[0, // int16], const[8, int32]] { // code_class: int8 = 0x7 (0 bytes) // code_s: int8 = 0x0 (0 bytes) // code_op: int8 = 0xb (1 bytes) // dst: const = 0x5 (0 bytes) // src: const = 0x0 (1 bytes) // off: const = 0x0 (2 bytes) // imm: const = 0x8 (4 bytes) // } // insn12: // bpf_insn_call_helper_t[const[BPF_FUNC_snprintf, // int32]] { // code: const = 0x85 (1 bytes) // regs: const = 0x0 (1 bytes) // off: const = 0x0 (2 bytes) // func: const = 0xa5 (4 bytes) // } // } // } // union bpf_insn { // exit: bpf_insn_exit { // code: const = 0x95 (1 bytes) // regs: const = 0x0 (1 bytes) // off: const = 0x0 (2 bytes) // imm: const = 0x0 (4 bytes) // } // } // union bpf_insn { // map_idx_val: bpf_insn_map_idx_value { // code: const = 0x18 (1 bytes) // dst: bpf_reg = 0x2 (0 bytes) // src: const = 0x6 (1 bytes) // off: const = 0x0 (2 bytes) // imm: int32 = 0x8 (4 bytes) // code2: const = 0x0 (1 bytes) // regs2: const = 0x0 (1 bytes) // off2: const = 0x0 (2 bytes) // imm2: int32 = 0xf (4 bytes) // } // } // union bpf_insn { // tail_call: bpf_insn_tail_call { // insn1: bpf_insn_map_fd_t[const[BPF_REG_2, int8:4], // tail_call_map] { // code: const = 0x18 (1 bytes) // dst: const = 0x2 (0 bytes) // src: const = 0x1 (1 bytes) // off: const = 0x0 (2 bytes) // imm: tail_call_map (resource) // code2: const = 0x0 (1 bytes) // regs2: const = 0x0 (1 bytes) // off2: const = 0x0 (2 bytes) // imm2: const = 0x0 (4 bytes) // } // insn2: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_MOV0, // const[BPF_REG_3, int8:4], const[0, int8:4], const[0, // int16], const[0, int32]] { // code_class: int8 = 0x7 (0 bytes) // code_s: int8 = 0x0 (0 bytes) // code_op: int8 = 0xb (1 bytes) // dst: const = 0x3 (0 bytes) // src: const = 0x0 (1 bytes) // off: const = 0x0 (2 bytes) // imm: const = 0x0 (4 bytes) // } // insn3: // bpf_insn_call_helper_t[const[BPF_FUNC_tail_call, // int32]] { // code: const = 0x85 (1 bytes) // regs: const = 0x0 (1 bytes) // off: const = 0x0 (2 bytes) // func: const = 0xc (4 bytes) // } // insn4: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_MOV0, // const[BPF_REG_0, int8:4], const[0, int8:4], const[0, // int16], const[0, int32]] { // code_class: int8 = 0x7 (0 bytes) // code_s: int8 = 0x0 (0 bytes) // code_op: int8 = 0xb (1 bytes) // dst: const = 0x0 (0 bytes) // src: const = 0x0 (1 bytes) // off: const = 0x0 (2 bytes) // imm: const = 0x0 (4 bytes) // } // } // } // union bpf_insn { // generic: bpf_insn_generic { // code: int8 = 0xe8 (1 bytes) // dst: int8 = 0x2 (0 bytes) // src: int8 = 0x0 (1 bytes) // off: int16 = 0x5 (2 bytes) // imm: int32 = 0x1ce (4 bytes) // } // } // union bpf_insn { // ringbuf_output: bpf_insn_ringbuf_output { // insn1: bpf_insn_map_fd_t[const[BPF_REG_1, int8:4], // tail_call_map] { // code: const = 0x18 (1 bytes) // dst: const = 0x1 (0 bytes) // src: const = 0x1 (1 bytes) // off: const = 0x0 (2 bytes) // imm: tail_call_map (resource) // code2: const = 0x0 (1 bytes) // regs2: const = 0x0 (1 bytes) // off2: const = 0x0 (2 bytes) // imm2: const = 0x0 (4 bytes) // } // insn2: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_MOV0, // const[BPF_REG_8, int8:4], const[0, int8:4], const[0, // int16], int32] { // code_class: int8 = 0x7 (0 bytes) // code_s: int8 = 0x0 (0 bytes) // code_op: int8 = 0xb (1 bytes) // dst: const = 0x8 (0 bytes) // src: const = 0x0 (1 bytes) // off: const = 0x0 (2 bytes) // imm: int32 = 0x2 (4 bytes) // } // insn3: bpf_insn_ldst_t[BPF_STX, BPF_DW0, BPF_MEM0, // const[BPF_REG_10, int8:4], const[BPF_REG_8, int8:4], // const[-8, int16], const[0, int32]] { // code_class: int8 = 0x3 (0 bytes) // code_size: int8 = 0x3 (0 bytes) // code_mode: int8 = 0x3 (1 bytes) // dst: const = 0xa (0 bytes) // src: const = 0x8 (1 bytes) // off: const = 0xfff8 (2 bytes) // imm: const = 0x0 (4 bytes) // } // insn4: bpf_insn_alu_t[BPF_ALU64, BPF_X0, BPF_MOV0, // const[BPF_REG_2, int8:4], const[BPF_REG_10, int8:4], // const[0, int16], const[0, int32]] { // code_class: int8 = 0x7 (0 bytes) // code_s: int8 = 0x1 (0 bytes) // code_op: int8 = 0xb (1 bytes) // dst: const = 0x2 (0 bytes) // src: const = 0xa (1 bytes) // off: const = 0x0 (2 bytes) // imm: const = 0x0 (4 bytes) // } // insn5: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_ADD0, // const[BPF_REG_2, int8:4], const[0, int8:4], const[0, // int16], const[-8, int32]] { // code_class: int8 = 0x7 (0 bytes) // code_s: int8 = 0x0 (0 bytes) // code_op: int8 = 0x0 (1 bytes) // dst: const = 0x2 (0 bytes) // src: const = 0x0 (1 bytes) // off: const = 0x0 (2 bytes) // imm: const = 0xfffffff8 (4 bytes) // } // insn6: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_MOV0, // const[BPF_REG_3, int8:4], const[0, int8:4], const[0, // int16], const[8, int32]] { // code_class: int8 = 0x7 (0 bytes) // code_s: int8 = 0x0 (0 bytes) // code_op: int8 = 0xb (1 bytes) // dst: const = 0x3 (0 bytes) // src: const = 0x0 (1 bytes) // off: const = 0x0 (2 bytes) // imm: const = 0x8 (4 bytes) // } // insn7: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_MOV0, // const[BPF_REG_4, int8:4], const[0, int8:4], const[0, // int16], flags[bpf_ringbuf_wakeup_flags, int32]] { // code_class: int8 = 0x7 (0 bytes) // code_s: int8 = 0x0 (0 bytes) // code_op: int8 = 0xb (1 bytes) // dst: const = 0x4 (0 bytes) // src: const = 0x0 (1 bytes) // off: const = 0x0 (2 bytes) // imm: bpf_ringbuf_wakeup_flags = 0x2 (4 bytes) // } // insn8: // bpf_insn_call_helper_t[const[BPF_FUNC_ringbuf_output, // int32]] { // code: const = 0x85 (1 bytes) // regs: const = 0x0 (1 bytes) // off: const = 0x0 (2 bytes) // func: const = 0x82 (4 bytes) // } // } // } // } // } // } // license: ptr[in, buffer] { // buffer: {73 79 7a 6b 61 6c 6c 65 72 00} (length 0xa) // } // loglev: int32 = 0x81 (4 bytes) // logsize: len = 0x0 (4 bytes) // log: nil // kern_version: bpf_kern_version = 0x41000 (4 bytes) // flags: bpf_prog_load_flags = 0x1e (4 bytes) // prog_name: buffer: {00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // 00} (length 0x10) prog_ifindex: ifindex (resource) // expected_attach_type: bpf_tracing_attach_types = 0x1c (4 bytes) // btf_fd: fd_btf (resource) // func_info_rec_size: const = 0x8 (4 bytes) // func_info: ptr[in, bpf_func_info] { // bpf_func_info { // insn_off: int32 = 0x4 (4 bytes) // type_id: int32 = 0x2 (4 bytes) // } // } // func_info_cnt: len = 0x8 (4 bytes) // line_info_rec_size: const = 0x10 (4 bytes) // line_info: ptr[in, bpf_line_info] { // bpf_line_info { // insn_off: int32 = 0x2 (4 bytes) // file_name_off: int32 = 0x10 (4 bytes) // line_off: int32 = 0x1 (4 bytes) // line_col: int32 = 0x45 (4 bytes) // } // } // line_info_cnt: len = 0x10 (4 bytes) // attach_btf_id: int32 = 0xbf70 (4 bytes) // attach_prog_fd: fd_bpf_prog (resource) // core_relo_cnt: len = 0x1 (4 bytes) // fd_array: ptr[in, array[fd_bpf_map]] { // array[fd_bpf_map] { // fd_bpf_map (resource) // fd_bpf_map (resource) // fd_bpf_map (resource) // fd_bpf_map (resource) // fd_bpf_map (resource) // fd_bpf_map (resource) // fd_bpf_map (resource) // fd_bpf_map (resource) // fd_bpf_map (resource) // } // } // core_relos: ptr[in, array[bpf_core_relo]] { // array[bpf_core_relo] { // bpf_core_relo { // insn_off: int32 = 0x5 (4 bytes) // type_id: int32 = 0x5 (4 bytes) // access_str_off: int32 = 0x8 (4 bytes) // kind: bpf_core_relo_kind = 0x7 (4 bytes) // } // } // } // core_relo_rec_size: const = 0x10 (4 bytes) // log_true_size: int32 = 0x2 (4 bytes) // prog_token_fd: union _bpf_prog_t[const[BPF_PROG_TYPE_TRACING, // int32], flags[bpf_tracing_attach_types, int32], // int32[0:BTF_ID_MAX], fd_bpf_prog[opt]]_prog_token_fd_wrapper { // void: buffer: {} (length 0x0) // } // pad: union _bpf_prog_t[const[BPF_PROG_TYPE_TRACING, int32], // flags[bpf_tracing_attach_types, int32], int32[0:BTF_ID_MAX], // fd_bpf_prog[opt]]_pad_wrapper { // value: const = 0x0 (4 bytes) // } // } // } // } // size: len = 0x94 (8 bytes) // ] // returns fd_bpf_prog_with_btfid *(uint32_t*)0x200000000a40 = 0x1a; *(uint32_t*)0x200000000a44 = 0x29; *(uint64_t*)0x200000000a48 = 0x200000000180; *(uint8_t*)0x200000000180 = 0x18; STORE_BY_BITMASK(uint8_t, , 0x200000000181, 2, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x200000000181, 1, 4, 4); *(uint16_t*)0x200000000182 = 0; *(uint32_t*)0x200000000184 = -1; *(uint8_t*)0x200000000188 = 0; *(uint8_t*)0x200000000189 = 0; *(uint16_t*)0x20000000018a = 0; *(uint32_t*)0x20000000018c = 0; STORE_BY_BITMASK(uint8_t, , 0x200000000190, 7, 0, 3); STORE_BY_BITMASK(uint8_t, , 0x200000000190, 0, 3, 1); STORE_BY_BITMASK(uint8_t, , 0x200000000190, 0xb, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x200000000191, 3, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x200000000191, 0, 4, 4); *(uint16_t*)0x200000000192 = 0; *(uint32_t*)0x200000000194 = 0; *(uint8_t*)0x200000000198 = 0x85; *(uint8_t*)0x200000000199 = 0; *(uint16_t*)0x20000000019a = 0; *(uint32_t*)0x20000000019c = 0xc; STORE_BY_BITMASK(uint8_t, , 0x2000000001a0, 7, 0, 3); STORE_BY_BITMASK(uint8_t, , 0x2000000001a0, 0, 3, 1); STORE_BY_BITMASK(uint8_t, , 0x2000000001a0, 0xb, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x2000000001a1, 0, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x2000000001a1, 0, 4, 4); *(uint16_t*)0x2000000001a2 = 0; *(uint32_t*)0x2000000001a4 = 0; STORE_BY_BITMASK(uint8_t, , 0x2000000001a8, 4, 0, 3); STORE_BY_BITMASK(uint8_t, , 0x2000000001a8, 0, 3, 1); STORE_BY_BITMASK(uint8_t, , 0x2000000001a8, 4, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x2000000001a9, 6, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x2000000001a9, 1, 4, 4); *(uint16_t*)0x2000000001aa = 1; *(uint32_t*)0x2000000001ac = 4; *(uint8_t*)0x2000000001b0 = 0x18; STORE_BY_BITMASK(uint8_t, , 0x2000000001b1, 0, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x2000000001b1, 0, 4, 4); *(uint16_t*)0x2000000001b2 = 0; *(uint32_t*)0x2000000001b4 = 0x10000; *(uint8_t*)0x2000000001b8 = 0; *(uint8_t*)0x2000000001b9 = 0; *(uint16_t*)0x2000000001ba = 0; *(uint32_t*)0x2000000001bc = 0x80000001; *(uint8_t*)0x2000000001c0 = 0x18; STORE_BY_BITMASK(uint8_t, , 0x2000000001c1, 2, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x2000000001c1, 6, 4, 4); *(uint16_t*)0x2000000001c2 = 0; *(uint32_t*)0x2000000001c4 = 7; *(uint8_t*)0x2000000001c8 = 0; *(uint8_t*)0x2000000001c9 = 0; *(uint16_t*)0x2000000001ca = 0; *(uint32_t*)0x2000000001cc = 0x29; STORE_BY_BITMASK(uint8_t, , 0x2000000001d0, 7, 0, 3); STORE_BY_BITMASK(uint8_t, , 0x2000000001d0, 0, 3, 1); STORE_BY_BITMASK(uint8_t, , 0x2000000001d0, 0xb, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x2000000001d1, 8, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x2000000001d1, 0, 4, 4); *(uint16_t*)0x2000000001d2 = 0; *(uint32_t*)0x2000000001d4 = 0; STORE_BY_BITMASK(uint8_t, , 0x2000000001d8, 3, 0, 3); STORE_BY_BITMASK(uint8_t, , 0x2000000001d8, 3, 3, 2); STORE_BY_BITMASK(uint8_t, , 0x2000000001d8, 3, 5, 3); STORE_BY_BITMASK(uint8_t, , 0x2000000001d9, 0xa, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x2000000001d9, 8, 4, 4); *(uint16_t*)0x2000000001da = 0xfff8; *(uint32_t*)0x2000000001dc = 0; STORE_BY_BITMASK(uint8_t, , 0x2000000001e0, 7, 0, 3); STORE_BY_BITMASK(uint8_t, , 0x2000000001e0, 0, 3, 1); STORE_BY_BITMASK(uint8_t, , 0x2000000001e0, 0xb, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x2000000001e1, 8, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x2000000001e1, 0, 4, 4); *(uint16_t*)0x2000000001e2 = 0; *(uint32_t*)0x2000000001e4 = 0; STORE_BY_BITMASK(uint8_t, , 0x2000000001e8, 3, 0, 3); STORE_BY_BITMASK(uint8_t, , 0x2000000001e8, 3, 3, 2); STORE_BY_BITMASK(uint8_t, , 0x2000000001e8, 3, 5, 3); STORE_BY_BITMASK(uint8_t, , 0x2000000001e9, 0xa, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x2000000001e9, 8, 4, 4); *(uint16_t*)0x2000000001ea = 0xfff0; *(uint32_t*)0x2000000001ec = 0; STORE_BY_BITMASK(uint8_t, , 0x2000000001f0, 7, 0, 3); STORE_BY_BITMASK(uint8_t, , 0x2000000001f0, 1, 3, 1); STORE_BY_BITMASK(uint8_t, , 0x2000000001f0, 0xb, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x2000000001f1, 1, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x2000000001f1, 0xa, 4, 4); *(uint16_t*)0x2000000001f2 = 0; *(uint32_t*)0x2000000001f4 = 0; STORE_BY_BITMASK(uint8_t, , 0x2000000001f8, 7, 0, 3); STORE_BY_BITMASK(uint8_t, , 0x2000000001f8, 0, 3, 1); STORE_BY_BITMASK(uint8_t, , 0x2000000001f8, 0, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x2000000001f9, 1, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x2000000001f9, 0, 4, 4); *(uint16_t*)0x2000000001fa = 0; *(uint32_t*)0x2000000001fc = 0xfffffff8; STORE_BY_BITMASK(uint8_t, , 0x200000000200, 7, 0, 3); STORE_BY_BITMASK(uint8_t, , 0x200000000200, 1, 3, 1); STORE_BY_BITMASK(uint8_t, , 0x200000000200, 0xb, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x200000000201, 4, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x200000000201, 0xa, 4, 4); *(uint16_t*)0x200000000202 = 0; *(uint32_t*)0x200000000204 = 0; STORE_BY_BITMASK(uint8_t, , 0x200000000208, 7, 0, 3); STORE_BY_BITMASK(uint8_t, , 0x200000000208, 0, 3, 1); STORE_BY_BITMASK(uint8_t, , 0x200000000208, 0, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x200000000209, 4, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x200000000209, 0, 4, 4); *(uint16_t*)0x20000000020a = 0; *(uint32_t*)0x20000000020c = 0xfffffff0; STORE_BY_BITMASK(uint8_t, , 0x200000000210, 7, 0, 3); STORE_BY_BITMASK(uint8_t, , 0x200000000210, 0, 3, 1); STORE_BY_BITMASK(uint8_t, , 0x200000000210, 0xb, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x200000000211, 2, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x200000000211, 0, 4, 4); *(uint16_t*)0x200000000212 = 0; *(uint32_t*)0x200000000214 = 8; *(uint8_t*)0x200000000218 = 0x18; STORE_BY_BITMASK(uint8_t, , 0x200000000219, 3, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x200000000219, 2, 4, 4); *(uint16_t*)0x20000000021a = 0; *(uint32_t*)0x20000000021c = -1; *(uint8_t*)0x200000000220 = 0; *(uint8_t*)0x200000000221 = 0; *(uint16_t*)0x200000000222 = 0; *(uint32_t*)0x200000000224 = 0; STORE_BY_BITMASK(uint8_t, , 0x200000000228, 7, 0, 3); STORE_BY_BITMASK(uint8_t, , 0x200000000228, 0, 3, 1); STORE_BY_BITMASK(uint8_t, , 0x200000000228, 0xb, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x200000000229, 5, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x200000000229, 0, 4, 4); *(uint16_t*)0x20000000022a = 0; *(uint32_t*)0x20000000022c = 8; *(uint8_t*)0x200000000230 = 0x85; *(uint8_t*)0x200000000231 = 0; *(uint16_t*)0x200000000232 = 0; *(uint32_t*)0x200000000234 = 0xa5; *(uint8_t*)0x200000000238 = 0x95; *(uint8_t*)0x200000000239 = 0; *(uint16_t*)0x20000000023a = 0; *(uint32_t*)0x20000000023c = 0; *(uint8_t*)0x200000000240 = 0x18; STORE_BY_BITMASK(uint8_t, , 0x200000000241, 2, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x200000000241, 6, 4, 4); *(uint16_t*)0x200000000242 = 0; *(uint32_t*)0x200000000244 = 8; *(uint8_t*)0x200000000248 = 0; *(uint8_t*)0x200000000249 = 0; *(uint16_t*)0x20000000024a = 0; *(uint32_t*)0x20000000024c = 0xf; *(uint8_t*)0x200000000250 = 0x18; STORE_BY_BITMASK(uint8_t, , 0x200000000251, 2, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x200000000251, 1, 4, 4); *(uint16_t*)0x200000000252 = 0; *(uint32_t*)0x200000000254 = -1; *(uint8_t*)0x200000000258 = 0; *(uint8_t*)0x200000000259 = 0; *(uint16_t*)0x20000000025a = 0; *(uint32_t*)0x20000000025c = 0; STORE_BY_BITMASK(uint8_t, , 0x200000000260, 7, 0, 3); STORE_BY_BITMASK(uint8_t, , 0x200000000260, 0, 3, 1); STORE_BY_BITMASK(uint8_t, , 0x200000000260, 0xb, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x200000000261, 3, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x200000000261, 0, 4, 4); *(uint16_t*)0x200000000262 = 0; *(uint32_t*)0x200000000264 = 0; *(uint8_t*)0x200000000268 = 0x85; *(uint8_t*)0x200000000269 = 0; *(uint16_t*)0x20000000026a = 0; *(uint32_t*)0x20000000026c = 0xc; STORE_BY_BITMASK(uint8_t, , 0x200000000270, 7, 0, 3); STORE_BY_BITMASK(uint8_t, , 0x200000000270, 0, 3, 1); STORE_BY_BITMASK(uint8_t, , 0x200000000270, 0xb, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x200000000271, 0, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x200000000271, 0, 4, 4); *(uint16_t*)0x200000000272 = 0; *(uint32_t*)0x200000000274 = 0; *(uint8_t*)0x200000000278 = 0xe8; STORE_BY_BITMASK(uint8_t, , 0x200000000279, 2, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x200000000279, 0, 4, 4); *(uint16_t*)0x20000000027a = 5; *(uint32_t*)0x20000000027c = 0x1ce; *(uint8_t*)0x200000000280 = 0x18; STORE_BY_BITMASK(uint8_t, , 0x200000000281, 1, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x200000000281, 1, 4, 4); *(uint16_t*)0x200000000282 = 0; *(uint32_t*)0x200000000284 = -1; *(uint8_t*)0x200000000288 = 0; *(uint8_t*)0x200000000289 = 0; *(uint16_t*)0x20000000028a = 0; *(uint32_t*)0x20000000028c = 0; STORE_BY_BITMASK(uint8_t, , 0x200000000290, 7, 0, 3); STORE_BY_BITMASK(uint8_t, , 0x200000000290, 0, 3, 1); STORE_BY_BITMASK(uint8_t, , 0x200000000290, 0xb, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x200000000291, 8, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x200000000291, 0, 4, 4); *(uint16_t*)0x200000000292 = 0; *(uint32_t*)0x200000000294 = 2; STORE_BY_BITMASK(uint8_t, , 0x200000000298, 3, 0, 3); STORE_BY_BITMASK(uint8_t, , 0x200000000298, 3, 3, 2); STORE_BY_BITMASK(uint8_t, , 0x200000000298, 3, 5, 3); STORE_BY_BITMASK(uint8_t, , 0x200000000299, 0xa, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x200000000299, 8, 4, 4); *(uint16_t*)0x20000000029a = 0xfff8; *(uint32_t*)0x20000000029c = 0; STORE_BY_BITMASK(uint8_t, , 0x2000000002a0, 7, 0, 3); STORE_BY_BITMASK(uint8_t, , 0x2000000002a0, 1, 3, 1); STORE_BY_BITMASK(uint8_t, , 0x2000000002a0, 0xb, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x2000000002a1, 2, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x2000000002a1, 0xa, 4, 4); *(uint16_t*)0x2000000002a2 = 0; *(uint32_t*)0x2000000002a4 = 0; STORE_BY_BITMASK(uint8_t, , 0x2000000002a8, 7, 0, 3); STORE_BY_BITMASK(uint8_t, , 0x2000000002a8, 0, 3, 1); STORE_BY_BITMASK(uint8_t, , 0x2000000002a8, 0, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x2000000002a9, 2, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x2000000002a9, 0, 4, 4); *(uint16_t*)0x2000000002aa = 0; *(uint32_t*)0x2000000002ac = 0xfffffff8; STORE_BY_BITMASK(uint8_t, , 0x2000000002b0, 7, 0, 3); STORE_BY_BITMASK(uint8_t, , 0x2000000002b0, 0, 3, 1); STORE_BY_BITMASK(uint8_t, , 0x2000000002b0, 0xb, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x2000000002b1, 3, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x2000000002b1, 0, 4, 4); *(uint16_t*)0x2000000002b2 = 0; *(uint32_t*)0x2000000002b4 = 8; STORE_BY_BITMASK(uint8_t, , 0x2000000002b8, 7, 0, 3); STORE_BY_BITMASK(uint8_t, , 0x2000000002b8, 0, 3, 1); STORE_BY_BITMASK(uint8_t, , 0x2000000002b8, 0xb, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x2000000002b9, 4, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x2000000002b9, 0, 4, 4); *(uint16_t*)0x2000000002ba = 0; *(uint32_t*)0x2000000002bc = 2; *(uint8_t*)0x2000000002c0 = 0x85; *(uint8_t*)0x2000000002c1 = 0; *(uint16_t*)0x2000000002c2 = 0; *(uint32_t*)0x2000000002c4 = 0x82; *(uint64_t*)0x200000000a50 = 0x200000000340; memcpy((void*)0x200000000340, "syzkaller\000", 10); *(uint32_t*)0x200000000a58 = 0x81; *(uint32_t*)0x200000000a5c = 0; *(uint64_t*)0x200000000a60 = 0; *(uint32_t*)0x200000000a68 = 0x41000; *(uint32_t*)0x200000000a6c = 0x1e; memset((void*)0x200000000a70, 0, 16); *(uint32_t*)0x200000000a80 = 0; *(uint32_t*)0x200000000a84 = 0x1c; *(uint32_t*)0x200000000a88 = -1; *(uint32_t*)0x200000000a8c = 8; *(uint64_t*)0x200000000a90 = 0x200000000600; *(uint32_t*)0x200000000600 = 4; *(uint32_t*)0x200000000604 = 2; *(uint32_t*)0x200000000a98 = 8; *(uint32_t*)0x200000000a9c = 0x10; *(uint64_t*)0x200000000aa0 = 0x200000000640; *(uint32_t*)0x200000000640 = 2; *(uint32_t*)0x200000000644 = 0x10; *(uint32_t*)0x200000000648 = 1; *(uint32_t*)0x20000000064c = 0x45; *(uint32_t*)0x200000000aa8 = 0x10; *(uint32_t*)0x200000000aac = 0xbf70; *(uint32_t*)0x200000000ab0 = -1; *(uint32_t*)0x200000000ab4 = 1; *(uint64_t*)0x200000000ab8 = 0x2000000009c0; *(uint32_t*)0x2000000009c0 = r[2]; *(uint32_t*)0x2000000009c4 = -1; *(uint32_t*)0x2000000009c8 = -1; *(uint32_t*)0x2000000009cc = r[3]; *(uint32_t*)0x2000000009d0 = -1; *(uint32_t*)0x2000000009d4 = -1; *(uint32_t*)0x2000000009d8 = -1; *(uint32_t*)0x2000000009dc = r[5]; *(uint32_t*)0x2000000009e0 = -1; *(uint64_t*)0x200000000ac0 = 0x200000000a00; *(uint32_t*)0x200000000a00 = 5; *(uint32_t*)0x200000000a04 = 5; *(uint32_t*)0x200000000a08 = 8; *(uint32_t*)0x200000000a0c = 7; *(uint32_t*)0x200000000ac8 = 0x10; *(uint32_t*)0x200000000acc = 2; *(uint32_t*)0x200000000ad0 = 0; syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x200000000a40ul, /*size=*/0x94ul); 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_802154())) printf("the reproducer may not work as expected: 802154 injection setup " "failed: %s\n", reason); loop(); return 0; }