// https://syzkaller.appspot.com/bug?id=016814f413b437ebf8d530b3775e620a892cf584 // 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_bpf #define __NR_bpf 321 #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; } #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; } #define MAX_FDS 30 static void setup_common() { if (mount(0, "/sys/fs/fuse/connections", "fusectl", 0, 0)) { } } static void setup_binderfs() { if (mkdir("/dev/binderfs", 0777)) { } if (mount("binder", "/dev/binderfs", "binder", 0, NULL)) { } if (symlink("/dev/binderfs", "./binderfs")) { } } static void loop(); static void sandbox_common() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setsid(); 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); setup_common(); sandbox_common(); drop_caps(); if (unshare(CLONE_NEWNET)) { } write_file("/proc/sys/net/ipv4/ping_group_range", "0 65535"); setup_binderfs(); loop(); exit(1); } static void kill_and_wait(int pid, int* status) { kill(-pid, SIGKILL); kill(pid, SIGKILL); for (int i = 0; i < 100; i++) { if (waitpid(-1, status, WNOHANG | __WALL) == pid) return; usleep(1000); } DIR* dir = opendir("/sys/fs/fuse/connections"); if (dir) { for (;;) { struct dirent* ent = readdir(dir); if (!ent) break; if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) continue; char abort[300]; snprintf(abort, sizeof(abort), "/sys/fs/fuse/connections/%s/abort", ent->d_name); int fd = open(abort, O_WRONLY); if (fd == -1) { continue; } if (write(fd, abort, 1) < 0) { } close(fd); } closedir(dir); } else { } while (waitpid(-1, status, __WALL) != pid) { } } static void setup_test() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setpgrp(); write_file("/proc/self/oom_score_adj", "1000"); } static void close_fds() { for (int fd = 3; fd < MAX_FDS; fd++) close(fd); } #define USLEEP_FORKED_CHILD (3 * 50 * 1000) static long handle_clone_ret(long ret) { if (ret != 0) { return ret; } usleep(USLEEP_FORKED_CHILD); syscall(__NR_exit, 0); while (1) { } } static long syz_clone(volatile long flags, volatile long stack, volatile long stack_len, volatile long ptid, volatile long ctid, volatile long tls) { long sp = (stack + stack_len) & ~15; long ret = (long)syscall(__NR_clone, flags & ~CLONE_VM, sp, ptid, ctid, tls); return handle_clone_ret(ret); } 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(); close_fds(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5000) continue; kill_and_wait(pid, &status); break; } } } uint64_t r[5] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x0}; void execute_one(void) { intptr_t res = 0; *(uint32_t*)0x20000180 = 0x18; *(uint32_t*)0x20000184 = 5; *(uint64_t*)0x20000188 = 0x20000280; memcpy((void*)0x20000280, "\x18\x01\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x4b\x64\xff\xec\x85" "\x00\x00\x00\x6d\x00\x00\x00\x85\x00\x00\x00\x05\x00\x00\x00\x95", 33); *(uint64_t*)0x20000190 = 0x20000100; memcpy((void*)0x20000100, "GPL\000", 4); *(uint32_t*)0x20000198 = 0; *(uint32_t*)0x2000019c = 0; *(uint64_t*)0x200001a0 = 0; *(uint32_t*)0x200001a8 = 0; *(uint32_t*)0x200001ac = 0; memset((void*)0x200001b0, 0, 16); *(uint32_t*)0x200001c0 = 0; *(uint32_t*)0x200001c4 = 2; *(uint32_t*)0x200001c8 = -1; *(uint32_t*)0x200001cc = 8; *(uint64_t*)0x200001d0 = 0; *(uint32_t*)0x200001d8 = 0; *(uint32_t*)0x200001dc = 0x10; *(uint64_t*)0x200001e0 = 0; *(uint32_t*)0x200001e8 = 0; *(uint32_t*)0x200001ec = 0; *(uint32_t*)0x200001f0 = 0; *(uint32_t*)0x200001f4 = 0; *(uint64_t*)0x200001f8 = 0; *(uint64_t*)0x20000200 = 0; *(uint32_t*)0x20000208 = 0x10; *(uint32_t*)0x2000020c = 0; res = syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x20000180ul, /*size=*/0x80ul); if (res != -1) r[0] = res; *(uint32_t*)0x20000280 = 6; *(uint32_t*)0x20000284 = 4; *(uint64_t*)0x20000288 = 0; *(uint64_t*)0x20000290 = 0x20000040; memcpy((void*)0x20000040, "GPL\000", 4); *(uint32_t*)0x20000298 = 4; *(uint32_t*)0x2000029c = 0x1000; *(uint64_t*)0x200002a0 = 0x20000300; *(uint32_t*)0x200002a8 = 0; *(uint32_t*)0x200002ac = 0; memset((void*)0x200002b0, 0, 16); *(uint32_t*)0x200002c0 = 0; *(uint32_t*)0x200002c4 = 0; *(uint32_t*)0x200002c8 = -1; *(uint32_t*)0x200002cc = 8; *(uint64_t*)0x200002d0 = 0; *(uint32_t*)0x200002d8 = 0; *(uint32_t*)0x200002dc = 0x10; *(uint64_t*)0x200002e0 = 0; *(uint32_t*)0x200002e8 = 0; *(uint32_t*)0x200002ec = 0; *(uint32_t*)0x200002f0 = -1; *(uint32_t*)0x200002f4 = 0; *(uint64_t*)0x200002f8 = 0; *(uint64_t*)0x20000300 = 0; *(uint32_t*)0x20000308 = 0x10; *(uint32_t*)0x2000030c = 0; syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x20000280ul, /*size=*/0x80ul); *(uint32_t*)0x20001300 = -1; *(uint32_t*)0x20001304 = 0xe0; *(uint64_t*)0x20001308 = 0x20000440; *(uint32_t*)0x20000474 = 0; *(uint64_t*)0x20000478 = 0; *(uint32_t*)0x200004a8 = 0; *(uint32_t*)0x200004ac = 0; *(uint64_t*)0x200004b0 = 0; *(uint64_t*)0x200004b8 = 0; *(uint32_t*)0x200004c4 = 8; *(uint64_t*)0x200004c8 = 0; *(uint32_t*)0x200004d0 = 0xfffffe56; *(uint32_t*)0x200004d4 = 0; *(uint64_t*)0x200004d8 = 0; *(uint64_t*)0x200004e0 = 0; *(uint32_t*)0x200004e8 = 0; *(uint32_t*)0x200004ec = 0x10; *(uint32_t*)0x200004f0 = 8; *(uint32_t*)0x200004f4 = 0; *(uint64_t*)0x200004f8 = 0; syscall(__NR_bpf, /*cmd=*/0xful, /*arg=*/0x20001300ul, /*size=*/0x10ul); syscall(__NR_bpf, /*cmd=*/0x1aul, /*arg=*/0ul, /*size=*/0ul); syscall(__NR_socketpair, /*domain=*/0x1eul, /*type=*/1ul, /*proto=*/0, /*fds=*/0x20000000ul); *(uint64_t*)0x20000040 = 0; syscall(__NR_ioctl, /*fd=*/-1, /*cmd=*/0x40086602, /*period=*/0x20000040ul); syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0ul, /*size=*/0ul); *(uint64_t*)0x20000500 = 0x20000040; *(uint32_t*)0x20000508 = 0x80; *(uint64_t*)0x20000510 = 0x20000100; *(uint64_t*)0x20000100 = 0; *(uint64_t*)0x20000108 = 0; *(uint64_t*)0x20000518 = 1; *(uint64_t*)0x20000520 = 0; *(uint64_t*)0x20000528 = 0; *(uint32_t*)0x20000530 = 0; syscall(__NR_recvmsg, /*fd=*/-1, /*msg=*/0x20000500ul, /*f=*/0x1f00ul, 0); *(uint32_t*)0x20000100 = 1; *(uint32_t*)0x20000104 = 0x80; *(uint8_t*)0x20000108 = 0; *(uint8_t*)0x20000109 = 0; *(uint8_t*)0x2000010a = 0; *(uint8_t*)0x2000010b = 0; *(uint32_t*)0x2000010c = 0; *(uint64_t*)0x20000110 = 0x200; *(uint64_t*)0x20000118 = 0; *(uint64_t*)0x20000120 = 0; STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 0, 1); STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 1, 1); STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 2, 1); STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 3, 1); STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 4, 1); STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 5, 1); STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 6, 1); STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 7, 1); STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 8, 1); STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 9, 1); STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 10, 1); STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 11, 1); STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 12, 1); STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 13, 1); STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 14, 1); STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 15, 2); STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 17, 1); STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 18, 1); STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 19, 1); STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 20, 1); STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 21, 1); STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 22, 1); STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 23, 1); STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 24, 1); STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 25, 1); STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 26, 1); STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 27, 1); STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 28, 1); STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 29, 1); STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 30, 1); STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 31, 1); STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 32, 1); STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 33, 1); STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 34, 1); STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 35, 1); STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 36, 1); STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 37, 1); STORE_BY_BITMASK(uint64_t, , 0x20000128, 0, 38, 26); *(uint32_t*)0x20000130 = 0; *(uint32_t*)0x20000134 = 0; *(uint64_t*)0x20000138 = 0; *(uint64_t*)0x20000140 = 0; *(uint64_t*)0x20000148 = 0; *(uint64_t*)0x20000150 = 0; *(uint32_t*)0x20000158 = 0; *(uint32_t*)0x2000015c = 0; *(uint64_t*)0x20000160 = 0; *(uint32_t*)0x20000168 = 0; *(uint16_t*)0x2000016c = 0; *(uint16_t*)0x2000016e = 0; *(uint32_t*)0x20000170 = 0; *(uint32_t*)0x20000174 = 0; *(uint64_t*)0x20000178 = 0; syscall(__NR_perf_event_open, /*attr=*/0x20000100ul, /*pid=*/0, /*cpu=*/-1, /*group=*/-1, /*flags=*/0ul); *(uint32_t*)0x20000600 = 0x18; *(uint32_t*)0x20000604 = 1; *(uint64_t*)0x20000608 = 0x20001340; memcpy((void*)0x20001340, "\x95\x00\x00\x00\x00\x00\x08\x00\x14\x3f\x78\xd3\x7f\x3f\x58\x11\x0b" "\x63\x1e\xb0\xc3\x0d\xcf\x8c\x3b\x42\x0e\x14\xbc\x8b\x85\x00\xdc\x5b" "\x2e\x10\x14\x86\x77\xd5\x43\x86\x39\xb7\xaa\xba\xa8\x19\xde\xe8\xa9" "\xb3\x47\x46\x5e\x78\xf8\xa7\xcb\x72\x1c\x08\x44\x04\x75\xc2\x2e\x76" "\xb3\xf5\xd3\x77\x2e\x6a\x2f\x18\xf7\x2f\x1f\x03\xff\xbf\xa7\x91", 84); *(uint64_t*)0x20000610 = 0; *(uint32_t*)0x20000618 = 0; *(uint32_t*)0x2000061c = 0; *(uint64_t*)0x20000620 = 0; *(uint32_t*)0x20000628 = 0; *(uint32_t*)0x2000062c = 0; memset((void*)0x20000630, 0, 16); *(uint32_t*)0x20000640 = 0; *(uint32_t*)0x20000644 = 0; *(uint32_t*)0x20000648 = -1; *(uint32_t*)0x2000064c = 8; *(uint64_t*)0x20000650 = 0; *(uint32_t*)0x20000658 = 0; *(uint32_t*)0x2000065c = 0x10; *(uint64_t*)0x20000660 = 0; *(uint32_t*)0x20000668 = 0; *(uint32_t*)0x2000066c = 0; *(uint32_t*)0x20000670 = 0; *(uint32_t*)0x20000674 = 0; *(uint64_t*)0x20000678 = 0; *(uint64_t*)0x20000680 = 0; *(uint32_t*)0x20000688 = 0x10; *(uint32_t*)0x2000068c = 0; syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x20000600ul, /*size=*/0x90ul); *(uint32_t*)0x20001840 = -1; syscall(__NR_setsockopt, /*fd=*/-1, /*level=*/1, /*optname=*/0x32, /*optval=*/0x20001840ul, /*optlen=*/4ul); *(uint64_t*)0x200000c0 = 0x20000080; memcpy((void*)0x20000080, "sched_switch\000", 13); *(uint32_t*)0x200000c8 = r[0]; syscall(__NR_bpf, /*cmd=*/0x11ul, /*arg=*/0x200000c0ul, /*size=*/0x10ul); *(uint32_t*)0x20000180 = 0x18; *(uint32_t*)0x20000184 = 5; *(uint64_t*)0x20000188 = 0; *(uint64_t*)0x20000190 = 0x20000080; memcpy((void*)0x20000080, "GPL\000", 4); *(uint32_t*)0x20000198 = 1; *(uint32_t*)0x2000019c = 0; *(uint64_t*)0x200001a0 = 0; *(uint32_t*)0x200001a8 = 0x40f00; *(uint32_t*)0x200001ac = 0; memset((void*)0x200001b0, 0, 16); *(uint32_t*)0x200001c0 = 0; *(uint32_t*)0x200001c4 = 2; *(uint32_t*)0x200001c8 = -1; *(uint32_t*)0x200001cc = 8; *(uint64_t*)0x200001d0 = 0; *(uint32_t*)0x200001d8 = 0; *(uint32_t*)0x200001dc = 0x10; *(uint64_t*)0x200001e0 = 0; *(uint32_t*)0x200001e8 = 0; *(uint32_t*)0x200001ec = 0; *(uint32_t*)0x200001f0 = 0; *(uint32_t*)0x200001f4 = 0; *(uint64_t*)0x200001f8 = 0; *(uint64_t*)0x20000200 = 0; *(uint32_t*)0x20000208 = 0x10; *(uint32_t*)0x2000020c = 0; syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x20000180ul, /*size=*/0x90ul); *(uint32_t*)0x20000180 = 1; *(uint32_t*)0x20000184 = 0x80; *(uint8_t*)0x20000188 = 0; *(uint8_t*)0x20000189 = 0; *(uint8_t*)0x2000018a = 0; *(uint8_t*)0x2000018b = 0; *(uint32_t*)0x2000018c = 0; *(uint64_t*)0x20000190 = 0x1ff; *(uint64_t*)0x20000198 = 0x21c4; *(uint64_t*)0x200001a0 = 0; STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 0, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 1, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 2, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 3, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 4, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 5, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 6, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 7, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 8, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 9, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 10, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 11, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 12, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 13, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 14, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 15, 2); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 17, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 18, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 19, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 20, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 21, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 22, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 23, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 24, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 25, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 26, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 27, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 28, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 29, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 30, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 31, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 32, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 33, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 34, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 35, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 36, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 37, 1); STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 38, 26); *(uint32_t*)0x200001b0 = 0; *(uint32_t*)0x200001b4 = 0; *(uint64_t*)0x200001b8 = 0; *(uint64_t*)0x200001c0 = 0; *(uint64_t*)0x200001c8 = 0; *(uint64_t*)0x200001d0 = 0; *(uint32_t*)0x200001d8 = 0; *(uint32_t*)0x200001dc = 0; *(uint64_t*)0x200001e0 = 0; *(uint32_t*)0x200001e8 = 0x10; *(uint16_t*)0x200001ec = 0; *(uint16_t*)0x200001ee = 0; *(uint32_t*)0x200001f0 = 0; *(uint32_t*)0x200001f4 = 0; *(uint64_t*)0x200001f8 = 4; syscall(__NR_perf_event_open, /*attr=*/0x20000180ul, /*pid=*/0, /*cpu=*/-1, /*group=*/-1, /*flags=*/0ul); res = syscall(__NR_socketpair, /*domain=*/1ul, /*type=*/1ul, /*proto=*/0, /*fds=*/0x200000c0ul); if (res != -1) r[1] = *(uint32_t*)0x200000c0; *(uint64_t*)0x20002bc0 = 0x20002800; *(uint16_t*)0x20002800 = 2; *(uint16_t*)0x20002802 = htobe16(0x4e21); *(uint32_t*)0x20002804 = htobe32(0xa010101); *(uint32_t*)0x20002bc8 = 0x10; *(uint64_t*)0x20002bd0 = 0x20002b00; *(uint64_t*)0x20002b00 = 0; *(uint64_t*)0x20002b08 = 0; *(uint64_t*)0x20002b10 = 0x200028c0; *(uint64_t*)0x20002b18 = 0; *(uint64_t*)0x20002b20 = 0x20002980; memcpy((void*)0x20002980, "\x29\x72\x41\x6c\x8d\xd8\x76\xae\xb9\x6f\xf4\x31\x7d\x8f\x3f\x70\x19" "\x5e\xea\x99\xaf\xb7\xa3\xaa\xe8\x8a\x7c\x23\x7a\x92\xc1\xb7\x45\xdc" "\xb7\x03\x31\xc6\x13\x0b\x82\x60\xef\x26\x08\x27\x30\xf5\xdf\x43\xa2" "\x2a\x97\xd3\x55\x0b\xe5\xca\xb6\xe4\x0c\x5e\xa3\x0a\x23\xd6\x81\xe7" "\x80\x96\x16\x29\xe4\x1e\x0d\x5f\xd5\xfd\x15\x6b\x6a\xc3\x62\xb5\x2e" "\x23\xcf\x3a\x68\xaf\x7a\x23\xb9\xf6\x5b\xda\xe4\xa2\xcd\x88\x27\xfd" "\x1b\x03\x11\x66\x2a\xb8\xd9\xa3\xb1\x44\x7e\xaf\x6a\x56\x4a\xcf\x93" "\x19\xe3\x77\x4a\xb7\x6e\xa6\x06\x48\x3c\xbe\xb8\xef", 132); *(uint64_t*)0x20002b28 = 0x84; *(uint64_t*)0x20002b30 = 0x20002a40; memcpy((void*)0x20002a40, "\x86\x13\xe2\x6c\xbb\x63\x61\x77\xb1\x3f\x8d\x8f\x8f\xf5\x4d\xba\xed" "\xc4\xda\xfc\x2d\x13\x99\xfc\xd3\x0c\xa4\xda\x92\xb4\x81", 31); *(uint64_t*)0x20002b38 = 0x1f; *(uint64_t*)0x20002b40 = 0x20002a80; memcpy( (void*)0x20002a80, "\xd1\x0d\xdc\x9a\xa9\x34\xd8\xf1\x96\x4c\x1e\xd4\xc9\x34\x64\xd9\x7f\xfa" "\x54\x24\xf9\x1e\x3f\xc7\x9e\xdc\x7c\x4a\x81\x41\x8f\x36\x84\x36\xa4\xad" "\xd5\x7a\x60\xd9\x91\x8d\x87\x18\x71\x83\x41\x36\xc1\xa3\x12\x1f\x3f\xc3" "\xc9\x4a\xb6\x3a\x8b\x23\x04\xc4\x8d\x0c\xa6\xd0\xd3\x14\xaa", 69); *(uint64_t*)0x20002b48 = 0x45; *(uint64_t*)0x20002bd8 = 5; *(uint64_t*)0x20002be0 = 0x20002b80; *(uint64_t*)0x20002be8 = 0; *(uint32_t*)0x20002bf0 = 0; syscall(__NR_sendmsg, /*fd=*/-1, /*msg=*/0x20002bc0ul, /*f=*/0ul); *(uint64_t*)0x20000480 = 0; *(uint32_t*)0x20000488 = 0; *(uint64_t*)0x20000490 = 0x20000580; *(uint64_t*)0x20000580 = 0; *(uint64_t*)0x20000588 = 0; *(uint64_t*)0x20000590 = 0x20000300; memcpy((void*)0x20000300, "\x52\xfd\x28\x8b\xb0\x23\x12\xf7\x31\xbd\xf1\xa1\xf7\xd9\xd5\xf3\x48" "\xae\x32\x49\x23\xd1\x56\xa4\x66\xbc\xd6\x75\x89\xb3", 30); *(uint64_t*)0x20000598 = 0x1e; *(uint64_t*)0x200005a0 = 0x20000340; *(uint64_t*)0x200005a8 = 0; *(uint64_t*)0x20000498 = 3; *(uint64_t*)0x200004a0 = 0x20000440; *(uint64_t*)0x20000440 = 0x14; *(uint32_t*)0x20000448 = 0; *(uint32_t*)0x2000044c = 1; *(uint32_t*)0x20000450 = -1; *(uint64_t*)0x200004a8 = 0x18; *(uint32_t*)0x200004b0 = 0; syscall(__NR_sendmsg, /*fd=*/r[1], /*msg=*/0x20000480ul, /*f=*/0ul); memcpy((void*)0x20002dc0, "cgroup.events\000", 14); res = syscall(__NR_openat, /*fd=*/-1, /*file=*/0x20002dc0ul, /*flags=*/0ul, /*mode=*/0ul); if (res != -1) r[2] = res; *(uint32_t*)0x20000040 = 0; *(uint32_t*)0x20000044 = 0; *(uint64_t*)0x20000048 = 0; *(uint64_t*)0x20000050 = 0x20000180; memcpy((void*)0x20000180, "syzkaller\000", 10); *(uint32_t*)0x20000058 = 0; *(uint32_t*)0x2000005c = 0; *(uint64_t*)0x20000060 = 0; *(uint32_t*)0x20000068 = 0; *(uint32_t*)0x2000006c = 0; memset((void*)0x20000070, 0, 16); *(uint32_t*)0x20000080 = 0; *(uint32_t*)0x20000084 = 2; *(uint32_t*)0x20000088 = -1; *(uint32_t*)0x2000008c = 8; *(uint64_t*)0x20000090 = 0; *(uint32_t*)0x20000098 = 0x53; *(uint32_t*)0x2000009c = 0x10; *(uint64_t*)0x200000a0 = 0; *(uint32_t*)0x200000a8 = 0; *(uint32_t*)0x200000ac = 0; *(uint32_t*)0x200000b0 = 0; *(uint32_t*)0x200000b4 = 0; *(uint64_t*)0x200000b8 = 0; *(uint64_t*)0x200000c0 = 0; *(uint32_t*)0x200000c8 = 0x10; *(uint32_t*)0x200000cc = 0; res = syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x20000040ul, /*size=*/0x80ul); if (res != -1) r[3] = res; *(uint32_t*)0x20000400 = -1; *(uint32_t*)0x20000404 = 0xe0; *(uint64_t*)0x20000408 = 0x20000300; *(uint32_t*)0x20000334 = 0; *(uint64_t*)0x20000338 = 0; *(uint32_t*)0x20000368 = 1; *(uint32_t*)0x2000036c = 1; *(uint64_t*)0x20000370 = 0x200000c0; *(uint64_t*)0x20000378 = 0x20000140; *(uint32_t*)0x20000384 = 8; *(uint64_t*)0x20000388 = 0; *(uint32_t*)0x20000390 = 0; *(uint32_t*)0x20000394 = 0; *(uint64_t*)0x20000398 = 0; *(uint64_t*)0x200003a0 = 0; *(uint32_t*)0x200003a8 = 0; *(uint32_t*)0x200003ac = 0x10; *(uint32_t*)0x200003b0 = 8; *(uint32_t*)0x200003b4 = 8; *(uint64_t*)0x200003b8 = 0x200002c0; res = syscall(__NR_bpf, /*cmd=*/0xful, /*arg=*/0x20000400ul, /*size=*/0x10ul); if (res != -1) r[4] = *(uint32_t*)0x20000380; syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0ul, /*size=*/0ul); *(uint32_t*)0x20000100 = 0x13; *(uint32_t*)0x20000104 = 0x10; *(uint32_t*)0x20000108 = 2; *(uint32_t*)0x2000010c = 0; *(uint32_t*)0x20000110 = 0; *(uint32_t*)0x20000114 = -1; *(uint32_t*)0x20000118 = 0; memset((void*)0x2000011c, 0, 16); *(uint32_t*)0x2000012c = 0; *(uint32_t*)0x20000130 = -1; *(uint32_t*)0x20000134 = 0; *(uint32_t*)0x20000138 = 0; *(uint32_t*)0x2000013c = 0; *(uint64_t*)0x20000140 = 0; syscall(__NR_bpf, /*cmd=*/0ul, /*arg=*/0x20000100ul, /*size=*/0x48ul); syscall(__NR_bpf, /*cmd=*/2ul, /*arg=*/0ul, /*size=*/0ul); *(uint32_t*)0x20000580 = 0x18; *(uint32_t*)0x20000584 = 2; *(uint64_t*)0x20000588 = 0x20000440; *(uint8_t*)0x20000440 = 0x18; STORE_BY_BITMASK(uint8_t, , 0x20000441, 8, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x20000441, 1, 4, 4); *(uint16_t*)0x20000442 = 0; *(uint32_t*)0x20000444 = -1; *(uint8_t*)0x20000448 = 0; *(uint8_t*)0x20000449 = 0; *(uint16_t*)0x2000044a = 0; *(uint32_t*)0x2000044c = 0; *(uint64_t*)0x20000590 = 0x20000480; memcpy((void*)0x20000480, "syzkaller\000", 10); *(uint32_t*)0x20000598 = 0; *(uint32_t*)0x2000059c = 0; *(uint64_t*)0x200005a0 = 0; *(uint32_t*)0x200005a8 = 0xc2e00; *(uint32_t*)0x200005ac = 0x10; memset((void*)0x200005b0, 0, 16); *(uint32_t*)0x200005c0 = 0; *(uint32_t*)0x200005c4 = 0; *(uint32_t*)0x200005c8 = -1; *(uint32_t*)0x200005cc = 8; *(uint64_t*)0x200005d0 = 0x200004c0; *(uint32_t*)0x200004c0 = 0x800003; *(uint32_t*)0x200004c4 = 5; *(uint32_t*)0x200005d8 = 8; *(uint32_t*)0x200005dc = 0x10; *(uint64_t*)0x200005e0 = 0x20000500; *(uint32_t*)0x20000500 = 2; *(uint32_t*)0x20000504 = 3; *(uint32_t*)0x20000508 = 0x1000; *(uint32_t*)0x2000050c = 0; *(uint32_t*)0x200005e8 = 0x10; *(uint32_t*)0x200005ec = r[4]; *(uint32_t*)0x200005f0 = r[3]; *(uint32_t*)0x200005f4 = 0; *(uint64_t*)0x200005f8 = 0; *(uint64_t*)0x20000600 = 0; *(uint32_t*)0x20000608 = 0x10; *(uint32_t*)0x2000060c = 0; syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x20000580ul, /*size=*/0x90ul); *(uint32_t*)0x20001440 = r[2]; *(uint32_t*)0x20001444 = 0x58; *(uint64_t*)0x20001448 = 0x200013c0; syscall(__NR_bpf, /*cmd=*/0xful, /*arg=*/0x20001440ul, /*size=*/0x10ul); syscall(__NR_bpf, /*cmd=*/0ul, /*arg=*/0ul, /*size=*/0ul); syscall(__NR_ioctl, /*fd=*/-1, /*cmd=*/0x800454d7, /*arg=*/0x200014c0ul); memcpy((void*)0x20000040, "blkio.bfq.empty_time\000", 21); syscall(__NR_openat, /*fd=*/-1, /*file=*/0x20000040ul, /*flags=*/0ul, /*mode=*/0ul); memcpy((void*)0x20000400, "./cgroup.cpu/syz1\000", 18); syscall(__NR_mkdirat, /*fd=*/0xffffffffffffff9cul, /*path=*/0x20000400ul, /*mode=*/0x1fful); syz_clone(/*flags=*/0x75848400, /*stack=*/0, /*stack_len=*/0, /*parentid=*/0, /*childtid=*/0, /*tls=*/0); } int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=*/0x32ul, /*fd=*/-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x20000000ul, /*len=*/0x1000000ul, /*prot=*/7ul, /*flags=*/0x32ul, /*fd=*/-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x21000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=*/0x32ul, /*fd=*/-1, /*offset=*/0ul); do_sandbox_none(); return 0; }