// https://syzkaller.appspot.com/bug?id=10a496c6a8e717bd6d0ee9991dae257841ac9163 // autogenerated by syzkaller (http://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #define BITMASK_LEN(type, bf_len) (type)((1ull << (bf_len)) - 1) #define BITMASK_LEN_OFF(type, bf_off, bf_len) \ (type)(BITMASK_LEN(type, (bf_len)) << (bf_off)) #define STORE_BY_BITMASK(type, addr, val, bf_off, bf_len) \ if ((bf_off) == 0 && (bf_len) == 0) { \ *(type*)(addr) = (type)(val); \ } else { \ type new_val = *(type*)(addr); \ new_val &= ~BITMASK_LEN_OFF(type, (bf_off), (bf_len)); \ new_val |= ((type)(val)&BITMASK_LEN(type, (bf_len))) << (bf_off); \ *(type*)(addr) = new_val; \ } static uintptr_t syz_open_pts(uintptr_t a0, uintptr_t 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); } static void execute_one(); extern unsigned long long procid; void loop() { while (1) { execute_one(); } } #ifndef __NR_renameat2 #define __NR_renameat2 316 #endif #ifndef __NR_bpf #define __NR_bpf 321 #endif uint64_t r[6] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; unsigned long long procid; void execute_one() { long res = 0; memcpy((void*)0x20000080, "/dev/dsp", 9); res = syscall(__NR_openat, 0xffffffffffffff9c, 0x20000080, 0x2900, 0); if (res != -1) r[0] = res; syscall(__NR_read, r[0], 0x20000100, 0x1000); syscall(__NR_epoll_create, 0xfffffc01); *(uint64_t*)0x20000180 = 0x20ffc000; *(uint64_t*)0x20000188 = 0x4000; *(uint64_t*)0x20000190 = 1; *(uint64_t*)0x20000198 = 0; syscall(__NR_ioctl, -1, 0xc020aa00, 0x20000180); *(uint32_t*)0x203b9fdc = 0; *(uint32_t*)0x203b9fe0 = 0; *(uint32_t*)0x203b9fe4 = 0; *(uint32_t*)0x203b9fe8 = 0; *(uint8_t*)0x203b9fec = 0; *(uint8_t*)0x203b9fed = 0; *(uint8_t*)0x203b9fee = 0; *(uint8_t*)0x203b9fef = 0; *(uint32_t*)0x203b9ff0 = 0; *(uint32_t*)0x203b9ff4 = 0; *(uint32_t*)0x203b9ff8 = 0; *(uint32_t*)0x203b9ffc = 0; syscall(__NR_ioctl, -1, 0x40045431, 0x203b9fdc); *(uint32_t*)0x2074fffc = 3; syscall(__NR_setsockopt, -1, 6, 0x19, 0x2074fffc, 0x348); syscall(__NR_dup, -1); memcpy((void*)0x20000040, "./control", 10); syscall(__NR_mkdirat, -1, 0x20000040, 0); syscall(__NR_socket, 0xa, 0x1000000000002, 0); res = syscall(__NR_socket, 0xa, 0x1000000000002, 0); if (res != -1) r[1] = res; syscall(__NR_ioctl, r[1], 0x8912, 0x20000280); *(uint32_t*)0x200000c0 = -1; *(uint64_t*)0x200000c8 = 0x200001c0; *(uint64_t*)0x200000d0 = 0x20000240; *(uint64_t*)0x200000d8 = 1; syscall(__NR_bpf, 2, 0x200000c0, 0x20); *(uint32_t*)0x20000180 = 0xfffffee7; syscall(__NR_getsockopt, -1, 0x10d, 0x89, 0x20000100, 0x20000180); memcpy((void*)0x20000000, "\x69\x70\x36\x74\x6e\x6c\x30\x00\x00\x00\x00\x00\x00\x00\x00\x00", 16); syscall(__NR_setsockopt, -1, 1, 0x19, 0x20000000, 0x10); memcpy((void*)0x20000040, "/dev/infiniband/rdma_cm", 24); syscall(__NR_openat, 0xffffffffffffff9c, 0x20000040, 2, 0); syscall(__NR_ioctl, -1, 0x4000008912, 0x20000100); syscall(__NR_socket, 2, 3, 6); *(uint32_t*)0x20000080 = 0x80; syscall(__NR_accept, -1, 0x20000000, 0x20000080); *(uint32_t*)0x200002c0 = 0; *(uint32_t*)0x200002c4 = 0; *(uint16_t*)0x200002c8 = 0; syscall(__NR_setsockopt, -1, 0x84, 0x7d, 0x200002c0, 0xc); memcpy((void*)0x20039000, "./control", 10); res = syscall(__NR_open, 0x20039000, 0, 0); if (res != -1) r[2] = res; memcpy((void*)0x20025000, "./file0", 8); syscall(__NR_openat, r[2], 0x20025000, 0, 0); syscall(__NR_socket, 0xa, 0x1000000000002, 0); *(uint32_t*)0x20000180 = 0xfffffee7; syscall(__NR_getsockopt, -1, 0x10d, 0x89, 0x20000100, 0x20000180); syscall(__NR_ioctl, -1, 0x8912, 0x20000280); syscall(__NR_ioctl, -1, 0x8904, 0x200001c0); *(uint32_t*)0x20000140 = 4; syscall(__NR_getsockopt, -1, 0, 0xa, 0x200000c0, 0x20000140); memcpy((void*)0x20000140, "/dev/ptmx", 10); syscall(__NR_openat, 0xffffffffffffff9c, 0x20000140, 0, 0); *(uint32_t*)0x20000500 = 0; *(uint32_t*)0x20000504 = 0; *(uint32_t*)0x20000508 = 0; *(uint32_t*)0x2000050c = 0; *(uint32_t*)0x20000510 = 0; *(uint32_t*)0x20000514 = 0; *(uint32_t*)0x20000518 = 0; *(uint32_t*)0x2000051c = 0; memcpy((void*)0x20000520, "\x79\x27\xc6\x12\xd0\x9a\x3d\x66\x5a\x6d\xd1\x62\x50\x3f\x96\xeb\xd0" "\x9e\x81\x9e\x33\x58\x94\x8a\x18\x94\xff\x7e\xf2\xdb\x48\x2b\x41\x6d" "\xe2\x70\xf3\xc9\x4e\xa9\x81\x1f\x92\xb1\xdf\x95\x50\x79\xfb\x00\x1f" "\x83\x7b\x61\xa8\x40\xc3\x31\xea\xb1\x9c\x3f\xdd\xba", 64); memcpy((void*)0x20000560, "\xfa\xf3\x18\xba\x1d\xce\xaa\xdc\x63\xf0\x1e\x69" "\xcc\xe3\xc3\x10\xc6\x56\xbe\xb2\x8a\xaf\x25\x4a" "\xa8\x63\x66\x4e\xb3\x8b\xf7\x09", 32); *(uint64_t*)0x20000580 = 0; *(uint64_t*)0x20000588 = 0; *(uint32_t*)0x20000590 = 0; syscall(__NR_ioctl, -1, 0x4c02, 0x20000500); *(uint32_t*)0x20000300 = 0; *(uint32_t*)0x20000304 = 0x70; *(uint8_t*)0x20000308 = 0; *(uint8_t*)0x20000309 = 0; *(uint8_t*)0x2000030a = 0; *(uint8_t*)0x2000030b = 0; *(uint32_t*)0x2000030c = 0; *(uint64_t*)0x20000310 = 0; *(uint64_t*)0x20000318 = 0; *(uint64_t*)0x20000320 = 0; STORE_BY_BITMASK(uint64_t, 0x20000328, 0, 0, 1); STORE_BY_BITMASK(uint64_t, 0x20000328, 0, 1, 1); STORE_BY_BITMASK(uint64_t, 0x20000328, 0, 2, 1); STORE_BY_BITMASK(uint64_t, 0x20000328, 0, 3, 1); STORE_BY_BITMASK(uint64_t, 0x20000328, 0, 4, 1); STORE_BY_BITMASK(uint64_t, 0x20000328, 0, 5, 1); STORE_BY_BITMASK(uint64_t, 0x20000328, 0, 6, 1); STORE_BY_BITMASK(uint64_t, 0x20000328, 0, 7, 1); STORE_BY_BITMASK(uint64_t, 0x20000328, 0, 8, 1); STORE_BY_BITMASK(uint64_t, 0x20000328, 0, 9, 1); STORE_BY_BITMASK(uint64_t, 0x20000328, 0, 10, 1); STORE_BY_BITMASK(uint64_t, 0x20000328, 0, 11, 1); STORE_BY_BITMASK(uint64_t, 0x20000328, 0, 12, 1); STORE_BY_BITMASK(uint64_t, 0x20000328, 0, 13, 1); STORE_BY_BITMASK(uint64_t, 0x20000328, 0, 14, 1); STORE_BY_BITMASK(uint64_t, 0x20000328, 0, 15, 2); STORE_BY_BITMASK(uint64_t, 0x20000328, 0, 17, 1); STORE_BY_BITMASK(uint64_t, 0x20000328, 0, 18, 1); STORE_BY_BITMASK(uint64_t, 0x20000328, 0, 19, 1); STORE_BY_BITMASK(uint64_t, 0x20000328, 0, 20, 1); STORE_BY_BITMASK(uint64_t, 0x20000328, 0, 21, 1); STORE_BY_BITMASK(uint64_t, 0x20000328, 0, 22, 1); STORE_BY_BITMASK(uint64_t, 0x20000328, 0, 23, 1); STORE_BY_BITMASK(uint64_t, 0x20000328, 0, 24, 1); STORE_BY_BITMASK(uint64_t, 0x20000328, 0, 25, 1); STORE_BY_BITMASK(uint64_t, 0x20000328, 0, 26, 1); STORE_BY_BITMASK(uint64_t, 0x20000328, 0, 27, 1); STORE_BY_BITMASK(uint64_t, 0x20000328, 0, 28, 1); STORE_BY_BITMASK(uint64_t, 0x20000328, 0, 29, 35); *(uint32_t*)0x20000330 = 0; *(uint32_t*)0x20000334 = 0; *(uint64_t*)0x20000338 = 0; *(uint64_t*)0x20000340 = 0; *(uint64_t*)0x20000348 = 0; *(uint64_t*)0x20000350 = 0; *(uint32_t*)0x20000358 = 0; *(uint32_t*)0x2000035c = 0; *(uint64_t*)0x20000360 = 0; *(uint32_t*)0x20000368 = 0; *(uint16_t*)0x2000036c = 0; *(uint16_t*)0x2000036e = 0; syscall(__NR_ioctl, -1, 0x4008240b, 0x20000300); *(uint32_t*)0x205befdc = 0; *(uint32_t*)0x205befe0 = 0; *(uint32_t*)0x205befe4 = 0; *(uint32_t*)0x205befe8 = 0; *(uint8_t*)0x205befec = 0; *(uint8_t*)0x205befed = 0; *(uint8_t*)0x205befee = 0; *(uint8_t*)0x205befef = 0; *(uint32_t*)0x205beff0 = 0; *(uint32_t*)0x205beff4 = 0; *(uint32_t*)0x205beff8 = 0; *(uint32_t*)0x205beffc = 0; syscall(__NR_ioctl, -1, 0x40045431, 0x205befdc); syz_open_pts(-1, 0); syscall(__NR_mmap, 0x20001000, 0xa000, 0, 0x11, -1, 0); *(uint32_t*)0x20000440 = 0xc; syscall(__NR_getsockopt, -1, 0, 8, 0x20000400, 0x20000440); *(uint32_t*)0x20c86f88 = 2; *(uint32_t*)0x20c86f8c = 0x70; *(uint8_t*)0x20c86f90 = 0xfd; *(uint8_t*)0x20c86f91 = 0; *(uint8_t*)0x20c86f92 = 0; *(uint8_t*)0x20c86f93 = 0; *(uint32_t*)0x20c86f94 = 0; *(uint64_t*)0x20c86f98 = 0; *(uint64_t*)0x20c86fa0 = 0; *(uint64_t*)0x20c86fa8 = 0xe; STORE_BY_BITMASK(uint64_t, 0x20c86fb0, 0, 0, 1); STORE_BY_BITMASK(uint64_t, 0x20c86fb0, 0, 1, 1); STORE_BY_BITMASK(uint64_t, 0x20c86fb0, 0, 2, 1); STORE_BY_BITMASK(uint64_t, 0x20c86fb0, 0, 3, 1); STORE_BY_BITMASK(uint64_t, 0x20c86fb0, 0, 4, 1); STORE_BY_BITMASK(uint64_t, 0x20c86fb0, -1, 5, 1); STORE_BY_BITMASK(uint64_t, 0x20c86fb0, 0, 6, 1); STORE_BY_BITMASK(uint64_t, 0x20c86fb0, 0, 7, 1); STORE_BY_BITMASK(uint64_t, 0x20c86fb0, 0, 8, 1); STORE_BY_BITMASK(uint64_t, 0x20c86fb0, 0, 9, 1); STORE_BY_BITMASK(uint64_t, 0x20c86fb0, 0, 10, 1); STORE_BY_BITMASK(uint64_t, 0x20c86fb0, 0, 11, 1); STORE_BY_BITMASK(uint64_t, 0x20c86fb0, 0, 12, 1); STORE_BY_BITMASK(uint64_t, 0x20c86fb0, 0, 13, 1); STORE_BY_BITMASK(uint64_t, 0x20c86fb0, 0, 14, 1); STORE_BY_BITMASK(uint64_t, 0x20c86fb0, 0, 15, 2); STORE_BY_BITMASK(uint64_t, 0x20c86fb0, 0, 17, 1); STORE_BY_BITMASK(uint64_t, 0x20c86fb0, 0, 18, 1); STORE_BY_BITMASK(uint64_t, 0x20c86fb0, 0, 19, 1); STORE_BY_BITMASK(uint64_t, 0x20c86fb0, 0, 20, 1); STORE_BY_BITMASK(uint64_t, 0x20c86fb0, 0, 21, 1); STORE_BY_BITMASK(uint64_t, 0x20c86fb0, 0, 22, 1); STORE_BY_BITMASK(uint64_t, 0x20c86fb0, 0, 23, 1); STORE_BY_BITMASK(uint64_t, 0x20c86fb0, 0, 24, 1); STORE_BY_BITMASK(uint64_t, 0x20c86fb0, 0, 25, 1); STORE_BY_BITMASK(uint64_t, 0x20c86fb0, 0, 26, 1); STORE_BY_BITMASK(uint64_t, 0x20c86fb0, 0, 27, 1); STORE_BY_BITMASK(uint64_t, 0x20c86fb0, 0, 28, 1); STORE_BY_BITMASK(uint64_t, 0x20c86fb0, 0, 29, 35); *(uint32_t*)0x20c86fb8 = 0; *(uint32_t*)0x20c86fbc = 0; *(uint64_t*)0x20c86fc0 = 0x20000000; *(uint64_t*)0x20c86fc8 = 0; *(uint64_t*)0x20c86fd0 = 0; *(uint64_t*)0x20c86fd8 = 0; *(uint32_t*)0x20c86fe0 = 0; *(uint32_t*)0x20c86fe4 = 0; *(uint64_t*)0x20c86fe8 = 0; *(uint32_t*)0x20c86ff0 = 0; *(uint16_t*)0x20c86ff4 = 0; *(uint16_t*)0x20c86ff6 = 0; syscall(__NR_perf_event_open, 0x20c86f88, 0, 0, -1, 0); syscall(__NR_mmap, 0x20000000, 0x7000, 0x300000b, 0x32, -1, 0); res = syscall(__NR_socket, 0xa, 0x1000000000002, 0); if (res != -1) r[3] = res; memcpy((void*)0x20000140, "/dev/ptmx", 10); syscall(__NR_openat, 0xffffffffffffff9c, 0x20000140, 0, 0); syscall(__NR_fcntl, r[3], 0x409, 0); *(uint32_t*)0x2074fffc = 3; syscall(__NR_setsockopt, -1, 6, 0x19, 0x2074fffc, 0x348); res = syscall(__NR_dup, -1); if (res != -1) r[4] = res; *(uint32_t*)0x20000440 = r[4]; *(uint32_t*)0x20000444 = 0; *(uint32_t*)0x20000448 = 1; *(uint32_t*)0x2000044c = 2; *(uint64_t*)0x20000450 = 0x20000400; *(uint32_t*)0x20000458 = 2; syscall(__NR_bpf, 0x10, 0x20000440, 0x20); *(uint16_t*)0x20000180 = 0xa; *(uint16_t*)0x20000182 = htobe16(0x4e20); *(uint32_t*)0x20000184 = 0; *(uint64_t*)0x20000188 = htobe64(0); *(uint64_t*)0x20000190 = htobe64(1); *(uint32_t*)0x20000198 = 0; syscall(__NR_bind, -1, 0x20000180, 0x1c); *(uint32_t*)0x200003c0 = 0x1c; syscall(__NR_getpeername, -1, 0x20000380, 0x200003c0); *(uint64_t*)0x20000100 = 0; syscall(__NR_sendfile, r[4], -1, 0x20000100, 0x8000fffffffe); *(uint64_t*)0x20000080 = 0x20000040; memcpy((void*)0x20000040, "", 1); *(uint32_t*)0x20000088 = 0xffffff9c; syscall(__NR_bpf, 0x11, 0x20000080, 0x10); syscall(__NR_ioctl, -1, 0x8912, 0x20000280); syscall(__NR_write, -1, 0x200000c0, 0xfec9); memcpy((void*)0x2000dff6, "./control", 10); syscall(__NR_mkdir, 0x2000dff6, 0); memcpy((void*)0x20000080, "./control", 10); syscall(__NR_fchownat, -1, 0x20000080, 0, 0, 0); memcpy((void*)0x20025000, "./file0", 8); res = syscall(__NR_openat, -1, 0x20025000, 0x400, 0); if (res != -1) r[5] = res; memcpy((void*)0x20000040, "./control", 10); syscall(__NR_mkdirat, r[5], 0x20000040, 0); memcpy((void*)0x20bee000, "./control", 10); memcpy((void*)0x2003a000, "./control", 10); syscall(__NR_renameat2, r[5], 0x20bee000, -1, 0x2003a000, 0); } int main() { syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0); for (procid = 0; procid < 8; procid++) { if (fork() == 0) { for (;;) { loop(); } } } sleep(1000000); return 0; }