// https://syzkaller.appspot.com/bug?id=3f01234c57305ddc8d7e5ee9a5cde314217977d7 // 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[1] = {0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0); long res = 0; memcpy((void*)0x20dec000, "smaps\x00", 6); res = syz_open_procfs(0, 0x20dec000); if (res != -1) r[0] = res; *(uint64_t*)0x20b58000 = 0x200000; syscall(__NR_sendfile, r[0], r[0], 0x20b58000, 0xffff); return 0; }