// https://syzkaller.appspot.com/bug?id=9f5e943f839929eb46b9cba915395f61d617a4b2 // 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 = 0xffffffffffffff9c (8 bytes) // file: ptr[in, buffer] { // buffer: {2f 64 65 76 2f 6e 65 74 6d 61 70 00} (length 0xc) // } // flags: open_flags = 0x400 (8 bytes) // mode: const = 0x0 (8 bytes) // ] // returns fd_netmap memcpy((void*)0x200000000380, "/dev/netmap\000", 12); res = syscall(SYS_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x200000000380ul, /*flags=O_TRUNC*/ 0x400ul, /*mode=*/0ul); if (res != -1) r[0] = res; // ioctl$NIOCCTRL arguments: [ // fd: fd_netmap (resource) // cmd: const = 0xc0586997 (8 bytes) // arg: ptr[inout, nmreq_header] { // nmreq_header { // nr_version: const = 0xe (2 bytes) // nr_reqtype: netmap_req_types = 0x5 (2 bytes) // nr_reserved: const = 0x0 (4 bytes) // nr_name: buffer: {00 00 00 00 0c e4 6c fd aa 68 c0 72 e2 50 61 98 27 // 90 e2 14 28 5d a3 c7 62 a2 fd 6c e4 75 0f 3c 77 cb 2d 81 93 50 f3 00 // 74 0b 00 20 fa 04 31 f6 8d 80 39 00 00 00 00 00 00 00 00 00 00 00 00 // 00} (length 0x40) nr_options: nil nr_body: ptr[inout, nmreq_body] { // union nmreq_body { // vale_list: nmreq_vale_list { // nr_bridge_idx: int16 = 0x5 (2 bytes) // pad1: const = 0x0 (2 bytes) // nr_port_idx: int32 = 0x80000001 (4 bytes) // } // } // } // } // } // ] *(uint16_t*)0x200000000100 = 0xe; *(uint16_t*)0x200000000102 = 5; *(uint32_t*)0x200000000104 = 0; memcpy((void*)0x200000000108, "\x00\x00\x00\x00\x0c\xe4\x6c\xfd\xaa\x68\xc0\x72\xe2\x50\x61\x98\x27" "\x90\xe2\x14\x28\x5d\xa3\xc7\x62\xa2\xfd\x6c\xe4\x75\x0f\x3c\x77\xcb" "\x2d\x81\x93\x50\xf3\x00\x74\x0b\x00\x20\xfa\x04\x31\xf6\x8d\x80\x39" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 64); *(uint64_t*)0x200000000148 = 0; *(uint64_t*)0x200000000150 = 0x2000000000c0; *(uint16_t*)0x2000000000c0 = 5; *(uint16_t*)0x2000000000c2 = 0; *(uint32_t*)0x2000000000c4 = 0x80000001; syscall(SYS_ioctl, /*fd=*/r[0], /*cmd=*/0xc0586997ul, /*arg=*/0x200000000100ul); } 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; }