// https://syzkaller.appspot.com/bug?id=17cceb3c3086b0fcc8252096ca5dc980d58202a2 // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include const int kInitNetNsFd = 201; static long syz_init_net_socket(volatile long domain, volatile long type, volatile long proto) { return syscall(__NR_socket, domain, type, proto); } uint64_t r[2] = {0xffffffffffffffff, 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)) { } // mkdirat arguments: [ // fd: fd_dir (resource) // path: ptr[in, buffer] { // buffer: {2e 2f 64 65 62 75 67 00} (length 0x8) // } // mode: open_mode = 0x1ff (8 bytes) // ] memcpy((void*)0x200000000000, "./debug\000", 8); syscall( __NR_mkdirat, /*fd=*/0xffffff9c, /*path=*/0x200000000000ul, /*mode=S_IXOTH|S_IWOTH|S_IROTH|S_IXGRP|S_IWGRP|S_IRGRP|S_IXUSR|S_IWUSR|0x100*/ 0x1fful); // mount arguments: [ // src: nil // dst: ptr[in, buffer] { // buffer: {2e 2f 64 65 62 75 67 00} (length 0x8) // } // type: ptr[in, buffer] { // buffer: {64 65 62 75 67 66 73 00} (length 0x8) // } // flags: mount_flags = 0x0 (8 bytes) // data: nil // ] memcpy((void*)0x2000000000c0, "./debug\000", 8); memcpy((void*)0x200000000100, "debugfs\000", 8); syscall(__NR_mount, /*src=*/0ul, /*dst=*/0x2000000000c0ul, /*type=*/0x200000000100ul, /*flags=*/0ul, /*data=*/0ul); // openat arguments: [ // fd: fd_dir (resource) // file: ptr[in, buffer] { // buffer: {2e 2f 64 65 62 75 67 2f 64 79 6e 61 6d 69 63 5f 64 65 62 75 // 67 2f 63 6f 6e 74 72 6f 6c 00} (length 0x1e) // } // flags: open_flags = 0x2 (4 bytes) // mode: open_mode = 0x0 (2 bytes) // ] // returns fd memcpy((void*)0x200000000400, "./debug/dynamic_debug/control\000", 30); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000400ul, /*flags=O_RDWR*/ 2, /*mode=*/0); if (res != -1) r[0] = res; // write arguments: [ // fd: fd (resource) // buf: ptr[in, buffer] { // buffer: {20 2b 70 0a 00 00 00 00 00 00 00 00 00 00 00 00 00 00} // (length 0x12) // } // count: len = 0x12 (8 bytes) // ] memcpy((void*)0x200000000500, " +p\n\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 18); syscall(__NR_write, /*fd=*/r[0], /*buf=*/0x200000000500ul, /*count=*/0x12ul); // syz_init_net_socket$nfc_llcp arguments: [ // domain: const = 0x27 (8 bytes) // type: nfc_llcp_type = 0x2 (8 bytes) // proto: const = 0x1 (8 bytes) // ] // returns sock_nfc_llcp res = -1; res = syz_init_net_socket(/*domain=*/0x27, /*type=SOCK_DGRAM*/ 2, /*proto=*/1); if (res != -1) r[1] = res; // bind$nfc_llcp arguments: [ // fd: sock_nfc_llcp (resource) // addr: ptr[in, sockaddr_nfc_llcp] { // sockaddr_nfc_llcp { // family: const = 0x27 (2 bytes) // pad = 0x0 (2 bytes) // devidx: nfc_dev_id (resource) // target: int32 = 0xfffffffe (4 bytes) // nfc_protocol: nfc_proto = 0x4 (4 bytes) // dsap: int8 = 0x0 (1 bytes) // ssap: int8 = 0x1 (1 bytes) // service_name: buffer: {d9 29 84 bd 1c a4 4c 22 6a f5 16 0e 96 17 11 // a0 77 60 94 75 b7 84 11 e8 85 09 de 05 00 00 00 00 00 f2 17 0e 65 e3 // f5 03 27 e4 22 00 00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 19 00 // 00 00} (length 0x3f) pad = 0x0 (7 bytes) servlen: intptr = 0x1c (8 // bytes) // } // } // addrlen: len = 0x60 (8 bytes) // ] *(uint16_t*)0x200000001040 = 0x27; *(uint32_t*)0x200000001044 = 0; *(uint32_t*)0x200000001048 = 0xfffffffe; *(uint32_t*)0x20000000104c = 4; *(uint8_t*)0x200000001050 = 0; *(uint8_t*)0x200000001051 = 1; memcpy((void*)0x200000001052, "\xd9\x29\x84\xbd\x1c\xa4\x4c\x22\x6a\xf5\x16\x0e\x96\x17\x11\xa0\x77" "\x60\x94\x75\xb7\x84\x11\xe8\x85\x09\xde\x05\x00\x00\x00\x00\x00\xf2" "\x17\x0e\x65\xe3\xf5\x03\x27\xe4\x22\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x02\x00\x00\x00\x00\x00\x19\x00\x00\x00", 63); *(uint64_t*)0x200000001098 = 0x1c; syscall(__NR_bind, /*fd=*/r[1], /*addr=*/0x200000001040ul, /*addrlen=*/0x60ul); return 0; }