// 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 #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 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; } 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"); } 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 < 4; 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 == 2) break; event_timedwait(&th->done, 50); 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 = 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[2] = {0xffffffffffffffff, 0xffffffffffffffff}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: // bpf$PROG_LOAD arguments: [ // cmd: const = 0x5 (8 bytes) // arg: ptr[in, bpf_prog_t[flags[bpf_prog_type, int32], // bpf_prog_attach_types, bpf_btf_id[opt], fd_bpf_prog[opt]]] { // bpf_prog_t[flags[bpf_prog_type, int32], bpf_prog_attach_types, // bpf_btf_id[opt], fd_bpf_prog[opt]] { // type: bpf_prog_type = 0x1 (4 bytes) // ninsn: bytesize8 = 0x8 (4 bytes) // insns: ptr[inout, array[ANYUNION]] { // array[ANYUNION] { // union ANYUNION { // ANYBLOB: buffer: {7a 0a f8 ff 75 25 70 00 bf a1 00 00 00 00 // 00 00 07 01 00 00 f8 ff ff ff b7 02 00 00 05 00 00 00 bf 13 // 00 00 00 00 00 00 85 00 00 00 06 00 00 00 b7 00 00 00 00 00 // 00 00 95 00 00 ff 00 00 00 00 b2 59 52 85 0a 84 a7 00 02 b2 // ab 3d 6f fa a6 ea d0 16 91 91 d5 4f 81 96 21 7f c5 63 e2 fc // 91 f6 da 4d ad 4f dc 2e b1 b5 98 6f c4 4b c2 5f b5 91 cf 77 // b9 df b3 79 a3 f6 11 db c2 a3 64 91 6f 09 8d ab 10 b1 a2 97 // cf 52 86 66 d1 dd d7 3f 30 f2 38 2f 6c da 4b fd d4 5b e5 83 // 82 3c 0f 09 22 48 a5 7d 48 62 1f 3c 1c 65 ee 19 ee 87 5d af // 45 00 6a 4c 4e a5 e1 5b 2f 96 18 d5 47 24 4a 22 00 00 00 00 // 08 00 db 58 36 20 ce 72 43 d1 ae bd b6 38 d9 1d be f6 61 93 // 58 39 9a a9 c2 ac d0 68 c0 3e fe fd 8b c7 7e df 2d 34 b1 2c // d4 8a 1b 20 fb 7d d8 43 26 7e 03 31 75 9f 4e c6 b5 b0 af 58 // e6 04 f4 94 ef f2 89 02 6d 50 45 ef 08 00 00 00 00 00 00 00 // 77 18 a0 9f 48 86 af c2 6a bb a3 46 35 d0 e8 b5 98 a5 1b c7 // 42 13 5a 6e 1d 33 fe 22 6c 94 4b c7 6b e4 0d 43 5a a8 b5 20 // 2d b7 61 01 4b 1b 99 9a 12 df 6b ee 43 1a 66 81 00 00 00 26 // 3b 62 33 e1 c0 fe 30 e3 84 c3 cb 07 b7 4a 72 29 1a 1a 2b 52 // 3d d8 1b 66 51 b1 ee 48 e9 99 bb 00 48 23 eb cd 8c 65 74 3f // 31 f8 4b 26 3a b9 b3 42 66 92 d0 1a d1 94 f3 02 d7 a6 58 e9 // e5 46 87 d3 c5 6d 7b ed b6 b2 f2 5d db 8c 64 0b b3 21 a4 02 // 05 8c 92 21 b6 87 08 14 cf 4e e2 3d db 79 ff f5 eb 15 6e 0a // 00 00 00 00 00 00 f2 bd 1d 4a 17 8d 86 d6 93 5e b8 b7 5b c4 // eb 68 0d 10 e8 b6 a5 4c 6c 86 74 ca f6 3f f7 66 22 93 9a 20 // d4 aa df 85 db 40 17 9c 2c f8 3e e0 7e 30 a2 79 d8 f9 f3 bc // 28 2d eb 43 a0 34 09 f8 e6 97 2f 3f 72 0d 04 59 23 70 2c ed // e0 f3 e9 14 11 f3 f1 b1 6f 06 56 24 f2 80 a7 dc ce 8d b9 10 // f9 3c 49 b9 e0 b6 dd 73 56 aa 79 d5 fa bb 5c 0d 0d a6 d7 19 // d7 e0 ef b2 bb 71 3d 18 24 2c d5 df 6c a5 33 07 a4 cd d9 1b // e4 58 7f 90 e3 17 c8 de 5e 5c 39 33 fd 5d 5b f3 8f 6b 9f c3 // 9f c8 29 dc fe 4a f8 ac 5f bb 73 14 a7 a4 33 e0 18 27 67 d1 // 78 6e da 2b 20} (length 0x26b) // } // } // } // license: ptr[in, buffer] { // buffer: {47 50 4c 00} (length 0x4) // } // loglev: int32 = 0x0 (4 bytes) // logsize: len = 0x0 (4 bytes) // log: nil // kern_version: bpf_kern_version = 0x0 (4 bytes) // flags: bpf_prog_load_flags = 0x0 (4 bytes) // prog_name: buffer: {00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // 00} (length 0x10) prog_ifindex: ifindex (resource) // expected_attach_type: union bpf_prog_attach_types { // fallback: bpf_attach_types = 0x0 (4 bytes) // } // btf_fd: fd_btf (resource) // func_info_rec_size: const = 0x8 (4 bytes) // func_info: nil // func_info_cnt: len = 0x0 (4 bytes) // line_info_rec_size: const = 0x10 (4 bytes) // line_info: nil // line_info_cnt: len = 0x0 (4 bytes) // attach_btf_id: bpf_btf_id (resource) // attach_prog_fd: fd_bpf_prog (resource) // core_relo_cnt: len = 0x0 (4 bytes) // fd_array: nil // core_relos: nil // core_relo_rec_size: const = 0x10 (4 bytes) // log_true_size: int32 = 0x0 (4 bytes) // prog_token_fd: union _bpf_prog_t[flags[bpf_prog_type, int32], // bpf_prog_attach_types, bpf_btf_id[opt], // fd_bpf_prog[opt]]_prog_token_fd_wrapper { // void: buffer: {} (length 0x0) // } // pad: union _bpf_prog_t[flags[bpf_prog_type, int32], // bpf_prog_attach_types, bpf_btf_id[opt], // fd_bpf_prog[opt]]_pad_wrapper { // value: const = 0x0 (4 bytes) // } // } // } // size: len = 0x48 (8 bytes) // ] // returns fd_bpf_prog *(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\x06\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: // bpf$MAP_CREATE_TAIL_CALL arguments: [ // cmd: const = 0x0 (8 bytes) // arg: ptr[inout, array[ANYUNION]] { // array[ANYUNION] { // union ANYUNION { // ANYBLOB: buffer: {03 00 00 00 04 00 00 00 04 00 00 00 0a} // (length 0xd) // } // } // } // size: len = 0x48 (8 bytes) // ] // returns tail_call_map_fd memcpy((void*)0x200000001d40, "\x03\x00\x00\x00\x04\x00\x00\x00\x04\x00\x00\x00\x0a", 13); res = syscall(__NR_bpf, /*cmd=*/0ul, /*arg=*/0x200000001d40ul, /*size=*/0x48ul); if (res != -1) r[1] = res; break; case 2: // bpf$MAP_UPDATE_ELEM_TAIL_CALL arguments: [ // cmd: const = 0x2 (8 bytes) // arg: ptr[inout, bpf_map_update_tail_call_arg] { // bpf_map_update_tail_call_arg { // map: tail_call_map_update { // in: tail_call_map_fd (resource) // out: tail_call_map (resource) // } // pad = 0x0 (4 bytes) // key: ptr[in, const[0, const]] { // const = 0x0 (4 bytes) // } // val: ptr[in, fd_bpf_prog] { // fd_bpf_prog (resource) // } // flags: const = 0x0 (8 bytes) // } // } // size: len = 0x20 (8 bytes) // ] *(uint32_t*)0x200000000280 = r[1]; *(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); for (int i = 0; i < 32; i++) { syscall(__NR_bpf, /*cmd=*/2ul, /*arg=*/0x200000000280ul, /*size=*/0x20ul); } break; case 3: // bpf$PROG_LOAD arguments: [ // cmd: const = 0x5 (8 bytes) // arg: ptr[in, bpf_prog_t[flags[bpf_prog_type, int32], // bpf_prog_attach_types, bpf_btf_id[opt], fd_bpf_prog[opt]]] { // bpf_prog_t[flags[bpf_prog_type, int32], bpf_prog_attach_types, // bpf_btf_id[opt], fd_bpf_prog[opt]] { // type: bpf_prog_type = 0x1 (4 bytes) // ninsn: bytesize8 = 0x10 (4 bytes) // insns: ptr[inout, array[ANYUNION]] { // array[ANYUNION] { // union ANYUNION { // ANYBLOB: buffer: {18 08 00 00 00 00 00 00 00 00 00 00 00 00 // 00 00 18 12 00 00} (length 0x14) // } // union ANYUNION { // ANYRES32: ANYRES32 (resource) // } // union ANYUNION { // ANYBLOB: buffer: {00 00 00 00 00 00 00 00 b7 03 00 00 00 00 // 00 00 85 00 00 00 0c 00 00 00 b7 00 00 00 00 00 00 00 18 01 // 00 00 00 08 2c 25 00 00 00 00 00 21 20 20 7b 1a f8 ff 00 00 // 00 00 bf a1 00 00 00 00 00 00 07 01 00 00 f8 ff ff ff b7 02 // 00 00 08 00 00 00 b7 03 00 00 00 00 00 00 85 00 00 00 07 00 // 00 00 95} (length 0x61) // } // } // } // license: ptr[in, buffer] { // buffer: {47 50 4c 00} (length 0x4) // } // loglev: int32 = 0x0 (4 bytes) // logsize: len = 0x0 (4 bytes) // log: nil // kern_version: bpf_kern_version = 0x0 (4 bytes) // flags: bpf_prog_load_flags = 0x0 (4 bytes) // prog_name: buffer: {00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // 00} (length 0x10) prog_ifindex: ifindex (resource) // expected_attach_type: union bpf_prog_attach_types { // fallback: bpf_attach_types = 0x0 (4 bytes) // } // btf_fd: fd_btf (resource) // func_info_rec_size: const = 0x0 (4 bytes) // func_info: nil // func_info_cnt: len = 0x0 (4 bytes) // line_info_rec_size: const = 0x0 (4 bytes) // line_info: nil // line_info_cnt: len = 0x0 (4 bytes) // attach_btf_id: bpf_btf_id (resource) // attach_prog_fd: fd_bpf_prog (resource) // core_relo_cnt: len = 0x0 (4 bytes) // fd_array: nil // core_relos: nil // core_relo_rec_size: const = 0x0 (4 bytes) // log_true_size: int32 = 0x0 (4 bytes) // prog_token_fd: union _bpf_prog_t[flags[bpf_prog_type, int32], // bpf_prog_attach_types, bpf_btf_id[opt], // fd_bpf_prog[opt]]_prog_token_fd_wrapper { // void: buffer: {} (length 0x0) // } // pad: union _bpf_prog_t[flags[bpf_prog_type, int32], // bpf_prog_attach_types, bpf_btf_id[opt], // fd_bpf_prog[opt]]_pad_wrapper { // value: const = 0x0 (4 bytes) // } // } // } // size: len = 0x94 (8 bytes) // ] // returns fd_bpf_prog *(uint32_t*)0x200000000500 = 1; *(uint32_t*)0x200000000504 = 0x10; *(uint64_t*)0x200000000508 = 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[1]; 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*)0x200000000510 = 0x200000000980; memcpy((void*)0x200000000980, "GPL\000", 4); *(uint32_t*)0x200000000518 = 0; *(uint32_t*)0x20000000051c = 0; *(uint64_t*)0x200000000520 = 0; *(uint32_t*)0x200000000528 = 0; *(uint32_t*)0x20000000052c = 0; memset((void*)0x200000000530, 0, 16); *(uint32_t*)0x200000000540 = 0; *(uint32_t*)0x200000000544 = 0; *(uint32_t*)0x200000000548 = -1; *(uint32_t*)0x20000000054c = 0; *(uint64_t*)0x200000000550 = 0; *(uint32_t*)0x200000000558 = 0; *(uint32_t*)0x20000000055c = 0; *(uint64_t*)0x200000000560 = 0; *(uint32_t*)0x200000000568 = 0; *(uint32_t*)0x20000000056c = 0; *(uint32_t*)0x200000000570 = 0; *(uint32_t*)0x200000000574 = 0; *(uint64_t*)0x200000000578 = 0; *(uint64_t*)0x200000000580 = 0; *(uint32_t*)0x200000000588 = 0; *(uint32_t*)0x20000000058c = 0; *(uint32_t*)0x200000000590 = 0; syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x200000000500ul, /*size=*/0x94ul); 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) { loop(); } } sleep(1000000); return 0; }