// https://syzkaller.appspot.com/bug?id=3e60a26f8743c540eb99e5ea5b404d0346c6a325 // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include uint64_t r[2] = {0xffffffffffffffff, 0xffffffffffffffff}; int main(void) { syscall(SYS_mmap, /*addr=*/0x200000000000ul, /*len=*/0x1000000ul, /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/ 7ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x1012ul, /*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)) { } // openat$netmap arguments: [ // fd: const = 0xffffff9c (8 bytes) // file: ptr[in, buffer] { // buffer: {2f 64 65 76 2f 6e 65 74 6d 61 70 00} (length 0xc) // } // flags: open_flags = 0x8 (8 bytes) // mode: const = 0x0 (8 bytes) // ] // returns fd_netmap memcpy((void*)0x200000000480, "/dev/netmap\000", 12); res = syscall(SYS_openat, /*fd=*/0xffffff9cul, /*file=*/0x200000000480ul, /*flags=O_APPEND*/ 8ul, /*mode=*/0ul); if (res != -1) r[0] = res; // ioctl$NIOCREGIF arguments: [ // fd: fd_netmap (resource) // cmd: const = 0xc03c6992 (8 bytes) // arg: ptr[inout, nmreq] { // nmreq { // nr_name: buffer: {22 83 92 e9 00 00 00 00 81 00 00 00 00 00 f0 00} // (length 0x10) nr_version: int32 = 0x7fffffff (4 bytes) nr_offset: // int32 = 0x5 (4 bytes) nr_memsize: int32 = 0x6 (4 bytes) nr_tx_slots: // int32 = 0x3 (4 bytes) nr_rx_slots: int32 = 0x1 (4 bytes) // nr_tx_rings: int16 = 0x2 (2 bytes) // nr_rx_rings: int16 = 0xb (2 bytes) // nr_ringid: nmreq_register_ringid = 0x9fff (2 bytes) // nr_cmd: nmreq_nr_cmds = 0x0 (2 bytes) // nr_arg1: int16 = 0xd (2 bytes) // nr_arg2: int16 = 0x1 (2 bytes) // nr_arg3: int32 = 0x2068734c (4 bytes) // nr_flags: nmreq_register_modes = 0x6 (4 bytes) // spare2: array[int32] { // int32 = 0xfffffffe (4 bytes) // } // } // } // ] memcpy((void*)0x2000000004c0, "\x22\x83\x92\xe9\x00\x00\x00\x00\x81\x00\x00\x00\x00\x00\xf0\x00", 16); *(uint32_t*)0x2000000004d0 = 0x7fffffff; *(uint32_t*)0x2000000004d4 = 5; *(uint32_t*)0x2000000004d8 = 6; *(uint32_t*)0x2000000004dc = 3; *(uint32_t*)0x2000000004e0 = 1; *(uint16_t*)0x2000000004e4 = 2; *(uint16_t*)0x2000000004e6 = 0xb; *(uint16_t*)0x2000000004e8 = 0x9fff; *(uint16_t*)0x2000000004ea = 0; *(uint16_t*)0x2000000004ec = 0xd; *(uint16_t*)0x2000000004ee = 1; *(uint32_t*)0x2000000004f0 = 0x2068734c; *(uint32_t*)0x2000000004f4 = 6; *(uint32_t*)0x2000000004f8 = 0xfffffffe; syscall(SYS_ioctl, /*fd=*/r[0], /*cmd=*/0xc03c6992ul, /*arg=*/0x2000000004c0ul); // openat$netmap arguments: [ // fd: const = 0xffffff9c (8 bytes) // file: ptr[in, buffer] { // buffer: {2f 64 65 76 2f 6e 65 74 6d 61 70 00} (length 0xc) // } // flags: open_flags = 0x80000 (8 bytes) // mode: const = 0x0 (8 bytes) // ] // returns fd_netmap memcpy((void*)0x200000000480, "/dev/netmap\000", 12); res = syscall(SYS_openat, /*fd=*/0xffffff9cul, /*file=*/0x200000000480ul, /*flags=O_TTY_INIT*/ 0x80000ul, /*mode=*/0ul); if (res != -1) r[1] = res; // ioctl$NIOCREGIF arguments: [ // fd: fd_netmap (resource) // cmd: const = 0xc03c6992 (8 bytes) // arg: ptr[inout, nmreq] { // nmreq { // nr_name: buffer: {22 83 92 e9 00 00 00 00 81 00 00 00 00 00 f0 00} // (length 0x10) nr_version: int32 = 0x7fffffff (4 bytes) nr_offset: // int32 = 0x800 (4 bytes) nr_memsize: int32 = 0x6 (4 bytes) // nr_tx_slots: int32 = 0x1 (4 bytes) // nr_rx_slots: int32 = 0xc (4 bytes) // nr_tx_rings: int16 = 0x1 (2 bytes) // nr_rx_rings: int16 = 0x13 (2 bytes) // nr_ringid: nmreq_register_ringid = 0x1fff (2 bytes) // nr_cmd: nmreq_nr_cmds = 0x0 (2 bytes) // nr_arg1: int16 = 0x19 (2 bytes) // nr_arg2: int16 = 0x1 (2 bytes) // nr_arg3: int32 = 0x9 (4 bytes) // nr_flags: nmreq_register_modes = 0x1 (4 bytes) // spare2: array[int32] { // int32 = 0xfffffffd (4 bytes) // } // } // } // ] memcpy((void*)0x200000000080, "\x22\x83\x92\xe9\x00\x00\x00\x00\x81\x00\x00\x00\x00\x00\xf0\x00", 16); *(uint32_t*)0x200000000090 = 0x7fffffff; *(uint32_t*)0x200000000094 = 0x800; *(uint32_t*)0x200000000098 = 6; *(uint32_t*)0x20000000009c = 1; *(uint32_t*)0x2000000000a0 = 0xc; *(uint16_t*)0x2000000000a4 = 1; *(uint16_t*)0x2000000000a6 = 0x13; *(uint16_t*)0x2000000000a8 = 0x1fff; *(uint16_t*)0x2000000000aa = 0; *(uint16_t*)0x2000000000ac = 0x19; *(uint16_t*)0x2000000000ae = 1; *(uint32_t*)0x2000000000b0 = 9; *(uint32_t*)0x2000000000b4 = 1; *(uint32_t*)0x2000000000b8 = 0xfffffffd; syscall(SYS_ioctl, /*fd=*/r[1], /*cmd=*/0xc03c6992ul, /*arg=*/0x200000000080ul); return 0; }