// https://syzkaller.appspot.com/bug?id=c2283e736a6077d20ce01c9cfcdc5e85473f5162 // 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[2] = {0xffffffffffffffff, 0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0); long res = 0; res = syscall(__NR_socket, 0xa, 1, 0); if (res != -1) r[0] = res; *(uint32_t*)0x20000200 = 1; syscall(__NR_setsockopt, r[0], 6, 0x13, 0x20000200, 4); *(uint16_t*)0x20000340 = 0xa; *(uint16_t*)0x20000342 = htobe16(0); *(uint32_t*)0x20000344 = htobe32(0); memcpy((void*)0x20000348, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 16); *(uint32_t*)0x20000358 = 0; syscall(__NR_connect, r[0], 0x20000340, 0x1c); memcpy((void*)0x200000c0, "tls\000", 4); syscall(__NR_setsockopt, r[0], 6, 0x1f, 0x200000c0, 4); *(uint16_t*)0x20000100 = 0x303; *(uint16_t*)0x20000102 = 0x33; syscall(__NR_setsockopt, r[0], 0x11a, 1, 0x20000100, 0x28); *(uint64_t*)0x200005c0 = 0; *(uint32_t*)0x200005c8 = 0; *(uint64_t*)0x200005d0 = 0x20000580; *(uint64_t*)0x20000580 = 0x20000540; *(uint32_t*)0x20000540 = 0x1c; *(uint16_t*)0x20000544 = 0; *(uint16_t*)0x20000546 = 0; *(uint32_t*)0x20000548 = 0; *(uint32_t*)0x2000054c = 0; *(uint8_t*)0x20000550 = 1; *(uint8_t*)0x20000551 = 0; *(uint16_t*)0x20000552 = 0; *(uint32_t*)0x20000554 = 0; *(uint16_t*)0x20000558 = 0xf; *(uint16_t*)0x2000055a = 0; *(uint64_t*)0x20000588 = 0x1c; *(uint64_t*)0x200005d8 = 1; *(uint64_t*)0x200005e0 = 0; *(uint64_t*)0x200005e8 = 0; *(uint32_t*)0x200005f0 = 0; syscall(__NR_sendmsg, r[0], 0x200005c0, 0); memcpy((void*)0x20000080, "pagemap\000", 8); res = syz_open_procfs(0, 0x20000080); if (res != -1) r[1] = res; syscall(__NR_sendfile, r[0], r[1], 0, 0x10010); return 0; }