// https://syzkaller.appspot.com/bug?id=39e1cc9035d26196c29d3a2ff92a7b75f3b5c6d9 // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #define USLEEP_FORKED_CHILD (3 * 50 * 1000) static long handle_clone_ret(long ret) { if (ret != 0) { return ret; } usleep(USLEEP_FORKED_CHILD); syscall(__NR_exit, 0); while (1) { } } static long syz_clone(volatile long flags, volatile long stack, volatile long stack_len, volatile long ptid, volatile long ctid, volatile long tls) { long sp = (stack + stack_len) & ~15; long ret = (long)syscall(__NR_clone, flags & ~CLONE_VM, sp, ptid, ctid, tls); return handle_clone_ret(ret); } uint64_t r[1] = {0x0}; 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; res = -1; res = syz_clone(0, 0, 0, 0, 0, 0); if (res != -1) r[0] = res; *(uint64_t*)0x20000000 = 0; *(uint64_t*)0x20000008 = 0; *(uint64_t*)0x20000440 = 0; *(uint64_t*)0x20000448 = 0; syscall(__NR_process_vm_writev, r[0], 0x20000000ul, 1ul, 0x20000440ul, 1ul, 0ul); return 0; }