// https://syzkaller.appspot.com/bug?id=bdf08cae172f0f4572f6559e7d64f13fbebb708a // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include static long syz_open_procfs(volatile long a0, volatile long a1) { char buf[128]; memset(buf, 0, sizeof(buf)); if (a0 == 0) { snprintf(buf, sizeof(buf), "/proc/self/%s", (char*)a1); } else if (a0 == -1) { snprintf(buf, sizeof(buf), "/proc/thread-self/%s", (char*)a1); } else { snprintf(buf, sizeof(buf), "/proc/self/task/%d/%s", (int)a0, (char*)a1); } int fd = open(buf, O_RDWR); if (fd == -1) fd = open(buf, O_RDONLY); return fd; } uint64_t r[3] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, 0x1ffff000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul); syscall(__NR_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x32ul, -1, 0ul); syscall(__NR_mmap, 0x21000000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul); intptr_t res = 0; memcpy((void*)0x20000100, "syscall\000", 8); syz_open_procfs(0, 0x20000100); res = syscall(__NR_socket, 0x10ul, 3ul, 0); if (res != -1) r[0] = res; res = syscall(__NR_socket, 1ul, 3ul, 0); if (res != -1) r[1] = res; *(uint32_t*)0x200002c0 = 0x14; res = syscall(__NR_getsockname, r[1], 0x20000100ul, 0x200002c0ul); if (res != -1) r[2] = *(uint32_t*)0x20000104; *(uint64_t*)0x20000080 = 0; *(uint32_t*)0x20000088 = 0; *(uint64_t*)0x20000090 = 0x20000000; *(uint64_t*)0x20000000 = 0x200004c0; memcpy((void*)0x200004c0, "\x80\x00\x00\x00\x10\x00\xdb\xdf\x25\xf1\x1f\x00\x00\x00\x00\x00\x00" "\x00\x00\x10", 20); *(uint32_t*)0x200004d4 = r[2]; memcpy((void*)0x200004d8, "\x00\x00\x00\x00\x00\x00\x00\x00\x58\x00\x12\x80\x0b\x00\x01\x00\x62" "\x61\x74\x61\x64\x76\x00\x00\x48\x00\x02\x80\x0d\x00\x01\x00\x42\x41" "\x54\x4d\x41\x4e\x5f\x49\x56\x00\x00\x00\x0c\x00\x01\x00\x42\x41\x54" "\x4d\x41\x4e\x5f\x56\x0d\x00\x01\x00\x42\x41\x54\x4d\x41\x4e\x5f\x49" "\x56\x00\x00\x00\x0c\x00\x01\x00\x42\x41\x54\x4d\x41\x4e\x5f\x56\x0c" "\x00\x01\x00\x42\x41\x54\x4d\x41\x4e\x5f\x56\x08\x00\x03\x00", 100); *(uint32_t*)0x2000053c = r[2]; *(uint64_t*)0x20000008 = 0x80; *(uint64_t*)0x20000098 = 1; *(uint64_t*)0x200000a0 = 0; *(uint64_t*)0x200000a8 = 0; *(uint32_t*)0x200000b0 = 0x28044084; syscall(__NR_sendmsg, r[0], 0x20000080ul, 0x4040000ul); return 0; }