// autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #ifndef __NR_bpf #define __NR_bpf 321 #endif uint64_t r[1] = {0xffffffffffffffff}; 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; intptr_t res = 0; if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } // 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 = 0x3 (4 bytes) // ninsn: bytesize8 = 0x5 (4 bytes) // insns: ptr[inout, array[ANYUNION]] { // array[ANYUNION] { // union ANYUNION { // ANYBLOB: buffer: {18 00 00 00 00 00 00 00 00 00 00 00 46 00 00 // 00 85 00 00 00 29 00 00 00 85 00 00 00 07 00 00 00 95} (length // 0x21) // } // } // } // license: ptr[in, buffer] { // buffer: {47 50 4c 00} (length 0x4) // } // loglev: int32 = 0x3 (4 bytes) // logsize: len = 0x0 (4 bytes) // log: nil // kern_version: bpf_kern_version = 0x41100 (4 bytes) // flags: bpf_prog_load_flags = 0x1 (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 = 0x6 (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 = 3; *(uint32_t*)0x200000000504 = 5; *(uint64_t*)0x200000000508 = 0x200000000400; memcpy((void*)0x200000000400, "\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x46\x00\x00\x00\x85" "\x00\x00\x00\x29\x00\x00\x00\x85\x00\x00\x00\x07\x00\x00\x00\x95", 33); *(uint64_t*)0x200000000510 = 0x200000000200; memcpy((void*)0x200000000200, "GPL\000", 4); *(uint32_t*)0x200000000518 = 3; *(uint32_t*)0x20000000051c = 0; *(uint64_t*)0x200000000520 = 0; *(uint32_t*)0x200000000528 = 0x41100; *(uint32_t*)0x20000000052c = 1; memset((void*)0x200000000530, 0, 16); *(uint32_t*)0x200000000540 = 0; *(uint32_t*)0x200000000544 = 6; *(uint32_t*)0x200000000548 = 0; *(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; res = syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x200000000500ul, /*size=*/0x94ul); if (res != -1) r[0] = res; // bpf$BPF_PROG_TEST_RUN arguments: [ // cmd: const = 0xa (8 bytes) // arg: ptr[in, bpf_test_prog_arg] { // bpf_test_prog_arg { // prog: fd_bpf_prog (resource) // retval: const = 0x0 (4 bytes) // insizedata: len = 0xdb (4 bytes) // outsizedata: len = 0x0 (4 bytes) // indata: nil // outdata: nil // repeat: int32 = 0xc (4 bytes) // dur: const = 0x0 (4 bytes) // insizectx: len = 0x0 (4 bytes) // outsizectx: len = 0x0 (4 bytes) // inctx: nil // outctx: nil // flags: bpf_prog_test_run_flags = 0x8 (4 bytes) // cpu: const = 0x0 (4 bytes) // batch_size: int32 = 0x0 (4 bytes) // pad = 0x0 (4 bytes) // } // } // size: len = 0x50 (8 bytes) // ] *(uint32_t*)0x200000000240 = r[0]; *(uint32_t*)0x200000000244 = 0; *(uint32_t*)0x200000000248 = 0xdb; *(uint32_t*)0x20000000024c = 0; *(uint64_t*)0x200000000250 = 0; *(uint64_t*)0x200000000258 = 0; *(uint32_t*)0x200000000260 = 0xc; *(uint32_t*)0x200000000264 = 0; *(uint32_t*)0x200000000268 = 0; *(uint32_t*)0x20000000026c = 0; *(uint64_t*)0x200000000270 = 0; *(uint64_t*)0x200000000278 = 0; *(uint32_t*)0x200000000280 = 8; *(uint32_t*)0x200000000284 = 0; *(uint32_t*)0x200000000288 = 0; syscall(__NR_bpf, /*cmd=*/0xaul, /*arg=*/0x200000000240ul, /*size=*/0x50ul); return 0; }