// https://syzkaller.appspot.com/bug?id=6a55ad261f82f9139ed81cafdc01ff40e0d4494f // 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 #ifndef __NR_getsockopt #define __NR_getsockopt 209 #endif #ifndef __NR_io_uring_enter #define __NR_io_uring_enter 426 #endif #ifndef __NR_io_uring_setup #define __NR_io_uring_setup 425 #endif #ifndef __NR_mmap #define __NR_mmap 222 #endif #ifndef __NR_mprotect #define __NR_mprotect 226 #endif #ifndef __NR_openat #define __NR_openat 56 #endif #ifndef __NR_sendmsg #define __NR_sendmsg 211 #endif #ifndef __NR_socket #define __NR_socket 198 #endif 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 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; } #define SIZEOF_IO_URING_SQE 64 #define SIZEOF_IO_URING_CQE 16 #define IORING_SETUP_SQE128 (1U << 10) #define IORING_SETUP_CQE32 (1U << 11) struct io_sqring_offsets { uint32_t head; uint32_t tail; uint32_t ring_mask; uint32_t ring_entries; uint32_t flags; uint32_t dropped; uint32_t array; uint32_t resv1; uint64_t user_addr; }; struct io_cqring_offsets { uint32_t head; uint32_t tail; uint32_t ring_mask; uint32_t ring_entries; uint32_t overflow; uint32_t cqes; uint32_t flags; uint32_t resv1; uint64_t user_addr; }; struct io_uring_params { uint32_t sq_entries; uint32_t cq_entries; uint32_t flags; uint32_t sq_thread_cpu; uint32_t sq_thread_idle; uint32_t features; uint32_t resv[4]; struct io_sqring_offsets sq_off; struct io_cqring_offsets cq_off; }; static long io_uring_sqe_size(struct io_uring_params* params) { return SIZEOF_IO_URING_SQE << !!(params->flags & IORING_SETUP_SQE128); } static long io_uring_cqe_size(struct io_uring_params* params) { return SIZEOF_IO_URING_CQE << !!(params->flags & IORING_SETUP_CQE32); } #define IORING_OFF_SQ_RING 0ULL #define IORING_OFF_SQES 0x10000000ULL static long syz_io_uring_setup(volatile long a0, volatile long a1, volatile long a2, volatile long a3, volatile long a4) { uint32_t entries = (uint32_t)a0; struct io_uring_params* setup_params = (struct io_uring_params*)a1; void** ring_params_ptr_out = (void**)a2; void** ring_ptr_out = (void**)a3; void** sqes_ptr_out = (void**)a4; uint32_t fd_io_uring = syscall(__NR_io_uring_setup, entries, setup_params); *ring_params_ptr_out = (void*)setup_params; uint32_t sq_ring_sz = setup_params->sq_off.array + setup_params->sq_entries * sizeof(uint32_t); uint32_t cq_ring_sz = setup_params->cq_off.cqes + setup_params->cq_entries * io_uring_cqe_size(setup_params); uint32_t ring_sz = sq_ring_sz > cq_ring_sz ? sq_ring_sz : cq_ring_sz; *ring_ptr_out = mmap(0, ring_sz, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_POPULATE, fd_io_uring, IORING_OFF_SQ_RING); uint32_t sqes_sz = setup_params->sq_entries * io_uring_sqe_size(setup_params); *sqes_ptr_out = mmap(0, sqes_sz, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_POPULATE, fd_io_uring, IORING_OFF_SQES); uint32_t* array = (uint32_t*)((uintptr_t)*ring_ptr_out + setup_params->sq_off.array); for (uint32_t index = 0; index < setup_params->sq_entries; index++) array[index] = index; return fd_io_uring; } static long syz_io_uring_submit(volatile long a0, volatile long a1, volatile long a2, volatile long a3) { struct io_uring_params* params = (struct io_uring_params*)a0; char* ring_ptr = (char*)a1; char* sqes_ptr = (char*)a2; char* sqe = (char*)a3; uint32_t sq_ring_mask = *(uint32_t*)(ring_ptr + params->sq_off.ring_mask); uint32_t* sq_tail_ptr = (uint32_t*)(ring_ptr + params->sq_off.tail); uint32_t sq_tail = *sq_tail_ptr & sq_ring_mask; uint32_t sqe_size = io_uring_sqe_size(params); char* sqe_dest = sqes_ptr + sq_tail * sqe_size; memcpy(sqe_dest, sqe, sqe_size); uint32_t sq_tail_next = *sq_tail_ptr + 1; __atomic_store_n(sq_tail_ptr, sq_tail_next, __ATOMIC_RELEASE); return 0; } 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, "stats=global")) { if (mount("binder", "/dev/binderfs", "binder", 0, NULL)) { } } if (symlink("/dev/binderfs", "./binderfs")) { } } static void loop(); static void sandbox_common() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); if (getppid() == 1) exit(1); struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = (200 << 20); setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 32 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 136 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); if (unshare(CLONE_NEWNS)) { } if (mount(NULL, "/", NULL, MS_REC | MS_PRIVATE, NULL)) { } if (unshare(CLONE_NEWIPC)) { } if (unshare(0x02000000)) { } if (unshare(CLONE_NEWUTS)) { } if (unshare(CLONE_SYSVSEM)) { } typedef struct { const char* name; const char* value; } sysctl_t; static const sysctl_t sysctls[] = { {"/proc/sys/kernel/shmmax", "16777216"}, {"/proc/sys/kernel/shmall", "536870912"}, {"/proc/sys/kernel/shmmni", "1024"}, {"/proc/sys/kernel/msgmax", "8192"}, {"/proc/sys/kernel/msgmni", "1024"}, {"/proc/sys/kernel/msgmnb", "1024"}, {"/proc/sys/kernel/sem", "1024 1048576 500 1024"}, }; unsigned i; for (i = 0; i < sizeof(sysctls) / sizeof(sysctls[0]); i++) write_file(sysctls[i].name, sysctls[i].value); } static int wait_for_loop(int pid) { if (pid < 0) exit(1); int status = 0; while (waitpid(-1, &status, __WALL) != pid) { } return WEXITSTATUS(status); } static void drop_caps(void) { struct __user_cap_header_struct cap_hdr = {}; struct __user_cap_data_struct cap_data[2] = {}; cap_hdr.version = _LINUX_CAPABILITY_VERSION_3; cap_hdr.pid = getpid(); if (syscall(SYS_capget, &cap_hdr, &cap_data)) exit(1); const int drop = (1 << CAP_SYS_PTRACE) | (1 << CAP_SYS_NICE); cap_data[0].effective &= ~drop; cap_data[0].permitted &= ~drop; cap_data[0].inheritable &= ~drop; if (syscall(SYS_capset, &cap_hdr, &cap_data)) exit(1); } static int do_sandbox_none(void) { if (unshare(CLONE_NEWPID)) { } int pid = fork(); if (pid != 0) return wait_for_loop(pid); sandbox_common(); drop_caps(); if (unshare(CLONE_NEWNET)) { } write_file("/proc/sys/net/ipv4/ping_group_range", "0 65535"); sandbox_common_mount_tmpfs(); loop(); exit(1); } uint64_t r[6] = {0xffffffffffffffff, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0x0}; void loop(void) { intptr_t res = 0; if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } // openat$smackfs_relabel_self arguments: [ // fd: const = 0xffffffffffffff9c (8 bytes) // file: ptr[in, buffer] { // buffer: {2f 73 79 73 2f 66 73 2f 73 6d 61 63 6b 66 73 2f 72 65 6c 61 // 62 65 6c 2d 73 65 6c 66 00} (length 0x1d) // } // flags: const = 0x2 (4 bytes) // mode: const = 0x0 (2 bytes) // ] // returns fd_smackfs_labels_list NONFAILING(memcpy((void*)0x20000000, "/sys/fs/smackfs/relabel-self\000", 29)); syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x20000000ul, /*flags=*/2, /*mode=*/0); // syz_io_uring_setup arguments: [ // entries: int32 = 0x34b8 (4 bytes) // params: ptr[inout, io_uring_params] { // io_uring_params { // sq_entries: int32 = 0x0 (4 bytes) // cq_entries: int32 = 0xc3b1 (4 bytes) // flags: io_uring_setup_flags = 0x800 (4 bytes) // sq_thread_cpu: int32 = 0x1 (4 bytes) // sq_thread_idle: int32 = 0x82 (4 bytes) // features: int32 = 0x0 (4 bytes) // wq_fd: fd_io_uring (resource) // resv: buffer: {00 00 00 00 00 00 00 00 00 00 00 00} (length 0xc) // sq_off: io_sqring_offsets { // head: int32 = 0x0 (4 bytes) // tail: int32 = 0x0 (4 bytes) // ring_mask: int32 = 0x0 (4 bytes) // ring_entries: int32 = 0x0 (4 bytes) // flags: int32 = 0x0 (4 bytes) // dropped: int32 = 0x0 (4 bytes) // array: int32 = 0x0 (4 bytes) // resv1: int32 = 0x0 (4 bytes) // user_addr: int64 = 0x0 (8 bytes) // } // cq_off: io_cqring_offsets { // head: int32 = 0x0 (4 bytes) // tail: int32 = 0x0 (4 bytes) // ring_mask: int32 = 0x0 (4 bytes) // ring_entries: int32 = 0x0 (4 bytes) // overflow: int32 = 0x0 (4 bytes) // cqes: int32 = 0x0 (4 bytes) // flags: int32 = 0x0 (4 bytes) // resv1: int32 = 0x0 (4 bytes) // user_addr: int64 = 0x0 (8 bytes) // } // } // } // ring_params_ptr: ptr[out, ring_params_ptr] { // ring_params_ptr (resource) // } // ring_ptr: ptr[out, ring_ptr] { // ring_ptr (resource) // } // sqes_ptr: ptr[out, sqes_ptr] { // sqes_ptr (resource) // } // ] // returns fd_io_uring NONFAILING(*(uint32_t*)0x20000544 = 0xc3b1); NONFAILING(*(uint32_t*)0x20000548 = 0x800); NONFAILING(*(uint32_t*)0x2000054c = 1); NONFAILING(*(uint32_t*)0x20000550 = 0x82); NONFAILING(*(uint32_t*)0x20000558 = 0); NONFAILING(memset((void*)0x2000055c, 0, 12)); res = -1; NONFAILING(res = syz_io_uring_setup(/*entries=*/0x34b8, /*params=*/0x20000540, /*ring_params_ptr=*/0x20000180, /*ring_ptr=*/0x20000140, /*sqes_ptr=*/0x20000100)); if (res != -1) { r[0] = res; NONFAILING(r[1] = *(uint64_t*)0x20000180); NONFAILING(r[2] = *(uint64_t*)0x20000140); NONFAILING(r[3] = *(uint64_t*)0x20000100); } // sendmsg$DEVLINK_CMD_RATE_SET arguments: [ // fd: sock_nl_generic (resource) // msg: ptr[in, msghdr_netlink[netlink_msg_t[genl_devlink_family_id, // genlmsghdr_t[DEVLINK_CMD_RATE_SET], devlink_nl_rate_set_policy]]] { // msghdr_netlink[netlink_msg_t[genl_devlink_family_id, // genlmsghdr_t[DEVLINK_CMD_RATE_SET], devlink_nl_rate_set_policy]] { // addr: nil // addrlen: len = 0x0 (4 bytes) // pad = 0x0 (4 bytes) // vec: ptr[in, iovec[in, netlink_msg_t[genl_devlink_family_id, // genlmsghdr_t[DEVLINK_CMD_RATE_SET], devlink_nl_rate_set_policy]]] { // iovec[in, netlink_msg_t[genl_devlink_family_id, // genlmsghdr_t[DEVLINK_CMD_RATE_SET], devlink_nl_rate_set_policy]] { // addr: ptr[inout, array[ANYUNION]] { // array[ANYUNION] { // } // } // len: len = 0x14 (8 bytes) // } // } // vlen: const = 0x1 (8 bytes) // ctrl: const = 0x0 (8 bytes) // ctrllen: const = 0x0 (8 bytes) // f: send_flags = 0x0 (4 bytes) // pad = 0x0 (4 bytes) // } // } // f: send_flags = 0x0 (8 bytes) // ] NONFAILING(*(uint64_t*)0x20000040 = 0); NONFAILING(*(uint32_t*)0x20000048 = 0); NONFAILING(*(uint64_t*)0x20000050 = 0x20000580); NONFAILING(*(uint64_t*)0x20000580 = 0x20000340); NONFAILING(*(uint64_t*)0x20000588 = 0x14); NONFAILING(*(uint64_t*)0x20000058 = 1); NONFAILING(*(uint64_t*)0x20000060 = 0); NONFAILING(*(uint64_t*)0x20000068 = 0); NONFAILING(*(uint32_t*)0x20000070 = 0); syscall(__NR_sendmsg, /*fd=*/(intptr_t)-1, /*msg=*/0x20000040ul, /*f=*/0ul); // socket$inet6_sctp arguments: [ // domain: const = 0xa (8 bytes) // type: sctp_socket_type = 0x1 (8 bytes) // proto: const = 0x84 (4 bytes) // ] // returns sock_sctp6 res = syscall(__NR_socket, /*domain=*/0xaul, /*type=SOCK_STREAM*/ 1ul, /*proto=*/0x84); if (res != -1) r[4] = res; // getsockopt$inet_sctp6_SCTP_SOCKOPT_CONNECTX3 arguments: [ // fd: sock_sctp6 (resource) // level: const = 0x84 (4 bytes) // opt: const = 0x6f (4 bytes) // val: ptr[inout, sctp_getaddrs_old] { // sctp_getaddrs_old { // assoc_id: assoc_id (resource) // addr_num: bytesize = 0x10 (4 bytes) // addrs: ptr[in, array[sockaddr_sctp]] { // array[sockaddr_sctp] { // union sockaddr_sctp { // in: sockaddr_in { // family: const = 0x2 (2 bytes) // port: int16be = 0x4e21 (2 bytes) // addr: union ipv4_addr { // private: int32be = 0xa010100 (4 bytes) // } // pad = 0x0 (8 bytes) // } // } // } // } // } // } // len: nil // ] NONFAILING(*(uint32_t*)0x20000280 = 0); NONFAILING(*(uint32_t*)0x20000284 = 0x10); NONFAILING(*(uint64_t*)0x20000288 = 0x20000000); NONFAILING(*(uint16_t*)0x20000000 = 2); NONFAILING(*(uint16_t*)0x20000002 = htobe16(0x4e21)); NONFAILING(*(uint32_t*)0x20000004 = htobe32(0xa010100)); syscall(__NR_getsockopt, /*fd=*/r[4], /*level=*/0x84, /*opt=*/0x6f, /*val=*/0x20000280ul, /*len=*/0ul); // getsockopt$inet_sctp6_SCTP_MAX_BURST arguments: [ // fd: sock_sctp6 (resource) // level: const = 0x84 (4 bytes) // opt: const = 0x83 (4 bytes) // val: ptr[out, sctp_max_burst] { // union sctp_max_burst { // assoc_value: sctp_assoc_value { // assoc_id: assoc_id (resource) // assoc_value: int32 = 0x0 (4 bytes) // } // } // } // len: ptr[inout, len] { // len = 0x8 (4 bytes) // } // ] NONFAILING(*(uint32_t*)0x20000080 = 8); res = syscall(__NR_getsockopt, /*fd=*/r[4], /*level=*/0x84, /*opt=*/0x83, /*val=*/0x20000000ul, /*len=*/0x20000080ul); if (res != -1) NONFAILING(r[5] = *(uint32_t*)0x20000000); // getsockopt$inet_sctp_SCTP_AUTH_ACTIVE_KEY arguments: [ // fd: sock_sctp (resource) // level: const = 0x84 (4 bytes) // opt: const = 0x18 (4 bytes) // val: ptr[inout, sctp_authkeyid] { // sctp_authkeyid { // scact_assoc_id: assoc_id (resource) // scact_keynumber: int16 = 0x3 (2 bytes) // pad = 0x0 (2 bytes) // } // } // len: nil // ] NONFAILING(*(uint32_t*)0x20000040 = r[5]); NONFAILING(*(uint16_t*)0x20000044 = 3); syscall(__NR_getsockopt, /*fd=*/(intptr_t)-1, /*level=*/0x84, /*opt=*/0x18, /*val=*/0x20000040ul, /*len=*/0ul); // mprotect arguments: [ // addr: VMA[0xf000] // len: len = 0xf000 (8 bytes) // prot: mmap_prot = 0x9 (8 bytes) // ] syscall(__NR_mprotect, /*addr=*/0x20000000ul, /*len=*/0xf000ul, /*prot=PROT_SEM|PROT_READ*/ 9ul); // syz_io_uring_submit arguments: [ // ring_params_ptr: ring_params_ptr (resource) // ring_ptr: ring_ptr (resource) // sqes_ptr: sqes_ptr (resource) // sqe: ptr[in, io_uring_sqe_u] { // union io_uring_sqe_u { // IORING_OP_CLOSE: io_uring_sqe[IORING_OP_CLOSE, const[0, int16], fd, // const[0, int64], const[0, int64], const[0, int32], const[0, int32], // sqe_user_data_not_openat, io_uring_sqe_close_misc] { // opcode: const = 0x13 (1 bytes) // flags: iosqe_flags = 0x48 (1 bytes) // ioprio: const = 0x0 (2 bytes) // fd: fd (resource) // off: const = 0x0 (8 bytes) // addr: const = 0x0 (8 bytes) // len: const = 0x0 (4 bytes) // misc_flags: const = 0x0 (4 bytes) // user_data: sqe_user_data_not_openat = 0x0 (8 bytes) // misc: io_uring_sqe_close_misc { // buf_index_unused: const = 0x0 (2 bytes) // ioring_personality_id_unused: const = 0x0 (2 bytes) // file_index: int32 = 0x0 (4 bytes) // addr3_unused: const = 0x0 (8 bytes) // } // pad = 0x0 (8 bytes) // } // } // } // ] NONFAILING(*(uint8_t*)0x20000040 = 0x13); NONFAILING(*(uint8_t*)0x20000041 = 0x48); NONFAILING(*(uint16_t*)0x20000042 = 0); NONFAILING(*(uint32_t*)0x20000044 = r[0]); NONFAILING(*(uint64_t*)0x20000048 = 0); NONFAILING(*(uint64_t*)0x20000050 = 0); NONFAILING(*(uint32_t*)0x20000058 = 0); NONFAILING(*(uint32_t*)0x2000005c = 0); NONFAILING(*(uint64_t*)0x20000060 = 0); NONFAILING(*(uint16_t*)0x20000068 = 0); NONFAILING(*(uint16_t*)0x2000006a = 0); NONFAILING(*(uint32_t*)0x2000006c = 0); NONFAILING(*(uint64_t*)0x20000070 = 0); NONFAILING(syz_io_uring_submit(/*ring_params_ptr=*/r[1], /*ring_ptr=*/r[2], /*sqes_ptr=*/r[3], /*sqe=*/0x20000040)); // io_uring_enter arguments: [ // fd: fd_io_uring (resource) // to_submit: int32 = 0x1 (4 bytes) // min_complete: int32 = 0x1 (4 bytes) // flags: io_uring_enter_flags = 0x1 (8 bytes) // sigmask: nil // size: len = 0x0 (8 bytes) // ] syscall(__NR_io_uring_enter, /*fd=*/r[0], /*to_submit=*/1, /*min_complete=*/1, /*flags=IORING_ENTER_GETEVENTS*/ 1ul, /*sigmask=*/0ul, /*size=*/0ul); // syz_io_uring_submit arguments: [ // ring_params_ptr: ring_params_ptr (resource) // ring_ptr: ring_ptr (resource) // sqes_ptr: sqes_ptr (resource) // sqe: ptr[in, io_uring_sqe_u] { // union io_uring_sqe_u { // IORING_OP_CLOSE: io_uring_sqe[IORING_OP_CLOSE, const[0, int16], fd, // const[0, int64], const[0, int64], const[0, int32], const[0, int32], // sqe_user_data_not_openat, io_uring_sqe_close_misc] { // opcode: const = 0x13 (1 bytes) // flags: iosqe_flags = 0x48 (1 bytes) // ioprio: const = 0x0 (2 bytes) // fd: fd (resource) // off: const = 0x0 (8 bytes) // addr: const = 0x0 (8 bytes) // len: const = 0x0 (4 bytes) // misc_flags: const = 0x0 (4 bytes) // user_data: sqe_user_data_not_openat = 0x0 (8 bytes) // misc: io_uring_sqe_close_misc { // buf_index_unused: const = 0x0 (2 bytes) // ioring_personality_id_unused: const = 0x0 (2 bytes) // file_index: int32 = 0x0 (4 bytes) // addr3_unused: const = 0x0 (8 bytes) // } // pad = 0x0 (8 bytes) // } // } // } // ] NONFAILING(*(uint8_t*)0x20000040 = 0x13); NONFAILING(*(uint8_t*)0x20000041 = 0x48); NONFAILING(*(uint16_t*)0x20000042 = 0); NONFAILING(*(uint32_t*)0x20000044 = r[0]); NONFAILING(*(uint64_t*)0x20000048 = 0); NONFAILING(*(uint64_t*)0x20000050 = 0); NONFAILING(*(uint32_t*)0x20000058 = 0); NONFAILING(*(uint32_t*)0x2000005c = 0); NONFAILING(*(uint64_t*)0x20000060 = 0); NONFAILING(*(uint16_t*)0x20000068 = 0); NONFAILING(*(uint16_t*)0x2000006a = 0); NONFAILING(*(uint32_t*)0x2000006c = 0); NONFAILING(*(uint64_t*)0x20000070 = 0); NONFAILING(syz_io_uring_submit(/*ring_params_ptr=*/r[1], /*ring_ptr=*/r[2], /*sqes_ptr=*/r[3], /*sqe=*/0x20000040)); // io_uring_enter arguments: [ // fd: fd_io_uring (resource) // to_submit: int32 = 0x1 (4 bytes) // min_complete: int32 = 0x1 (4 bytes) // flags: io_uring_enter_flags = 0x1 (8 bytes) // sigmask: nil // size: len = 0x0 (8 bytes) // ] syscall(__NR_io_uring_enter, /*fd=*/r[0], /*to_submit=*/1, /*min_complete=*/1, /*flags=IORING_ENTER_GETEVENTS*/ 1ul, /*sigmask=*/0ul, /*size=*/0ul); } int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x20000000ul, /*len=*/0x1000000, /*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=*/0x21000000ul, /*len=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); const char* reason; (void)reason; install_segv_handler(); do_sandbox_none(); return 0; }