// https://syzkaller.appspot.com/bug?id=61ff7a4853095272ca657f9c1e9e4f63f3154b14 // 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*)0x200000000000, "./debug\000", 8); memcpy((void*)0x200000000040, "debugfs\000", 8); syscall(__NR_mount, /*src=*/0ul, /*dst=*/0x200000000000ul, /*type=*/0x200000000040ul, /*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*)0x200000000080, "./debug/dynamic_debug/control\000", 30); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000080ul, /*flags=O_RDWR*/ 2, /*mode=*/0); if (res != -1) r[0] = res; // write arguments: [ // fd: fd (resource) // buf: ptr[in, buffer] { // buffer: {2b 70} (length 0x2) // } // count: len = 0x2 (8 bytes) // ] memcpy((void*)0x200000000100, "+p", 2); syscall(__NR_write, /*fd=*/r[0], /*buf=*/0x200000000100ul, /*count=*/2ul); // 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 = 0x1 (4 bytes) // nfc_protocol: nfc_proto = 0x5 (4 bytes) // dsap: int8 = 0x0 (1 bytes) // ssap: int8 = 0x6 (1 bytes) // service_name: buffer: {23 ba 4c b1 48 e2 7a 62 77 8a b6 e2 ad 47 e2 // f0 96 db ae 54 88 d8 38 16 1d a2 67 52 70 0a 99 3a 98 98 b7 53 ac bb // e0 30 34 a8 e6 48 7b ac 34 f3 e9 5e 88 aa aa fc 37 88 33 77 01 a4 cd // 90 bb} (length 0x3f) pad = 0x0 (7 bytes) servlen: intptr = 0x21 (8 // bytes) // } // } // addrlen: len = 0x60 (8 bytes) // ] *(uint16_t*)0x200000000280 = 0x27; *(uint32_t*)0x200000000284 = 0; *(uint32_t*)0x200000000288 = 1; *(uint32_t*)0x20000000028c = 5; *(uint8_t*)0x200000000290 = 0; *(uint8_t*)0x200000000291 = 6; memcpy((void*)0x200000000292, "\x23\xba\x4c\xb1\x48\xe2\x7a\x62\x77\x8a\xb6\xe2\xad\x47\xe2\xf0\x96" "\xdb\xae\x54\x88\xd8\x38\x16\x1d\xa2\x67\x52\x70\x0a\x99\x3a\x98\x98" "\xb7\x53\xac\xbb\xe0\x30\x34\xa8\xe6\x48\x7b\xac\x34\xf3\xe9\x5e\x88" "\xaa\xaa\xfc\x37\x88\x33\x77\x01\xa4\xcd\x90\xbb", 63); *(uint64_t*)0x2000000002d8 = 0x21; syscall(__NR_bind, /*fd=*/r[1], /*addr=*/0x200000000280ul, /*addrlen=*/0x60ul); return 0; }