// https://syzkaller.appspot.com/bug?id=7f2c87f4c360bcb8419c1cd55853d16cb89edbac // 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 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 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); } #define BITMASK(bf_off, bf_len) (((1ull << (bf_len)) - 1) << (bf_off)) #define STORE_BY_BITMASK(type, htobe, addr, val, bf_off, bf_len) \ *(type*)(addr) = \ htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | \ (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len)))) static bool write_file(const char* file, const char* what, ...) { char buf[1024]; va_list args; va_start(args, what); vsnprintf(buf, sizeof(buf), what, args); va_end(args); buf[sizeof(buf) - 1] = 0; int len = strlen(buf); int fd = open(file, O_WRONLY | O_CLOEXEC); if (fd == -1) return false; if (write(fd, buf, len) != len) { int err = errno; close(fd); errno = err; return false; } close(fd); return true; } static int runcmdline(char* cmdline) { int ret = system(cmdline); if (ret) { } return ret; } #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 long syz_ublk_setup_io_uring(volatile long a0, volatile long a1, volatile long a2, volatile long a3, volatile long a4) { struct io_uring_params* params = (struct io_uring_params*)a1; params->flags |= IORING_SETUP_SQE128 | IORING_SETUP_CQE32; return syz_io_uring_setup(a0, (long)params, a2, a3, a4); } #define UBLK_F_USER_COPY (1UL << 7) #define UBLK_IO_RES_OK 0 #define UBLK_IO_RES_NEED_GET_DATA 1 #define UBLK_IO_COMMIT_AND_FETCH_REQ 0x21 #define UBLK_IO_NEED_GET_DATA 0x22 #define UBLK_U_IO_COMMIT_AND_FETCH_REQ \ _IOWR('u', UBLK_IO_COMMIT_AND_FETCH_REQ, struct ublksrv_io_cmd) #define UBLK_U_IO_NEED_GET_DATA \ _IOWR('u', UBLK_IO_NEED_GET_DATA, struct ublksrv_io_cmd) struct ublksrv_ctrl_cmd { __u32 dev_id; __u16 queue_id; __u16 len; __u64 addr; __u64 data[1]; __u16 dev_path_len; __u16 pad; __u32 reserved; }; struct ublksrv_ctrl_dev_info { __u16 nr_hw_queues; __u16 queue_depth; __u16 state; __u16 pad0; __u32 max_io_buf_bytes; __u32 dev_id; __s32 ublksrv_pid; __u32 pad1; __u64 flags; __u64 ublksrv_flags; __u32 owner_uid; __u32 owner_gid; __u64 reserved1; __u64 reserved2; }; struct ublksrv_io_desc { __u32 op_flags; union { __u32 nr_sectors; __u32 nr_zones; }; __u64 start_sector; __u64 addr; }; struct ublksrv_io_cmd { __u16 q_id; __u16 tag; __s32 result; union { __u64 addr; __u64 zone_append_lba; }; }; struct io_uring_sqe { __u8 opcode; __u8 flags; __u16 ioprio; __s32 fd; union { __u64 off; __u64 addr2; struct { __u32 cmd_op; __u32 __pad1; }; }; union { __u64 addr; __u64 splice_off_in; struct { __u32 level; __u32 optname; }; }; __u32 len; union { __kernel_rwf_t rw_flags; __u32 fsync_flags; __u16 poll_events; __u32 poll32_events; __u32 sync_range_flags; __u32 msg_flags; __u32 timeout_flags; __u32 accept_flags; __u32 cancel_flags; __u32 open_flags; __u32 statx_flags; __u32 fadvise_advice; __u32 splice_flags; __u32 rename_flags; __u32 unlink_flags; __u32 hardlink_flags; __u32 xattr_flags; __u32 msg_ring_flags; __u32 uring_cmd_flags; __u32 waitid_flags; __u32 futex_flags; __u32 install_fd_flags; __u32 nop_flags; __u32 pipe_flags; }; __u64 user_data; union { __u16 buf_index; __u16 buf_group; } __attribute__((packed)); __u16 personality; union { __s32 splice_fd_in; __u32 file_index; __u32 zcrx_ifq_idx; __u32 optlen; struct { __u16 addr_len; __u16 __pad3[1]; }; }; union { struct { __u64 addr3; __u64 __pad2[1]; }; struct { __u64 attr_ptr; __u64 attr_type_mask; }; __u64 optval; __u8 cmd[0]; }; }; static long syz_ublk_add_dev(volatile long a0, volatile long a1, volatile long a2, volatile long a3, volatile long a4, volatile long a5) { __u32 ring_fd = (__u32)a0; struct io_uring_params* params = (struct io_uring_params*)a1; char* ring_ptr = (char*)a2; char* sqes_ptr = (char*)a3; struct io_uring_sqe* sqe = (struct io_uring_sqe*)a4; void** dev_info_ptr_out = (void**)a5; struct ublksrv_ctrl_cmd* cmd = (struct ublksrv_ctrl_cmd*)(sqe->cmd); struct ublksrv_ctrl_dev_info* dev_info = (struct ublksrv_ctrl_dev_info*)(unsigned long)(cmd->addr); dev_info->flags |= UBLK_F_USER_COPY; int ret = syz_io_uring_submit((long)params, (long)ring_ptr, (long)sqes_ptr, (long)sqe); if (ret < 0) return (long)ret; syscall(__NR_io_uring_enter, ring_fd, 1, 1, 1, NULL, _NSIG / 8); *dev_info_ptr_out = (void*)dev_info; return dev_info->dev_id; } struct ublk_queue { __u16 q_id; __u32 char_dev_fd; struct io_uring_params params; __u32 ring_fd; char* ring_ptr; char* sqes_ptr; char* io_cmd_buf; }; #define UBLK_MAX_QUEUE_DEPTH 4096 #define UBLK_QUEUES_OFFSET 0 #define round_up(x, y) (((x) + (y) - 1) / (y) * (y)) static long syz_ublk_setup_queues(volatile long a0, volatile long a1, volatile long a2, volatile long a3, volatile long a4, volatile long a5, volatile long a6) { int char_dev_fd = (int)a0; struct ublksrv_ctrl_dev_info* dev_info = (struct ublksrv_ctrl_dev_info*)a1; struct io_uring_params* params = (struct io_uring_params*)a2; struct ublk_queue* queues = (struct ublk_queue*)a3; int queues_len = (int)a4; struct io_uring_sqe* sqe = (struct io_uring_sqe*)a5; void** queues_ptr_out = (void**)a6; if (char_dev_fd < 0 || !dev_info) return -1; memset(queues, 0, sizeof(struct ublk_queue) * queues_len); int queue_depth = dev_info->queue_depth; for (int q_id = 0; q_id < dev_info->nr_hw_queues; q_id++) { struct ublk_queue* queue = &queues[q_id]; queue->q_id = q_id; queue->char_dev_fd = char_dev_fd; queue->params = *params; struct io_uring_params* temp = NULL; queue->ring_fd = syz_ublk_setup_io_uring( (long)queue_depth, (long)&queue->params, (long)&temp, (long)&queue->ring_ptr, (long)&queue->sqes_ptr); if (queue->ring_fd < 0) { return queue->ring_fd; } unsigned long cmd_buf_size = round_up(queue_depth * sizeof(struct ublksrv_io_desc), getpagesize()); unsigned long off = UBLK_QUEUES_OFFSET + q_id * round_up(UBLK_MAX_QUEUE_DEPTH * sizeof(struct ublksrv_io_desc), getpagesize()); queue->io_cmd_buf = (char*)mmap(0, cmd_buf_size, PROT_READ, MAP_SHARED | MAP_POPULATE, char_dev_fd, off); if (queue->io_cmd_buf == MAP_FAILED) { return -1; } for (int j = 0; j < queue_depth; j++) { struct ublksrv_io_cmd* cmd = (struct ublksrv_io_cmd*)(&sqe->cmd); cmd->q_id = q_id; cmd->tag = j; cmd->addr = 0; sqe->user_data = j | (sqe->cmd_op << 16); if (syz_io_uring_submit((long)&queue->params, (long)queue->ring_ptr, (long)queue->sqes_ptr, (long)sqe) < 0) { return -1; } syscall(__NR_io_uring_enter, queue->ring_fd, 1, 0, 0, NULL, _NSIG / 8); } } *queues_ptr_out = (void*)queues; return 0; } #define MAX_FDS 30 static long syz_open_dev(volatile long a0, volatile long a1, volatile long a2) { if (a0 == 0xc || a0 == 0xb) { char buf[128]; sprintf(buf, "/dev/%s/%d:%d", a0 == 0xc ? "char" : "block", (uint8_t)a1, (uint8_t)a2); return open(buf, O_RDWR, 0); } else { unsigned long nb = a1; char buf[1024]; char* hash; strncpy(buf, (char*)a0, sizeof(buf) - 1); buf[sizeof(buf) - 1] = 0; while ((hash = strchr(buf, '#'))) { *hash = '0' + (char)(nb % 10); nb /= 10; } return open(buf, a2 & ~O_CREAT, 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)) { } } } 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); } static void close_fds() { for (int fd = 3; fd < MAX_FDS; fd++) close(fd); } static const char* setup_binfmt_misc() { if (mount(0, "/proc/sys/fs/binfmt_misc", "binfmt_misc", 0, 0) && errno != EBUSY) { return NULL; } if (!write_file("/proc/sys/fs/binfmt_misc/register", ":syz0:M:0:\x01::./file0:") || !write_file("/proc/sys/fs/binfmt_misc/register", ":syz1:M:1:\x02::/proc/thread-self/cwd/file0:POC")) return "write(/proc/sys/fs/binfmt_misc/register) failed"; return NULL; } static void setup_sysctl() { int cad_pid = fork(); if (cad_pid < 0) exit(1); if (cad_pid == 0) { for (;;) sleep(100); } char tmppid[32]; snprintf(tmppid, sizeof(tmppid), "%d", cad_pid); struct { const char* name; const char* data; } files[] = { {"/sys/kernel/debug/x86/nmi_longest_ns", "10000000000"}, {"/proc/sys/kernel/hung_task_check_interval_secs", "20"}, {"/proc/sys/net/core/bpf_jit_kallsyms", "1"}, {"/proc/sys/net/core/bpf_jit_harden", "0"}, {"/proc/sys/kernel/kptr_restrict", "0"}, {"/proc/sys/kernel/softlockup_all_cpu_backtrace", "1"}, {"/proc/sys/fs/mount-max", "100"}, {"/proc/sys/vm/oom_dump_tasks", "0"}, {"/proc/sys/debug/exception-trace", "0"}, {"/proc/sys/kernel/printk", "7 4 1 3"}, {"/proc/sys/kernel/keys/gc_delay", "1"}, {"/proc/sys/vm/oom_kill_allocating_task", "1"}, {"/sys/kernel/debug/failslab/task-filter", "Y"}, {"/sys/kernel/debug/fail_page_alloc/task-filter", "Y"}, {"/sys/kernel/debug/fail_futex/task-filter", "Y"}, {"/sys/kernel/debug/fail_usercopy/task-filter", "Y"}, {"/sys/kernel/debug/fail_make_request/task-filter", "Y"}, {"/sys/kernel/debug/fail_io_timeout/task-filter", "Y"}, {"/sys/kernel/debug/fail_iommufd/task-filter", "Y"}, {"/proc/sys/kernel/ctrl-alt-del", "0"}, {"/proc/sys/kernel/cad_pid", tmppid}, }; for (size_t i = 0; i < sizeof(files) / sizeof(files[0]); i++) { if (!write_file(files[i].name, files[i].data)) { } } kill(cad_pid, SIGKILL); while (waitpid(cad_pid, NULL, 0) != cad_pid) ; } #define SWAP_FILE "./swap-file" #define SWAP_FILE_SIZE (128 * 1000 * 1000) static const char* setup_swap() { swapoff(SWAP_FILE); unlink(SWAP_FILE); int fd = open(SWAP_FILE, O_CREAT | O_WRONLY | O_CLOEXEC, 0600); if (fd == -1) return "swap file open failed"; fallocate(fd, FALLOC_FL_ZERO_RANGE, 0, SWAP_FILE_SIZE); close(fd); char cmdline[64]; sprintf(cmdline, "mkswap %s", SWAP_FILE); if (runcmdline(cmdline)) return "mkswap failed"; if (swapon(SWAP_FILE, SWAP_FLAG_PREFER) == 1) return "swapon failed"; return NULL; } uint64_t r[9] = { 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffffffffffff}; void loop(void) { intptr_t res = 0; if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } // openat$ublk_ctrl arguments: [ // fd: const = 0xffffffffffffff9c (8 bytes) // file: ptr[in, buffer] { // buffer: {2f 64 65 76 2f 75 62 6c 6b 2d 63 6f 6e 74 72 6f 6c 00} // (length 0x12) // } // flags: const = 0x2 (4 bytes) // mode: const = 0x0 (2 bytes) // ] // returns fd_ublk_ctrl NONFAILING(memcpy((void*)0x200000000000, "/dev/ublk-control\000", 18)); res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x200000000000ul, /*flags=*/2, /*mode=*/0); if (res != -1) r[0] = res; // syz_ublk_setup_io_uring arguments: [ // entries: int32 = 0x20 (4 bytes) // params: ptr[inout, io_uring_params] { // io_uring_params { // sq_entries: int32 = 0x0 (4 bytes) // cq_entries: int32 = 0x0 (4 bytes) // flags: io_uring_setup_flags = 0x0 (4 bytes) // sq_thread_cpu: int32 = 0x0 (4 bytes) // sq_thread_idle: int32 = 0x0 (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*)0x200000000184 = 0); NONFAILING(*(uint32_t*)0x200000000188 = 0); NONFAILING(*(uint32_t*)0x20000000018c = 0); NONFAILING(*(uint32_t*)0x200000000190 = 0); NONFAILING(*(uint32_t*)0x200000000198 = -1); NONFAILING(memset((void*)0x20000000019c, 0, 12)); res = -1; NONFAILING(res = syz_ublk_setup_io_uring( /*entries=*/0x20, /*params=*/0x200000000180, /*ring_params_ptr=*/0x2000000000c0, /*ring_ptr=*/0x200000000100, /*sqes_ptr=*/0x200000000140)); if (res != -1) { r[1] = res; NONFAILING(r[2] = *(uint64_t*)0x2000000000c0); NONFAILING(r[3] = *(uint64_t*)0x200000000100); NONFAILING(r[4] = *(uint64_t*)0x200000000140); } // syz_ublk_add_dev arguments: [ // fd_io_uring: fd_io_uring (resource) // ring_params_ptr: ring_params_ptr (resource) // ring_ptr: ring_ptr (resource) // sqes_ptr: sqes_ptr (resource) // sqe: ptr[inout, io_uring_sqe_uring[fd_ublk_ctrl, // const[UBLK_U_CMD_ADD_DEV, int32], ublk_ctrl_cmd$add_dev, int64]] { // io_uring_sqe_uring[fd_ublk_ctrl, const[UBLK_U_CMD_ADD_DEV, int32], // ublk_ctrl_cmd$add_dev, int64] { // opcode: const = 0x2e (1 bytes) // flags: iosqe_flags = 0xc (1 bytes) // ioprio: const = 0x0 (2 bytes) // fd: fd_ublk_ctrl (resource) // cmd_op: const = 0xc0207504 (4 bytes) // pad1: const = 0x0 (4 bytes) // addr: const = 0x0 (8 bytes) // len: const = 0x0 (4 bytes) // uring_flags: uring_cmd_flags = 0x0 (4 bytes) // user_data: int64 = 0x0 (8 bytes) // buf_index_unused: const = 0x0 (2 bytes) // ioring_personality_id: ioring_personality_id (resource) // pad_unused: buffer: {00 00 00 00} (length 0x4) // cmd: ublk_ctrl_cmd[const[-1, int32], len[addr, int16], ptr64[in, // ublk_ctrl_dev_info_new], const[0, int64]] { // dev_id: const = 0xffffffff (4 bytes) // queue_id: const = 0xffff (2 bytes) // len: len = 0x40 (2 bytes) // addr: ptr[in, ublk_ctrl_dev_info_new] { // union ublk_ctrl_dev_info_new { // new_dev: ublk_ctrl_dev_info[const[-1, int32]] { // nr_hw_queues: int16 = 0x3 (2 bytes) // queue_depth: int16 = 0x104 (2 bytes) // state: const = 0x0 (2 bytes) // pad0: const = 0x0 (2 bytes) // max_io_buf_bytes: const = 0x1000 (4 bytes) // dev_id: const = 0xffffffff (4 bytes) // ublk_pid: pid (resource) // pad1: const = 0x0 (4 bytes) // flags: ublk_f_flags = 0x0 (8 bytes) // ublk_flags: const = 0x0 (8 bytes) // owner_uid: const = 0x0 (4 bytes) // owner_gid: const = 0x0 (4 bytes) // reserved1: const = 0x0 (8 bytes) // reserved2: const = 0x0 (8 bytes) // } // } // } // data: const = 0x0 (8 bytes) // dev_path_len: const = 0x0 (2 bytes) // pad: const = 0x0 (2 bytes) // reserved: const = 0x0 (4 bytes) // pad2_unused: buffer: {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 0x30) // } // } // } // dev_info_ptr: ptr[out, dev_info_ptr] { // dev_info_ptr (resource) // } // ] // returns ublk_dev_id NONFAILING(*(uint8_t*)0x200000000200 = 0x2e); NONFAILING(*(uint8_t*)0x200000000201 = 0xc); NONFAILING(*(uint16_t*)0x200000000202 = 0); NONFAILING(*(uint32_t*)0x200000000204 = r[0]); NONFAILING(*(uint32_t*)0x200000000208 = 0xc0207504); NONFAILING(*(uint32_t*)0x20000000020c = 0); NONFAILING(*(uint64_t*)0x200000000210 = 0); NONFAILING(*(uint32_t*)0x200000000218 = 0); NONFAILING(*(uint32_t*)0x20000000021c = 0); NONFAILING(*(uint64_t*)0x200000000220 = 0); NONFAILING(*(uint16_t*)0x200000000228 = 0); NONFAILING(*(uint16_t*)0x20000000022a = 0); NONFAILING(memset((void*)0x20000000022c, 0, 4)); NONFAILING(*(uint32_t*)0x200000000230 = -1); NONFAILING(*(uint16_t*)0x200000000234 = -1); NONFAILING(*(uint16_t*)0x200000000236 = 0x40); NONFAILING(*(uint64_t*)0x200000000238 = 0x200000000500); NONFAILING(*(uint16_t*)0x200000000500 = 3); NONFAILING(*(uint16_t*)0x200000000502 = 0x104); NONFAILING(*(uint16_t*)0x200000000504 = 0); NONFAILING(*(uint16_t*)0x200000000506 = 0); NONFAILING(*(uint32_t*)0x200000000508 = 0x1000); NONFAILING(*(uint32_t*)0x20000000050c = -1); NONFAILING(*(uint32_t*)0x200000000510 = 0); NONFAILING(*(uint32_t*)0x200000000514 = 0); NONFAILING(*(uint64_t*)0x200000000518 = 0); NONFAILING(*(uint64_t*)0x200000000520 = 0); NONFAILING(*(uint32_t*)0x200000000528 = 0); NONFAILING(*(uint32_t*)0x20000000052c = 0); NONFAILING(*(uint64_t*)0x200000000530 = 0); NONFAILING(*(uint64_t*)0x200000000538 = 0); NONFAILING(*(uint64_t*)0x200000000240 = 0); NONFAILING(*(uint16_t*)0x200000000248 = 0); NONFAILING(*(uint16_t*)0x20000000024a = 0); NONFAILING(*(uint32_t*)0x20000000024c = 0); NONFAILING(memset((void*)0x200000000250, 0, 48)); res = -1; NONFAILING(res = syz_ublk_add_dev(/*fd_io_uring=*/r[1], /*ring_params_ptr=*/r[2], /*ring_ptr=*/r[3], /*sqes_ptr=*/r[4], /*sqe=*/0x200000000200, /*dev_info_ptr=*/0x200000000300)); if (res != -1) { r[5] = res; NONFAILING(r[6] = *(uint16_t*)0x20000000022a); NONFAILING(r[7] = *(uint64_t*)0x200000000300); } // syz_open_dev$ublk_chdev arguments: [ // dev: ptr[in, buffer] { // buffer: {2f 64 65 76 2f 75 62 6c 6b 63 23 00} (length 0xc) // } // id: ublk_dev_id (resource) // flags: open_flags = 0x2 (8 bytes) // ] // returns fd_ublk_ch NONFAILING(memcpy((void*)0x200000002000, "/dev/ublkc#\000", 12)); res = -1; NONFAILING(res = syz_open_dev(/*dev=*/0x200000002000, /*id=*/r[5], /*flags=O_RDWR*/ 2)); if (res != -1) r[8] = res; // syz_ublk_setup_queues arguments: [ // fd_ublk_ch: fd_ublk_ch (resource) // dev_info_ptr: dev_info_ptr (resource) // params: ptr[in, io_uring_params] { // io_uring_params { // sq_entries: int32 = 0x0 (4 bytes) // cq_entries: int32 = 0x7193 (4 bytes) // flags: io_uring_setup_flags = 0x400 (4 bytes) // sq_thread_cpu: int32 = 0x2 (4 bytes) // sq_thread_idle: int32 = 0x219 (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) // } // } // } // queues: ptr[out, array[ublk_queue]] { // array[ublk_queue] { // ublk_queue { // queue_id: int16 = 0x0 (2 bytes) // pad1: const = 0x0 (2 bytes) // fd_ublk_ch: fd_ublk_ch (resource) // params: io_uring_params { // sq_entries: int32 = 0x0 (4 bytes) // cq_entries: int32 = 0x72bc (4 bytes) // flags: io_uring_setup_flags = 0x40 (4 bytes) // sq_thread_cpu: int32 = 0x4000002 (4 bytes) // sq_thread_idle: int32 = 0x30c (4 bytes) // features: int32 = 0x0 (4 bytes) // wq_fd: fd_io_uring (resource) // resv: buffer: (DirOut) // 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_fd: fd_io_uring (resource) // pad2: const = 0x0 (4 bytes) // ring_ptr: ring_ptr (resource) // sqes_ptr: sqes_ptr (resource) // io_cmd_buf: intptr = 0x0 (8 bytes) // } // ublk_queue { // queue_id: int16 = 0x0 (2 bytes) // pad1: const = 0x0 (2 bytes) // fd_ublk_ch: fd_ublk_ch (resource) // params: io_uring_params { // sq_entries: int32 = 0x0 (4 bytes) // cq_entries: int32 = 0x1887 (4 bytes) // flags: io_uring_setup_flags = 0x40 (4 bytes) // sq_thread_cpu: int32 = 0x10003 (4 bytes) // sq_thread_idle: int32 = 0x393 (4 bytes) // features: int32 = 0x0 (4 bytes) // wq_fd: fd_io_uring (resource) // resv: buffer: (DirOut) // 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_fd: fd_io_uring (resource) // pad2: const = 0x0 (4 bytes) // ring_ptr: ring_ptr (resource) // sqes_ptr: sqes_ptr (resource) // io_cmd_buf: intptr = 0x0 (8 bytes) // } // ublk_queue { // queue_id: int16 = 0x0 (2 bytes) // pad1: const = 0x0 (2 bytes) // fd_ublk_ch: fd_ublk_ch (resource) // params: io_uring_params { // sq_entries: int32 = 0x0 (4 bytes) // cq_entries: int32 = 0x468b (4 bytes) // flags: io_uring_setup_flags = 0x8 (4 bytes) // sq_thread_cpu: int32 = 0x1 (4 bytes) // sq_thread_idle: int32 = 0xc5 (4 bytes) // features: int32 = 0x0 (4 bytes) // wq_fd: fd_io_uring (resource) // resv: buffer: (DirOut) // 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_fd: fd_io_uring (resource) // pad2: const = 0x0 (4 bytes) // ring_ptr: ring_ptr (resource) // sqes_ptr: sqes_ptr (resource) // io_cmd_buf: intptr = 0x0 (8 bytes) // } // ublk_queue { // queue_id: int16 = 0x0 (2 bytes) // pad1: const = 0x0 (2 bytes) // fd_ublk_ch: fd_ublk_ch (resource) // params: io_uring_params { // sq_entries: int32 = 0x0 (4 bytes) // cq_entries: int32 = 0xc7a (4 bytes) // flags: io_uring_setup_flags = 0x44 (4 bytes) // sq_thread_cpu: int32 = 0x0 (4 bytes) // sq_thread_idle: int32 = 0x20a (4 bytes) // features: int32 = 0x0 (4 bytes) // wq_fd: fd_io_uring (resource) // resv: buffer: (DirOut) // 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_fd: fd_io_uring (resource) // pad2: const = 0x0 (4 bytes) // ring_ptr: ring_ptr (resource) // sqes_ptr: sqes_ptr (resource) // io_cmd_buf: intptr = 0x0 (8 bytes) // } // } // } // nr_queues: const = 0x4 (8 bytes) // sqe: ptr[inout, io_uring_sqe_uring[fd_ublk_ch, // const[UBLK_U_IO_FETCH_REQ, int32], ublk_io_cmd$fetch_req, // user_data[UBLK_U_IO_FETCH_REQ]]] { // io_uring_sqe_uring[fd_ublk_ch, const[UBLK_U_IO_FETCH_REQ, int32], // ublk_io_cmd$fetch_req, user_data[UBLK_U_IO_FETCH_REQ]] { // opcode: const = 0x2e (1 bytes) // flags: iosqe_flags = 0x50 (1 bytes) // ioprio: const = 0x0 (2 bytes) // fd: fd_ublk_ch (resource) // cmd_op: const = 0xc0107520 (4 bytes) // pad1: const = 0x0 (4 bytes) // addr: const = 0x0 (8 bytes) // len: const = 0x0 (4 bytes) // uring_flags: uring_cmd_flags = 0x0 (4 bytes) // user_data: user_data[UBLK_U_IO_FETCH_REQ] { // tag: int64 = 0xff (0 bytes) // cmd: const = 0xc0107520 (0 bytes) // pad: const = 0x0 (8 bytes) // } // buf_index_unused: const = 0x0 (2 bytes) // ioring_personality_id: ioring_personality_id (resource) // pad_unused: buffer: {00 00 00 00} (length 0x4) // cmd: ublk_io_cmd[int16[0:UBLK_MAX_HW_QUEUES], // int16[0:UBLK_MAX_QUEUE_DEPTH], const[0, int32], ptr64[inout, // ublk_io_buf_u]] { // q_id: int16 = 0x4 (2 bytes) // tag: int16 = 0xe52 (2 bytes) // result: const = 0x0 (4 bytes) // addr: nil // pad: buffer: {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 0x40) // } // } // } // ublk_queues_ptr: nil // ] NONFAILING(*(uint32_t*)0x200000000344 = 0x7193); NONFAILING(*(uint32_t*)0x200000000348 = 0x400); NONFAILING(*(uint32_t*)0x20000000034c = 2); NONFAILING(*(uint32_t*)0x200000000350 = 0x219); NONFAILING(*(uint32_t*)0x200000000358 = -1); NONFAILING(memset((void*)0x20000000035c, 0, 12)); NONFAILING(*(uint32_t*)0x2000000005cc = 0x72bc); NONFAILING(*(uint32_t*)0x2000000005d0 = 0x40); NONFAILING(*(uint32_t*)0x2000000005d4 = 0x4000002); NONFAILING(*(uint32_t*)0x2000000005d8 = 0x30c); NONFAILING(*(uint32_t*)0x2000000005e0 = r[1]); NONFAILING(*(uint32_t*)0x20000000066c = 0x1887); NONFAILING(*(uint32_t*)0x200000000670 = 0x40); NONFAILING(*(uint32_t*)0x200000000674 = 0x10003); NONFAILING(*(uint32_t*)0x200000000678 = 0x393); NONFAILING(*(uint32_t*)0x200000000680 = -1); NONFAILING(*(uint32_t*)0x20000000070c = 0x468b); NONFAILING(*(uint32_t*)0x200000000710 = 8); NONFAILING(*(uint32_t*)0x200000000714 = 1); NONFAILING(*(uint32_t*)0x200000000718 = 0xc5); NONFAILING(*(uint32_t*)0x200000000720 = r[1]); NONFAILING(*(uint32_t*)0x2000000007ac = 0xc7a); NONFAILING(*(uint32_t*)0x2000000007b0 = 0x44); NONFAILING(*(uint32_t*)0x2000000007b4 = 0); NONFAILING(*(uint32_t*)0x2000000007b8 = 0x20a); NONFAILING(*(uint32_t*)0x2000000007c0 = r[1]); NONFAILING(*(uint8_t*)0x200000001dc0 = 0x2e); NONFAILING(*(uint8_t*)0x200000001dc1 = 0x50); NONFAILING(*(uint16_t*)0x200000001dc2 = 0); NONFAILING(*(uint32_t*)0x200000001dc4 = r[8]); NONFAILING(*(uint32_t*)0x200000001dc8 = 0xc0107520); NONFAILING(*(uint32_t*)0x200000001dcc = 0); NONFAILING(*(uint64_t*)0x200000001dd0 = 0); NONFAILING(*(uint32_t*)0x200000001dd8 = 0); NONFAILING(*(uint32_t*)0x200000001ddc = 0); NONFAILING(STORE_BY_BITMASK(uint64_t, , 0x200000001de0, 0xff, 0, 16)); NONFAILING(STORE_BY_BITMASK(uint64_t, , 0x200000001de0, 0xc0107520, 16, 32)); NONFAILING(STORE_BY_BITMASK(uint64_t, , 0x200000001de0, 0, 48, 16)); NONFAILING(*(uint16_t*)0x200000001de8 = 0); NONFAILING(*(uint16_t*)0x200000001dea = r[6]); NONFAILING(memset((void*)0x200000001dec, 0, 4)); NONFAILING(*(uint16_t*)0x200000001df0 = 4); NONFAILING(*(uint16_t*)0x200000001df2 = 0xe52); NONFAILING(*(uint32_t*)0x200000001df4 = 0); NONFAILING(*(uint64_t*)0x200000001df8 = 0); NONFAILING(memset((void*)0x200000001e00, 0, 64)); NONFAILING(syz_ublk_setup_queues( /*fd_ublk_ch=*/r[8], /*dev_info_ptr=*/r[7], /*params=*/0x200000000340, /*queues=*/0x2000000005c0, /*nr_queues=*/4, /*sqe=*/0x200000001dc0, /*ublk_queues_ptr=*/0)); close_fds(); } int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*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=*/0x200001000000ul, /*len=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); setup_sysctl(); const char* reason; (void)reason; if ((reason = setup_binfmt_misc())) printf("the reproducer may not work as expected: binfmt_misc setup failed: " "%s\n", reason); if ((reason = setup_swap())) printf("the reproducer may not work as expected: swap setup failed: %s\n", reason); install_segv_handler(); use_temporary_dir(); do_sandbox_none(); return 0; }