// 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_epoll_create1 #define __NR_epoll_create1 20 #endif #ifndef __NR_epoll_pwait #define __NR_epoll_pwait 22 #endif #ifndef __NR_mmap #define __NR_mmap 222 #endif #ifndef __NR_sendmsg #define __NR_sendmsg 211 #endif #ifndef __NR_setsockopt #define __NR_setsockopt 208 #endif #ifndef __NR_socket #define __NR_socket 198 #endif uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 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)) { } // socket$inet_tcp arguments: [ // domain: const = 0x2 (8 bytes) // type: const = 0x1 (8 bytes) // proto: const = 0x0 (4 bytes) // ] // returns sock_tcp res = syscall(__NR_socket, /*domain=*/2ul, /*type=*/1ul, /*proto=*/0); if (res != -1) r[0] = res; // setsockopt$inet_tcp_int arguments: [ // fd: sock_tcp (resource) // level: const = 0x6 (4 bytes) // optname: tcp_option_types_int = 0x210000000013 (4 bytes) // optval: nil // optlen: len = 0x0 (8 bytes) // ] syscall(__NR_setsockopt, /*fd=*/r[0], /*level=*/6, /*optname=TCP_THIN_LINEAR_TIMEOUTS|TCP_CORK*/ 0x13, /*optval=*/0ul, /*optlen=*/0ul); // 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[1] = res; // close arguments: [ // fd: fd (resource) // ] syscall(__NR_close, /*fd=*/r[1]); // bpf$BPF_PROG_TEST_RUN arguments: [ // cmd: const = 0x1c (8 bytes) // arg: nil // size: len = 0x0 (8 bytes) // ] syscall(__NR_bpf, /*cmd=*/0x1cul, /*arg=*/0ul, /*size=*/0ul); // bpf$LINK_DETACH arguments: [ // cmd: const = 0x22 (8 bytes) // arg: nil // size: len = 0x0 (8 bytes) // ] syscall(__NR_bpf, /*cmd=*/0x22ul, /*arg=*/0ul, /*size=*/0ul); // epoll_create1 arguments: [ // flags: epoll_flags = 0x0 (8 bytes) // ] // returns fd_epoll res = syscall(__NR_epoll_create1, /*flags=*/0ul); if (res != -1) r[2] = res; // socket arguments: [ // domain: socket_domain = 0x10 (8 bytes) // type: socket_type = 0x803 (8 bytes) // proto: int32 = 0x0 (4 bytes) // ] // returns sock res = syscall(__NR_socket, /*domain=AF_NETLINK*/ 0x10ul, /*type=SOCK_NONBLOCK|SOCK_RAW*/ 0x803ul, /*proto=*/0); if (res != -1) r[3] = res; // epoll_pwait arguments: [ // epfd: fd_epoll (resource) // events: nil // maxevents: len = 0x0 (8 bytes) // timeout: int32 = 0x8 (4 bytes) // sigmask: nil // size: bytesize = 0x0 (8 bytes) // ] syscall(__NR_epoll_pwait, /*epfd=*/r[2], /*events=*/0ul, /*maxevents=*/0ul, /*timeout=*/8, /*sigmask=*/0ul, /*size=*/0ul); // sendmsg$IPCTNL_MSG_CT_NEW arguments: [ // fd: sock_nl_netfilter (resource) // msg: nil // f: send_flags = 0x800 (8 bytes) // ] syscall(__NR_sendmsg, /*fd=*/r[3], /*msg=*/0ul, /*f=MSG_CONFIRM*/ 0x800ul); return 0; }