// https://syzkaller.appspot.com/bug?id=acc91fc5738dacbfaa1163219fc6bf0685224b60 // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include static long syz_open_pts(volatile long a0, volatile long a1) { int ptyno = 0; if (ioctl(a0, TIOCGPTN, &ptyno)) return -1; char buf[128]; sprintf(buf, "/dev/pts/%d", ptyno); return open(buf, a1, 0); } uint64_t r[2] = {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*)0x20000080, "/dev/ptmx\000", 10); res = syscall(__NR_openat, 0xffffffffffffff9cul, 0x20000080ul, 0x80000000000a01ul, 0ul); if (res != -1) r[0] = res; syscall(__NR_ioctl, r[0], 0x5403, 0ul); syscall(__NR_write, r[0], 0x200000c0ul, 0xffffff78ul); res = -1; res = syz_open_pts(r[0], 0); if (res != -1) r[1] = res; syscall(__NR_readv, r[1], 0ul, 0ul); return 0; }