// https://syzkaller.appspot.com/bug?id=a1fadd4536a3818013239b93294e07e0cb643e75 // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #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)))) uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0x1000000, /*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=*/0x1000, /*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$nl_route arguments: [ // domain: const = 0x10 (8 bytes) // type: const = 0x3 (8 bytes) // proto: const = 0x0 (4 bytes) // ] // returns sock_nl_route res = syscall(__NR_socket, /*domain=*/0x10ul, /*type=*/3ul, /*proto=*/0); if (res != -1) r[0] = res; // openat$tun arguments: [ // fd: const = 0xffffffffffffff9c (8 bytes) // file: ptr[in, buffer] { // buffer: {2f 64 65 76 2f 6e 65 74 2f 74 75 6e 00} (length 0xd) // } // flags: open_flags = 0x2 (4 bytes) // mode: const = 0x0 (2 bytes) // ] // returns fd_tun memcpy((void*)0x200000000100, "/dev/net/tun\000", 13); res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x200000000100ul, /*flags=O_RDWR*/ 2, /*mode=*/0); if (res != -1) r[1] = res; // ioctl$TUNSETIFF arguments: [ // fd: fd_tun (resource) // cmd: const = 0x400454ca (4 bytes) // arg: ptr[in, ifreq_dev_t[devnames, flags[tun_setiff_flags, int16]]] { // ifreq_dev_t[devnames, flags[tun_setiff_flags, int16]] { // ifr_ifrn: buffer: {73 79 7a 6b 61 6c 6c 65 72 30 00 00 00 00 00 00} // (length 0x10) elem: tun_setiff_flags = 0x1 (2 bytes) pad = 0x0 (22 // bytes) // } // } // ] memcpy((void*)0x200000000040, "syzkaller0\000\000\000\000\000\000", 16); *(uint16_t*)0x200000000050 = 1; syscall(__NR_ioctl, /*fd=*/r[1], /*cmd=*/0x400454ca, /*arg=*/0x200000000040ul); // ioctl$sock_SIOCGIFINDEX arguments: [ // fd: sock (resource) // cmd: const = 0x8933 (4 bytes) // arg: ptr[out, ifreq_dev_t[devnames, ifindex]] { // ifreq_dev_t[devnames, ifindex] { // ifr_ifrn: buffer: {73 79 7a 6b 61 6c 6c 65 72 30 00 00 00 00 00 00} // (length 0x10) elem: ifindex (resource) pad = 0x0 (20 bytes) // } // } // ] memcpy((void*)0x200000000080, "syzkaller0\000\000\000\000\000\000", 16); res = syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x8933, /*arg=*/0x200000000080ul); if (res != -1) r[2] = *(uint32_t*)0x200000000090; // socket$inet arguments: [ // domain: const = 0x2 (8 bytes) // type: socket_type = 0x2 (8 bytes) // proto: int32 = 0x0 (4 bytes) // ] // returns sock_in res = syscall(__NR_socket, /*domain=*/2ul, /*type=SOCK_DGRAM*/ 2ul, /*proto=*/0); if (res != -1) r[3] = res; // ioctl$sock_inet_SIOCSIFFLAGS arguments: [ // fd: sock (resource) // cmd: const = 0x8914 (4 bytes) // arg: ptr[in, ifreq_dev_t[devnames, flags[ifru_flags, int16]]] { // ifreq_dev_t[devnames, flags[ifru_flags, int16]] { // ifr_ifrn: buffer: {73 79 7a 6b 61 6c 6c 65 72 30 00 00 00 00 00 00} // (length 0x10) elem: ifru_flags = 0x1 (2 bytes) pad = 0x0 (22 bytes) // } // } // ] memcpy((void*)0x2000000000c0, "syzkaller0\000\000\000\000\000\000", 16); *(uint16_t*)0x2000000000d0 = 1; syscall(__NR_ioctl, /*fd=*/r[3], /*cmd=*/0x8914, /*arg=*/0x2000000000c0ul); // sendmsg$nl_route_sched arguments: [ // fd: sock_nl_route (resource) // msg: ptr[in, msghdr_netlink[netlink_msg_route_sched]] { // msghdr_netlink[netlink_msg_route_sched] { // addr: nil // addrlen: len = 0x0 (4 bytes) // pad = 0x0 (4 bytes) // vec: ptr[in, iovec[in, netlink_msg_route_sched]] { // iovec[in, netlink_msg_route_sched] { // addr: ptr[in, netlink_msg_route_sched] { // union netlink_msg_route_sched { // newqdisc: netlink_msg_t[const[RTM_NEWQDISC, int16], // tcmsg[AF_UNSPEC], rtm_tca_policy] { // len: len = 0x30 (4 bytes) // type: const = 0x24 (2 bytes) // flags: netlink_msg_flags = 0x401 (2 bytes) // seq: int32 = 0x2000 (4 bytes) // pid: int32 = 0x0 (4 bytes) // payload: tcmsg[AF_UNSPEC] { // family: const = 0x0 (1 bytes) // tcm__pad1: const = 0x0 (1 bytes) // tcm__pad2: const = 0x0 (2 bytes) // ifindex: ifindex (resource) // tcm_handle: tcm_handle { // minor: tcm_handle_offsets = 0x0 (2 bytes) // major: tcm_handle_offsets = 0xffff (2 bytes) // } // tcm_parent: tcm_handle { // minor: tcm_handle_offsets = 0xfff1 (2 bytes) // major: tcm_handle_offsets = 0xffff (2 bytes) // } // tcm_info: tcm_handle { // minor: tcm_handle_offsets = 0x0 (2 bytes) // major: tcm_handle_offsets = 0x0 (2 bytes) // } // } // attrs: array[rtm_tca_policy] { // union rtm_tca_policy { // qdisc_kind_options: union qdisc_kind_options { // q_ingress: nlattr_t[const[TCA_KIND, int16], // string["ingress"]] { // nla_len: offsetof = 0xc (2 bytes) // nla_type: const = 0x1 (2 bytes) // payload: buffer: {69 6e 67 72 65 73 73 00} (length // 0x8) size: buffer: {} (length 0x0) // } // } // } // } // } // } // } // len: len = 0x30 (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*)0x200000000200 = 0; *(uint32_t*)0x200000000208 = 0; *(uint64_t*)0x200000000210 = 0x200000000100; *(uint64_t*)0x200000000100 = 0x200000000000; *(uint32_t*)0x200000000000 = 0x30; *(uint16_t*)0x200000000004 = 0x24; *(uint16_t*)0x200000000006 = 0x401; *(uint32_t*)0x200000000008 = 0x2000; *(uint32_t*)0x20000000000c = 0; *(uint8_t*)0x200000000010 = 0; *(uint8_t*)0x200000000011 = 0; *(uint16_t*)0x200000000012 = 0; *(uint32_t*)0x200000000014 = r[2]; *(uint16_t*)0x200000000018 = 0; *(uint16_t*)0x20000000001a = -1; *(uint16_t*)0x20000000001c = 0xfff1; *(uint16_t*)0x20000000001e = -1; *(uint16_t*)0x200000000020 = 0; *(uint16_t*)0x200000000022 = 0; *(uint16_t*)0x200000000024 = 0xc; *(uint16_t*)0x200000000026 = 1; memcpy((void*)0x200000000028, "ingress\000", 8); *(uint64_t*)0x200000000108 = 0x30; *(uint64_t*)0x200000000218 = 1; *(uint64_t*)0x200000000220 = 0; *(uint64_t*)0x200000000228 = 0; *(uint32_t*)0x200000000230 = 0; syscall(__NR_sendmsg, /*fd=*/r[0], /*msg=*/0x200000000200ul, /*f=*/0ul); // sendmsg$nl_route_sched arguments: [ // fd: sock_nl_route (resource) // msg: ptr[in, msghdr_netlink[netlink_msg_route_sched]] { // msghdr_netlink[netlink_msg_route_sched] { // addr: nil // addrlen: len = 0x0 (4 bytes) // pad = 0x0 (4 bytes) // vec: ptr[in, iovec[in, netlink_msg_route_sched]] { // iovec[in, netlink_msg_route_sched] { // addr: ptr[in, netlink_msg_route_sched] { // union netlink_msg_route_sched { // newtfilter: netlink_msg_t[const[RTM_NEWTFILTER, int16], // tcmsg[AF_UNSPEC], filter_policy] { // len: len = 0x5c (4 bytes) // type: const = 0x2c (2 bytes) // flags: netlink_msg_flags = 0x401 (2 bytes) // seq: int32 = 0x0 (4 bytes) // pid: int32 = 0x0 (4 bytes) // payload: tcmsg[AF_UNSPEC] { // family: const = 0x0 (1 bytes) // tcm__pad1: const = 0x0 (1 bytes) // tcm__pad2: const = 0x0 (2 bytes) // ifindex: ifindex (resource) // tcm_handle: tcm_handle { // minor: tcm_handle_offsets = 0x1 (2 bytes) // major: tcm_handle_offsets = 0x9 (2 bytes) // } // tcm_parent: tcm_handle { // minor: tcm_handle_offsets = 0xffff (2 bytes) // major: tcm_handle_offsets = 0xffff (2 bytes) // } // tcm_info: tcm_handle { // minor: tcm_handle_offsets = 0x300 (2 bytes) // major: tcm_handle_offsets = 0x1 (2 bytes) // } // } // attrs: array[filter_policy] { // union filter_policy { // filter_kind_options: union filter_kind_options { // f_basic: tca_kind_options_t["basic", // array[basic_policy]] { // TCA_KIND: nlattr_t[const[TCA_KIND, int16], // string["basic"]] { // nla_len: offsetof = 0xa (2 bytes) // nla_type: const = 0x1 (2 bytes) // payload: buffer: {62 61 73 69 63 00} (length // 0x6) size: buffer: {} (length 0x0) pad = 0x0 (2 // bytes) // } // TCA_OPTIONS: nlattr_t[const[TCA_OPTIONS, int16], // array[basic_policy]] { // nla_len: offsetof = 0x2c (2 bytes) // nla_type: const = 0x2 (2 bytes) // payload: array[basic_policy] { // union basic_policy { // TCA_BASIC_EMATCHES: // nlattr_tt[const[TCA_BASIC_EMATCHES, // int16:14], 0, 1, array[em_policy]] { // nla_len: offsetof = 0x28 (2 bytes) // nla_type: const = 0x2 (1 bytes) // NLA_F_NET_BYTEORDER: const = 0x0 (0 bytes) // NLA_F_NESTED: const = 0x1 (1 bytes) // payload: array[em_policy] { // union em_policy { // TCA_EMATCH_TREE_HDR: // nlattr_t[const[TCA_EMATCH_TREE_HDR, // int16], tcf_ematch_tree_hdr] { // nla_len: offsetof = 0x8 (2 bytes) // nla_type: const = 0x1 (2 bytes) // payload: tcf_ematch_tree_hdr { // nmatches: int16 = 0x1 (2 bytes) // progid: const = 0x0 (2 bytes) // } // size: buffer: {} (length 0x0) // } // } // union em_policy { // TCA_EMATCH_TREE_LIST: // nlattr_tt[const[TCA_EMATCH_TREE_LIST, // int16:14], 0, 1, // array[tca_ematch_tree_list]] { // nla_len: offsetof = 0x1c (2 bytes) // nla_type: const = 0x2 (1 bytes) // NLA_F_NET_BYTEORDER: const = 0x0 (0 // bytes) NLA_F_NESTED: const = 0x1 (1 // bytes) payload: // array[tca_ematch_tree_list] { // union tca_ematch_tree_list { // TCF_EM_META: // nlattr_tt[int16:14[1:3], 0, 0, // tcf_ematch_hdr_t[TCF_EM_META, // array[meta_policy]]] { // nla_len: offsetof = 0x18 (2 // bytes) nla_type: int16 = 0x1 // (1 bytes) NLA_F_NET_BYTEORDER: // const = 0x0 (0 bytes) // NLA_F_NESTED: const = 0x0 (1 // bytes) payload: // tcf_ematch_hdr_t[TCF_EM_META, // array[meta_policy]] { // header: // tcf_ematch_hdr[TCF_EM_META] // { // matchid: int16 = 0x0 (2 // bytes) kind: const = 0x4 // (2 bytes) flags: int16 = // 0x0 (2 bytes) pad: const = // 0x0 (2 bytes) // } // payload: array[meta_policy] // { // union meta_policy { // TCA_EM_META_HDR: // nlattr_t[const[TCA_EM_META_HDR, // int16], tcf_meta_hdr] { // nla_len: offsetof = // 0xc (2 bytes) // nla_type: const = 0x1 // (2 bytes) payload: // tcf_meta_hdr { // left: tcf_meta_val { // kind: int16 = // 0x1002 (2 bytes) // shift: int8 = 0xfd // (1 bytes) op: // tcf_em_opnds = 0x0 // (1 bytes) // } // right: tcf_meta_val // { // kind: int16 = // 0x1004 (2 bytes) // shift: int8 = 0x0 // (1 bytes) op: // tcf_em_opnds = 0x0 // (1 bytes) // } // } // size: buffer: {} // (length 0x0) // } // } // } // } // size: buffer: {} (length 0x0) // } // } // } // size: buffer: {} (length 0x0) // } // } // } // size: buffer: {} (length 0x0) // } // } // } // size: buffer: {} (length 0x0) // } // } // } // } // } // } // } // } // len: len = 0x5c (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*)0x200000000800 = 0; *(uint32_t*)0x200000000808 = 0; *(uint64_t*)0x200000000810 = 0x200000000300; *(uint64_t*)0x200000000300 = 0x200000000240; *(uint32_t*)0x200000000240 = 0x5c; *(uint16_t*)0x200000000244 = 0x2c; *(uint16_t*)0x200000000246 = 0x401; *(uint32_t*)0x200000000248 = 0; *(uint32_t*)0x20000000024c = 0; *(uint8_t*)0x200000000250 = 0; *(uint8_t*)0x200000000251 = 0; *(uint16_t*)0x200000000252 = 0; *(uint32_t*)0x200000000254 = r[2]; *(uint16_t*)0x200000000258 = 1; *(uint16_t*)0x20000000025a = 9; *(uint16_t*)0x20000000025c = -1; *(uint16_t*)0x20000000025e = -1; *(uint16_t*)0x200000000260 = 0x300; *(uint16_t*)0x200000000262 = 1; *(uint16_t*)0x200000000264 = 0xa; *(uint16_t*)0x200000000266 = 1; memcpy((void*)0x200000000268, "basic\000", 6); *(uint16_t*)0x200000000270 = 0x2c; *(uint16_t*)0x200000000272 = 2; *(uint16_t*)0x200000000274 = 0x28; STORE_BY_BITMASK(uint16_t, , 0x200000000276, 2, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x200000000277, 0, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x200000000277, 1, 7, 1); *(uint16_t*)0x200000000278 = 8; *(uint16_t*)0x20000000027a = 1; *(uint16_t*)0x20000000027c = 1; *(uint16_t*)0x20000000027e = 0; *(uint16_t*)0x200000000280 = 0x1c; STORE_BY_BITMASK(uint16_t, , 0x200000000282, 2, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x200000000283, 0, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x200000000283, 1, 7, 1); *(uint16_t*)0x200000000284 = 0x18; STORE_BY_BITMASK(uint16_t, , 0x200000000286, 1, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x200000000287, 0, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x200000000287, 0, 7, 1); *(uint16_t*)0x200000000288 = 0; *(uint16_t*)0x20000000028a = 4; *(uint16_t*)0x20000000028c = 0; *(uint16_t*)0x20000000028e = 0; *(uint16_t*)0x200000000290 = 0xc; *(uint16_t*)0x200000000292 = 1; *(uint16_t*)0x200000000294 = 0x1002; *(uint8_t*)0x200000000296 = 0xfd; *(uint8_t*)0x200000000297 = 0; *(uint16_t*)0x200000000298 = 0x1004; *(uint8_t*)0x20000000029a = 0; *(uint8_t*)0x20000000029b = 0; *(uint64_t*)0x200000000308 = 0x5c; *(uint64_t*)0x200000000818 = 1; *(uint64_t*)0x200000000820 = 0; *(uint64_t*)0x200000000828 = 0; *(uint32_t*)0x200000000830 = 0; syscall(__NR_sendmsg, /*fd=*/r[0], /*msg=*/0x200000000800ul, /*f=*/0ul); // write$tun arguments: [ // fd: fd_tun (resource) // buf: ptr[inout, array[ANYUNION]] { // array[ANYUNION] { // } // } // count: len = 0x20 (8 bytes) // ] syscall(__NR_write, /*fd=*/r[1], /*buf=*/0x200000000500ul, /*count=*/0x20ul); return 0; }