// autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include uint64_t r[3] = {0xffffffffffffffff, 0xffffffffffffffff, 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)) { } // socket$packet arguments: [ // domain: const = 0x11 (8 bytes) // type: packet_socket_type = 0x3 (8 bytes) // proto: const = 0x300 (4 bytes) // ] // returns sock_packet res = syscall(__NR_socket, /*domain=*/0x11ul, /*type=SOCK_RAW*/ 3ul, /*proto=*/0x300); if (res != -1) r[0] = res; // setsockopt$packet_int arguments: [ // fd: sock_packet (resource) // level: const = 0x107 (4 bytes) // optname: packet_option_types_int = 0xf (4 bytes) // optval: ptr[in, int32] { // int32 = 0x2 (4 bytes) // } // optlen: len = 0x4 (8 bytes) // ] *(uint32_t*)0x200000000240 = 2; syscall(__NR_setsockopt, /*fd=*/r[0], /*level=*/0x107, /*optname=PACKET_VNET_HDR*/ 0xf, /*optval=*/0x200000000240ul, /*optlen=*/4ul); // setsockopt$packet_rx_ring arguments: [ // fd: sock_packet (resource) // level: const = 0x107 (4 bytes) // optname: const = 0x5 (4 bytes) // optval: ptr[in, tpacket_req_u] { // union tpacket_req_u { // req3: tpacket_req3 { // tp_block_size: int32 = 0x1000 (4 bytes) // tp_block_nr: int32 = 0x3a (4 bytes) // tp_frame_size: int32 = 0x1000 (4 bytes) // tp_frame_nr: int32 = 0x3a (4 bytes) // tp_retire_blk_tov: int32 = 0x0 (4 bytes) // tp_sizeof_priv: int32 = 0x0 (4 bytes) // tp_feature_req_word: int32 = 0x0 (4 bytes) // } // } // } // optlen: len = 0x1c (8 bytes) // ] *(uint32_t*)0x200000000040 = 0x1000; *(uint32_t*)0x200000000044 = 0x3a; *(uint32_t*)0x200000000048 = 0x1000; *(uint32_t*)0x20000000004c = 0x3a; *(uint32_t*)0x200000000050 = 0; *(uint32_t*)0x200000000054 = 0; *(uint32_t*)0x200000000058 = 0; syscall(__NR_setsockopt, /*fd=*/r[0], /*level=*/0x107, /*optname=*/5, /*optval=*/0x200000000040ul, /*optlen=*/0x1cul); // 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 = 0x40241 (4 bytes) // mode: const = 0x0 (2 bytes) // ] // returns fd_tun memcpy((void*)0x200000000000, "/dev/net/tun\000", 13); res = syscall( __NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x200000000000ul, /*flags=O_TRUNC|O_NOATIME|O_CREAT|O_WRONLY*/ 0x40241, /*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 31 00 00 00 00 00 00} // (length 0x10) elem: tun_setiff_flags = 0xc201 (2 bytes) pad = 0x0 // (22 bytes) // } // } // ] memcpy((void*)0x200000000200, "syzkaller1\000\000\000\000\000\000", 16); *(uint16_t*)0x200000000210 = 0xc201; syscall(__NR_ioctl, /*fd=*/r[1], /*cmd=*/0x400454ca, /*arg=*/0x200000000200ul); // socket$kcm arguments: [ // domain: const = 0x2 (8 bytes) // type: kcm_socket_type = 0xa (8 bytes) // proto: const = 0x2 (4 bytes) // ] // returns sock_kcm res = syscall(__NR_socket, /*domain=*/2ul, /*type=SOCK_DGRAM|0x8*/ 0xaul, /*proto=*/2); if (res != -1) r[2] = res; // ioctl$SIOCSIFHWADDR arguments: [ // fd: fd_tun (resource) // cmd: const = 0x8914 (4 bytes) // arg: ptr[in, ifreq_dev_t[devnames, mac_addr]] { // ifreq_dev_t[devnames, mac_addr] { // ifr_ifrn: buffer: {73 79 7a 6b 61 6c 6c 65 72 31 00 00 00 00 00 00} // (length 0x10) elem: union mac_addr { // link_local: mac_addr_link_local { // a0: const = 0x1 (1 bytes) // a1: const = 0x80 (1 bytes) // a2: const = 0xc2 (1 bytes) // a3: const = 0x0 (1 bytes) // a4: const = 0x0 (1 bytes) // a5: mac_addr_link_local_values = 0x0 (1 bytes) // } // } // pad = 0x0 (18 bytes) // } // } // ] memcpy((void*)0x200000000180, "syzkaller1\000\000\000\000\000\000", 16); *(uint8_t*)0x200000000190 = 1; *(uint8_t*)0x200000000191 = 0x80; *(uint8_t*)0x200000000192 = 0xc2; *(uint8_t*)0x200000000193 = 0; *(uint8_t*)0x200000000194 = 0; *(uint8_t*)0x200000000195 = 0; syscall(__NR_ioctl, /*fd=*/r[2], /*cmd=*/0x8914, /*arg=*/0x200000000180ul); // write$tun arguments: [ // fd: fd_tun (resource) // buf: ptr[inout, array[ANYUNION]] { // array[ANYUNION] { // union ANYUNION { // ANYBLOB: buffer: {1c 00 08 20 02 03 00 00 14} (length 0x9) // } // } // } // count: len = 0xfb5 (8 bytes) // ] memcpy((void*)0x200000002780, "\x1c\x00\x08\x20\x02\x03\x00\x00\x14", 9); syscall(__NR_write, /*fd=*/r[1], /*buf=*/0x200000002780ul, /*count=*/0xfb5ul); return 0; }