// https://syzkaller.appspot.com/bug?id=ddfaf1d75a1db3b0ed9dfa5bb615a2d50dd8f1da // 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 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 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; for (i = 0; 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_RELAXED)) 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; } static void kill_and_wait(int pid, int* status) { kill(-pid, SIGKILL); kill(pid, SIGKILL); int i; for (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"); } 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) { int i, call, thread; for (call = 0; call < 9; 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); event_timedwait(&th->done, 45); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); #define WAIT_FLAGS __WALL static void loop(void) { int iter; for (iter = 0;; 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 (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5 * 1000) continue; kill_and_wait(pid, &status); break; } } } uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; void execute_call(int call) { intptr_t res; switch (call) { case 0: res = syscall(__NR_socket, 2ul, 2ul, 0ul); if (res != -1) r[0] = res; break; case 1: memcpy((void*)0x20000700, "filter\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\000", 32); *(uint32_t*)0x20000720 = 0xe; *(uint32_t*)0x20000724 = 4; *(uint32_t*)0x20000728 = 0x3a8; *(uint32_t*)0x2000072c = 0; *(uint32_t*)0x20000730 = 0x1c0; *(uint32_t*)0x20000734 = 0; *(uint32_t*)0x20000738 = 0; *(uint32_t*)0x2000073c = 0; *(uint32_t*)0x20000740 = 0x310; *(uint32_t*)0x20000744 = 0x310; *(uint32_t*)0x20000748 = 0x310; *(uint32_t*)0x2000074c = 0x310; *(uint32_t*)0x20000750 = 0x310; *(uint32_t*)0x20000754 = 4; *(uint64_t*)0x20000758 = 0; *(uint32_t*)0x20000760 = htobe32(0x7f000001); *(uint8_t*)0x20000764 = 0xac; *(uint8_t*)0x20000765 = 0x14; *(uint8_t*)0x20000766 = 0x14; *(uint8_t*)0x20000767 = 0xbb; *(uint32_t*)0x20000768 = htobe32(0); *(uint32_t*)0x2000076c = htobe32(0); memcpy((void*)0x20000770, "gretap0\000\000\000\000\000\000\000\000\000", 16); memcpy((void*)0x20000780, "dummy0\000\000\000\000\000\000\000\000\000\000", 16); *(uint8_t*)0x20000790 = 0; *(uint8_t*)0x200007a0 = 0; *(uint16_t*)0x200007b0 = 0; *(uint8_t*)0x200007b2 = 0; *(uint8_t*)0x200007b3 = 0; *(uint32_t*)0x200007b4 = 0; *(uint16_t*)0x200007b8 = 0x198; *(uint16_t*)0x200007ba = 0x1c0; *(uint32_t*)0x200007bc = 0; *(uint64_t*)0x200007c0 = 0; *(uint64_t*)0x200007c8 = 0; *(uint16_t*)0x200007d0 = 0x30; memcpy((void*)0x200007d2, "addrtype\000\000\000\000\000\000\000\000\000\000" "\000\000\000\000\000\000\000\000\000\000\000", 29); *(uint8_t*)0x200007ef = 0; *(uint16_t*)0x200007f0 = 0; *(uint16_t*)0x200007f2 = 0; *(uint32_t*)0x200007f4 = 0; *(uint32_t*)0x200007f8 = 0; *(uint16_t*)0x20000800 = 0xf8; memcpy((void*)0x20000802, "recent\000\000\000\000\000\000\000\000\000\000" "\000\000\000\000\000\000\000\000\000\000\000\000" "\000", 29); *(uint8_t*)0x2000081f = 0; *(uint32_t*)0x20000820 = 0xffff; *(uint32_t*)0x20000824 = 5; *(uint8_t*)0x20000828 = 0x21; *(uint8_t*)0x20000829 = 0; memcpy((void*)0x2000082a, "syz1\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\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\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\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\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\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\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" "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" "\000\000\000\000\000", 200); *(uint8_t*)0x200008f2 = 0; *(uint16_t*)0x200008f8 = 0x28; memcpy((void*)0x200008fa, "REJECT\000\000\000\000\000\000\000\000\000\000" "\000\000\000\000\000\000\000\000\000\000\000\000" "\000", 29); *(uint8_t*)0x20000917 = 0; *(uint32_t*)0x20000918 = 0; *(uint8_t*)0x20000920 = 0; *(uint8_t*)0x20000921 = 0; *(uint8_t*)0x20000922 = 0; *(uint8_t*)0x20000923 = 0; *(uint8_t*)0x20000924 = 0; *(uint8_t*)0x20000925 = 0; *(uint8_t*)0x20000926 = 0; *(uint8_t*)0x20000927 = 0; *(uint8_t*)0x20000928 = 0; *(uint8_t*)0x20000929 = 0; *(uint8_t*)0x2000092a = 0; *(uint8_t*)0x2000092b = 0; *(uint8_t*)0x2000092c = 0; *(uint8_t*)0x2000092d = 0; *(uint8_t*)0x2000092e = 0; *(uint8_t*)0x2000092f = 0; *(uint8_t*)0x20000930 = 0; *(uint8_t*)0x20000931 = 0; *(uint8_t*)0x20000932 = 0; *(uint8_t*)0x20000933 = 0; *(uint8_t*)0x20000934 = 0; *(uint8_t*)0x20000935 = 0; *(uint8_t*)0x20000936 = 0; *(uint8_t*)0x20000937 = 0; *(uint8_t*)0x20000938 = 0; *(uint8_t*)0x20000939 = 0; *(uint8_t*)0x2000093a = 0; *(uint8_t*)0x2000093b = 0; *(uint8_t*)0x2000093c = 0; *(uint8_t*)0x2000093d = 0; *(uint8_t*)0x2000093e = 0; *(uint8_t*)0x2000093f = 0; *(uint8_t*)0x20000940 = 0; *(uint8_t*)0x20000941 = 0; *(uint8_t*)0x20000942 = 0; *(uint8_t*)0x20000943 = 0; *(uint8_t*)0x20000944 = 0; *(uint8_t*)0x20000945 = 0; *(uint8_t*)0x20000946 = 0; *(uint8_t*)0x20000947 = 0; *(uint8_t*)0x20000948 = 0; *(uint8_t*)0x20000949 = 0; *(uint8_t*)0x2000094a = 0; *(uint8_t*)0x2000094b = 0; *(uint8_t*)0x2000094c = 0; *(uint8_t*)0x2000094d = 0; *(uint8_t*)0x2000094e = 0; *(uint8_t*)0x2000094f = 0; *(uint8_t*)0x20000950 = 0; *(uint8_t*)0x20000951 = 0; *(uint8_t*)0x20000952 = 0; *(uint8_t*)0x20000953 = 0; *(uint8_t*)0x20000954 = 0; *(uint8_t*)0x20000955 = 0; *(uint8_t*)0x20000956 = 0; *(uint8_t*)0x20000957 = 0; *(uint8_t*)0x20000958 = 0; *(uint8_t*)0x20000959 = 0; *(uint8_t*)0x2000095a = 0; *(uint8_t*)0x2000095b = 0; *(uint8_t*)0x2000095c = 0; *(uint8_t*)0x2000095d = 0; *(uint8_t*)0x2000095e = 0; *(uint8_t*)0x2000095f = 0; *(uint8_t*)0x20000960 = 0; *(uint8_t*)0x20000961 = 0; *(uint8_t*)0x20000962 = 0; *(uint8_t*)0x20000963 = 0; *(uint8_t*)0x20000964 = 0; *(uint8_t*)0x20000965 = 0; *(uint8_t*)0x20000966 = 0; *(uint8_t*)0x20000967 = 0; *(uint8_t*)0x20000968 = 0; *(uint8_t*)0x20000969 = 0; *(uint8_t*)0x2000096a = 0; *(uint8_t*)0x2000096b = 0; *(uint8_t*)0x2000096c = 0; *(uint8_t*)0x2000096d = 0; *(uint8_t*)0x2000096e = 0; *(uint8_t*)0x2000096f = 0; *(uint8_t*)0x20000970 = 0; *(uint8_t*)0x20000971 = 0; *(uint8_t*)0x20000972 = 0; *(uint8_t*)0x20000973 = 0; *(uint32_t*)0x20000974 = 0; *(uint16_t*)0x20000978 = 0x70; *(uint16_t*)0x2000097a = 0x98; *(uint32_t*)0x2000097c = 0; *(uint64_t*)0x20000980 = 0; *(uint64_t*)0x20000988 = 0; *(uint16_t*)0x20000990 = 0x28; memcpy((void*)0x20000992, "REJECT\000\000\000\000\000\000\000\000\000\000" "\000\000\000\000\000\000\000\000\000\000\000\000" "\000", 29); *(uint8_t*)0x200009af = 0; *(uint32_t*)0x200009b0 = 0; *(uint8_t*)0x200009b8 = 0; *(uint8_t*)0x200009b9 = 0; *(uint8_t*)0x200009ba = 0; *(uint8_t*)0x200009bb = 0; *(uint8_t*)0x200009bc = 0; *(uint8_t*)0x200009bd = 0; *(uint8_t*)0x200009be = 0; *(uint8_t*)0x200009bf = 0; *(uint8_t*)0x200009c0 = 0; *(uint8_t*)0x200009c1 = 0; *(uint8_t*)0x200009c2 = 0; *(uint8_t*)0x200009c3 = 0; *(uint8_t*)0x200009c4 = 0; *(uint8_t*)0x200009c5 = 0; *(uint8_t*)0x200009c6 = 0; *(uint8_t*)0x200009c7 = 0; *(uint8_t*)0x200009c8 = 0; *(uint8_t*)0x200009c9 = 0; *(uint8_t*)0x200009ca = 0; *(uint8_t*)0x200009cb = 0; *(uint8_t*)0x200009cc = 0; *(uint8_t*)0x200009cd = 0; *(uint8_t*)0x200009ce = 0; *(uint8_t*)0x200009cf = 0; *(uint8_t*)0x200009d0 = 0; *(uint8_t*)0x200009d1 = 0; *(uint8_t*)0x200009d2 = 0; *(uint8_t*)0x200009d3 = 0; *(uint8_t*)0x200009d4 = 0; *(uint8_t*)0x200009d5 = 0; *(uint8_t*)0x200009d6 = 0; *(uint8_t*)0x200009d7 = 0; *(uint8_t*)0x200009d8 = 0; *(uint8_t*)0x200009d9 = 0; *(uint8_t*)0x200009da = 0; *(uint8_t*)0x200009db = 0; *(uint8_t*)0x200009dc = 0; *(uint8_t*)0x200009dd = 0; *(uint8_t*)0x200009de = 0; *(uint8_t*)0x200009df = 0; *(uint8_t*)0x200009e0 = 0; *(uint8_t*)0x200009e1 = 0; *(uint8_t*)0x200009e2 = 0; *(uint8_t*)0x200009e3 = 0; *(uint8_t*)0x200009e4 = 0; *(uint8_t*)0x200009e5 = 0; *(uint8_t*)0x200009e6 = 0; *(uint8_t*)0x200009e7 = 0; *(uint8_t*)0x200009e8 = 0; *(uint8_t*)0x200009e9 = 0; *(uint8_t*)0x200009ea = 0; *(uint8_t*)0x200009eb = 0; *(uint8_t*)0x200009ec = 0; *(uint8_t*)0x200009ed = 0; *(uint8_t*)0x200009ee = 0; *(uint8_t*)0x200009ef = 0; *(uint8_t*)0x200009f0 = 0; *(uint8_t*)0x200009f1 = 0; *(uint8_t*)0x200009f2 = 0; *(uint8_t*)0x200009f3 = 0; *(uint8_t*)0x200009f4 = 0; *(uint8_t*)0x200009f5 = 0; *(uint8_t*)0x200009f6 = 0; *(uint8_t*)0x200009f7 = 0; *(uint8_t*)0x200009f8 = 0; *(uint8_t*)0x200009f9 = 0; *(uint8_t*)0x200009fa = 0; *(uint8_t*)0x200009fb = 0; *(uint8_t*)0x200009fc = 0; *(uint8_t*)0x200009fd = 0; *(uint8_t*)0x200009fe = 0; *(uint8_t*)0x200009ff = 0; *(uint8_t*)0x20000a00 = 0; *(uint8_t*)0x20000a01 = 0; *(uint8_t*)0x20000a02 = 0; *(uint8_t*)0x20000a03 = 0; *(uint8_t*)0x20000a04 = 0; *(uint8_t*)0x20000a05 = 0; *(uint8_t*)0x20000a06 = 0; *(uint8_t*)0x20000a07 = 0; *(uint8_t*)0x20000a08 = 0; *(uint8_t*)0x20000a09 = 0; *(uint8_t*)0x20000a0a = 0; *(uint8_t*)0x20000a0b = 0; *(uint32_t*)0x20000a0c = 0; *(uint16_t*)0x20000a10 = 0x70; *(uint16_t*)0x20000a12 = 0xb8; *(uint32_t*)0x20000a14 = 0; *(uint64_t*)0x20000a18 = 0; *(uint64_t*)0x20000a20 = 0; *(uint16_t*)0x20000a28 = 0x48; memcpy((void*)0x20000a2a, "TEE\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\000", 29); *(uint8_t*)0x20000a47 = 1; *(uint8_t*)0x20000a48 = 0xac; *(uint8_t*)0x20000a49 = 0x14; *(uint8_t*)0x20000a4a = 0x14; *(uint8_t*)0x20000a4b = 0xbb; memcpy((void*)0x20000a58, "veth0_to_bond\000\000\000", 16); *(uint64_t*)0x20000a68 = 0; *(uint8_t*)0x20000a70 = 0; *(uint8_t*)0x20000a71 = 0; *(uint8_t*)0x20000a72 = 0; *(uint8_t*)0x20000a73 = 0; *(uint8_t*)0x20000a74 = 0; *(uint8_t*)0x20000a75 = 0; *(uint8_t*)0x20000a76 = 0; *(uint8_t*)0x20000a77 = 0; *(uint8_t*)0x20000a78 = 0; *(uint8_t*)0x20000a79 = 0; *(uint8_t*)0x20000a7a = 0; *(uint8_t*)0x20000a7b = 0; *(uint8_t*)0x20000a7c = 0; *(uint8_t*)0x20000a7d = 0; *(uint8_t*)0x20000a7e = 0; *(uint8_t*)0x20000a7f = 0; *(uint8_t*)0x20000a80 = 0; *(uint8_t*)0x20000a81 = 0; *(uint8_t*)0x20000a82 = 0; *(uint8_t*)0x20000a83 = 0; *(uint8_t*)0x20000a84 = 0; *(uint8_t*)0x20000a85 = 0; *(uint8_t*)0x20000a86 = 0; *(uint8_t*)0x20000a87 = 0; *(uint8_t*)0x20000a88 = 0; *(uint8_t*)0x20000a89 = 0; *(uint8_t*)0x20000a8a = 0; *(uint8_t*)0x20000a8b = 0; *(uint8_t*)0x20000a8c = 0; *(uint8_t*)0x20000a8d = 0; *(uint8_t*)0x20000a8e = 0; *(uint8_t*)0x20000a8f = 0; *(uint8_t*)0x20000a90 = 0; *(uint8_t*)0x20000a91 = 0; *(uint8_t*)0x20000a92 = 0; *(uint8_t*)0x20000a93 = 0; *(uint8_t*)0x20000a94 = 0; *(uint8_t*)0x20000a95 = 0; *(uint8_t*)0x20000a96 = 0; *(uint8_t*)0x20000a97 = 0; *(uint8_t*)0x20000a98 = 0; *(uint8_t*)0x20000a99 = 0; *(uint8_t*)0x20000a9a = 0; *(uint8_t*)0x20000a9b = 0; *(uint8_t*)0x20000a9c = 0; *(uint8_t*)0x20000a9d = 0; *(uint8_t*)0x20000a9e = 0; *(uint8_t*)0x20000a9f = 0; *(uint8_t*)0x20000aa0 = 0; *(uint8_t*)0x20000aa1 = 0; *(uint8_t*)0x20000aa2 = 0; *(uint8_t*)0x20000aa3 = 0; *(uint8_t*)0x20000aa4 = 0; *(uint8_t*)0x20000aa5 = 0; *(uint8_t*)0x20000aa6 = 0; *(uint8_t*)0x20000aa7 = 0; *(uint8_t*)0x20000aa8 = 0; *(uint8_t*)0x20000aa9 = 0; *(uint8_t*)0x20000aaa = 0; *(uint8_t*)0x20000aab = 0; *(uint8_t*)0x20000aac = 0; *(uint8_t*)0x20000aad = 0; *(uint8_t*)0x20000aae = 0; *(uint8_t*)0x20000aaf = 0; *(uint8_t*)0x20000ab0 = 0; *(uint8_t*)0x20000ab1 = 0; *(uint8_t*)0x20000ab2 = 0; *(uint8_t*)0x20000ab3 = 0; *(uint8_t*)0x20000ab4 = 0; *(uint8_t*)0x20000ab5 = 0; *(uint8_t*)0x20000ab6 = 0; *(uint8_t*)0x20000ab7 = 0; *(uint8_t*)0x20000ab8 = 0; *(uint8_t*)0x20000ab9 = 0; *(uint8_t*)0x20000aba = 0; *(uint8_t*)0x20000abb = 0; *(uint8_t*)0x20000abc = 0; *(uint8_t*)0x20000abd = 0; *(uint8_t*)0x20000abe = 0; *(uint8_t*)0x20000abf = 0; *(uint8_t*)0x20000ac0 = 0; *(uint8_t*)0x20000ac1 = 0; *(uint8_t*)0x20000ac2 = 0; *(uint8_t*)0x20000ac3 = 0; *(uint32_t*)0x20000ac4 = 0; *(uint16_t*)0x20000ac8 = 0x70; *(uint16_t*)0x20000aca = 0x98; *(uint32_t*)0x20000acc = 0; *(uint64_t*)0x20000ad0 = 0; *(uint64_t*)0x20000ad8 = 0; *(uint16_t*)0x20000ae0 = 0x28; memcpy((void*)0x20000ae2, "\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\000\000\000\000", 29); *(uint8_t*)0x20000aff = 0; *(uint32_t*)0x20000b00 = 0xfffffffe; syscall(__NR_setsockopt, r[0], 0ul, 0x40ul, 0x20000700ul, 0x408ul); break; case 2: res = syscall(__NR_pipe, 0x20000040ul); if (res != -1) { r[1] = *(uint32_t*)0x20000040; r[2] = *(uint32_t*)0x20000044; } break; case 3: res = syscall(__NR_socket, 2ul, 2ul, 0ul); if (res != -1) r[3] = res; break; case 4: syscall(__NR_close, r[3]); break; case 5: *(uint64_t*)0x20000300 = 0; *(uint32_t*)0x20000308 = 0; *(uint64_t*)0x20000310 = 0x200002c0; *(uint64_t*)0x200002c0 = 0x20000000; memcpy((void*)0x20000000, "\x60\x00\x00\x00\x30\x00\x3d\xfa\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x4c\x00\x01\x00\x48\x00\x01\x00\x07\x00\x01\x00" "\x78\x74\x00\x00\x38\x00\x02\x80\x2a\x00\x06\x00\x26\x00\x00\x00" "\x6e\x67\x6c\x65\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x47\x3c\x02\xef\x00\x03\x00\x00\x00\x00" "\x00\x00\x00\x00\x08\x00\x02", 87); *(uint64_t*)0x200002c8 = 1; *(uint64_t*)0x20000318 = 1; *(uint64_t*)0x20000320 = 0; *(uint64_t*)0x20000328 = 0; *(uint32_t*)0x20000330 = 0; syscall(__NR_sendmsg, -1, 0x20000300ul, 0ul); break; case 6: syscall(__NR_write, r[2], 0x20000000ul, 0xfffffeccul); break; case 7: syscall(__NR_socket, 0x10ul, 3ul, 0ul); break; case 8: syscall(__NR_splice, r[1], 0ul, r[3], 0ul, 0x4ffe0ul, 0ul); break; } } int main(void) { syscall(__NR_mmap, 0x20000000ul, 0x1000000ul, 3ul, 0x32ul, -1, 0); loop(); return 0; }