// https://syzkaller.appspot.com/bug?id=4f75167210501e91853d8baa350eb70278006d91 // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include static void sandbox_common() { if (setsid() == -1 && errno != EPERM) exit(1); struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 8 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 0; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); } static void loop(); static int do_sandbox_none(void) { sandbox_common(); loop(); return 0; } uint64_t r[1] = {0xffffffffffffffff}; void loop(void) { 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 = 0x80000 (8 bytes) // mode: const = 0x0 (8 bytes) // ] // returns fd_netmap memcpy((void*)0x200000000040, "/dev/netmap\000", 12); res = syscall(SYS_openat, /*fd=*/0xffffff9cul, /*file=*/0x200000000040ul, /*flags=O_TTY_INIT*/ 0x80000ul, /*mode=*/0ul); if (res != -1) r[0] = res; // socket$bt_sco arguments: [ // domain: const = 0x24 (8 bytes) // type: const = 0x5 (8 bytes) // protocol: const = 0x89 (1 bytes) // ] // returns sock_bt_sco syscall(SYS_socket, /*domain=*/0x24ul, /*type=*/5ul, /*protocol=*/0x89); // ioctl$NIOCREGIF arguments: [ // fd: fd_netmap (resource) // cmd: const = 0xc03c6992 (8 bytes) // arg: ptr[inout, nmreq] { // nmreq { // nr_name: buffer: {20 b5 40 c2 ca 25 6f b2 34 40 ec 5d db b9 1f 24} // (length 0x10) nr_version: int32 = 0x80000000 (4 bytes) nr_offset: // int32 = 0x5 (4 bytes) nr_memsize: int32 = 0xfffffffe (4 bytes) // nr_tx_slots: int32 = 0x20000001 (4 bytes) // nr_rx_slots: int32 = 0x100 (4 bytes) // nr_tx_rings: int16 = 0x8 (2 bytes) // nr_rx_rings: int16 = 0xfffe (2 bytes) // nr_ringid: nmreq_register_ringid = 0x1000 (2 bytes) // nr_cmd: nmreq_nr_cmds = 0x0 (2 bytes) // nr_arg1: int16 = 0x7 (2 bytes) // nr_arg2: int16 = 0x1 (2 bytes) // nr_arg3: int32 = 0x3 (4 bytes) // nr_flags: nmreq_register_modes = 0x5 (4 bytes) // spare2: array[int32] { // int32 = 0x1000 (4 bytes) // } // } // } // ] memcpy((void*)0x200000000180, "\x20\xb5\x40\xc2\xca\x25\x6f\xb2\x34\x40\xec\x5d\xdb\xb9\x1f\x24", 16); *(uint32_t*)0x200000000190 = 0x80000000; *(uint32_t*)0x200000000194 = 5; *(uint32_t*)0x200000000198 = 0xfffffffe; *(uint32_t*)0x20000000019c = 0x20000001; *(uint32_t*)0x2000000001a0 = 0x100; *(uint16_t*)0x2000000001a4 = 8; *(uint16_t*)0x2000000001a6 = 0xfffe; *(uint16_t*)0x2000000001a8 = 0x1000; *(uint16_t*)0x2000000001aa = 0; *(uint16_t*)0x2000000001ac = 7; *(uint16_t*)0x2000000001ae = 1; *(uint32_t*)0x2000000001b0 = 3; *(uint32_t*)0x2000000001b4 = 5; *(uint32_t*)0x2000000001b8 = 0x1000; syscall(SYS_ioctl, /*fd=*/r[0], /*cmd=*/0xc03c6992ul, /*arg=*/0x200000000180ul); } 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; do_sandbox_none(); return 0; }