// https://syzkaller.appspot.com/bug?id=d9c92411cacf0b049f730ff6c81863a685d159f2 // 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 static unsigned long long procid; 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 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 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 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 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 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) ; } 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(); 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; } } } uint64_t r[10] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xffffffffffffffff, 0x0, 0xffffffffffffffff, 0xffffffffffffffff}; void execute_one(void) { intptr_t res = 0; if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } // socket$inet6_tcp arguments: [ // domain: const = 0xa (8 bytes) // type: const = 0x1 (8 bytes) // proto: const = 0x0 (4 bytes) // ] // returns sock_tcp6 res = syscall(__NR_socket, /*domain=*/0xaul, /*type=*/1ul, /*proto=*/0); if (res != -1) r[0] = res; // mkdir arguments: [ // path: ptr[in, buffer] { // buffer: {2e 2f 73 79 73 00} (length 0x6) // } // mode: open_mode = 0x0 (8 bytes) // ] NONFAILING(memcpy((void*)0x200000000540, "./sys\000", 6)); syscall(__NR_mkdir, /*path=*/0x200000000540ul, /*mode=*/0ul); // mount arguments: [ // src: nil // dst: ptr[in, buffer] { // buffer: {2e 2f 73 79 73 00} (length 0x6) // } // type: ptr[in, buffer] { // buffer: {73 79 73 66 73 00} (length 0x6) // } // flags: mount_flags = 0x0 (8 bytes) // data: nil // ] NONFAILING(memcpy((void*)0x200000000000, "./sys\000", 6)); NONFAILING(memcpy((void*)0x200000000040, "sysfs\000", 6)); syscall(__NR_mount, /*src=*/0ul, /*dst=*/0x200000000000ul, /*type=*/0x200000000040ul, /*flags=*/0ul, /*data=*/0ul); // openat arguments: [ // fd: fd_dir (resource) // file: ptr[in, buffer] { // buffer: {2e 2f 73 79 73 2f 62 75 73 2f 70 63 69 2f 64 65 76 69 63 65 // 73 2f 30 30 30 30 3a 30 30 3a 30 31 2e 30 2f 72 65 6d 6f 76 65 00} // (length 0x2a) // } // flags: open_flags = 0x1 (4 bytes) // mode: open_mode = 0x0 (2 bytes) // ] // returns fd NONFAILING(memcpy((void*)0x200000000080, "./sys/bus/pci/devices/0000:00:01.0/remove\000", 42)); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000080ul, /*flags=O_WRONLY*/ 1, /*mode=*/0); if (res != -1) r[1] = res; // openat$sw_sync_info arguments: [ // fd: const = 0xffffffffffffff9c (8 bytes) // file: ptr[in, buffer] { // buffer: {2f 73 79 73 2f 6b 65 72 6e 65 6c 2f 64 65 62 75 67 2f 73 79 // 6e 63 2f 69 6e 66 6f 00} (length 0x1c) // } // flags: open_flags = 0x0 (4 bytes) // mode: const = 0x0 (2 bytes) // ] // returns fd NONFAILING( memcpy((void*)0x2000000002c0, "/sys/kernel/debug/sync/info\000", 28)); res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x2000000002c0ul, /*flags=*/0, /*mode=*/0); if (res != -1) r[2] = res; // close arguments: [ // fd: fd (resource) // ] syscall(__NR_close, /*fd=*/r[2]); // syz_open_dev$dri arguments: [ // dev: ptr[in, buffer] { // buffer: {2f 64 65 76 2f 64 72 69 2f 63 61 72 64 23 00} (length 0xf) // } // id: intptr = 0x1ff (8 bytes) // flags: open_flags = 0x0 (8 bytes) // ] // returns fd_dri NONFAILING(memcpy((void*)0x200000000000, "/dev/dri/card#\000", 15)); res = -1; NONFAILING( res = syz_open_dev(/*dev=*/0x200000000000, /*id=*/0x1ff, /*flags=*/0)); if (res != -1) r[3] = res; // ioctl$DRM_IOCTL_MODE_GETRESOURCES arguments: [ // fd: fd_dri (resource) // cmd: const = 0xc04064a0 (4 bytes) // arg: ptr[inout, drm_mode_card_res] { // drm_mode_card_res { // fbid: nil // crtcid: ptr[out, array[drm_crtc_id]] { // array[drm_crtc_id] { // drm_crtc_id (resource) // } // } // connid: nil // encid: nil // nfbid: len = 0x0 (4 bytes) // ncrtcid: len = 0x1 (4 bytes) // nconnid: len = 0x0 (4 bytes) // nencid: len = 0x0 (4 bytes) // maxw: const = 0x0 (4 bytes) // maxh: const = 0x0 (4 bytes) // minw: const = 0x0 (4 bytes) // minh: const = 0x0 (4 bytes) // } // } // ] NONFAILING(*(uint64_t*)0x200000000200 = 0); NONFAILING(*(uint64_t*)0x200000000208 = 0x200000000100); NONFAILING(*(uint64_t*)0x200000000210 = 0); NONFAILING(*(uint64_t*)0x200000000218 = 0); NONFAILING(*(uint32_t*)0x200000000220 = 0); NONFAILING(*(uint32_t*)0x200000000224 = 1); NONFAILING(*(uint32_t*)0x200000000228 = 0); NONFAILING(*(uint32_t*)0x20000000022c = 0); NONFAILING(*(uint32_t*)0x200000000230 = 0); NONFAILING(*(uint32_t*)0x200000000234 = 0); NONFAILING(*(uint32_t*)0x200000000238 = 0); NONFAILING(*(uint32_t*)0x20000000023c = 0); syscall(__NR_ioctl, /*fd=*/r[3], /*cmd=*/0xc04064a0, /*arg=*/0x200000000200ul); // syz_open_dev$dri arguments: [ // dev: ptr[in, buffer] { // buffer: {2f 64 65 76 2f 64 72 69 2f 63 61 72 64 23 00} (length 0xf) // } // id: intptr = 0xd21 (8 bytes) // flags: open_flags = 0x0 (8 bytes) // ] // returns fd_dri NONFAILING(memcpy((void*)0x2000000008c0, "/dev/dri/card#\000", 15)); res = -1; NONFAILING( res = syz_open_dev(/*dev=*/0x2000000008c0, /*id=*/0xd21, /*flags=*/0)); if (res != -1) r[4] = res; // ioctl$DRM_IOCTL_MODE_GETRESOURCES arguments: [ // fd: fd_dri (resource) // cmd: const = 0xc04064a0 (4 bytes) // arg: ptr[inout, drm_mode_card_res] { // drm_mode_card_res { // fbid: nil // crtcid: ptr[out, array[drm_crtc_id]] { // array[drm_crtc_id] { // drm_crtc_id (resource) // } // } // connid: nil // encid: nil // nfbid: len = 0x0 (4 bytes) // ncrtcid: len = 0x1 (4 bytes) // nconnid: len = 0x0 (4 bytes) // nencid: len = 0x0 (4 bytes) // maxw: const = 0x0 (4 bytes) // maxh: const = 0x0 (4 bytes) // minw: const = 0x0 (4 bytes) // minh: const = 0x0 (4 bytes) // } // } // ] NONFAILING(*(uint64_t*)0x2000000001c0 = 0); NONFAILING(*(uint64_t*)0x2000000001c8 = 0x2000000000c0); NONFAILING(*(uint64_t*)0x2000000001d0 = 0); NONFAILING(*(uint64_t*)0x2000000001d8 = 0); NONFAILING(*(uint32_t*)0x2000000001e0 = 0); NONFAILING(*(uint32_t*)0x2000000001e4 = 1); NONFAILING(*(uint32_t*)0x2000000001e8 = 0); NONFAILING(*(uint32_t*)0x2000000001ec = 0); NONFAILING(*(uint32_t*)0x2000000001f0 = 0); NONFAILING(*(uint32_t*)0x2000000001f4 = 0); NONFAILING(*(uint32_t*)0x2000000001f8 = 0); NONFAILING(*(uint32_t*)0x2000000001fc = 0); res = syscall(__NR_ioctl, /*fd=*/r[4], /*cmd=*/0xc04064a0, /*arg=*/0x2000000001c0ul); if (res != -1) NONFAILING(r[5] = *(uint32_t*)0x2000000000c0); // socket$inet6_tcp arguments: [ // domain: const = 0xa (8 bytes) // type: const = 0x1 (8 bytes) // proto: const = 0x0 (4 bytes) // ] // returns sock_tcp6 res = syscall(__NR_socket, /*domain=*/0xaul, /*type=*/1ul, /*proto=*/0); if (res != -1) r[6] = res; // getsockopt$inet6_tcp_TCP_ZEROCOPY_RECEIVE arguments: [ // fd: sock_tcp6 (resource) // level: const = 0x6 (4 bytes) // optname: const = 0x23 (4 bytes) // optval: ptr[in, tcp_zerocopy_receive] { // tcp_zerocopy_receive { // address: VMA[0x1000] // length: len = 0x1000 (4 bytes) // recv_skip_hint: int32 = 0x0 (4 bytes) // inq: int32 = 0x0 (4 bytes) // err: int32 = 0x0 (4 bytes) // copybuf_address: ptr[out, buffer] { // buffer: (DirOut) // } // copybuf_len: bytesize = 0xfffffffffffffdcc (4 bytes) // flags: tcp_zerocopy_receive_flags = 0x0 (4 bytes) // msg_control: nil // msg_controllen: bytesize = 0xffffffffffffff29 (8 bytes) // msg_flags: int32 = 0x0 (4 bytes) // reserved: const = 0x0 (4 bytes) // } // } // optlen: ptr[inout, len] { // len = 0x28 (4 bytes) // } // ] NONFAILING(*(uint64_t*)0x200000000140 = 0x200000ffc000); NONFAILING(*(uint32_t*)0x200000000148 = 0x1000); NONFAILING(*(uint64_t*)0x200000000158 = 0x200000001380); NONFAILING(*(uint32_t*)0x200000000160 = 0xfffffdcc); NONFAILING(*(uint32_t*)0x200000000164 = 0); NONFAILING(*(uint64_t*)0x200000000168 = 0); NONFAILING(*(uint64_t*)0x200000000170 = 0xffffffffffffff29); NONFAILING(*(uint32_t*)0x20000000017c = 0); NONFAILING(*(uint32_t*)0x200000000000 = 0x28); syscall(__NR_getsockopt, /*fd=*/r[6], /*level=*/6, /*optname=*/0x23, /*optval=*/0x200000000140ul, /*optlen=*/0x200000000000ul); // ioctl$DRM_IOCTL_MODE_GETCRTC arguments: [ // fd: fd_dri (resource) // cmd: const = 0xc06864a1 (4 bytes) // arg: ptr[inout, drm_mode_crtc$DRM_IOCTL_MODE_GETCRTC] { // drm_mode_crtc$DRM_IOCTL_MODE_GETCRTC { // set_connectors_ptr: nil // count_connectors: len = 0x0 (4 bytes) // crtc_id: drm_crtc_id (resource) // fb_id: drm_fb_id (resource) // x: int32 = 0x0 (4 bytes) // y: int32 = 0x0 (4 bytes) // gamma_size: int32 = 0x0 (4 bytes) // mode_valid: int32 = 0x0 (4 bytes) // mode: drm_mode_modeinfo { // clock: int32 = 0x0 (4 bytes) // hdisplay: int16 = 0x0 (2 bytes) // hsync_start: int16 = 0x0 (2 bytes) // hsync_end: int16 = 0x0 (2 bytes) // htotal: int16 = 0x0 (2 bytes) // hskew: int16 = 0x0 (2 bytes) // vdisplay: int16 = 0x0 (2 bytes) // vsync_start: int16 = 0x0 (2 bytes) // vsync_end: int16 = 0x0 (2 bytes) // vtotal: int16 = 0x0 (2 bytes) // vscan: int16 = 0x0 (2 bytes) // vrefresh: int32 = 0x0 (4 bytes) // flags: int32 = 0x0 (4 bytes) // type: int32 = 0x0 (4 bytes) // name: buffer: (DirOut) // } // } // } // ] NONFAILING(*(uint64_t*)0x200000001380 = 0); NONFAILING(*(uint32_t*)0x200000001388 = 0); NONFAILING(*(uint32_t*)0x20000000138c = r[5]); res = syscall(__NR_ioctl, /*fd=*/r[4], /*cmd=*/0xc06864a1, /*arg=*/0x200000001380ul); if (res != -1) NONFAILING(r[7] = *(uint32_t*)0x200000001390); // ioctl$DRM_IOCTL_MODE_GETFB2 arguments: [ // fd: fd_dri (resource) // cmd: const = 0xc06864ce (4 bytes) // arg: ptr[inout, drm_mode_fb_cmd2$DRM_IOCTL_MODE_GETFB2] { // drm_mode_fb_cmd2$DRM_IOCTL_MODE_GETFB2 { // fb_id: drm_fb_id (resource) // width: int32 = 0x8002 (4 bytes) // height: int32 = 0x7fff (4 bytes) // pixel_format: int32 = 0x0 (4 bytes) // flags: drm_mode_fb_flags = 0x0 (4 bytes) // handles: array[drm_gem_handle] { // drm_gem_handle (resource) // drm_gem_handle (resource) // drm_gem_handle (resource) // drm_gem_handle (resource) // } // pitches: array[int32] { // int32 = 0x2 (4 bytes) // int32 = 0x0 (4 bytes) // int32 = 0x0 (4 bytes) // int32 = 0x0 (4 bytes) // } // offsets: array[int32] { // int32 = 0x0 (4 bytes) // int32 = 0x4 (4 bytes) // int32 = 0xfffffffe (4 bytes) // int32 = 0x5e8 (4 bytes) // } // pad = 0x0 (4 bytes) // modifier: array[int64] { // int64 = 0x0 (8 bytes) // int64 = 0x0 (8 bytes) // int64 = 0x0 (8 bytes) // int64 = 0x0 (8 bytes) // } // } // } // ] NONFAILING(*(uint32_t*)0x2000000012c0 = r[7]); NONFAILING(*(uint32_t*)0x2000000012c4 = 0x8002); NONFAILING(*(uint32_t*)0x2000000012c8 = 0x7fff); NONFAILING(*(uint32_t*)0x2000000012cc = 0); NONFAILING(*(uint32_t*)0x2000000012d0 = 0); NONFAILING(*(uint32_t*)0x2000000012e4 = 2); NONFAILING(*(uint32_t*)0x2000000012e8 = 0); NONFAILING(*(uint32_t*)0x2000000012ec = 0); NONFAILING(*(uint32_t*)0x2000000012f0 = 0); NONFAILING(*(uint32_t*)0x2000000012f4 = 0); NONFAILING(*(uint32_t*)0x2000000012f8 = 4); NONFAILING(*(uint32_t*)0x2000000012fc = 0xfffffffe); NONFAILING(*(uint32_t*)0x200000001300 = 0x5e8); NONFAILING(*(uint64_t*)0x200000001308 = 0); NONFAILING(*(uint64_t*)0x200000001310 = 0); NONFAILING(*(uint64_t*)0x200000001318 = 0); NONFAILING(*(uint64_t*)0x200000001320 = 0); syscall(__NR_ioctl, /*fd=*/r[4], /*cmd=*/0xc06864ce, /*arg=*/0x2000000012c0ul); // write arguments: [ // fd: fd (resource) // buf: ptr[in, buffer] { // buffer: {31} (length 0x1) // } // count: len = 0x1 (8 bytes) // ] NONFAILING(memset((void*)0x2000000000c0, 49, 1)); syscall(__NR_write, /*fd=*/r[1], /*buf=*/0x2000000000c0ul, /*count=*/1ul); // socket$inet6_mptcp arguments: [ // domain: const = 0xa (8 bytes) // type: const = 0x1 (8 bytes) // proto: const = 0x106 (4 bytes) // ] // returns sock_mptcp6 res = syscall(__NR_socket, /*domain=*/0xaul, /*type=*/1ul, /*proto=*/0x106); if (res != -1) r[8] = res; // setsockopt$inet6_int arguments: [ // fd: sock_in6 (resource) // level: const = 0x29 (4 bytes) // optname: inet6_option_types_int = 0x35 (4 bytes) // optval: nil // optlen: len = 0x0 (8 bytes) // ] syscall(__NR_setsockopt, /*fd=*/r[8], /*level=*/0x29, /*optname=IPV6_RECVHOPOPTS*/ 0x35, /*optval=*/0ul, /*optlen=*/0ul); // setsockopt$inet6_tcp_int arguments: [ // fd: sock_tcp6 (resource) // level: const = 0x6 (4 bytes) // optname: tcp_option_types_int = 0x13 (4 bytes) // optval: ptr[in, int32] { // int32 = 0x100000001 (4 bytes) // } // optlen: len = 0x4 (8 bytes) // ] NONFAILING(*(uint32_t*)0x200000000040 = 1); syscall(__NR_setsockopt, /*fd=*/r[0], /*level=*/6, /*optname=TCP_THIN_LINEAR_TIMEOUTS|TCP_CORK*/ 0x13, /*optval=*/0x200000000040ul, /*optlen=*/4ul); // ioctl$DRM_IOCTL_AGP_ACQUIRE arguments: [ // fd: fd_dri (resource) // cmd: const = 0x6430 (4 bytes) // ] syscall(__NR_ioctl, /*fd=*/(intptr_t)-1, /*cmd=*/0x6430, 0); // setsockopt$inet6_tcp_TCP_ULP arguments: [ // fd: sock_tcp6 (resource) // level: const = 0x6 (4 bytes) // optname: const = 0x1f (4 bytes) // optval: ptr[in, buffer] { // buffer: {74 6c 73} (length 0x3) // } // optlen: len = 0x4 (8 bytes) // ] NONFAILING(memcpy((void*)0x2000000002c0, "tls", 3)); syscall(__NR_setsockopt, /*fd=*/r[0], /*level=*/6, /*optname=*/0x1f, /*optval=*/0x2000000002c0ul, /*optlen=*/4ul); // socket$inet_icmp_raw arguments: [ // domain: const = 0x2 (8 bytes) // type: const = 0x3 (8 bytes) // proto: const = 0x1 (4 bytes) // ] // returns sock_icmp res = syscall(__NR_socket, /*domain=*/2ul, /*type=*/3ul, /*proto=*/1); if (res != -1) r[9] = res; // getsockopt$IPT_SO_GET_REVISION_TARGET arguments: [ // fd: sock_in (resource) // level: const = 0x0 (4 bytes) // opt: const = 0x43 (4 bytes) // val: ptr[in, xt_get_revision] { // xt_get_revision { // name: buffer: {69 63 6d 70 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 0x1d) revision: const = // 0x0 (1 bytes) // } // } // len: ptr[in, len] { // len = 0x1e (4 bytes) // } // ] NONFAILING(memcpy((void*)0x200000000000, "icmp\000\000\000\000\000\000\000\000\000\000\000\000\000" "\000\000\000\000\000\000\000\000\000\000\000\000", 29)); NONFAILING(*(uint8_t*)0x20000000001d = 0); NONFAILING(*(uint32_t*)0x200000000080 = 0x1e); syscall(__NR_getsockopt, /*fd=*/r[9], /*level=*/0, /*opt=*/0x43, /*val=*/0x200000000000ul, /*len=*/0x200000000080ul); // socket$nl_generic arguments: [ // domain: const = 0x10 (8 bytes) // type: const = 0x3 (8 bytes) // proto: const = 0x10 (4 bytes) // ] // returns sock_nl_generic syscall(__NR_socket, /*domain=*/0x10ul, /*type=*/3ul, /*proto=*/0x10); // sendmsg$key arguments: [ // fd: sock_key (resource) // msg: ptr[in, send_msghdr_key] { // send_msghdr_key { // msg_name: const = 0x0 (8 bytes) // msg_namelen: const = 0x0 (4 bytes) // pad = 0x0 (4 bytes) // msg_iov: ptr[in, iovec_sadb_msg] { // iovec_sadb_msg { // addr: ptr[in, sadb_msg] { // sadb_msg { // sadb_msg_version: const = 0x2 (1 bytes) // sadb_msg_type: int8 = 0xb (1 bytes) // sadb_msg_errno: int8 = 0xe (1 bytes) // sadb_msg_satype: sadb_satype = 0x8 (1 bytes) // sadb_msg_len: bytesize8 = 0x6 (2 bytes) // sadb_msg_reserved: const = 0x0 (2 bytes) // sadb_msg_seq: int32 = 0x70bd25 (4 bytes) // sadb_msg_pid: int32 = 0x25dfdbfe (4 bytes) // ext_headers: array[sadb_ext_hdr] { // union sadb_ext_hdr { // sadb_lifetime: sadb_lifetime { // sadb_len: bytesize8 = 0x4 (2 bytes) // sadb_exttype: sadb_lifetime_type = 0x3 (2 bytes) // sadb_lifetime_allocations: int32 = 0x4 (4 bytes) // sadb_lifetime_bytes: int64 = 0x5 (8 bytes) // sadb_lifetime_addtime: int64 = 0xf (8 bytes) // sadb_lifetime_usetime: int64 = 0x10000000000001 (8 // bytes) // } // } // } // } // } // len: bytesize = 0x30 (8 bytes) // } // } // msg_iovlen: const = 0x1 (8 bytes) // msg_control: const = 0x0 (8 bytes) // msg_controllen: const = 0x0 (8 bytes) // msg_flags: const = 0x0 (4 bytes) // pad = 0x0 (4 bytes) // } // } // f: send_flags = 0x4000 (8 bytes) // ] NONFAILING(*(uint64_t*)0x200000000200 = 0); NONFAILING(*(uint32_t*)0x200000000208 = 0); NONFAILING(*(uint64_t*)0x200000000210 = 0x200000000100); NONFAILING(*(uint64_t*)0x200000000100 = 0x200000000080); NONFAILING(*(uint8_t*)0x200000000080 = 2); NONFAILING(*(uint8_t*)0x200000000081 = 0xb); NONFAILING(*(uint8_t*)0x200000000082 = 0xe); NONFAILING(*(uint8_t*)0x200000000083 = 8); NONFAILING(*(uint16_t*)0x200000000084 = 6); NONFAILING(*(uint16_t*)0x200000000086 = 0); NONFAILING(*(uint32_t*)0x200000000088 = 0x70bd25); NONFAILING(*(uint32_t*)0x20000000008c = 0x25dfdbfe); NONFAILING(*(uint16_t*)0x200000000090 = 4); NONFAILING(*(uint16_t*)0x200000000092 = 3); NONFAILING(*(uint32_t*)0x200000000094 = 4); NONFAILING(*(uint64_t*)0x200000000098 = 5); NONFAILING(*(uint64_t*)0x2000000000a0 = 0xf); NONFAILING(*(uint64_t*)0x2000000000a8 = 0x10000000000001); NONFAILING(*(uint64_t*)0x200000000108 = 0x30); NONFAILING(*(uint64_t*)0x200000000218 = 1); NONFAILING(*(uint64_t*)0x200000000220 = 0); NONFAILING(*(uint64_t*)0x200000000228 = 0); NONFAILING(*(uint32_t*)0x200000000230 = 0); syscall(__NR_sendmsg, /*fd=*/(intptr_t)-1, /*msg=*/0x200000000200ul, /*f=MSG_NOSIGNAL*/ 0x4000ul); } 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; install_segv_handler(); for (procid = 0; procid < 6; procid++) { if (fork() == 0) { loop(); } } sleep(1000000); return 0; }