// https://syzkaller.appspot.com/bug?id=898819aa10260a468a0191c309b066cc36437d7d // 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(long a0, 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[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0); long res = 0; memcpy((void*)0x20000140, "stack", 6); res = syz_open_procfs(0, 0x20000140); if (res != -1) r[0] = res; res = syscall(__NR_socketpair, 1, 2, 0, 0x200000c0); if (res != -1) r[1] = *(uint32_t*)0x200000c0; syscall(__NR_sendfile, r[1], r[0], 0, 4); memcpy((void*)0x20000040, "./file0", 8); syscall(__NR_mknod, 0x20000040, 0x808000001040, 0); syscall(__NR_clone, 0x3102001ffe, 0, 0x9999999999999999, 0, -1); memcpy((void*)0x20000140, "./file0", 8); syscall(__NR_execve, 0x20000140, 0, 0); res = syscall(__NR_pipe2, 0x20000080, 0); if (res != -1) r[2] = *(uint32_t*)0x20000084; memcpy((void*)0x20000180, "/proc/self/net/pfkey", 21); res = syscall(__NR_openat, 0xffffffffffffff9c, 0x20000180, 0, 0); if (res != -1) r[3] = res; syscall(__NR_splice, r[3], 0, r[2], 0, 2, 0); return 0; }