// 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 #define BITMASK(bf_off, bf_len) (((1ull << (bf_len)) - 1) << (bf_off)) #define STORE_BY_BITMASK(type, htobe, addr, val, bf_off, bf_len) \ *(type*)(addr) = \ htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | \ (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len)))) 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; if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } // sendmsg$NFT_BATCH arguments: [ // fd: sock_nl_netfilter (resource) // msg: ptr[in, msghdr_netlink[nft_batch_msg]] { // msghdr_netlink[nft_batch_msg] { // addr: nil // addrlen: len = 0x0 (4 bytes) // pad = 0x0 (4 bytes) // vec: ptr[in, iovec[in, nft_batch_msg]] { // iovec[in, nft_batch_msg] { // addr: ptr[in, nft_batch_msg] { // nft_batch_msg { // begin: nft_nlmsghdr[NFNL_MSG_BATCH_BEGIN] { // nlmsg_len: len = 0x14 (4 bytes) // nlmsg_type: const = 0x10 (2 bytes) // nlmsg_flags: const = 0x1 (2 bytes) // nlmsg_seq: const = 0x0 (4 bytes) // nlmsg_pid: const = 0x0 (4 bytes) // hdr: nfgenmsg_nft { // nfgen_family: families = 0x0 (1 bytes) // version: const = 0x0 (1 bytes) // res_id: const = 0xa (2 bytes) // } // } // msgs: array[nft_batch_message] { // } // end: nft_nlmsghdr[NFNL_MSG_BATCH_END] { // nlmsg_len: len = 0x14 (4 bytes) // nlmsg_type: const = 0x11 (2 bytes) // nlmsg_flags: const = 0x1 (2 bytes) // nlmsg_seq: const = 0x0 (4 bytes) // nlmsg_pid: const = 0x0 (4 bytes) // hdr: nfgenmsg_nft { // nfgen_family: families = 0x0 (1 bytes) // version: const = 0x0 (1 bytes) // res_id: const = 0xa (2 bytes) // } // } // } // } // len: len = 0x28 (8 bytes) // } // } // vlen: const = 0x1 (8 bytes) // ctrl: const = 0x0 (8 bytes) // ctrllen: const = 0x0 (8 bytes) // f: send_flags = 0x0 (4 bytes) // pad = 0x0 (4 bytes) // } // } // f: send_flags = 0x0 (8 bytes) // ] *(uint64_t*)0x2000000000c0 = 0; *(uint32_t*)0x2000000000c8 = 0; *(uint64_t*)0x2000000000d0 = 0x200000000040; *(uint64_t*)0x200000000040 = 0x2000000001c0; *(uint32_t*)0x2000000001c0 = 0x14; *(uint16_t*)0x2000000001c4 = 0x10; *(uint16_t*)0x2000000001c6 = 1; *(uint32_t*)0x2000000001c8 = 0; *(uint32_t*)0x2000000001cc = 0; *(uint8_t*)0x2000000001d0 = 0; *(uint8_t*)0x2000000001d1 = 0; *(uint16_t*)0x2000000001d2 = htobe16(0xa); *(uint32_t*)0x2000000001d4 = 0x14; *(uint16_t*)0x2000000001d8 = 0x11; *(uint16_t*)0x2000000001da = 1; *(uint32_t*)0x2000000001dc = 0; *(uint32_t*)0x2000000001e0 = 0; *(uint8_t*)0x2000000001e4 = 0; *(uint8_t*)0x2000000001e5 = 0; *(uint16_t*)0x2000000001e6 = htobe16(0xa); *(uint64_t*)0x200000000048 = 0x28; *(uint64_t*)0x2000000000d8 = 1; *(uint64_t*)0x2000000000e0 = 0; *(uint64_t*)0x2000000000e8 = 0; *(uint32_t*)0x2000000000f0 = 0; syscall(__NR_sendmsg, /*fd=*/(intptr_t)-1, /*msg=*/0x2000000000c0ul, /*f=*/0ul); // 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 = 0x17 (4 bytes) // ninsn: bytesize8 = 0x3 (4 bytes) // insns: ptr[in, bpf_instructions] { // union bpf_instructions { // framed: bpf_framed_program { // initr0: bpf_insn_init_r0 { // code: const = 0x18 (1 bytes) // dst: const = 0x0 (0 bytes) // src: const = 0x0 (1 bytes) // off: const = 0x0 (2 bytes) // imm: int32 = 0x0 (4 bytes) // code2: const = 0x0 (1 bytes) // regs2: const = 0x0 (1 bytes) // off2: const = 0x0 (2 bytes) // imm2: int32 = 0x0 (4 bytes) // } // body: array[bpf_insn] { // } // exit: bpf_insn_exit { // code: const = 0x95 (1 bytes) // regs: const = 0x0 (1 bytes) // off: const = 0x0 (2 bytes) // imm: const = 0x0 (4 bytes) // } // } // } // } // 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 { // cgroup_sysctl: cgroup_sysctl_attach_types = 0x12 (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 = 0xa8 (8 bytes) // ] // returns fd_bpf_prog *(uint32_t*)0x200000000140 = 0x17; *(uint32_t*)0x200000000144 = 3; *(uint64_t*)0x200000000148 = 0x200000000200; *(uint8_t*)0x200000000200 = 0x18; STORE_BY_BITMASK(uint8_t, , 0x200000000201, 0, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x200000000201, 0, 4, 4); *(uint16_t*)0x200000000202 = 0; *(uint32_t*)0x200000000204 = 0; *(uint8_t*)0x200000000208 = 0; *(uint8_t*)0x200000000209 = 0; *(uint16_t*)0x20000000020a = 0; *(uint32_t*)0x20000000020c = 0; *(uint8_t*)0x200000000210 = 0x95; *(uint8_t*)0x200000000211 = 0; *(uint16_t*)0x200000000212 = 0; *(uint32_t*)0x200000000214 = 0; *(uint64_t*)0x200000000150 = 0x200000000240; memcpy((void*)0x200000000240, "GPL\000", 4); *(uint32_t*)0x200000000158 = 0; *(uint32_t*)0x20000000015c = 0; *(uint64_t*)0x200000000160 = 0; *(uint32_t*)0x200000000168 = 0; *(uint32_t*)0x20000000016c = 0; memset((void*)0x200000000170, 0, 16); *(uint32_t*)0x200000000180 = 0; *(uint32_t*)0x200000000184 = 0x12; *(uint32_t*)0x200000000188 = 0; *(uint32_t*)0x20000000018c = 0; *(uint64_t*)0x200000000190 = 0; *(uint32_t*)0x200000000198 = 0; *(uint32_t*)0x20000000019c = 0; *(uint64_t*)0x2000000001a0 = 0; *(uint32_t*)0x2000000001a8 = 0; *(uint32_t*)0x2000000001ac = 0; *(uint32_t*)0x2000000001b0 = 0; *(uint32_t*)0x2000000001b4 = 0; *(uint64_t*)0x2000000001b8 = 0; *(uint64_t*)0x2000000001c0 = 0; *(uint32_t*)0x2000000001c8 = 0; *(uint32_t*)0x2000000001cc = 0; *(uint32_t*)0x2000000001d0 = 0; syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x200000000140ul, /*size=*/0xa8ul); return 0; }