// https://syzkaller.appspot.com/bug?id=400f101b6d23e28cd9fa9d6d759f59388d8f6603 // 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 280 #endif #ifndef __NR_close #define __NR_close 57 #endif #ifndef __NR_mmap #define __NR_mmap 222 #endif uint64_t r[1] = {0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x20000000ul, /*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=*/0x21000000ul, /*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$BPF_PROG_WITH_BTFID_LOAD arguments: [ // cmd: const = 0x5 (8 bytes) // arg: ptr[in, bpf_prog_with_btfid] { // union bpf_prog_with_btfid { // bpf_lsm: bpf_prog_t[const[BPF_PROG_TYPE_LSM, int32], // const[BPF_LSM_MAC, int32], bpf_lsm_btf_id[opt], const[0, int32]] { // type: const = 0x6 (4 bytes) // ninsn: bytesize8 = 0x3 (4 bytes) // insns: ptr[inout, array[ANYUNION]] { // array[ANYUNION] { // union ANYUNION { // ANYBLOB: buffer: {18 00 00 00 00 3f 00 00 00 00 00 00 00 00 // 00 f1 95} (length 0x11) // } // } // } // 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: const = 0x1b (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_lsm_btf_id (resource) // attach_prog_fd: const = 0x0 (4 bytes) // 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[const[BPF_PROG_TYPE_LSM, int32], // const[BPF_LSM_MAC, int32], bpf_lsm_btf_id[opt], const[0, // int32]]_prog_token_fd_wrapper { // void: buffer: {} (length 0x0) // } // pad: union _bpf_prog_t[const[BPF_PROG_TYPE_LSM, int32], // const[BPF_LSM_MAC, int32], bpf_lsm_btf_id[opt], const[0, // int32]]_pad_wrapper { // value: const = 0x0 (4 bytes) // } // } // } // } // size: len = 0x80 (8 bytes) // ] // returns fd_bpf_prog_with_btfid *(uint32_t*)0x20000280 = 6; *(uint32_t*)0x20000284 = 3; *(uint64_t*)0x20000288 = 0x200003c0; memcpy((void*)0x200003c0, "\x18\x00\x00\x00\x00\x3f\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf1\x95", 17); *(uint64_t*)0x20000290 = 0x20000140; memcpy((void*)0x20000140, "GPL\000", 4); *(uint32_t*)0x20000298 = 0; *(uint32_t*)0x2000029c = 0; *(uint64_t*)0x200002a0 = 0; *(uint32_t*)0x200002a8 = 0; *(uint32_t*)0x200002ac = 0; memset((void*)0x200002b0, 0, 16); *(uint32_t*)0x200002c0 = 0; *(uint32_t*)0x200002c4 = 0x1b; *(uint32_t*)0x200002c8 = -1; *(uint32_t*)0x200002cc = 8; *(uint64_t*)0x200002d0 = 0; *(uint32_t*)0x200002d8 = 0; *(uint32_t*)0x200002dc = 0x10; *(uint64_t*)0x200002e0 = 0; *(uint32_t*)0x200002e8 = 0; *(uint32_t*)0x200002ec = 0; *(uint32_t*)0x200002f0 = 0; *(uint32_t*)0x200002f4 = 0; *(uint64_t*)0x200002f8 = 0; *(uint64_t*)0x20000300 = 0; *(uint32_t*)0x20000308 = 0x10; *(uint32_t*)0x2000030c = 0; *(uint32_t*)0x20000310 = 0; syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x20000280ul, /*size=*/0x80ul); // bpf$ITER_CREATE arguments: [ // cmd: const = 0xb (8 bytes) // arg: nil // size: len = 0x0 (8 bytes) // ] // returns fd res = syscall(__NR_bpf, /*cmd=*/0xbul, /*arg=*/0ul, /*size=*/0ul); if (res != -1) r[0] = res; // close arguments: [ // fd: fd (resource) // ] syscall(__NR_close, /*fd=*/r[0]); // bpf$MAP_CREATE arguments: [ // cmd: const = 0x0 (8 bytes) // arg: nil // size: len = 0x48 (8 bytes) // ] // returns fd_bpf_map syscall(__NR_bpf, /*cmd=*/0ul, /*arg=*/0ul, /*size=*/0x48ul); // bpf$BPF_GET_PROG_INFO arguments: [ // cmd: const = 0xf (8 bytes) // arg: nil // size: len = 0x0 (8 bytes) // ] syscall(__NR_bpf, /*cmd=*/0xful, /*arg=*/0ul, /*size=*/0ul); return 0; }