// https://syzkaller.appspot.com/bug?id=a2f1f8000f41589e86e23e548e92e1d36ab46dd5 // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #ifndef __NR_bind #define __NR_bind 200 #endif #ifndef __NR_mkdirat #define __NR_mkdirat 34 #endif #ifndef __NR_mmap #define __NR_mmap 222 #endif #ifndef __NR_mount #define __NR_mount 40 #endif #ifndef __NR_openat #define __NR_openat 56 #endif #ifndef __NR_write #define __NR_write 64 #endif 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=*/0x1ffff000ul, /*len=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x20000000ul, /*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=*/0x21000000ul, /*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*)0x20000000, "./debug\000", 8); syscall( __NR_mkdirat, /*fd=*/0xffffff9c, /*path=*/0x20000000ul, /*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*)0x20000000, "./debug\000", 8); memcpy((void*)0x20000180, "debugfs\000", 8); syscall(__NR_mount, /*src=*/0ul, /*dst=*/0x20000000ul, /*type=*/0x20000180ul, /*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*)0x20000080, "./debug/dynamic_debug/control\000", 30); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x20000080ul, /*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*)0x20000100, "+p", 2); syscall(__NR_write, /*fd=*/r[0], /*buf=*/0x20000100ul, /*count=*/2ul); // syz_init_net_socket$nfc_llcp arguments: [ // domain: const = 0x27 (8 bytes) // type: nfc_llcp_type = 0x1 (8 bytes) // proto: const = 0x1 (8 bytes) // ] // returns sock_nfc_llcp res = -1; res = syz_init_net_socket(/*domain=*/0x27, /*type=SOCK_STREAM*/ 1, /*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 = 0xffffffffffffffff (4 bytes) // nfc_protocol: nfc_proto = 0x5 (4 bytes) // dsap: int8 = 0x0 (1 bytes) // ssap: int8 = 0x0 (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 = 0x11 (8 // bytes) // } // } // addrlen: len = 0x60 (8 bytes) // ] *(uint16_t*)0x20001040 = 0x27; *(uint32_t*)0x20001044 = 0; *(uint32_t*)0x20001048 = -1; *(uint32_t*)0x2000104c = 5; *(uint8_t*)0x20001050 = 0; *(uint8_t*)0x20001051 = 0; memcpy((void*)0x20001052, "\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*)0x20001098 = 0x11; syscall(__NR_bind, /*fd=*/r[1], /*addr=*/0x20001040ul, /*addrlen=*/0x60ul); return 0; }