// https://syzkaller.appspot.com/bug?id=d5f63be97bcf572595613d19f9b82475e37c9026 // 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 #ifndef __NR_bpf #define __NR_bpf 321 #endif static unsigned long long procid; static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void 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); } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); syscall(SYS_futex, &ev->state, FUTEX_WAKE | FUTEX_PRIVATE_FLAG, 1000000); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, 0); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; for (;;) { uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, &ts); if (__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) return 1; now = current_time_ms(); if (now - start > timeout) return 0; } } static bool write_file(const char* file, const char* what, ...) { char buf[1024]; va_list args; va_start(args, what); vsnprintf(buf, sizeof(buf), what, args); va_end(args); buf[sizeof(buf) - 1] = 0; int len = strlen(buf); int fd = open(file, O_WRONLY | O_CLOEXEC); if (fd == -1) return false; if (write(fd, buf, len) != len) { int err = errno; close(fd); errno = err; return false; } close(fd); return true; } #define MAX_FDS 30 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, 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); } #define FS_IOC_SETFLAGS _IOW('f', 2, long) static void remove_dir(const char* dir) { int iter = 0; DIR* dp = 0; const int umount_flags = MNT_FORCE | UMOUNT_NOFOLLOW; retry: while (umount2(dir, umount_flags) == 0) { } dp = opendir(dir); if (dp == NULL) { if (errno == EMFILE) { exit(1); } exit(1); } struct dirent* ep = 0; while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); while (umount2(filename, umount_flags) == 0) { } struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } int i; for (i = 0;; i++) { if (unlink(filename) == 0) break; if (errno == EPERM) { int fd = open(filename, O_RDONLY); if (fd != -1) { long flags = 0; if (ioctl(fd, FS_IOC_SETFLAGS, &flags) == 0) { } close(fd); continue; } } if (errno == EROFS) { break; } if (errno != EBUSY || i > 100) exit(1); if (umount2(filename, umount_flags)) exit(1); } } closedir(dp); for (int i = 0;; i++) { if (rmdir(dir) == 0) break; if (i < 100) { if (errno == EPERM) { int fd = open(dir, O_RDONLY); if (fd != -1) { long flags = 0; if (ioctl(fd, FS_IOC_SETFLAGS, &flags) == 0) { } close(fd); continue; } } if (errno == EROFS) { break; } if (errno == EBUSY) { if (umount2(dir, umount_flags)) exit(1); continue; } if (errno == ENOTEMPTY) { if (iter < 100) { iter++; goto retry; } } } 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"); if (symlink("/dev/binderfs", "./binderfs")) { } } static void close_fds() { for (int fd = 3; fd < MAX_FDS; fd++) close(fd); } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } int i, call, thread; for (call = 0; call < 6; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 3) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); close_fds(); } static void execute_one(void); #define WAIT_FLAGS __WALL static void loop(void) { int iter = 0; for (;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); setup_test(); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { sleep_ms(10); if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; if (current_time_ms() - start < 5000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: *(uint32_t*)0x200000000000 = 1; *(uint32_t*)0x200000000004 = 8; *(uint64_t*)0x200000000008 = 0x200000000780; memcpy( (void*)0x200000000780, "\x7a\x0a\xf8\xff\x75\x25\x70\x00\xbf\xa1\x00\x00\x00\x00\x00\x00\x07" "\x01\x00\x00\xf8\xff\xff\xff\xb7\x02\x00\x00\x05\x00\x00\x00\xbf\x13" "\x00\x00\x00\x00\x00\x00\x85\x00\x00\x00\x7d\x00\x00\x00\xb7\x00\x00" "\x00\x00\x00\x00\x00\x95\x00\x00\xff\x00\x00\x00\x00\xb2\x59\x52\x85" "\x0a\x84\xa7\x00\x02\xb2\xab\x3d\x6f\xfa\xa6\xea\xd0\x16\x91\x91\xd5" "\x4f\x81\x96\x21\x7f\xc5\x63\xe2\xfc\x91\xf6\xda\x4d\xad\x4f\xdc\x2e" "\xb1\xb5\x98\x6f\xc4\x4b\xc2\x5f\xb5\x91\xcf\x77\xb9\xdf\xb3\x79\xa3" "\xf6\x11\xdb\xc2\xa3\x64\x91\x6f\x09\x8d\xab\x10\xb1\xa2\x97\xcf\x52" "\x86\x66\xd1\xdd\xd7\x3f\x30\xf2\x38\x2f\x6c\xda\x4b\xfd\xd4\x5b\xe5" "\x83\x82\x3c\x0f\x09\x22\x48\xa5\x7d\x48\x62\x1f\x3c\x1c\x65\xee\x19" "\xee\x87\x5d\xaf\x45\x00\x6a\x4c\x4e\xa5\xe1\x5b\x2f\x96\x18\xd5\x47" "\x24\x4a\x22\x00\x00\x00\x00\x08\x00\xdb\x58\x36\x20\xce\x72\x43\xd1" "\xae\xbd\xb6\x38\xd9\x1d\xbe\xf6\x61\x93\x58\x39\x9a\xa9\xc2\xac\xd0" "\x68\xc0\x3e\xfe\xfd\x8b\xc7\x7e\xdf\x2d\x34\xb1\x2c\xd4\x8a\x1b\x20" "\xfb\x7d\xd8\x43\x26\x7e\x03\x31\x75\x9f\x4e\xc6\xb5\xb0\xaf\x58\xe6" "\x04\xf4\x94\xef\xf2\x89\x02\x6d\x50\x45\xef\x08\x00\x00\x00\x00\x00" "\x00\x00\x77\x18\xa0\x9f\x48\x86\xaf\xc2\x6a\xbb\xa3\x46\x35\xd0\xe8" "\xb5\x98\xa5\x1b\xc7\x42\x13\x5a\x6e\x1d\x33\xfe\x22\x6c\x94\x4b\xc7" "\x6b\xe4\x0d\x43\x5a\xa8\xb5\x20\x2d\xb7\x61\x01\x4b\x1b\x99\x9a\x12" "\xdf\x6b\xee\x43\x1a\x66\x81\x00\x00\x00\x26\x3b\x62\x33\xe1\xc0\xfe" "\x30\xe3\x84\xc3\xcb\x07\xb7\x4a\x72\x29\x1a\x1a\x2b\x52\x3d\xd8\x1b" "\x66\x51\xb1\xee\x48\xe9\x99\xbb\x00\x48\x23\xeb\xcd\x8c\x65\x74\x3f" "\x31\xf8\x4b\x26\x3a\xb9\xb3\x42\x66\x92\xd0\x1a\xd1\x94\xf3\x02\xd7" "\xa6\x58\xe9\xe5\x46\x87\xd3\xc5\x6d\x7b\xed\xb6\xb2\xf2\x5d\xdb\x8c" "\x64\x0b\xb3\x21\xa4\x02\x05\x8c\x92\x21\xb6\x87\x08\x14\xcf\x4e\xe2" "\x3d\xdb\x79\xff\xf5\xeb\x15\x6e\x0a\x00\x00\x00\x00\x00\x00\xf2\xbd" "\x1d\x4a\x17\x8d\x86\xd6\x93\x5e\xb8\xb7\x5b\xc4\xeb\x68\x0d\x10\xe8" "\xb6\xa5\x4c\x6c\x86\x74\xca\xf6\x3f\xf7\x66\x22\x93\x9a\x20\xd4\xaa" "\xdf\x85\xdb\x40\x17\x9c\x2c\xf8\x3e\xe0\x7e\x30\xa2\x79\xd8\xf9\xf3" "\xbc\x28\x2d\xeb\x43\xa0\x34\x09\xf8\xe6\x97\x2f\x3f\x72\x0d\x04\x59" "\x23\x70\x2c\xed\xe0\xf3\xe9\x14\x11\xf3\xf1\xb1\x6f\x06\x56\x24\xf2" "\x80\xa7\xdc\xce\x8d\xb9\x10\xf9\x3c\x49\xb9\xe0\xb6\xdd\x73\x56\xaa" "\x79\xd5\xfa\xbb\x5c\x0d\x0d\xa6\xd7\x19\xd7\xe0\xef\xb2\xbb\x71\x3d" "\x18\x24\x2c\xd5\xdf\x6c\xa5\x33\x07\xa4\xcd\xd9\x1b\xe4\x58\x7f\x90" "\xe3\x17\xc8\xde\x5e\x5c\x39\x33\xfd\x5d\x5b\xf3\x8f\x6b\x9f\xc3\x9f" "\xc8\x29\xdc\xfe\x4a\xf8\xac\x5f\xbb\x73\x14\xa7\xa4\x33\xe0\x18\x27" "\x67\xd1\x78\x6e\xda\x2b\x20", 619); *(uint64_t*)0x200000000010 = 0x200000000100; memcpy((void*)0x200000000100, "GPL\000", 4); *(uint32_t*)0x200000000018 = 0; *(uint32_t*)0x20000000001c = 0; *(uint64_t*)0x200000000020 = 0; *(uint32_t*)0x200000000028 = 0; *(uint32_t*)0x20000000002c = 0; memset((void*)0x200000000030, 0, 16); *(uint32_t*)0x200000000040 = 0; *(uint32_t*)0x200000000044 = 0; *(uint32_t*)0x200000000048 = -1; *(uint32_t*)0x20000000004c = 8; *(uint64_t*)0x200000000050 = 0; *(uint32_t*)0x200000000058 = 0; *(uint32_t*)0x20000000005c = 0x10; *(uint64_t*)0x200000000060 = 0; *(uint32_t*)0x200000000068 = 0; *(uint32_t*)0x20000000006c = 0; *(uint32_t*)0x200000000070 = -1; *(uint32_t*)0x200000000074 = 0; *(uint64_t*)0x200000000078 = 0; *(uint64_t*)0x200000000080 = 0; *(uint32_t*)0x200000000088 = 0x10; *(uint32_t*)0x20000000008c = 0; *(uint32_t*)0x200000000090 = 0; res = syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x200000000000ul, /*size=*/0x48ul); if (res != -1) r[0] = res; break; case 1: res = syscall(__NR_socketpair, /*domain=*/1ul, /*type=SOCK_DGRAM*/ 2ul, /*proto=*/0, /*fds=*/0x200000000080ul); if (res != -1) r[1] = *(uint32_t*)0x200000000080; break; case 2: memcpy((void*)0x2000000002c0, "\x03\x00\x00\x00\x04\x00\x00\x00\x04\x00\x00\x00\x0a", 13); res = syscall(__NR_bpf, /*cmd=*/0ul, /*arg=*/0x2000000002c0ul, /*size=*/0x48ul); if (res != -1) r[2] = res; break; case 3: *(uint32_t*)0x200000000280 = r[2]; *(uint64_t*)0x200000000288 = 0x200000000200; *(uint32_t*)0x200000000200 = 0; *(uint64_t*)0x200000000290 = 0x200000000240; *(uint32_t*)0x200000000240 = r[0]; *(uint64_t*)0x200000000298 = 0; syscall(__NR_bpf, /*cmd=*/2ul, /*arg=*/0x200000000280ul, /*size=*/0x20ul); break; case 4: *(uint32_t*)0x200000000880 = 1; *(uint32_t*)0x200000000884 = 0x10; *(uint64_t*)0x200000000888 = 0x200000000bc0; memcpy((void*)0x200000000bc0, "\x18\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x18\x12\x00\x00", 20); *(uint32_t*)0x200000000bd4 = r[2]; memcpy( (void*)0x200000000bd8, "\x00\x00\x00\x00\x00\x00\x00\x00\xb7\x03\x00\x00\x00\x00\x00\x00\x85" "\x00\x00\x00\x0c\x00\x00\x00\xb7\x00\x00\x00\x00\x00\x00\x00\x18\x01" "\x00\x00\x00\x08\x2c\x25\x00\x00\x00\x00\x00\x21\x20\x20\x7b\x1a\xf8" "\xff\x00\x00\x00\x00\xbf\xa1\x00\x00\x00\x00\x00\x00\x07\x01\x00\x00" "\xf8\xff\xff\xff\xb7\x02\x00\x00\x08\x00\x00\x00\xb7\x03\x00\x00\x00" "\x00\x00\x00\x85\x00\x00\x00\x07\x00\x00\x00\x95", 97); *(uint64_t*)0x200000000890 = 0x200000000980; memcpy((void*)0x200000000980, "GPL\000", 4); *(uint32_t*)0x200000000898 = 0; *(uint32_t*)0x20000000089c = 0; *(uint64_t*)0x2000000008a0 = 0; *(uint32_t*)0x2000000008a8 = 0; *(uint32_t*)0x2000000008ac = 0; memset((void*)0x2000000008b0, 0, 16); *(uint32_t*)0x2000000008c0 = 0; *(uint32_t*)0x2000000008c4 = 0; *(uint32_t*)0x2000000008c8 = -1; *(uint32_t*)0x2000000008cc = 0; *(uint64_t*)0x2000000008d0 = 0; *(uint32_t*)0x2000000008d8 = 0; *(uint32_t*)0x2000000008dc = 0; *(uint64_t*)0x2000000008e0 = 0; *(uint32_t*)0x2000000008e8 = 0; *(uint32_t*)0x2000000008ec = 0; *(uint32_t*)0x2000000008f0 = 0; *(uint32_t*)0x2000000008f4 = 0; *(uint64_t*)0x2000000008f8 = 0; *(uint64_t*)0x200000000900 = 0; *(uint32_t*)0x200000000908 = 0; *(uint32_t*)0x20000000090c = 0; *(uint32_t*)0x200000000910 = 0; res = syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x200000000880ul, /*size=*/0x90ul); if (res != -1) r[3] = res; break; case 5: *(uint32_t*)0x2000000000c0 = r[3]; syscall(__NR_setsockopt, /*fd=*/r[1], /*level=*/1, /*optname=*/0x32, /*optval=*/0x2000000000c0ul, /*optlen=*/4ul); break; } } int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0x1000000ul, /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/ 7ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x200001000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); const char* reason; (void)reason; for (procid = 0; procid < 5; procid++) { if (fork() == 0) { use_temporary_dir(); do_sandbox_none(); } } sleep(1000000); return 0; }