// 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); } 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[8] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; void execute_one(void) { intptr_t res = 0; syscall(__NR_ioctl, /*fd=*/-1, /*cmd=*/0xc0046686, /*period=*/0ul); memcpy((void*)0x200000c0, "memory.events\000", 14); syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000c0ul, /*flags=*/0x26e1ul, /*mode=*/0ul); *(uint32_t*)0x20000580 = 4; *(uint32_t*)0x20000584 = 0x80; *(uint8_t*)0x20000588 = 0; *(uint8_t*)0x20000589 = 1; *(uint8_t*)0x2000058a = 0x60; *(uint8_t*)0x2000058b = 0; *(uint32_t*)0x2000058c = 0; *(uint64_t*)0x20000590 = 0xfffffffffffff041; *(uint64_t*)0x20000598 = 0x2002; *(uint64_t*)0x200005a0 = 0; STORE_BY_BITMASK(uint64_t, , 0x200005a8, 1, 0, 1); STORE_BY_BITMASK(uint64_t, , 0x200005a8, 0, 1, 1); STORE_BY_BITMASK(uint64_t, , 0x200005a8, 1, 2, 1); STORE_BY_BITMASK(uint64_t, , 0x200005a8, 1, 3, 1); STORE_BY_BITMASK(uint64_t, , 0x200005a8, 0, 4, 1); STORE_BY_BITMASK(uint64_t, , 0x200005a8, 0, 5, 1); STORE_BY_BITMASK(uint64_t, , 0x200005a8, 1, 6, 1); STORE_BY_BITMASK(uint64_t, , 0x200005a8, 0, 7, 1); STORE_BY_BITMASK(uint64_t, , 0x200005a8, 0, 8, 1); STORE_BY_BITMASK(uint64_t, , 0x200005a8, 0, 9, 1); STORE_BY_BITMASK(uint64_t, , 0x200005a8, 0, 10, 1); STORE_BY_BITMASK(uint64_t, , 0x200005a8, 0, 11, 1); STORE_BY_BITMASK(uint64_t, , 0x200005a8, 1, 12, 1); STORE_BY_BITMASK(uint64_t, , 0x200005a8, 1, 13, 1); STORE_BY_BITMASK(uint64_t, , 0x200005a8, 1, 14, 1); STORE_BY_BITMASK(uint64_t, , 0x200005a8, 3, 15, 2); STORE_BY_BITMASK(uint64_t, , 0x200005a8, 1, 17, 1); STORE_BY_BITMASK(uint64_t, , 0x200005a8, 1, 18, 1); STORE_BY_BITMASK(uint64_t, , 0x200005a8, 1, 19, 1); STORE_BY_BITMASK(uint64_t, , 0x200005a8, 1, 20, 1); STORE_BY_BITMASK(uint64_t, , 0x200005a8, 1, 21, 1); STORE_BY_BITMASK(uint64_t, , 0x200005a8, 0, 22, 1); STORE_BY_BITMASK(uint64_t, , 0x200005a8, 1, 23, 1); STORE_BY_BITMASK(uint64_t, , 0x200005a8, 1, 24, 1); STORE_BY_BITMASK(uint64_t, , 0x200005a8, 0, 25, 1); STORE_BY_BITMASK(uint64_t, , 0x200005a8, 0, 26, 1); STORE_BY_BITMASK(uint64_t, , 0x200005a8, 1, 27, 1); STORE_BY_BITMASK(uint64_t, , 0x200005a8, 0, 28, 1); STORE_BY_BITMASK(uint64_t, , 0x200005a8, 0, 29, 1); STORE_BY_BITMASK(uint64_t, , 0x200005a8, 1, 30, 1); STORE_BY_BITMASK(uint64_t, , 0x200005a8, 0, 31, 1); STORE_BY_BITMASK(uint64_t, , 0x200005a8, 1, 32, 1); STORE_BY_BITMASK(uint64_t, , 0x200005a8, 0, 33, 1); STORE_BY_BITMASK(uint64_t, , 0x200005a8, 0, 34, 1); STORE_BY_BITMASK(uint64_t, , 0x200005a8, 1, 35, 1); STORE_BY_BITMASK(uint64_t, , 0x200005a8, 0, 36, 1); STORE_BY_BITMASK(uint64_t, , 0x200005a8, 0, 37, 1); STORE_BY_BITMASK(uint64_t, , 0x200005a8, 0, 38, 26); *(uint32_t*)0x200005b0 = 7; *(uint32_t*)0x200005b4 = 2; *(uint64_t*)0x200005b8 = 0x20000000; *(uint64_t*)0x200005c0 = 4; *(uint64_t*)0x200005c8 = 0x8000; *(uint64_t*)0x200005d0 = 9; *(uint32_t*)0x200005d8 = 0x360; *(uint32_t*)0x200005dc = 2; *(uint64_t*)0x200005e0 = 6; *(uint32_t*)0x200005e8 = 9; *(uint16_t*)0x200005ec = 0x401; *(uint16_t*)0x200005ee = 0; *(uint32_t*)0x200005f0 = 6; *(uint32_t*)0x200005f4 = 0; *(uint64_t*)0x200005f8 = 0; syscall(__NR_perf_event_open, /*attr=*/0x20000580ul, /*pid=*/-1, /*cpu=*/9ul, /*group=*/-1, /*flags=*/0xbul); memcpy((void*)0x20000080, "memory.events\000", 14); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x20000080ul, /*flags=*/0x7a05ul, /*mode=*/0x1700ul); if (res != -1) r[0] = res; *(uint64_t*)0x20000040 = 0; syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x40086602, /*period=*/0x20000040ul); memcpy((void*)0x200001c0, "memory.events\000", 14); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200001c0ul, /*flags=*/0x7a05ul, /*mode=*/0x1700ul); if (res != -1) r[1] = res; syscall(__NR_write, /*fd=*/r[1], /*buf=*/0x20000000ul, /*len=*/0x32600ul); memcpy((void*)0x20000380, "memory.events\000", 14); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x20000380ul, /*flags=*/0x7a05ul, /*mode=*/0x1700ul); if (res != -1) r[2] = res; *(uint32_t*)0x20000200 = 0x18; *(uint32_t*)0x20000204 = 4; *(uint64_t*)0x20000208 = 0x200002c0; memcpy((void*)0x200002c0, "\x18\x01\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\xea\x04\x85" "\x00\x00\x00\x6d\x00\x00\x00\x95", 25); *(uint64_t*)0x20000210 = 0x20000100; memcpy((void*)0x20000100, "GPL\000", 4); *(uint32_t*)0x20000218 = 0; *(uint32_t*)0x2000021c = 0; *(uint64_t*)0x20000220 = 0; *(uint32_t*)0x20000228 = 0; *(uint32_t*)0x2000022c = 0; memset((void*)0x20000230, 0, 16); *(uint32_t*)0x20000240 = 0; *(uint32_t*)0x20000244 = 2; *(uint32_t*)0x20000248 = -1; *(uint32_t*)0x2000024c = 8; *(uint64_t*)0x20000250 = 0; *(uint32_t*)0x20000258 = 0; *(uint32_t*)0x2000025c = 0x10; *(uint64_t*)0x20000260 = 0; *(uint32_t*)0x20000268 = 0; *(uint32_t*)0x2000026c = 0; *(uint32_t*)0x20000270 = 0; *(uint32_t*)0x20000274 = 0; *(uint64_t*)0x20000278 = 0; *(uint64_t*)0x20000280 = 0; *(uint32_t*)0x20000288 = 0x10; *(uint32_t*)0x2000028c = 0; res = syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x20000200ul, /*size=*/0x80ul); if (res != -1) r[3] = res; memcpy((void*)0x20000500, "./cgroup/syz0\000", 14); res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x20000500ul, /*flags=*/0x200002ul, /*mode=*/0ul); if (res != -1) r[4] = res; memcpy((void*)0x20000540, "blkio.bfq.sectors\000", 18); syscall(__NR_openat, /*fd=*/r[4], /*file=*/0x20000540ul, /*flags=*/0ul, /*mode=*/0ul); *(uint64_t*)0x20000280 = 0x20000040; memcpy((void*)0x20000040, "sched_switch\000", 13); *(uint32_t*)0x20000288 = r[3]; syscall(__NR_bpf, /*cmd=*/0x11ul, /*arg=*/0x20000280ul, /*size=*/0x10ul); res = syscall(__NR_bpf, /*cmd=*/0xeul, /*arg=*/0ul, /*size=*/0ul); if (res != -1) r[5] = res; *(uint32_t*)0x200007c0 = 0x18; *(uint32_t*)0x200007c4 = 0x10; *(uint64_t*)0x200007c8 = 0x20000940; memcpy((void*)0x20000940, "\x18\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x18" "\x11\x00\x00", 20); *(uint32_t*)0x20000954 = r[5]; memcpy((void*)0x20000958, "\x00\x00\x00\x00\x00\x00\x00\x00\xb7\x02\x00\x00\x14\x00\x00\x00\xb7" "\x03\x00\x00\x00\x00\x00\x00\x85\x00\x00\x00\x83\x00\x00\x00\xbf\x09" "\x00\x00\x00\x00\x00\x00\x55\x09\x01\x00\x00\x00\x00\x00\x95\x00\x00" "\x00\x00\x00\x00\x00\x06\x90\x07\x00\x05\x00\x00\x00\xbf\x91\x00\x00" "\x00\x00\x00\x00\xb7\x02\x00\x00\x02\x00\x00\x00\x85\x00\x00\x00\x84" "\x00\x00\x00\xb7\x00\x00\x00\x00\x00\x00\x00\x95\x00\x00\x00\x00\x00" "\x00\x00\xdb\x21\x27\x3b\x01\x70\x2e\x74\xbb\x25\xaf\x33\x96\x85\x55" "\x0d\x30\x18\x0d\x3f\xe0\x88\x35\x56\xaf\xab\x34\xb8\xa8\xa3\xf7\x79" "\x26\x7d\x5a\x4b\x8f\x5a\xaa\x0e\x20\x19\x2a\xf4\x64\x7c\x0a\x25\x8b" "\x2f\x6b\x26\x29\x21\xbf\x1e\xdc\xb2\xe4\x0b\x5c\x12\x82\x08\xdc\x1c" "\x01\x74\x52\x3b\x87\xa1\x32\x95\xf8\xae\x09\xe2\x03\x2a\x38\x64\x5f" "\x1b\xe4\xef\x3a\x51\xee\xd8\xcb\x06\xc2\x19\x40\xc2\x1c\xf1\xad\x59" "\x80\x4d\x4c\xf9\x28\xd1\x36\x7b\xf8\x7c\xa7\x76\xbf\x80", 218); *(uint64_t*)0x200007d0 = 0x200003c0; memcpy((void*)0x200003c0, "syzkaller\000", 10); *(uint32_t*)0x200007d8 = 4; *(uint32_t*)0x200007dc = 0x15; *(uint64_t*)0x200007e0 = 0x20000600; *(uint32_t*)0x200007e8 = 0x41000; *(uint32_t*)0x200007ec = 0; memset((void*)0x200007f0, 0, 16); *(uint32_t*)0x20000800 = 0; *(uint32_t*)0x20000804 = 0; *(uint32_t*)0x20000808 = r[1]; *(uint32_t*)0x2000080c = 8; *(uint64_t*)0x20000810 = 0; *(uint32_t*)0x20000818 = 0; *(uint32_t*)0x2000081c = 0x10; *(uint64_t*)0x20000820 = 0x20000740; *(uint32_t*)0x20000740 = 5; *(uint32_t*)0x20000744 = 0xd; *(uint32_t*)0x20000748 = 0xa0; *(uint32_t*)0x2000074c = 5; *(uint32_t*)0x20000828 = 0x10; *(uint32_t*)0x2000082c = 0; *(uint32_t*)0x20000830 = 0; *(uint32_t*)0x20000834 = 4; *(uint64_t*)0x20000838 = 0; *(uint64_t*)0x20000840 = 0x20000780; *(uint32_t*)0x20000780 = 5; *(uint32_t*)0x20000784 = 2; *(uint32_t*)0x20000788 = 3; *(uint32_t*)0x2000078c = 1; *(uint32_t*)0x20000790 = 0; *(uint32_t*)0x20000794 = 4; *(uint32_t*)0x20000798 = 2; *(uint32_t*)0x2000079c = 6; *(uint32_t*)0x200007a0 = 0; *(uint32_t*)0x200007a4 = 2; *(uint32_t*)0x200007a8 = 4; *(uint32_t*)0x200007ac = 0xc; *(uint32_t*)0x200007b0 = 3; *(uint32_t*)0x200007b4 = 1; *(uint32_t*)0x200007b8 = 8; *(uint32_t*)0x200007bc = 0xc; *(uint32_t*)0x20000848 = 0x10; *(uint32_t*)0x2000084c = 0xffffff3c; syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x200007c0ul, /*size=*/0x90ul); memcpy((void*)0x20000080, "memory.events\000", 14); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x20000080ul, /*flags=*/0x7a05ul, /*mode=*/0x1700ul); if (res != -1) r[6] = res; *(uint64_t*)0x20000180 = 0; syscall(__NR_ioctl, /*fd=*/r[6], /*cmd=*/0x40086602, /*period=*/0x20000180ul); *(uint64_t*)0x20000900 = 6; syscall(__NR_ioctl, /*fd=*/r[6], /*cmd=*/0x40082404, /*period=*/0x20000900ul); syscall(__NR_write, /*fd=*/-1, /*buf=*/0x20000480ul, /*len=*/0xbul); syscall(__NR_write, /*fd=*/r[1], /*buf=*/0ul, /*len=*/0xda00ul); *(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 = 0x20000240; *(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 = 0; syscall(__NR_perf_event_open, /*attr=*/0x20000180ul, /*pid=*/0, /*cpu=*/-1, /*group=*/-1, /*flags=*/0ul); *(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 = 4; *(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*)0x20000f00 = -1; *(uint32_t*)0x20000f04 = -1; *(uint32_t*)0x20000f08 = 0xb; *(uint32_t*)0x20000f0c = 0x24; *(uint32_t*)0x20000f10 = -1; *(uint32_t*)0x20000f14 = 0; *(uint64_t*)0x20000f18 = 0; syscall(__NR_bpf, /*cmd=*/8ul, /*arg=*/0x20000f00ul, /*size=*/0x20ul); *(uint32_t*)0x200004c0 = r[1]; *(uint32_t*)0x200004c4 = -1; *(uint32_t*)0x200004c8 = 0; *(uint32_t*)0x200004cc = 0x1c; *(uint32_t*)0x200004d0 = 0; *(uint32_t*)0x200004d4 = r[0]; *(uint64_t*)0x200004d8 = 0; syscall(__NR_bpf, /*cmd=*/9ul, /*arg=*/0x200004c0ul, /*size=*/0x20ul); memcpy((void*)0x20000880, "memory.stat\000", 12); res = syscall(__NR_openat, /*fd=*/r[4], /*file=*/0x20000880ul, /*flags=*/0ul, /*mode=*/0ul); if (res != -1) r[7] = res; memcpy((void*)0x200008c0, "blkio.bfq.io_service_time_recursive\000", 36); syscall(__NR_openat, /*fd=*/r[7], /*file=*/0x200008c0ul, /*flags=*/0ul, /*mode=*/0ul); sprintf((char*)0x20000200, "0x%016llx", (long long)0); syscall(__NR_write, /*fd=*/r[2], /*buf=*/0x20000200ul, /*len=*/0x43405ul); *(uint32_t*)0x20000180 = 0; *(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 = 0x201; *(uint64_t*)0x20000198 = 0; *(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 = 2; *(uint64_t*)0x200001b8 = 0; *(uint64_t*)0x200001c0 = 0; *(uint64_t*)0x200001c8 = 0x89091; *(uint64_t*)0x200001d0 = 0; *(uint32_t*)0x200001d8 = 0; *(uint32_t*)0x200001dc = 0; *(uint64_t*)0x200001e0 = 0; *(uint32_t*)0x200001e8 = 0; *(uint16_t*)0x200001ec = 0; *(uint16_t*)0x200001ee = 0; *(uint32_t*)0x200001f0 = 0; *(uint32_t*)0x200001f4 = 0; *(uint64_t*)0x200001f8 = 0; syscall(__NR_perf_event_open, /*attr=*/0x20000180ul, /*pid=*/0, /*cpu=*/0xbffffffffffffffful, /*group=*/-1, /*flags=*/0ul); } 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; }