// https://syzkaller.appspot.com/bug?id=6cfb3d27ad511ea8d780a457e881eada642d8da6 // 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, 0x0}; int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=*/0x32ul, /*fd=*/-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x20000000ul, /*len=*/0x1000000ul, /*prot=*/7ul, /*flags=*/0x32ul, /*fd=*/-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x21000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=*/0x32ul, /*fd=*/-1, /*offset=*/0ul); intptr_t res = 0; syscall(__NR_mmap, /*addr=*/0x20000000ul, /*len=*/0xff5000ul, /*prot=*/3ul, /*flags=*/0x200000005c831ul, /*fd=*/-1, /*offset=*/0ul); memcpy((void*)0x20000000, "pagemap\000", 8); res = -1; res = syz_open_procfs(/*pid=*/0, /*file=*/0x20000000); if (res != -1) r[0] = res; res = syscall(__NR_getpid); if (res != -1) r[1] = res; *(uint64_t*)0x20008400 = 0x20000300; *(uint64_t*)0x20008408 = 0x7ffff000; *(uint64_t*)0x20008410 = 0x20006180; *(uint64_t*)0x20008418 = 0x98; *(uint64_t*)0x20008640 = 0x20008480; *(uint64_t*)0x20008648 = 0x7ffff000; syscall(__NR_process_vm_readv, /*pid=*/r[1], /*loc_vec=*/0x20008400ul, /*loc_vlen=*/2ul, /*rem_vec=*/0x20008640ul, /*rem_vlen=*/0x286ul, /*flags=*/0ul); *(uint64_t*)0x20000040 = 0x60; *(uint64_t*)0x20000048 = 1; *(uint64_t*)0x20000050 = 0x20ff9000; *(uint64_t*)0x20000058 = 0x20ffc000; *(uint64_t*)0x20000060 = 0; *(uint64_t*)0x20000068 = 0; *(uint64_t*)0x20000070 = 0; *(uint64_t*)0x20000078 = 0; *(uint64_t*)0x20000080 = 0; *(uint64_t*)0x20000088 = 0; *(uint64_t*)0x20000090 = 2; *(uint64_t*)0x20000098 = 0; syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0xc0606610, /*arg=*/0x20000040ul); return 0; }